:root{--svg-ink:#091126;--svg-blue:#2864ed;--svg-cyan:#2fa6d8;--svg-gold:#f2b84b;--svg-bg:#f5f8fc;--svg-card:#fff;--svg-border:#dce6f2;--svg-muted:#63738a}
.svgraph-page{background:linear-gradient(180deg,#f7fbff 0,#eef4fb 100%);min-height:calc(100vh - 74px);padding:18px 18px 34px;color:var(--svg-ink)}
.svgraph-shell{max-width:1550px;margin:0 auto;display:grid;grid-template-columns:300px minmax(0,1fr) 310px;gap:14px;align-items:start}
.svgraph-panel,.svgraph-workspace{background:#fff;border:1px solid var(--svg-border);border-radius:22px;box-shadow:0 14px 38px rgba(17,49,92,.08)}
.svgraph-panel{padding:16px;position:sticky;top:88px;max-height:calc(100vh - 108px);overflow:auto}
.svgraph-workspace{overflow:hidden;min-height:720px}
.svgraph-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--svg-border);background:#fbfdff}
.svgraph-brand{display:flex;align-items:center;gap:12px}.svgraph-brand img{width:42px;height:42px}.svgraph-brand strong{display:block;font-size:1.08rem}.svgraph-brand small{color:var(--svg-muted)}
.svgraph-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.svgraph-btn{border:1px solid #c9d7ea;background:#fff;color:#17365f;border-radius:12px;padding:9px 12px;font-weight:750;cursor:pointer}.svgraph-btn:hover{border-color:#8fb0dc;background:#f7fbff}.svgraph-btn.primary{background:var(--svg-blue);color:#fff;border-color:var(--svg-blue)}.svgraph-btn.danger{color:#a62020;border-color:#efcaca}.svgraph-btn.icon{width:40px;height:40px;padding:0;display:grid;place-items:center}.svgraph-btn[disabled]{opacity:.45;cursor:not-allowed}
.svgraph-tabs{display:flex;gap:8px;padding:12px 14px 0}.svgraph-tab{border:0;background:#edf3fb;color:#39516e;border-radius:999px;padding:9px 14px;font-weight:800;cursor:pointer}.svgraph-tab.is-active{background:#17365f;color:#fff}
.svgraph-stage{padding:14px;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(360px,.85fr);gap:14px}.svgraph-calc,.svgraph-graph{border:1px solid var(--svg-border);border-radius:18px;background:#fff;overflow:hidden}.svgraph-calc{padding:14px}.svgraph-display{background:#102642;color:#fff;border-radius:16px;padding:14px;min-height:118px;display:flex;flex-direction:column;justify-content:flex-end;gap:8px}.svgraph-expression{font-size:1.14rem;word-break:break-all;color:#d9ecff;min-height:28px}.svgraph-result{font-size:2rem;font-weight:800;word-break:break-all}.svgraph-display-tools{display:flex;justify-content:space-between;align-items:center;font-size:.82rem;color:#a8c7e5}.svgraph-angle{border:1px solid rgba(255,255,255,.35);background:transparent;color:#fff;border-radius:999px;padding:5px 9px;cursor:pointer}
.svgraph-entry{display:flex;gap:8px;margin:12px 0}.svgraph-entry input{flex:1;min-width:0;border:1px solid #c9d7ea;border-radius:12px;padding:12px;font:600 1rem/1.2 ui-monospace,SFMono-Regular,Menlo,monospace}.svgraph-entry button{border:0;border-radius:12px;background:var(--svg-gold);color:#2e240d;padding:0 18px;font-weight:900;cursor:pointer}
.svgraph-keypad{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}.svgraph-key{min-height:44px;border:1px solid #d4dfed;border-radius:11px;background:#f8fbff;color:#17365f;font-weight:800;cursor:pointer}.svgraph-key:hover{background:#eef5ff}.svgraph-key.op{background:#eaf1ff;color:#1f55c3}.svgraph-key.fn{background:#f3f6fa;color:#44566c}.svgraph-key.accent{background:#17365f;color:#fff}.svgraph-key.wide{grid-column:span 2}
.svgraph-graph{position:relative;min-height:560px;background:#fff}.svgraph-graph canvas{width:100%;height:520px;display:block;touch-action:none}.svgraph-graph-toolbar{position:absolute;z-index:3;right:12px;top:12px;display:flex;gap:7px}.svgraph-trace{position:absolute;left:12px;top:12px;background:rgba(9,17,38,.88);color:#fff;padding:8px 10px;border-radius:10px;font:600 .82rem/1.3 ui-monospace,monospace;pointer-events:none;max-width:70%}.svgraph-function-list{padding:12px;border-top:1px solid var(--svg-border)}.svgraph-function-row{display:grid;grid-template-columns:20px 1fr 34px;gap:8px;align-items:center;margin:7px 0}.svgraph-function-row input[type=text]{width:100%;border:1px solid #cad8e8;border-radius:10px;padding:9px;font-family:ui-monospace,monospace}.svgraph-function-dot{width:12px;height:12px;border-radius:50%;display:block}.svgraph-function-row button{border:0;background:transparent;font-size:1.2rem;cursor:pointer;color:#6b7b90}.svgraph-add-function{width:100%;border:1px dashed #adc3df;border-radius:10px;background:#f8fbff;padding:9px;color:#285c98;font-weight:800;cursor:pointer}
.svgraph-table-wrap{padding:14px;border-top:1px solid var(--svg-border);display:none}.svgraph-table-wrap.is-open{display:block}.svgraph-table-controls{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}.svgraph-table-controls input{width:100px;border:1px solid #cad8e8;border-radius:9px;padding:8px}.svgraph-table{width:100%;border-collapse:collapse;font-size:.9rem}.svgraph-table th,.svgraph-table td{border-bottom:1px solid #edf1f6;padding:7px;text-align:right}.svgraph-table th:first-child,.svgraph-table td:first-child{text-align:left}
.svgraph-panel h2{font-size:1rem;margin:0 0 12px}.svgraph-history-list,.svgraph-saved-list,.svgraph-live-feed{display:flex;flex-direction:column;gap:8px}.svgraph-history-item,.svgraph-saved-item,.svgraph-feed-item{border:1px solid #e1e8f1;border-radius:12px;padding:10px;background:#fbfdff}.svgraph-history-item code{display:block;color:#17365f;white-space:normal;word-break:break-word}.svgraph-history-item strong{display:block;margin-top:4px}.svgraph-empty{color:var(--svg-muted);font-size:.9rem;padding:12px 0}.svgraph-saved-item{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center}.svgraph-saved-item button{border:0;background:transparent;cursor:pointer}.svgraph-panel-section+ .svgraph-panel-section{border-top:1px solid var(--svg-border);margin-top:16px;padding-top:16px}
.svgraph-live-box{background:#eef6ff;border:1px solid #cbdff7;border-radius:14px;padding:12px}.svgraph-live-code{font:900 1.35rem/1.1 ui-monospace,monospace;letter-spacing:.14em;color:#17365f}.svgraph-live-badge{display:inline-flex;border-radius:999px;background:#17365f;color:#fff;padding:5px 8px;font-size:.72rem;font-weight:800}.svgraph-live-participants{list-style:none;padding:0;margin:8px 0}.svgraph-live-participants li{display:flex;justify-content:space-between;gap:8px;padding:5px 0;border-bottom:1px solid #dbe8f6;font-size:.88rem}
.svgraph-modal[hidden]{display:none}.svgraph-modal{position:fixed;inset:0;z-index:10020;display:grid;place-items:center;padding:18px}.svgraph-modal::before{content:"";position:absolute;inset:0;background:rgba(9,17,38,.58);backdrop-filter:blur(3px)}.svgraph-dialog{position:relative;z-index:1;background:#fff;border-radius:22px;box-shadow:0 26px 80px rgba(0,0,0,.24);width:min(660px,100%);max-height:90vh;overflow:auto;padding:22px}.svgraph-dialog h2{margin-top:0}.svgraph-field{display:block;margin:12px 0}.svgraph-field span{display:block;font-weight:800;margin-bottom:6px}.svgraph-field input,.svgraph-field select{width:100%;border:1px solid #cbd8e8;border-radius:11px;padding:11px}.svgraph-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px;flex-wrap:wrap}.svgraph-qr{display:grid;place-items:center;background:#fff;padding:12px;border-radius:14px}.svgraph-qr svg{max-width:220px;width:100%;height:auto}
.svgraph-lock{position:absolute;inset:0;z-index:10;background:rgba(255,255,255,.96);display:none;align-items:center;justify-content:center;text-align:center;padding:40px}.svgraph-lock.is-active{display:flex}.svgraph-lock-card{max-width:520px}.svgraph-lock-card h2{font-size:1.4rem}.svgraph-lock-card p{color:#59697e}
.svgraph-toast{position:fixed;z-index:10030;left:50%;bottom:24px;transform:translateX(-50%);background:#102642;color:#fff;padding:11px 16px;border-radius:999px;box-shadow:0 10px 30px rgba(0,0,0,.2);font-weight:700;opacity:0;pointer-events:none;transition:.2s}.svgraph-toast.show{opacity:1}
.svgraph-dock{position:fixed;z-index:8800;right:18px;bottom:18px;width:min(390px,calc(100vw - 36px));background:#fff;border:1px solid #cad8e8;border-radius:18px;box-shadow:0 18px 50px rgba(17,49,92,.2);overflow:hidden}.svgraph-dock[hidden]{display:none}.svgraph-dock-head{display:flex;align-items:center;justify-content:space-between;background:#17365f;color:#fff;padding:9px 11px}.svgraph-dock-head strong{font-size:.9rem}.svgraph-dock-head button{border:0;background:transparent;color:#fff;font-size:1.1rem;cursor:pointer}.svgraph-dock-body{display:grid;grid-template-columns:1fr auto;gap:8px;padding:10px}.svgraph-dock input{min-width:0;border:1px solid #cad8e8;border-radius:10px;padding:9px}.svgraph-dock-eq{border:0;background:#f2b84b;border-radius:10px;padding:0 14px;font-weight:900}.svgraph-dock-result{padding:0 10px 10px;font:700 .9rem/1.3 ui-monospace,monospace;word-break:break-all}.svgraph-dock-foot{display:flex;justify-content:space-between;padding:0 10px 10px}.svgraph-dock-foot a,.svgraph-dock-foot button{font-size:.78rem;border:0;background:transparent;color:#2864ed;cursor:pointer;text-decoration:none}
@media(max-width:1180px){.svgraph-shell{grid-template-columns:240px minmax(0,1fr)}.svgraph-panel.right{grid-column:1/-1;position:static;max-height:none;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.svgraph-panel.right .svgraph-panel-section{border:0;margin:0;padding:0}.svgraph-stage{grid-template-columns:1fr}.svgraph-graph{min-height:500px}.svgraph-graph canvas{height:470px}}
@media(max-width:760px){.svgraph-page{padding:8px}.svgraph-shell{display:block}.svgraph-panel{position:static;max-height:none;margin-bottom:10px}.svgraph-panel.left{display:none}.svgraph-panel.right{display:block}.svgraph-workspace{min-height:0}.svgraph-topbar{align-items:flex-start;flex-direction:column}.svgraph-stage{padding:8px}.svgraph-keypad{grid-template-columns:repeat(5,1fr)}.svgraph-key{font-size:.8rem}.svgraph-graph canvas{height:410px}.svgraph-actions{width:100%;overflow:auto;flex-wrap:nowrap}.svgraph-btn{white-space:nowrap}.svgraph-result{font-size:1.55rem}}


/* V99.2 — vues exclusives et console live */
.svgraph-stage{display:block}
.svgraph-calc,.svgraph-graph{width:100%}
.svgraph-page[data-view="calculator"] .svgraph-graph{display:none}
.svgraph-page[data-view="graph"] .svgraph-calc,.svgraph-page[data-view="table"] .svgraph-calc{display:none}
.svgraph-page[data-view="graph"] .svgraph-table-wrap{display:none!important}
.svgraph-page[data-view="table"] .svgraph-graph-toolbar,.svgraph-page[data-view="table"] #svgraphCanvas,.svgraph-page[data-view="table"] .svgraph-function-list,.svgraph-page[data-view="table"] .svgraph-trace{display:none!important}
.svgraph-page[data-view="table"] .svgraph-graph{min-height:0}.svgraph-page[data-view="table"] .svgraph-table-wrap{display:block!important;border-top:0}
.svgraph-tabs button:disabled{opacity:.55;cursor:not-allowed}
.svgraph-live-panel-head,.svgraph-live-roster-title,.svgraph-feed-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.svgraph-live-count,.svgraph-live-roster-title small{display:inline-flex;align-items:center;border-radius:999px;background:#edf4ff;color:#234f82;padding:4px 8px;font-size:.75rem;font-weight:800}
.svgraph-live-actions{display:flex;gap:7px;flex-wrap:wrap}.svgraph-live-participants li>div{display:flex;flex-direction:column}.svgraph-live-participants time{font-size:.72rem;color:#7a899c;white-space:nowrap}.svgraph-feed-head small{color:#7a899c}.svgraph-feed-expression{margin-top:6px;font:700 .92rem/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;color:#17365f;word-break:break-word}

/* V99.4 — une session active ne modifie jamais la géométrie des vues outil. */
/* V99.3 — outil compact, grapheur latéral et vue Session dédiée */
@media (min-width: 981px){
  .svgraph-page{padding:12px 18px 24px;min-height:calc(100dvh - 74px)}
  .svgraph-shell{height:calc(100dvh - 98px);min-height:650px;max-height:820px;grid-template-columns:250px minmax(0,1fr) 230px;align-items:stretch}
  .svgraph-panel{position:static;max-height:none;height:100%;overflow:auto}
  .svgraph-workspace{height:100%;min-height:0;display:flex;flex-direction:column}
  .svgraph-stage{flex:1;min-height:0;overflow:hidden;padding:12px}
  .svgraph-page[data-view="calculator"] .svgraph-stage{display:grid;place-items:center}
  .svgraph-page[data-view="calculator"] .svgraph-calc{width:min(680px,100%);margin:auto;padding:12px}
  .svgraph-page[data-view="calculator"] .svgraph-display{min-height:102px}
  .svgraph-page[data-view="calculator"] .svgraph-key{min-height:40px}
  .svgraph-page[data-view="graph"] .svgraph-stage{display:block}
  .svgraph-page[data-view="graph"] .svgraph-graph{height:100%;min-height:0}
  .svgraph-graph-main{display:grid;grid-template-columns:270px minmax(0,1fr);height:100%;min-height:0}
  .svgraph-function-list{border-top:0;border-right:1px solid var(--svg-border);overflow:auto;padding:12px;background:#fbfdff}
  .svgraph-canvas-wrap{position:relative;min-width:0;min-height:0;height:100%}
  .svgraph-graph canvas{height:100%;min-height:0}
  .svgraph-page[data-view="table"] .svgraph-stage{overflow:auto}
  .svgraph-page[data-view="table"] .svgraph-graph{min-height:0}
  .svgraph-page[data-view="session"] .svgraph-shell{grid-template-columns:1fr;max-width:1320px}
    .svgraph-page[data-view="session"] .svgraph-workspace{grid-column:1}
  .svgraph-page[data-view="session"] .svgraph-stage{display:block;overflow:hidden}
}
.svgraph-page[data-view="session"] .svgraph-panel{display:none!important}
.svgraph-page[data-view="session"] .svgraph-shell{grid-template-columns:1fr;max-width:1320px}
.svgraph-page[data-view="session"] .svgraph-workspace{grid-column:1;width:100%}
.svgraph-page[data-view="session"] .svgraph-calc,
.svgraph-page[data-view="session"] .svgraph-graph{display:none!important}
.svgraph-session-tab[hidden]{display:none!important}
.svgraph-session-view{height:100%;box-sizing:border-box;overflow:hidden;display:flex;flex-direction:column;gap:12px}
.svgraph-session-view[hidden]{display:none!important}
.svgraph-session-hero{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:18px 20px;border:1px solid #d8e5f4;border-radius:18px;background:linear-gradient(135deg,#f6faff,#edf5ff)}
.svgraph-session-kicker{display:block;color:#2864ed;font-size:.72rem;font-weight:900;letter-spacing:.08em;text-transform:uppercase}.svgraph-session-hero h2{margin:4px 0 5px;font-size:1.45rem}.svgraph-session-hero p{margin:0;color:#607189}.svgraph-session-codebox{display:grid;grid-template-columns:auto auto;gap:4px 12px;align-items:center;text-align:right}.svgraph-session-codebox span{font-size:.72rem;color:#6c7c91;font-weight:800;text-transform:uppercase}.svgraph-session-codebox strong{font:900 1.25rem/1 ui-monospace,monospace;letter-spacing:.12em;color:#17365f}.svgraph-session-codebox .svgraph-btn{grid-column:1/-1;margin-top:5px}
.svgraph-session-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.svgraph-session-stats article{border:1px solid #dce6f2;border-radius:15px;background:#fff;padding:12px 15px;display:flex;align-items:center;justify-content:space-between}.svgraph-session-stats span{color:#68798f;font-size:.82rem;font-weight:700}.svgraph-session-stats strong{font-size:1.28rem;color:#17365f}
.svgraph-session-grid{display:grid;grid-template-columns:minmax(260px,.7fr) minmax(0,1.3fr);gap:12px;flex:1;min-height:0}.svgraph-session-card{border:1px solid #dce6f2;border-radius:18px;background:#fff;padding:14px;min-height:0;overflow:auto}.svgraph-session-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-bottom:10px;border-bottom:1px solid #edf2f7}.svgraph-session-card-head h3{margin:0;font-size:1rem}.svgraph-session-card-head small{color:#728298}.svgraph-session-results .svgraph-live-feed{padding-top:10px}.svgraph-session-actions{display:flex;justify-content:flex-end;gap:8px}.svgraph-session-view .svgraph-live-participants{margin:8px 0 0}.svgraph-session-view .svgraph-live-participants li{padding:9px 2px}
/* V99.4 — état live neutre : Calculatrice/Grapheur/Table gardent exactement leur layout normal. */
.svgraph-page[data-live-active="1"] .svgraph-workspace{min-height:0}
.svgraph-page[data-live-mode="demo"][data-live-role="participant"] .svgraph-topbar::after{content:"Démonstration en direct";display:inline-flex;align-items:center;border-radius:999px;background:#eaf2ff;color:#2157a6;padding:6px 10px;font-size:.75rem;font-weight:850;white-space:nowrap}
.svgraph-page[data-live-mode="demo"][data-live-role="participant"] .svgraph-actions{display:none}
@media(max-width:980px){
  .svgraph-graph-main{display:grid;grid-template-columns:220px minmax(0,1fr);min-height:440px}.svgraph-function-list{border-right:1px solid var(--svg-border);border-top:0;overflow:auto}.svgraph-canvas-wrap{position:relative;min-width:0}.svgraph-session-grid{grid-template-columns:1fr}.svgraph-session-view{height:auto;overflow:visible}.svgraph-session-card{max-height:42vh}}
@media(max-width:700px){.svgraph-graph-main{grid-template-columns:1fr}.svgraph-function-list{border-right:0;border-bottom:1px solid var(--svg-border);max-height:190px}.svgraph-canvas-wrap{min-height:420px}.svgraph-session-hero{align-items:flex-start;flex-direction:column}.svgraph-session-codebox{text-align:left}.svgraph-session-stats{grid-template-columns:1fr}.svgraph-session-card{max-height:none}.svgraph-session-view{overflow:visible}}

/* V99.5 — coque harmonisée, saisie live en cours et panneau historique */
.svgraph-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:8px}.svgraph-dialog-head h2{margin:0}.svgraph-dialog-close{width:38px;height:38px;border:1px solid #d6e1ee;border-radius:12px;background:#f8fbff;color:#17365f;font-size:1.45rem;line-height:1;cursor:pointer}.svgraph-dialog-close:hover{background:#eef5ff}
.svgraph-current-work{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px;padding-top:10px}.svgraph-current-item{border:1px solid #d9e5f2;border-radius:13px;background:#f8fbff;padding:10px 11px}.svgraph-current-expression{margin-top:7px;min-height:28px;font:800 .98rem/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;color:#17365f;word-break:break-word}.svgraph-history-head{margin-top:14px;padding-top:12px;border-top:1px solid #edf2f7}
@media (min-width:981px){
  .svgraph-page{padding:12px 18px 24px}
  .svgraph-shell{display:block;max-width:1320px;height:calc(100dvh - 98px);min-height:650px;max-height:840px;margin:0 auto}
  .svgraph-workspace{height:100%;display:flex;flex-direction:column;min-height:0}
  .svgraph-topbar{min-height:72px;padding:14px 18px;gap:18px}
  .svgraph-actions{justify-content:flex-end;gap:9px}
  .svgraph-tabs{padding:12px 18px 0;gap:9px}
  .svgraph-stage{flex:1;min-height:0;overflow:hidden;padding:12px 18px 16px}
  .svgraph-panel.right{display:none!important}
  .svgraph-panel.left{display:block;position:fixed;z-index:10010;top:86px;left:18px;width:min(340px,calc(100vw - 36px));height:calc(100dvh - 108px);max-height:none;overflow:auto;transform:translateX(calc(-100% - 30px));transition:transform .2s ease;box-shadow:0 24px 60px rgba(17,49,92,.18)}
  .svgraph-panel.left.is-open{transform:translateX(0)}
  .svgraph-page[data-view="calculator"] .svgraph-stage{display:grid;place-items:center}
  .svgraph-page[data-view="calculator"] .svgraph-calc{width:min(680px,100%);height:auto;max-height:100%;overflow:auto;margin:auto;padding:12px}
  .svgraph-page[data-view="graph"] .svgraph-graph{height:100%;min-height:0}
  .svgraph-page[data-view="graph"] .svgraph-graph-main{grid-template-columns:280px minmax(0,1fr);height:100%}
  .svgraph-page[data-view="table"] .svgraph-stage{overflow:auto}
  .svgraph-page[data-view="session"] .svgraph-shell{max-width:1320px;height:calc(100dvh - 98px)}
  .svgraph-page[data-view="session"] .svgraph-stage{overflow:hidden}
}
@media(max-width:980px){
  .svgraph-shell{display:block}.svgraph-panel.right{display:none!important}.svgraph-panel.left{display:none}.svgraph-panel.left.is-open{display:block;position:fixed;z-index:10010;inset:76px 10px 10px;width:auto;max-height:none;overflow:auto}
  .svgraph-topbar{gap:10px}.svgraph-actions{width:100%;overflow:auto;flex-wrap:nowrap;padding-bottom:2px}.svgraph-tabs{overflow:auto;white-space:nowrap;padding-bottom:4px}
}
.svgraph-page[data-view="session"] .svgraph-panel.left.is-open{display:block!important}
