:root {
  --bg-base: #0a0c14;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --bg-nav: #0d1117;
  --bg-input: #1e2739;
  --border: #1e293b;
  --border-light: #2d3a52;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99,102,241,0.15);

  --profit: #10b981;
  --profit-dim: rgba(16,185,129,0.15);
  --loss: #ef4444;
  --loss-dim: rgba(239,68,68,0.15);

  --yellow: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --orange: #f97316;
  --pink: #ec4899;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 8px 32px rgba(0,0,0,0.2);

  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  --nav-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* ── Navbar ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  backdrop-filter: blur(12px);
}

.nav-link-admin { color: var(--purple) !important; border: 1px solid rgba(139,92,246,.3); border-radius: var(--radius-sm); }
.nav-link-admin:hover { background: rgba(139,92,246,.15) !important; color: var(--purple) !important; }

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  white-space: nowrap;
}
.nav-brand i { color: var(--accent); font-size: 22px; }

.nav-links { display: flex; gap: 4px; flex: 1; }

.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 500;
  transition: all .2s;
}
.nav-link:hover, .nav-link.active {
  background: var(--accent-dim); color: var(--accent);
}

.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-username { color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 6px; }

.btn-logout {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-secondary); padding: 6px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px;
  transition: all .2s; font-family: var(--font-sans);
}
.btn-logout:hover { border-color: var(--loss); color: var(--loss); }

