/* ============================================================
   STOQUITY — Application Stylesheet
   ============================================================ */
:root {
  --bg: #080910;
  --bg2: #0d0f18;
  --bg3: #121520;
  --panel: #181b28;
  --panel2: #1e2133;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --gold: #d4a853;
  --gold2: #f0c97a;
  --gold-dim: rgba(212,168,83,0.12);
  --green: #3dd68c;
  --green-dim: rgba(61,214,140,0.12);
  --red: #f06b6b;
  --red-dim: rgba(240,107,107,0.12);
  --blue: #4d9ef5;
  --blue-dim: rgba(77,158,245,0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167,139,250,0.12);
  --orange: #f0a040;
  --orange-dim: rgba(240,160,64,0.12);
  --text: #c8c4b8;
  --text2: rgba(200,196,184,0.5);
  --text3: rgba(200,196,184,0.3);
  --cream: #ede8dc;
  --muted: #5a5d6e;
  --sidebar-w: 240px;
  --topbar-h: 52px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; background:var(--bg); color:var(--text); font-family:'IBM Plex Sans',sans-serif; font-size:13px; overflow:hidden; }
a { color:var(--gold); text-decoration:none; }
a:hover { text-decoration:underline; }
button { font-family:inherit; cursor:pointer; }
input, select, textarea { font-family:inherit; }
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.08); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,0.15); }

/* ============ LAYOUT ============ */
.app-layout { display:flex; height:100vh; overflow:hidden; }

