/* Module Triphasé et facteur de puissance (préfixe tri-). Site en Bootstrap 3 : em/px uniquement, jamais rem. */
.tri-shell{--g:#1f4fa3;--g2:#3d7be0;--y:#f2c230;--ink:#14263a;--muted:#5d7385;--line:#dbe6ee;--soft:#f3f6fb;--ok:#178a57;--bad:#c2412f;--warn:#d98a00;--blue:#1d5fd1;--ph:#8a5a2b;max-width:1240px;margin:0 auto;padding:18px;color:var(--ink);font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-size:16px;line-height:1.55}
.tri-shell *{box-sizing:border-box}
.tri-shell h1,.tri-shell h2,.tri-shell h3,.tri-shell h4{font-family:inherit;color:inherit;line-height:1.2}
.tri-shell h2{font-size:1.55em;font-weight:800;margin:0 0 6px}
.tri-shell h3{font-size:1.18em;font-weight:800;margin:18px 0 8px}
.tri-shell p{margin:0 0 10px}
.tri-loading{padding:60px;text-align:center;color:var(--muted);font-weight:700}
.tri-alert{background:#fff0ee;color:#8a2a1c;border-radius:12px;padding:14px 16px}
.tri-muted{color:var(--muted)}
.tri-small{font-size:.88em}

/* Hero */
.tri-hero{position:relative;overflow:hidden;display:grid;grid-template-columns:1fr auto;gap:28px;align-items:center;padding:32px 38px;border-radius:26px;color:#fff;background:linear-gradient(125deg,#14143f 0%,#2f3fa0 55%,#e5a000 100%);box-shadow:0 18px 50px #1f4fa330}
.tri-hero:before{content:"";position:absolute;left:0;right:0;bottom:0;height:8px;background:repeating-linear-gradient(90deg,#f2c230 0 22px,#3d7be0 22px 44px)}
.tri-hero h1{font-size:2.6em;margin:6px 0 10px;font-weight:850;color:#fff}
.tri-hero p{font-size:1.06em;max-width:760px;opacity:.95;margin:0}
.tri-kicker{font-weight:800;text-transform:uppercase;letter-spacing:.08em;font-size:.8em;opacity:.95}
.tri-pills{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.tri-pills span{padding:6px 12px;border:1px solid #ffffff55;border-radius:999px;background:#ffffff1c;font-size:.9em;font-weight:700}
.tri-ring{position:relative;width:116px;height:116px;text-align:center}
.tri-ring svg{width:100%;height:100%;transform:rotate(-90deg)}
.tri-ring circle{fill:none;stroke-width:10}
.tri-ring .bg{stroke:#ffffff30}
.tri-ring .fg{stroke:#fff;stroke-linecap:round;stroke-dasharray:327;transition:stroke-dashoffset .6s ease}
.tri-ring b{position:absolute;left:0;right:0;top:40px;font-size:1.5em}
.tri-ring small{display:block;font-weight:700;opacity:.9;margin-top:4px}

/* Onglets */
.tri-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:20px 0 16px;position:sticky;top:0;z-index:5;background:#ffffffee;padding:8px 0;backdrop-filter:blur(4px)}
.tri-tab{display:flex;align-items:center;gap:8px;border:1px solid var(--line);background:#fff;border-radius:14px;padding:10px 14px;font-weight:750;font-size:.95em;color:var(--ink);cursor:pointer;transition:all .15s}
.tri-tab:hover{border-color:var(--g2)}
.tri-tab.on{background:var(--g);border-color:var(--g);color:#fff;box-shadow:0 8px 20px #1f4fa333}
.tri-tab .n{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#eef2fa;color:var(--g);font-size:.85em}
.tri-tab.on .n{background:#ffffff30;color:#fff}
.tri-tab.done .n{background:var(--ok);color:#fff}

/* Cartes / panneaux */
.tri-panel{background:#fff;border:1px solid var(--line);border-radius:20px;padding:22px 24px;margin-bottom:16px;box-shadow:0 6px 22px #14263a0a}
.tri-grid{display:grid;gap:14px}
.tri-g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.tri-g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.tri-g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.tri-card{border:1px solid var(--line);border-radius:16px;padding:14px 16px;background:var(--soft)}
.tri-card h4{margin:0 0 6px;font-size:1.05em;font-weight:800}
.tri-card p{margin:0;font-size:.94em}
.tri-def b{color:var(--g)}
.tri-letters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.tri-letter{border-radius:16px;padding:16px;background:#fff8e1;border:1px solid #f2dd8a}
.tri-letter big{font-size:2.2em;font-weight:900;color:var(--g);margin-right:8px}
.tri-letter ul{margin:6px 0 0;padding-left:20px}

/* Sélecteur de schéma */
.tri-seg{display:inline-flex;flex-wrap:wrap;gap:6px;background:#eef2fa;border-radius:14px;padding:5px}
.tri-seg button{border:0;background:transparent;padding:8px 14px;border-radius:10px;font-weight:800;color:var(--ink);cursor:pointer;font-size:.95em}
.tri-seg button.on{background:#fff;color:var(--g);box-shadow:0 2px 8px #0001}
.tri-seg button .ok{color:var(--ok);margin-left:4px}

/* Schéma SVG */
.tri-svgwrap{background:#fbfdfb;border:1px solid var(--line);border-radius:16px;padding:8px;margin:12px 0;overflow:hidden}
.tri-svg{width:100%;height:auto;display:block}
.tri-svg text{font-family:Inter,system-ui,sans-serif}
.tri-svg .lbl{font-size:13px;font-weight:700;fill:#14263a}
.tri-svg .sub{font-size:11px;fill:#5d7385}
.tri-svg .wl{font-size:12px;font-weight:800}
.tri-svg .w{fill:none;stroke-width:3}
.tri-svg .L1{stroke:#8a5a2b}.tri-svg .L2{stroke:#222}.tri-svg .L3{stroke:#8a8f94}
.tri-svg .N{stroke:#1d5fd1}
.tri-svg .PE{stroke:#3d7be0;stroke-dasharray:10 6}
.tri-svg .PEY{stroke:#f2c230;stroke-dasharray:10 6;stroke-dashoffset:10}
.tri-svg .PEN{stroke:#1d5fd1}
.tri-svg .PENY{stroke:#f2c230;stroke-dasharray:6 10;stroke-width:3;fill:none}
.tri-svg .earth{stroke:#5b4630;stroke-width:3;fill:none}
.tri-svg .ground{stroke:#a48a6a;stroke-width:2;stroke-dasharray:4 5;fill:none}
.tri-svg .box{fill:#fff;stroke:#14263a;stroke-width:2}
.tri-svg .tr{fill:#eef2fa;stroke:#14263a;stroke-width:2}
.tri-svg .masse{fill:#e7ecef;stroke:#5d7385;stroke-width:2.5}
.tri-svg .prot{fill:#fff8e1;stroke:#d98a00;stroke-width:2}
.tri-svg .prot.trip{fill:#e5f6ec;stroke:#178a57}
.tri-svg .cpi{fill:#e8f0ff;stroke:#1d5fd1;stroke-width:2}
.tri-svg .cpi.alarm{fill:#ffe9e4;stroke:#c2412f;animation:tri-blink 1s infinite}
.tri-svg .path{fill:none;stroke:#e5301f;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:14 12;opacity:.9;animation:tri-flow .8s linear infinite}
.tri-svg .path.weak{stroke-width:3;stroke-dasharray:4 10;opacity:.7}
.tri-svg .path.off{opacity:.18;animation:none}
.tri-svg .fault{font-size:22px}
.tri-svg .hsz{cursor:pointer}
.tri-svg .hsz:hover rect,.tri-svg .hsz:focus rect{stroke:#1f4fa3;stroke-width:3}
@keyframes tri-flow{to{stroke-dashoffset:-26}}
@keyframes tri-blink{50%{opacity:.45}}

.tri-legend{display:flex;flex-wrap:wrap;gap:14px;font-size:.85em;color:var(--muted);margin-top:4px}
.tri-legend i{display:inline-block;width:22px;height:4px;border-radius:2px;margin-right:6px;vertical-align:middle}

/* Fiche schéma */
.tri-fiche{display:grid;grid-template-columns:1.1fr .9fr;gap:16px;align-items:start}
.tri-list{margin:0;padding-left:20px}
.tri-list li{margin:3px 0}
.tri-pro b{color:var(--ok)}.tri-con b{color:var(--bad)}
.tri-tag{display:inline-block;padding:2px 10px;border-radius:999px;font-size:.8em;font-weight:800;background:#eef2fa;color:var(--g)}

/* Tableau comparatif */
.tri-table{width:100%;border-collapse:collapse;font-size:.93em}
.tri-table th,.tri-table td{border-bottom:1px solid var(--line);padding:9px 10px;text-align:left;vertical-align:top}
.tri-table th{background:#eef2fa;font-weight:800}
.tri-tablewrap{overflow-x:auto}

/* Formulaires */
.tri-ctrls{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px}
.tri-field{display:flex;flex-direction:column;gap:4px;font-size:.92em}
.tri-field label{font-weight:750;margin:0}
.tri-field output{font-weight:800;color:var(--g)}
.tri-field input[type=range]{width:100%}
.tri-field select,.tri-input{border:1px solid #c6d4dd;border-radius:10px;padding:7px 10px;font-size:1em;background:#fff;color:var(--ink);height:auto}
.tri-input{width:120px}
.tri-check{display:flex;align-items:center;gap:8px;font-weight:700;font-size:.92em;margin:0}
.tri-btn{display:inline-flex;align-items:center;gap:6px;border:0;border-radius:12px;padding:9px 16px;font-weight:800;font-size:.95em;cursor:pointer;background:var(--g);color:#fff;transition:filter .15s}
.tri-btn:hover{filter:brightness(1.08)}
.tri-btn.alt{background:#eef2fa;color:var(--g)}
.tri-btn.red{background:var(--bad)}
.tri-btn.blue{background:var(--blue)}
.tri-btn[disabled]{opacity:.45;cursor:not-allowed}
.tri-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}

/* Simulateur */
.tri-simgrid{display:grid;grid-template-columns:1.45fr 1fr;gap:16px;align-items:start}
.tri-meters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tri-meter{border-radius:14px;background:#14263a;color:#fff;padding:10px 12px}
.tri-meter small{display:block;opacity:.7;font-weight:700;font-size:.78em;text-transform:uppercase;letter-spacing:.05em}
.tri-meter b{font-family:"Consolas","Courier New",monospace;font-size:1.45em;color:#7dffb0}
.tri-meter.bad b{color:#ff8a78}
.tri-gauge{position:relative;height:16px;background:#e9eef1;border-radius:8px;margin:18px 0 6px;overflow:visible}
.tri-gauge .fill{height:100%;border-radius:8px;background:linear-gradient(90deg,#3d7be0,#f2c230 40%,#e5301f);transition:width .3s}
.tri-gauge .ul{position:absolute;top:-6px;bottom:-6px;width:3px;background:#14263a}
.tri-gauge .ul span{position:absolute;top:-18px;left:-14px;font-size:.75em;font-weight:800;white-space:nowrap}
.tri-verdict{border-radius:14px;padding:12px 14px;margin-top:12px;font-weight:650;font-size:.95em}
.tri-verdict.ok{background:#e5f6ec;color:#0f5c3a}
.tri-verdict.bad{background:#ffe9e4;color:#8a2a1c}
.tri-verdict.warn{background:#fff4dc;color:#7a4b00}
.tri-verdict.info{background:#e8f0ff;color:#183f82}
.tri-formula{font-family:"Consolas","Courier New",monospace;background:#f4f6f8;border-radius:10px;padding:8px 10px;font-size:.88em;margin-top:8px;white-space:pre-wrap;line-height:1.5}
.tri-missions{list-style:none;margin:0;padding:0}
.tri-missions li{display:flex;gap:10px;align-items:flex-start;padding:9px 0;border-bottom:1px dashed var(--line);font-size:.93em}
.tri-missions li:last-child{border-bottom:0}
.tri-missions .st{flex:0 0 26px;height:26px;border-radius:50%;display:grid;place-items:center;background:#eef1f3;color:var(--muted);font-weight:900;font-size:.85em}
.tri-missions li.done .st{background:var(--ok);color:#fff}

/* Essais */
.tri-lab{display:grid;grid-template-columns:1.3fr 1fr;gap:16px;align-items:start}
.tri-display{font-family:"Consolas","Courier New",monospace;background:#0f2a1c;color:#7dffb0;border-radius:12px;padding:12px 14px;font-size:1.5em;text-align:right;border:4px solid #2c3e50;min-height:62px}
.tri-display small{display:block;font-size:.5em;color:#a9d8bb;text-align:left}
.tri-instr{background:#f3c623;border-radius:18px;padding:14px;color:#14263a;box-shadow:inset 0 -6px 0 #d4a70f}
.tri-instr h4{margin:0 0 8px;font-weight:900;font-size:1em}
.tri-chart{width:100%;height:auto;background:#fff;border:1px solid var(--line);border-radius:12px}
.tri-feeders{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.tri-feeder{border:2px solid var(--line);border-radius:14px;padding:10px;text-align:center;background:#fff}
.tri-feeder.offd{background:#f2f2f2;opacity:.75}
.tri-feeder .ico{font-size:1.7em}
.tri-feeder h5{margin:6px 0;font-size:.85em;font-weight:800;min-height:2.4em}
.tri-switch{border:0;border-radius:999px;padding:5px 12px;font-weight:800;cursor:pointer;font-size:.82em}
.tri-switch.on{background:var(--ok);color:#fff}
.tri-switch.off{background:#c9d2d8;color:#14263a}
.tri-done-badge{display:inline-flex;align-items:center;gap:6px;background:#e5f6ec;color:#0f5c3a;border-radius:999px;padding:4px 12px;font-weight:800;font-size:.85em}

/* Exercices / quiz */
.tri-ex{border:1px solid var(--line);border-radius:16px;padding:14px 16px;margin-bottom:12px}
.tri-ex.ok{border-color:#9fd8b8;background:#f3f7fd}
.tri-ex.ko{border-color:#f0b4a8;background:#fff8f6}
.tri-ex h4{margin:0 0 6px;font-weight:800;font-size:1em}
.tri-ex .data{background:#f4f6f8;border-radius:10px;padding:8px 10px;font-size:.92em;margin:6px 0 10px}
.tri-ex .fb{margin-top:8px;font-size:.92em}
.tri-q{border:1px solid var(--line);border-radius:16px;padding:14px 16px;margin-bottom:12px}
.tri-q p{font-weight:750}
.tri-opt{display:block;width:100%;text-align:left;border:1px solid #cdd9e1;background:#fff;border-radius:10px;padding:8px 12px;margin:6px 0;cursor:pointer;font-size:.95em;color:var(--ink)}
.tri-opt:hover{border-color:var(--g2)}
.tri-opt.sel{border-color:var(--g);background:#eaf1fc;font-weight:700}
.tri-opt.good{border-color:var(--ok);background:#e5f6ec}
.tri-opt.wrong{border-color:var(--bad);background:#ffe9e4}
.tri-score{font-size:2.4em;font-weight:900}

/* Exercice d'identification */
.tri-idgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.tri-idcard{border:1px solid var(--line);border-radius:14px;padding:12px;background:#fff}
.tri-idcard p{font-size:.92em;min-height:4.4em}
.tri-idcard .tri-seg{display:flex}
.tri-idcard.ok{border-color:#9fd8b8;background:#f3f7fd}
.tri-idcard.ko{border-color:#f0b4a8;background:#fff8f6}

/* Toasts */
.tri-toasts{position:fixed;right:18px;bottom:18px;z-index:9999;display:flex;flex-direction:column;gap:8px}
.tri-toast{background:#14263a;color:#fff;padding:10px 16px;border-radius:12px;font-weight:700;box-shadow:0 10px 30px #0003;font-size:15px;transition:opacity .4s,transform .4s}
.tri-toast.ok{background:#178a57}
.tri-toast.out{opacity:0;transform:translateY(8px)}

@media (max-width:980px){
  .tri-simgrid,.tri-lab,.tri-fiche{grid-template-columns:1fr}
  .tri-g4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tri-idgrid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tri-feeders{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:640px){
  .tri-shell{padding:10px}
  .tri-hero{grid-template-columns:1fr;padding:24px 20px}
  .tri-hero h1{font-size:1.9em}
  .tri-g2,.tri-g3,.tri-g4,.tri-letters,.tri-idgrid{grid-template-columns:1fr}
  .tri-feeders{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tri-panel{padding:16px}
  .tri-tab{padding:8px 10px;font-size:.88em}
}


/* ===== Fresnel, ondes, schémas ===== */
.tri-shell{--c1:#d9a300;--c2:#1e9e5a;--c3:#d63a2f;--cu:#7a3fb8;--ci:#0f7fa8;--cp:#e5681f}
.tri-two{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:16px;align-items:start}
.tri-plot{background:#fbfcfe;border:1px solid var(--line);border-radius:16px;padding:6px;overflow:hidden}
.tri-plot svg{display:block;width:100%;height:auto}
.tri-plot text{font-family:Inter,system-ui,sans-serif}
.tri-plot .ax{stroke:#c3cfd8;stroke-width:1}
.tri-plot .ring{fill:none;stroke:#dbe6ee;stroke-dasharray:3 5}
.tri-plot .t{font-size:12px;font-weight:800}
.tri-plot .ts{font-size:10.5px;fill:#5d7385}
.tri-plot .ph{stroke-width:3.4;fill:none;stroke-linecap:round}
.tri-plot .cons{stroke-width:2.6;fill:none;stroke-linecap:round}
.tri-plot .guide{stroke:#8da0ae;stroke-width:1;stroke-dasharray:4 4;fill:none}
.tri-plot .wave{fill:none;stroke-width:2.4}
.tri-plot .cur{stroke:#14263a;stroke-width:1.4;stroke-dasharray:5 4}
.tri-plot .arcl{fill:none;stroke-width:2}
.tri-plot .tfill{opacity:.28}
.tri-readout{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;margin:10px 0}
.tri-readout div{background:#14263a;color:#fff;border-radius:12px;padding:8px 10px}
.tri-readout small{display:block;opacity:.7;font-weight:700;font-size:.74em;text-transform:uppercase;letter-spacing:.05em}
.tri-readout b{font-family:Consolas,"Courier New",monospace;font-size:1.25em;color:#7dffb0}
.tri-readout div.q b{color:#ffd37d}.tri-readout div.bad b{color:#ff8a78}
.tri-sw{display:flex;gap:14px;flex-wrap:wrap;margin:8px 0}
.tri-lg{display:flex;flex-wrap:wrap;gap:12px;font-size:.85em;color:var(--muted);margin:6px 0}
.tri-lg i{display:inline-block;width:22px;height:4px;border-radius:2px;margin-right:6px;vertical-align:middle}
.tri-presets{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}
.tri-presets button{border:1px solid var(--line);background:#fff;border-radius:999px;padding:5px 12px;font-weight:750;font-size:.86em;cursor:pointer;color:var(--ink)}
.tri-presets button:hover{border-color:var(--g2)}
.tri-presets button.on{background:var(--g);border-color:var(--g);color:#fff}
.tri-bars{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:8px}
.tri-bar{border:1px solid var(--line);border-radius:12px;padding:8px 10px;background:#fff;text-align:center}
.tri-bar b{display:block;font-size:1.3em;font-family:Consolas,"Courier New",monospace}
.tri-bar.hi{background:#ffe9e4;border-color:#f0b4a8}.tri-bar.lo{background:#fff4dc;border-color:#f2dd8a}.tri-bar.ok{background:#e5f6ec;border-color:#9fd8b8}
.tri-bar .bg{height:8px;border-radius:4px;background:#e6edf5;margin-top:6px;overflow:hidden}
.tri-bar .bg i{display:block;height:100%;background:#3d7be0}
.tri-note{background:#fff8e1;border:1px solid #f2dd8a;border-radius:14px;padding:10px 14px;font-size:.93em;margin:10px 0}
.tri-eq{font-family:inherit;font-weight:700;background:#f4f6f8;border-radius:10px;padding:2px 8px;white-space:nowrap}
.tri-missions{list-style:none;margin:0;padding:0}
.tri-missions li{display:flex;gap:10px;align-items:flex-start;padding:9px 0;border-bottom:1px dashed var(--line);font-size:.93em}
.tri-missions li:last-child{border-bottom:0}
.tri-missions .st{flex:0 0 26px;height:26px;border-radius:50%;display:grid;place-items:center;background:#eef1f3;color:var(--muted);font-weight:900;font-size:.85em}
.tri-missions li.done .st{background:var(--ok);color:#fff}
.tri-field-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
@media (max-width:980px){.tri-two{grid-template-columns:1fr}}
@media (max-width:640px){.tri-bars{grid-template-columns:1fr}}
.tri-two.lab{grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr)}
.tri-plot svg.wv .t{font-size:14.5px}.tri-plot svg.wv .ts{font-size:12.5px}
@media (max-width:980px){.tri-two.lab{grid-template-columns:1fr}}