/* ── Main Content ── */
.main-content {
  margin-top: var(--nav-h);
  padding: 24px;
  max-width: 1400px;
  margin-left: auto; margin-right: auto;
}

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 {
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.page-header h1 i { color: var(--accent); }

.page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-header h2 i { color: var(--accent); }

.link-more {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.link-more:hover { color: var(--accent); }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stats-grid.sm { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card.lg {
  flex-direction: column; align-items: flex-start;
  padding: 24px; grid-column: span 2;
}

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(139,92,246,.15); color: var(--purple); }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: var(--blue); }
.stat-icon.green  { background: var(--profit-dim); color: var(--profit); }
.stat-icon.red    { background: var(--loss-dim); color: var(--loss); }
.stat-icon.orange { background: rgba(249,115,22,.15); color: var(--orange); }

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.stat-value.xl { font-size: 36px; }
.stat-value small { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.stat-sub { font-size: 14px; margin-top: 4px; }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.card-full { grid-column: 1 / -1; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.02); }

.data-table th, .data-table td { padding: 10px 12px; font-size: 12.5px; }

.mono { font-family: var(--font-mono); font-size: 13px; }
.small { font-size: 11.5px; }

/* ── Trade Type ── */
.trade-type {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.trade-type.buy  { background: var(--profit-dim); color: var(--profit); }
.trade-type.sell { background: var(--loss-dim); color: var(--loss); }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.badge-strong-buy  { background: rgba(16,185,129,.2); color: #10b981; border: 1px solid rgba(16,185,129,.3); }
.badge-buy         { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.2); }
.badge-hold        { background: rgba(245,158,11,.12); color: #f59e0b; border: 1px solid rgba(245,158,11,.2); }
.badge-sell        { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.badge-strong-sell { background: rgba(239,68,68,.2); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }

.mode-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.mode-badge.paper { background: rgba(59,130,246,.15); color: var(--blue); border: 1px solid rgba(59,130,246,.3); }
.mode-badge.live  { background: rgba(239,68,68,.15); color: var(--loss); border: 1px solid rgba(239,68,68,.3); }

.mode-tag { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.mode-tag.paper { background: rgba(59,130,246,.1); color: var(--blue); }
.mode-tag.live  { background: rgba(239,68,68,.1); color: var(--loss); }

/* ── Colors ── */
.text-profit { color: var(--profit); }
.text-loss   { color: var(--loss); }
.text-muted  { color: var(--text-muted); }

/* ── Signals ── */
.signals-list { padding: 8px 0; max-height: 420px; overflow-y: auto; }
.signal-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.signal-item:last-child { border-bottom: none; }
.signal-item:hover { background: rgba(255,255,255,.02); }
.signal-asset { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 12px; }
.signal-asset strong { font-size: 14px; }
.signal-asset small { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.signal-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pos-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.pos-badge i { font-size: 10px; }
.pos-held  { background: rgba(34,197,94,.14); color: #4ade80; border: 1px solid rgba(34,197,94,.28); }
.pos-watch { background: rgba(148,163,184,.10); color: var(--text-secondary); border: 1px solid rgba(148,163,184,.22); }
.age-fresh { color: #4ade80; }
.age-warm  { color: #f59e0b; }
.age-cold  { color: #ef4444; }
.signal-details { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.signal-price { font-size: 12px; color: var(--text-secondary); }
.confidence { font-size: 12px; font-family: var(--font-mono); color: var(--text-secondary); }
.signal-reason { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

/* ── AI Row ── */
.ai-row td { padding: 0; }
.ai-reasoning {
  padding: 8px 16px 12px 24px;
  font-size: 12px; color: var(--text-muted);
  background: rgba(99,102,241,.04);
  display: flex; gap: 8px; align-items: flex-start;
}
.ai-reasoning i { color: var(--accent); margin-top: 2px; flex-shrink: 0; }

/* ── Bot Toggle ── */
.bot-toggle-wrap { display: flex; align-items: center; gap: 10px; }
.bot-status { font-size: 12px; font-weight: 600; }
.bot-status.active  { color: var(--profit); }
.bot-status.inactive { color: var(--text-muted); }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch.sm { width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-light);
  border-radius: 99px; cursor: pointer;
  transition: background .25s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: transform .25s;
}
.toggle-switch.sm .toggle-slider::before { width: 14px; height: 14px; }
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch.sm input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Positions ── */
.positions-table, .positions-detail { padding: 8px 0; }
.position-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.position-card:last-child { border-bottom: none; }
.pos-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pos-asset { display: flex; align-items: center; gap: 12px; }
.pos-pnl { text-align: right; }
.pnl-usd { font-size: 16px; font-weight: 700; font-family: var(--font-mono); }
.pnl-pct { font-size: 12px; margin-top: 2px; }
.pos-details { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 10px; }
.pos-detail { display: flex; flex-direction: column; gap: 2px; }
.pos-detail span:first-child { font-size: 11px; color: var(--text-muted); }
.pos-detail span:last-child { font-family: var(--font-mono); font-size: 13px; }
.pos-bar { height: 4px; background: var(--border-light); border-radius: 99px; overflow: hidden; }
.pos-bar-fill { height: 100%; border-radius: 99px; transition: width .5s; }
.pos-bar-fill.profit { background: var(--profit); }
.pos-bar-fill.loss   { background: var(--loss); }

.asset-badge {
  padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.asset-badge.crypto { background: rgba(245,158,11,.15); color: var(--yellow); }
.asset-badge.stock  { background: rgba(59,130,246,.15); color: var(--blue); }

/* ── Trading Page ── */
.trading-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.asset-panel { height: calc(100vh - 140px); display: flex; flex-direction: column; }
.asset-list { flex: 1; overflow-y: auto; padding: 8px 0; }

.filter-tabs { display: flex; gap: 4px; }
.filter-btn {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: all .2s;
  font-family: var(--font-sans);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--accent-dim); color: var(--accent);
  border-color: rgba(99,102,241,.3);
}
a.filter-btn { display: inline-flex; align-items: center; }

.asset-group-label {
  padding: 8px 16px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); background: rgba(255,255,255,.02);
}

.asset-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; cursor: pointer; transition: background .15s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.asset-row:hover { background: rgba(255,255,255,.03); }
.asset-row.selected { background: var(--accent-dim); }
.asset-row.watched { border-left: 2px solid var(--accent); }

.asset-info { display: flex; align-items: center; gap: 10px; }
.asset-icon { font-size: 18px; width: 32px; text-align: center; }
.asset-name { font-size: 13px; font-weight: 600; }
.asset-symbol { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.analysis-panel { display: flex; flex-direction: column; gap: 16px; }

.analysis-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 300px; color: var(--text-muted); gap: 16px;
}
.analysis-placeholder i { font-size: 48px; color: var(--border-light); }

/* ── Analysis Card ── */
.analysis-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.analysis-asset-name { font-size: 20px; font-weight: 700; }
.analysis-price { font-size: 28px; font-weight: 800; font-family: var(--font-mono); color: var(--text-primary); }
.price-change { font-size: 14px; margin-top: 4px; }

.analysis-body { padding: 20px; }
.indicators-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 16px;
}
.indicator-card {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.indicator-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.indicator-value { font-size: 16px; font-weight: 700; font-family: var(--font-mono); margin-top: 4px; }

.ai-result-card {
  background: var(--accent-dim); border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius); padding: 16px; margin-top: 16px;
}
.ai-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-reasoning-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.analyze-btn {
  width: 100%; padding: 12px;
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--font-sans);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s, transform .1s;
}
.analyze-btn:hover { background: var(--accent-hover); }
.analyze-btn:active { transform: scale(.98); }
.analyze-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Trade Form ── */
.trade-form { padding: 20px; }
.trade-type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.trade-type-btn {
  padding: 12px; border-radius: var(--radius); border: 2px solid var(--border);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-size: 15px; font-weight: 700; font-family: var(--font-sans);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s;
}
.trade-type-btn.active { background: var(--profit-dim); border-color: var(--profit); color: var(--profit); }
.trade-type-btn.sell.active { background: var(--loss-dim); border-color: var(--loss); color: var(--loss); }

.amount-input { position: relative; }
.amount-input span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-family: var(--font-mono);
}
.amount-input input { padding-left: 28px; }

.quick-amounts { display: flex; gap: 8px; margin-top: 8px; }
.quick-amounts button {
  flex: 1; padding: 6px; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; font-family: var(--font-sans); transition: all .2s;
}
.quick-amounts button:hover { border-color: var(--accent); color: var(--accent); }

.trade-result {
  margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); font-size: 13px;
}
.trade-result.success { background: var(--profit-dim); color: var(--profit); border: 1px solid rgba(16,185,129,.3); }
.trade-result.error   { background: var(--loss-dim); color: var(--loss); border: 1px solid rgba(239,68,68,.3); }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; background: var(--accent); color: white;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--font-sans);
  transition: background .2s, transform .1s; text-decoration: none;
}
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-primary:active { transform: scale(.98); }
.btn-primary.btn-full { width: 100%; }
.btn-primary.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 14px;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
select option { background: var(--bg-card); }

.hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-msg {
  margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.form-msg.success { background: var(--profit-dim); color: var(--profit); border: 1px solid rgba(16,185,129,.3); }
.form-msg.error   { background: var(--loss-dim); color: var(--loss); border: 1px solid rgba(239,68,68,.3); }

.input-pw { position: relative; }
.input-pw input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 0; top: 0; bottom: 0;
  padding: 0 14px; background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; transition: color .2s;
}
.pw-toggle:hover { color: var(--accent); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.alert-error   { background: var(--loss-dim); color: var(--loss); border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: var(--profit-dim); color: var(--profit); border: 1px solid rgba(16,185,129,.3); }

/* ── Auth ── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }

.auth-container { width: 100%; max-width: 440px; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: var(--radius);
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 16px;
}
.auth-header h1 { font-size: 24px; font-weight: 800; }
.auth-header p { color: var(--text-muted); font-size: 13px; margin-top: 6px; }

.auth-tabs {
  display: flex; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 24px;
}
.auth-tabs .tab {
  flex: 1; text-align: center; padding: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: all .2s;
}
.auth-tabs .tab.active { background: var(--accent); color: white; }

.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-footer { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }
.auth-footer p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-form { padding: 20px; }
.api-info {
  margin: 16px 20px 0;
  padding: 10px 14px; background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.2); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--blue);
  display: flex; gap: 8px; align-items: flex-start;
}
.api-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.api-section-header {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.link-ext { margin-left: auto; font-size: 11px; display: flex; align-items: center; gap: 4px; }

.info-list { padding: 8px 0; }
.info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-item:last-child { border-bottom: none; }
.info-item > span:first-child { color: var(--text-muted); }
code.mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }

/* ── Portfolio ── */
.portfolio-stats-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.portfolio-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }

.chart-container { padding: 20px; }
.chart-legend { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-item span { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.ai-summary { margin-bottom: 24px; }
.ai-summary p { padding: 16px 20px; color: var(--text-secondary); line-height: 1.6; font-size: 14px; }

/* ── Confidence Bar ── */
.confidence-bar {
  height: 4px; background: var(--border-light); border-radius: 99px; overflow: hidden; width: 60px;
}
.cb-fill { height: 100%; background: var(--accent); border-radius: 99px; }

/* ── Balance Badge ── */
.balance-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
}
.balance-badge strong { color: var(--accent); font-family: var(--font-mono); }

/* ── Empty State ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; color: var(--text-muted); gap: 12px;
}
.empty-state i { font-size: 40px; color: var(--border-light); }
.empty-state p { font-size: 13px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; padding: 16px 20px; border-top: 1px solid var(--border); }
.page-btn {
  min-width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: var(--bg-input); border: 1px solid var(--border);
  transition: all .2s;
}
.page-btn.active, .page-btn:hover {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* ── Table Responsive ── */
.table-responsive { overflow-x: auto; }

/* ── Loading Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border-light);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}

/* ── Asset type small ── */
.asset-type-sm {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
}
.asset-type-sm.crypto { background: var(--yellow); }
.asset-type-sm.stock  { background: var(--blue); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .settings-grid { grid-template-columns: 1fr; }
  .portfolio-stats-row { grid-template-columns: 1fr 1fr; }
  .portfolio-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .trading-grid { grid-template-columns: 1fr; }
  .pos-details { grid-template-columns: repeat(3, 1fr); }
  .indicators-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .pos-details { grid-template-columns: 1fr 1fr; }
}
