/* ---------- Fiche détaillée ---------- */
.small { font-size: 12px; }
.wait { color: var(--wait); }
.pill.wait { background: rgba(245, 158, 11, .15); }

.dt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.dt-head h2 { margin: 0 6px 0 0; }
.dt-head .badge { margin-left: 0; }
.badge.type { color: var(--accent); border-color: rgb(var(--accent-rgb) / .4); background: rgb(var(--accent-rgb) / .1); }
.badge.state { display: inline-flex; align-items: center; gap: 6px; }
.badge.state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.state.open .dot { background: var(--up); animation: live-pulse 1.6s ease-in-out infinite; }
.badge.state.pre .dot { background: var(--wait); }

/* Onglets avec soulignement glissant */
.tabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-radius: 0; padding: 9px 12px; color: var(--muted);
  font-weight: 600; white-space: nowrap; transition: color .2s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tab-ink {
  position: absolute; bottom: 0; height: 2px; background: var(--accent); border-radius: 2px;
  transition: left .3s cubic-bezier(.4, 0, .2, 1), width .3s cubic-bezier(.4, 0, .2, 1);
}

.dt-section + .dt-section { margin-top: 16px; }
.dt-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.dt-section h3 .small { text-transform: none; letter-spacing: 0; }

/* Apparition en cascade */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tab-panel.animate .stat, .tab-panel.animate .perf-chip, .tab-panel.animate .hbar {
  animation: rise .35s ease-out both; animation-delay: calc(min(var(--i, 0), 16) * 25ms);
}

/* Performances */
.perf-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; }
.perf-chip {
  display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 8px;
  transition: transform .15s; cursor: default;
}
.perf-chip:hover { transform: translateY(-2px) scale(1.04); }
.perf-k { font-size: 11px; color: var(--text); opacity: .75; }
.perf-v { font-weight: 700; font-size: 13px; }

/* Fourchettes */
.dt-range + .dt-range { margin-top: 10px; }
.dt-range-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.range-marker { transition: left .8s cubic-bezier(.2, .8, .2, 1); }

/* Cartes de statistiques */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat {
  position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.stat:hover { border-color: rgb(var(--accent-rgb) / .5); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.stat-k { font-size: 12px; color: var(--muted); }
.stat-v { font-size: 16px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; margin-top: 2px; }
.tip-i {
  display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  font-size: 10px; border: 1px solid var(--border); color: var(--muted); vertical-align: 1px;
}

/* Infobulles pédagogiques */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 8px);
  width: max-content; max-width: 240px; padding: 8px 10px; border-radius: 8px;
  background: #0f1522; border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); pointer-events: none;
  opacity: 0; transform: translate(-50%, 4px); transition: opacity .15s, transform .15s;
}
[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); }

/* Barres horizontales */
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 64px; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; }
.hbar + .hbar { margin-top: 2px; }
.hbar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-value { font-size: 13px; font-weight: 600; text-align: right; }
.hbar-track { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.hbar-track.big { height: 12px; border-radius: 6px; margin: 4px 0; }
.hbar-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #4ade80); transition: width .9s cubic-bezier(.2, .8, .2, 1);
}
.hbar-fill.accent { background: linear-gradient(90deg, #3b6fe0, var(--accent)); }
.hbar-fill.muted-fill { background: #64748b; }
.hbar-fill.neg { background: var(--down); }
.hbar.clickable { cursor: pointer; transition: background .15s; }
.hbar.clickable:hover { background: var(--panel-2); }
.hbar.clickable:hover .hbar-label b { color: var(--accent); }

/* Répartition */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut {
  position: relative; width: 110px; height: 110px; border-radius: 50%;
  animation: spin-in .9s cubic-bezier(.2, .8, .2, 1);
}
.donut::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--panel); }
@keyframes spin-in { from { transform: rotate(-90deg) scale(.6); opacity: 0; } }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-left: auto; padding-left: 14px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* Analystes */
.analysts-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.target-track { position: relative; height: 6px; border-radius: 3px; background: var(--panel-2); margin: 0 6px; }
.target-zone { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, rgba(239, 68, 68, .5), rgba(34, 197, 94, .6)); }
.target-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.target-mark.now { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--panel); z-index: 1; }
.target-mark.mean { width: 10px; height: 10px; background: var(--accent); transform: translate(-50%, -50%) rotate(45deg); }
.analysts .qh-range-foot { margin-top: 8px; }

