/* ===========================================================================
   OVERLAYS (fase 4) — HMI, Tutoriales/ChangeOver, Electrónica, Galería y
   ventanas de vídeo. Puerto de hmi_view / tutorial_view / electronica_dialog /
   gallery_view / video_popup (.dart).
   =========================================================================== */

/* ------------------------- PANEL GLOW (tutoriales / vídeo) --------------- */
.glow-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1.4px solid rgba(30, 150, 255, 0.35);
  border-radius: 26px;
  box-shadow:
    0 0 30px 1px rgba(30, 150, 255, 0.22),
    0 6px 16px rgba(0, 0, 0, 0.08);
}

/* ------------------------- VENTANA DE VÍDEO ------------------------------ */
.video-popup {
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}
.video-popup .vp-area {
  flex: 1;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #fff;
}
.video-popup video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.video-popup video.contain { object-fit: contain; transform: translateX(12px); }
.video-popup .vp-missing {
  position: absolute;
  inset: 0;
  background: #E9EDF3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--navy-soft);
  font-size: 13px;
  text-align: center;
  padding: 18px;
}
.video-popup .vp-big-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.vp-transport {
  display: flex;
  min-width: 0;
  overflow: hidden;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #F1F4F9;
  border: 1px solid var(--divider);
  border-radius: 16px;
  flex: none;
}
.vp-transport .vp-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.vp-transport .vp-wave { flex: 1 1 0; width: 100%; min-width: 0; max-width: 100%; height: 30px; display: block; overflow: hidden; }

/* Ventana del vídeo de arranque (izquierda, no modal) */
.startup-video-slot {
  position: absolute;
  left: 120px;
  top: 50%;
  transform: translateY(-50%);
}

/* ------------------------- ESCENARIO DE SECCIÓN (tutorial/changeover) ---- */
.stage-overlay { position: absolute; inset: 0; }
.stage-overlay .stage-bg {
  position: absolute;
  inset: 0;
  background: var(--bg) url('../assets/images/Fondo.jpg') center / cover no-repeat;
}
.stage-overlay .stage-pad {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 114px 150px 104px;
  transition: padding var(--menu-anim);
  pointer-events: none; /* los toques fuera de la tarjeta caen al fondo */
}
.stage-overlay .stage-card { pointer-events: auto; }
.stage-overlay .stage-pad.menu-left-open { padding-left: 176px; }
.stage-overlay .stage-pad.menu-right-open { padding-right: 176px; }
.stage-overlay .stage-pad.menu-bottom-open { padding-bottom: 168px; }
.stage-overlay .stage-card {
  width: 100%;
  height: 100%;
  max-width: 1180px;
  /* La tarjeta ocupa el hueco disponible, pero sus vistas de contenido
     intrínseco (p. ej. la rejilla inicial de Operations) se centran también
     en vertical. Las vistas de detalle siguen usando height:100%. */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.stage-overlay .stage-card > .tut-detail {
  flex: 1 1 auto;
  min-height: 0;
}

/* ------------------------- TUTORIALES: GRID 3×3 -------------------------- */
.tut-grid-panel {
  /* Al convertir .stage-card en flex para centrar verticalmente, los márgenes
     auto hacían que este panel pudiera encogerse a su ancho intrínseco. Forzar
     width:100% conserva el tamaño/aspecto que tenía antes del centrado. */
  width: 100%;
  box-sizing: border-box;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 auto;
}
.tut-head { display: flex; align-items: center; gap: 14px; }
.tut-head .badge {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.tut-head .tt { flex: 1; min-width: 0; }
.tut-head .tt .t1 {
  font-size: 23px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tut-head .tt .t2 {
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tut-tile {
  position: relative;
  aspect-ratio: 350 / 239; /* un 25 % menos alto que el original */
  border-radius: 18px;
  overflow: hidden;
  border: 1.4px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--soft-shadow);
  cursor: default;
}
.tut-tile.available { border-color: rgba(30, 150, 255, 0.55); cursor: pointer; }
.tut-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tut-tile .icon-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #EDF1F7, #DCE3EE);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 30px;
  color: rgba(34, 57, 91, 0.55);
}
.tut-tile .tt-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 14px 12px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.12;
  color: #fff;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.72));
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.54);
}
.tut-tile .tt-label.no-thumb { color: var(--navy); background: none; text-shadow: none; }

