/* Menu du haut, pages outils (comparateur, simulateur, calendrier, screener, glossaire), actualités, chat */

/* ---------- Menu du haut ---------- */
.top-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top-nav a {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px;
  transition: background .15s, color .15s;
}
.top-nav a:hover { color: var(--text); background: var(--panel-2); }
.top-nav a.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.top-actions { display: flex; gap: 6px; margin-left: auto; }
.top-actions .icon-btn { margin-left: 0; width: auto; min-width: 32px; padding: 0 8px; font-size: 13px; font-weight: 700; }

/* ---------- Pages ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h2 { font-size: 20px; margin: 0 0 2px; }
.page-head p { margin: 0; }
.table-scroll { overflow-x: auto; }
.home-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
/* Filtre sélectionné : fond bleu plein, bien distinct des filtres inactifs */
.chip.active, .chip.active:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: 0 2px 10px rgb(var(--accent-rgb) / .35); }
.cmp-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.cmp-presets .chip .logo-wrap { width: 18px; height: 18px; }
.search-results.mini { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; }

/* ---------- Comparateur ---------- */
.cmp-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.cmp-chips { display: contents; }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 8px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--c);
}
.cmp-chip .logo-wrap { width: 22px; height: 22px; margin-right: 0; }
.cmp-chip small { font-size: 11px; }
.cmp-remove { padding: 0 7px; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; }
.cmp-remove:hover { color: var(--down); }
.cmp-add { position: relative; flex: 1; min-width: 220px; }
.cmp-chart-box, .sim-chart-box { position: relative; margin: 6px 0 12px; }
.cmp-chart { height: 340px; }
.cmp-table, .scr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th, .cmp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-table thead th { font-weight: 700; }
.cmp-table tbody th { text-align: left; font-weight: 500; color: var(--muted); }
.cmp-table td.best { font-weight: 700; background: rgb(var(--accent-rgb) / .08); }
.cmp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* ---------- Simulateur ---------- */
.sim-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; align-items: end; }
.sim-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.sim-field input, .sim-field select { color: var(--text); }
.sim-wide { grid-column: span 2; }
.sim-pick { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }
.sim-pick .logo-wrap { width: 22px; height: 22px; margin: 0; }
.sim-pick b { white-space: nowrap; }
.sim-pick input { border: 0; background: transparent; padding: 4px; }
.sim-toggle { flex-direction: row; align-items: center; gap: 8px; color: var(--text); padding-bottom: 8px; }
.sim-toggle input { width: auto; }
.sim-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.sim-kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.sim-kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }
.sim-kpi.main { border-color: rgba(34, 197, 94, .45); }
.sim-kpi.main.down { border-color: rgba(239, 68, 68, .45); }
.sim-kpi.main b { font-size: 24px; color: var(--text); }
.sim-kpi.main.up small { color: var(--up); }
.sim-kpi.main.down small { color: var(--down); }
.sim-legend { display: flex; gap: 16px; color: var(--muted); }
.sim-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- Calendrier ---------- */
.cal-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; }
.cal-group.past { opacity: .7; }
.cal-row {
  display: grid; grid-template-columns: 52px 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 8px 4px; text-align: left; color: var(--text);
}
.cal-row:hover { background: var(--panel-2); }
.cal-row.today { box-shadow: inset 3px 0 0 var(--accent); }
.cal-row .logo-wrap { width: 28px; height: 28px; margin: 0; }
.cal-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.cal-date b { font-size: 18px; }
.cal-date small { font-size: 11px; }
.cal-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cal-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-type { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap; }
.cal-type.t-earnings { color: #60a5fa; border-color: rgba(96, 165, 250, .35); }
.cal-type.t-exDividend { color: var(--wait); border-color: rgba(245, 158, 11, .35); }
.cal-type.t-dividendPayment { color: var(--up); border-color: rgba(34, 197, 94, .35); }
.cal-amount { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.cal-compact .cal-row { padding: 6px 4px; }

/* ---------- Screener ---------- */
.scr-sectors { display: flex; flex-wrap: wrap; gap: 6px; }
.scr-sectors .chip { font-size: 12px; }

/* ---------- Glossaire ---------- */
.gl-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.gl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.gl-item { padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.gl-item header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gl-item h3 { margin: 0; font-size: 15px; }
.gl-item p { margin: 0; font-size: 13px; line-height: 1.5; flex: 1; }
.gl-item .ghost { align-self: flex-start; padding-left: 0; }
.gl-cat { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- Accueil : outils ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tool-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px; text-align: left; border-radius: 10px;
  background: var(--panel-2); transition: transform .15s, border-color .15s;
}
.tool-card span { font-size: 22px; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); }

/* ---------- Actualités ---------- */
.news-list { display: flex; flex-direction: column; }
.news-item { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.news-item:hover { background: var(--panel-2); }
.news-item img, .news-ph { flex: none; width: 72px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--panel-2); display: grid; place-items: center; font-size: 22px; }
.news-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.news-main b { font-weight: 600; line-height: 1.35; }

/* ---------- Composition : secteurs ---------- */
.ic-sectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.ic-sector { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.ic-sector-head { display: flex; align-items: center; gap: 8px; }
.ic-sector-head .pill { margin-left: auto; font-size: 12px; }
.ic-sector-bar { display: flex; align-items: center; gap: 8px; }
.ic-sector-bar .hbar-track { flex: 1; }
.ic-sector-bar b { font-size: 12px; min-width: 48px; text-align: right; }
.ic-sector-logos { display: flex; flex-wrap: wrap; gap: 4px; }
.ic-mini { padding: 0; border: 0; background: transparent; }
.ic-mini .logo-wrap { width: 26px; height: 26px; margin: 0; }

/* ---------- Graphique : mode tracé ---------- */
.chart-panel.drawing .chart { cursor: crosshair; }

/* ---------- Chat ---------- */
#send-btn.stop { background: var(--down); border-color: var(--down); }
.copy-btn { align-self: flex-start; margin-top: 2px; padding: 2px 8px; font-size: 11px; color: var(--muted); background: transparent; }
.copy-btn:hover { color: var(--text); }

@media (max-width: 700px) {
  .sim-wide { grid-column: auto; }
  .cal-row { grid-template-columns: 44px 26px minmax(0, 1fr) auto; }
  .cal-amount { display: none; }
  .top-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
}

/* Barre du graphique : seul le premier bouton icône est poussé à droite */
#fullscreen-btn { margin-left: 0; }

/* Boutons de choix (vues, filtres, type de graphique) : l'option active ressort nettement */
.seg button.active { background: var(--accent); color: var(--on-accent); }
.seg.multi button.active { background: rgb(var(--accent-rgb) / .32); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- Fondamentaux : historique annuel ---------- */
.fin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.fin-card { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.fin-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.fin-head b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fin-bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.fin-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; min-width: 0; }
.fin-val { font-size: 10px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-bar { width: 100%; max-width: 34px; height: 0; border-radius: 4px 4px 0 0; background: rgb(var(--accent-rgb) / .45); transition: height .7s cubic-bezier(.2, .8, .2, 1); }
.fin-bar.last { background: var(--accent); }
.fin-bar.neg { background: rgba(239, 68, 68, .7); }
.fin-year { font-size: 11px; }


/* ---------- Fondamentaux : liste des actionnaires ---------- */
.holders { margin-top: 12px; }
.holders .subtabs { margin-bottom: 6px; }
.holder-row { display: grid; grid-template-columns: 22px 30px minmax(0, 1.4fr) minmax(60px, 1fr) 78px; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--border); }
.holder-row.insider { grid-template-columns: 30px minmax(0, 1fr) auto; }
.holder-row .logo-wrap { width: 28px; height: 28px; margin: 0; }
.holder-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.holder-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holder-pct { display: flex; flex-direction: column; align-items: flex-end; font-weight: 600; font-variant-numeric: tabular-nums; }
.holder-pct small { font-weight: 500; font-size: 11px; }
.info-note .ghost { display: block; margin-top: 6px; padding-left: 0; color: var(--accent); }
@media (max-width: 640px) { .holder-row { grid-template-columns: 30px minmax(0, 1fr) 70px; } .holder-row .rank, .holder-row .hbar-track { display: none; } }

/* ---------- Simulateur : durée, mode, dividendes, explications ---------- */
.sim-row { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 4px 0 10px; }
.sim-group { display: flex; flex-direction: column; gap: 4px; }
.sim-group .seg button { padding: 6px 10px; font-size: 12.5px; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.sim-banner { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; margin-bottom: 10px; border: 1px solid var(--border); }
.sim-banner.past { background: rgba(34, 197, 94, .07); border-color: rgba(34, 197, 94, .3); }
.sim-banner.projection { background: rgba(167, 139, 250, .08); border-color: rgba(167, 139, 250, .35); }
.sim-how { margin-top: 10px; font-size: 13px; }
.sim-how summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.sim-how ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.55; }
.sim-how b { color: var(--text); }

/* ---------- Screener simplifié ---------- */
.scr2-hero { text-align: center; padding: 10px 0 6px; }
.scr2-hero h2 {
  font-size: 24px; margin: 0 0 4px;
  background: linear-gradient(90deg, var(--accent), #a78bfa 55%, #22c55e); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.scr2-hero p { margin: 0; }
.scr2-step { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font-weight: 700; }
.scr2-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; }
.scr2-markets { display: flex; flex-wrap: wrap; gap: 8px; }
.scr2-market { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; font-weight: 600; background: var(--panel-2); transition: all .2s; }
.scr2-market .fi { width: 20px; height: 15px; border-radius: 3px; background-size: cover; }
.scr2-market:hover { border-color: var(--accent); transform: translateY(-1px); }
.scr2-market.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px rgb(var(--accent-rgb) / .35); }
.scr2-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.scr2-goal {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; text-align: left;
  border-radius: 14px; background: var(--panel-2); transition: transform .2s, box-shadow .2s, border-color .2s; overflow: hidden;
}
.scr2-goal:hover { transform: translateY(-3px); border-color: var(--accent); }
.scr2-goal-icon { font-size: 26px; margin-bottom: 4px; transition: transform .3s; }
.scr2-goal:hover .scr2-goal-icon { transform: scale(1.15) rotate(-6deg); }
.scr2-goal small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.scr2-goal.active { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); box-shadow: 0 10px 26px rgb(var(--accent-rgb) / .35); }
.scr2-goal.active small { color: rgba(255, 255, 255, .85); }
.scr2-select { min-width: 200px; }
.scr2-select.is-set { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.scr2-results { margin-top: 16px; transition: opacity .2s; }
.scr2-results.loading { opacity: .5; }
.scr2-summary { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.scr2-summary b { font-size: 18px; }
.scr2-summary p { margin: 0; }
.scr2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.scr2-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; text-align: left; border-radius: 14px; min-height: 150px;
  background: var(--panel-2); animation: pop-in .4s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.scr2-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 30px rgba(0, 0, 0, .25); }
.scr2-card.podium { border-color: rgba(245, 158, 11, .45); background: linear-gradient(160deg, rgba(245, 158, 11, .1), var(--panel-2) 45%); }
.scr2-rank { position: absolute; top: 10px; right: 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.scr2-card.podium .scr2-rank { font-size: 22px; top: 6px; }
.scr2-top { display: flex; align-items: center; gap: 10px; padding-right: 28px; min-width: 0; }
.scr2-top .logo-wrap { width: 36px; height: 36px; margin: 0; border-radius: 10px; }
.scr2-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.scr2-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr2-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr2-metric { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.scr2-metric b {
  font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--accent), #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.scr2-metric.down b { background: linear-gradient(90deg, var(--down), #f97316); -webkit-background-clip: text; background-clip: text; }
.scr2-bar { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.scr2-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), #a78bfa); animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; }
.scr2-bar span.neg { background: linear-gradient(90deg, var(--down), #f97316); }
@keyframes grow { from { width: 0; } }
.scr2-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; font-variant-numeric: tabular-nums; margin-top: auto; }
.scr2-more { display: block; margin: 14px auto 0; padding: 10px 22px; border-radius: 999px; font-weight: 600; }
.scr2-more:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .scr2-card, .scr2-bar span { animation: none; } }
/* Les 6 objectifs sur une seule ligne dès que la largeur le permet */
.scr2-goals { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
.scr2-goal { padding: 12px; }

/* ---------- À propos ---------- */
.ab-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.ab-index {
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); box-shadow: 0 3px 10px rgb(var(--accent-rgb) / .3);
}
.ab-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
div.desc p { margin: 0 0 8px; }
div.desc.collapsed { display: block; max-height: 8.2em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.ab-source { margin: 4px 0 0; }
.ab-source a { color: var(--accent); }
.ab-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ab-person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.ab-photo {
  position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #3b2a30, #241a1d); color: #eadbd2; font-weight: 700; font-size: 16px; box-shadow: 0 0 0 2px var(--border);
}
.ab-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.ab-person-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.ab-person-main small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:root[data-theme="light"] .ab-photo { background: linear-gradient(135deg, #efe2dc, #f6f0ed); color: #6b4e50; }
