/* Asset Vault — onglet « Investissement » (direction B « Portefeuille en cartes »).
   Contrat : docs/INVEST-TAB.md §4 ; maquette : mockups/invest-v2-b.html.
   Vue : public/js/views/investments.js.

   Règles : classes préfixées .inv- ; AUCUNE couleur en dur — uniquement des
   tokens --av-* (transparences via color-mix sur ces tokens). Les couleurs par
   type, poids de barres et largeurs sont posés en JS (el.style, CSP). Les
   mini-graphiques SVG des tuiles ne portent que des classes : leurs couleurs
   vivent ici. Responsive vérifié à 1280 / 900 / 640 / 375 px.

   Sommaire
     0. Racine, libellés, sections, carte
     1. Hero sombre
     2. Positions (grille de tuiles + mini-graphiques)
     3. Plan d'épargne
     4. Projection
     5. État vide */

/* =========================================================================
   0. Racine, libellés, sections, carte
   ========================================================================= */

.inv {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--av-text);
}

/* Sur-titre en capitales espacées (kicker de la maquette). */
.inv-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--av-text-tertiary);
}

.inv-nowrap {
  white-space: nowrap;
}

.inv-sec {
  margin-top: 36px;
}

.inv-sec__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 4px 16px;
}

.inv-sec__title {
  font-family: var(--av-font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.inv-sec__meta {
  font-size: 12.5px;
  color: var(--av-text-tertiary);
}

/* Carte blanche de la maquette (sans bordure, ombre douce à deux couches). */
.inv-card {
  background: var(--av-surface);
  border-radius: var(--av-radius-lg);
  box-shadow:
    var(--av-shadow-sm),
    0 10px 28px color-mix(in srgb, var(--av-text) 5%, transparent);
}

@media (min-width: 900px) {
  .inv-sec {
    margin-top: 44px;
  }
}

/* =========================================================================
   1. HERO SOMBRE compact
   ========================================================================= */

.inv-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  padding: 24px 20px 22px;
  border-radius: var(--av-radius-lg);
  color: var(--av-text-on-dark);
  background:
    radial-gradient(620px 300px at 82% -12%, var(--av-dark-glow) 0%, transparent 68%),
    linear-gradient(160deg, var(--av-dark-2), var(--av-dark));
  box-shadow: 0 18px 44px color-mix(in srgb, var(--av-dark) 26%, transparent);
}

.inv-hero .inv-kicker {
  color: color-mix(in srgb, var(--av-text-on-dark) 50%, transparent);
}

.inv-hero__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Valeur géante : entier en grand, décimales et devise réduites. */
.inv-hero__value {
  margin-top: 14px;
  font-family: var(--av-font-display);
  font-size: clamp(40px, 11vw, 56px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.inv-hero__value.is-long {
  font-size: clamp(32px, 8.6vw, 46px);
}

.inv-hero__dec {
  font-size: 0.54em;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--av-text-on-dark) 55%, transparent);
}

.inv-hero__cur {
  margin-left: 10px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--av-text-on-dark) 55%, transparent);
}

.inv-hero__gain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 18px;
  font-family: var(--av-font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--av-positive-on-dark);
}

.inv-hero__gain.is-down {
  color: color-mix(in srgb, var(--av-negative) 78%, var(--av-text-on-dark));
}

.inv-hero__gain.is-flat {
  color: var(--av-text-on-dark-secondary);
}

/* Pastille % sur fond sombre. */
.inv-pill-dark {
  padding: 3px 9px;
  border-radius: var(--av-radius-pill);
  font-family: var(--av-font);
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--av-positive-on-dark) 13%, transparent);
  color: var(--av-positive-on-dark);
}

.inv-hero__gain.is-down .inv-pill-dark {
  background: color-mix(in srgb, var(--av-negative) 18%, transparent);
  color: inherit;
}

.inv-hero__gain.is-flat .inv-pill-dark {
  background: color-mix(in srgb, var(--av-text-on-dark) 10%, transparent);
  color: inherit;
}

.inv-hero__gainlbl {
  margin-top: 5px;
  margin-bottom: 24px;
  font-size: 12.5px;
  color: var(--av-text-on-dark-secondary);
}

.inv-hero__gainlbl--none {
  margin-top: 18px;
  max-width: 34ch;
}

/* Capital versé | rendement, séparés par un filet. */
.inv-hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--av-border-on-dark);
}

