/* ── Variables ───────────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --sidebar-w: 220px;
  --topbar-h: 60px;

  /* ── Dark Palette ──────────────────────────────────────────────── */
  --bg:       #0b1120;
  --surface:  #111827;
  --card:     #1a2235;
  --border:   #1f2d45;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --accent:   #3b82f6;
  --green:    #10b981;
  --red:      #ef4444;
  --amber:    #f59e0b;
  --purple:   #8b5cf6;
  --teal:     #14b8a6;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,.45);
  --font:     'Inter', system-ui, -apple-system, sans-serif;

  /* ── Aliases (backward compat) ─────────────────────────────────── */
  --primary:          #3b82f6;
  --text-muted:       #64748b;
  --green-bg:         rgba(16,185,129,.15);
  --red-bg:           rgba(239,68,68,.15);
  --sidebar-bg:       #080e1c;
  --sidebar-text:     #64748b;
  --sidebar-active:   #e2e8f0;
  --sidebar-active-bg: rgba(59,130,246,.15);

  /* ── Table vars ─────────────────────────────────────────────────── */
  --table-head-bg:  rgba(255,255,255,.025);
  --table-border:   rgba(31,45,69,.8);
  --table-hover:    rgba(59,130,246,.04);
  --table-stripe:   rgba(255,255,255,.015);
  --card-hover:     #1e2a3d;
  --input-bg:       #0d1525;
  --bg-subtle:      #111827;
  --bg-secondary:   #141d2e;
  --bg-alpha:       rgba(255,255,255,.025);
}

/* ── Light Palette ───────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:       #f1f5f9;
  --surface:  #ffffff;
  --card:     #ffffff;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --muted:    #64748b;
  --accent:   #2563eb;
  --green:    #16a34a;
  --red:      #dc2626;
  --amber:    #d97706;
  --purple:   #7c3aed;
  --teal:     #0d9488;
  --shadow:   0 4px 24px rgba(0,0,0,.08);

  --primary:          #2563eb;
  --text-muted:       #64748b;
  --green-bg:         rgba(22,163,74,.1);
  --red-bg:           rgba(220,38,38,.1);
  --sidebar-bg:       #ffffff;
  --sidebar-text:     #64748b;
  --sidebar-active:   #1e293b;
  --sidebar-active-bg: rgba(37,99,235,.1);

  --table-head-bg:  rgba(0,0,0,.02);
  --table-border:   #e2e8f0;
  --table-hover:    rgba(37,99,235,.04);
  --table-stripe:   rgba(0,0,0,.015);
  --card-hover:     #f8fafc;
  --input-bg:       #ffffff;
  --bg-subtle:      #f8fafc;
  --bg-secondary:   #f1f5f9;
  --bg-alpha:       rgba(0,0,0,.025);
}

/* ── Light overrides for hardcoded dark elements ──────────────────── */
[data-theme="light"] .stock-hero-panel {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}
[data-theme="light"] .stock-hero-logo { background: rgba(0,0,0,.04); }
[data-theme="light"] .stock-exch-badge {
  background: rgba(37,99,235,.1);
  border-color: rgba(37,99,235,.2);
}
[data-theme="light"] .stock-score-box {
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.2);
  box-shadow: 0 0 10px rgba(37,99,235,.12);
}
[data-theme="light"] .r-score-bar-outer { background: rgba(0,0,0,.06); }
[data-theme="light"] .score-tooltip-icon { background: rgba(0,0,0,.05); }
[data-theme="light"] .score-tooltip-box {
  background: #ffffff;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
[data-theme="light"] .score-tooltip-box::before { border-right-color: #ffffff; }
[data-theme="light"] .score-gray.score-badge { background: rgba(0,0,0,.04); }
[data-theme="light"] .notif-btn:hover,
[data-theme="light"] .theme-btn:hover { background: rgba(0,0,0,.05); }

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { border: none; background: none; cursor: pointer; }

/* ── Layout ──────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(59,130,246,.45);
}
.logo-text {
  font-size: 15px; font-weight: 800; color: var(--text);
  letter-spacing: -.3px;
}

.nav-list { padding: 10px 8px; flex: 1; }
.nav-item + .nav-item { margin-top: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.nav-item.active .nav-link {
  background: linear-gradient(90deg, rgba(59,130,246,.18), rgba(59,130,246,.04));
  color: var(--text);
  border-left: 2px solid var(--accent);
  padding-left: 9px;
  box-shadow: 0 0 14px rgba(59,130,246,.12);
}
.nav-link svg { flex-shrink: 0; opacity: .75; }
.nav-item.active .nav-link svg { opacity: 1; color: var(--accent); }

/* ── Bouton de réduction du menu (icônes seules) ─────────────────── */
.sidebar-toggle {
  display: flex; align-items: center; gap: 11px;
  margin: 8px; padding: 9px 11px;
  background: none; border: none; border-radius: 8px; cursor: pointer;
  color: var(--sidebar-text); font-family: inherit; font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidebar-toggle .st-ico { flex-shrink: 0; transition: transform .2s; }

html.sidebar-collapsed { --sidebar-w: 64px; }
html.sidebar-collapsed .logo-text,
html.sidebar-collapsed .nav-link span,
html.sidebar-collapsed .sidebar-toggle span { display: none; }
html.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 18px 0 20px; }
html.sidebar-collapsed .nav-list { padding: 10px 6px; }
html.sidebar-collapsed .nav-link { justify-content: center; gap: 0; padding: 10px 0; }
html.sidebar-collapsed .nav-item.active .nav-link { border-left: none; padding-left: 0; }
html.sidebar-collapsed .sidebar-toggle { justify-content: center; gap: 0; margin: 8px auto; padding: 9px; }
html.sidebar-collapsed .sidebar-toggle .st-ico { transform: rotate(180deg); }

/* Déconnexion (bas de la sidebar) */
.sidebar-logout {
  margin: 4px 8px 12px; border-top: 1px solid var(--border); padding-top: 14px;
}
.sidebar-logout:hover { color: #f87171 !important; background: rgba(220,38,38,.08); }
.sidebar-logout svg { opacity: .75; }
html.sidebar-collapsed .sidebar-logout { justify-content: center; gap: 0; padding: 12px 0 10px; margin: 4px 6px 10px; }

/* ── Main wrapper ────────────────────────────────────────────────── */
.sidebar { transition: width .2s ease; }
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left .2s ease;
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  width: 320px;
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within {
  border-color: rgba(59,130,246,.45);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-input {
  border: none; background: transparent;
  font-family: var(--font);
  font-size: 13px; color: var(--text); outline: none; width: 100%;
}
.search-input::placeholder { color: var(--muted); }

/* ── Search dropdown ─────────────────────────────────────────────── */
.sd-drop {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 300;
  overflow: hidden;
}
.sd-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; cursor: pointer;
  transition: background .12s;
}
.sd-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.sd-item:hover { background: rgba(255,255,255,.04); }
.sd-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,.07); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.sd-logo img { width: 28px; height: 28px; object-fit: contain; }
.sd-logo-fb { background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.sd-logo-fb::after { content: attr(data-ini); }
.sd-info { flex: 1; min-width: 0; }
.sd-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sd-meta { display: flex; gap: 7px; align-items: center; margin-top: 2px; }
.sd-exch {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--accent); border-radius: 4px; padding: 1px 6px;
}
.sd-sym { font-size: 11px; color: var(--muted); }

.notif-btn {
  position: relative; padding: 8px;
  border-radius: 8px; color: var(--muted);
  transition: background .15s;
}
.notif-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 6px var(--accent), 0 0 12px rgba(59,130,246,.4);
}

.theme-btn {
  position: relative; padding: 8px; border-radius: 8px;
  color: var(--muted); transition: background .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }
.theme-btn .theme-icon-sun,
.theme-btn .theme-icon-moon { display: block; }
[data-theme="dark"] .theme-btn .theme-icon-sun { display: none; }
[data-theme="light"] .theme-btn .theme-icon-moon { display: none; }

/* ── Content area ────────────────────────────────────────────────── */
.content { padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 18px; }

/* ── Panels (cards) ──────────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .25s, box-shadow .3s;
}
.panel:hover {
  border-color: rgba(59,130,246,.2);
  box-shadow: 0 0 0 1px rgba(59,130,246,.07), 0 6px 28px rgba(0,0,0,.55);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.panel-link { font-size: 12px; color: var(--accent); font-weight: 500; }
.panel-link:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
}
.badge::before { content: '●'; font-size: 8px; }
.badge-neutral {
  background: rgba(245,158,11,.12);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,.25);
}
.badge-neutral::before { color: var(--amber); }
.badge-bull {
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(16,185,129,.3);
  box-shadow: 0 0 8px rgba(16,185,129,.2);
}
.badge-bull::before { color: var(--green); }
.badge-bear {
  background: var(--red-bg); color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
  box-shadow: 0 0 8px rgba(239,68,68,.2);
}
.badge-bear::before { color: var(--red); }

/* ── Charts row (index cards) ────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 10px;
  min-height: 160px;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color .25s, box-shadow .3s;
}
.chart-card:hover {
  border-color: rgba(59,130,246,.2);
  box-shadow: 0 0 0 1px rgba(59,130,246,.07), 0 6px 28px rgba(0,0,0,.55);
}
.chart-card.skeleton { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2px; }
.chart-flag-name { display: flex; align-items: center; gap: 5px; }
.chart-flag { font-size: 14px; line-height: 1; }
.chart-name { font-size: 11px; font-weight: 600; color: var(--muted); }
.expand-btn { color: var(--muted); opacity: .6; }
.chart-price { font-size: 18px; font-weight: 700; color: var(--text); margin: 4px 0 2px; letter-spacing: -.4px; }
.chart-change { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.chart-change.pos { color: var(--green); }
.chart-change.neg { color: var(--red); }
/* Hauteur FIXE : évite la boucle de redimensionnement Chart.js (responsive +
   maintainAspectRatio:false dans un conteneur flex:1 à hauteur variable). */
.chart-canvas-wrap { position: relative; margin-top: 8px; height: 72px; }
.chart-canvas-wrap canvas { width: 100% !important; height: 100% !important; }
.no-data { color: var(--muted); font-size: 12px; margin: auto; display: flex; align-items: center; justify-content: center; flex: 1; }

/* ── Recent bar ──────────────────────────────────────────────────── */
.recent-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  overflow-x: auto; scrollbar-width: none;
}
.recent-bar::-webkit-scrollbar { display: none; }
.recent-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; white-space: nowrap;
  font-size: 12.5px; color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.recent-item:hover { color: var(--text); }

/* ── Markets ─────────────────────────────────────────────────────── */
.markets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.market-col { padding: 14px 20px; }
.market-col + .market-col { border-left: 1px solid var(--border); }
.market-region {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
}
.market-region-btn {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; padding: 4px 9px; margin: -4px 0 6px -9px;
  border-radius: 7px; transition: background .12s, color .12s;
  user-select: none;
}
.market-region-btn .market-region-ic { opacity: .5; transition: opacity .12s; }
.market-region-btn:hover { color: var(--text); background: var(--bg-alpha); }
.market-region-btn:hover .market-region-ic { opacity: 1; }
.market-region-btn.active { color: var(--accent); background: rgba(59,130,246,.12); }
.market-region-btn.active .market-region-ic { opacity: 1; color: var(--accent); }
.market-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.market-row:last-child { border-bottom: none; }
.market-name { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.market-flag { font-size: 14px; }
.market-hours { font-size: 11px; color: var(--muted); margin-left: 4px; }
.market-status {
  font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: 20px; flex-shrink: 0;
}
.market-status.open   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.market-status.closed { background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--border); }

/* ── Mid / Bot rows ──────────────────────────────────────────────── */
.mid-row { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; }
.bot-row { display: grid; grid-template-columns: 0.85fr 1fr 1fr; gap: 18px; }