/* À propos */
.desc { margin: 0 0 6px; line-height: 1.6; }
.desc.collapsed { display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts a { color: var(--accent); text-decoration: none; }
.facts a:hover { text-decoration: underline; }

/* Chargement */
.skeleton {
  height: 56px; border-radius: 8px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--panel-2) 25%, #1f2a40 50%, var(--panel-2) 75%); background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton.short { width: 60%; height: 20px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 600px) {
  .hbar { grid-template-columns: 1fr 52px; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel.animate *, .donut, .hbar-fill, .range-marker, .skeleton { animation: none !important; transition: none !important; }
}

/* Logo (initiales en repli) */
.logo-wrap {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 8px; overflow: hidden; vertical-align: middle; margin-right: 8px;
  background: linear-gradient(135deg, #3b2a30, #241a1d); border: 1px solid var(--border);
}
.logo-wrap.big { width: 44px; height: 44px; border-radius: 12px; margin-right: 4px; }
.logo-initials { font-size: 11px; font-weight: 700; color: var(--muted); }
.logo-wrap.big .logo-initials { font-size: 15px; }
.logo-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 3px; opacity: 0; transition: opacity .3s; }
.logo-wrap.has-img img { opacity: 1; }
.logo-wrap.has-img .logo-initials { visibility: hidden; }
.qh-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; }
.dt-title { display: flex; flex-direction: column; margin-right: 8px; }
.dt-title h2 { margin: 0; line-height: 1.2; }
.dt-head { margin-bottom: 10px; }

/* Enveloppes fiscales */
.elig { display: flex; flex-wrap: wrap; gap: 8px; }
.elig-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px 7px 8px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border); transition: transform .15s, border-color .2s;
}
.elig-chip:hover { transform: translateY(-2px); }
.elig-chip b { display: block; font-size: 13px; line-height: 1.2; }
.elig-chip small { color: var(--muted); font-size: 11px; }
.elig-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 700; font-size: 13px; }
.elig-chip.oui { border-color: rgba(34, 197, 94, .35); }
.elig-chip.oui .elig-icon { background: rgba(34, 197, 94, .18); color: var(--up); }
.elig-chip.non .elig-icon { background: rgba(239, 68, 68, .15); color: var(--down); }
.elig-chip.verifier .elig-icon, .elig-chip.contrat .elig-icon { background: rgba(245, 158, 11, .15); color: var(--wait); }
.tab-panel.animate .elig-chip { animation: rise .35s ease-out both; animation-delay: calc(var(--i, 0) * 40ms); }

.note { margin: 0 0 8px; }
.rank {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 5px;
  background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600;
}