/* SIDEBAR */
.sidebar { width:var(--sidebar-w); height:100vh; background:var(--bg2); border-right:1px solid var(--border); display:flex; flex-direction:column; flex-shrink:0; overflow-y:auto; transition:transform 0.25s ease; z-index:50; }
.sidebar-logo { padding:1rem 1.25rem; border-bottom:1px solid var(--border); font-family:'Libre Baskerville',serif; font-size:1.15rem; font-weight:700; color:var(--cream); letter-spacing:-0.02em; cursor:pointer; }
.sidebar-logo span { color:var(--gold); }
.sidebar-section { padding:0.75rem 0.875rem 0.25rem; font-size:0.6rem; text-transform:uppercase; letter-spacing:0.12em; color:var(--text3); }
.sidebar-nav { display:flex; flex-direction:column; gap:1px; padding:0.25rem 0.5rem; flex:1; }
.sidebar-item { display:flex; align-items:center; gap:0.625rem; padding:0.5rem 0.75rem; border-radius:4px; font-size:0.8rem; color:var(--text2); cursor:pointer; transition:all 0.15s; text-decoration:none; position:relative; }
.sidebar-item:hover { background:rgba(255,255,255,0.04); color:var(--text); text-decoration:none; }
.sidebar-item.active { background:var(--gold-dim); color:var(--gold); }
.sidebar-item .si-icon { width:18px; text-align:center; font-size:0.85rem; flex-shrink:0; opacity:0.7; }
.sidebar-item.active .si-icon { opacity:1; }
.sidebar-item .si-badge { margin-left:auto; background:var(--red); color:#fff; font-size:0.6rem; padding:0.1rem 0.4rem; border-radius:8px; font-weight:600; min-width:18px; text-align:center; }
.sidebar-footer { padding:0.875rem; border-top:1px solid var(--border); }
.sidebar-user { display:flex; align-items:center; gap:0.625rem; padding:0.5rem; border-radius:4px; cursor:pointer; transition:background 0.15s; }
.sidebar-user:hover { background:rgba(255,255,255,0.04); }
.sidebar-avatar { width:30px; height:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:0.65rem; font-weight:700; color:var(--bg); flex-shrink:0; }
.sidebar-user-name { font-size:0.78rem; color:var(--cream); font-weight:500; }
.sidebar-user-role { font-size:0.65rem; color:var(--text3); }
.sidebar-logout { display:flex; align-items:center; gap:0.5rem; padding:0.4rem 0.5rem; border-radius:4px; font-size:0.72rem; color:var(--text3); cursor:pointer; transition:all 0.15s; background:none; border:none; width:100%; margin-top:0.35rem; }
.sidebar-logout:hover { color:var(--red); background:var(--red-dim); }

/* MAIN CONTENT */
.main-wrap { flex:1; display:flex; flex-direction:column; overflow:hidden; min-width:0; }
.topbar { height:var(--topbar-h); border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 1.5rem; gap:1rem; flex-shrink:0; background:var(--bg); }
.topbar-title { font-family:'Libre Baskerville',serif; font-size:1rem; font-weight:700; color:var(--cream); white-space:nowrap; }
.topbar-breadcrumb { font-size:0.72rem; color:var(--text3); white-space:nowrap; }
.topbar-spacer { flex:1; }
.topbar-search { position:relative; }
.topbar-search input { width:220px; padding:0.4rem 0.75rem 0.4rem 2rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; color:var(--cream); font-size:0.78rem; outline:none; transition:border-color 0.2s, width 0.2s; }
.topbar-search input:focus { border-color:var(--gold); width:300px; }
.topbar-search .search-icon { position:absolute; left:0.6rem; top:50%; transform:translateY(-50%); color:var(--text3); font-size:0.75rem; pointer-events:none; }
.topbar-btn { width:32px; height:32px; display:flex; align-items:center; justify-content:center; border-radius:4px; background:transparent; border:1px solid var(--border); color:var(--text2); font-size:0.85rem; transition:all 0.15s; cursor:pointer; position:relative; }
.topbar-btn:hover { border-color:var(--gold); color:var(--gold); }
.topbar-btn .notif-dot { position:absolute; top:4px; right:4px; width:7px; height:7px; background:var(--red); border-radius:50%; border:1px solid var(--bg); }
.content-area { flex:1; overflow-y:auto; padding:1.5rem; }

/* ============ COMMON COMPONENTS ============ */
/* Cards */
.card { background:var(--panel); border:1px solid var(--border); border-radius:6px; padding:1.25rem; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.card-title { font-family:'Libre Baskerville',serif; font-size:0.9rem; font-weight:700; color:var(--cream); }
.card-subtitle { font-size:0.72rem; color:var(--text3); }
.card-body { }

/* Stats grid */
.stats-row { display:grid; gap:1rem; margin-bottom:1.5rem; }
.stats-row.cols-4 { grid-template-columns:repeat(4, 1fr); }
.stats-row.cols-3 { grid-template-columns:repeat(3, 1fr); }
.stats-row.cols-5 { grid-template-columns:repeat(5, 1fr); }
.stat-card { background:var(--panel); border:1px solid var(--border); border-radius:6px; padding:1rem 1.25rem; }
.stat-card .stat-label { font-size:0.68rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text3); margin-bottom:0.4rem; }
.stat-card .stat-value { font-family:'IBM Plex Mono',monospace; font-size:1.5rem; font-weight:500; color:var(--cream); line-height:1.2; }
.stat-card .stat-sub { font-size:0.7rem; margin-top:0.3rem; }

/* Buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:0.4rem; padding:0.45rem 1rem; border-radius:4px; font-size:0.78rem; font-weight:500; cursor:pointer; transition:all 0.15s; border:none; text-decoration:none; }
.btn:hover { text-decoration:none; }
.btn-gold { background:var(--gold); color:var(--bg); }
.btn-gold:hover { background:var(--gold2); }
.btn-ghost { background:transparent; border:1px solid var(--border); color:var(--text); }
.btn-ghost:hover { border-color:var(--gold); color:var(--gold); }
.btn-green { background:var(--green); color:var(--bg); }
.btn-green:hover { opacity:0.9; }
.btn-red { background:var(--red); color:#fff; }
.btn-red:hover { opacity:0.9; }
.btn-sm { padding:0.3rem 0.65rem; font-size:0.7rem; }
.btn-icon { width:28px; height:28px; padding:0; }

/* Tags/Badges */
.tag { display:inline-flex; align-items:center; gap:0.25rem; padding:0.15rem 0.5rem; border-radius:3px; font-size:0.65rem; font-weight:600; letter-spacing:0.03em; }
.tag-green { background:var(--green-dim); color:var(--green); }
.tag-red { background:var(--red-dim); color:var(--red); }
.tag-gold { background:var(--gold-dim); color:var(--gold); }
.tag-blue { background:var(--blue-dim); color:var(--blue); }
.tag-purple { background:var(--purple-dim); color:var(--purple); }
.tag-orange { background:var(--orange-dim); color:var(--orange); }
.tag-muted { background:rgba(90,93,110,0.2); color:var(--muted); }

/* Tables */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
thead th { padding:0.5rem 0.75rem; text-align:left; font-size:0.65rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text3); border-bottom:1px solid var(--border); font-weight:500; white-space:nowrap; }
tbody td { padding:0.6rem 0.75rem; border-bottom:1px solid var(--border); font-size:0.78rem; white-space:nowrap; }
tbody tr:hover { background:rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom:none; }

/* Form elements */
.form-group { margin-bottom:1rem; }
.form-label { display:block; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text3); margin-bottom:0.4rem; }
.form-input { width:100%; padding:0.5rem 0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; color:var(--cream); font-size:0.82rem; outline:none; transition:border-color 0.2s; }
.form-input:focus { border-color:var(--gold); }
.form-select { width:100%; padding:0.5rem 0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; color:var(--cream); font-size:0.82rem; outline:none; appearance:none; background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position:right 0.5rem center; background-repeat:no-repeat; background-size:1.5em 1.5em; padding-right:2.5rem; }
.form-select:focus { border-color:var(--gold); }
.form-textarea { width:100%; padding:0.5rem 0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; color:var(--cream); font-size:0.82rem; outline:none; resize:vertical; min-height:80px; transition:border-color 0.2s; }
.form-textarea:focus { border-color:var(--gold); }