/* ── Recommandations d'analystes ─────────────────────────────────── */
.reco-panel { margin-bottom: 18px; }
.reco-table td { vertical-align: middle; }
.reco-tk { display: flex; flex-direction: column; gap: 1px; text-decoration: none; }
.reco-tk .reco-sym { font-weight: 700; color: var(--text); }
.reco-tk:hover .reco-sym { color: var(--accent); }
.reco-tk .reco-name { font-size: 11.5px; color: var(--text-muted); }
.reco-firm { color: var(--text); font-weight: 500; }
.reco-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.reco-up      { color: #16a34a; background: rgba(22,163,74,.12); }
.reco-down    { color: #dc2626; background: rgba(220,38,38,.12); }
.reco-init    { color: #2563eb; background: rgba(37,99,235,.12); }
.reco-neutral { color: var(--text-muted); background: rgba(148,163,184,.14); }
.reco-grade-from { color: var(--text-muted); text-decoration: line-through; font-size: 12px; }
.reco-arrow { color: var(--text-muted); margin: 0 4px; }
.reco-grade-to { color: var(--text); font-weight: 600; font-size: 12.5px; }
.reco-pt { font-weight: 700; font-variant-numeric: tabular-nums; }
.reco-date { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Agenda économique ───────────────────────────────────────────── */
.econ-panel { margin-bottom: 18px; }
.econ-table td { vertical-align: middle; }
.econ-table tr.econ-day td { background: var(--surface); color: var(--text-muted); font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 6px 12px; border-top: 1px solid var(--border); }
.econ-when { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.econ-flag { font-size: 17px; text-align: center; }
.econ-title { color: var(--text); font-weight: 500; }
.econ-period { color: var(--muted); font-size: 11px; margin-left: 7px; }
.econ-imp { display: inline-flex; gap: 2px; align-items: center; }
.econ-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.econ-imp-hi { background: #dc2626; } .econ-imp-md { background: #d97706; }
.econ-dot-off { background: var(--border); }
.econ-actual { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.econ-table .text-right { font-variant-numeric: tabular-nums; }
.econ-prev { color: var(--text-muted); }
.econ-na { color: var(--muted); }
.econ-table .text-center { text-align: center; }

/* ── Hedge Funds (positions 13F) ─────────────────────────────────── */
.hf-layout { display: grid; grid-template-columns: 370px 1fr; gap: 18px; align-items: start; }
.hf-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px;
  max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 4px; }
.hf-fund { display: flex; gap: 12px; text-align: left; cursor: pointer; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  transition: border-color .12s, background .12s; }
.hf-fund:hover { border-color: var(--accent); }
.hf-fund.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: var(--surface); }
.hf-fund-rank { flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: var(--muted); }
.hf-fund.active .hf-fund-rank { background: var(--accent); color: #fff; border-color: var(--accent); }
.hf-fund-body { flex: 1; min-width: 0; }
.hf-fund-top { display: flex; align-items: baseline; gap: 8px; }
.hf-fund-name { font-weight: 700; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-fund-val { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hf-fund-mid { display: flex; align-items: center; gap: 8px; margin: 4px 0 3px; }
.hf-fund-mgr { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-fund-nh { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.hf-fund-holds { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hf-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.hf-st-ls    { color: #3b82f6; background: rgba(59,130,246,.13); }
.hf-st-value { color: #16a34a; background: rgba(22,163,74,.13); }
.hf-st-macro { color: #d97706; background: rgba(217,119,6,.14); }
.hf-st-quant { color: #7c3aed; background: rgba(124,58,237,.14); }
.hf-st-multi { color: #0891b2; background: rgba(8,145,178,.14); }
.hf-st-activ { color: #dc2626; background: rgba(220,38,38,.13); }
.hf-st-event { color: #db2777; background: rgba(219,39,119,.13); }

.hf-detail { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.hf-detail-head { display: flex; align-items: flex-start; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hf-dh-name { font-size: 20px; font-weight: 800; color: var(--text); }
.hf-dh-sub { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.hf-dh-mgr { color: var(--text-muted); font-size: 13px; }
.hf-dh-stats { margin-left: auto; display: flex; gap: 26px; }
.hf-dh-stat { display: flex; flex-direction: column; text-align: right; }
.hf-dh-k { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hf-dh-v { font-size: 17px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.hf-table-wrap { overflow-x: auto; }
.hf-table { width: 100%; }
.hf-table th { white-space: nowrap; }
.hf-table td { vertical-align: middle; }
.hf-pos-rank { color: var(--muted); font-weight: 700; width: 34px; }
.hf-tk { font-weight: 800; color: var(--accent); text-decoration: none; }
.hf-tk:hover { text-decoration: underline; }
.hf-tk-none { color: var(--muted); font-weight: 500; }
.hf-pos-name { color: var(--text); }
.hf-pos-wt { min-width: 150px; }
.hf-wt-wrap { display: inline-block; width: 92px; height: 7px; background: var(--surface); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.hf-wt-bar { height: 100%; background: var(--accent); border-radius: 4px; }
.hf-wt-val { font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hf-pos-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.hf-pos-sh { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hf-note { padding: 14px 22px 18px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.hf-note b { color: var(--text); font-weight: 700; }
.hf-chg { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hf-chg-add   { color: #16a34a; background: rgba(22,163,74,.13); }
.hf-chg-trim  { color: #dc2626; background: rgba(220,38,38,.13); }
.hf-chg-new   { color: #2563eb; background: rgba(37,99,235,.13); }
.hf-chg-hold  { color: var(--muted); background: rgba(148,163,184,.13); font-weight: 600; }
.hf-chg-na    { color: var(--muted); }

/* ── Secteurs ─────────────────────────────────────────────────────── */
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sec-panel { min-height: 400px; display: flex; flex-direction: column; }
@media (max-width: 1100px) { .sec-grid { grid-template-columns: 1fr; } }

.sec-tf { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.sec-tf-btn { background: none; border: none; cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 700; color: var(--muted); padding: 3px 10px; border-radius: 5px; }
.sec-tf-btn:hover { color: var(--text); }
.sec-tf-btn.active { background: #f5a623; color: #1a1205; }

/* Heatmap */
.sec-heatmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; }
.sec-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 13px 11px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.06); text-decoration: none; min-height: 92px; transition: transform .1s; }
.sec-tile:hover { transform: translateY(-2px); }
.sec-tile-name { font-size: 13px; font-weight: 700; color: #eef2f8; line-height: 1.2; }
.sec-tile-tk { font-size: 10.5px; color: rgba(255,255,255,0.5); margin-top: auto; letter-spacing: .04em; }
.sec-tile-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sec-tile-val.up { color: #4ade80; } .sec-tile-val.down { color: #f87171; }

/* RRG */
.sec-rrg-wrap { flex: 1; min-height: 350px; position: relative; }

/* Performers */
.sec-perf-wrap { flex: 1; overflow-x: auto; }
.sec-perf { width: 100%; font-size: 13px; }
.sec-perf thead th { font-size: 10px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; padding: 6px 8px; font-weight: 600; }
.sec-perf tbody td { padding: 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.sec-rank { color: var(--muted); font-weight: 700; width: 26px; }
.sec-ind { display: flex; flex-direction: column; text-decoration: none; }
.sec-ind-name { font-weight: 600; color: var(--text); }
.sec-ind-sec { font-size: 11px; color: var(--muted); }
.sec-ind:hover .sec-ind-name { color: var(--accent); }
.sec-ma { font-size: 11px; }
.sec-ma-up { color: #16a34a; } .sec-ma-dn { color: #dc2626; } .sec-ma-na { color: var(--muted); }
.sec-chg { font-weight: 800; font-variant-numeric: tabular-nums; }
.sec-chg.up { color: #16a34a; } .sec-chg.down { color: #dc2626; }
.sec-perf .text-center { text-align: center; }

@media (max-width: 1080px) {
  .hf-layout { grid-template-columns: 1fr; }
  .hf-list { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .hf-fund { width: calc(50% - 4px); }
}
.zb-avatar { background: linear-gradient(135deg, #0b2a4a, #1668c7); font-size: 15px; }
.zb-src { color: #3f8cff !important; font-weight: 700; }

/* ── Data table ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 10px 20px; border-bottom: 1px solid var(--table-border); font-size: 13px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--table-hover); }
.text-right { text-align: right !important; }
.loading-row { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

/* ── Stock avatar ────────────────────────────────────────────────── */
.stock-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.logo-wrap {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  padding: 3px;
}
.logo-img { width: 100%; height: 100%; object-fit: contain; border-radius: 5px; display: block; }
.stock-info { display: flex; align-items: center; gap: 10px; }
.stock-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px; display: block;
}
.stock-name:hover { color: var(--accent); }
.stock-sym { font-size: 11px; color: var(--muted); }

/* ── Change pill ─────────────────────────────────────────────────── */
.change-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
}
.change-pill.pos { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.25); box-shadow: 0 0 8px rgba(16,185,129,.2); }
.change-pill.neg { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(239,68,68,.25);   box-shadow: 0 0 8px rgba(239,68,68,.2); }
.change-pill.neu { background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid var(--border); }

/* ── Indices table ───────────────────────────────────────────────── */
.idx-name { display: flex; align-items: center; gap: 8px; }
.idx-flag { font-size: 15px; }
.idx-label { font-weight: 500; }
.idx-price { font-size: 11px; color: var(--muted); }
.ath-date  { font-size: 12px; color: var(--muted); }
.vs-ath { font-size: 12px; font-weight: 600; }
.vs-ath.pos { color: var(--green); }
.vs-ath.neg { color: var(--red); }

/* ── 52-week range bar ───────────────────────────────────────────── */
.range-wrap { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.range-bar { flex: 1; height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; position: relative; }
.range-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 2px; }
.range-fill.hi  { background: var(--green); box-shadow: 0 0 5px rgba(16,185,129,.5); }
.range-fill.mid { background: var(--amber); }
.range-fill.lo  { background: var(--red); box-shadow: 0 0 5px rgba(239,68,68,.5); }
.range-pct { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ── Card lists ──────────────────────────────────────────────────── */
.card-list { padding: 6px 0; }
.card-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--table-border);
  transition: background .12s;
}
.card-item:last-child { border-bottom: none; }
.card-item:hover { background: var(--card-hover); }
.card-avatar {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; }
.card-title a:hover { color: var(--accent); }
.card-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.card-meta span { display: flex; align-items: center; gap: 3px; }
.card-meta .src-name { color: var(--accent); font-weight: 500; }
.pplx-avatar { background: linear-gradient(135deg, #6d28d9, #4f46e5) !important; font-size: 16px; }
.pplx-src { color: #7c3aed !important; }
.gn-avatar { background: linear-gradient(135deg, #1e3a5f, #2563eb); font-size: 16px; }
.eps-row { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.eps-item { font-size: 11px; color: var(--muted); }
.eps-item strong { color: var(--text); }
.surprise-pos { color: var(--green); font-weight: 600; }
.surprise-neg { color: var(--red);   font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════
   STOCK PAGE
   ═══════════════════════════════════════════════════════════════════ */

/* Topbar back button */
.topbar-left { display: flex; align-items: center; gap: 10px; }
.back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--muted); transition: background .15s;
}
.back-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }

/* Hero panel */
.stock-hero-panel {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-color: var(--border);
}
.stock-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stock-hero-logo {
  width: 52px; height: 52px; border-radius: 12px;
  overflow: hidden; flex-shrink: 0;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.hero-logo-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stock-hero-info { flex: 1; min-width: 0; }
.stock-hero-name { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stock-hero-sub { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.stock-exch-badge {
  font-size: 11px; font-weight: 600;
  background: rgba(59,130,246,.15);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.3);
  padding: 2px 8px; border-radius: 5px;
}
.stock-hero-ticker { font-size: 13px; color: var(--muted); font-weight: 500; }
.stock-hero-price { text-align: right; margin-left: auto; }
.stock-hero-px { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.5px; }
.stock-hero-chg { font-size: 13px; font-weight: 600; margin-top: 2px; }
.stock-hero-chg.pos { color: var(--green); text-shadow: 0 0 10px rgba(16,185,129,.45); }
.stock-hero-chg.neg { color: var(--red);   text-shadow: 0 0 10px rgba(239,68,68,.45); }
.stock-score-box {
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 10px; padding: 6px 14px;
  text-align: center; flex-shrink: 0;
  box-shadow: 0 0 14px rgba(59,130,246,.2);
}
.stock-score-num { font-size: 22px; font-weight: 700; color: var(--accent); line-height: 1; }
.stock-score-label { font-size: 10px; font-weight: 600; color: var(--muted); margin-top: 2px; }

/* Watchlist star button */
.wl-star-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 2px solid var(--border);
  color: var(--muted); cursor: pointer;
  transition: all .2s; flex-shrink: 0;
}
.wl-star-btn:hover { background: rgba(245,158,11,.1); border-color: var(--amber); color: var(--amber); }
.wl-star-btn.active, .wl-star-btn.starred {
  background: rgba(245,158,11,.1); border-color: var(--amber); color: var(--amber);
  filter: drop-shadow(0 0 5px rgba(245,158,11,.5));
}
.wl-star-btn.active svg, .wl-star-btn.starred svg { fill: var(--amber); }

/* Tab nav */
.stock-tabs {
  display: flex; gap: 0; padding: 0 16px;
  overflow-x: auto; scrollbar-width: none;
}
.stock-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 12px 16px; font-size: 13px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-shadow: 0 0 12px rgba(59,130,246,.5);
}
.tab-content[hidden] { display: none; }

/* ── Stock charts row ────────────────────────────────────────────── */
.s-charts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.s-chart-body { padding: 12px 16px 16px; }
.s-chart-canvas { height: 160px; position: relative; margin-bottom: 12px; }
.s-chart-canvas canvas { width: 100% !important; height: 100% !important; }
.s-chart-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.s-stat { display: flex; flex-direction: column; gap: 3px; }
.s-stat-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.s-stat-value { font-size: 14px; font-weight: 700; color: var(--text); }
.s-stat-value.pos { color: var(--green); }
.s-stat-value.neg { color: var(--red); }

/* Info row */
.s-info-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.s-info-rows { padding: 4px 0; }
.s-info-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px; border-bottom: 1px solid var(--table-border);
  font-size: 13px; gap: 12px;
}
.s-info-item:last-child { border-bottom: none; }
.s-info-key { color: var(--muted); font-weight: 500; white-space: nowrap; }
.s-info-val { color: var(--text); font-weight: 500; text-align: right; word-break: break-word; max-width: 58%; }
.s-info-val a { color: var(--accent); }
.s-info-val a:hover { text-decoration: underline; }
.s-info-desc { padding: 12px 20px; font-size: 12.5px; line-height: 1.65; color: var(--text); border-bottom: 1px solid var(--border); }
.s-info-desc-toggle { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 500; padding: 0 0 0 4px; }
.s-info-desc-toggle:hover { text-decoration: underline; }
.div-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(16,185,129,.3);
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

/* Radar chart */
.s-radar-wrap { height: 230px; position: relative; padding: 8px 20px 16px; }
.s-radar-wrap canvas { width: 100% !important; height: 100% !important; }

/* Valuation */
.s-val-wrap { padding: 14px 20px 10px; }
.val-summary { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.val-summary-label { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.val-fair-price { font-size: 22px; font-weight: 700; color: var(--text); display: flex; align-items: baseline; gap: 8px; }
.val-upside { font-size: 13px; font-weight: 600; }
.val-upside.pos { color: var(--green); }
.val-upside.neg { color: var(--red); }
.val-curr-line { font-size: 12px; color: var(--muted); margin-top: 4px; }
.val-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--table-border);
}
.val-row:last-child { border-bottom: none; }
.val-label { font-size: 11.5px; color: var(--muted); min-width: 90px; font-weight: 500; }
.val-bar-outer { flex: 1; height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; position: relative; }
.val-bar-fill { height: 100%; border-radius: 3px; }
.val-price-tag { font-size: 12px; font-weight: 600; color: var(--text); min-width: 55px; text-align: right; }
.val-marker {
  position: absolute; top: -4px; width: 2px; height: 14px;
  background: var(--red); border-radius: 1px; transform: translateX(-50%);
}

/* Bottom 3-col row */
.s-bot-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* Earnings dots */
.earn-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.earn-dot-past   { background: var(--muted); }
.earn-dot-future { background: var(--accent); }

/* No data */
.s-no-data {
  display: flex; align-items: center; justify-content: center;
  padding: 36px 20px; color: var(--muted); font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════
   QUANTITATIVE TAB
   ═══════════════════════════════════════════════════════════════════ */
.q-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.q-chart-panel { overflow: visible; }
.q-chart-body { padding: 12px 16px 14px; }
.q-canvas-wrap { height: 180px; position: relative; margin-bottom: 10px; }
.q-canvas-wrap canvas { width: 100% !important; height: 100% !important; }
.q-foot {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; font-weight: 600; padding-top: 6px;
  border-top: 1px solid var(--border);
}
.q-foot-stat { display: flex; gap: 4px; align-items: center; }
.q-foot-label { color: var(--muted); font-weight: 500; }
.q-foot-val.pos { color: var(--green); }
.q-foot-val.neg { color: var(--red); }
.q-foot-val.neu { color: var(--muted); }
.q-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.q-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.q-legend-dot { width: 10px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.q-tables-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.q-tbl-body { padding: 6px 0; }
.q-metric-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-bottom: 1px solid var(--table-border);
  font-size: 12.5px;
}
.q-metric-row:last-child { border-bottom: none; }
.q-metric-label { color: var(--muted); min-width: 90px; font-weight: 500; white-space: nowrap; }
.q-metric-val { font-weight: 700; min-width: 54px; text-align: right; font-size: 12.5px; }
.q-metric-val.pos { color: var(--green); }
.q-metric-val.neg { color: var(--red); }
.q-metric-val.neu { color: var(--muted); }
.q-metric-bar-outer { flex: 1; height: 5px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.q-metric-bar-fill  { height: 100%; border-radius: 3px; transition: width .4s; }

/* ═══════════════════════════════════════════════════════════════════
   RESULTS TAB
   ═══════════════════════════════════════════════════════════════════ */
.r-pt-header {
  display: flex; gap: 16px; padding: 16px 20px 0;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.r-pt-kpi { flex: 1; text-align: center; padding-bottom: 12px; }
.r-pt-val { display: block; font-size: 18px; font-weight: 700; color: var(--text); }
.r-pt-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
.r-pt-scale-wrap { padding: 0 20px 4px; }
.r-pt-scale {
  position: relative; height: 8px; background: rgba(255,255,255,.07);
  border-radius: 4px; margin: 24px 0 8px;
}
.r-pt-fill { position: absolute; height: 100%; border-radius: 4px; background: linear-gradient(to right, var(--red), var(--green)); }
.r-pt-pin {
  position: absolute; top: -5px;
  width: 3px; height: 18px; border-radius: 2px; transform: translateX(-50%);
}
.r-pt-pin.cur  { background: #1d4ed8; }
.r-pt-pin.mean { background: var(--amber); }
.r-pt-pin.med  { background: var(--purple); }
.r-pt-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--muted); margin-top: 4px;
}
.r-pt-legend {
  padding: 8px 20px 14px; font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.r-pt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.r-pt-dot.cur  { background: #1d4ed8; }
.r-pt-dot.mean { background: var(--amber); }
.r-pt-dot.med  { background: var(--purple); }
.r-pt-body { padding: 16px 20px 14px; }
.r-pt-pin-label { position: absolute; top: -22px; transform: translateX(-50%); font-size: 10px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.r-pt-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--table-border); font-size: 13px; }
.r-pt-item:last-child { border-bottom: none; }
.r-pt-item-curr { font-weight: 600; }
.r-pt-n { font-size: 11px; color: var(--muted); margin-top: 10px; }

.r-score-row { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-bottom: 1px solid var(--table-border); font-size: 13px; }
.r-score-row:last-child { border-bottom: none; }
.r-score-label { width: 90px; color: var(--muted); flex-shrink: 0; }
.r-score-bar-outer { flex: 1; height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.r-score-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.r-score-bar-fill.hi  { background: var(--green); }
.r-score-bar-fill.mid { background: var(--amber); }
.r-score-bar-fill.lo  { background: var(--red); }
.r-score-val { font-size: 12px; font-weight: 700; color: var(--text); min-width: 28px; text-align: right; }

.r-reco-consensus { font-size: 16px; font-weight: 700; margin-bottom: 10px; text-align: center; padding: 6px 0; }
.r-reco-consensus.pos { color: var(--green); }
.r-reco-consensus.neg { color: var(--red); }
.r-reco-consensus.neu { color: var(--muted); }
.r-reco-items { display: flex; flex-direction: column; }
.r-donut-body { display: flex; align-items: center; padding: 12px 20px 16px; gap: 20px; }
.r-donut-wrap { width: 140px; height: 140px; flex-shrink: 0; position: relative; }
.r-donut-wrap canvas { width: 100% !important; height: 100% !important; }
.r-reco-legend { flex: 1; }
.r-reco-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.r-reco-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.r-reco-label { flex: 1; color: var(--text); }
.r-reco-count { font-weight: 700; color: var(--text); min-width: 22px; text-align: right; }
.r-reco-pct { font-size: 11px; color: var(--muted); min-width: 36px; text-align: right; }

.r-next-box {
  margin: 10px 20px 0; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3);
  border-radius: 10px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--accent); font-weight: 500;
}
.r-transcript-item { display: flex; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--table-border); gap: 12px; }
.r-transcript-item:last-child { border-bottom: none; }
.r-transcript-avatar { width: 38px; height: 38px; border-radius: 10px; overflow: hidden; flex-shrink: 0; background: rgba(255,255,255,.07); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.r-transcript-avatar img { width: 100%; height: 100%; object-fit: contain; }
.r-transcript-info { flex: 1; min-width: 0; }
.r-transcript-title { font-size: 13px; font-weight: 500; color: var(--text); }
.r-transcript-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; }
.r-transcript-stats { display: flex; gap: 20px; flex-shrink: 0; }
.r-transcript-stat { text-align: right; }
.r-transcript-stat-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.r-transcript-stat-val { font-size: 12px; font-weight: 700; }

.r-history-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.r-ht-table { border-collapse: collapse; width: 100%; min-width: 700px; font-size: 12.5px; }
.r-ht-th {
  font-size: 11px; font-weight: 600; color: var(--muted);
  white-space: nowrap; padding: 9px 12px; text-align: right;
  background: var(--table-head-bg); border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.r-ht-col { min-width: 80px; }
.r-ht-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap; padding: 9px 14px; text-align: left;
  background: var(--table-head-bg); position: sticky; left: 0; z-index: 2;
  border-right: 1px solid var(--border); min-width: 130px;
}
.r-ht-th.r-ht-label { border-bottom: 2px solid var(--border); z-index: 3; }
.r-ht-row td { border-bottom: 1px solid var(--table-border); }
.r-ht-row:last-child td { border-bottom: none; }
.r-ht-row:hover td { background: var(--table-hover); }
.r-ht-row:hover .r-ht-label { background: var(--card-hover); }
.r-ht-highlight .r-ht-label { background: rgba(59,130,246,.08); border-right: 2px solid rgba(59,130,246,.3); }
.r-ht-highlight td { background: rgba(59,130,246,.05); }
.r-ht-cell { padding: 9px 12px; text-align: right; white-space: nowrap; font-size: 12.5px; color: var(--text); }
.r-ht-blue  { color: var(--accent); font-weight: 700; }
.r-ht-pos   { color: var(--green); font-weight: 600; }
.r-ht-neg   { color: var(--red);   font-weight: 600; }
.r-ht-muted { color: var(--border); }
.r-ht-date  { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   THESES TAB
   ═══════════════════════════════════════════════════════════════════ */
.thesis-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 20px 0; }
.thesis-date { font-size: 11.5px; color: var(--muted); margin-right: auto; }
.thesis-regen-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.thesis-regen-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.thesis-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 20px; gap: 14px;
}
.thesis-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: thesis-spin .9s linear infinite;
}
@keyframes thesis-spin { to { transform: rotate(360deg); } }
.thesis-loading p { font-size: 14px; color: var(--text); font-weight: 500; margin: 0; }
.thesis-loading-sub { font-size: 12px !important; color: var(--muted) !important; font-weight: 400 !important; }
.thesis-error-box {
  margin: 14px 20px 20px; padding: 16px 20px;
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.25);
  border-radius: 10px; border-left: 4px solid var(--red); font-size: 13px;
}
.thesis-error-box strong { color: var(--red); }
.thesis-error-box p { margin: 6px 0 0; color: var(--muted); font-size: 12px; word-break: break-word; }
.thesis-content { padding: 20px 28px 32px; font-size: 13.5px; line-height: 1.75; color: var(--text); }
.thesis-content h2 { font-size: 15px; font-weight: 700; color: var(--text); margin: 28px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.thesis-content h2:first-child { margin-top: 0; }
.thesis-content h3 { font-size: 13.5px; font-weight: 600; margin: 16px 0 6px; }
.thesis-content p  { margin: 0 0 10px; }
.thesis-content ul { padding-left: 22px; margin: 6px 0 12px; }
.thesis-content li { margin-bottom: 6px; }
.thesis-content strong { font-weight: 600; }
.thesis-content em    { font-style: italic; color: var(--muted); }
.thesis-content table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 12.5px; }
.thesis-content th { background: var(--table-head-bg); padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--border); }
.thesis-content td { padding: 8px 12px; border-bottom: 1px solid var(--table-border); }
.thesis-content tr:last-child td { border-bottom: none; }
.thesis-content tr:hover td { background: var(--table-hover); }
.thesis-content blockquote, .thesis-content .thesis-disclaimer {
  margin-top: 20px; padding: 12px 16px;
  background: rgba(255,255,255,.03); border-left: 3px solid var(--border);
  border-radius: 0 6px 6px 0; font-size: 11.5px; color: var(--muted); font-style: italic;
}
.thesis-content .thesis-header {
  background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(139,92,246,.08));
  border: 1px solid rgba(59,130,246,.25); border-radius: 12px;
  padding: 20px 24px; margin-bottom: 24px;
}
.thesis-content .thesis-header h1,
.thesis-content .thesis-header h2 { font-size: 18px; font-weight: 700; margin: 0 0 8px; border: none; padding: 0; }
.thesis-content .thesis-verdict { margin-top: 24px; padding: 16px 20px; border-radius: 10px; border-left: 4px solid var(--muted); background: rgba(255,255,255,.03); }
.thesis-content .thesis-verdict.buy  { border-left-color: var(--green); background: rgba(16,185,129,.06); }
.thesis-content .thesis-verdict.hold { border-left-color: var(--amber); background: rgba(245,158,11,.06); }
.thesis-content .thesis-verdict.sell { border-left-color: var(--red);   background: rgba(239,68,68,.06); }
.thesis-content .swot-table { width: 100%; border-collapse: collapse; }
.thesis-content .swot-table td { width: 50%; padding: 14px 16px; vertical-align: top; border: 1px solid var(--border); }
.thesis-content .swot-table tr:first-child td:first-child { background: rgba(16,185,129,.07); border-top-left-radius: 8px; }
.thesis-content .swot-table tr:first-child td:last-child  { background: rgba(239,68,68,.07);  border-top-right-radius: 8px; }
.thesis-content .swot-table tr:last-child  td:first-child { background: rgba(59,130,246,.07); border-bottom-left-radius: 8px; }
.thesis-content .swot-table tr:last-child  td:last-child  { background: rgba(245,158,11,.07); border-bottom-right-radius: 8px; }

/* ═══════════════════════════════════════════════════════════════════
   FINANCES TAB
   ═══════════════════════════════════════════════════════════════════ */
.fin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.fin-subtabs {
  display: flex; gap: 3px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
}
.fin-subtab {
  padding: 6px 16px; border: none; background: transparent;
  border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.fin-subtab:hover { color: var(--text); }
.fin-subtab.active { background: rgba(255,255,255,.08); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.3); text-shadow: 0 0 10px rgba(59,130,246,.4); }
.fin-period-toggle {
  display: flex; gap: 3px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.fin-period {
  padding: 5px 14px; border: none; background: transparent;
  border-radius: 6px; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.fin-period:hover { color: var(--text); }
.fin-period.active { background: rgba(255,255,255,.08); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.fin-summary-panel { margin-bottom: 14px; }
.fin-chart-wrap { height: 260px; padding: 8px 16px 16px; }
.fin-tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fin-tbl { border-collapse: collapse; width: 100%; min-width: 600px; font-size: 12.5px; }
.fin-th { min-width: 92px; padding: 9px 12px; text-align: right; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--table-head-bg); border-bottom: 2px solid var(--border); white-space: nowrap; }
.fin-th-label { position: sticky; left: 0; z-index: 3; background: var(--table-head-bg); min-width: 170px; text-align: left; padding: 9px 16px; border-right: 1px solid var(--border); }
.fin-th-cur { background: rgba(59,130,246,.1); color: var(--accent); border-bottom: 2px solid var(--accent); box-shadow: 0 0 12px rgba(59,130,246,.2) inset; }
.fin-row-label { position: sticky; left: 0; z-index: 2; background: var(--card); min-width: 170px; padding: 10px 16px; font-size: 12.5px; font-weight: 500; color: var(--text); text-align: left; border-right: 1px solid var(--border); border-bottom: 1px solid var(--table-border); white-space: nowrap; }
.fin-row:hover .fin-row-label { background: var(--card-hover); }
.fin-row:hover .fin-cell      { background: var(--table-hover); }
.fin-cell { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--table-border); white-space: nowrap; }
.fin-cell-cur { background: rgba(59,130,246,.07); box-shadow: 0 0 8px rgba(59,130,246,.07) inset; }
.fin-val { font-size: 12.5px; color: var(--text); font-weight: 500; }
.fin-gr  { font-size: 10.5px; margin-top: 2px; }
.fin-gr-pos { color: var(--green); }
.fin-gr-neg { color: var(--red); }
.fin-hl-primary .fin-row-label { background: rgba(59,130,246,.07); border-right: 2px solid rgba(59,130,246,.3); font-weight: 700; }
.fin-hl-primary .fin-cell      { background: rgba(59,130,246,.05); }
.fin-hl-primary .fin-val       { color: var(--accent); font-weight: 700; }
.fin-hl-orange  .fin-row-label { background: rgba(245,158,11,.07); border-right: 2px solid rgba(245,158,11,.3); font-weight: 700; }
.fin-hl-orange  .fin-cell      { background: rgba(245,158,11,.04); }
.fin-hl-orange  .fin-val       { color: var(--amber); font-weight: 700; }
.fin-hl-green   .fin-row-label { background: rgba(16,185,129,.07); border-right: 2px solid rgba(16,185,129,.3); font-weight: 700; }
.fin-hl-green   .fin-cell      { background: rgba(16,185,129,.04); }
.fin-hl-green   .fin-val       { color: var(--green); font-weight: 700; }
.fin-hl-teal    .fin-row-label { background: rgba(20,184,166,.07); border-right: 2px solid rgba(20,184,166,.3); font-weight: 700; }
.fin-hl-teal    .fin-cell      { background: rgba(20,184,166,.04); }
.fin-hl-teal    .fin-val       { color: var(--teal); font-weight: 700; }
.fin-hl-primary .fin-cell-cur,
.fin-hl-orange  .fin-cell-cur,
.fin-hl-green   .fin-cell-cur,
.fin-hl-teal    .fin-cell-cur  { filter: brightness(1.06); }
.fin-group-header .fin-row-label,
.fin-group-header .fin-cell    { background: rgba(255,255,255,.02); color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   DIVIDENDE TAB
   ═══════════════════════════════════════════════════════════════════ */
.div-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.div-metrics-panel { min-height: 220px; }
.div-metrics-body  { padding: 8px 16px 16px; }
.div-metrics-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.div-metrics-col   { display: flex; flex-direction: column; }
.div-metric-row { display: flex; flex-direction: column; gap: 1px; padding: 8px 0; border-bottom: 1px solid var(--table-border); }
.div-metric-row:last-child { border-bottom: none; }
.div-metric-key  { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.div-metric-val  { font-size: 13px; font-weight: 600; color: var(--text); }
.div-badge-king  { display: inline-block; padding: 2px 8px; background: rgba(245,158,11,.12); color: var(--amber); border-radius: 6px; font-size: 11px; font-weight: 700; border: 1px solid rgba(245,158,11,.25); }
.div-badge-aris  { display: inline-block; padding: 2px 8px; background: rgba(139,92,246,.12); color: var(--purple); border-radius: 6px; font-size: 11px; font-weight: 700; border: 1px solid rgba(139,92,246,.25); }
.div-badge-grow  { display: inline-block; padding: 2px 8px; background: var(--green-bg); color: var(--green); border-radius: 6px; font-size: 11px; font-weight: 700; border: 1px solid rgba(16,185,129,.25); }
.div-badge-none  { display: inline-block; padding: 2px 8px; background: rgba(255,255,255,.05); color: var(--muted); border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); }
.div-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; flex-shrink: 0; }
.div-history-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.div-hist-tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.div-hist-tbl thead th { padding: 9px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--table-head-bg); border-bottom: 2px solid var(--border); }
.div-hist-tbl tbody tr { border-bottom: 1px solid var(--table-border); }
.div-hist-tbl tbody tr:hover { background: var(--table-hover); }
.div-hist-tbl tbody td { padding: 9px 16px; color: var(--text); }
.div-hist-freq { color: var(--muted); font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════
   VALORISATION TAB
   ═══════════════════════════════════════════════════════════════════ */
.val-dcf-panel { margin-bottom: 16px; }
.val-dcf-kpi-row { display: flex; gap: 32px; padding: 14px 20px 10px; border-bottom: 1px solid var(--border); }
.val-dcf-kpi { display: flex; flex-direction: column; gap: 2px; }
.val-dcf-kpi-label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.val-dcf-kpi-value { font-size: 20px; font-weight: 700; color: var(--text); }
.val-dcf-kpi-value.primary { color: var(--accent); }
.val-dcf-kpi-value.green   { color: var(--green); }
.val-dcf-kpi-value.red     { color: var(--red); }
.val-dcf-body { display: grid; grid-template-columns: 1fr 270px; gap: 28px; padding: 16px 20px 20px; }
.val-dcf-chart-wrap { height: 340px; }
.val-ctrl-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.val-dcf-controls { display: flex; flex-direction: column; gap: 10px; }
.val-ctrl-row { display: flex; flex-direction: column; gap: 3px; }
.val-ctrl-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.val-ctrl-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.val-ctrl-hint  { font-size: 10.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.val-ctrl-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; padding: 2px 0; }
.val-ctrl-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.val-ctrl-actions { margin-top: 2px; }
.val-ctrl-select,
.val-ctrl-input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: var(--font); color: var(--text);
  background: var(--input-bg); outline: none; transition: border-color .15s;
}
.val-ctrl-select:focus,
.val-ctrl-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.val-reset-btn {
  margin-top: 2px; padding: 8px 14px; background: rgba(255,255,255,.04);
  border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .15s; border: 1px solid var(--border);
  align-self: flex-start; letter-spacing: .01em;
}
.val-reset-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.val-mid-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.val-metrics-body { padding: 0 16px 14px; }
.val-est-body     { padding: 0 16px 14px; }
.val-metric-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--table-border); }
.val-metric-row:last-child { border-bottom: none; }
.val-metric-label { font-size: 12.5px; color: var(--muted); }
.val-metric-value { font-size: 13px; font-weight: 600; color: var(--text); }
.val-est-item { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--table-border); gap: 8px; }
.val-est-item:last-child { border-bottom: none; }
.val-est-label { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.val-est-price { font-size: 13px; font-weight: 600; color: var(--text); }
.val-est-upside { font-size: 11.5px; font-weight: 600; margin-left: 5px; }
.val-fair-box { padding: 12px 14px; background: rgba(59,130,246,.1); border-radius: 10px; border: 1px solid rgba(59,130,246,.25); margin-bottom: 12px; text-align: center; }
.val-fair-label  { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.val-fair-price  { font-size: 21px; font-weight: 700; color: var(--accent); }
.val-fair-upside { font-size: 13px; font-weight: 600; margin-left: 6px; }
.val-fcf-wrap { height: 185px; padding: 0 12px 12px; }
.val-charts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.val-ratio-panel { overflow: hidden; }
.val-ratio-chart-wrap { height: 165px; padding: 4px 12px 6px; }
.val-ratio-foot { padding: 4px 16px 10px; font-size: 11.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.val-ratio-foot .vlo  { color: var(--muted); }
.val-ratio-foot .vmed { color: var(--amber); font-weight: 600; }
.val-ratio-foot .vhi  { color: var(--muted); }
.val-ratio-foot .vcur { color: var(--accent); font-weight: 600; }

/* ── Peter Lynch Chart ────────────────────────────────────────────── */
.pl-chart-wrap {
  height: 320px; padding: 8px 16px 4px;
  background: linear-gradient(180deg, rgba(59,130,246,.02) 0%, transparent 60%);
}
.pl-header-kpis { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pl-kpi { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pl-kpi b { font-size: 12.5px; color: var(--text); }
.pl-footer { padding: 6px 18px 10px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pl-sep { opacity: .4; margin: 0 2px; }
.pl-scale-btns { display: flex; align-items: center; gap: 4px; }
.pl-scale-label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.pl-scale-btn {
  font-size: 11px; font-weight: 600; padding: 2px 10px;
  border-radius: 5px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  cursor: pointer; transition: background .12s, color .12s;
}
.pl-scale-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 10px rgba(59,130,246,.35); }
.pl-scale-btn:not(.active):hover { background: rgba(255,255,255,.05); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════
   HEATMAP (monthly performance table)
   ═══════════════════════════════════════════════════════════════════ */
.hm-container { overflow: hidden; padding: 0 0 12px; }
.hm-scroll    { overflow-x: auto; padding: 0 16px 4px; }
.hm-tbl { border-collapse: separate; border-spacing: 3px; font-size: 11px; width: 100%; }
.hm-tbl thead th { padding: 3px 4px; font-size: 10.5px; font-weight: 600; color: var(--muted); text-align: center; white-space: nowrap; }
.hm-yr-hd   { width: 44px; min-width: 42px; max-width: 44px; }
.hm-yr      { width: 44px; max-width: 44px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: right; padding-right: 8px; white-space: nowrap; }
.hm-mhd     { min-width: 52px; }
.hm-total-hd { color: var(--text) !important; font-weight: 700 !important; }
.hm-cell {
  text-align: center; padding: 0; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  cursor: default; transition: opacity .1s;
  width: 54px; height: 40px; vertical-align: middle; line-height: 1;
}
.hm-cell:hover { opacity: .8; }
.hm-empty { background: rgba(255,255,255,.03); color: transparent; width: 54px; height: 40px; padding: 0; }
.hm-na    { background: rgba(255,255,255,.03); color: var(--muted); }
.hm-total-cell { font-weight: 800 !important; border: 1.5px solid rgba(255,255,255,.08); width: 54px; height: 40px; padding: 0; }
.hm-h4 { background: #14532d; color: #fff; box-shadow: 0 0 6px rgba(16,185,129,.3); }
.hm-h3 { background: #166534; color: #fff; box-shadow: 0 0 5px rgba(16,185,129,.2); }
.hm-h2 { background: #15803d; color: #fff; }
.hm-h1 { background: #166534; color: rgba(255,255,255,.8); }
.hm-c1 { background: rgba(255,255,255,.06); color: var(--muted); }
.hm-c2 { background: #78350f; color: #fde68a; box-shadow: 0 0 5px rgba(245,158,11,.2); }
.hm-c3 { background: #7c2d12; color: #fca5a5; }
.hm-c4 { background: #7f1d1d; color: #fca5a5; box-shadow: 0 0 6px rgba(239,68,68,.3); }
.hm-legend { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.hm-leg-item { padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════
   FINANCIAL SCORES
   ═══════════════════════════════════════════════════════════════════ */
.score-list { display: flex; flex-direction: column; gap: 0; padding: 4px 0 8px; }
.score-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.score-row:last-child { border-bottom: none; }
.score-name-wrap { display: flex; align-items: center; gap: 7px; }
.score-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.score-right { display: flex; align-items: center; gap: 10px; }
.score-value { font-size: 15px; font-weight: 700; }
.score-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.score-green  { color: var(--green); }
.score-orange { color: var(--amber); }
.score-red    { color: var(--red); }
.score-gray   { color: var(--muted); }
.score-green.score-badge  { background: rgba(16,185,129,.15);  color: var(--green);  border: 1px solid rgba(16,185,129,.3);  box-shadow: 0 0 8px rgba(16,185,129,.2); }
.score-orange.score-badge { background: rgba(245,158,11,.15); color: var(--amber); border: 1px solid rgba(245,158,11,.3); box-shadow: 0 0 8px rgba(245,158,11,.15); }
.score-red.score-badge    { background: rgba(239,68,68,.15);   color: var(--red);    border: 1px solid rgba(239,68,68,.3);    box-shadow: 0 0 8px rgba(239,68,68,.2); }
.score-gray.score-badge   { background: rgba(255,255,255,.06); color: var(--muted); border: 1px solid var(--border); }
.score-dots { display: flex; gap: 3px; align-items: center; }
.score-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.score-dot-on  { background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.score-dot-off { background: var(--border); }
.score-raw-val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.score-divider { height: 1px; background: var(--border); margin: 8px 0; }
.score-tooltip-anchor { position: relative; display: inline-flex; align-items: center; cursor: default; }
.score-tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: rgba(255,255,255,.07); border: 1px solid var(--border); font-size: 9px; font-weight: 700; color: var(--muted); line-height: 1; cursor: help; user-select: none; }
.score-tooltip-box { display: none; position: absolute; left: 22px; top: 50%; transform: translateY(-50%); z-index: 999; background: #1e2942; color: var(--text); font-size: 11px; line-height: 1.55; white-space: pre-wrap; padding: 10px 14px; border-radius: 8px; width: 300px; box-shadow: 0 4px 20px rgba(0,0,0,.6); pointer-events: none; border: 1px solid var(--border); }
.score-tooltip-box::before { content: ''; position: absolute; right: 100%; top: 50%; transform: translateY(-50%); border: 6px solid transparent; border-right-color: #1e2942; }
.score-tooltip-anchor:hover .score-tooltip-box,
.score-tooltip-anchor:focus .score-tooltip-box { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   PUBLICATIONS TAB
   ═══════════════════════════════════════════════════════════════════ */
.pub-layout { display: grid; grid-template-columns: 340px 1fr; gap: 0; min-height: 600px; border-top: 1px solid var(--border); }
.pub-list-col { border-right: 1px solid var(--border); overflow-y: auto; max-height: 680px; display: flex; flex-direction: column; }
.pub-list-header { padding: 6px 14px; font-size: 10px; color: var(--muted); background: var(--table-head-bg); border-bottom: 1px solid var(--border); }
.pub-list { flex: 1; display: flex; flex-direction: column; }
.pub-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.pub-loading-sub { font-size: 11px; color: var(--muted); opacity: .7; margin: 0; }
.pub-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; box-shadow: 0 0 10px rgba(59,130,246,.3); }
@keyframes spin { to { transform: rotate(360deg); } }
.pub-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.pub-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--table-border); cursor: pointer; transition: background .12s; }
.pub-item:hover { background: var(--card-hover); }
.pub-item-active { background: rgba(59,130,246,.08) !important; }
.pub-item-icon { flex-shrink: 0; color: var(--muted); opacity: .7; }
.pub-item-info { flex: 1; min-width: 0; }
.pub-item-title { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub-item-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.pub-ext-link { color: var(--accent); text-decoration: none; }
.pub-ext-link:hover { text-decoration: underline; }
.pub-item-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.pub-view-btn { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; transition: background .12s, color .12s; }
.pub-view-btn:hover { background: var(--accent); color: #fff; }
.pub-dl-btn { font-size: 14px; font-weight: 700; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border); background: transparent; color: var(--muted); text-decoration: none; transition: background .12s, color .12s; }
.pub-dl-btn:hover { background: var(--muted); color: #fff; }
.pub-no-pdf { font-size: 10px; color: var(--muted); opacity: .6; }
.pub-viewer-col { display: flex; flex-direction: column; position: relative; }
.pub-viewer-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 13px; padding: 40px; }
.pub-iframe { flex: 1; width: 100%; height: 680px; border: none; background: #fff; }
.pub-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.pub-badge-pending { background: rgba(245,158,11,.12); color: var(--amber); border: 1px solid rgba(245,158,11,.25); }
.pub-badge-error   { background: rgba(239,68,68,.12);  color: var(--red);   border: 1px solid rgba(239,68,68,.25); }
.pub-action-btn { font-size: 11.5px; font-weight: 600; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.pub-action-btn:hover { background: rgba(255,255,255,.06); color: var(--text); box-shadow: 0 0 14px rgba(59,130,246,.4); }
.pub-scraped-at { font-size: 10px; color: var(--muted); }

.pub-ai-btn {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 5px;
  border: 1px solid #a855f7; background: rgba(168,85,247,.1);
  color: #a855f7; cursor: pointer; transition: background .12s;
}
.pub-ai-btn:hover { background: rgba(168,85,247,.2); }
.pub-ai-btn:disabled { opacity: .5; cursor: default; }

.pub-summary-wrap { padding: 8px 12px 10px; border-bottom: 1px solid var(--border); }
.pub-summary-loading { display: flex; align-items: center; gap: 10px; padding: 8px; font-size: 12px; color: var(--muted); }
.pub-summary-loading .thesis-spinner { width: 18px; height: 18px; border-width: 2px; flex-shrink: 0; }
.pub-summary-box {
  background: rgba(168,85,247,.06); border: 1px solid rgba(168,85,247,.2);
  border-radius: 8px; padding: 10px 14px;
}
.pub-summary-title { font-size: 12px; font-weight: 700; color: #a855f7; margin-bottom: 6px; }
.pub-summary-list { margin: 0; padding-left: 16px; }
.pub-summary-list li { font-size: 11.5px; line-height: 1.55; color: var(--text); margin-bottom: 4px; }
.pub-summary-error { font-size: 12px; color: var(--red); padding: 8px; }

/* ═══════════════════════════════════════════════════════════════════
   ANALYSE TAB
   ═══════════════════════════════════════════════════════════════════ */
.an-subnav {
  display: flex; gap: 2px; padding: 0; margin-bottom: 16px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none;
  border: 1px solid var(--border);
}
.an-subnav::-webkit-scrollbar { display: none; }
.an-subbtn { padding: 12px 18px; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; flex-shrink: 0; }
.an-subbtn:hover { color: var(--text); }
.an-subbtn.active { color: var(--accent); border-bottom-color: var(--accent); text-shadow: 0 0 12px rgba(59,130,246,.5); }
.an-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.an-charts-area { min-width: 0; }
.an-charts-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.an-chart-card { overflow: visible; border-top-color: rgba(255,255,255,.1); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, var(--shadow); }
.an-card-hdr { display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 16px 8px; gap: 8px; }
.an-card-hdr-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.an-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.an-card-unit  { font-size: 11px; color: var(--muted); }
.an-kpi { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.an-kpi-pos { background: rgba(16,185,129,.15);  color: var(--green);  border: 1px solid rgba(16,185,129,.3);  box-shadow: 0 0 8px rgba(16,185,129,.2); }
.an-kpi-neg { background: rgba(239,68,68,.15);   color: var(--red);    border: 1px solid rgba(239,68,68,.3);    box-shadow: 0 0 8px rgba(239,68,68,.2); }
.an-card-legend { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.an-leg { display: flex; align-items: center; gap: 3px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.an-leg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.an-canvas-wrap { height: 180px; position: relative; padding: 0 14px 14px; }
.an-right-col { min-width: 0; }
.an-right-panel { padding: 0; }
.an-right-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.an-right-sect-label { font-size: 9px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.an-right-sect-name  { font-size: 16px; font-weight: 700; color: var(--text); }
.an-ring { width: 52px; height: 52px; border-radius: 50%; background: conic-gradient(var(--an-clr, #3b82f6) calc(var(--an-pct, 0) * 1%), rgba(255,255,255,.07) 0%); display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; box-shadow: 0 0 16px var(--an-clr, #3b82f6), 0 0 32px rgba(0,0,0,.4); filter: saturate(1.25); }
.an-ring::before { content: ''; position: absolute; width: 37px; height: 37px; border-radius: 50%; background: var(--card); }
.an-ring-val { position: relative; font-size: 11px; font-weight: 700; color: var(--text); z-index: 1; }
.an-pentagon-wrap { padding: 16px; height: 210px; position: relative; }
.an-insights { padding: 14px 18px 16px; border-top: 1px solid var(--border); }
.an-insights-title { font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
#an-insights-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.an-insight-item { font-size: 12px; color: var(--muted); line-height: 1.45; padding-left: 10px; position: relative; }
.an-insight-item::before { content: ''; position: absolute; left: 0; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.an-body { padding: 4px 0 8px; }
.an-metric-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.an-metric-row:last-child { border-bottom: none; }
.an-metric-label { font-size: 12.5px; color: var(--muted); flex: 1; }
.an-metric-right  { display: flex; align-items: center; gap: 8px; }
.an-metric-value  { font-size: 13px; font-weight: 600; }
.an-val-med       { font-size: 11px; color: var(--muted); }
.an-green  { color: var(--green); }
.an-orange { color: var(--amber); }
.an-red    { color: var(--red); }
.an-gray   { color: var(--muted); }
.an-card-kpi { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════
   SOCIÉTÉ TAB
   ═══════════════════════════════════════════════════════════════════ */
.soc-row { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-bottom: 16px; }
.soc-summary-body { padding: 16px; }
.soc-kpi-grid { display: flex; flex-direction: column; gap: 12px; }
.soc-kpi { background: rgba(255,255,255,.03); border-radius: 8px; padding: 14px 16px; border: 1px solid var(--border); }
.soc-kpi-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.soc-kpi-value { display: block; font-size: 18px; font-weight: 700; color: var(--text); }
.soc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.soc-table th { text-align: left; padding: 10px 12px; font-weight: 700; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.soc-table td { padding: 10px 12px; border-bottom: 1px solid var(--table-border); color: var(--text); white-space: nowrap; }
.soc-table tbody tr:hover td { background: var(--table-hover); }
.soc-table-scroll { overflow-x: auto; }
.soc-up   { color: var(--green); }
.soc-down { color: var(--red); }
.soc-empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════
   WATCHLIST PAGE
   ═══════════════════════════════════════════════════════════════════ */
.wl-panel { overflow: visible; }
.wl-count { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; }
.wl-table { width: 100%; }
.wl-row { cursor: pointer; }
.wl-row:hover td { background: var(--table-hover); }
.wl-avatar { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.wl-remove-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: var(--muted); opacity: 0; transition: all .15s; }
.wl-row:hover .wl-remove-btn { opacity: 1; }
.wl-remove-btn:hover { background: var(--red-bg); color: var(--red); }
.wl-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 20px; gap: 12px; color: var(--muted); text-align: center; }
.wl-empty[hidden] { display: none; }   /* sinon `display:flex` écrase le display:none de l'attribut hidden */
.wl-empty svg { opacity: .2; }
.wl-empty p { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.wl-empty-sub { font-size: 13px !important; color: var(--muted) !important; font-weight: 400 !important; }
.wl-empty-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; transition: background .15s; margin-top: 4px; }
.wl-empty-btn:hover { background: #2563eb; }

/* ═══════════════════════════════════════════════════════════════════
   SCREENER PAGE
   ═══════════════════════════════════════════════════════════════════ */
.sr-panel { display: flex; flex-direction: column; }
.sr-count { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: auto; margin-right: 12px; }
.sr-refresh-btn { background: none; border: 1px solid var(--border); border-radius: 6px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: color .15s; }
.sr-refresh-btn:hover { color: var(--text); }
.sr-spin svg { animation: sr-spin .8s linear infinite; }
@keyframes sr-spin { to { transform: rotate(360deg); } }
.sr-filters { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.sr-filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.sr-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1 0 auto; }
.sr-filter-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sr-filter-select, .sr-filter-input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); color: var(--text); font-size: 13px; font-family: inherit; outline: none; transition: border-color .15s; }
.sr-filter-select:focus, .sr-filter-input:focus { border-color: var(--accent); }
.sr-filter-input[type="number"] { width: 72px; }
.sr-filter-text { width: 160px; }
.sr-range-row { display: flex; align-items: center; gap: 4px; }
.sr-range-sep { color: var(--muted); font-size: 13px; }
.sr-filter-actions { display: flex; gap: 8px; align-items: flex-end; padding-bottom: 1px; }
.sr-btn { padding: 6px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; font-family: inherit; transition: background .15s; }
.sr-btn-primary { background: var(--accent); color: #fff; }
.sr-btn-primary:hover { background: #2563eb; }
.sr-btn-ghost { background: none; color: var(--muted); border: 1px solid var(--border); }
.sr-btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.04); }
.sr-table-wrap { overflow-x: auto; }
.sr-table { min-width: 900px; }
.sr-th { position: relative; cursor: default; white-space: nowrap; user-select: none; }
.sr-th.sortable { cursor: pointer; }
.sr-th.sortable:hover { color: var(--text); }
.sr-sort-icon { margin-left: 4px; font-size: 10px; color: var(--muted); }
.sr-th.sorted-asc .sr-sort-icon, .sr-th.sorted-desc .sr-sort-icon { color: var(--accent); }
.sr-row { cursor: pointer; transition: background .1s; }
.sr-row:hover td { background: var(--table-hover); }
.sr-row td { padding: 8px 12px; vertical-align: middle; }
.sr-row .stock-avatar { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }
.sr-empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sr-empty svg { opacity: .2; }
.sr-empty p { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.sr-empty-sub { font-size: 13px !important; color: var(--muted) !important; font-weight: 400 !important; }

/* ═══════════════════════════════════════════════════════════════════
   CALENDRIER PAGE
   ═══════════════════════════════════════════════════════════════════ */
.cal-controls-panel { margin-bottom: 16px; }
.cal-controls { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.cal-nav-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; color: var(--text); display: flex; align-items: center; transition: background .15s; }
.cal-nav-btn:hover { background: rgba(255,255,255,.05); }
.cal-title { font-size: 16px; font-weight: 600; margin: 0; min-width: 140px; color: var(--text); }
.cal-today-btn { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-size: 12px; font-weight: 500; cursor: pointer; }
.cal-today-btn:hover { opacity: .9; }
.cal-legend { display: flex; gap: 14px; margin-left: auto; font-size: 11.5px; color: var(--muted); }
.cal-legend-item { display: flex; align-items: center; gap: 5px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-dot-earnings { background: var(--accent); }
.cal-dot-dividend { background: var(--green); }
.cal-dot-exdiv    { background: var(--amber); }
.cal-refresh-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; color: var(--text); font-size: 16px; line-height: 1; }
.cal-refresh-btn:hover { background: rgba(255,255,255,.05); }
@keyframes cal-spin { to { transform: rotate(360deg); } }
.cal-spin { animation: cal-spin .6s linear infinite; display: inline-block; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-weekdays span { padding: 10px 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 90px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 6px 8px; cursor: pointer; position: relative; transition: background .15s; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: rgba(255,255,255,.03); }
.cal-empty { cursor: default; }
.cal-empty:hover { background: transparent; }
.cal-today { background: rgba(59,130,246,.07); }
.cal-today:hover { background: rgba(59,130,246,.1); }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--text); }
.cal-today .cal-day-num { background: var(--accent); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-cell-dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.cal-cell-dot  { width: 7px; height: 7px; border-radius: 50%; }
.cal-has-event { border-bottom: 2px solid var(--accent); }
.cal-loading { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--muted); }
.cal-empty-state { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
.cal-detail-panel { margin-top: 16px; }
.cal-event-list { display: flex; flex-direction: column; }
.cal-event-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--table-border); text-decoration: none; color: var(--text); transition: background .15s; }
.cal-event-row:hover { background: var(--table-hover); }
.cal-event-row:last-child { border-bottom: none; }
.cal-event-symbol { font-weight: 600; font-size: 13px; min-width: 80px; }
.cal-event-name { font-size: 12.5px; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.cal-badge-earnings { background: rgba(59,130,246,.15);  color: var(--accent); border: 1px solid rgba(59,130,246,.3); }
.cal-badge-dividend { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.cal-badge-exdiv    { background: rgba(245,158,11,.12); color: var(--amber); border: 1px solid rgba(245,158,11,.25); }
.cal-event-extras   { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════
   HEATMAP PAGE (TREEMAP)
   ═══════════════════════════════════════════════════════════════════ */
.hm-page-header { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 24px 14px; box-shadow: var(--shadow); }
.hm-page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.hm-page-title    { font-size: 20px; font-weight: 700; color: var(--text); }
.hm-page-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hm-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hm-updated-badge  { font-size: 11px; color: var(--muted); white-space: nowrap; }
.hm-refresh-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--accent); color: #fff; cursor: pointer; transition: opacity .15s;
}
.hm-refresh-btn:hover:not(:disabled) { opacity: .85; box-shadow: 0 0 16px rgba(59,130,246,.4); }
.hm-refresh-btn:disabled { opacity: .4; cursor: default; }
.hm-grad-legend { display: flex; flex-direction: column; gap: 4px; }
.hm-legend-bar {
  height: 10px; border-radius: 5px;
  background: linear-gradient(to right, #6e141c, #aa2819, #cd4128, #3c5a40, #1e8237, #166428, #0c4119);
}
.hm-legend-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.hm-treemap-wrap { position: relative; min-height: 400px; padding: 0; overflow: hidden; }
.hm-loading { position: absolute; inset: 0; z-index: 2; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px; }
.hm-loading[hidden], .hm-treemap[hidden] { display: none !important; }
.hm-loading-spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: hm-spin .8s linear infinite; box-shadow: 0 0 10px rgba(59,130,246,.3); }
@keyframes hm-spin { to { transform: rotate(360deg); } }
.hm-loading-text { font-size: 14px; font-weight: 600; color: var(--text); }
.hm-loading-sub  { font-size: 12px; color: var(--muted); text-align: center; max-width: 380px; }
.hm-treemap { display: grid; grid-template-columns: repeat(10, 1fr); grid-auto-rows: 96px; gap: 3px; padding: 3px; }
.hm-treemap .hm-cell {
  position: relative; width: 100%; height: 100%; box-sizing: border-box;
  border-radius: 4px; border: 2px solid rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; gap: 2px; padding: 4px 5px;
  transition: filter .15s, border-color .15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
  user-select: none;
}
.hm-treemap .hm-cell:hover {
  filter: brightness(1.18);
  border-color: rgba(255,255,255,.4);
  z-index: 10;
  box-shadow: 0 0 12px rgba(255,255,255,.12), inset 0 1px 0 rgba(255,255,255,.1);
}
.hmc-icons  { display: flex; gap: 3px; font-size: 11px; line-height: 1; }
.hmc-name   { font-size: 9.5px; font-weight: 500; color: rgba(255,255,255,.8); text-align: center; max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hmc-ticker { font-size: 12px; font-weight: 700; color: #fff; text-align: center; }
.hmc-tiny   { font-size: 9px; }
.hmc-ytd    { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.92); text-align: center; }
.hmc-ytd-lg { font-size: 14px; font-weight: 800; }
.hm-tooltip { position: fixed; z-index: 9999; background: #1a2235; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 12px 14px; min-width: 200px; box-shadow: 0 8px 32px rgba(0,0,0,.7); pointer-events: none; }
.hm-tt-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.hm-tt-flag   { font-size: 16px; }
.hm-tt-ticker { font-size: 15px; font-weight: 700; color: var(--text); }
.hm-tt-icon   { font-size: 14px; margin-left: auto; }
.hm-tt-name   { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.hm-tt-row    { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--muted); }
.hm-tt-row:last-child { border-bottom: none; }
.hm-tt-row strong { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════
   FISCAL.AI COMPANY STATISTICS
   ═══════════════════════════════════════════════════════════════════ */
.fs-source-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: rgba(88,166,255,.1); color: #58a6ff; border: 1px solid rgba(88,166,255,.25); text-decoration: none; letter-spacing: .03em; transition: opacity .15s; box-shadow: 0 0 8px rgba(88,166,255,.2); }
.fs-source-badge:hover { opacity: .8; }
.fs-updated { font-size: 11px; color: var(--muted); }
.fs-refresh-btn { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 7px; background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.fs-refresh-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 14px rgba(59,130,246,.4); }
.fs-refresh-btn:disabled { opacity: .4; cursor: default; }
.fs-loading { display: flex; align-items: center; gap: 10px; padding: 28px 20px; color: var(--muted); font-size: 13px; }
.fs-spin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: hm-spin .7s linear infinite; flex-shrink: 0; box-shadow: 0 0 8px rgba(59,130,246,.3); }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0; }
.fs-section { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; }
.fs-section:last-child { border-right: none; }
.fs-sec-header { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px 8px; background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border); }
.fs-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 14px; border-bottom: 1px solid var(--table-border); gap: 6px; }
.fs-row:last-child { border-bottom: none; }
.fs-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.fs-value { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; text-align: right; }
.fs-pos { color: var(--green); }
.fs-neg { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════
   THEME TOGGLE (sidebar)
   ═══════════════════════════════════════════════════════════════════ */
.theme-toggle {
  padding: 12px 10px 10px;
  border-top: 1px solid rgba(59,130,246,.12);
  margin-top: auto;
  background: linear-gradient(180deg, rgba(59,130,246,.02) 0%, transparent 100%);
}
.theme-toggle-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 11px; border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s; cursor: pointer;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.theme-toggle-icon  { font-size: 16px; line-height: 1; flex-shrink: 0; }
.theme-toggle-label { flex: 1; text-align: left; }
.theme-toggle-pill  { width: 34px; height: 18px; border-radius: 9px; background: var(--accent); position: relative; flex-shrink: 0; transition: background .25s; }
.theme-toggle-knob  { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .25s; transform: translateX(16px); }

/* ═══════════════════════════════════════════════════════════════════
   SCROLLBARS
   ═══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(59,130,246,.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(59,130,246,.45); }
* { scrollbar-width: thin; scrollbar-color: rgba(59,130,246,.2) transparent; }

/* ═══════════════════════════════════════════════════════════════════
   FOCUS
   ═══════════════════════════════════════════════════════════════════ */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1400px) { .charts-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1200px) {
  .s-charts-row { grid-template-columns: 1fr 1fr; }
  .s-info-row   { grid-template-columns: 1fr 1fr; }
  .s-bot-row    { grid-template-columns: 1fr 1fr; }
  .bot-row      { grid-template-columns: 1fr 1fr; }
  .q-row        { grid-template-columns: 1fr 1fr; }
  .q-tables-grid { grid-template-columns: 1fr 1fr; }
  .an-charts-2col { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .mid-row { grid-template-columns: 1fr; }
  .bot-row { grid-template-columns: 1fr; }
  .markets-grid { grid-template-columns: 1fr; }
  .market-col + .market-col { border-left: none; border-top: 1px solid var(--border); }
  .an-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .charts-row   { grid-template-columns: repeat(2, 1fr); }
  .s-charts-row { grid-template-columns: 1fr; }
  .s-info-row   { grid-template-columns: 1fr; }
  .s-bot-row    { grid-template-columns: 1fr; }
  .q-row        { grid-template-columns: 1fr; }
  .q-tables-grid { grid-template-columns: 1fr; }
  .val-dcf-body { grid-template-columns: 1fr; }
  .val-mid-row  { grid-template-columns: 1fr; }
  .div-row      { grid-template-columns: 1fr; }
  .soc-row      { grid-template-columns: 1fr; }
  .sr-filter-row { flex-direction: column; }
  .sr-filter-group { min-width: 100%; }
  .sr-filter-input[type="number"] { width: 100%; }
  .sr-filter-text { width: 100%; }
}
@media (max-width: 600px) {
  .main { padding: 12px; }
  .content { padding: 12px 12px 40px; }
  .pub-layout { grid-template-columns: 1fr; }
  .val-charts-row { grid-template-columns: 1fr; }
}

/* ── Comparateur page ────────────────────────────────────────────── */
.cmp-search-panel { margin-bottom: 16px; }
.cmp-search-inner { display: flex; align-items: center; gap: 8px; padding: 12px 16px; position: relative; flex-wrap: wrap; }
.cmp-search-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 5px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--tag-color, var(--accent)) 15%, transparent); color: var(--tag-color, var(--accent)); border: 1px solid color-mix(in srgb, var(--tag-color, var(--accent)) 30%, transparent); }
.cmp-tag-remove { background: none; border: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; opacity: .6; }
.cmp-tag-remove:hover { opacity: 1; }
.cmp-search-input { flex: 1; min-width: 180px; border: none; background: none; font-size: 13px; color: var(--text); outline: none; padding: 6px 0; }
.cmp-search-input::placeholder { color: var(--text-muted); }
.cmp-search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 100; max-height: 280px; overflow-y: auto; }
.cmp-dd-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cmp-dd-item:last-child { border-bottom: none; }
.cmp-dd-item:hover { background: var(--bg-secondary); }
.cmp-dd-disabled { opacity: .4; cursor: default; }
.cmp-dd-sym { font-weight: 700; font-size: 13px; color: var(--text); min-width: 70px; }
.cmp-dd-name { font-size: 12px; color: var(--text-muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-dd-exch { font-size: 10.5px; color: var(--text-muted); }
.cmp-presets { display: flex; align-items: center; gap: 8px; padding: 8px 16px 12px; flex-wrap: wrap; }
.cmp-preset-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.cmp-preset-btn { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 11.5px; font-weight: 500; color: var(--text); cursor: pointer; }
.cmp-preset-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.cmp-chart-panel { margin-bottom: 16px; }
.cmp-chart-wrap { height: 340px; padding: 8px 16px 16px; }

.cmp-table-scroll { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cmp-table th { padding: 10px 14px; font-weight: 600; font-size: 11.5px; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
.cmp-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.cmp-table tbody tr:hover td { background: var(--bg-secondary); }
.cmp-metric-col { color: var(--text-muted); font-weight: 500; min-width: 160px; }
.cmp-stock-col { color: var(--text); font-weight: 500; min-width: 110px; }
.cmp-stock-sym { font-weight: 700; font-size: 13px; }
.cmp-error-badge { display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: #fef2f2; color: #991b1b; }

.cmp-empty-panel { margin-top: 16px; }
.cmp-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.cmp-empty svg { margin-bottom: 16px; opacity: .3; }
.cmp-empty h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.cmp-empty p { font-size: 13px; margin: 0; }

/* ═══════════════════════════════════════════════════════════════════
   STOCK PAGE — display enhancements
   ═══════════════════════════════════════════════════════════════════ */

/* ── Hero: change arrow + market state ───────────────────────────── */
.stock-hero-chg-arrow { font-size: 11px; margin-right: 2px; }
.stock-hero-chg-abs   { opacity: .85; font-weight: 600; }
.stock-mkt-state {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px;
  background: rgba(255,255,255,.06); color: var(--muted);
  border: 1px solid var(--border);
}
.stock-mkt-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.stock-mkt-state.open        { background: var(--green-bg); color: var(--green); border-color: rgba(16,185,129,.3); }
.stock-mkt-state.open::before{ background: var(--green); box-shadow: 0 0 6px var(--green); }
.stock-mkt-state.pre, .stock-mkt-state.post { background: rgba(245,158,11,.12); color: var(--amber); border-color: rgba(245,158,11,.3); }
.stock-mkt-state.pre::before, .stock-mkt-state.post::before { background: var(--amber); }

/* ── Hero: key stats strip + 52-week range ───────────────────────── */
.stock-keybar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stock-keystats { display: flex; gap: 22px; flex-wrap: wrap; flex: 1; min-width: 0; }
.stock-keystat { display: flex; flex-direction: column; gap: 2px; }
.stock-keystat-label { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stock-keystat-val   { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.stock-keystat-val.pos { color: var(--green); }
.stock-keystat-val.neg { color: var(--red); }

.stock-52w { min-width: 220px; flex: 0 0 auto; }
.stock-52w-head { display: flex; justify-content: space-between; font-size: 10px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.stock-52w-track {
  position: relative; height: 6px; border-radius: 4px;
  background: linear-gradient(90deg, var(--red) 0%, var(--amber) 50%, var(--green) 100%);
  opacity: .85;
}
.stock-52w-marker {
  position: absolute; top: 50%; width: 3px; height: 14px;
  background: var(--text); border-radius: 2px;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--card);
}
.stock-52w-vals { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--text); margin-top: 5px; }

/* ── Interactive price chart toolbar ─────────────────────────────── */
.px-toolbar { display: flex; align-items: center; gap: 8px; }
.px-range { display: inline-flex; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.px-range-btn {
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  color: var(--muted); background: none; border: none; cursor: pointer;
  border-right: 1px solid var(--border); transition: background .12s, color .12s;
}
.px-range-btn:last-child { border-right: none; }
.px-range-btn:hover { color: var(--text); }
.px-range-btn.active { background: var(--accent); color: #fff; }
.px-vol-btn {
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
}
.px-vol-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Sticky mini-header ──────────────────────────────────────────── */
.sticky-hero {
  position: sticky; top: var(--topbar-h); z-index: 49;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  animation: sticky-slide .18s ease;
}
@keyframes sticky-slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.sticky-hero-logo { width: 24px; height: 24px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: rgba(255,255,255,.07); display: flex; align-items: center; justify-content: center; }
.sticky-hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.sticky-hero-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.sticky-hero-ticker { font-size: 11px; color: var(--muted); font-weight: 600; }
.sticky-hero-px { font-size: 14px; font-weight: 700; color: var(--text); margin-left: auto; }
.sticky-hero-chg { font-size: 12px; font-weight: 600; }
.sticky-hero-chg.pos { color: var(--green); }
.sticky-hero-chg.neg { color: var(--red); }

/* ── Skeleton loaders ────────────────────────────────────────────── */
.skel { display: block; border-radius: 6px; background: var(--bg-secondary); position: relative; overflow: hidden; }
.skel::after {
  content: ''; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.09), transparent);
  animation: skel-shimmer 1.3s infinite;
}
[data-theme="light"] .skel::after { background: linear-gradient(90deg, transparent, rgba(0,0,0,.05), transparent); }
@keyframes skel-shimmer { 100% { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 9px 16px; }
.skel-block { margin: 12px 16px; }
.skel-stack { padding: 6px 0; }

/* ── Panel error state ───────────────────────────────────────────── */
.panel-error { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 20px; text-align: center; color: var(--muted); }
.panel-error svg { opacity: .4; }
.panel-error-msg { font-size: 12.5px; }
.panel-retry-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  color: var(--accent); background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.3); border-radius: 7px; cursor: pointer;
}
.panel-retry-btn:hover { background: rgba(59,130,246,.18); }

@media (max-width: 900px) {
  .stock-keybar { gap: 14px; }
  .stock-keystats { gap: 14px; }
  .stock-52w { min-width: 100%; }
  .sticky-hero-name { max-width: 130px; }
}

/* ── Cross-source comparison (yfinance vs fiscal.ai) ─────────────── */
.src-cmp-hint { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.src-cmp-head, .src-cmp-row {
  display: grid; grid-template-columns: 1fr 110px 110px; align-items: center;
  gap: 8px; padding: 8px 20px; font-size: 13px;
}
.src-cmp-head {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.src-cmp-row { border-bottom: 1px solid var(--table-border); }
.src-cmp-row:last-of-type { border-bottom: none; }
.src-cmp-row:hover { background: var(--bg-alpha); }
.src-cmp-label { color: var(--text); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.src-cmp-yf, .src-cmp-fa { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.src-cmp-fa { color: var(--accent); }
.src-cmp-head .src-cmp-yf, .src-cmp-head .src-cmp-fa { font-weight: 600; color: var(--muted); }
.src-cmp-wait { color: var(--muted); }
.src-cmp-note { padding: 12px 20px; font-size: 12px; color: var(--muted); }

.src-flag { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: transparent; border: 1px solid var(--border); }
.src-flag-ok  { background: var(--green); border-color: var(--green); }
.src-flag-mid { background: var(--amber); border-color: var(--amber); }
.src-flag-hi  { background: var(--red);   border-color: var(--red); }

@media (max-width: 600px) {
  .src-cmp-head, .src-cmp-row { grid-template-columns: 1fr 72px 72px; padding: 8px 12px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   MOMENTUM SURGE page
   ═══════════════════════════════════════════════════════════════════ */
.mom-page-header { margin-bottom: 16px; }
.mom-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.mom-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; display: flex; align-items: center; gap: 10px; }
.mom-title-accent { color: var(--amber); }
.mom-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.mom-header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mom-region-toggle { display: inline-flex; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mom-region-btn { padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: none; border: none; border-right: 1px solid var(--border); cursor: pointer; transition: background .12s, color .12s; }
.mom-region-btn:last-child { border-right: none; }
.mom-region-btn:hover { color: var(--text); }
.mom-region-btn.active { background: var(--accent); color: #fff; }
.mom-updated { font-size: 11.5px; color: var(--muted); }
.mom-refresh-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.mom-refresh-btn:hover { background: var(--card-hover); }
.mom-refresh-btn:disabled { opacity: .55; cursor: default; }
.mom-refresh-btn.mom-spinning svg { animation: mom-spin 1s linear infinite; }
@keyframes mom-spin { to { transform: rotate(360deg); } }

/* Loading */
.mom-panel { padding: 0; overflow: hidden; }
.mom-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 80px 20px; text-align: center; }
.mom-loading[hidden] { display: none; }
.mom-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: mom-spin .9s linear infinite; }
.mom-loading-text { font-size: 14px; font-weight: 600; color: var(--text); }
.mom-loading-sub { font-size: 12px; color: var(--muted); max-width: 440px; }

/* Table */
.mom-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mom-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 1100px; }
.mom-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mom-grp-row th { padding: 8px 6px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; text-align: center; border-bottom: 1px solid var(--border); }
.mom-grp { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.mom-col-row th { padding: 7px 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mom-th-l { text-align: left; }
.mom-th-num { text-align: right; cursor: pointer; user-select: none; }
.mom-th-num:hover { color: var(--text); }
.mom-th-score { text-align: center; color: var(--accent); border-left: 1px solid var(--border); }
.mom-sort { color: var(--accent); margin-left: 2px; }

.mom-row { cursor: pointer; border-bottom: 1px solid var(--table-border); }
.mom-row:hover { background: var(--bg-alpha); }
.mom-ticker { padding: 8px 10px; white-space: nowrap; }
.mom-flag { margin-right: 7px; }
.mom-tk { font-weight: 700; color: var(--text); }
.mom-name { padding: 8px 10px; color: var(--text); font-weight: 500; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.mom-num { padding: 8px 10px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: #e7f5ec; }
.mom-num.mom-pos { color: #c8facc; }
.mom-num.mom-neg { color: #ffd3d3; }
.mom-num.mom-na  { color: var(--muted); font-weight: 500; }

.mom-arr { padding: 0 4px; text-align: center; }
.mom-arrow { display: inline-flex; align-items: center; }
.mom-arrow svg { margin: 0 -3px; }
.mom-arrow-up   { color: var(--green); }
.mom-arrow-down { color: var(--red); }
.mom-arrow-flat { color: var(--muted); font-weight: 700; }

.mom-score-cell { padding: 8px 10px; text-align: center; border-left: 1px solid var(--border); }
.mom-score { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mom-score svg rect { fill: currentColor; }
.mom-score-num { min-width: 26px; text-align: right; }
.mom-sc-vhi { color: #22c55e; }
.mom-sc-hi  { color: #4ade80; }
.mom-sc-mid { color: var(--amber); }
.mom-sc-lo  { color: #fb923c; }
.mom-sc-low { color: var(--red); }

.mom-rating { padding: 8px 14px; font-weight: 700; white-space: nowrap; }
.mom-rt-vhi { color: #22c55e; }
.mom-rt-hi  { color: #4ade80; }
.mom-rt-mid { color: var(--amber); }
.mom-rt-lo  { color: #fb923c; }
.mom-rt-vlo { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════
   PORTFOLIO page
   ═══════════════════════════════════════════════════════════════════ */
.pf-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pf-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.pf-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.pf-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-base-toggle { display: inline-flex; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pf-base-btn { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: none; border: none; border-right: 1px solid var(--border); cursor: pointer; }
.pf-base-btn:last-child { border-right: none; }
.pf-base-btn:hover { color: var(--text); }
.pf-base-btn.active { background: var(--accent); color: #fff; }
.pf-add-toggle { padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: #fff; background: var(--accent); border: none; border-radius: 8px; cursor: pointer; }
.pf-add-toggle:hover { filter: brightness(1.08); }

/* Add form */
.pf-add-panel { margin-bottom: 16px; }
.pf-add-form { display: flex; align-items: flex-end; gap: 14px; padding: 16px 18px; flex-wrap: wrap; }
.pf-field { display: flex; flex-direction: column; gap: 5px; }
.pf-field label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pf-field input { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 7px; padding: 8px 11px; font-size: 13px; color: var(--text); outline: none; width: 130px; }
.pf-field input:focus { border-color: var(--accent); }
.pf-field-sym input { width: 170px; }
.pf-add-submit { padding: 9px 18px; font-size: 13px; font-weight: 600; color: #fff; background: var(--green); border: none; border-radius: 7px; cursor: pointer; }
.pf-add-submit:hover { filter: brightness(1.08); }
.pf-add-submit:disabled { opacity: .6; cursor: default; }
.pf-add-msg { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pf-add-msg.pos { color: var(--green); }
.pf-add-msg.neg { color: var(--red); }

/* KPI row */
.pf-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.pf-kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.pf-kpi-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pf-kpi-value { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.pf-kpi-value.pos { color: var(--green); }
.pf-kpi-value.neg { color: var(--red); }
.pf-kpi-sub { font-size: 12.5px; font-weight: 700; }
.pf-kpi-sub.pos { color: var(--green); }
.pf-kpi-sub.neg { color: var(--red); }

.pf-fx-warn { font-size: 12px; color: var(--amber); margin: -4px 0 14px; }

/* Grid: table + allocation */
.pf-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.pf-table-panel { overflow: hidden; }
.pf-count { font-size: 12px; color: var(--muted); font-weight: 500; }
.pf-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pf-table { width: 100%; }
.pf-table th { white-space: nowrap; }
.pf-avatar { background: var(--accent); color: #fff; }
.pf-table .pos, .pf-table td.pos { color: var(--green); font-weight: 600; }
.pf-table .neg, .pf-table td.neg { color: var(--red); font-weight: 600; }
.pf-table .neu { color: var(--muted); }
.pf-remove-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; background: none; border: none; color: var(--muted); cursor: pointer; }
.pf-remove-btn:hover { background: var(--red-bg); color: var(--red); }

/* Allocation */
.pf-alloc-panel { padding-bottom: 12px; }
.pf-alloc-chart-wrap { height: 220px; padding: 14px 16px 6px; position: relative; }
.pf-alloc-legend { display: flex; flex-direction: column; gap: 7px; padding: 6px 18px 12px; max-height: 240px; overflow-y: auto; }
.pf-leg-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.pf-leg-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.pf-leg-sym { font-weight: 600; color: var(--text); }
.pf-leg-w { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pf-alloc-empty { font-size: 12.5px; color: var(--muted); text-align: center; padding: 20px; }

/* Empty state */
.pf-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 64px 20px; text-align: center; color: var(--muted); }
.pf-empty[hidden] { display: none; }   /* même piège que .wl-empty : display:flex écrase l'attribut hidden */
.pf-empty svg { opacity: .4; }
.pf-empty p { font-size: 15px; font-weight: 600; color: var(--text); margin: 0; }
.pf-empty-sub { font-size: 12.5px !important; color: var(--muted) !important; font-weight: 400 !important; }
.pf-empty-btn { margin-top: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); border: none; border-radius: 8px; cursor: pointer; }

@media (max-width: 1000px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .pf-kpi-row { grid-template-columns: 1fr; }
  .pf-field input, .pf-field-sym input { width: 100%; }
  .pf-field { flex: 1; min-width: 120px; }
}

/* ═══════════════════════════════════════════════════════════════════
   RESSOURCES page
   ═══════════════════════════════════════════════════════════════════ */
.rs-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.rs-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.rs-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.rs-search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; min-width: 260px; }
.rs-search-box svg { color: var(--muted); flex-shrink: 0; }
.rs-search-box input { background: none; border: none; outline: none; font-size: 13px; color: var(--text); width: 100%; }
.rs-search-box input::placeholder { color: var(--muted); }

.rs-section { margin-bottom: 26px; }
.rs-section-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }

.rs-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; transition: border-color .15s, transform .12s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.rs-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.rs-card-icon { font-size: 22px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.rs-card-body { min-width: 0; }
.rs-card-title { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--text); }
.rs-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.rs-card-host { display: inline-block; font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 7px; }
.rs-badge { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; }
.rs-badge-int { background: rgba(59,130,246,.15); color: var(--accent); border: 1px solid rgba(59,130,246,.3); }

.rs-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 20px; }

/* ═══════════════════════════════════════════════════════════════════
   NOTIFICATIONS (bell)
   ═══════════════════════════════════════════════════════════════════ */
.notif-dot { display: none; }   /* replaced by count badge */
.notif-badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--red);
  border: 2px solid var(--surface); border-radius: 9px;
  box-shadow: 0 0 6px rgba(239,68,68,.5);
}

.notif-panel {
  position: fixed; z-index: 200;
  width: 350px; max-width: calc(100vw - 24px);
  max-height: 72vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.28);
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.notif-panel-title { font-size: 14px; font-weight: 700; color: var(--text); }
.notif-mark-read {
  background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--accent);
}
.notif-mark-read:hover { text-decoration: underline; }

.notif-list { overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 16px; text-decoration: none;
  border-bottom: 1px solid var(--table-border); position: relative;
  transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-alpha); }
.notif-item.unread { background: rgba(59,130,246,.06); }
.notif-ic {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: var(--bg-secondary); color: var(--text);
}
.notif-ic.nf-up   { background: var(--green-bg); color: var(--green); }
.notif-ic.nf-down { background: var(--red-bg);   color: var(--red); }
.notif-ic.nf-earn { background: rgba(59,130,246,.15); }
.notif-ic.nf-div  { background: rgba(245,158,11,.15); }
.notif-body { min-width: 0; flex: 1; }
.notif-title { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.notif-detail { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notif-unread-dot {
  position: absolute; top: 14px; right: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.notif-empty { padding: 32px 20px; text-align: center; font-size: 13px; color: var(--text); }
.notif-empty span { font-size: 11.5px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   INDICES page
   ═══════════════════════════════════════════════════════════════════ */
.idx-header { margin-bottom: 18px; }
.idx-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.idx-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.idx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.idx-card {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); transition: border-color .15s, transform .12s, box-shadow .15s;
}
.idx-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.idx-card.active { border-color: var(--accent); background: rgba(59,130,246,.07); box-shadow: 0 0 0 1px var(--accent) inset; }
.idx-card.skeleton { min-height: 104px; cursor: default; }
.idx-card-top { display: flex; align-items: center; gap: 8px; }
.idx-card-flag { font-size: 18px; }
.idx-card-name { font-size: 14px; font-weight: 700; color: var(--text); }
.idx-card-sub { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); padding: 1px 6px; border-radius: 5px; }
.idx-card-lvl { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.idx-card-meta { display: flex; align-items: center; justify-content: space-between; }
.idx-card-chg { font-size: 13px; font-weight: 700; }
.idx-card-chg.pos { color: var(--green); }
.idx-card-chg.neg { color: var(--red); }
.idx-card-chg.neu { color: var(--muted); }
.idx-card-count { font-size: 11px; color: var(--muted); font-weight: 500; }

/* Constituents */
.idx-const-panel { overflow: hidden; }
.idx-const-count { font-size: 12px; color: var(--muted); font-weight: 500; }
.idx-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.idx-table { width: 100%; }
.idx-table th { white-space: nowrap; }
.idx-th { cursor: pointer; user-select: none; white-space: nowrap; transition: color .12s; }
.idx-th:hover { color: var(--text); }
.idx-sort { color: var(--accent); margin-left: 2px; }
.idx-rank { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.idx-avatar { background: var(--accent); color: #fff; }
.idx-row { cursor: pointer; }
.idx-row:hover { background: var(--bg-alpha); }
.idx-table .pos { color: var(--green); font-weight: 600; }
.idx-table .neg { color: var(--red); font-weight: 600; }
.idx-table .neu { color: var(--muted); }

.idx-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 20px; text-align: center; }
.idx-loading[hidden] { display: none; }
.idx-spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: mom-spin .9s linear infinite; }
.idx-loading p { font-size: 13px; color: var(--text); font-weight: 600; margin: 0; }
.idx-loading-sub { font-size: 11.5px !important; color: var(--muted) !important; font-weight: 400 !important; }

/* ── Modale graphique (Lightweight Charts) ─────────────────────────── */
.lwc-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(3px);
  animation: lwc-fade .16s ease;
}
.lwc-overlay[hidden] { display: none; }
@keyframes lwc-fade { from { opacity: 0; } to { opacity: 1; } }

.lwc-modal {
  width: min(1400px, 95vw);
  height: min(880px, 92vh);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 18px 22px 22px;
  animation: lwc-pop .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes lwc-pop { from { transform: translateY(8px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }

.lwc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.lwc-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lwc-logo {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle); border: 1px solid var(--border);
  font-weight: 700; font-size: 15px; color: var(--text);
}
.lwc-logo img { width: 100%; height: 100%; object-fit: contain; }
.lwc-logo-fb { background: var(--primary); color: #fff; border-color: transparent; }
.lwc-titles { display: flex; flex-direction: column; min-width: 0; }
.lwc-name { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lwc-ticker { font-size: 12px; color: var(--muted); }
.lwc-perf { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.lwc-perf.pos { color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.lwc-perf.neg { color: #dc2626; background: rgba(220, 38, 38, 0.12); }

.lwc-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lwc-open-link {
  font-size: 12px; font-weight: 600; color: var(--accent);
  text-decoration: none; padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--border);
}
.lwc-open-link:hover { background: var(--bg-subtle); }
.lwc-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
}
.lwc-close:hover { color: var(--text); background: var(--bg-subtle); }

.lwc-ranges { display: flex; gap: 4px; margin-bottom: 8px; }
.lwc-range-btn {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 5px 12px; border-radius: 7px;
  background: transparent; border: 1px solid transparent; cursor: pointer;
}
.lwc-range-btn:hover { color: var(--text); background: var(--bg-subtle); }
.lwc-range-btn.active { color: #fff; background: var(--primary); border-color: var(--primary); }

/* Rangée de contrôles : type de graphique + EMA */
.lwc-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.lwc-type-toggle { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.lwc-type-btn {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 5px 12px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
}
.lwc-type-btn:hover { color: var(--text); }
.lwc-type-btn.active { color: var(--text); background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }

.lwc-ema-toggle { display: inline-flex; align-items: center; gap: 6px; }
.lwc-ema-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.lwc-ema-btn {
  font-size: 12px; font-weight: 700; color: var(--muted);
  min-width: 34px; padding: 5px 9px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  position: relative;
}
.lwc-ema-btn:hover { color: var(--text); }
.lwc-ema-btn.active {
  color: #fff; background: var(--ema-c); border-color: var(--ema-c);
}

.lwc-chart-box { width: 100%; flex: 1 1 auto; min-height: 0; }
.lwc-msg { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.lwc-msg[hidden] { display: none; }

/* Bouton icône graphique dans les tables watchlist/portefeuille */
.mini-chart-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; transition: all .12s ease;
}
.mini-chart-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-subtle); }

@media (max-width: 640px) {
  .lwc-overlay { padding: 10px; }
  .lwc-modal { padding: 14px; width: 96vw; height: 94vh; }
  .lwc-ranges, .lwc-controls { flex-wrap: wrap; }
}

/* ── Macro (FRED) ──────────────────────────────────────────────────── */
.macro-kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.macro-kpi {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.macro-kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.macro-kpi-value { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.macro-kpi-delta { font-size: 12px; font-weight: 700; }
.macro-kpi-delta.pos { color: #16a34a; }
.macro-kpi-delta.neg { color: #dc2626; }
.macro-kpi-delta.neu { color: var(--muted); }
.macro-kpi-warn {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: #dc2626; background: rgba(220,38,38,0.12); padding: 1px 6px; border-radius: 5px;
}

.macro-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px;
}
.macro-card .panel-header { display: flex; align-items: center; justify-content: space-between; }
.macro-sub { font-size: 11px; color: var(--muted); }
.macro-canvas-wrap { height: 230px; padding: 6px 4px 2px; }

@media (max-width: 640px) {
  .macro-grid { grid-template-columns: 1fr; }
  .macro-canvas-wrap { height: 200px; }
}

/* ── Société : short interest + insiders ───────────────────────────── */
.soc-short-date { font-size: 11px; color: var(--muted); margin-top: 10px; }
.soc-insider-badge { font-size: 12px; font-weight: 600; }
.soc-insider-badge .pos { color: #16a34a; }
.soc-insider-badge .neg { color: #dc2626; }
.soc-kpi-value .pos { color: #16a34a; }
.soc-kpi-value .neg { color: #dc2626; }
.soc-kpi-value.pos { color: #16a34a; }
.soc-kpi-value.neg { color: #dc2626; }
.soc-kpi-value.neu { color: #f59e0b; }
.ins-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.ins-buy { background: #16a34a; }
.ins-sell { background: #dc2626; }
.ins-neu { background: #94a3b8; }
.ins-name { font-weight: 600; }
.ins-pos { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }

/* ── Notation factorielle (onglet Analyse) ─────────────────────────── */
.fg-panel { margin-bottom: 16px; }
.fg-scope { font-size: 12px; color: var(--muted); }
.fg-overall { display: flex; align-items: center; gap: 8px; }
.fg-overall-grade { font-size: 20px; font-weight: 800; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 9px; }
.fg-overall-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.fg-body { display: flex; flex-direction: column; gap: 18px; }
.fg-grades { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.fg-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 11px; text-align: center; }
.fg-card-grade { font-size: 22px; font-weight: 800; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.fg-card-label { font-size: 11.5px; font-weight: 600; color: var(--text); }
.fg-card-score { font-size: 11px; color: var(--muted); }
.fg-card-sub { font-size: 10px; color: var(--muted); }
.fg-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2px 28px; }
.fg-metrics-head { grid-column: 1 / -1; }
/* Couleurs des notes */
.fg-a { background: rgba(22,163,74,0.15);  color: #16a34a; }
.fg-b { background: rgba(132,204,22,0.15); color: #65a30d; }
.fg-c { background: rgba(245,158,11,0.15); color: #d97706; }
.fg-d { background: rgba(249,115,22,0.15); color: #ea580c; }
.fg-f { background: rgba(220,38,38,0.15);  color: #dc2626; }
.fg-na { background: var(--border); color: var(--muted); }
/* Barres de percentile */
.fg-metrics-head { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.fg-metrics-head b { color: var(--text); }
.fg-metric { display: grid; grid-template-columns: 92px 62px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 7px; }
.fg-metric-lbl { font-size: 12px; color: var(--muted); }
.fg-metric-val { font-size: 12px; font-weight: 600; color: var(--text); text-align: right; }
.fg-metric-bar { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.fg-metric-fill { height: 100%; border-radius: 4px; background: #94a3b8; }
.fg-metric-fill.hi  { background: #16a34a; }
.fg-metric-fill.mid { background: #f59e0b; }
.fg-metric-fill.lo  { background: #dc2626; }
.fg-metric-pct { font-size: 12px; font-weight: 700; color: var(--text); text-align: right; }
.fg-metric-sup { font-size: 8px; vertical-align: super; }
@media (max-width: 560px) {
  .fg-grades { grid-template-columns: repeat(3, 1fr); }
}

/* ── Révisions d'estimations + Options (onglet Résultats) ──────────── */
.rev-badge { font-size: 12px; font-weight: 600; }
.rev-badge .pos, .opt-tile-value.pos, .rev-table .pos, #rev-actions .pos { color: #16a34a; }
.rev-badge .neg, .opt-tile-value.neg, .rev-table .neg, #rev-actions .neg { color: #dc2626; }
.rev-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rev-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rev-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.rev-table .text-right { text-align: right; }
.rev-num { color: var(--muted); font-size: 10.5px; margin-left: 5px; font-weight: 400; }
.rev-drift-title { font-size: 11px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.rev-firm { font-weight: 600; }

.opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opt-tile { display: flex; flex-direction: column; gap: 3px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.opt-tile-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.opt-tile-value { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.opt-tile-value.neu { color: var(--text); }
.opt-tile-sub { font-size: 10.5px; color: var(--muted); }
.opt-exp { font-size: 11px; color: var(--muted); }
@media (max-width: 560px) { .opt-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Chiffre d'affaires par segment (onglet Finances) ──────────────── */
.seg-src { font-size: 11px; color: var(--muted); }
.seg-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; }
.seg-chart-wrap { height: 200px; }
.seg-table-wrap { overflow-x: auto; }
.seg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.seg-panel .pos { color: #16a34a; }
.seg-panel .neg { color: #dc2626; }
@media (max-width: 640px) {
  .seg-layout { grid-template-columns: 1fr; }
  .seg-chart-wrap { height: 180px; }
}

/* Colonne « Vues » de la section Les plus vues cette semaine */
.ts-views { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Légendes HTML des graphiques macro comparatifs */
.macro-leg { display: flex; gap: 14px; justify-content: flex-end; padding: 0 12px 2px; }
.macro-leg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.macro-leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Colonne sparkline de la watchlist */
.wl-spark-cell { text-align: center; vertical-align: middle; width: 110px; }
.wl-spark-svg { display: inline-block; vertical-align: middle; }
.wl-spark-empty { color: var(--muted); }

/* Actualités Reddit r/stocks (accueil) */
.reddit-avatar { background: transparent; padding: 0; display: flex; align-items: center; justify-content: center; }
.reddit-avatar svg { display: block; }
.reddit-src { color: #FF4500 !important; font-weight: 700; }

/* Panneaux Risque quantitatif (Risk Shield) */
.risk-sub { font-size: 11px; color: var(--muted); }
.risk-grid { grid-template-columns: repeat(4, 1fr); }
.risk-canvas-wrap { height: 260px; padding: 4px 2px; }
.opt-tile-value.pos { color: #16a34a; }
.opt-tile-value.neg { color: #dc2626; }
@media (max-width: 900px) { .risk-grid { grid-template-columns: repeat(2, 1fr); } }

/* Distribution Monte Carlo du prix juste (onglet Valorisation) */
.valmc-canvas-wrap { height: 190px; padding: 2px; }

/* Analyse quantitative du portefeuille */
.pfq-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 22px; align-items: start; }
.pfq-h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 8px; }
.pfq-canvas-wrap { height: 300px; }
.pfq-contrib-wrap { height: 220px; }
.pfq-corr-scroll { overflow-x: auto; }
.pfq-corr-table { border-collapse: collapse; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.pfq-corr-table th { font-size: 10px; color: var(--muted); padding: 3px 4px; text-align: center; font-weight: 600; }
.pfq-corr-table td { padding: 3px 4px; text-align: center; color: #fff; min-width: 34px; border: 1px solid var(--card); }
.pfq-weights { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pfq-w-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.pfq-w-chip { font-size: 11px; font-weight: 700; color: var(--text); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; }
@media (max-width: 1000px) { .pfq-row { grid-template-columns: 1fr; } }

/* Pairs trading (Comparateur) + smile + ACF */
.pairs-signal { font-size: 13px; font-weight: 700; color: var(--text); padding: 8px 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; margin: 0 0 10px; }
.pairs-signal.pos { color: #16a34a; border-color: rgba(22,163,74,0.4); }
.opt-smile-wrap { height: 200px; padding: 2px; }
.risk-acf-wrap { height: 170px; padding: 2px; }

/* Régimes de marché (Markov) */
.regime-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; font-style: italic; }