.inv-hero__stats > div {
  min-width: 0;
}

.inv-hero__stats > div + div {
  padding-left: 16px;
  border-left: 1px solid var(--av-border-on-dark);
}

.inv-hero__stat {
  margin-top: 6px;
  font-family: var(--av-font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.inv-hero__stat small {
  margin-left: 1px;
  font-size: 13px;
  font-weight: 500;
  color: color-mix(in srgb, var(--av-text-on-dark) 55%, transparent);
}

.inv-hero__stat.is-up {
  color: var(--av-positive-on-dark);
}

.inv-hero__stat.is-down {
  color: color-mix(in srgb, var(--av-negative) 78%, var(--av-text-on-dark));
}

/* TRI estimé (date initiale déduite) : « ≈ » + infobulle. */
.inv-irr--est {
  cursor: help;
  white-space: nowrap;
}

.inv-hero__hint {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--av-text-on-dark) 48%, transparent);
}

/* Colonne graphique : légende + canvas (hauteur fixe : Chart.js responsive). */
.inv-hero__chart {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.inv-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 12px;
  color: var(--av-text-on-dark-secondary);
}

.inv-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.inv-legend i {
  display: inline-block;
  flex: none;
}

.inv-legend__val {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--av-text-on-dark);
}

.inv-legend__cap {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--av-text-on-dark) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av-text-on-dark) 30%, transparent);
}

.inv-legend__gain {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--av-positive-on-dark) 42%, transparent);
}

.inv-legend__since {
  margin-left: auto;
  color: color-mix(in srgb, var(--av-text-on-dark) 42%, transparent);
}

.inv-hero__canvas {
  position: relative;
  height: 200px;
  margin-top: 14px;
}

.inv-hero__canvas canvas {
  display: block;
  max-width: 100%;
}

.inv-hero__fallback {
  color: var(--av-text-on-dark-secondary);
}

/* Note de périmètre sous la courbe (positions sans prix de revient écartées). */
.inv-hero__scope {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--av-text-on-dark) 42%, transparent);
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .inv-hero {
    padding: 30px 32px 28px;
  }

  .inv-hero__stats > div + div {
    padding-left: 24px;
  }

  .inv-hero__stat {
    font-size: 19px;
  }

  .inv-hero__canvas {
    height: 220px;
  }
}

@media (min-width: 900px) {
  .inv-hero {
    grid-template-columns: minmax(300px, 372px) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 52px);
    padding: 32px 36px 30px;
  }

  .inv-hero__canvas {
    height: 236px;
  }
}

/* =========================================================================
   2. POSITIONS — grille de tuiles
   1 colonne < 720 px ; 2 colonnes jusqu'à 1079 px ; puis grille de 6 pistes :
   les 2 premières tuiles (« lead ») en occupent 3, les suivantes 2 (3 par
   ligne). La dernière ligne incomplète est équilibrée par les classes posées
   en JS (row1 = pleine largeur, row2 = moitié) ; solo = tuile unique.
   ========================================================================= */

.inv-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

@media (min-width: 720px) {
  .inv-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .inv-tile--odd,
  .inv-tile--solo {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1080px) {
  .inv-tiles {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .inv-tile {
    grid-column: span 2;
  }

  .inv-tile--lead,
  .inv-tile--row2 {
    grid-column: span 3;
  }

  .inv-tile--row1,
  .inv-tile--solo {
    grid-column: 1 / -1;
  }
}

/* Tuile : carte blanche cliquable ; conteneur de requêtes (largeur propre). */
.inv-tile {
  container: inv-tile / inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 20px 20px;
  border-radius: var(--av-radius-lg);
  background: var(--av-surface);
  box-shadow:
    var(--av-shadow-sm),
    0 10px 28px color-mix(in srgb, var(--av-text) 5%, transparent);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.inv-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--av-shadow-sm),
    0 16px 36px color-mix(in srgb, var(--av-text) 9%, transparent);
}

.inv-tile:focus-visible {
  outline: none;
  box-shadow:
    var(--av-focus-ring),
    0 10px 28px color-mix(in srgb, var(--av-text) 5%, transparent);
}

.inv-tile:active {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .inv-tile {
    padding: 24px 24px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inv-tile {
    transition: none;
  }

  .inv-tile:hover {
    transform: none;
  }
}

.inv-tile__head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

/* Pastille code (.acode globale) agrandie ; teinte du type posée en JS. */
.acode.inv-token {
  justify-content: center;
  flex: none;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  border-radius: 13px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.inv-tile__id {
  min-width: 0;
}

.inv-tile__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
}

.inv-tile__sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--av-text-tertiary);
  overflow-wrap: anywhere;
}