/* Tabs */
.tabs { display:flex; gap:0; border-bottom:1px solid var(--border); margin-bottom:1.25rem; }
.tab { padding:0.5rem 1rem; font-size:0.78rem; color:var(--text2); cursor:pointer; border-bottom:2px solid transparent; transition:all 0.15s; background:none; border-top:none; border-left:none; border-right:none; }
.tab:hover { color:var(--text); }
.tab.active { color:var(--gold); border-bottom-color:var(--gold); }

/* Section headers */
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.25rem; }
.section-title { font-family:'Libre Baskerville',serif; font-size:1.1rem; font-weight:700; color:var(--cream); }
.section-actions { display:flex; gap:0.5rem; align-items:center; }

/* Empty state */
.empty-state { padding:3rem; text-align:center; }
.empty-icon { font-size:2.5rem; margin-bottom:0.75rem; opacity:0.3; }
.empty-title { font-size:0.9rem; color:var(--text2); margin-bottom:0.35rem; }
.empty-sub { font-size:0.75rem; color:var(--text3); }

/* ============ DASHBOARD ============ */
.dash-grid { display:grid; grid-template-columns:2fr 1fr; gap:1rem; }
.dash-chart-card { min-height:280px; }
.dash-recent { }
.dash-activity { }
.dash-activity .act-item { display:flex; gap:0.625rem; padding:0.625rem 0; border-bottom:1px solid var(--border); }
.dash-activity .act-item:last-child { border-bottom:none; }
.dash-activity .act-dot { width:8px; height:8px; border-radius:50%; margin-top:4px; flex-shrink:0; }
.dash-activity .act-text { font-size:0.78rem; color:var(--text); line-height:1.5; }
.dash-activity .act-time { font-size:0.65rem; color:var(--text3); margin-top:0.15rem; }

/* ============ PORTFOLIO CARDS GRID ============ */
.portfolio-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:1rem; }
.pf-card { background:var(--panel); border:1px solid var(--border); border-radius:6px; padding:1.25rem; cursor:pointer; transition:all 0.2s; }
.pf-card:hover { border-color:rgba(212,168,83,0.3); transform:translateY(-2px); box-shadow:0 8px 24px rgba(0,0,0,0.3); }
.pf-card-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:0.75rem; }
.pf-card-theme { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.1em; color:var(--gold); margin-bottom:0.2rem; }
.pf-card-name { font-family:'Libre Baskerville',serif; font-size:0.95rem; font-weight:700; color:var(--cream); }
.pf-card-return { font-family:'IBM Plex Mono',monospace; font-size:1.2rem; font-weight:500; text-align:right; }
.pf-card-return-sub { font-size:0.6rem; color:var(--text3); text-align:right; }
.pf-card-thesis { font-size:0.75rem; color:var(--text2); line-height:1.6; margin-bottom:0.875rem; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.pf-card-stats { display:grid; grid-template-columns:repeat(4, 1fr); gap:0.5rem; padding-top:0.75rem; border-top:1px solid var(--border); }
.pf-card-stat { text-align:center; }
.pf-card-stat-val { font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--cream); }
.pf-card-stat-label { font-size:0.6rem; color:var(--text3); }
.pf-card-footer { display:flex; align-items:center; justify-content:space-between; margin-top:0.75rem; padding-top:0.6rem; border-top:1px solid var(--border); }
.pf-card-meta { display:flex; align-items:center; gap:0.75rem; font-size:0.68rem; color:var(--text3); }
.pf-card-follow { }

/* ============ PORTFOLIO DETAIL ============ */
.pf-detail-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:1.5rem; }
.pf-detail-left { }
.pf-detail-theme { font-size:0.65rem; text-transform:uppercase; letter-spacing:0.1em; color:var(--gold); margin-bottom:0.25rem; }
.pf-detail-name { font-family:'Libre Baskerville',serif; font-size:1.6rem; font-weight:700; color:var(--cream); margin-bottom:0.4rem; }
.pf-detail-thesis { font-size:0.82rem; color:var(--text2); line-height:1.7; max-width:640px; }
.pf-detail-right { text-align:right; }
.pf-detail-nav { font-family:'IBM Plex Mono',monospace; font-size:2rem; font-weight:500; color:var(--cream); line-height:1; }
.pf-detail-nav-sub { font-size:0.75rem; margin-top:0.3rem; }
.pf-detail-actions { display:flex; gap:0.5rem; margin-top:0.75rem; }

