/* ============================
   CSS Variables — coin.deeply Design System
   ============================ */
:root {
  --bg-body: #0b0f19;
  --bg-sidebar: #0d1117;
  --bg-card: #111827;
  --bg-card-hover: #151d2e;
  --bg-input: #1a2236;
  --bg-table-header: #0f1520;
  --bg-table-row-hover: #131b2a;
  --bg-badge: #1a2236;
  --bg-active: #1a2540;
  --border-color: #1e293b;
  --border-light: #263348;
  --border-subtle: #162032;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-green: #22c55e;
  --accent-green-dim: rgba(34, 197, 94, 0.12);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.12);
  --accent-orange: #f59e0b;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --transition-fast: 120ms ease;
  --sidebar-width: 200px;
  --topbar-height: 52px;
}

/* ============================
   Reset & Base
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
.hidden { display: none !important; }

/* ============================
   Top Navbar
   ============================ */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: var(--topbar-height);
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.logo-icon {
  width: 28px;
  height: 28px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text .logo-coin { color: var(--text-primary); }
.logo-text .logo-dot { color: var(--accent-blue); }

/* Network badge */
.network-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: var(--bg-badge);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--transition-fast);
}

.network-badge:hover { border-color: var(--border-light); }

.network-badge-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #28a0f0, #1b5eaa);
}

/* Connect Wallet */
.connect-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: background-color var(--transition-fast);
}

.connect-btn:hover { background-color: var(--accent-blue-hover); }

.connect-btn.connected {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
}

.settings-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-badge);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.settings-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* ============================
   App Layout
   ============================ */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

/* ============================
   Sidebar
   ============================ */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  flex: 1;
}

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

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

.sidebar-item.active {
  background-color: var(--bg-active);
  color: var(--text-primary);
}

.sidebar-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.sidebar-item.active .sidebar-icon { opacity: 1; }

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

.sidebar-footer .sidebar-item {
  color: var(--text-muted);
}

/* ============================
   Main Content
   ============================ */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
}

.page-section { display: none; }
.page-section.active { display: block; }

/* ============================
   Page Header
   ============================ */
.page-header { margin-bottom: 20px; }

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.page-subtitle a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================
   Filter Tabs + Search Bar
   ============================ */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.filter-tab:hover { color: var(--text-primary); background-color: var(--bg-card-hover); }
.filter-tab.active { background-color: var(--bg-active); color: var(--text-primary); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  min-width: 220px;
}

.search-box svg { flex-shrink: 0; color: var(--text-muted); }

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

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

/* ============================
   Data Table (shared)
   ============================ */
.data-table-wrap {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-table-header);
  white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text-secondary); }

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background-color: var(--bg-table-row-hover); }

/* Pool name cell */
.pool-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pool-star {
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.pool-star:hover, .pool-star.active { color: var(--accent-orange); }

.pool-tokens {
  position: relative;
  width: 40px;
  height: 32px;
  flex-shrink: 0;
}

.pool-coin-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  position: absolute;
  border: 2px solid var(--bg-card);
  background: var(--bg-card);
}
.pool-coin-logo:first-child { top: 0; left: 0; z-index: 2; }
.pool-coin-logo:last-child { bottom: 0; left: 14px; z-index: 1; }

.pool-token-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg-card);
}

.pool-token-icon:first-child { top: 0; left: 0; z-index: 2; }
.pool-token-icon:last-child { bottom: 0; right: 0; z-index: 1; }

