:root{font-family:system-ui,sans-serif;color:#243b35;background:#f6f4ed;--green:#254d40;--line:#deded1}*{box-sizing:border-box}body{margin:0}header{background:var(--green);color:#fff;padding:22px max(5vw,20px);display:flex;justify-content:space-between;gap:20px;align-items:center}small{letter-spacing:.2em;font-size:11px;color:#d8dbb8}h1{font-family:Georgia,serif;font-weight:400;font-size:clamp(26px,4vw,42px);margin:14px 0}h2{font-size:24px;font-weight:500}main{max-width:1440px;margin:auto;padding:24px 5vw}button,input,select{font:inherit}button{background:var(--green);color:#fff;border:0;border-radius:10px;padding:13px 18px;min-height:46px;cursor:pointer}button:hover{filter:brightness(1.12)}button:disabled{opacity:.4;cursor:not-allowed}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #d5a443;outline-offset:3px}input,select{border:1px solid var(--line);background:#fff;border-radius:8px;padding:12px;max-width:100%;color:#243b35}input[type=checkbox]{width:20px;height:20px;accent-color:var(--green)}label{display:flex;gap:8px;flex-direction:column;margin:12px 0}form{max-width:760px}nav{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:24px}nav button{background:#e4e8db;color:var(--green)}nav button.active{background:var(--green);color:#fff}.section-head,.filters,.bulk,.actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.section-head{justify-content:space-between}.shortcuts{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:28px 0}.shortcuts button{text-align:left;font-size:26px;padding:24px;background:#e8c981;color:#3b3b26}.shortcuts button:nth-child(2){background:#254d40;color:#fff}.shortcuts button:nth-child(n+3){background:#e4e8db}.shortcuts strong,.shortcuts span{display:block;font-size:20px;margin-top:15px}.shortcuts span{font-size:13px;margin-top:7px}.filters input{width:300px}.bulk{margin:15px 0 24px}.bulk button{padding:10px;background:#e4e8db;color:var(--green)}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px}.card{padding:20px;background:#fff;border:1px solid var(--line);border-radius:14px}.card.selected{border:2px solid #254d40;padding:19px}.card h3{margin:10px 0}.card small{color:#677d6c;letter-spacing:0}.card .buttons{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.card .buttons button{flex:1;padding:10px}.card label.pick{flex-direction:row;align-items:center;font-size:13px}.card input[type=range]{width:100%}.card p{font-size:13px;color:#64766b}.routine,.entry,.zone-row{padding:16px;border-bottom:1px solid var(--line)}.routine{display:flex;gap:14px;align-items:center;flex-wrap:wrap}.routine strong{flex:1}.zone-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:center}#notice{padding:12px;border-radius:8px;white-space:pre-wrap}#notice:not(:empty){background:#f5ddae;margin-bottom:20px}#status{font-size:13px}fieldset{border:1px solid var(--line);border-radius:8px}#weekdays{display:flex;flex-wrap:wrap;gap:16px}#weekdays label{flex-direction:row;align-items:center}dialog{border:0;border-radius:16px;padding:28px;max-width:750px;width:92%;max-height:85vh;color:#243b35}dialog::backdrop{background:#10241bb0}#commandPreview{max-height:35vh;overflow:auto}#sceneRows{max-height:40vh;overflow:auto}.scene-row{display:grid;grid-template-columns:1fr 1fr 80px;gap:10px;align-items:center;padding:12px 0}.entry small{color:#657369;letter-spacing:0}footer{text-align:center;padding:30px;color:#657369;font-size:12px}[hidden]{display:none!important}@media(max-width:700px){header{display:block}.shortcuts{grid-template-columns:1fr 1fr}.shortcuts button{padding:18px}.shortcuts strong{font-size:17px}.filters{display:block}.filters input{width:100%}.grid{grid-template-columns:1fr}.scene-row{grid-template-columns:1fr 1fr}.zone-row{grid-template-columns:1fr}main{padding:20px}nav button{flex:1}.bulk button{flex:1}}
/* ---------- Plan vue du dessus ---------- */
:root{--amber:#e8b54a;--water:#e4eef0;--muted:#64766b}
.plan-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:12px}
.plan-toolbar .spacer{flex:1}
.seg{display:inline-flex;background:#e4e8db;border-radius:12px;padding:4px;gap:4px}
.seg button{background:transparent;color:var(--green);min-height:40px;padding:8px 14px}
.seg button.active{background:var(--green);color:#fff}
button.ghost{background:#fff;color:var(--green);border:1px solid var(--line)}
button.ghost.active{background:var(--green);color:#fff}
button.primary{background:var(--amber);color:#3b3b26}
button.dark{background:var(--green);color:#fff}
button.stop{background:#fff;color:#8c2f1f;border:1px solid #e3b3a8}
button.danger{background:#fff;color:#8c2f1f;border:1px solid #e3b3a8}
button.chip{background:#fff;color:var(--green);border:1px solid var(--line);min-height:38px;padding:7px 12px;border-radius:999px;font-size:14px}
#planBanner p{margin:0 0 8px;padding:10px 12px;border-radius:8px;background:#eef1e6;font-size:14px}
.group-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:6px 0 12px}
.muted{color:var(--muted);font-size:14px}
.plan-layout{display:grid;grid-template-columns:1fr;gap:16px;align-items:start}
@media(min-width:1700px){.plan-layout{grid-template-columns:minmax(0,1fr) 360px}}
.plan-stage{background:#fff;border:1px solid var(--line);border-radius:14px;padding:10px;min-width:0}
#planSvg{display:block;width:100%;height:auto;user-select:none;-webkit-user-select:none}
#planSvg .water{fill:var(--water)}
#planSvg .quay{fill:#ecebe4}
#planSvg .hull{fill:#fbfaf6;stroke:#243b35;stroke-width:.12}
#planSvg .area{fill:none;stroke:#c9cbbd;stroke-width:.06;stroke-dasharray:.3 .25}
#planSvg .area-label{fill:#a3a996;font-weight:600;letter-spacing:.02em}
#planSvg .area-label.big{text-anchor:middle;letter-spacing:.25em;opacity:.8}
#planSvg .edge-label{fill:#7f9a9f;font-weight:700;letter-spacing:.15em}
#planSvg .hatch-bg{fill:#f6e3b8}
#planSvg .hatch-fg{fill:var(--amber)}
.slot{cursor:pointer;outline:none}
.slot rect{stroke:#254d40;stroke-width:.08;transition:fill .3s}
.slot text{text-anchor:middle;fill:#243b35;pointer-events:none;font-weight:600}
.slot .slot-sub{font-weight:400;fill:#4d5f56}
.slot.s-in rect{fill:#e3ebe0}
.slot.s-out rect{fill:var(--amber);stroke:#8a6413}
.slot.s-mixed rect{fill:url(#hatch);stroke:#8a6413}
.slot.s-unknown rect{fill:#f1efe6}
.slot.s-moving rect{fill:#9cc3e6;stroke:#2f6690;animation:pulse 1.2s ease-in-out infinite}
.slot.s-off rect{fill:#d9d9d4;stroke:#8d8d86;stroke-dasharray:.25 .15}
.slot.s-off text{fill:#6d6d68}
.slot.s-empty rect{fill:rgba(255,255,255,.55);stroke:#9aa69d;stroke-dasharray:.3 .2}
.slot.s-empty text{fill:#8b968e}
.k-toile-pluie.s-in rect,.k-toile-soleil.s-in rect,.k-pergola.s-in rect{fill:#eef2ea}
/* toiles du rooftop : un module = un cadre, moitié soleil (gauche) / moitié pluie (droite), superposées en vrai */
#planSvg .module-frame{fill:none;stroke:#254d40;stroke-width:.16;pointer-events:none}
.k-toile-soleil rect,.k-toile-pluie rect{stroke-width:.03;stroke-opacity:.55}
.k-toile-soleil.selected rect,.k-toile-pluie.selected rect{stroke-width:.24;stroke-opacity:1}
.k-toile-soleil .slot-label{fill:#8a5a00}
.k-toile-pluie .slot-label{fill:#2f5f7a}
.k-toile-soleil.s-out .slot-label,.k-toile-pluie.s-out .slot-label{fill:#243b35}
.slot:hover rect,.slot:focus-visible rect{stroke-width:.18}
.slot.selected rect{stroke:#c47f00;stroke-width:.28}
.slot.warn rect{stroke:#b3261e}
#planSvg.editing .slot.selected{cursor:move;touch-action:none}
@keyframes pulse{50%{opacity:.55}}
@media (prefers-reduced-motion:reduce){.slot.s-moving rect{animation:none}}
.legend{display:flex;flex-wrap:wrap;gap:6px 16px;padding:10px 4px 2px;font-size:13px;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.sw{display:inline-block;width:16px;height:12px;border-radius:3px;border:1px solid #254d40}
.sw.s-in{background:#e3ebe0}.sw.s-out{background:var(--amber)}.sw.s-mixed{background:repeating-linear-gradient(45deg,var(--amber) 0 3px,#f6e3b8 3px 6px)}
.sw.s-moving{background:#9cc3e6}.sw.s-off{background:#d9d9d4;border-style:dashed}.sw.s-empty{background:#fff;border-style:dashed}
.slot-panel{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;position:sticky;top:12px;max-height:calc(100vh - 24px);overflow:auto}
.slot-panel h3{margin:0 0 6px;font-size:20px}
.slot-panel h4{margin:18px 0 6px}
.panel-head{display:flex;justify-content:space-between;align-items:start;gap:10px}
.panel-head .close{background:#eef1e6;color:var(--green);min-height:36px;padding:4px 12px;font-size:20px}
.device-list{list-style:none;margin:10px 0;padding:0;max-height:38vh;overflow:auto}
.device-list li{display:flex;flex-direction:column;gap:2px;padding:9px 0;border-bottom:1px solid var(--line)}
.device-list .bad{color:#b3261e;font-size:13px}
.device-list span{font-size:13px}
.panel-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.panel-actions button{min-height:56px;font-size:17px}
.panel-actions .to-closed{background:var(--amber);color:#3b3b26;border:2px solid #8a6413}
.panel-actions .to-open{background:#e3ebe0;color:#243b35;border:2px solid #254d40}
.panel-actions .stop{grid-column:1/-1;min-height:46px}
.slot-panel details.tech{margin-top:14px;font-size:12px;color:var(--muted)}
.slot-panel details.tech summary{cursor:pointer;padding:6px 0}
.slot-panel details.tech p{margin:4px 0;word-break:break-word}
.slider-box{margin-top:14px;padding:12px;border:1px solid var(--line);border-radius:12px;background:#fff}
.slider-label{flex-direction:row;justify-content:space-between;margin:0 0 6px;font-size:15px}
.slider-box input[type=range]{width:100%;height:40px;accent-color:var(--green);margin:0}
.slider-scale{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-bottom:10px}
.slider-go{width:100%;min-height:52px;font-size:17px}
.caution{background:#f5ddae;border-radius:8px;padding:10px;font-size:13px}
.row-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.row-actions button{min-height:36px;padding:6px 12px;font-size:14px;background:#e4e8db;color:var(--green)}
.row-actions button.danger{background:#fff;color:#8c2f1f}
.slot-panel label{margin:8px 0}
.slot-panel .geo{display:grid;grid-template-columns:1fr 1fr;gap:0 10px}
.slot-panel .geo label{font-size:12px}
.slot-panel select,.slot-panel input{width:100%}
.edit-panel{margin-top:16px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px}
.edit-head{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.edit-head h3{flex:1;margin:0;font-size:19px}
.edit-filters{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0}
.edit-filters input{flex:1;min-width:200px}
.edit-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:8px;max-height:45vh;overflow:auto}
.edit-row{display:flex;gap:8px;align-items:center;border:1px solid var(--line);border-radius:10px;padding:8px 10px}
.edit-row div{flex:1;min-width:0;display:flex;flex-direction:column}
.edit-row small{color:var(--muted);letter-spacing:0;font-size:12px}
.edit-row button{min-height:38px;padding:6px 10px;font-size:13px;background:#e4e8db;color:var(--green)}
.edit-row button.primary{background:var(--amber);color:#3b3b26}
.edit-row.picked{border:2px solid var(--amber)}
.edit-row.off strong{color:#8d8d86}
.kinds{margin-top:14px}
.kinds summary{cursor:pointer;font-weight:600;padding:8px 0}
.kind-row{display:grid;grid-template-columns:1.4fr 1fr 1fr auto;gap:8px;align-items:center;padding:6px 0}
.kind-row .check{flex-direction:row;align-items:center;margin:0;font-size:13px}
@media(max-width:1699px){.slot-panel{position:static}.slot-panel:has(.panel-head){position:fixed;left:50%;transform:translateX(-50%);bottom:0;top:auto;width:min(100%,640px);border-radius:16px 16px 0 0;max-height:62vh;z-index:5;box-shadow:0 -8px 30px #10241b33}}
@media(min-width:900px) and (max-width:1699px){#plan:has(.slot-panel.edit .panel-head){padding-right:396px}.slot-panel.edit:has(.panel-head){left:auto;right:12px;top:12px;bottom:12px;transform:none;width:380px;max-height:none;border-radius:16px}}
@media(max-width:900px){.kind-row{grid-template-columns:1fr 1fr}}
@media(max-width:700px){.plan-toolbar .seg{width:100%}.seg button{flex:1}.plan-toolbar .spacer{display:none}#multiToggle,#editToggle{flex:1}}

.button-link{display:inline-block;background:var(--green);color:#fff;border-radius:10px;padding:13px 18px;text-decoration:none}
.button-link:hover{filter:brightness(1.12)}

#planSvg .overlay{pointer-events:none}
#planSvg .overlay rect{fill:rgba(37,77,64,.07);stroke:#254d40;stroke-width:.07;stroke-dasharray:.35 .2;opacity:.75}
#planSvg .overlay .step{stroke:#254d40;stroke-width:.04;opacity:.22}
#planSvg .overlay text{fill:#254d40;opacity:.55;font-weight:700;text-anchor:middle;letter-spacing:.03em}

/* ---------- Tablette / écrans moyens : tout le plan visible d'un coup ---------- */
@media (max-width:1699px){
  header{padding:10px max(3vw,16px)}
  header small{display:none}
  header h1{font-size:22px;margin:4px 0}
  main{padding:12px max(2vw,12px)}
  nav{margin-bottom:10px;gap:6px}
  nav button{min-height:38px;padding:7px 14px;font-size:15px}
  .plan-toolbar{margin-bottom:8px}
  .seg button{min-height:42px}
  #planBanner p{padding:6px 10px;font-size:13px}
  .group-bar{margin:4px 0 8px}
  .plan-stage{padding:6px}
  .legend{padding:6px 2px 0;font-size:12px}
}
@media (min-width:1000px) and (max-width:1699px){
  .plan-layout{grid-template-columns:minmax(0,1fr) 300px;gap:10px}
  .slot-panel,.slot-panel:has(.panel-head){position:sticky;top:8px;left:auto;transform:none;width:auto;max-height:calc(100vh - 16px);border-radius:14px;box-shadow:none;bottom:auto}
  .slot-panel.edit:has(.panel-head){position:sticky;right:auto;top:8px;width:auto}
  #plan:has(.slot-panel.edit .panel-head){padding-right:0}
  .panel-actions button{min-height:64px;font-size:19px}
}

/* ---------- Écran du personnel : gros boutons au-dessus du plan, roue dentée ---------- */
.head-right{display:flex;align-items:center;gap:14px}
.gear{background:transparent;border:1px solid #ffffff55;color:#fff;font-size:22px;min-height:44px;min-width:44px;padding:0;border-radius:50%;line-height:1}
.gear.open{background:#ffffff22}
#adminNav{align-items:center}
#adminNav .spacer{flex:1}
#adminNav .lock{background:#f5ddae;color:#3b3b26}
.shortcuts.quick{grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin:0 0 12px}
.shortcuts.quick button{font-size:18px;padding:12px 16px;min-height:70px;display:flex;align-items:center;gap:10px;text-align:left}
.shortcuts.quick strong{margin:0;font-size:18px}
.shortcuts.quick span{display:none}
.shortcuts.quick .scene-btn{background:#e4e8db;color:var(--green)}
.shortcuts.quick .scene-btn:nth-child(n){background:#e4e8db;color:var(--green)}
#sceneRows{max-height:60vh}
#sceneRows .scene-level{margin:16px 0 4px;font-size:17px}
#sceneRows .scene-group{background:#f4f3ec;border-radius:8px;padding:8px 10px;margin-top:8px}
#adminDialog{max-width:420px}
#adminDialog input{font-size:24px;letter-spacing:.4em;text-align:center}
#adminError{color:#b3261e;min-height:1.2em}

.slot-panel .state-line{font-size:17px;margin:6px 0 4px;color:#243b35}
.slot-panel .state-line.bad{color:#b3261e}

/* ---------- Problèmes : bien visibles ---------- */
.alert-bar{background:#fbe3e1;border:2px solid #b3261e;border-radius:12px;padding:10px 12px;margin:0 0 12px;display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.alert-bar strong{color:#b3261e;font-size:17px;margin-right:6px}
.alert-bar button{background:#fff;color:#7a1a14;border:1px solid #b3261e;min-height:44px;padding:8px 12px;text-align:left}
.issue-box{background:#fbe3e1;border:2px solid #b3261e;border-radius:10px;padding:10px 12px;margin:8px 0}
.issue-box strong{color:#b3261e}
.issue-box p{margin:4px 0 0;color:#7a1a14;font-size:15px}
.slot.warn rect{stroke:#b3261e;stroke-width:.22;stroke-opacity:1}
.slot.warn text.slot-label{fill:#b3261e}
.seg button.has-alert::after{content:'';display:inline-block;width:10px;height:10px;border-radius:50%;background:#d93025;margin-left:8px;vertical-align:middle}

/* ---------- Deux lignes de commandes : Situations / Par produit ---------- */
.row-label{grid-column:1/-1;font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin-bottom:-4px}
.group-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:stretch;margin:4px 0 12px}
.group-bar .row-label{width:100%;margin:0}
.product{display:flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px}
.product .product-name{background:transparent;color:var(--green);font-weight:600;padding:6px 8px;min-height:44px}
.product .to-closed,.product .to-open{min-height:44px;padding:6px 12px;font-size:15px}
.product .to-closed{background:var(--amber);color:#3b3b26;border:2px solid #8a6413}
.product .to-open{background:#e3ebe0;color:#243b35;border:2px solid #254d40}

/* compactage tablette : situations + produits sur peu de hauteur */
.shortcuts.quick .row-label{display:block}
.shortcuts.quick{margin:0 0 8px}
.shortcuts.quick button{min-height:54px;padding:8px 14px}
.shortcuts.quick button[data-global=open]{background:#e3ebe0;color:#243b35;border:2px solid #254d40}
.shortcuts.quick button[data-global=close]{background:var(--amber);color:#3b3b26;border:2px solid #8a6413}
.plan-toolbar{flex-wrap:wrap;row-gap:8px}
.plan-toolbar .group-bar{margin:0}
.alert-bar{padding:6px 10px;margin-bottom:8px}
.alert-bar button{min-height:38px}

/* situations : 8 boutons sur 2 lignes de 4 (tablette) */
.shortcuts.quick{grid-template-columns:repeat(4,1fr)}
.shortcuts.quick .scene-btn{background:#fff;color:var(--green);border:1px solid var(--line);font-size:16px}
.shortcuts.quick .scene-btn strong{font-size:16px}
.shortcuts.quick .scene-btn.to-open{background:#e3ebe0;border:2px solid #254d40}
.shortcuts.quick .scene-btn.to-closed{background:var(--amber);color:#3b3b26;border:2px solid #8a6413}
.shortcuts.quick .ico{font-style:normal;font-size:22px}
@media(max-width:700px){.shortcuts.quick{grid-template-columns:1fr 1fr}}

.product.sub{background:#f7f6f0}
.product.sub .product-name{font-weight:500;font-size:14px}

/* compactage : situations et produits moins hauts pour laisser le plan visible */
.shortcuts.quick button{min-height:46px;padding:6px 12px}
.shortcuts.quick .ico{font-size:19px}
.product{padding:4px}
.product .product-name{min-height:38px;padding:4px 6px}
.product .to-closed,.product .to-open{min-height:38px;padding:4px 10px;font-size:14px}
.plan-toolbar .group-bar{gap:6px}

/* produits dans le panneau de droite : une ligne par produit */
.product-list{display:flex;flex-direction:column;gap:6px;margin:8px 0}
.product-list .product{display:grid;grid-template-columns:1fr auto auto;gap:6px;border-radius:10px}
.product-list .product-name{text-align:left;font-size:15px}
.product-list .product.sub{margin-left:14px}
.product-list .product.sub .product-name{font-size:14px;white-space:nowrap}
.product-list .product-name{white-space:nowrap}

/* ---------- Ergonomie tablette 10" (paysage et portrait) + téléphone ---------- */
/* situations : 8 sur une ligne en paysage, 4 x 2 en portrait, 2 colonnes sur téléphone */
@media (min-width:1100px){.shortcuts.quick{grid-template-columns:repeat(8,minmax(0,1fr))}.shortcuts.quick .row-label{grid-column:1/-1}}
@media (min-width:701px) and (max-width:1099px){.shortcuts.quick{grid-template-columns:repeat(4,minmax(0,1fr))}}
.shortcuts.quick .scene-btn{padding:6px 10px;gap:8px}
.shortcuts.quick .scene-btn strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* panneau produits : jamais de défilement horizontal */
.product-list .product{grid-template-columns:minmax(0,1fr) auto auto}
.product-list .product-name{white-space:normal;line-height:1.15;font-size:14px}
.product-list .product .to-closed,.product-list .product .to-open{padding:4px 8px;font-size:14px;min-height:42px}
.slot-panel{overflow-x:hidden}
#planSvg{margin:0 auto}

/* niveau : deux grands onglets bien distincts du reste */
#planSvg{overflow:hidden}
#levelSwitch{display:inline-flex;gap:0;background:transparent;padding:0;border:2px solid var(--green);border-radius:14px;overflow:hidden}
#levelSwitch button{min-height:54px;padding:8px 26px;font-size:19px;font-weight:700;background:#fff;color:var(--green);border-radius:0;display:flex;align-items:center;gap:10px}
#levelSwitch button+button{border-left:2px solid var(--green)}
#levelSwitch button.active{background:var(--green);color:#fff}
#levelSwitch .lvl-ico{font-size:14px;opacity:.8}
@media(max-width:700px){#levelSwitch{display:flex;width:100%}#levelSwitch button{flex:1;justify-content:center;padding:8px 10px;font-size:17px}}

/* Panneau de commande : ne recouvre jamais le plan (sélection multiple possible) */
@media (min-width:701px) and (max-width:999px){
  .slot-panel:has(.panel-head){position:static;left:auto;transform:none;width:auto;max-height:none;box-shadow:none;border-radius:14px;bottom:auto}
}
@media (max-width:700px){
  .slot-panel:has(.panel-head){max-height:42vh;overflow:auto}
  body:has(.slot-panel .panel-head){padding-bottom:44vh}   /* on peut faire défiler le plan au-dessus du panneau */
}
/* Écran large mais peu haut (fenêtre PC, tablette en paysage < 1000 px) : panneau à côté du plan, jamais dessus */
@media (min-width:701px) and (max-width:999px) and (orientation:landscape){
  .plan-layout{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:10px;align-items:start}
  .slot-panel,.slot-panel:has(.panel-head){position:sticky;top:8px;max-height:calc(100vh - 16px);overflow:auto}
}

/* sélection multiple : liste des cases en petites étiquettes, sous les boutons */
.device-list.chips{display:flex;flex-wrap:wrap;gap:6px;max-height:none;margin-top:12px}
.device-list.chips li{flex-direction:row;align-items:baseline;gap:6px;padding:4px 10px;border:1px solid var(--line);border-radius:999px;background:#fbfaf6;font-size:13px}
.device-list.chips li strong{font-weight:600}

/* confirmation d'une situation : simple et gros boutons */
#confirmDialog{max-width:480px}
#commandLabel{font-size:22px;font-weight:700;margin:0 0 10px}
#commandPreview p{margin:4px 0;font-size:15px;color:#4d5f56}
#confirmDialog .actions{margin-top:18px;display:grid;grid-template-columns:1fr 1fr;gap:10px}
#confirmDialog .actions button{min-height:58px;font-size:18px}
#cancelCommand{background:#e3ebe0;color:#243b35}

/* ligne produit : nom (ouvre le réglage %) + Replier + Déployer + Stop */
.product-list .product{grid-template-columns:minmax(0,1fr) auto auto 40px}
.product .stop-mini{background:#fff;color:#b3261e;border:2px solid #e2a9a4;min-height:42px;min-width:40px;padding:0;font-size:16px}
.product-list .product-name{text-decoration:none}

/* situation en cours */
.run-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#dbe9f6;border:2px solid #2f6690;border-radius:12px;padding:8px 12px;margin:0 0 10px;font-size:17px;font-weight:600;color:#1d4766}
.run-bar .run-stop{background:#b3261e;color:#fff;min-height:50px;min-width:140px;font-size:18px;font-weight:700}
/* ligne produit sur deux lignes : nom (réglage %) puis boutons */
.product-list .product{grid-template-columns:1fr 1fr 44px}
.product-list .product-name{grid-column:1/-1;white-space:nowrap;padding:2px 4px;min-height:30px;font-size:15px}
.product-list .product.sub{margin-left:14px}

/* logo Modulo dans l'en-tête */
.brand{display:flex;align-items:center;gap:16px;min-width:0}
.brand .logo{height:46px;width:auto;display:block}
.brand h1{margin:0}
@media(max-width:700px){.brand .logo{height:36px}.brand h1{font-size:17px}header{display:flex}}
/* niveau + sélection multiple centrés */
.plan-toolbar{justify-content:center;align-items:center;gap:16px}
.plan-toolbar .spacer{display:none}
#multiToggle{min-height:54px}

/* ---------- liste « Par produit » : une carte par produit, lignes alignées ---------- */
.product-list{gap:10px}
.product-card{background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px 8px 8px}
.product-card .product-title{background:transparent;color:var(--green);font-weight:700;font-size:16px;padding:4px 2px;min-height:34px;text-align:left}
.product-row{display:grid;grid-template-columns:96px 1fr 1fr 44px;gap:6px;align-items:center;padding:4px 0;border-top:1px solid #efeee6}
.product-row.solo{grid-template-columns:1fr 1fr 44px;border-top:0}
.product-row .row-name{background:transparent;color:#4d5f56;font-size:14px;font-weight:600;text-align:left;padding:2px;min-height:40px}
.product-row .to-open{background:#e3ebe0;color:#243b35;border:2px solid #254d40;min-height:44px;font-size:15px;padding:4px 6px}
.product-row .to-closed{background:var(--amber);color:#3b3b26;border:2px solid #8a6413;min-height:44px;font-size:15px;padding:4px 6px}
.product-row .stop-mini{background:#fff;color:#b3261e;border:2px solid #e2a9a4;min-height:44px;min-width:44px;padding:0;font-size:16px}
@media (min-width:1000px){.product-row{grid-template-columns:78px 1fr 1fr 40px}.product-row .row-name{font-size:13px}}

@media (min-width:1000px) and (max-width:1699px){.plan-layout{grid-template-columns:minmax(0,1fr) 320px}}
@media (min-width:1000px){.product-row{grid-template-columns:62px 1fr 1fr 40px}.product-row .row-name{white-space:nowrap}}

.pair-code{font-size:26px;letter-spacing:.12em;font-family:ui-monospace,monospace;background:#fff;border:1px solid var(--line);border-radius:8px;padding:4px 10px}

.login{max-width:420px;margin:40px auto;text-align:center}
.login-logo{width:96px;height:96px;border-radius:20px}
.login input{font-size:28px;letter-spacing:.3em;text-align:center}
.login button{width:100%;min-height:56px;font-size:19px}

/* ---- installation en mode appli ---- */
.app-url{font-family:ui-monospace,monospace;word-break:break-all;background:#fff;border:1px solid var(--line);border-radius:8px;padding:3px 8px}
.install-btn{font-size:18px;padding:12px 20px}
.install-done{color:#2f7d4f;font-weight:600}
.install-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px;margin:8px 0}
.install-os{background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 14px}
.install-os.mine{border:2px solid #254d40}
.install-os h3{margin:0 0 6px;font-size:16px}
.install-os ol{margin:0;padding-left:20px;line-height:1.5}

#rotateToggle{min-height:54px}
@media(max-width:700px){#rotateToggle{flex:1}}

.scene-dir{display:flex;gap:12px;margin:14px 0 4px}.scene-dir button{flex:1;min-height:64px;font-size:20px;font-weight:700;border-radius:12px}
.scene-dir .to-closed{background:var(--amber);color:#3b3b26;border:2px solid #8a6413}.scene-dir .to-open{background:#e3ebe0;color:#243b35;border:2px solid #254d40}

/* ---- retour visuel quand on appuie sur un bouton de commande ---- */
button{transition:transform .08s}
button:active:not(:disabled){transform:scale(.95)}
button.is-sending{opacity:.75;cursor:progress}
button.is-sending::after{content:'';display:inline-block;width:.9em;height:.9em;margin-left:8px;vertical-align:-2px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .7s linear infinite}
button.is-sent{animation:sentPulse 1.2s ease-in-out infinite;font-weight:700}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes sentPulse{0%,100%{box-shadow:0 0 0 0 rgba(37,77,64,.55)}50%{box-shadow:0 0 0 7px rgba(37,77,64,0)}}
@media (prefers-reduced-motion:reduce){button.is-sent,button.is-sending::after{animation:none}}
/* titre en haut : même esprit que l'icône (lettres capitales grasses, crème) */
.brand h1{font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:#f6f1e2;font-size:clamp(17px,2.2vw,24px)}
#commandPreview.scene-choice{max-height:none;overflow:visible}

/* état du groupe sous le nom du produit (Par produit) */
.group-state{display:flex;flex-wrap:wrap;gap:4px 12px;font-size:13px;color:#3d5249;margin:0 2px 6px}
.group-state span{display:inline-flex;align-items:center;gap:5px}
.group-state .sw{width:14px;height:11px}
.group-state.sub{margin:-2px 0 6px 52px;font-size:12px;color:var(--muted)}

/* état dans les boutons « Par produit » : ✓ = tout le groupe est déjà dans cet état ; pastille = combien de cases */
.product-row button.is-current,.product-card button.is-current{box-shadow:inset 0 0 0 3px #254d40;font-weight:800}
.product-row button.to-closed.is-current{box-shadow:inset 0 0 0 3px #6b4b0c}
button .cnt{display:inline-block;min-width:22px;margin-left:6px;padding:0 6px;border-radius:11px;background:#254d40;color:#fff;font-size:12px;font-weight:700;line-height:20px}
button.to-closed .cnt{background:#6b4b0c}
button .tick{font-weight:900}
.product-row button,.product-card .panel-actions button{white-space:nowrap}