.inv-tile__value {
  margin-top: 24px;
  font-family: var(--av-font-display);
  font-size: 29px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.inv-tile__value span {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--av-text-tertiary);
}

.inv-tile__gain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--av-positive);
}

.inv-tile__gain.is-down {
  color: var(--av-negative);
}

.inv-tile__gain.is-flat {
  color: var(--av-text-secondary);
}

.inv-tile__gain.is-none {
  font-weight: 500;
  color: var(--av-text-tertiary);
}

/* Pastille % claire. */
.inv-pct {
  padding: 2px 8px;
  border-radius: var(--av-radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--av-positive-soft);
  color: var(--av-positive);
}

.inv-pct.is-down {
  background: var(--av-negative-soft);
  color: var(--av-negative);
}

.inv-pct.is-flat {
  background: var(--av-surface-2);
  color: var(--av-text-secondary);
}

.inv-tile__chart {
  margin-top: 20px;
}

.inv-tile__axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--av-text-tertiary);
}

/* Pied : poussé en bas pour aligner les indicateurs d'une même rangée. */
.inv-tile__foot {
  margin-top: auto;
  padding-top: 18px;
}

.inv-tile__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding-top: 16px;
  border-top: 1px solid var(--av-border);
}

.inv-tile__stats > div {
  min-width: 0;
}

.inv-tile__stats dt {
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--av-text-tertiary);
}

.inv-tile__stats dd {
  margin-top: 4px;
  font-family: var(--av-font-display);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}

.inv-tile__stats dd small {
  margin-left: 6px;
  font-family: var(--av-font);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--av-text-tertiary);
}

.inv-tile__stats dd.is-up {
  color: var(--av-positive);
}

.inv-tile__stats dd.is-down {
  color: var(--av-negative);
}

.inv-tile__stats dd.is-none {
  font-weight: 500;
  color: var(--av-text-tertiary);
}

/* Tuile large : les 4 indicateurs sur une ligne. */
@container inv-tile (min-width: 500px) {
  .inv-tile__stats {
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
  }
}

/* Tuile étroite (téléphone) : chiffres un peu plus petits, retour à la ligne permis. */
@container inv-tile (max-width: 310px) {
  .inv-tile__stats dd {
    font-size: 13.5px;
    white-space: normal;
  }
}

@container inv-tile (max-width: 290px) {
  .inv-tile__value {
    font-size: 25px;
  }
}

.inv-tile__value.is-long {
  font-size: 25px;
}

/* -------------------------------------------------------------------------
   Mini-graphique SVG versé / valeur (classes posées par sparkSvg)
   ------------------------------------------------------------------------- */

.inv-spark {
  display: block;
  width: 100%;
  height: 72px;
  overflow: visible;
}

.inv-spark--wide {
  height: 92px;
}

.inv-spark__cap,
.inv-spark__area {
  fill: var(--av-surface-2);
}

.inv-spark__g0 {
  stop-color: var(--av-positive);
  stop-opacity: 0.3;
}

.inv-spark__g1 {
  stop-color: var(--av-positive);
  stop-opacity: 0.1;
}

.inv-spark__loss {
  fill: var(--av-negative);
  fill-opacity: 0.16;
}

.inv-spark__axis {
  fill: none;
  stroke: var(--av-border);
  stroke-width: 1;
}