.risk-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(130px, 1fr)); gap:0.75rem; }
.risk-item { background:var(--bg3); border:1px solid var(--border); border-radius:4px; padding:0.625rem 0.75rem; }
.risk-label { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text3); margin-bottom:0.25rem; }
.risk-value { font-family:'IBM Plex Mono',monospace; font-size:1rem; color:var(--cream); font-weight:500; }

.holding-card { display:flex; align-items:center; gap:0.75rem; padding:0.625rem 0; border-bottom:1px solid var(--border); }
.holding-card:last-child { border-bottom:none; }
.holding-symbol { width:42px; height:42px; background:var(--gold-dim); border-radius:6px; display:flex; align-items:center; justify-content:center; font-family:'IBM Plex Mono',monospace; font-size:0.65rem; font-weight:700; color:var(--gold); flex-shrink:0; cursor:pointer; transition:background 0.15s; }
.holding-symbol:hover { background:rgba(212,168,83,0.25); }
.holding-info { flex:1; min-width:0; }
.holding-name { font-size:0.82rem; color:var(--cream); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.holding-detail { font-size:0.68rem; color:var(--text3); }
.holding-right { text-align:right; }
.holding-weight { font-family:'IBM Plex Mono',monospace; font-size:0.82rem; color:var(--cream); }
.holding-pnl { font-family:'IBM Plex Mono',monospace; font-size:0.72rem; }

/* Trade cards */
.trade-card { padding:0.75rem; margin-bottom:0.5rem; border:1px solid var(--border); border-radius:4px; background:var(--bg3); }
.trade-card-header { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.4rem; }
.trade-action { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.08em; font-weight:700; padding:0.1rem 0.45rem; border-radius:2px; }
.trade-action.buy { background:var(--green-dim); color:var(--green); }
.trade-action.sell { background:var(--red-dim); color:var(--red); }
.trade-stock { font-size:0.82rem; color:var(--cream); font-weight:500; }
.trade-date { font-size:0.68rem; color:var(--text3); margin-left:auto; }
.trade-rationale { font-size:0.75rem; color:var(--text2); line-height:1.6; }
.trade-meta { display:flex; gap:1rem; margin-top:0.5rem; font-size:0.68rem; color:var(--text3); }

/* ============ SIGNAL QUEUE / ADMIN ============ */
.signal-card { padding:1rem; margin-bottom:0.75rem; border:1px solid var(--border); border-radius:6px; background:var(--panel); }
.signal-header { display:flex; align-items:center; gap:0.625rem; margin-bottom:0.5rem; }
.signal-conf { font-family:'IBM Plex Mono',monospace; font-size:0.82rem; }
.signal-actions { display:flex; gap:0.5rem; margin-top:0.75rem; }

/* ============ ALERTS ============ */
.alert-item { display:flex; align-items:flex-start; gap:0.75rem; padding:0.75rem; border-bottom:1px solid var(--border); transition:background 0.15s; cursor:pointer; }
.alert-item:hover { background:rgba(255,255,255,0.02); }
.alert-item.unread { border-left:3px solid var(--gold); }
.alert-icon { width:32px; height:32px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:0.9rem; flex-shrink:0; }
.alert-content { flex:1; min-width:0; }
.alert-title { font-size:0.82rem; color:var(--cream); font-weight:500; margin-bottom:0.2rem; }
.alert-detail { font-size:0.72rem; color:var(--text2); line-height:1.5; }
.alert-time { font-size:0.65rem; color:var(--text3); margin-top:0.25rem; }

/* ============ DIGESTS ============ */
.digest-card { background:var(--panel); border:1px solid var(--border); border-radius:6px; padding:1.25rem; margin-bottom:1rem; }
.digest-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:1rem; }
.digest-portfolio { font-family:'Libre Baskerville',serif; font-size:1rem; font-weight:700; color:var(--cream); }
.digest-month { font-size:0.72rem; color:var(--gold); }
.digest-section { margin-bottom:1rem; }
.digest-section-title { font-size:0.7rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--gold); margin-bottom:0.4rem; }
.digest-section-text { font-size:0.82rem; color:var(--text); line-height:1.7; }

/* ============ CHARTS ============ */
.chart-container { position:relative; width:100%; }
.chart-container svg { width:100%; display:block; }
.chart-tooltip { position:absolute; background:var(--panel2); border:1px solid var(--border2); border-radius:4px; padding:0.4rem 0.6rem; font-size:0.7rem; color:var(--cream); pointer-events:none; opacity:0; transition:opacity 0.15s; z-index:20; white-space:nowrap; }
.chart-legend { display:flex; gap:1rem; margin-top:0.5rem; flex-wrap:wrap; }
.chart-legend-item { display:flex; align-items:center; gap:0.35rem; font-size:0.68rem; color:var(--text2); }
.chart-legend-dot { width:8px; height:8px; border-radius:2px; }
.sparkline { display:inline-block; vertical-align:middle; }

