*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;background:#f5f7fb;color:#172033}.shell{display:flex;min-height:100vh}.side{position:fixed;inset:0 auto 0 0;width:220px;background:#102235;color:#dce7f4;padding:20px 14px;z-index:10}.brand{font-weight:800;padding:7px 10px 25px}.brand i{color:#1da1ff;font-style:normal}.side a{display:block;color:#b9c7d7;text-decoration:none;padding:11px;border-radius:7px;font-size:14px;margin:3px 0}.side a:hover{background:#1d3b59;color:#fff}.main{margin-left:220px;width:calc(100% - 220px);padding:28px 32px}.top{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.top h1{margin:0;font-size:24px}.top p{margin:4px 0;color:#718094;font-size:13px}.menu{display:none}.card{background:#fff;border:1px solid #e2e7ee;border-radius:10px;box-shadow:0 2px 10px #15263d0a}.section{padding:18px;margin-bottom:15px}.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:15px}.kpi{padding:16px}.kpi span,.kpi small{display:block;color:#788598;font-size:12px}.kpi strong{display:block;font-size:23px;margin:7px 0}.pos{color:#078956!important}.neg{color:#d94343!important}.grid{display:grid;grid-template-columns:1.7fr 1fr;gap:15px}.chart{padding:17px;min-width:0;overflow:hidden}
.chart-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap;margin-bottom:12px}
.chart-head h2{margin:0;font-size:18px}
.chart-head p{margin:5px 0 0;color:#788598;font-size:12px}
.chart-legend{display:flex;align-items:center;gap:16px;flex-wrap:wrap;font-size:12px;color:#526174}
.chart-legend span{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.legend-line{display:inline-block;width:24px;height:0;border-top:3px solid;flex:0 0 auto}
.legend-line.portfolio{border-color:#246fe0}
.legend-line.cac{border-color:#e39a26}
.chart-scroll{width:100%;overflow-x:auto;overflow-y:hidden}
.chart svg.performance-chart{display:block;width:100%;min-width:620px;height:auto;aspect-ratio:1000/390;overflow:visible}
.line{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.line.p{stroke:#246fe0}
.line.c{stroke:#e39a26}
.point.p-point{fill:#246fe0}
.point.c-point{fill:#e39a26}
.value-label{font-size:11px;fill:#172033}
.portfolio-label{fill:#246fe0}
.cac-label{fill:#b87512}
.date-label{font-size:11px;fill:#66758a}
.g{stroke:#e8edf2;stroke-width:1}.table{overflow:auto}.table table{width:100%;border-collapse:collapse;font-size:13px}.table th,.table td{padding:12px 14px;text-align:left;border-bottom:1px solid #edf0f4;white-space:nowrap}.table th{color:#788598;background:#fafbfd}.form{max-width:900px}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.form label{display:block;color:#687689;font-size:12px}.form input,.form select,.form textarea{width:100%;margin-top:6px;padding:10px;border:1px solid #d7dee8;border-radius:6px;background:#fff;font:inherit}.form textarea{min-height:100px}.btn{border:0;border-radius:7px;padding:10px 14px;font-weight:700;text-decoration:none;display:inline-block;cursor:pointer;font-size:13px}.primary{background:#159e69;color:#fff}.danger{background:#fff;color:#c33b3b;border:1px solid #efbaba}.actions{display:flex;justify-content:flex-end;gap:9px}.decision{border:1px solid #e6eaf0;border-radius:8px;padding:13px;margin:10px 0}.decision-head{display:flex;justify-content:space-between}.tag{font-size:11px;font-weight:800;padding:4px 7px;border-radius:5px}.buy{background:#e7f8f0;color:#078956}.sell{background:#fff0f0;color:#c43b3b}.hold{background:#fff7df;color:#a77400}.badge{display:inline-block;border-radius:20px;padding:6px 10px;font-size:12px;background:#e7f8f0;color:#078956}.muted{color:#8994a3}.status{display:grid;gap:0}.status div{display:grid;grid-template-columns:20px 1fr auto;padding:13px 0;border-bottom:1px solid #edf0f4}.statgrid{display:grid;grid-template-columns:repeat(6,1fr);gap:10px}.stat{text-align:center;padding:16px}.stat b{display:block;font-size:20px}.stat span{font-size:11px;color:#7b8797}.login{min-height:100vh;display:grid;place-items:center}.loginbox{width:min(420px,calc(100% - 30px));padding:25px}.loginbox input{width:100%;padding:10px;margin:7px 0 15px;border:1px solid #d7dee8;border-radius:6px}@media(max-width:900px){.side{transform:translateX(-100%)}.nav-open .side{transform:translateX(0)}.main{margin-left:0;width:100%;padding:15px}.menu{display:inline-block;border:0;background:#fff;font-size:21px}.kpis{grid-template-columns:1fr 1fr}.grid{grid-template-columns:1fr}.statgrid{grid-template-columns:repeat(2,1fr)}}@media(max-width:560px){.kpis,.formgrid{grid-template-columns:1fr}.top{align-items:flex-start}.actions{flex-wrap:wrap}}

/* V2.6 — positions et valorisation */
.stock-code{display:block;font-size:11px;margin-top:2px}
.position-master{cursor:pointer}
.position-master:hover{background:#fafbfd}
.position-master.is-open{background:#f7f9fc}
.expand-icon{display:inline-grid;place-items:center;width:22px;height:22px;margin-right:7px;border:1px solid #d7dee8;border-radius:50%;font-weight:800;color:#516174}
.position-history-row{display:none!important}
.position-history-row.is-open{display:table-row!important}
.position-history{padding:14px 8px 18px 42px;background:#f8fafc;border-top:1px solid #e7ebf1}
.position-history h3{margin:0 0 10px;font-size:14px}
.position-history table{width:100%;border-collapse:collapse;font-size:12px}
.position-history th,.position-history td{padding:9px 10px;text-align:left;border-bottom:1px solid #e7ebf1;white-space:nowrap}
.position-history th{color:#788598;background:#f1f4f8}
.quote-source{display:block;font-size:10px;color:#8994a3;margin-top:2px}
.quote-source.live{color:#078956}
.positions-table th,.positions-table td{vertical-align:middle}
.live-market-note{margin:0 0 15px;font-size:12px}
.live-market-warning{color:#a77400}
@media(max-width:1100px){.positions-table{min-width:1050px}.positions-table-wrap{overflow-x:auto}.position-history{padding-left:20px}}

/* Sélection des actions lors de la création d'une simulation */
.simulation-error{border-color:#efbaba;background:#fff7f7;color:#b52f2f}
.simulation-help{margin:5px 0 0;font-size:12px}
.simulation-help code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px}
.instrument-selector-head{display:flex;justify-content:space-between;align-items:center;gap:18px}
.instrument-open{background:#eef5ff;color:#245ea8;border:1px solid #cbdcf5}
.selected-summary{margin-top:16px;padding:14px;background:#f8fafc;border:1px solid #e6eaf0;border-radius:8px}
.selected-summary-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.selected-table-wrap{max-height:230px;overflow:auto;border:1px solid #e1e6ed;border-radius:7px;background:#fff}
.selected-table{width:100%;border-collapse:collapse;font-size:12px}
.selected-table th,.selected-table td{padding:8px 10px;text-align:left;border-bottom:1px solid #edf0f4}
.selected-table th{position:sticky;top:0;background:#f1f4f8;color:#66758a;font-size:11px;z-index:1}
.selected-table tr:last-child td{border-bottom:0}
.simulation-watchlist{margin:15px 0 18px;padding:14px;background:#f8fafc;border:1px solid #e6eaf0;border-radius:8px}

/* Sélecteur d'actions - structure isolée et hauteur stable */
.instrument-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:24px}
.instrument-modal[hidden]{display:none!important}
.instrument-modal-backdrop{position:absolute;inset:0;background:rgba(16,34,53,.62)}
.instrument-dialog{position:relative;width:min(920px,calc(100vw - 48px));height:min(760px,calc(100vh - 48px));max-height:calc(100vh - 48px);min-height:0;background:#fff;border:1px solid #dfe5ec;border-radius:12px;box-shadow:0 18px 60px rgba(15,31,48,.3);overflow:hidden;z-index:1}
.instrument-dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;padding:18px 22px;border-bottom:1px solid #e8ecf1;flex:0 0 auto}
.instrument-dialog-head h2{margin:0;font-size:19px}.instrument-dialog-head p{margin:5px 0 0;font-size:12px}
.instrument-close{border:0;background:transparent;color:#6f7d8e;font-size:28px;line-height:1;cursor:pointer;padding:0 4px}
.instrument-toolbar{display:flex;align-items:center;gap:10px;padding:12px 22px;border-bottom:1px solid #edf0f4;background:#fafbfd;flex:0 0 auto}
.instrument-toolbar input{flex:1;min-width:180px;padding:10px 12px;border:1px solid #d7dee8;border-radius:7px;font:inherit}
.instrument-toolbar-actions{display:flex;gap:7px;flex:0 0 auto}.instrument-toolbar-actions .btn{font-size:11px;padding:9px 10px;background:#fff;border:1px solid #d7dee8;color:#516174}
.instrument-modal-count{display:flex;justify-content:space-between;padding:10px 22px;font-size:12px;border-bottom:1px solid #edf0f4;flex:0 0 auto}
/* Hauteur explicite : le fait de cocher des lignes ne peut pas réduire cette zone. */
.instrument-list{position:absolute;left:0;right:0;top:151px;bottom:64px;height:auto!important;min-height:0!important;max-height:none!important;overflow-y:scroll;overflow-x:hidden;padding:0 22px 12px;overscroll-behavior:contain;background:#fff}
.instrument-table{width:100%;border-collapse:collapse;font-size:13px;table-layout:fixed}.instrument-table th:nth-child(1),.instrument-table td:nth-child(1){width:46px}.instrument-table th:nth-child(2),.instrument-table td:nth-child(2){width:120px}.instrument-table th:nth-child(4),.instrument-table td:nth-child(4){width:150px}
.instrument-table th,.instrument-table td{padding:10px;text-align:left;border-bottom:1px solid #edf0f4}.instrument-table th{position:sticky;top:0;background:#f1f4f8;color:#66758a;font-size:11px;z-index:2}.instrument-table tbody tr:hover{background:#f8fafc}.instrument-table tbody tr[hidden]{display:none}
.instrument-table .check-col{width:46px;text-align:center}.instrument-check-label{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.instrument-check-label input{position:absolute;opacity:0;width:1px;height:1px}.instrument-check{display:inline-block;width:18px;height:18px;border:1px solid #bcc7d5;border-radius:4px;background:#fff;position:relative}.instrument-check-label input:checked + .instrument-check{background:#159e69;border-color:#159e69}.instrument-check-label input:checked + .instrument-check:after{content:'✓';position:absolute;inset:0;display:grid;place-items:center;color:#fff;font-size:12px;font-weight:800}
.instrument-dialog-foot{position:absolute;left:0;right:0;bottom:0;height:64px;display:flex;justify-content:space-between;align-items:center;gap:15px;padding:13px 22px;border-top:1px solid #e8ecf1;background:#fafbfd}.instrument-dialog-foot > div{display:flex;gap:8px;flex:0 0 auto}.modal-open{overflow:hidden}
@media(max-width:800px){
    .instrument-modal{padding:10px}
    .instrument-dialog{height:calc(100vh - 20px);max-height:calc(100vh - 20px);min-height:0}
    .instrument-toolbar{align-items:stretch;flex-direction:column}
    .instrument-toolbar-actions{flex-wrap:wrap}
    .instrument-dialog-foot{align-items:flex-start;flex-direction:column}
}
@media(max-width:560px){
    .instrument-selector-head{align-items:flex-start;flex-direction:column}
    .instrument-dialog-head{padding:16px}
    .instrument-toolbar,.instrument-modal-count,.instrument-list,.instrument-dialog-foot{padding-left:16px;padding-right:16px}
    .instrument-table th,.instrument-table td{padding:8px 6px}
    .instrument-table th:nth-child(4),.instrument-table td:nth-child(4){display:none}
}

/* FINAL: modal list is pinned between header/count and footer; selection cannot collapse it. */
.instrument-dialog{position:relative!important;overflow:hidden!important}
.instrument-list{position:absolute!important;left:0!important;right:0!important;top:151px!important;bottom:64px!important;height:auto!important;min-height:0!important;max-height:none!important;overflow-y:scroll!important;overflow-x:hidden!important;display:block!important}
.instrument-dialog-foot{position:absolute!important;left:0!important;right:0!important;bottom:0!important;height:64px!important;min-height:64px!important;display:flex!important}
@media(max-width:560px){.instrument-list{top:211px!important;bottom:108px!important}.instrument-dialog-foot{height:108px!important;min-height:108px!important;align-items:flex-start!important;flex-direction:column!important}}


/* V2.6.3 — présentation positions et système */
.position-title{display:flex;align-items:baseline;gap:0;line-height:1.35;flex-wrap:wrap}
.position-title .stock-code{display:inline;font-size:12px;margin:0 0 0 4px}
.position-title .stock-code::before{content:'('}
.position-title .stock-code::after{content:')'}
.position-title .position-separator{margin-left:7px;color:#687689}
.position-title .position-qty{margin-left:2px}
.position-finance{display:flex;align-items:baseline;gap:10px;margin-top:5px}
.position-finance strong{font-size:14px}
.position-finance span{font-size:12px}
.position-main{min-width:0}
.status div{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:13px 0;border-bottom:1px solid #edf0f4}
.status div b{flex:0 0 130px}
.status div span{margin-left:auto;text-align:right;white-space:nowrap}
@media(max-width:560px){.status div{gap:12px}.status div b{flex-basis:100px}.status div span{white-space:normal;text-align:right}.position-finance{gap:8px;flex-wrap:wrap}}

/* V2.6.4 — séparateurs entre les positions */
.position-row{padding:11px 0;border-bottom:1px solid #e5e9ef}
.position-row:last-child{border-bottom:none}