.pool-token-icon.token-btc { background: linear-gradient(135deg, #f7931a, #c47a15); }
.pool-token-icon.token-eth { background: linear-gradient(135deg, #627eea, #3b5998); }
.pool-token-icon.token-usdc { background: linear-gradient(135deg, #2775ca, #1a5aa8); }
.pool-token-icon.token-sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.pool-token-icon.token-link { background: linear-gradient(135deg, #2a5ada, #1e40a0); }
.pool-token-icon.token-xrp { background: linear-gradient(135deg, #00aae4, #0077b6); }
.pool-token-icon.token-hype { background: linear-gradient(135deg, #00d897, #00a876); }
.pool-token-icon.token-xpl { background: linear-gradient(135deg, #6c5ce7, #4834d4); }
.pool-token-icon.token-oil { background: linear-gradient(135deg, #2d3436, #636e72); }
.pool-token-icon.token-weth { background: linear-gradient(135deg, #627eea, #3b5998); }

.pool-coin-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-primary);
}

.pool-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

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

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

.pool-tvl {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pool-tvl-main {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.3s ease;
}
.pool-tvl-main.flash-up { color: #22c55e; }
.pool-tvl-main.flash-down { color: #ef4444; }

.pool-tvl-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Mini sparkline */
.sparkline {
  width: 80px;
  height: 28px;
}

.sparkline svg { width: 100%; height: 100%; }

/* Details button */
.details-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

/* ============================
   Stats Page
   ============================ */
.stats-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stats-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stats-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.stats-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

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

.stats-row-label { color: var(--text-secondary); }
.stats-row-value { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-row-value.positive { color: var(--accent-green); }
.stats-row-value.negative { color: var(--accent-red); }

/* Tokens section */
.tokens-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.token-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
}

.token-card-info { display: flex; flex-direction: column; gap: 12px; }

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

.token-card-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-card-logo {
  width: 28px;
  height: 28px;
}

.token-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.buy-token-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.buy-token-btn:hover { border-color: var(--border-light); }

.token-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.token-card-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.token-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.token-stat-label { color: var(--text-secondary); }
.token-stat-value { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Donut chart */
.donut-chart {
  width: 140px;
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart svg { width: 100%; height: 100%; }

.donut-label {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

/* Buyback dashboard */
.buyback-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.buyback-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 4px;
}

.buyback-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.buyback-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.buyback-amount-sub {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.buyback-rate {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-green);
  font-variant-numeric: tabular-nums;
}

.buyback-chart {
  margin-top: 16px;
  height: 120px;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  gap: 2px;
}

/* ============================
   Leaderboard Page
   ============================ */
.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.lb-tabs {
  display: flex;
  gap: 4px;
}

.lb-tab {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.lb-tab:hover { color: var(--text-primary); background-color: var(--bg-card-hover); }
.lb-tab.active { background-color: var(--bg-active); color: var(--text-primary); }

.lb-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-filter-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  transition: all var(--transition-fast);
}

.lb-filter-btn:hover { color: var(--text-secondary); border-color: var(--border-light); }
.lb-filter-btn.active { color: var(--text-primary); border-color: var(--accent-blue); background-color: var(--accent-blue-dim, rgba(59,130,246,0.1)); }

.lb-table td { padding: 10px 16px; }

.rank-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

.rank-num.rank-1 { color: #fbbf24; }
.rank-num.rank-2 { color: #94a3b8; }
.rank-num.rank-3 { color: #d97706; }

/* Address avatar */
.addr-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.addr-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.addr-text {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--accent-blue);
}

.pnl-positive { color: var(--accent-green); font-weight: 600; }
.pnl-negative { color: var(--accent-red); font-weight: 600; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.page-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.page-btn.active { background-color: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

/* ============================
   Ecosystem Page
   ============================ */
.eco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.eco-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: border-color var(--transition-fast);
}

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

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

.eco-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.eco-chain-badges {
  display: flex;
  gap: 4px;
}

.chain-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chain-badge.arbitrum { background: linear-gradient(135deg, #28a0f0, #1b5eaa); }
.chain-badge.avalanche { background: linear-gradient(135deg, #e84142, #c0392b); }

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

.eco-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.eco-row-label { color: var(--text-muted); }
.eco-row-value { color: var(--accent-blue); }
.eco-row-value.about { color: var(--text-secondary); }

/* ============================
   Trade Page
   ============================ */
.trade-container {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
}

.market-bar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 12px;
}

.pair-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.pair-selector:hover { background-color: var(--bg-card-hover); }

.token-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.token-icon-sm.eth { background: linear-gradient(135deg, #627eea, #3b5998); }

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

.market-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.stat-item { display: flex; flex-direction: column; gap: 2px; }

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

.stat-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-value.positive { color: var(--accent-green); }
.stat-value.negative { color: var(--accent-red); }
td.positive { color: var(--accent-green); font-weight: 500; transition: opacity 0.3s; }
td.negative { color: var(--accent-red); font-weight: 500; transition: opacity 0.3s; }
td.positive.flash, td.negative.flash { opacity: 0.5; }

.chart-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  height: 480px;
  overflow: hidden;
  margin-bottom: 12px;
}

.chart-container > div { height: 100%; width: 100%; }

.positions-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px;
  position: relative;
  transition: color var(--transition-fast);
}

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

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  background-color: var(--accent-blue);
  border-radius: 1px;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background-color: var(--bg-input);
  border-radius: 9px;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.tab-content { position: relative; flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
}

.empty-state.hidden { display: none; }
.empty-state-icon { margin-bottom: 12px; opacity: 0.4; }

.positions-media-top {
  width: 100%;
  height: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.positions-media-top video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.positions-media-bottom {
  width: 100%;
  height: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.positions-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
}

.empty-state-overlay {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}

.empty-state-title { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-sub { font-size: 12px; color: var(--text-muted); }

/* Video + Image layout for positions */
#tab-positions {
  padding: 0;
  position: relative;
  flex: 1;
  overflow: hidden;
}
#tab-positions .empty-state-title,
#tab-positions .empty-state-sub { color: rgba(255,255,255,0.7); }

/* Order Form Panel */
.order-form-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  align-self: start;
  position: sticky;
  top: 72px;
}

.order-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  background-color: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px;
}

.type-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.type-btn:hover { color: var(--text-primary); }
.type-btn.long.active { background-color: var(--accent-green); color: #000; }
.type-btn.short.active { background-color: var(--accent-red); color: #fff; }
.type-btn.swap.active { background-color: var(--accent-blue); color: #fff; }

.form-group { margin-bottom: 16px; }

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

.field-header span:first-child { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

.balance-text { font-size: 12px; color: var(--text-muted); }
.balance-text strong { color: var(--text-secondary); font-weight: 600; }

.leverage-display {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-blue);
  font-variant-numeric: tabular-nums;
}

.input-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: border-color var(--transition-fast);
}

.input-box:focus-within { border-color: var(--accent-blue); }

.input-box input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  width: 100%;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.input-box input::placeholder { color: var(--text-muted); }
.input-box input::-webkit-inner-spin-button,
.input-box input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-box input[type=number] { -moz-appearance: textfield; }

.receive-box { opacity: 0.7; }
.receive-box input { cursor: default; }

.asset-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background-color: var(--bg-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
}

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

.asset-dot.usdc { background: linear-gradient(135deg, #2775ca, #1a5aa8); }
.asset-dot.eth { background: linear-gradient(135deg, #627eea, #3b5998); }

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

.slider-container { position: relative; padding-bottom: 20px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--accent-blue);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.slider-marks {
  display: flex;
  justify-content: space-between;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.slider-marks span { font-size: 10px; color: var(--text-muted); }

.leverage-presets { display: flex; gap: 6px; margin-top: 8px; }

.preset-btn {
  flex: 1;
  padding: 6px 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.preset-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.preset-btn.active { background-color: rgba(59,130,246,0.1); border-color: var(--accent-blue); color: var(--accent-blue); }

.order-summary {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.summary-row span:first-child { color: var(--text-secondary); }
.summary-row span:last-child { color: var(--text-primary); font-weight: 500; font-variant-numeric: tabular-nums; }
.summary-row.divider { border-top: 1px solid var(--border-color); margin: 6px 0; padding: 0; }

.highlight-danger { color: var(--accent-red) !important; font-weight: 600 !important; }
.highlight-green { color: var(--accent-green) !important; font-weight: 600 !important; }

.action-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.action-btn:hover { opacity: 0.9; }
.action-btn:active { transform: scale(0.99); }
.action-btn.long-bg { background-color: var(--accent-green); color: #000; }
.action-btn.short-bg { background-color: var(--accent-red); color: #fff; }
.action-btn.swap-bg { background-color: var(--accent-blue); color: #fff; }

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}

/* ============================
   Earn Page
   ============================ */
.earn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.earn-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.earn-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.earn-token-row { display: flex; align-items: center; gap: 12px; }

.earn-token-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.earn-token-desc { font-size: 12px; color: var(--text-secondary); }

.earn-apy { text-align: right; }
.earn-apy-label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.earn-apy-value { font-size: 20px; font-weight: 700; color: var(--accent-green); font-variant-numeric: tabular-nums; }

.earn-stats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.earn-stat { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.earn-stat-label { color: var(--text-secondary); }
.earn-stat-value { color: var(--text-primary); font-weight: 500; font-variant-numeric: tabular-nums; }

.earn-action-btn {
  width: 100%;
  padding: 12px;
  background-color: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: opacity var(--transition-fast);
}

.earn-action-btn:hover { opacity: 0.9; }

/* ============================
   Referrals Page
   ============================ */
.referral-container { display: flex; flex-direction: column; gap: 16px; }

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

.referral-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; }

.referral-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.referral-code {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-blue);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 1px;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.copy-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }

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

.referral-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.referral-stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.referral-stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.referral-stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }

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

.referral-info-card h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; }

.referral-steps { display: flex; flex-direction: column; gap: 16px; }

.referral-step { display: flex; align-items: flex-start; gap: 14px; }

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(59,130,246,0.12);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.referral-step h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.referral-step p { font-size: 13px; color: var(--text-secondary); }

/* ============================
   Announcements Page
   ============================ */
.announcements-list { display: flex; flex-direction: column; gap: 12px; }

.announcement-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color var(--transition-fast);
}

.announcement-item:hover { border-color: var(--border-light); }

.announcement-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.announcement-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-new { background-color: var(--accent-green-dim); color: var(--accent-green); }
.tag-update { background-color: rgba(59,130,246,0.12); color: var(--accent-blue); }
.tag-event { background-color: rgba(168,85,247,0.12); color: var(--accent-purple); }
.tag-security { background-color: var(--accent-red-dim); color: var(--accent-red); }

.announcement-date { font-size: 12px; color: var(--text-muted); }
.announcement-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.announcement-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ============================
   Footer
   ============================ */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 24px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links { display: flex; gap: 20px; }
.footer-link { font-size: 12px; color: var(--text-muted); transition: color var(--transition-fast); }
.footer-link:hover { color: var(--text-primary); }

.footer-stats { display: flex; gap: 24px; }
.footer-stat { display: flex; align-items: center; gap: 8px; }
.footer-stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.footer-stat-value { font-size: 13px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ============================
   Responsive
   ============================ */
@media (max-width: 1024px) {
  .sidebar { display: none; }
  .trade-container { grid-template-columns: 1fr; }
  .order-form-panel { position: static; }
  .market-bar { flex-wrap: wrap; gap: 12px; }
  .market-stats { flex-wrap: wrap; gap: 12px; }
  .stats-overview-grid { grid-template-columns: 1fr; }
  .tokens-section { grid-template-columns: 1fr; }
  .referral-stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .navbar { padding: 0 12px; }
  .main-content { padding: 12px; }
  .chart-container { height: 300px; }
  .footer-inner { flex-direction: column; gap: 12px; }
  .footer-stats { flex-wrap: wrap; justify-content: center; }
  .earn-grid, .eco-grid { grid-template-columns: 1fr; }
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