/* Donut */
.donut-wrap { display:flex; align-items:center; gap:1.5rem; }
.donut-legend { display:flex; flex-direction:column; gap:0.35rem; }
.donut-legend-item { display:flex; align-items:center; gap:0.5rem; font-size:0.75rem; }
.donut-legend-dot { width:10px; height:10px; border-radius:2px; flex-shrink:0; }
.donut-legend-pct { font-family:'IBM Plex Mono',monospace; color:var(--cream); min-width:30px; }
.donut-legend-name { color:var(--text2); }

/* ============ MODALS ============ */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:200; display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity 0.2s; }
.modal-overlay.visible { opacity:1; pointer-events:all; }
.modal { background:var(--panel); border:1px solid var(--border2); border-radius:8px; width:90%; max-width:520px; max-height:85vh; overflow-y:auto; box-shadow:0 30px 80px rgba(0,0,0,0.6); transform:scale(0.95); transition:transform 0.2s; }
.modal-overlay.visible .modal { transform:scale(1); }
.modal-lg { max-width:720px; }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid var(--border); }
.modal-title { font-family:'Libre Baskerville',serif; font-size:1rem; font-weight:700; color:var(--cream); }
.modal-close { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border-radius:4px; background:transparent; border:1px solid var(--border); color:var(--text2); cursor:pointer; font-size:1rem; transition:all 0.15s; }
.modal-close:hover { border-color:var(--red); color:var(--red); }
.modal-body { padding:1.25rem; }
.modal-footer { padding:0.875rem 1.25rem; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:0.5rem; }

/* Stock popup */
.stock-popup { max-width:420px; }
.stock-popup-price { font-family:'IBM Plex Mono',monospace; font-size:1.8rem; font-weight:500; color:var(--cream); }
.stock-popup-change { font-family:'IBM Plex Mono',monospace; font-size:0.9rem; margin-left:0.5rem; }
.stock-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.5rem 1.5rem; margin-top:0.75rem; }
.stock-detail-item { padding:0.4rem 0; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; }
.stock-detail-label { font-size:0.72rem; color:var(--text3); }
.stock-detail-val { font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--cream); }
.stock-portfolios { margin-top:0.75rem; }
.stock-pf-item { display:flex; align-items:center; justify-content:space-between; padding:0.35rem 0; font-size:0.78rem; }

/* ============ TOAST ============ */
.toast-container { position:fixed; bottom:1.5rem; right:1.5rem; z-index:300; display:flex; flex-direction:column-reverse; gap:0.5rem; }
.toast { display:flex; align-items:center; gap:0.625rem; padding:0.625rem 1rem; background:var(--panel2); border:1px solid var(--border2); border-radius:6px; box-shadow:0 8px 24px rgba(0,0,0,0.4); animation:toastIn 0.3s ease; min-width:260px; max-width:400px; }
.toast.removing { animation:toastOut 0.3s ease forwards; }
.toast-icon { font-size:1rem; flex-shrink:0; }
.toast-text { font-size:0.78rem; color:var(--cream); flex:1; }
.toast-close { background:none; border:none; color:var(--text3); cursor:pointer; font-size:0.85rem; padding:0.2rem; }
@keyframes toastIn { from { opacity:0; transform:translateY(12px) scale(0.95); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); } to { opacity:0; transform:translateY(12px) scale(0.95); } }

/* ============ SEARCH RESULTS ============ */
.search-results { position:absolute; top:100%; left:0; right:0; background:var(--panel); border:1px solid var(--border2); border-radius:0 0 6px 6px; max-height:320px; overflow-y:auto; z-index:60; box-shadow:0 12px 32px rgba(0,0,0,0.5); display:none; }
.search-results.visible { display:block; }
.search-result-item { display:flex; align-items:center; gap:0.625rem; padding:0.5rem 0.75rem; cursor:pointer; transition:background 0.15s; }
.search-result-item:hover { background:rgba(255,255,255,0.04); }
.search-result-type { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.06em; padding:0.1rem 0.35rem; border-radius:2px; background:var(--gold-dim); color:var(--gold); }
.search-result-name { font-size:0.82rem; color:var(--cream); }
.search-result-sub { font-size:0.68rem; color:var(--text3); margin-left:auto; }

/* ============ ADMIN SPECIFIC ============ */
.admin-metric-row { display:flex; gap:0.75rem; margin-bottom:1rem; }
.admin-metric { flex:1; background:var(--bg3); border:1px solid var(--border); border-radius:4px; padding:0.75rem; text-align:center; }
.admin-metric .am-val { font-family:'IBM Plex Mono',monospace; font-size:1.25rem; color:var(--cream); font-weight:500; }
.admin-metric .am-label { font-size:0.65rem; color:var(--text3); margin-top:0.2rem; text-transform:uppercase; letter-spacing:0.06em; }

