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

:root {
  --bg-deep:   #0a0c10;
  --bg-card:   #111318;
  --bg-card2:  #161a21;
  --bg-hover:  #1c2029;
  --border:        rgba(255,255,255,0.07);
  --border-light:  rgba(255,255,255,0.12);
  --accent:        #00e5a0;
  --accent-dim:    rgba(0,229,160,0.12);
  --accent-glow:   rgba(0,229,160,0.25);
  --sell-color:    #ff4d6d;
  --sell-dim:      rgba(255,77,109,0.12);
  --blue:          #3d9eff;
  --blue-dim:      rgba(61,158,255,0.12);
  --text-primary:  #f0f2f6;
  --text-secondary:#8a9bb0;
  --text-muted:    #4a5568;
  --gold:    #f5c842;
  --silver:  #a0aec0;
  --bronze:  #cd7f32;
  --font-main: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-w: 220px;
  --news-w:    252px;
  --topbar-h:  60px;
  --radius:    10px;
  --radius-lg: 14px;
  --tr: all 0.2s ease;
  --theme-tr: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-deep:      #f0f2f6;
  --bg-card:      #ffffff;
  --bg-card2:     #f7f8fa;
  --bg-hover:     #edf0f5;
  --border:       rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.14);
  --text-primary:  #0d1117;
  --text-secondary:#4a5568;
  --text-muted:    #9ca3af;
  --accent-dim:    rgba(0,200,140,0.1);
  --sell-dim:      rgba(220,50,80,0.1);
  --blue-dim:      rgba(30,130,220,0.1);
}
[data-theme="light"] .sidebar  { background: #fff; }
[data-theme="light"] .topbar   { background: #fff; }
[data-theme="light"] .news-panel { background: #fff; }
[data-theme="light"] .modal    { background: #fff; }
[data-theme="light"] .notif-panel { background: #fff; }
[data-theme="light"] .profile-dropdown { background: #fff; }
[data-theme="light"] .ai-insight-card { background: linear-gradient(135deg,#f0faf6,#eef4ff); }
[data-theme="light"] .sc-risk-marker  { border-color: #f0f2f6; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d1d5db; }

/* smooth theme transitions */
body, .sidebar, .topbar, .news-panel, .section, .signal-card, .copy-card,
.modal, .notif-panel, .profile-dropdown, .holding-row, .trader-row,
.alert-item, .bottom-stats, .port-stat-card, .akpi, .cc-stat,
.modal-stat, .activity-entry, .news-item {
  transition: var(--theme-tr);
}

html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font-main); background: var(--bg-deep); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3140; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4455; }

/* =============================================
   LAYOUT HIERARCHY
   .app-layout
     .sidebar  (fixed, 220px)
     .main-content  (margin-left: 220px, flex-col)
       .topbar  (height 60px, sticky)
       .content-row  (flex-row, fills remaining height)
         .pages-scroll  (flex:1, overflow-y auto)
           .page  (display:none / block)
         .news-panel  (width 252px, sticky)
   ============================================= */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #0d0f14;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.sidebar-logo { display:flex; align-items:center; gap:10px; padding:20px 20px 16px; border-bottom:1px solid var(--border); }
.logo-icon  { display:flex; align-items:center; justify-content:center; }
.logo-text  { font-size:18px; font-weight:700; color:var(--text-primary); letter-spacing:-0.3px; }
.sidebar-nav { padding:14px 12px; flex:1; display:flex; flex-direction:column; gap:3px; }
.nav-item {
  display:flex; align-items:center; gap:11px;
  padding:9px 12px; border-radius:var(--radius);
  color:var(--text-secondary); cursor:pointer;
  font-size:13.5px; font-weight:500; text-decoration:none;
  transition:var(--tr); position:relative;
}
.nav-item:hover { background:var(--bg-hover); color:var(--text-primary); }
.nav-item.active { background:var(--accent-dim); color:var(--accent); border:1px solid rgba(0,229,160,0.18); }
.nav-item.active::before { content:''; position:absolute; left:-12px; top:50%; transform:translateY(-50%); width:3px; height:18px; background:var(--accent); border-radius:0 3px 3px 0; }
.nav-icon { width:16px; height:16px; flex-shrink:0; }
.nav-badge { margin-left:auto; background:var(--sell-color); color:#fff; font-size:9px; font-weight:700; min-width:16px; height:16px; border-radius:8px; display:flex; align-items:center; justify-content:center; padding:0 4px; }
.ai-insight-card { margin:12px; padding:14px; background:linear-gradient(135deg,#0f1a14,#0d1420); border:1px solid rgba(0,229,160,0.2); border-radius:var(--radius); position:relative; overflow:hidden; }
.ai-insight-card::before { content:''; position:absolute; top:-20px; right:-20px; width:80px; height:80px; background:radial-gradient(circle,rgba(0,229,160,0.08) 0%,transparent 70%); border-radius:50%; }
.ai-insight-header { display:flex; justify-content:space-between; align-items:center; font-size:11px; font-weight:600; color:var(--accent); text-transform:uppercase; letter-spacing:1px; margin-bottom:8px; }
.ai-insight-text { font-size:12px; color:var(--text-secondary); line-height:1.5; margin-bottom:10px; transition:opacity 0.3s; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;          /* fill full viewport height */
  overflow: hidden;       /* children handle their own scroll */
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  flex-shrink: 0;
  background: #0d0f14;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.mobile-toggle { display:none; background:none; border:none; color:var(--text-secondary); cursor:pointer; padding:6px; }
.topbar-right { display:flex; align-items:center; gap:12px; }
.market-status { display:flex; align-items:center; gap:7px; background:rgba(0,229,160,0.08); border:1px solid rgba(0,229,160,0.2); padding:6px 14px; border-radius:20px; font-size:12.5px; font-weight:500; color:var(--accent); }
.market-dot { width:7px; height:7px; border-radius:50%; background:var(--accent); animation:pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(0,229,160,0.4)}50%{opacity:0.8;box-shadow:0 0 0 4px rgba(0,229,160,0)} }

.notif-btn { position:relative; background:var(--bg-card2); border:1px solid var(--border); color:var(--text-secondary); width:36px; height:36px; border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--tr); }
.notif-btn:hover { border-color:var(--border-light); color:var(--text-primary); }
.notif-badge { position:absolute; top:-3px; right:-3px; background:var(--sell-color); color:#fff; font-size:9px; font-weight:700; width:15px; height:15px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.profile-btn { display:flex; align-items:center; gap:8px; background:var(--bg-card2); border:1px solid var(--border); padding:5px 12px 5px 5px; border-radius:24px; cursor:pointer; color:var(--text-primary); font-family:var(--font-main); font-size:13px; font-weight:500; transition:var(--tr); }
.profile-btn:hover { border-color:var(--border-light); background:var(--bg-hover); }
.profile-avatar { width:26px; height:26px; border-radius:50%; background:linear-gradient(135deg,var(--accent),#00b37d); color:#0a0c10; font-weight:700; font-size:12px; display:flex; align-items:center; justify-content:center; }
.theme-toggle-wrap { display:flex; align-items:center; gap:6px; cursor:pointer; }
.theme-icon { font-size:13px; line-height:1; }
.theme-toggle { width:40px; height:22px; background:var(--bg-hover); border:1px solid var(--border); border-radius:11px; cursor:pointer; position:relative; transition:var(--tr); }
[data-theme="dark"] .theme-toggle { background:rgba(0,229,160,0.15); border-color:rgba(0,229,160,0.3); }
.theme-knob { width:16px; height:16px; border-radius:50%; background:var(--text-muted); position:absolute; top:2px; left:2px; transition:all 0.25s cubic-bezier(0.4,0,0.2,1); }
[data-theme="dark"] .theme-knob { left:20px; background:var(--accent); }

/* =============================================
   CONTENT ROW — the key layout fix
   ============================================= */
.content-row {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* height fills exactly what remains below the sticky topbar */
}

/* ===== PAGES SCROLL AREA ===== */
.pages-scroll {
  flex: 1;
  min-width: 0;            /* allow shrinking in flex row */
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

/* ===== PAGE VISIBILITY ===== */
.page { display: none; }
.page.active { display: block; }
.page-inner { padding: 24px; max-width: 1200px; }

/* =============================================
   NEWS PANEL — RIGHT SIDE STICKY
   ============================================= */
.news-panel {
  width: var(--news-w);
  flex-shrink: 0;
  background: #0d0f14;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  /* height matches content-row, not full viewport */
  height: 100%;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.news-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.news-header-title { display:flex; align-items:center; gap:7px; font-size:13px; font-weight:600; color:var(--text-primary); }
.news-live-dot { width:7px; height:7px; border-radius:50%; background:var(--sell-color); animation:pulse-dot 1.5s ease-in-out infinite; }
.news-refresh-time { font-size:10px; color:var(--text-muted); }
.news-feed { flex:1; overflow-y:auto; }
.news-loading { padding:20px 14px; text-align:center; color:var(--text-muted); font-size:12px; }
.news-item { padding:11px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s; }
.news-item:hover { background:var(--bg-hover); }
.news-item.flash-new { animation:news-flash 1.8s ease; }
@keyframes news-flash { 0%{background:rgba(0,229,160,0.1)} 100%{background:transparent} }
.news-cat-tag { display:inline-block; font-size:9px; font-weight:700; padding:2px 7px; border-radius:4px; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:5px; }
.news-cat-tag.market  { background:var(--accent-dim); color:var(--accent); }
.news-cat-tag.nse     { background:var(--blue-dim); color:var(--blue); }
.news-cat-tag.crypto  { background:rgba(245,200,66,0.12); color:var(--gold); }
.news-cat-tag.economy { background:rgba(167,139,250,0.12); color:#a78bfa; }
.news-cat-tag.alert   { background:var(--sell-dim); color:var(--sell-color); }
.news-headline { font-size:11.5px; font-weight:500; color:var(--text-primary); line-height:1.45; margin-bottom:4px; }
.news-time { font-size:10px; color:var(--text-muted); }

/* ===== SECTIONS ===== */
.section { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; margin-bottom:20px; }
.section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.section-title { font-size:15px; font-weight:600; color:var(--text-primary); }
.view-all-btn { background:none; border:1px solid var(--border); color:var(--text-secondary); padding:6px 14px; border-radius:20px; cursor:pointer; font-size:12px; transition:var(--tr); font-family:var(--font-main); }
.view-all-btn:hover { border-color:var(--accent); color:var(--accent); }

/* ===== SIGNAL CARDS ===== */
.signal-cards-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.signal-cards-grid.full-grid { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); }
.signal-card { background:var(--bg-card2); border:1px solid var(--border); border-radius:var(--radius); padding:16px; cursor:pointer; transition:var(--tr); position:relative; overflow:hidden; }
.signal-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:var(--accent); opacity:0; transition:opacity 0.2s; }
.signal-card.sell-card::before { background:var(--sell-color); }
.signal-card:hover { border-color:var(--border-light); transform:translateY(-2px); }
.signal-card:hover::before { opacity:1; }
.sc-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:4px; }
.sc-ticker { font-size:15px; font-weight:700; color:var(--text-primary); font-family:var(--font-mono); }
.badge { padding:3px 9px; border-radius:5px; font-size:11px; font-weight:700; letter-spacing:0.5px; }
.badge.buy  { background:var(--accent); color:#0a0c10; }
.badge.sell { background:var(--sell-color); color:#fff; }
.sc-exchange { font-size:11px; color:var(--text-muted); margin-bottom:10px; }
.sc-price { font-size:20px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); margin-bottom:8px; }
.sc-confidence { display:flex; justify-content:space-between; font-size:11.5px; color:var(--text-muted); margin-bottom:8px; }
.sc-conf-val { font-weight:700; }
.sc-conf-val.buy  { color:var(--accent); }
.sc-conf-val.sell { color:var(--sell-color); }
.sc-chart-wrap { height:56px; margin-bottom:10px; }
.sc-chart-wrap canvas { width:100% !important; height:56px !important; }
.sc-risk-row { font-size:10px; color:var(--text-muted); }
.sc-risk-bar { height:4px; border-radius:2px; background:linear-gradient(90deg,#00e5a0 0%,#f5c842 50%,#ff4d6d 100%); margin:4px 0 3px; position:relative; }
.sc-risk-marker { position:absolute; top:-2px; width:8px; height:8px; border-radius:50%; background:#fff; border:2px solid #1c2029; transform:translateX(-50%); }
.sc-risk-labels { display:flex; justify-content:space-between; font-size:10px; color:var(--text-muted); }

/* ===== DUAL ROW ===== */
.dual-row { display:grid; grid-template-columns:1fr 1.4fr; gap:20px; margin-bottom:20px; }

/* ===== TRADERS ===== */
.traders-table { display:flex; flex-direction:column; gap:4px; }
.traders-header { display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:600; color:var(--text-secondary); margin-bottom:8px; }
.view-all-sm { background:none; border:none; color:var(--text-muted); font-size:12px; cursor:pointer; font-family:var(--font-main); transition:var(--tr); }
.view-all-sm:hover { color:var(--accent); }
.trader-row { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--bg-card2); border:1px solid var(--border); border-radius:var(--radius); transition:var(--tr); }
.trader-row:hover { border-color:var(--border-light); }
.trader-rank { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; flex-shrink:0; }
.trader-rank.gold   { background:rgba(245,200,66,0.2);  color:var(--gold); }
.trader-rank.silver { background:rgba(160,174,192,0.2); color:var(--silver); }
.trader-rank.bronze { background:rgba(205,127,50,0.2);  color:var(--bronze); }
.trader-avatar { width:30px; height:30px; border-radius:50%; background:linear-gradient(135deg,#1a3a2a,#0d2a1a); border:1px solid rgba(0,229,160,0.3); color:var(--accent); font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.trader-avatar.purple { background:linear-gradient(135deg,#2a1a3a,#1a0d2a); border-color:rgba(130,100,220,0.3); color:#a78bfa; }
.trader-avatar.blue   { background:linear-gradient(135deg,#1a2a3a,#0d1a2a); border-color:rgba(61,158,255,0.3); color:var(--blue); }
.trader-info { flex:1; }
.trader-name { font-size:13px; font-weight:600; color:var(--text-primary); }
.trader-stats { display:flex; flex-direction:column; gap:2px; text-align:right; }
.trader-wr  { font-size:11px; color:var(--text-muted); }
.trader-ret { font-size:11px; font-weight:600; }
.copy-btn { background:var(--bg-card); border:1px solid var(--border); color:var(--text-secondary); padding:5px 12px; border-radius:6px; cursor:pointer; font-size:12px; font-weight:500; font-family:var(--font-main); transition:var(--tr); white-space:nowrap; }
.copy-btn:hover { border-color:var(--accent); color:var(--accent); }
.copy-btn.active { background:var(--accent-dim); border-color:var(--accent); color:var(--accent); }

/* ===== PORTFOLIO MINI ===== */
.portfolio-balances { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:14px; }
.bal-label { font-size:11px; color:var(--text-muted); margin-bottom:4px; }
.bal-val   { font-size:16px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); }
.portfolio-chart-wrap { height:130px; position:relative; margin-bottom:12px; }
.timeframe-tabs { display:flex; gap:4px; }
.tf-btn { background:none; border:1px solid transparent; color:var(--text-muted); padding:5px 10px; border-radius:6px; cursor:pointer; font-size:12px; font-weight:500; font-family:var(--font-main); transition:var(--tr); }
.tf-btn:hover  { color:var(--text-secondary); }
.tf-btn.active { background:var(--accent-dim); border-color:rgba(0,229,160,0.25); color:var(--accent); }

/* ===== BOTTOM STATS ===== */
.bottom-stats { display:grid; grid-template-columns:repeat(5,1fr); gap:14px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px 24px; }
.bstat { text-align:center; }
.bstat-label { font-size:11px; color:var(--text-muted); margin-bottom:6px; }
.bstat-val   { font-size:18px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); line-height:1.2; transition:color 0.4s ease; }
.bstat-pct   { font-size:12px; color:var(--accent); }
.bstat-sub   { font-size:11px; color:var(--text-muted); }
.risk-badge.moderate { color:var(--accent); font-size:13px; }
.green { color:var(--accent)     !important; }
.red   { color:var(--sell-color) !important; }

/* ===== CAPITAL FLASH ANIMATIONS ===== */
@keyframes flash-red   { 0%,100%{color:var(--text-primary)} 40%{color:var(--sell-color)} }
@keyframes flash-green { 0%,100%{color:var(--text-primary)} 40%{color:var(--accent)} }
.cap-flash-red   { animation:flash-red   0.8s ease; }
.cap-flash-green { animation:flash-green 0.8s ease; }

/* PnL cell flash */
@keyframes pnl-up   { 0%{background:rgba(0,229,160,0.2);color:var(--accent)}     100%{background:transparent;color:inherit} }
@keyframes pnl-down { 0%{background:rgba(255,77,109,0.2);color:var(--sell-color)} 100%{background:transparent;color:inherit} }
.pnl-flash-up   { animation: pnl-up   0.7s ease forwards; }
.pnl-flash-down { animation: pnl-down 0.7s ease forwards; }
/* subtle row tinting */
.pos-row-profit > td { background: rgba(0,229,160,0.03)  !important; }
.pos-row-loss   > td { background: rgba(255,77,109,0.03) !important; }

/* ===== SIGNALS TABLE ===== */
.signals-table-wrap { overflow-x:auto; margin-bottom:16px; }
.signals-table { width:100%; border-collapse:collapse; font-size:13px; }
.signals-table th { padding:10px 14px; text-align:left; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); }
.signals-table td { padding:12px 14px; border-bottom:1px solid rgba(255,255,255,0.04); }
.signals-table tr:hover td { background:var(--bg-hover); }
.signal-action-btn { background:var(--accent-dim); border:1px solid rgba(0,229,160,0.25); color:var(--accent); padding:5px 14px; border-radius:6px; cursor:pointer; font-size:11.5px; font-family:var(--font-main); font-weight:600; transition:var(--tr); }
.signal-action-btn:hover { background:var(--accent); color:#0a0c10; }
.filter-select { background:var(--bg-card2); border:1px solid var(--border); color:var(--text-secondary); padding:7px 12px; border-radius:var(--radius); font-size:12.5px; font-family:var(--font-main); cursor:pointer; }

/* ===== COPY TRADING PAGE ===== */
.copy-stats-inline { display:flex; gap:12px; flex-wrap:wrap; }
.cs-tag { background:var(--bg-card2); border:1px solid var(--border); padding:5px 12px; border-radius:6px; font-size:12px; color:var(--text-secondary); }
.cs-tag b { color:var(--accent); }
.copy-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; margin-bottom:20px; }
.copy-card { background:var(--bg-card2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; transition:var(--tr); }
.copy-card:hover { border-color:var(--border-light); }
.cc-header { display:flex; align-items:center; gap:14px; margin-bottom:16px; }
.cc-avatar { width:46px; height:46px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:700; flex-shrink:0; }
.cc-name { font-size:15px; font-weight:600; color:var(--text-primary); }
.cc-specialty { font-size:12px; color:var(--text-muted); }
.cc-rank-badge { margin-left:auto; font-size:10px; font-weight:700; padding:3px 8px; border-radius:4px; }
.rank-1 { background:rgba(245,200,66,0.15); color:var(--gold); }
.rank-2 { background:rgba(160,174,192,0.15); color:var(--silver); }
.rank-3 { background:rgba(205,127,50,0.15); color:var(--bronze); }
.rank-other { background:var(--bg-card); color:var(--text-muted); }
.cc-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
.cc-stat { background:var(--bg-card); border-radius:7px; padding:10px; }
.cc-stat-label { font-size:10px; color:var(--text-muted); margin-bottom:4px; }
.cc-stat-val   { font-size:15px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); }
.cc-copy-btn { width:100%; padding:10px; border-radius:8px; border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); cursor:pointer; font-size:13px; font-weight:600; font-family:var(--font-main); transition:var(--tr); }
.cc-copy-btn:hover   { border-color:var(--accent); color:var(--accent); }
.cc-copy-btn.copying { background:var(--accent-dim); border-color:var(--accent); color:var(--accent); }
.cc-btn-row { display:flex; gap:8px; }
.cc-pnl-live { font-size:11px; font-weight:600; margin-bottom:10px; }

/* ===== POSITIONS TABLES ===== */
.positions-count-badge { background:var(--accent-dim); border:1px solid rgba(0,229,160,0.25); color:var(--accent); padding:3px 10px; border-radius:12px; font-size:11px; font-weight:600; }
.positions-table-wrap  { overflow-x:auto; }
.positions-table, .portfolio-positions-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.positions-table th, .portfolio-positions-table th { padding:9px 12px; text-align:left; font-size:10.5px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); white-space:nowrap; }
.positions-table td, .portfolio-positions-table td { padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.04); vertical-align:middle; transition:background 0.3s; }
.positions-table tr:hover td, .portfolio-positions-table tr:hover td { background:var(--bg-hover); }
.pos-pnl-positive { color:var(--accent);     font-weight:600; font-family:var(--font-mono); }
.pos-pnl-negative { color:var(--sell-color); font-weight:600; font-family:var(--font-mono); }
.squareoff-btn { background:var(--sell-dim); border:1px solid rgba(255,77,109,0.25); color:var(--sell-color); padding:4px 10px; border-radius:6px; cursor:pointer; font-size:11px; font-weight:600; font-family:var(--font-main); transition:var(--tr); white-space:nowrap; }
.squareoff-btn:hover { background:var(--sell-color); color:#fff; }
.exit-all-btn { background:rgba(255,77,109,0.15); border:1px solid rgba(255,77,109,0.3); color:var(--sell-color); padding:7px 16px; border-radius:8px; cursor:pointer; font-size:12px; font-weight:700; font-family:var(--font-main); transition:var(--tr); white-space:nowrap; }
.exit-all-btn:hover { background:var(--sell-color); color:#fff; }
.pos-side-buy  { color:var(--accent); font-weight:700; font-size:11px; }
.pos-side-sell { color:var(--sell-color); font-weight:700; font-size:11px; }
.pos-status-open   { background:var(--accent-dim); color:var(--accent); font-size:10px; font-weight:600; padding:2px 8px; border-radius:4px; }
.pos-status-closed { background:var(--sell-dim); color:var(--sell-color); font-size:10px; font-weight:600; padding:2px 8px; border-radius:4px; }
.empty-positions { text-align:center; padding:32px 20px; color:var(--text-muted); font-size:12.5px; }
.empty-pos-icon  { font-size:28px; margin-bottom:10px; }

/* ===== PORTFOLIO PAGE ===== */
.port-stat-row  { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.port-stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.psc-label { font-size:11px; color:var(--text-muted); margin-bottom:6px; }
.psc-val   { font-size:20px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); }
.holdings-list { display:flex; flex-direction:column; gap:8px; }
.holding-row { display:flex; align-items:center; gap:12px; padding:12px; background:var(--bg-card2); border-radius:var(--radius); border:1px solid var(--border); }
.holding-icon { width:36px; height:36px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; }
.holding-info  { flex:1; }
.holding-name  { font-size:13px; font-weight:600; }
.holding-qty   { font-size:11px; color:var(--text-muted); }
.holding-val   { text-align:right; }
.holding-price  { font-size:13px; font-weight:600; font-family:var(--font-mono); }
.holding-change { font-size:11px; }
.allocation-labels { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.alloc-label-item { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--text-secondary); }
.alloc-dot  { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.alloc-pct  { font-weight:600; color:var(--text-primary); margin-left:2px; }

/* ===== ANALYTICS PAGE ===== */
.analytics-kpi-row { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.akpi { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.akpi-label { font-size:11px; color:var(--text-muted); margin-bottom:6px; }
.akpi-val   { font-size:22px; font-weight:700; font-family:var(--font-mono); margin-bottom:10px; color:var(--text-primary); }
.akpi-bar  { height:4px; background:var(--border); border-radius:2px; overflow:hidden; }
.akpi-fill { height:100%; border-radius:2px; background:var(--accent); transition:width 1s ease; }
.akpi-fill.green { background:var(--accent); }
.akpi-fill.red   { background:var(--sell-color); }

/* ===== ALERTS PAGE ===== */
.create-alert-btn { background:var(--accent-dim); border:1px solid rgba(0,229,160,0.25); color:var(--accent); padding:8px 16px; border-radius:var(--radius); cursor:pointer; font-size:13px; font-weight:600; font-family:var(--font-main); transition:var(--tr); }
.create-alert-btn:hover { background:var(--accent); color:#0a0c10; }
.alerts-list { display:flex; flex-direction:column; gap:10px; }
.alert-item { display:flex; align-items:center; gap:14px; padding:14px 16px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); transition:var(--tr); }
.alert-item:hover { border-color:var(--border-light); }
.alert-icon { width:36px; height:36px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.alert-icon.active-icon    { background:var(--accent-dim); }
.alert-icon.triggered-icon { background:var(--blue-dim); }
.alert-icon.paused-icon    { background:rgba(245,200,66,0.12); }
.alert-info { flex:1; }
.alert-title     { font-size:13.5px; font-weight:600; color:var(--text-primary); }
.alert-condition { font-size:11.5px; color:var(--text-muted); margin-top:2px; }
.alert-status { font-size:11px; font-weight:600; padding:3px 10px; border-radius:12px; }
.alert-status.active    { background:var(--accent-dim); color:var(--accent); }
.alert-status.triggered { background:var(--blue-dim); color:var(--blue); }
.alert-status.paused    { background:rgba(245,200,66,0.12); color:var(--gold); }
.alert-delete { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px 8px; border-radius:5px; font-size:14px; transition:var(--tr); }
.alert-delete:hover { background:var(--sell-dim); color:var(--sell-color); }

/* Activity Log */
.activity-log { max-height:320px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.activity-empty { text-align:center; padding:24px; color:var(--text-muted); font-size:12px; }
.activity-entry { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; background:var(--bg-card2); border-radius:8px; border:1px solid var(--border); border-left:3px solid var(--border); animation:slide-in 0.3s ease; }
@keyframes slide-in { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:translateX(0)} }
.activity-entry.type-order    { border-left-color:var(--accent); }
.activity-entry.type-sell     { border-left-color:var(--sell-color); }
.activity-entry.type-squareoff{ border-left-color:var(--gold); }
.activity-entry.type-copy     { border-left-color:var(--blue); }
.activity-entry.type-pnl      { border-left-color:#a78bfa; }
.activity-entry.type-market   { border-left-color:var(--text-muted); }
.activity-icon    { font-size:14px; flex-shrink:0; margin-top:1px; }
.activity-content { flex:1; }
.activity-title   { font-size:12.5px; font-weight:600; color:var(--text-primary); margin-bottom:2px; }
.activity-desc    { font-size:11px; color:var(--text-secondary); }
.activity-time    { font-size:10px; color:var(--text-muted); white-space:nowrap; margin-top:2px; }

/* Alert Form */
.alert-form-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:500; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
.alert-form-card { background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius-lg); width:360px; max-width:90vw; }
.af-header { display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid var(--border); font-size:15px; font-weight:600; }
.af-body   { padding:20px; display:flex; flex-direction:column; gap:10px; }
.af-label  { font-size:11px; color:var(--text-muted); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:-4px; }
.af-input  { background:var(--bg-card2); border:1px solid var(--border); color:var(--text-primary); padding:10px 12px; border-radius:var(--radius); font-size:13px; font-family:var(--font-main); width:100%; transition:var(--tr); }
.af-input:focus { outline:none; border-color:var(--accent); }
.af-checks { display:flex; gap:16px; font-size:12.5px; color:var(--text-secondary); }
.af-checks label { display:flex; align-items:center; gap:6px; cursor:pointer; }

/* ===== SETTINGS ===== */
.settings-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:20px; margin-bottom:20px; }
.settings-section { margin-bottom:0; }
.settings-group-title { font-size:13px; font-weight:700; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.8px; margin-bottom:16px; }
.settings-field { display:flex; flex-direction:column; gap:5px; margin-bottom:14px; }
.settings-field label { font-size:12px; color:var(--text-muted); }
.settings-input { background:var(--bg-card2); border:1px solid var(--border); color:var(--text-primary); padding:9px 12px; border-radius:var(--radius); font-size:13px; font-family:var(--font-main); width:100%; transition:var(--tr); }
.settings-input:focus { outline:none; border-color:var(--accent); }
.toggle-field { flex-direction:row !important; align-items:center; justify-content:space-between; }
.toggle { width:40px; height:22px; background:var(--bg-hover); border:1px solid var(--border); border-radius:11px; cursor:pointer; position:relative; transition:var(--tr); }
.toggle.active { background:rgba(0,229,160,0.2); border-color:var(--accent); }
.toggle-knob { width:16px; height:16px; border-radius:50%; background:var(--text-muted); position:absolute; top:2px; left:2px; transition:var(--tr); }
.toggle.active .toggle-knob { left:20px; background:var(--accent); }
.settings-save-btn { background:var(--accent-dim); border:1px solid rgba(0,229,160,0.25); color:var(--accent); padding:9px 20px; border-radius:var(--radius); cursor:pointer; font-size:13px; font-weight:600; font-family:var(--font-main); transition:var(--tr); margin-top:4px; }
.settings-save-btn:hover { background:var(--accent); color:#0a0c10; }
.settings-danger-zone { background:rgba(255,77,109,0.05); border:1px solid rgba(255,77,109,0.15); border-radius:var(--radius-lg); padding:20px; }
.danger-btn { background:rgba(255,77,109,0.1); border:1px solid rgba(255,77,109,0.25); color:var(--sell-color); padding:9px 18px; border-radius:var(--radius); cursor:pointer; font-size:13px; font-weight:600; font-family:var(--font-main); transition:var(--tr); }
.danger-btn:hover { background:rgba(255,77,109,0.2); }

/* ===== MODAL ===== */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.75); z-index:1000; align-items:center; justify-content:center; backdrop-filter:blur(5px); }
.modal-overlay.open { display:flex; }
.modal { background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius-lg); width:460px; max-width:92vw; max-height:90vh; overflow-y:auto; animation:modal-in 0.25s ease; }
@keyframes modal-in { from{opacity:0;transform:translateY(20px) scale(0.97)} to{opacity:1;transform:translateY(0) scale(1)} }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:20px 22px 16px; border-bottom:1px solid var(--border); }
.modal-ticker   { font-size:20px; font-weight:800; font-family:var(--font-mono); margin-right:10px; }
.modal-exchange { font-size:12px; color:var(--text-muted); }
.modal-close { background:var(--bg-card2); border:1px solid var(--border); color:var(--text-muted); width:28px; height:28px; border-radius:6px; cursor:pointer; font-size:12px; display:flex; align-items:center; justify-content:center; transition:var(--tr); }
.modal-close:hover { border-color:var(--sell-color); color:var(--sell-color); }
.modal-body { padding:20px 22px; }
.modal-stats-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:18px; }
.modal-stat { background:var(--bg-card2); border-radius:8px; padding:12px; }
.mstat-label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:5px; display:block; }
.mstat-val   { font-size:14px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); }
.modal-chart-wrap { height:140px; margin-bottom:16px; }
.modal-analysis { background:var(--bg-card2); border-radius:8px; padding:14px; margin-bottom:16px; border-left:3px solid var(--accent); }
.analysis-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; color:var(--accent); margin-bottom:6px; }
.modal-analysis p { font-size:12.5px; color:var(--text-secondary); line-height:1.6; }
.modal-risk-row { margin-bottom:14px; }
.risk-label   { font-size:11px; color:var(--text-muted); margin-bottom:6px; display:block; }
.risk-bar-wrap { height:6px; border-radius:3px; background:linear-gradient(90deg,#00e5a0 0%,#f5c842 50%,#ff4d6d 100%); margin-bottom:4px; position:relative; }
.risk-bar  { position:absolute; top:-2px; height:10px; width:3px; background:#fff; border-radius:2px; }
.risk-ticks { display:flex; justify-content:space-between; font-size:10px; color:var(--text-muted); }
.modal-qty-row { display:flex; align-items:center; gap:12px; margin-bottom:14px; padding:12px; background:var(--bg-card2); border-radius:var(--radius); border:1px solid var(--border); }
.modal-qty-label { font-size:12px; color:var(--text-muted); font-weight:500; }
.modal-qty-controls { display:flex; align-items:center; gap:8px; margin-left:auto; }
.qty-btn { width:26px; height:26px; border-radius:6px; border:1px solid var(--border); background:var(--bg-hover); color:var(--text-primary); font-size:16px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--tr); line-height:1; }
.qty-btn:hover { border-color:var(--accent); color:var(--accent); }
.qty-input { width:56px; text-align:center; background:var(--bg-card); border:1px solid var(--border); color:var(--text-primary); padding:4px 8px; border-radius:6px; font-size:14px; font-weight:600; font-family:var(--font-mono); }
.qty-input:focus { outline:none; border-color:var(--accent); }
.modal-qty-cost { font-size:11.5px; color:var(--text-secondary); white-space:nowrap; }
.modal-action-btn { width:100%; padding:12px; border-radius:var(--radius); border:none; cursor:pointer; font-size:14px; font-weight:700; font-family:var(--font-main); transition:var(--tr); letter-spacing:0.3px; }
.modal-action-btn.buy-btn  { background:var(--accent); color:#0a0c10; }
.modal-action-btn.buy-btn:hover  { background:#00ffb3; }
.modal-action-btn.sell-btn { background:var(--sell-color); color:#fff; }
.modal-action-btn.sell-btn:hover { background:#ff7090; }
.modal-action-btn:disabled { opacity:0.5; cursor:not-allowed; }

/* ===== TOAST ===== */
.toast-container { position:fixed; bottom:24px; right:280px; display:flex; flex-direction:column; gap:8px; z-index:9999; max-width:320px; }
.toast { padding:12px 16px 12px 12px; background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius); border-left:3px solid var(--accent); box-shadow:0 4px 20px rgba(0,0,0,0.3); animation:toast-in 0.3s ease; display:flex; align-items:flex-start; gap:10px; font-size:12.5px; }
@keyframes toast-in  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes toast-out { from{opacity:1;transform:translateX(0)} to{opacity:0;transform:translateX(20px)} }
.toast.out     { animation:toast-out 0.3s ease forwards; }
.toast.success { border-left-color:var(--accent); }
.toast.error   { border-left-color:var(--sell-color); }
.toast.info    { border-left-color:var(--blue); }
.toast.warning { border-left-color:var(--gold); }
.toast-icon    { font-size:15px; flex-shrink:0; }
.toast-title   { font-weight:600; color:var(--text-primary); margin-bottom:2px; }
.toast-msg     { color:var(--text-secondary); font-size:11.5px; }

/* ===== NOTIF PANEL ===== */
.notif-panel { position:fixed; top:var(--topbar-h); right:-360px; width:340px; background:var(--bg-card); border:1px solid var(--border-light); border-radius:0 0 var(--radius-lg) var(--radius-lg); z-index:300; transition:right 0.3s ease, background 0.3s ease; max-height:calc(100vh - var(--topbar-h)); overflow-y:auto; }
.notif-panel.open { right:0; }
.notif-header { display:flex; justify-content:space-between; align-items:center; padding:16px 18px; border-bottom:1px solid var(--border); font-size:14px; font-weight:600; }
.notif-close  { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:14px; }
.notif-list   { padding:8px 0; }
.notif-item   { display:flex; align-items:flex-start; gap:12px; padding:12px 18px; transition:var(--tr); cursor:pointer; }
.notif-item:hover { background:var(--bg-hover); }
.notif-item.unread { background:rgba(0,229,160,0.04); }
.notif-dot  { width:8px; height:8px; border-radius:50%; background:var(--accent); margin-top:5px; flex-shrink:0; }
.notif-dot.inactive { background:var(--text-muted); }
.notif-title { font-size:13px; color:var(--text-primary); font-weight:500; margin-bottom:2px; }
.notif-time  { font-size:11px; color:var(--text-muted); }

/* ===== PROFILE DROPDOWN ===== */
.profile-dropdown { position:fixed; top:calc(var(--topbar-h) + 8px); right:16px; width:220px; background:var(--bg-card); border:1px solid var(--border-light); border-radius:var(--radius-lg); z-index:300; display:none; overflow:hidden; box-shadow:0 10px 30px rgba(0,0,0,0.4); animation:fade-in 0.15s ease; }
@keyframes fade-in { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.profile-dropdown.open { display:block; }
.pd-user   { display:flex; align-items:center; gap:10px; padding:16px; }
.pd-avatar { width:38px; height:38px; border-radius:50%; background:linear-gradient(135deg,var(--accent),#00b37d); color:#0a0c10; font-weight:700; font-size:16px; display:flex; align-items:center; justify-content:center; }
.pd-name   { font-size:14px; font-weight:600; }
.pd-email  { font-size:11px; color:var(--text-muted); }
.pd-hr     { border:none; border-top:1px solid var(--border); margin:4px 0; }
.pd-item   { display:block; padding:10px 16px; font-size:13px; color:var(--text-secondary); text-decoration:none; transition:var(--tr); cursor:pointer; }
.pd-item:hover     { background:var(--bg-hover); color:var(--text-primary); }
.pd-item.red:hover { color:var(--sell-color); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1400px) { :root { --news-w: 220px; } }
@media (max-width: 1200px) {
  :root { --news-w: 200px; }
  .signal-cards-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 1050px) {
  .news-panel { display:none; }
  .toast-container { right:24px; }
}
@media (max-width: 900px) {
  .signal-cards-grid { grid-template-columns:repeat(2,1fr); }
  .dual-row { grid-template-columns:1fr; }
  .bottom-stats { grid-template-columns:repeat(3,1fr); }
  .analytics-kpi-row { grid-template-columns:repeat(2,1fr); }
  .port-stat-row { grid-template-columns:repeat(2,1fr); }
  .modal-stats-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.mobile-open { transform:translateX(0); }
  .main-content { margin-left:0; }
  .mobile-toggle { display:flex; }
  .signal-cards-grid { grid-template-columns:1fr; }
  .bottom-stats { grid-template-columns:repeat(2,1fr); }
  .settings-grid { grid-template-columns:1fr; }
}
@media (max-width: 480px) {
  .page-inner { padding:14px; }
  .bottom-stats { grid-template-columns:1fr 1fr; }
  .port-stat-row { grid-template-columns:1fr 1fr; }
  .profile-name { display:none; }
  .theme-toggle-wrap .theme-icon { display:none; }
}

/* ============================================================
   ADDITIONS v4 — Ask AI, Profile Modal, Chat, Days P&L, Logo
   ============================================================ */

/* Logo in sidebar — tighter fit */
.sidebar-logo .logo-text { font-size:15px; font-weight:700; letter-spacing:-0.3px; }

/* Ask AI nav item sparkle treatment (matches existing active state exactly) */
.nav-item[data-tab="askai"].active { background:var(--accent-dim); color:var(--accent); border:1px solid rgba(0,229,160,0.18); }

/* AI Suggestion buttons */
.ai-suggestion-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-main);
  transition: var(--tr);
}
.ai-suggestion-btn:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-dim); }

/* AI Chat messages */
.ai-chat-msg { display:flex; align-items:flex-start; gap:10px; animation:slide-in 0.3s ease; }
.ai-msg { flex-direction:row; }
.user-msg { flex-direction:row-reverse; }
.ai-chat-avatar {
  width:30px; height:30px; border-radius:8px; flex-shrink:0;
  background:linear-gradient(135deg,var(--accent-dim),rgba(0,229,160,0.06));
  border:1px solid rgba(0,229,160,0.25);
  color:var(--accent); font-size:10px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
}
.ai-chat-bubble {
  max-width:80%;
  background:var(--bg-card2);
  border:1px solid var(--border);
  border-radius:12px 12px 12px 2px;
  padding:11px 14px;
  font-size:13px;
  color:var(--text-primary);
  line-height:1.55;
}
.user-bubble {
  background:var(--accent-dim);
  border-color:rgba(0,229,160,0.2);
  border-radius:12px 12px 2px 12px;
  color:var(--text-primary);
}

/* Bottom stats — extended for Days P&L */
.bottom-stats { grid-template-columns: repeat(5,1fr); }
@media(max-width:1100px) { .bottom-stats { grid-template-columns: repeat(3,1fr); } }
@media(max-width:768px)  { .bottom-stats { grid-template-columns: repeat(2,1fr); } }

/* Profile modal specifics */
#profileModal .modal { max-width:440px; }

/* Settings save feedback */
#settingsSaveMsg { animation:slide-in 0.3s ease; }

/* Sidebar logo image */
.sidebar-logo img { border:1px solid rgba(0,229,160,0.15); }

/* pos-side colors */
.pos-side-buy  { color:var(--accent);     font-weight:700; font-size:11px; }
.pos-side-sell { color:var(--sell-color); font-weight:700; font-size:11px; }
.pos-status-open { background:var(--accent-dim); color:var(--accent); font-size:10px; font-weight:600; padding:2px 8px; border-radius:4px; }

/* Toast positioning — clear of news panel */
.toast-container { right:270px; }
@media(max-width:1050px) { .toast-container { right:24px; } }

/* P&L flash animations */
@keyframes pnl-up   { 0%{background:rgba(0,229,160,0.2);color:var(--accent)}     100%{background:transparent} }
@keyframes pnl-down { 0%{background:rgba(255,77,109,0.2);color:var(--sell-color)} 100%{background:transparent} }
.pnl-flash-up   { animation:pnl-up   0.7s ease forwards; }
.pnl-flash-down { animation:pnl-down 0.7s ease forwards; }
.pos-row-profit > td { background:rgba(0,229,160,0.03)   !important; }
.pos-row-loss   > td { background:rgba(255,77,109,0.03)  !important; }

/* Capital flash */
@keyframes flash-red   { 0%,100%{color:var(--text-primary)} 40%{color:var(--sell-color)} }
@keyframes flash-green { 0%,100%{color:var(--text-primary)} 40%{color:var(--accent)} }
.cap-flash-red   { animation:flash-red   0.8s ease; }
.cap-flash-green { animation:flash-green 0.8s ease; }

/* cc-pnl-live & cc-btn-row */
.cc-pnl-live  { font-size:11.5px; font-weight:600; margin-bottom:10px; }
.cc-btn-row   { display:flex; gap:8px; }
.exit-all-btn { background:rgba(255,77,109,0.1); border:1px solid rgba(255,77,109,0.3); color:var(--sell-color); padding:8px 14px; border-radius:8px; cursor:pointer; font-size:12px; font-weight:700; font-family:var(--font-main); transition:var(--tr); }
.exit-all-btn:hover { background:var(--sell-color); color:#fff; }

/* Allocation labels */
.allocation-labels { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.alloc-label-item  { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--text-secondary); }
.alloc-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.alloc-pct { font-weight:600; color:var(--text-primary); margin-left:2px; }

/* portfolio positions */
.portfolio-positions-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.portfolio-positions-table th { padding:9px 12px; text-align:left; font-size:10.5px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); white-space:nowrap; }
.portfolio-positions-table td { padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.04); vertical-align:middle; }
.portfolio-positions-table tr:hover td { background:var(--bg-hover); }

/* Empty positions */
.empty-positions { text-align:center; padding:32px 20px; color:var(--text-muted); font-size:12.5px; }
.empty-pos-icon  { font-size:28px; margin-bottom:10px; }

/* positions-count-badge */
.positions-count-badge { background:var(--accent-dim); border:1px solid rgba(0,229,160,0.25); color:var(--accent); padding:3px 10px; border-radius:12px; font-size:11px; font-weight:600; }

/* activity log */
.activity-log   { max-height:320px; overflow-y:auto; display:flex; flex-direction:column; gap:6px; }
.activity-empty { text-align:center; padding:24px; color:var(--text-muted); font-size:12px; }
.activity-entry { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; background:var(--bg-card2); border-radius:8px; border:1px solid var(--border); border-left:3px solid var(--border); animation:slide-in 0.3s ease; }
@keyframes slide-in { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:translateX(0)} }
.activity-entry.type-order    { border-left-color:var(--accent); }
.activity-entry.type-sell     { border-left-color:var(--sell-color); }
.activity-entry.type-squareoff{ border-left-color:var(--gold,#f5c842); }
.activity-entry.type-copy     { border-left-color:var(--blue); }
.activity-entry.type-pnl      { border-left-color:#a78bfa; }
.activity-entry.type-market   { border-left-color:var(--text-muted); }
.activity-icon    { font-size:14px; flex-shrink:0; margin-top:1px; }
.activity-content { flex:1; }
.activity-title   { font-size:12.5px; font-weight:600; color:var(--text-primary); margin-bottom:2px; }
.activity-desc    { font-size:11px; color:var(--text-secondary); }
.activity-time    { font-size:10px; color:var(--text-muted); white-space:nowrap; margin-top:2px; }

/* squareoff + positions table */
.positions-table-wrap { overflow-x:auto; }
.positions-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.positions-table th { padding:9px 12px; text-align:left; font-size:10.5px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; border-bottom:1px solid var(--border); white-space:nowrap; }
.positions-table td { padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.04); vertical-align:middle; }
.positions-table tr:hover td { background:var(--bg-hover); }
.pos-pnl-positive { color:var(--accent);     font-weight:600; font-family:var(--font-mono); }
.pos-pnl-negative { color:var(--sell-color); font-weight:600; font-family:var(--font-mono); }
.squareoff-btn { background:var(--sell-dim); border:1px solid rgba(255,77,109,0.25); color:var(--sell-color); padding:4px 10px; border-radius:6px; cursor:pointer; font-size:11px; font-weight:600; font-family:var(--font-main); transition:var(--tr); white-space:nowrap; }
.squareoff-btn:hover { background:var(--sell-color); color:#fff; }

/* Light mode overrides for new elements */
[data-theme="light"] .ai-chat-bubble { background:#f7f8fa; border-color:rgba(0,0,0,0.08); }
[data-theme="light"] .user-bubble    { background:rgba(0,200,140,0.08); }
[data-theme="light"] .ai-suggestion-btn { background:#f7f8fa; }

/* ============================================================
   v5 ADDITIONS — Ask AI Widget, Copy %, SL/TP, Status badges
   ============================================================ */

/* Ask AI full-height page */
#page-askai .page-inner {
  padding: 0;
  height: calc(100vh - var(--topbar-h) - 2px);
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

/* askai-live-dot pulse */
.askai-live-dot { animation: pulse-dot 2s infinite; }

/* Typing dots */
@keyframes askai-bounce {
  0%,80%,100% { transform:translateY(0); opacity:.4; }
  40%          { transform:translateY(-5px); opacity:1; }
}
.askai-dots span:nth-child(1) { animation: askai-bounce 1.2s infinite; }
.askai-dots span:nth-child(2) { animation: askai-bounce 1.2s .18s infinite; }
.askai-dots span:nth-child(3) { animation: askai-bounce 1.2s .36s infinite; }

/* Copy % row */
.copy-pct-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.copy-pct-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.copy-pct-select, .copy-pct-input {
  background: var(--bg-card2);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-family: var(--font-main);
  width: 90px;
  outline: none;
  transition: border-color .18s;
}
.copy-pct-input { width: 72px; }
.copy-pct-select:focus, .copy-pct-input:focus { border-color: var(--accent); }
.start-copying-btn {
  background: var(--accent);
  border: none;
  color: #0a0c10;
  padding: 7px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-main);
  transition: all 0.18s;
  white-space: nowrap;
}
.start-copying-btn:hover { background: #00ffb3; }

/* Execute Order — Loss/Profit % */
.order-sl-tp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-card2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.sltp-field    { display: flex; flex-direction: column; gap: 4px; }
.sltp-label    { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.sltp-hint     { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.sltp-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color .18s;
  width: 100%;
}
.sltp-input.loss-input:focus   { border-color: var(--sell-color); }
.sltp-input.profit-input:focus { border-color: var(--accent); }

/* Auto sq-off status badges */
.pos-status-target {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.pos-status-sl {
  background: var(--sell-dim);
  color: var(--sell-color);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Light mode overrides for new elements */
[data-theme="light"] .copy-pct-row  { background: #f7f8fa; }
[data-theme="light"] .order-sl-tp-row { background: #f7f8fa; }
[data-theme="light"] .askai-bubble  { background: #f7f8fa; border-color: rgba(0,0,0,0.08); }
