/* Escenas de planta v4 */
.sv-frame{position:relative;aspect-ratio:16/9;width:100%;overflow:hidden;border-radius:12px;background:#15121a;isolation:isolate;container-type:inline-size}
.sv-frame .sv-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
.sv-frame.is-cv:after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(15,8,24,.55) 0%,rgba(15,8,24,0) 16%,rgba(15,8,24,0) 80%,rgba(15,8,24,.6) 100%);z-index:1}
.sv-svg{position:absolute;inset:0;width:100%;height:100%;z-index:2;pointer-events:none}
.sv-box,.sv-zone,.sv-path{opacity:0;transition:opacity .45s ease}
.sv-box.on,.sv-zone.on,.sv-path.on{opacity:1}
.sv-zone.on{animation:sv-zone-pulse 2.6s ease-in-out infinite}
.sv-path.on{animation:sv-dash 1.2s linear infinite}
@keyframes sv-zone-pulse{0%,100%{fill-opacity:.12}50%{fill-opacity:.24}}
@keyframes sv-dash{to{stroke-dashoffset:-36}}
.sv-label{position:absolute;z-index:3;transform:translateY(calc(-100% - 6px));display:inline-flex;align-items:center;gap:6px;max-width:46%;white-space:nowrap;padding:5px 8px;border-radius:5px;background:rgba(17,11,26,.86);color:#fff;font:600 clamp(7px,1.05cqi,11.5px)/1.15 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.06em;box-shadow:0 4px 14px rgba(0,0,0,.25);border-left:3px solid var(--lc,#f4f1f7);animation:sv-in .35s ease both}
.sv-label.below{transform:translateY(6px)}
.sv-label.right{transform:translate(-100%,calc(-100% - 6px))}
.sv-label.right.below{transform:translate(-100%,6px)}
.sv-label i{width:6px;height:6px;border-radius:50%;background:var(--lc,#fff);flex:0 0 6px}
.sv-label b{color:var(--lc,#fff);font-weight:700;margin-left:2px}
.sv-label small{display:block;font-weight:500;opacity:.75;margin-left:4px;letter-spacing:.03em}
.sv-label.sv-lime{--lc:#a4d65e}.sv-label.sv-amber{--lc:#f2b84b}.sv-label.sv-red{--lc:#ff7d6e}.sv-label.sv-violet{--lc:#c9a7ff}.sv-label.sv-blue{--lc:#7cc4ff}
@keyframes sv-in{from{opacity:0;margin-top:4px}to{opacity:1;margin-top:0}}
.sv-top{position:absolute;z-index:4;left:0;right:0;top:0;display:flex;justify-content:space-between;align-items:flex-start;gap:10px;padding:clamp(8px,1.6cqi,16px)}
.sv-cam,.sv-sim{font:600 clamp(7px,1cqi,10.5px)/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.12em;color:#fff;background:rgba(17,11,26,.72);padding:7px 9px;border-radius:5px;backdrop-filter:blur(4px)}
.sv-cam i{display:inline-block;width:7px;height:7px;border-radius:50%;background:#ff5a4f;margin-right:7px;vertical-align:0;animation:sv-rec 1.6s ease-in-out infinite}
.sv-cam b{font-weight:500;opacity:.8;margin-left:4px}
.sv-sim{border:1px solid rgba(242,184,75,.55);color:#f6d391}
@keyframes sv-rec{50%{opacity:.25}}
.sv-foot{position:absolute;z-index:4;left:0;right:0;bottom:0;display:flex;justify-content:space-between;align-items:center;gap:8px;padding:clamp(8px,1.6cqi,16px);font:500 clamp(7px,1cqi,10.5px)/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.1em;color:rgba(255,255,255,.85)}
.sv-foot b{color:#fff;margin-left:4px}
.sv-status{display:inline-flex;align-items:center;gap:7px;background:rgba(17,11,26,.72);padding:7px 9px;border-radius:5px}
.sv-status i{width:7px;height:7px;border-radius:50%;background:#f2b84b;animation:sv-rec 1s ease-in-out infinite}
.sv-status.done i{background:#a4d65e;animation:none}
.sv-scan{position:absolute;z-index:2;left:0;right:0;height:22%;top:-22%;background:linear-gradient(180deg,rgba(164,214,94,0),rgba(164,214,94,.16) 70%,rgba(164,214,94,.55));border-bottom:1px solid rgba(164,214,94,.8);animation:sv-scan 2.4s linear infinite;pointer-events:none}
@keyframes sv-scan{to{top:100%}}
@media (prefers-reduced-motion:reduce){.sv-zone.on,.sv-path.on,.sv-scan,.sv-cam i,.sv-status i{animation:none}.sv-scan{display:none}}
/* thumbnails */
.sv-thumb{aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#15121a}
.sv-thumb img{width:100%;height:100%;object-fit:cover;display:block}
/* record next to scene */
.scene-record{border:1px solid var(--line,#e8e4eb);border-radius:14px;padding:16px 18px;background:#fff}
.scene-record .sr-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px}
.scene-record .sr-head span{font-size:9px;letter-spacing:.16em;font-weight:600;color:#797282}
.scene-record h4{font-size:15px;margin:2px 0 10px}
.scene-record dl{display:grid;grid-template-columns:auto 1fr;gap:7px 14px;font-size:11px;margin:0}
.scene-record dt{color:#797282}
.scene-record dd{margin:0;text-align:right;font-weight:500}
.sr-state{font-size:9.5px;font-weight:600;padding:4px 8px;border-radius:20px;background:#eef7e3;color:#2f7850;white-space:nowrap}
.sr-state.pending{background:#fdf3e1;color:#a66c20}
.sr-state.app{background:#f0e8f8;color:#581c87}
/* stage detail with scene */
.stage-detail.has-scene{grid-template-columns:1.25fr 1fr}
.stage-detail.has-scene .stage-scene{padding:18px;display:flex;flex-direction:column;gap:10px;background:#faf9fb;border-right:1px solid var(--line,#e8e4eb)}
.stage-detail.has-scene .stage-scene .photo-caption{position:static;color:#9a8aa5;font-size:9.5px;line-height:1.6;background:none;padding:0}
@media (max-width:980px){.stage-detail.has-scene{grid-template-columns:1fr}.stage-detail.has-scene .stage-scene{border-right:0;border-bottom:1px solid var(--line,#e8e4eb);padding:12px}}
@media (max-width:560px){.sv-label{max-width:62%;padding:4px 6px;gap:4px}.sv-label small{display:none}.sv-sim{font-size:6.5px;padding:5px 6px;letter-spacing:.08em}.sv-cam{font-size:6.5px;padding:5px 6px}}
/* scene strip (recorrido de escenas) */
.scene-strip{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(150px,1fr);gap:12px;overflow-x:auto;padding-bottom:6px;scroll-snap-type:x mandatory}
.scene-strip button{all:unset;cursor:pointer;scroll-snap-align:start;display:flex;flex-direction:column;gap:7px;font-size:10.5px;color:#241d31;border-radius:10px;padding:6px;border:1px solid transparent}
.scene-strip button:hover,.scene-strip button.active{border-color:#d9c9ea;background:#faf7fd}
.scene-strip button:focus-visible{outline:2px solid #581c87;outline-offset:2px}
.scene-strip b{font-size:9px;letter-spacing:.14em;color:#797282;font-weight:600}

/* scene gallery */
.scene-gallery{margin-bottom:22px}
.sg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:16px}
.sg-card{display:flex;flex-direction:column;gap:9px}
.sg-open{all:unset;cursor:zoom-in;display:block;border-radius:9px}
.sg-open:focus-visible{outline:2px solid #581c87;outline-offset:3px}
.sg-open .sv-thumb{display:block;transition:transform .2s ease}
.sg-open:hover .sv-thumb{transform:scale(1.015)}
.sg-meta{display:grid;grid-template-columns:auto 1fr;column-gap:8px;align-items:baseline}
.sg-meta b{font-size:10px;color:#581c87;letter-spacing:.1em}
.sg-meta strong{font-size:12px;font-weight:600}
.sg-meta small{grid-column:2;font-size:10px;color:#797282}
.sg-links{display:flex;gap:12px;font-size:10.5px}
.sg-links a{color:#581c87;text-decoration:none;font-weight:500}
.sg-links a:hover{text-decoration:underline}
.sg-modal{width:100%;min-width:0}#modal:has(.sg-modal){width:min(1200px,95vw);padding:24px}@media(max-width:560px){#modal:has(.sg-modal){padding:16px}}
.sg-modal .v-image-source{font-size:10px;color:#9a8aa5;margin-top:10px}
/* vision v4 stage */
.vision-view .camera-stage.scene-v4{padding:0;background:none;aspect-ratio:auto;border-radius:12px;overflow:visible}
.vision-view .camera-thumbs .scene-thumb-photo.sv-thumb{aspect-ratio:16/9;height:auto}
.vision-view .camera-thumbs{grid-template-columns:repeat(4,minmax(0,1fr))}
.camera-thumb .sv-thumb img{height:auto;aspect-ratio:16/9;filter:none;border-radius:0}
.vision-preview .camera-stage.scene-v4{padding:0;background:none;aspect-ratio:auto;overflow:visible}
@media (max-width:760px){.vision-view .camera-thumbs{grid-template-columns:repeat(3,1fr)}}
.vision-view .v-evidence{aspect-ratio:16/9}
.vision-view .v-evidence>img{opacity:1}
.sv-frame.is-app .sv-cam i{background:#a4d65e;animation:none}

/* Each overlay retains its simulation label at every viewport size. */
.sv-label{display:flex;flex-direction:column;align-items:flex-start;gap:3px;white-space:normal;width:max-content}.sv-label-main{display:flex;align-items:center;gap:5px;min-width:0;max-width:100%}.sv-label-main>span{min-width:0;overflow-wrap:anywhere}.sv-label small{margin-left:0;font-size:.75em;line-height:1.2;display:block}.sv-label b{white-space:nowrap}@media(max-width:560px){.sv-label{gap:2px}.sv-label small{display:block;font-size:.75em}}

/* Keep the box/pallet identity readable without changing other capture cards. */
.capture-palletizing .capture-identity>div:nth-child(2){min-width:0}.capture-palletizing .capture-identity>div>span{display:block;overflow-wrap:anywhere;line-height:1.5}.capture-palletizing .capture-bin-thumb img{object-fit:cover;border-radius:5px}