.config-row { display:flex; align-items:center; justify-content:space-between; padding:0.625rem 0; border-bottom:1px solid var(--border); }
.config-row:last-child { border-bottom:none; }
.config-key { font-size:0.78rem; color:var(--cream); font-weight:500; }
.config-desc { font-size:0.68rem; color:var(--text3); }
.config-value { font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--gold); }

/* Feed status indicators */
.feed-status { display:inline-flex; align-items:center; gap:0.35rem; }
.feed-dot { width:8px; height:8px; border-radius:50%; }
.feed-dot.active { background:var(--green); animation:pulse-dot 2s infinite; }
.feed-dot.degraded { background:var(--orange); }
.feed-dot.error { background:var(--red); }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

/* ============ SETTINGS ============ */
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; }
.settings-section { }
.settings-section-title { font-family:'Libre Baskerville',serif; font-size:0.9rem; font-weight:700; color:var(--cream); margin-bottom:1rem; padding-bottom:0.5rem; border-bottom:1px solid var(--border); }

/* ============ LOADING ============ */
.loading-spinner { display:inline-block; width:20px; height:20px; border:2px solid var(--border); border-top-color:var(--gold); border-radius:50%; animation:spin 0.6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.page-loading { display:flex; align-items:center; justify-content:center; min-height:200px; }
.skeleton { background:linear-gradient(90deg, var(--bg3) 25%, rgba(255,255,255,0.05) 50%, var(--bg3) 75%); background-size:200% 100%; animation:shimmer 1.5s infinite; border-radius:4px; }
@keyframes shimmer { from { background-position:200% 0; } to { background-position:-200% 0; } }

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
  .stats-row.cols-4 { grid-template-columns:repeat(2, 1fr); }
  .stats-row.cols-5 { grid-template-columns:repeat(3, 1fr); }
  .dash-grid { grid-template-columns:1fr; }
  .settings-grid { grid-template-columns:1fr; }
}
@media (max-width: 768px) {
  .sidebar { position:fixed; left:0; top:0; transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .content-area { padding:1rem; }
  .portfolio-grid { grid-template-columns:1fr; }
  .pf-detail-header { flex-direction:column; gap:1rem; }
  .risk-grid { grid-template-columns:repeat(2, 1fr); }
  .stats-row.cols-4, .stats-row.cols-3, .stats-row.cols-5 { grid-template-columns:1fr; }
  .stock-detail-grid { grid-template-columns:1fr; }
}

/* ============ PARADE / SEASONS ============ */
.leaderboard-controls { padding: 0.9rem 1rem; }
.leaderboard-controls-row { display:flex; align-items:center; justify-content:space-between; gap:0.75rem; flex-wrap:wrap; }
.leaderboard-legend-right { display:flex; align-items:center; justify-content:flex-end; gap:0.75rem; flex-wrap:wrap; }
.leaderboard-legend { display:flex; align-items:center; gap:0.35rem; }
.leaderboard-legend .legend-note { font-size:0.72rem; color:var(--text3); margin-left:0.35rem; }
.leaderboard-quick { display:flex; align-items:center; gap:0.4rem; }

.leaderboard-adv { margin-top:0.75rem; padding-top:0.75rem; border-top:1px solid var(--border); }
.leaderboard-adv-row { display:flex; align-items:center; gap:0.5rem; flex-wrap:wrap; }

@media (max-width: 768px) {
  .leaderboard-adv-row { align-items:stretch; }
  .leaderboard-adv-row .form-input, .leaderboard-adv-row .form-select { width:100% !important; }
}

@media (max-width: 768px) {
  .leaderboard-legend-right { justify-content:flex-start; }
}

.season-strip { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:0.75rem 1rem; border:1px solid var(--border); border-radius:6px; background:rgba(18,21,32,0.55); margin:0 0 1rem; }
.season-strip-left { display:flex; align-items:center; gap:0.75rem; min-width:0; }
.season-strip-title { font-size:0.7rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text3); }
.season-strip-meta { font-size:0.78rem; color:var(--text2); margin-top:0.15rem; }
.provisional-countdown { color: var(--orange) !important; }

/* Default leaderboard view is "All"; eligible rows are subtly highlighted */
.row-eligible { background: rgba(61, 214, 140, 0.07); }
.row-eligible:hover { background: rgba(61, 214, 140, 0.11); }
.row-eligible td:first-child { border-left: 3px solid var(--green); }

.row-provisional:hover { background: rgba(255, 255, 255, 0.03); }

