/* === Page Portefeuille === */

/* Ruban de synthèse COMPACT (item 7) : ligne principale + bloc « Détails » repliable */
.exv-synth {
    background: var(--theme-bg-tertiaire);
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
    padding: 12px 16px;
    margin-bottom: 8px;
}
.exv-synth-main { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; }
.exv-synth-item { display: flex; flex-direction: column; gap: 2px; }
.exv-synth-k { font-size: var(--ht-texte-07); color: var(--theme-texte-tertiaire); text-transform: uppercase; letter-spacing: 0.03em; }
.exv-synth-v { font-family: 'Intertight', sans-serif; font-size: var(--ht-texte-115); font-weight: var(--wg-texte-semibold); }
.exv-synth-more {
    margin-left: auto; background: none; border: 1px solid var(--theme-border-color);
    border-radius: 999px; padding: 3px 13px; font-size: var(--ht-texte-08);
    color: var(--theme-texte-secondaire); cursor: pointer;
}
.exv-synth-more:hover { color: var(--theme-texte-primaire); border-color: var(--theme-border-color-hover); }
.exv-synth-details {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--theme-border-color);
}
.exv-synth-details[hidden] { display: none; } /* sinon display:flex écrase l'attribut [hidden] */
.exv-synth-details .exv-synth-v { font-size: var(--ht-texte-10); }
.exv-synth-asof { font-size: var(--ht-texte-07); color: var(--theme-texte-tertiaire); margin-left: auto; }

/* Contrôles de visibilité des sections (item 8) */
.exv-perf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 18px 0 8px; }
.exv-perf-sel-label { font-size: var(--ht-texte-08); color: var(--theme-texte-tertiaire); margin-left: auto; }

/* En-tête « Mon portefeuille » (moteur actif de l'utilisateur) */
.exv-mp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.exv-mp-engine-name { font-family: 'Intertight', sans-serif; font-size: var(--ht-texte-115); font-weight: var(--wg-texte-semibold); }
.exv-mp-engine-ref { font-size: var(--ht-texte-09); color: var(--theme-texte-tertiaire); }
.exv-mp-engine-link { margin-left: auto; font-size: var(--ht-texte-08); }

/* D — STYLES STRUCTURELS */
.exv-two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

/* (Le style .exv-checkbox est désormais GLOBAL — voir gbl_styles.css.) */

/* En-tête de graphique : titre + bouton engrenage Options (aligné à droite). */
.exv-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.exv-chart-head h3 { margin: 0; }
.exv-gear {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--theme-texte-tertiaire);
    font-size: 17px;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: var(--border-radius-classic);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.2s;
}
.exv-gear:hover { color: var(--theme-texte-primaire); background: var(--theme-bg-tertiaire); }
.exv-gear.active { color: var(--theme-button-cl-blue); transform: rotate(45deg); }

/* Panneau d'options dépliable (sous l'en-tête, masqué par défaut). */
.exv-chart-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: var(--theme-bg-tertiaire);
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
}
.exv-chart-options[hidden] { display: none; }

.exv-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}
.exv-segmented {
    display: inline-flex;
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
    overflow: hidden;
}
.exv-segmented button {
    background: var(--theme-bg-tertiaire);
    color: var(--theme-texte-secondaire);
    border: none;
    padding: 5px 16px;
    font-size: var(--ht-texte-08);
    font-weight: var(--wg-texte-medium);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.exv-segmented button.active {
    background: var(--theme-button-cl-blue);
    color: var(--cl-blanc-i1);
}

#table-positions tbody tr.active { background: var(--theme-bg-quaterniaire); }
#table-positions tbody tr.exv-row-closed { opacity: 0.6; }

.exv-lev-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 8px 0 14px;
}
.exv-lev-metrics .k { font-size: var(--ht-texte-07); color: var(--theme-texte-tertiaire); }
.exv-lev-metrics .v { font-size: var(--ht-texte-115); font-weight: var(--wg-texte-semibold); font-family: 'Intertight', sans-serif; }
.exv-num {
    width: 60px;
    padding: 3px 6px;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-bg-tertiaire);
    color: var(--theme-texte-primaire);
    border-radius: var(--border-radius-classic);
    font-size: var(--ht-texte-08);
}