/* Dividendes */
.div-next {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(245, 158, 11, .12), rgba(245, 158, 11, .02)); border: 1px solid rgba(245, 158, 11, .3);
}
.div-next-icon { font-size: 22px; }
/* Histogramme annuel des dividendes */
.div-chart-wrap {
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: 210px auto; column-gap: 8px;
  padding: 14px 14px 8px 6px; border-radius: 12px; border: 1px solid var(--border);
  background: radial-gradient(120% 90% at 50% 0%, rgba(34, 197, 94, .07), transparent 60%), var(--panel-2);
}
.div-axis { position: relative; }
.div-axis span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.div-plot { position: relative; }
.div-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(138, 148, 168, .16); }
.div-grid:first-child { border-top: 1px solid rgba(138, 148, 168, .35); }
.div-chart { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 6px; }
.div-col {
  position: relative; flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 8px 8px 0 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  background: transparent; cursor: pointer; transition: background .2s;
}
.div-col:hover, .div-col.active { background: rgba(255, 255, 255, .035); }
.div-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.div-stack {
  display: flex; flex-direction: column-reverse; gap: 2px; width: 72%; max-width: 44px; height: 0; border-radius: 6px 6px 2px 2px; overflow: hidden;
  transition: height .9s cubic-bezier(.2, .8, .2, 1), transform .2s, filter .2s; transition-delay: calc(var(--i, 0) * 45ms), 0s, 0s;
  box-shadow: 0 0 0 rgba(34, 197, 94, 0);
}
.div-seg { display: block; min-height: 3px; background: linear-gradient(180deg, #4ade80, #22c55e); }
.div-seg:nth-child(even) { background: linear-gradient(180deg, #22c55e, #15803d); }
.div-col.down .div-seg { background: linear-gradient(180deg, #fbbf24, #d97706); }
.div-col.down .div-seg:nth-child(even) { background: linear-gradient(180deg, #d97706, #b45309); }
.div-col.partial .div-seg { background: repeating-linear-gradient(45deg, rgba(74, 222, 128, .75) 0 5px, rgba(21, 128, 61, .75) 5px 10px); }
.div-col:hover .div-stack { filter: brightness(1.15); transform: scaleX(1.06); }
.div-col.active .div-stack { filter: brightness(1.2); box-shadow: 0 0 18px rgba(34, 197, 94, .45); }
.div-amount {
  font-size: 11px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; color: var(--muted);
  font-variant-numeric: tabular-nums; transition: color .2s, transform .2s;
}
.div-col:hover .div-amount, .div-col.active .div-amount { color: var(--text); transform: translateY(-2px); }
.div-col.up .div-amount { color: #86efac; }
.div-col.down .div-amount { color: #fcd34d; }
.div-years { grid-column: 2; display: flex; gap: 6px; padding-top: 6px; }
.div-years span { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); }

.div-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.div-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; }
.lg-seg { background: linear-gradient(180deg, #4ade80 45%, var(--panel) 45% 55%, #15803d 55%); }
.lg-up { background: #22c55e; }
.lg-down { background: #f59e0b; }

/* Bulle de détail d'une année */
.div-popover {
  position: absolute; z-index: 30; width: 250px; padding: 14px 16px 12px; border-radius: 12px;
  background: rgba(24, 17, 20, .97); border: 1px solid rgb(var(--accent-rgb) / .45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03) inset; backdrop-filter: blur(6px);
}
.div-popover::after {
  content: ""; position: absolute; top: 100%; left: var(--arrow, 50%); transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: rgb(var(--accent-rgb) / .45);
}
.div-popover.show { animation: pop-in .22s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.pop-close {
  position: absolute; top: 6px; right: 8px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
}
.pop-close:hover { background: var(--panel-2); color: var(--text); }
.pop-head { font-size: 13px; color: var(--muted); }
.pop-head b { color: var(--text); font-size: 15px; }
.pop-total { font-size: 22px; font-weight: 700; margin: 2px 0; color: var(--up); }
.pop-total small { font-size: 12px; font-weight: 400; }
.pop-list { list-style: none; margin: 10px 0 8px; padding: 0; max-height: 200px; overflow-y: auto; display: grid; gap: 2px; }
.pop-list li {
  display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; line-height: 1.3; animation: rise .3s ease-out both;
}
.pop-list li:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.pop-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.pop-list li:nth-child(even) .pop-dot { background: #15803d; }
.div-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.div-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.div-table td { padding: 7px 8px; border-bottom: 1px solid rgba(36, 48, 73, .5); }
.div-table tbody tr { transition: background .15s; }
.div-table tbody tr:hover { background: var(--panel-2); }
.div-table tr.upcoming td { background: rgba(245, 158, 11, .07); }
.rows-btn { margin-top: 8px; }

@media (max-width: 600px) {
  .div-amount { display: none; }
}

/* Sous-onglets de la composition (contrôle segmenté) */
.subtabs {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.subtabs button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-weight: 600; transition: background .2s, color .2s;
}
.subtabs button:hover { color: var(--text); }
.subtabs button.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 10px rgb(var(--accent-rgb) / .35); }
.subtabs button.is-empty:not(.active) { opacity: .55; }
.subtabs .count {
  min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center;
  background: rgba(255, 255, 255, .12);
}
.subpanel.animate .hbar { animation: rise .35s ease-out both; animation-delay: calc(var(--i, 0) * 25ms); }
.empty-sub { padding: 14px; border: 1px dashed var(--border); border-radius: 8px; margin: 0; }

/* Note d'information (ex. ETF répliqué par swap) */
.info-note {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  background: rgb(var(--accent-rgb) / .08); border: 1px solid rgb(var(--accent-rgb) / .3);
}
.note a { color: var(--accent); }

/* Drapeaux et logos dans les barres de composition */
.hbar-label { display: flex; align-items: center; gap: 0; min-width: 0; }
.hbar-label .flag { flex: none; width: 20px; height: 15px; margin-right: 8px; border-radius: 3px; background-size: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.hbar-label .flag-none { display: inline-grid; place-items: center; font-size: 13px; box-shadow: none; }
.hbar-label .logo-wrap { width: 22px; height: 22px; border-radius: 6px; margin-right: 7px; }
.hbar-label .logo-wrap .logo-initials { font-size: 9px; }
.hbar-label b { flex: none; }
.info-note.warn { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .35); }