/* ============ UTILITY ============ */
.text-green { color:var(--green) !important; }
.text-red { color:var(--red) !important; }
.text-gold { color:var(--gold) !important; }
.text-blue { color:var(--blue) !important; }
.text-orange { color:var(--orange) !important; }
.text-muted { color:var(--muted) !important; }
.text-cream { color:var(--cream) !important; }
.text-mono { font-family:'IBM Plex Mono',monospace !important; }
.fw-500 { font-weight:500; }
.fw-600 { font-weight:600; }
.mt-1 { margin-top:0.5rem; }
.mt-2 { margin-top:1rem; }
.mt-3 { margin-top:1.5rem; }
.mb-1 { margin-bottom:0.5rem; }
.mb-2 { margin-bottom:1rem; }
.gap-1 { gap:0.5rem; }
.d-flex { display:flex; }
.align-center { align-items:center; }
.justify-between { justify-content:space-between; }
.flex-1 { flex:1; }
.w-full { width:100%; }
.hidden { display:none !important; }
.truncate { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Financial bar (portfolio $100K tracking) */
.fin-bar { display:grid; grid-template-columns:repeat(6,1fr); gap:0; margin-bottom:1rem; border:1px solid var(--border); border-radius:6px; background:rgba(18,21,32,0.6); }
.fin-item { padding:0.75rem 1rem; border-right:1px solid var(--border); text-align:center; }
.fin-item:last-child { border-right:none; }
.fin-label { font-size:0.62rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text3); margin-bottom:0.3rem; }
.fin-val { font-family:'IBM Plex Mono',monospace; font-size:0.82rem; font-weight:500; color:var(--text); }
.fin-val.text-cream { color:var(--cream); font-weight:600; }

@media(max-width:768px) {
  .fin-bar { grid-template-columns:repeat(3,1fr); }
  .fin-item:nth-child(3) { border-right:none; }
}

/* ============ PORTFOLIO CONSTRUCTION WIZARD ============ */
.wizard-steps { display:flex; gap:0; margin-bottom:1.5rem; border:1px solid var(--border); border-radius:6px; overflow:hidden; }
.wizard-step { flex:1; padding:0.6rem 0.75rem; text-align:center; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text3); background:var(--bg3); border-right:1px solid var(--border); cursor:pointer; transition:all 0.2s; }
.wizard-step:last-child { border-right:none; }
.wizard-step.active { background:var(--gold-dim); color:var(--gold); font-weight:600; }
.wizard-step.completed { background:var(--green-dim); color:var(--green); }
.wizard-step-num { display:block; font-size:1rem; font-weight:700; margin-bottom:0.15rem; }

.wizard-panel { padding:0.5rem 0; }
.wizard-panel .form-group { margin-bottom:1rem; }
.wizard-field-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.wizard-field-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:0.75rem; }

.weight-slider-group { display:flex; align-items:center; gap:0.75rem; padding:0.4rem 0; }
.weight-slider-label { width:90px; font-size:0.75rem; color:var(--text2); }
.weight-slider { flex:1; -webkit-appearance:none; appearance:none; height:4px; background:var(--border); border-radius:4px; outline:none; }
.weight-slider::-webkit-slider-thumb { -webkit-appearance:none; width:14px; height:14px; border-radius:50%; background:var(--gold); cursor:pointer; }
.weight-slider-val { width:36px; text-align:right; font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--gold); }

.holdings-preview { display:flex; flex-direction:column; gap:0.5rem; margin-top:0.75rem; }
.holding-preview-row { display:flex; align-items:center; gap:0.5rem; padding:0.5rem 0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; }
.holding-preview-sym { font-family:'IBM Plex Mono',monospace; font-weight:600; color:var(--gold); width:60px; }
.holding-preview-name { flex:1; font-size:0.78rem; color:var(--cream); }
.holding-preview-weight { font-family:'IBM Plex Mono',monospace; font-size:0.78rem; color:var(--gold); width:40px; text-align:right; }
.holding-preview-remove { background:none; border:none; color:var(--red); cursor:pointer; font-size:0.9rem; padding:0 0.3rem; opacity:0.6; }
.holding-preview-remove:hover { opacity:1; }

.sector-tag { display:inline-flex; align-items:center; gap:0.3rem; padding:0.25rem 0.6rem; margin:0.2rem; border:1px solid var(--border); border-radius:999px; font-size:0.7rem; color:var(--text2); cursor:pointer; transition:all 0.2s; }
.sector-tag.selected { border-color:var(--gold); background:var(--gold-dim); color:var(--gold); }
.sector-tag:hover { border-color:var(--gold); }

.ips-preview { background:var(--bg3); border:1px solid var(--border); border-radius:6px; padding:1rem; font-size:0.78rem; color:var(--text); line-height:1.7; white-space:pre-wrap; max-height:240px; overflow-y:auto; }