/* === Ruban haut de page (switch Stratégie live / Affinages + infos contextuelles) === */
.exv-ribbon {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 18px;
    background: var(--theme-bg-tertiaire);
    border: 1px solid var(--theme-border-color);
    border-left: 3px solid var(--theme-button-cl-blue);
    border-radius: var(--border-radius-classic);
}
.exv-ribbon-engine {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    font-size: 20px;
    color: var(--theme-texte-secondaire);
    background: var(--theme-bg-tertiaire);
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.exv-ribbon-engine:hover { color: var(--theme-button-cl-blue); border-color: var(--theme-button-cl-blue); }

/* Hauteur commune fixe + bascule des éléments propres à chaque mode (les communs restent en place). */
.exv-ribbon { min-height: 58px; }
.exv-ribbon.mode-live .exv-mode-backfill,
.exv-ribbon.mode-live .exv-ribbon-select,
.exv-ribbon.mode-backfill .exv-mode-live { display: none; }
.exv-ribbon-select { flex: 0 0 auto; align-self: center; max-width: 300px; }

/* Slot Moteur (commun) + popup des composants au survol. */
.exv-ribbon-moteur { position: relative; }
.exv-moteur { cursor: help; border-bottom: 1px dashed var(--theme-texte-tertiaire); }
.exv-moteur-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    min-width: 210px;
    padding: 10px 12px;
    background: var(--theme-bg-tertiaire);
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.exv-ribbon-moteur:hover .exv-moteur-popup,
.exv-ribbon-moteur:focus-within .exv-moteur-popup { display: block; }
.exv-moteur-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; white-space: nowrap; }
.exv-moteur-icon { display: inline-flex; color: var(--theme-button-cl-blue); font-size: 15px; line-height: 1; }
.exv-ribbon-switch {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1px solid var(--theme-border-color);
    border-radius: var(--border-radius-classic);
    overflow: hidden;
}
.exv-ribbon-switch button {
    background: var(--theme-bg-secondaire);
    color: var(--theme-texte-secondaire);
    border: none;
    padding: 6px 16px;
    font-size: var(--ht-texte-08);
    font-weight: var(--wg-texte-medium);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.exv-ribbon-switch button.active {
    background: var(--theme-button-cl-blue);
    color: var(--cl-blanc-i1);
}
.exv-ribbon-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 22px;
    flex: 1 1 auto;
}
.exv-ribbon-panel[hidden] { display: none; }
.exv-ribbon-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.exv-ribbon-grow { flex: 1 1 220px; }
.exv-ribbon-label {
    font-size: var(--ht-texte-07);
    color: var(--theme-texte-tertiaire);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.exv-ribbon-val {
    font-size: var(--ht-texte-09);
    font-weight: var(--wg-texte-semibold);
    color: var(--theme-texte-primaire);
}
.exv-ribbon-ndx { color: var(--theme-texte-tertiaire); font-weight: var(--wg-texte-regular); }
.exv-ribbon-save {
    flex: 0 0 auto;
    margin-left: auto;
    background: var(--theme-button-cl-blue);
    color: var(--cl-blanc-i1);
    border: none;
    padding: 7px 14px;
    border-radius: var(--border-radius-classic);
    font-size: var(--ht-texte-08);
    font-weight: var(--wg-texte-medium);
    cursor: pointer;
    transition: opacity 0.15s;
}
.exv-ribbon-save:hover { opacity: 0.88; }
.exv-select {
    padding: 5px 8px;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-bg-secondaire);
    color: var(--theme-texte-primaire);
    border-radius: var(--border-radius-classic);
    font-size: var(--ht-texte-08);
    max-width: 100%;
}

/* Diagramme sectoriel (camembert/donut) + légende verticale. */
.exv-sectors-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr;
    gap: 20px;
    align-items: center;
}
.exv-pie-wrap { height: 240px; }
.exv-pie-wrap canvas { width: 100%; height: 100%; display: block; }
.exv-sectors-legend { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 700px) {
    .exv-sectors-row { grid-template-columns: 1fr; }
}