/* ------------------------- TUTORIAL: DETALLE ----------------------------- */
.tut-detail { display: flex; gap: 18px; width: 100%; height: 100%; }
.tut-left { flex: 62; min-width: 0; display: flex; flex-direction: column; padding: 18px 22px; gap: 16px; }
.tut-right { flex: 38; min-width: 0; display: flex; flex-direction: column; padding: 18px 20px; gap: 12px; }

.tut-dhead { display: flex; align-items: center; gap: 13px; flex: none; }
.tut-dhead .back { display: flex; align-items: center; gap: 13px; cursor: pointer; flex: 1; min-width: 0; border-radius: 12px; }
.tut-dhead .dbadge {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2C4A6F, var(--navy));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.tut-dhead .dt1 { font-size: 22px; font-weight: 800; color: var(--navy); line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tut-dhead .dt2 { margin-top: 2px; font-size: 13.5px; color: var(--navy-soft); display: flex; align-items: center; gap: 2px; white-space: nowrap; overflow: hidden; }
.tut-dhead .dt2 b { color: var(--blue); font-weight: 700; }
/* v146 · PDF is an operator action, not a tiny decorative glyph. The same
   control is shared by BOTH tutorial families (Cleaning and Change Over). */
.tut-dhead .pdf {
  min-width: 86px;
  height: 46px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1.5px solid rgba(214,69,61,.48);
  background: linear-gradient(180deg, rgba(255,247,246,.98), rgba(255,232,229,.96));
  color: #C93630;
  box-shadow: 0 5px 14px rgba(116,26,20,.16), inset 0 0 0 1px rgba(255,255,255,.72);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  font: inherit;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.tut-dhead .pdf .material-symbols-outlined { font-size: 30px !important; line-height: 1; }
.tut-dhead .pdf strong { font-size: 13px; line-height: 1; font-weight: 900; letter-spacing: .055em; }
.tut-dhead .pdf:hover,
.tut-dhead .pdf:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(214,69,61,.82);
  box-shadow: 0 7px 17px rgba(116,26,20,.22), 0 0 0 3px rgba(214,69,61,.10);
  outline: none;
}
.tut-dhead .pdf:active { transform: translateY(0); }

.tut-media {
  flex: 1;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #DCE3EE;
}
.tut-media img, .tut-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-missing {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(34, 57, 91, 0.55);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 16px;
  background: #DCE3EE;
}

.tut-steps { flex: none; display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tut-steps::-webkit-scrollbar { display: none; }
.tut-steps .sep { align-self: center; color: var(--navy-soft); padding: 0 2px; flex: none; }
.step-card {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1.3px solid transparent;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}
.tut-steps.scrolling .step-card { flex: none; width: 200px; }
.step-card.active { background: rgba(30, 150, 255, 0.08); border-color: rgba(30, 150, 255, 0.5); }
.step-card .sc-head { display: flex; gap: 8px; align-items: flex-start; }
.step-card .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.step-card .sc-title { font-size: 13px; font-weight: 800; color: var(--navy); line-height: 1.12; }
.step-card .sc-icon { height: 56px; margin: 10px 0; display: flex; align-items: center; justify-content: center; gap: 14px; color: rgba(34, 57, 91, 0.85); }
.step-card .sc-icon img { max-height: 56px; max-width: 100%; object-fit: contain; }
.step-card .sc-desc { font-size: 12px; color: var(--navy-soft); line-height: 1.28; }

/* Franja de pasos compacta: mismo ancho, menos alto; el vídeo de arriba
   absorbe el espacio liberado (la media ya es flex:1).
   h25 → Operaciones (–25 %) · h50 → Cambio de formato (–50 %). */
.tut-steps.steps-h25 .step-card { padding: 8px; }
.tut-steps.steps-h25 .sc-icon { height: 40px; margin: 7px 0; }
.tut-steps.steps-h25 .sc-icon img { max-height: 40px; }
.tut-steps.steps-h25 .sc-desc { font-size: 11px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tut-steps.steps-h50 .step-card { padding: 6px 8px; }
.tut-steps.steps-h50 .sc-icon { height: 24px; margin: 4px 0; }
.tut-steps.steps-h50 .sc-icon img { max-height: 24px; }
.tut-steps.steps-h50 .sc-title { font-size: 12px; }
.tut-steps.steps-h50 .sc-desc { display: none; }
.tut-steps { touch-action: pan-x; cursor: grab; }

.tut-protip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #EFF3FA;
  border: 1px solid rgba(30, 150, 255, 0.25);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.3;
}
.tut-protip .pt-txt b { color: var(--navy); font-weight: 800; }
.tut-protip .pt-txt span { color: var(--navy-soft); }

.tut-quote { flex: none; display: flex; gap: 8px; align-items: flex-start; }
/* `format_quote` de Material Symbols se parece visualmente a “99”.
   Conservamos la intención gráfica pero dibujamos una comilla de apertura
   inequívoca, sin depender de ese glifo. */
.tut-quote .q-ic {
  color: rgba(30, 150, 255, 0.55);
  transform: none;
  flex: none;
  width: 24px;
  font-size: 0 !important;
  line-height: 1;
  overflow: visible;
}
.tut-quote .q-ic::before {
  content: "“";
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 0.85;
  color: rgba(30, 150, 255, 0.58);
}
.tut-quote .q-txt { font-size: 15px; line-height: 1.34; color: var(--navy); font-weight: 500; }

/* ------------------------- VISOR DE DOCUMENTOS (jpg) --------------------- */
.doc-viewer {
  width: min(860px, calc(100vw - 80px));
  max-height: calc(100vh - 90px);
  background: #fff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.doc-viewer .dv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 12px 20px;
  border-bottom: 1px solid var(--divider);
}
.doc-viewer .dv-title { flex: 1; font-size: 16px; font-weight: 800; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-viewer .dv-body { overflow: auto; background: #F1F3F7; }
.doc-viewer .dv-body img { display: block; width: 100%; height: auto; }

/* ------------------------- HMI ------------------------------------------- */
.hmi-overlay { position: absolute; inset: 0; overflow: hidden; }
/* Sin velo: el fondo tras el HMI queda totalmente transparente (la capa
   solo existe para el «tocar fuera cierra»). */
.hmi-backdrop { position: absolute; inset: 0; background: transparent; }
.hmi-overlay { background: transparent; }
.hmi-image {
  position: absolute;
  border-radius: 16px;
  /* sin sombra: nada de velos ni halos tras el panel (petición) */
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hmi-image img { -webkit-user-drag: none; user-select: none; }
.hmi-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hmi-screen-slot { position: absolute; overflow: hidden; }
.hmi-screen-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 450ms ease;
}
.hmi-tap-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #CBD2DC;
  font-weight: 500;
  pointer-events: none;
  animation: hmi-blink 1500ms ease-in-out infinite;
}
@keyframes hmi-blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
.hmi-boot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}
.hmi-boot.on { opacity: 1; }
.hmi-boot .hb-txt {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  color: #000;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.hmi-boot .hb-bar { position: absolute; border-radius: 999px; background: rgba(0, 0, 0, 0.22); overflow: hidden; }
.hmi-boot .hb-bar > i { display: block; height: 100%; width: 0%; background: var(--blue); }
.hmi-status { position: absolute; color: #000; font-weight: 600; white-space: nowrap; pointer-events: none; }
.hmi-hot { position: absolute; cursor: pointer; }
.hmi-test-tile { position: absolute; cursor: pointer; background: transparent; transition: background 220ms ease; }
.hmi-test-tile.flash { background: rgba(255, 255, 255, 0.45); }
.hmi-dosis { position: absolute; cursor: pointer; }
.hmi-dosis img { width: 100%; height: 100%; object-fit: fill; }

.hmi-table { position: absolute; background: #fff; border: 1px solid #CBD5E1; box-shadow: 0 2px 6px rgba(0,0,0,0.06); display: flex; flex-direction: column; overflow: hidden; }
.hmi-table .ht-head { display: flex; background: var(--navy); color: #fff; font-weight: 700; flex: none; align-items: center; }
.hmi-table .ht-rows { flex: 1; overflow-y: auto; }
.hmi-table .ht-row { display: flex; align-items: center; cursor: pointer; }
.hmi-table .ht-row.even { background: #F1F5F9; }
.hmi-table .ht-row.sel { background: var(--blue); color: #fff; font-weight: 700; }
.hmi-table .c-name { flex: 3; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hmi-table .c-par { flex: 2; text-align: right; color: #475569; white-space: nowrap; overflow: hidden; }
.hmi-table .ht-row.sel .c-par { color: #fff; }

.hmi-restore {
  position: absolute;
  left: 20px;
  bottom: 26px;
  padding: 12px;
  cursor: pointer;
  animation: hmi-icon-blink 1800ms ease-in-out infinite;
}
@keyframes hmi-icon-blink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ------------------------- ELECTRÓNICA ----------------------------------- */
.elec-overlay { position: absolute; inset: 0; }
.elec-overlay .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.30); }
.elec-panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 260ms ease;
}
.elec-panel.fullscreen { border-radius: 0; }
.elec-head { display: flex; align-items: flex-start; padding: 16px 12px 12px 24px; border-bottom: 1px solid #D8DBE0; flex: none; }
.elec-head .et1 { font-size: 21px; font-weight: 800; color: #1C2230; }
.elec-head .et2 { margin-top: 3px; font-size: 13px; font-weight: 600; color: #5E6671; }
.elec-head .grow { flex: 1; min-width: 0; }
.elec-body { flex: 1; min-height: 0; display: flex; }
.elec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 12px 12px 24px; gap: 12px; }
.elec-side {
  width: 236px;
  flex: none;
  border-left: 1px solid #D8DBE0;
  overflow-y: auto;
  padding: 14px 16px;
}
.elec-foot { display: flex; align-items: center; gap: 10px; padding: 12px 24px 14px; border-top: 1px solid #D8DBE0; flex: none; }
.elec-foot .cnt { font-size: 12.5px; font-weight: 700; color: #5E6671; flex: 1; }

.elec-steps { display: flex; align-items: center; flex: none; }
.elec-steps .sep { padding: 0 6px; color: #5E6671; display: flex; }
.elec-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid #D8DBE0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.elec-chip.active { background: #EAF4FF; border: 1.6px solid var(--blue); }
.elec-chip .n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #EDEFF3;
  color: #5E6671;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.elec-chip.active .n { background: var(--blue); color: #fff; }
.elec-chip .ct { min-width: 0; }
.elec-chip .ct .a { font-size: 12.5px; font-weight: 800; color: #1C2230; }
.elec-chip.active .ct .a { color: var(--blue); }
.elec-chip .ct .b { font-size: 10.5px; font-weight: 600; color: #5E6671; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.elec-stage { flex: 1; min-height: 0; position: relative; }
.elec-stage svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.elec-cols { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-start; }
.device-card {
  background: #FBFBFD;
  border: 1px solid #D8DBE0;
  border-radius: 14px;
  padding: 10px 10px 8px;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.device-card .dc-title { font-size: 13px; font-weight: 800; color: #1C2230; padding: 0 4px 6px; flex: none; }
.device-card .dc-art { border-radius: 9px; overflow: hidden; flex: none; margin-bottom: 8px; }
.device-card .dc-rows { min-height: 0; }
.elec-group { display: flex; align-items: center; gap: 7px; padding: 8px 4px 5px; font-size: 12.5px; font-weight: 800; color: #1C2230; }
.elec-group .dot { width: 9px; height: 9px; border-radius: 50%; }

.plc-row, .strip-row {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #D8DBE0;
  border-radius: 9px;
  font-size: 11.5px;
}
.plc-row { padding: 0 4px 0 10px; justify-content: space-between; gap: 4px; }
.strip-row { padding: 0 8px; gap: 9px; cursor: default; }
.strip-row.unplug { cursor: pointer; }
.row-ref { font-weight: 800; color: #1C2230; flex: none; }
.plc-row .row-ref { width: 38px; }
.strip-row .row-ref { width: 42px; }
.row-label { flex: 1; min-width: 0; font-weight: 600; color: #5E6671; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plc-node {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid currentColor;
  margin: 5px;
  cursor: grab;
  touch-action: none;
  flex: none;
}
.plc-node.active { background: currentColor; border-color: #fff; box-shadow: 0 0 7px currentColor; }
.strip-node {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #B9BEC7;
  border: 2px solid #fff;
  flex: none;
}
.strip-node.lit { box-shadow: 0 0 6px currentColor; background: currentColor; }

.elec-side .st { font-size: 13.5px; font-weight: 800; color: #1C2230; margin: 14px 0 6px; }
.elec-side .st:first-child { margin-top: 0; }
.elec-toggle { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 12.5px; font-weight: 600; color: #1C2230; }
.elec-toggle .material-symbols-outlined { font-size: 18px; color: #5E6671; }
.elec-toggle .grow { flex: 1; }
.elec-toggle .switch { transform: scale(0.82); transform-origin: right center; }
.elec-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.elec-info-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  border: 1px solid currentColor;
}
.elec-tip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 11px;
  background: #EAF4FF;
  border: 1px solid #BFE0FF;
  border-radius: 11px;
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 600;
  color: #1C2230;
}
.btn-elec {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid #D8DBE0;
  background: #fff;
  color: #1C2230;
  font-size: 13.5px;
  font-weight: 700;
}
.btn-elec.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 800; }

/* ------------------------- GALERÍA --------------------------------------- */
.gallery-overlay { position: absolute; inset: 0; }
.gallery-overlay .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.gallery-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  padding: 60px 24vw;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery-band::-webkit-scrollbar { display: none; }
.gallery-band { cursor: grab; }
.gallery-card {
  flex: none;
  width: 52vw;
  max-width: 780px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
  border: 1.6px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
  scroll-snap-align: center;
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease;
}
.gallery-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-card.side { transform: scale(0.84); opacity: 0.60; }
.gallery-card .missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--navy-soft);
  font-size: 13px;
  font-weight: 600;
  height: 100%;
}
.gallery-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  text-align: center;
  padding: 0 40px;
  pointer-events: none;
}

.gallery-fs { position: absolute; inset: 0; background: #fff; overflow: hidden; touch-action: none; }
.gallery-fs img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}
.gallery-fs .fs-icons { position: absolute; top: 18px; right: 18px; display: flex; gap: 10px; }
.gallery-fs .fs-icons > span {
  padding: 10px;
  color: #000;
  cursor: pointer;
  filter: drop-shadow(0 0 12px #fff);
  display: flex;
}

/* Compartir por correo (galería) */
.gshare-dialog {
  width: min(460px, calc(100vw - 60px));
  background: #fff;
  border-radius: 20px;
  padding: 22px 24px 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}
.gshare-head { display: flex; align-items: center; gap: 10px; }
.gshare-head .gt { flex: 1; font-size: 19px; font-weight: 800; color: #1C2230; }
.gshare-head .x { cursor: pointer; color: #5E6671; display: flex; }
.gshare-label { margin: 14px 0 8px; font-size: 13.5px; font-weight: 700; color: #1C2230; }
.gshare-dialog select, .gshare-dialog input[type="text"], .gshare-dialog textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #1C2230;
  background: #fff;
  border: 1px solid #D8DBE0;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  resize: none;
}
.gshare-dialog textarea { height: 90px; font-weight: 500; }
.gshare-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------- UTILIDADES DE FASE 4 -------------------------- */
/* El atributo hidden debe ganar aunque la clase fije display:flex. */
[hidden] { display: none !important; }

.dlg-x {
  cursor: pointer;
  padding: 8px;
  display: flex;
  border-radius: 10px;
  color: #1C2230;
  flex: none;
}
.dlg-x:hover { background: rgba(0, 0, 0, 0.05); }

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(30, 150, 255, 0.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: pf-spin 900ms linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* PLC wiring v39: feedback visual sin reconstruir los nodos durante el drag. */
.elec-stage.is-wiring .plc-node.wire-source {
  background: var(--wire-drag-color) !important;
  border-color: #fff !important;
  box-shadow: 0 0 8px var(--wire-drag-color) !important;
  cursor: grabbing;
}
.elec-stage.is-wiring .plc-row.wire-source-row {
  border-color: var(--wire-drag-color) !important;
  border-width: 1.6px !important;
}
.elec-stage.is-wiring .strip-row.wire-hover {
  border-color: var(--wire-drag-color) !important;
  border-width: 1.8px !important;
  background: color-mix(in srgb, var(--wire-drag-color) 8%, white) !important;
}
.elec-stage.is-wiring .strip-node.wire-hover {
  color: var(--wire-drag-color) !important;
  background: var(--wire-drag-color) !important;
  box-shadow: 0 0 7px var(--wire-drag-color) !important;
}