/* ============ SUNSET DIALOG ============ */
.sunset-warning { background:var(--red-dim); border:1px solid rgba(240,107,107,0.3); border-radius:6px; padding:1rem; margin-bottom:1rem; }
.sunset-warning-title { font-size:0.9rem; font-weight:600; color:var(--red); margin-bottom:0.5rem; }
.sunset-warning-text { font-size:0.78rem; color:var(--text); line-height:1.6; }
.sunset-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:0.75rem; margin:1rem 0; }
.sunset-stat { padding:0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; text-align:center; }
.sunset-stat-val { font-family:'IBM Plex Mono',monospace; font-size:1.1rem; font-weight:600; color:var(--cream); }
.sunset-stat-label { font-size:0.65rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text3); margin-top:0.3rem; }

/* ============ INVESTMENT COMMITTEE ============ */
.committee-container { display:flex; flex-direction:column; height:calc(100vh - var(--topbar-h) - 3rem); max-height:calc(100vh - var(--topbar-h) - 3rem); }
.committee-header { margin-bottom:1rem; flex-shrink:0; }
.committee-members { display:flex; gap:1rem; margin-bottom:1rem; flex-shrink:0; }
.committee-member { flex:1; padding:0.75rem; background:var(--bg3); border:1px solid var(--border); border-radius:6px; text-align:center; }
.committee-member-icon { font-size:1.5rem; margin-bottom:0.3rem; }
.committee-member-name { font-size:0.82rem; font-weight:600; color:var(--cream); }
.committee-member-role { font-size:0.68rem; color:var(--text3); }
.committee-member-model { font-size:0.6rem; color:var(--text3); margin-top:0.3rem; font-style:italic; }

.committee-chat { flex:1; overflow-y:auto; padding:0.5rem 0; display:flex; flex-direction:column; gap:1rem; min-height:0; }
.committee-msg { padding:1rem; border:1px solid var(--border); border-radius:6px; background:var(--bg3); }
.committee-msg.user { background:var(--gold-dim); border-color:rgba(212,168,83,0.3); }
.committee-msg-header { display:flex; align-items:center; gap:0.5rem; margin-bottom:0.5rem; }
.committee-msg-sender { font-size:0.78rem; font-weight:600; color:var(--cream); }
.committee-msg-meta { font-size:0.65rem; color:var(--text3); margin-left:auto; }
.committee-msg-body { font-size:0.82rem; color:var(--text); line-height:1.7; white-space:pre-wrap; }
.committee-msg-confidence { display:inline-flex; align-items:center; gap:0.3rem; margin-top:0.5rem; font-size:0.7rem; padding:0.2rem 0.5rem; border-radius:999px; }
.committee-msg.consensus { background:rgba(77,158,245,0.08); border-color:rgba(77,158,245,0.2); }
.committee-msg.consensus .committee-msg-sender { color:var(--blue); }

.committee-input-area { flex-shrink:0; display:flex; gap:0.5rem; padding-top:0.75rem; border-top:1px solid var(--border); margin-top:auto; }
.committee-input { flex:1; padding:0.65rem 0.875rem; background:var(--bg3); border:1px solid var(--border); border-radius:6px; color:var(--cream); font-family:'IBM Plex Sans',sans-serif; font-size:0.82rem; outline:none; transition:border-color 0.2s; }
.committee-input:focus { border-color:var(--gold); }
.committee-context-bar { display:flex; gap:0.5rem; align-items:center; flex-shrink:0; margin-bottom:0.5rem; }
.committee-context-select { padding:0.4rem 0.6rem; background:var(--bg3); border:1px solid var(--border); border-radius:4px; color:var(--cream); font-size:0.75rem; outline:none; }
.committee-thinking { display:flex; align-items:center; gap:0.5rem; padding:0.75rem 1rem; font-size:0.78rem; color:var(--gold); }
.committee-thinking-dots { display:flex; gap:3px; }
.committee-thinking-dots span { width:6px; height:6px; border-radius:50%; background:var(--gold); animation:committeePulse 1.2s infinite; }
.committee-thinking-dots span:nth-child(2) { animation-delay:0.2s; }
.committee-thinking-dots span:nth-child(3) { animation-delay:0.4s; }
@keyframes committeePulse { 0%,80%,100% { opacity:0.3; } 40% { opacity:1; } }

/* Quick question buttons */
.committee-quick-btns { display:flex; flex-wrap:wrap; gap:0.4rem; margin-bottom:0.75rem; flex-shrink:0; }
.committee-quick-btn { padding:0.3rem 0.65rem; background:var(--bg3); border:1px solid var(--border); border-radius:999px; color:var(--text2); font-size:0.7rem; cursor:pointer; transition:all 0.2s; }
.committee-quick-btn:hover { border-color:var(--gold); color:var(--gold); background:var(--gold-dim); }

/* Admin portfolio action buttons row */
.admin-pf-actions { display:flex; gap:0.5rem; margin-bottom:1rem; }
.btn-green { background:var(--green); color:var(--bg); border:none; }
.btn-green:hover { filter:brightness(1.1); }
.btn-red { background:var(--red); color:var(--bg); border:none; }
.btn-red:hover { filter:brightness(1.1); }