.inv-spark__capline {
  fill: none;
  stroke: var(--av-border-strong);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.inv-spark__line {
  fill: none;
  stroke: var(--av-text);
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Point final : tracé de longueur nulle à extrémité ronde (disque net). */
.inv-spark__ring {
  fill: none;
  stroke: var(--av-surface);
  stroke-width: 9;
  stroke-linecap: round;
}

.inv-spark__dot {
  fill: none;
  stroke: var(--av-text);
  stroke-width: 6;
  stroke-linecap: round;
}

/* Valeur actuelle sous le capital versé : point final rouge (la zone de
   moins-value est déjà rouge ; le trait reste à l'encre pour ne pas contredire
   les périodes passées en plus-value). */
.inv-spark.is-down .inv-spark__dot {
  stroke: var(--av-negative);
}

/* =========================================================================
   3. PLAN D'ÉPARGNE — bande à 3 colonnes séparées par des filets
   Empilé < 720 px. Variantes selon les colonnes présentes (classe posée en
   JS) : m = chaque mois, s = répartition, f = frais.
   ========================================================================= */

.inv-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.inv-plan__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 20px;
}

.inv-plan__col + .inv-plan__col {
  border-top: 1px solid var(--av-border);
}

@media (min-width: 720px) {
  .inv-plan {
    padding: 28px 0;
  }

  .inv-plan__col {
    padding: 0 30px;
  }

  .inv-plan__col + .inv-plan__col {
    border-top: 0;
    border-left: 1px solid var(--av-border);
  }

  .inv-plan--ms {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .inv-plan--mf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Trois colonnes en tablette : chaque mois | frais, puis répartition dessous. */
  .inv-plan--msf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "month fees"
      "split split";
  }

  .inv-plan--msf .inv-plan__col--month {
    grid-area: month;
  }

  .inv-plan--msf .inv-plan__col--fees {
    grid-area: fees;
  }

  .inv-plan--msf .inv-plan__col--split {
    grid-area: split;
    margin-top: 26px;
    padding-top: 24px;
    border-left: 0;
    border-top: 1px solid var(--av-border);
  }
}

@media (min-width: 1100px) {
  .inv-plan {
    padding: 30px 0;
  }

  .inv-plan__col {
    padding: 0 34px;
  }

  .inv-plan--ms {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .inv-plan--msf {
    grid-template-columns: 300px minmax(0, 1fr) 280px;
    grid-template-areas: "month split fees";
  }

  .inv-plan--msf .inv-plan__col--split {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    border-left: 1px solid var(--av-border);
  }
}

/* Colonne « Chaque mois ». */
.inv-plan__amount {
  margin-top: 12px;
  font-family: var(--av-font-display);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.inv-plan__amount span {
  margin-left: 7px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--av-text-tertiary);
}

.inv-plan__sub {
  margin-top: 10px;
  font-size: 13px;
  color: var(--av-text-secondary);
}

.inv-plan__year {
  margin-top: auto;
  padding-top: 22px;
}

.inv-progress {
  height: 5px;
  overflow: hidden;
  border-radius: var(--av-radius-pill);
  background: var(--av-surface-3);
}

.inv-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: var(--av-radius-pill);
  background: var(--av-text);
}

.inv-plan__year p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--av-text-tertiary);
}

.inv-plan__year b {
  font-family: var(--av-font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--av-text);
  white-space: nowrap;
}

/* Colonne « Répartition des versements » : barre segmentée + liste. */
.inv-bar {
  display: flex;
  gap: 3px;
  height: 10px;
  margin-top: 14px;
}

.inv-bar > span {
  min-width: 4px;
  border-radius: 3px;
}

.inv-bar > span:first-child {
  border-radius: var(--av-radius-pill) 3px 3px var(--av-radius-pill);
}

.inv-bar > span:last-child {
  border-radius: 3px var(--av-radius-pill) var(--av-radius-pill) 3px;
}

.inv-bar > span:only-child {
  border-radius: var(--av-radius-pill);
}

.inv-split {
  margin-top: 16px;
  list-style: none;
}

.inv-split li {
  display: grid;
  grid-template-columns: 12px 40px minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  font-size: 13px;
}

.inv-split li + li {
  border-top: 1px solid var(--av-border);
}

.inv-split__sw {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.inv-split__code {
  font-family: var(--av-font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--av-text-secondary);
}

.inv-split__nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--av-text-secondary);
}

.inv-split b {
  font-family: var(--av-font-display);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.inv-split i {
  font-size: 12.5px;
  font-style: normal;
  text-align: right;
  white-space: nowrap;
  color: var(--av-text-tertiary);
}

@media (max-width: 420px) {
  .inv-split li {
    grid-template-columns: 10px 32px minmax(0, 1fr) auto 34px;
    gap: 8px;
  }
}

/* Colonne « Frais estimés ». */
.inv-fees__v {
  margin-top: 12px;
  font-family: var(--av-font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.inv-fees__v small {
  margin-left: 2px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--av-text-tertiary);
}

.inv-fees__s {
  margin-top: 4px;
  font-size: 12px;
  color: var(--av-text-tertiary);
}

.inv-fees {
  margin-top: auto;
  padding-top: 14px;
  list-style: none;
}

.inv-fees li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--av-border);
  font-size: 12.5px;
  white-space: nowrap;
  color: var(--av-text-secondary);
}

.inv-fees li em {
  margin-left: 6px;
  font-style: normal;
  color: var(--av-text-tertiary);
}

.inv-fees li b {
  font-family: var(--av-font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--av-text);
}

/* Aucun versement ni TER : invitation discrète. */
.inv-plan-empty {
  padding: 20px 24px;
  font-size: 13px;
  color: var(--av-text-secondary);
}

/* =========================================================================
   4. PROJECTION — graphique | panneau (sélecteur d'horizon + chiffres)
   ========================================================================= */

.inv-proj {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.inv-proj__chart {
  min-width: 0;
  padding: 22px 20px 10px;
}

.inv-proj__lede {
  font-size: 13px;
  color: var(--av-text-secondary);
}

.inv-proj__canvas {
  position: relative;
  height: 240px;
  margin-top: 14px;
}

.inv-proj__canvas canvas {
  display: block;
  max-width: 100%;
}

.inv-proj__side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 20px 22px;
  border-top: 1px solid var(--av-border);
}

@media (min-width: 640px) {
  .inv-proj__canvas {
    height: 300px;
  }
}

@media (min-width: 900px) {
  .inv-proj {
    grid-template-columns: minmax(0, 1fr) 300px;
    padding: 30px 0;
  }

  .inv-proj__chart {
    padding: 0 32px 0 34px;
  }

  .inv-proj__canvas {
    height: 346px;
  }

  .inv-proj__side {
    padding: 0 34px 0 32px;
    border-top: 0;
    border-left: 1px solid var(--av-border);
  }
}

/* Écran large : panneau un peu plus large pour qu'un montant complet (horizon
   10 ans, sous le million) tienne sur la ligne de son libellé. */
@media (min-width: 1100px) {
  .inv-proj {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

/* Sélecteur segmenté 10 / 20 / 30 ans. */
.inv-seg {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--av-surface-2);
}

.inv-seg__btn {
  flex: 1;
  min-height: 34px;
  padding: 7px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  color: var(--av-text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.inv-seg__btn:hover {
  color: var(--av-text);
}

.inv-seg__btn.is-on {
  background: var(--av-surface);
  color: var(--av-text);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--av-text) 8%, transparent),
    0 2px 6px color-mix(in srgb, var(--av-text) 6%, transparent);
}

.inv-seg__btn:focus-visible {
  outline: none;
  box-shadow: var(--av-focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  .inv-seg__btn {
    transition: none;
  }
}

.inv-proj__figs {
  display: flex;
  flex-direction: column;
}

.inv-proj__kicker {
  margin-top: 26px;
}

.inv-proj__big {
  margin-top: 10px;
  font-family: var(--av-font-display);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.inv-proj__big.is-long {
  font-size: 30px;
}

.inv-proj__big.is-xlong {
  font-size: 25px;
}

.inv-proj__big span {
  margin-left: 8px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--av-text-tertiary);
}

.inv-proj__bigsub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--av-text-secondary);
}

.inv-rows {
  margin-top: 20px;
  border-top: 1px solid var(--av-border);
  list-style: none;
}

.inv-rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--av-border);
  font-size: 13px;
  color: var(--av-text-secondary);
}

.inv-rows li > span {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.inv-rows b {
  margin-left: auto;
  font-family: var(--av-font-display);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--av-text);
}

/* Échantillons de trait (légende des lignes de la projection). */
.inv-ln {
  flex: none;
  width: 14px;
  height: 0;
  border-top: 2px solid var(--av-text);
}

.inv-ln--thin {
  border-top: 1.5px solid color-mix(in srgb, var(--av-text) 32%, transparent);
}

.inv-ln--dash {
  border-top: 1.5px dashed var(--av-text-tertiary);
}

.inv-proj__note {
  margin-top: auto;
  padding-top: 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--av-text-tertiary);
}

/* =========================================================================
   5. État vide (composants partagés .card .empty, app.css)
   ========================================================================= */

.inv-empty .empty__text {
  max-width: 52ch;
}
