﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700;800&display=swap');

:root {
  --ciat-dark: #111318;
  --ciat-panel: #181b22;
  --ciat-navy: #0b1528;
  --ciat-navy-light: #152542;
  --ciat-red: #dc2626;
  --ciat-red-glow: #ef4444;
  --ciat-border: #272c38;
  --page-bg: #d9dde2;   /* fondo gris claro de la página: los paneles conservan sus colores */
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--page-bg);
  color: #e5e7eb;
  overflow-x: hidden;
  user-select: none;
  /* dvh = alto visible real en móviles (descuenta barras del navegador); 100vh queda de respaldo */
  height: 100vh;
  height: 100dvh;
}
.mono { font-family: 'JetBrains Mono', monospace; }

/* Estilos de cables y monitoreo Ladder */
/* Ladder con colores de TIA Portal: hilos negros; en RUN (monitoreo) verde = con flujo, azul punteado = sin flujo */
.wire-off { stroke: #2b2f36; stroke-width: 2; }
.ladder-run .wire-off { stroke: #1f6fd1; stroke-dasharray: 5 3; }
.wire-on { stroke: #00a650; stroke-width: 3; }
.ladder-rail-r { stroke: #d6dbe1; stroke-width: 1.5; stroke-dasharray: 2 4; }
.cell-drop-ok {
  stroke: #22c55e !important;
  stroke-width: 2.4 !important;
  fill: rgba(34, 197, 94, 0.15) !important;
}
.cell-drop-bad {
  stroke: #f59e0b !important;
  stroke-width: 2.4 !important;
  stroke-dasharray: 3, 3;
  fill: rgba(245, 158, 11, 0.12) !important;
}
#ladder-unified-canvas { -webkit-touch-callout: none; }
/* Puntos de conexión de hilos: con ratón solo se ven al pasar encima (o mientras se tiende un hilo).
   En táctil no hay "hover", así que se quedan visibles. */
@media (hover: hover) {
  [data-wkind] .wire-dot { opacity: 0; transition: opacity 0.12s; }
  [data-wkind]:hover .wire-dot, [data-wkind].wire-dot-on .wire-dot { opacity: 1; }
}
.cell-selected {
  stroke: #f08c00 !important;
  stroke-width: 2 !important;
  stroke-dasharray: 4, 3;
  fill: rgba(255, 186, 73, 0.18) !important;
}

/* LEDs realistas */
.led-green-on {
  background-color: #22c55e;
  box-shadow: 0 0 10px #22c55e, inset 0 0 3px #ffffff;
}
.led-amber-on {
  background-color: #f59e0b;
  box-shadow: 0 0 10px #f59e0b, inset 0 0 3px #ffffff;
}
.led-red-on {
  background-color: #ef4444;
  box-shadow: 0 0 10px #ef4444, inset 0 0 3px #ffffff;
}

/* Conectores tipo Banana */
.banana-jack {
  width: 15px;
  height: 15px;
  border-radius: 9999px;
  border: 2.5px solid #cbd5e1;
  background: radial-gradient(circle, #020617 38%, #334155 100%);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-block;
}
.banana-jack:hover {
  transform: scale(1.28);
  box-shadow: 0 0 10px #ef4444;
}
.banana-jack.jack-selected {
  transform: scale(1.32);
  border-color: #facc15;
  box-shadow: 0 0 12px #facc15;
}

/* Barras divisorias redimensionables en escritorio */
.splitter-v {
  width: 7px;
  cursor: col-resize;
  background: var(--page-bg);
  border-left: 1px solid #c3c9d1;
  border-right: 1px solid #c3c9d1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 25;
}
.splitter-v:hover, .splitter-v.dragging { background: var(--ciat-red); }
.splitter-h {
  height: 7px;
  cursor: row-resize;
  background: var(--page-bg);
  border-top: 1px solid #c3c9d1;
  border-bottom: 1px solid #c3c9d1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 25;
}
.splitter-h:hover, .splitter-h.dragging { background: var(--ciat-red); }

/* Slider vertical de Zoom en 3D */
/* Selector de 2 posiciones (frente del tablero y área de interacción) */
.hw-sel { position: relative; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4b5563, #111827 70%); border: 2px solid #0b0f17; }
.hw-sel span { position: absolute; top: -13px; font: 800 8px 'JetBrains Mono', monospace; color: #334155; }
.hw-sel span:first-child { left: 2px; } .hw-sel span:last-of-type { right: 4px; }
.hw-sel i { position: absolute; left: 50%; top: 50%; width: 10px; height: 34px; margin: -17px 0 0 -5px; border-radius: 4px; background: #e5e7eb; transform: rotate(-40deg); transition: transform .15s; }
.hw-sel.on i { transform: rotate(40deg); background: #4ade80; }
.sel-knob { width: 14px; height: 14px; border-radius: 50%; background: #111827; border: 1px solid #64748b; position: relative; }
.sel-knob::after { content: ''; position: absolute; left: 5px; top: 1px; width: 3px; height: 10px; border-radius: 2px; background: #e5e7eb; transform: rotate(-40deg); transition: transform .15s; }
.sel-knob.on::after { transform: rotate(40deg); background: #4ade80; }

/* Slider horizontal girado -90°: el extremo derecho (máximo) queda arriba, junto al botón ＋ */
.zoom-slider-wrap { width: 16px; height: 110px; position: relative; }
.zoom-slider-vertical {
  position: absolute; left: 50%; top: 50%;
  width: 110px; height: 16px; margin: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
  accent-color: #dc2626;
}


/* Scrollbar delgada */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #111318; }
::-webkit-scrollbar-thumb { background: #2d3548; border-radius: 3px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Tamaños de paneles solo en escritorio (los splitters cambian --w1 / --h2) */
@media (min-width: 1024px) {
  #slot-pos-1 { width: var(--w1, 58%); }
  #right-column-wrap { width: calc(100% - var(--w1, 58%) - 14px); }
  #slot-pos-2 { height: var(--h2, 50%); }
  #slot-pos-3 { height: calc(100% - var(--h2, 50%) - 14px); }
}
/* Botones táctiles: sin retardo ni zoom por doble toque */
button, select, .banana-jack { touch-action: manipulation; }
@media (pointer: coarse) {
  .banana-jack { width: 22px; height: 22px; }
  /* Cinta Ladder más alta para el dedo y sin menú de "mantener presionado" */
  #ladder-tools-ribbon button { padding-top: 0.5rem; padding-bottom: 0.5rem; -webkit-touch-callout: none; }
}
/* Cinta Ladder minimalista: solo icono + abreviatura (el nombre completo queda en el tooltip) */
.lad-tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 38px; padding: 3px 5px 2px; border-radius: 6px; flex-shrink: 0;
  background: #4a4f57; border: 1px solid #5f656e; transition: background 0.12s, border-color 0.12s;
}
.lad-tool:hover { background: #5a6069; border-color: #f08c00; }
/* Cinta de bloques y barra de propiedades del editor Ladder: gris oscuro como TIA Portal */
.lad-bar { background: #3b3f46; border-bottom: 1px solid #2c3036; }
.lad-bar-btn { background: #4a4f57; border: 1px solid #5f656e; color: #e5e7eb; }
.lad-bar-btn:hover { background: #5a6069; }
.lad-tool svg { width: 26px; height: 14px; }
.lad-tool span { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 800; line-height: 1; }
/* Iconos "+" del lienzo Ladder (agregar línea / columna) */
.ladder-plus { cursor: pointer; }
.ladder-plus circle { fill: #0b1528; stroke: #22c55e; stroke-width: 1.6; transition: fill 0.12s; }
.ladder-plus:hover circle { fill: #166534; }
.ladder-plus rect, .ladder-plus circle { fill: #ffffff; stroke: #16a34a; stroke-width: 1.4; transition: fill 0.12s; }
.ladder-plus:hover rect, .ladder-plus:hover circle { fill: #dcfce7; }
.ladder-seg:hover rect { stroke: #f08c00; }
.ladder-addr-pick { cursor: pointer; }
.ladder-addr-pick:hover text:first-of-type { fill: #d97706; }
.ladder-edit-hot { transition: stroke 0.12s; }
[data-edit]:hover .ladder-edit-hot { stroke: #f08c00 !important; }
/* Pulsadores de campo: presionado (amarillo) y enclavado por doble clic (cian) */
.pb-on { box-shadow: 0 0 0 2px #facc15, 0 0 12px #facc15 !important; transform: scale(0.95); }
.pb-latched { box-shadow: 0 0 0 2px #22d3ee, 0 0 14px #22d3ee !important; }
[data-pb], [data-sw] { touch-action: none; -webkit-touch-callout: none; }
/* S7-1200 con el aspecto plano de la vista de dispositivos de TIA Portal */
.tia-1200 { position: relative; width: 100%; height: 308px; background: #617485; font-family: Arial, 'Inter', sans-serif; }
.tia-strip { position: absolute; left: 0; right: 0; height: 16px; background: #536270; }
.tia-band { position: absolute; left: 0; right: 0; height: 18px; background: #74889a; }
.tia-logo { position: absolute; padding: 3px 7px; background: #1f8c8e; color: #fff; font: 900 16px Arial, sans-serif; letter-spacing: 0.04em; }
.tia-ledcol { display: flex; flex-direction: column; align-items: center; width: 14px; }
.tia-addr { writing-mode: vertical-rl; transform: rotate(180deg); height: 58px; font: 700 11px Arial, sans-serif; color: #0b0f14; line-height: 14px; text-align: left; }
.tia-ledcol > .sled { margin: 6px 0; }
.tia-lbl { font: 700 6.5px Arial, sans-serif; color: #fff; line-height: 9px; white-space: nowrap; }
.tia-kind { font-size: 7px; margin-bottom: 0; }
.tia-vtext { writing-mode: vertical-rl; transform: rotate(180deg); font: 400 9px Arial, sans-serif; color: #fff; line-height: 9px; }
.sled.tia { width: 9px; height: 7px; border-radius: 0; background: #bcc2cd; box-shadow: none; }
.sled.tia.lit { background: #22e04a; box-shadow: 0 0 6px #22e04a; }
.sled.tia.lit.amber { background: #ffc61a; box-shadow: 0 0 6px #ffc61a; }
.tia-port { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 4px solid #05d737; background: #617485; }
.tia-port span { width: 18px; height: 18px; background: #3a4652; box-shadow: 6px 0 0 -2px #3a4652; }
/* S7-1500 con el aspecto de TIA Portal */
.tia-1500 { height: 590px; display: flex; flex-direction: column; background: #617485; border-left: 2px solid #536270; border-right: 2px solid #475462; font-family: Arial, sans-serif; }
.tia-1500-head { margin: 8px 8px 6px; padding: 4px 6px 6px; border: 1px solid #455063; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tia-1500-name { font: 400 8px Arial, sans-serif; color: #c8d7e4; white-space: nowrap; }
.tia-ledrail { width: 22px; display: flex; flex-direction: column; align-items: center; padding: 2px 0; background: #536270; border: 1px solid #455063; }
.tia-iorow { height: 23px; display: flex; align-items: center; gap: 2px; }
.tia-chn { width: 6px; font: 400 6.5px Arial, sans-serif; color: #c8d7e4; line-height: 9px; text-align: center; }
.tia-strip-1500 { flex: 1; padding: 11px 3px 9px; background: #9fbed6; }
.tia-strip-row { height: 23px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-bottom: 1px solid #8eaec7; }
.tia-cell { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.05; }
.tia-cell b { font: 400 11.5px Arial, sans-serif; color: #0b0f14; }
.tia-cell span { font: 600 7px 'JetBrains Mono', monospace; color: #1e3a5f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tia-1500-foot { height: 26px; margin-top: 6px; display: flex; align-items: center; justify-content: center; background: #536270; font: 400 7px Arial, sans-serif; color: #c8d7e4; }
.tia-1500-flap { margin: 0 8px; height: 250px; padding: 10px 8px; background: #455063; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tia-1500-display { width: 100%; height: 92px; background: #536270; border: 2px solid #3a4553; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; font-family: 'JetBrains Mono', monospace; text-align: center; }
.tia-key { display: flex; align-items: center; justify-content: center; height: 15px; background: #536270; color: #c8d7e4; font: 700 6.5px Arial, sans-serif; }
.tia-1500-lower { flex: 1; margin-top: 10px; padding: 10px 8px; background: #536270; display: flex; align-items: flex-start; }
/* LOGO! 8 */
.logo8 { width: 330px; display: flex; flex-direction: column; background: #7f8a90; border: 1px solid #494f52; font-family: Arial, sans-serif; }
.logo8-x10, .logo8-x11 { display: flex; align-items: center; padding: 4px 6px; }
.logo8-x10 { border-bottom: 1px solid #494f52; }
.logo8-x11 { border-top: 1px solid #494f52; justify-content: flex-start; }
.logo8-xlbl { width: 28px; font: 700 9px Arial, sans-serif; color: #1f2326; }
.logo8-tl { font: 700 8px Arial, sans-serif; color: #1f2326; line-height: 10px; white-space: nowrap; }
.logo8-blank { width: 14px; height: 14px; margin: 10px 0 0 2px; border: 1.5px solid #3d4245; border-radius: 3px; }
.logo-screw { position: relative; width: 16px; height: 16px; border-radius: 50%; background: #9aa4aa; border: 2px solid #3d4245; }
.logo-screw::after { content: ''; position: absolute; left: 1px; right: 1px; top: 5px; height: 2px; background: #3d4245; transform: rotate(-40deg); }
.logo8-info { display: flex; justify-content: space-between; gap: 6px; padding: 2px 6px; font: 400 6.5px Arial, sans-serif; color: #1f2326; line-height: 8px; }
.logo8-labelbox { width: 70px; height: 13px; margin-top: 2px; margin-left: auto; border: 1px solid #3d4245; }
.logo8-face { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-top: 1px solid #494f52; }
.logo8-siemens { font: 900 15px Arial, sans-serif; color: #b4d1d5; letter-spacing: 0.02em; }
.logo8-logo { font: 900 15px Arial, sans-serif; color: #a5adb1; }
.logo8-display { width: 168px; height: 102px; padding: 2px 6px; background: #dedede; border: 7px solid #0d0e0f; white-space: nowrap; color: #0f172a; font: 700 10.5px/16px 'JetBrains Mono', monospace; }
.logo8-display.hw-logo-display-off { background: #8f9a9c; }
.logo8-keys { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.logo8-card { width: 22px; height: 14px; border: 1.5px solid #1f2326; border-radius: 2px; }
.logo8-key { display: flex; align-items: center; justify-content: center; height: 22px; border: 2px solid #1f2326; background: #51585c; color: #dfe3e5; font: 700 11px Arial, sans-serif; }
/* Encabezado de un solo nivel */
.ciat-wordmark { font: italic 900 15px 'Inter', sans-serif; letter-spacing: 0.01em; }
.hdr-sep { width: 1px; height: 22px; background: #334155; flex-shrink: 0; }
.hdr-btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 30px; height: 28px; border-radius: 6px;
  background: #1e2430; color: #e2e8f0; border: 1px solid #334155; transition: background 0.12s, color 0.12s, box-shadow 0.12s; }
.hdr-btn:hover { background: #334155; }
.hdr-btn svg { width: 15px; height: 15px; }
.hdr-btn-red { background: #dc2626; border-color: #ef4444; color: #fff; }
.hdr-btn-red:hover { background: #ef4444; }
.hdr-btn.hdr-run { background: #16a34a; border-color: #4ade80; color: #fff; box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.hdr-btn.hdr-stop { background: #f59e0b; border-color: #fcd34d; color: #111; box-shadow: 0 0 8px rgba(245,158,11,0.6); }
/* Descripción emergente (se posiciona por JS para que no la recorte ningún contenedor) */
#ui-tip { position: fixed; z-index: 70; pointer-events: none; max-width: 260px; padding: 4px 8px; border-radius: 6px; background: #0b1528;
  border: 1px solid #ef4444; color: #f1f5f9; font: 600 11px 'Inter', sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.1s; }
#ui-tip.show { opacity: 1; }
/* Ventanas: controles, bordes de ventanas cerradas y distribución según las abiertas */
.win-ctrls { position: absolute; top: 6px; right: 8px; display: flex; align-items: center; gap: 3px; }
section[id^="panel-"] > div:first-child { position: relative; padding-right: 112px; }
#panel-plc > div:first-child { padding-right: 196px; }
.win-btn.win-flip { width: auto; gap: 3px; padding: 0 6px; margin-right: 4px; background: #f59e0b; border-color: #fcd34d; color: #111827;
  font: 800 9px 'Inter', sans-serif; }
.win-btn.win-flip:hover { background: #fbbf24; color: #111827; }
.win-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px; border-radius: 4px;
  background: #111827; border: 1px solid #334155; color: #cbd5e1; }
.win-btn:hover { background: #334155; color: #fff; }
.win-btn.win-close:hover { background: #dc2626; border-color: #ef4444; }
.win-btn[disabled] { opacity: 0.3; pointer-events: none; }
.win-btn svg { width: 12px; height: 12px; }
.win-dock { position: fixed; right: 0; z-index: 35; display: flex; flex-direction: column; gap: 6px; }
.win-tab { display: flex; align-items: center; gap: 6px; padding: 10px 5px; writing-mode: vertical-rl; transform: rotate(180deg);
  background: #0b1528; color: #e2e8f0; border: 1px solid #334155; border-left: 3px solid var(--dot, #ef4444); border-radius: 0 8px 8px 0;
  font: 800 10px 'Inter', sans-serif; letter-spacing: 0.06em; text-transform: uppercase; box-shadow: -4px 4px 14px rgba(0,0,0,0.5); cursor: pointer; }
.win-tab:hover { background: #152542; color: #fff; }
.win-tab .win-tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #ef4444); }
#win-fs-tabs .win-tab { flex: 1; max-height: 220px; justify-content: center; }
.win-gone { display: none !important; }
#workspace-main.ws-one #slot-pos-1 { width: 100% !important; flex: 1 1 auto; }
@media (min-width: 1024px) { #workspace-main.ws-two #slot-pos-2 { height: 100% !important; } }
/* Cara posterior por zonas: tarjetas opacas encima de los cables; canaletas transparentes con barras */
/* Las zonas son marcos transparentes (los cables se ven entre tarjetas); tarjetas, títulos y barras son opacos y van encima */
.rear-layout, .rear-pass, .rear-zone { pointer-events: none; }
.rear-card, .rear-device, .rear-zone-title, .bus-bar, .banana-jack, .rear-zone button { pointer-events: auto; }
.rear-zone { border: 1px dashed #334155; border-radius: 10px; padding: 8px; }
.rear-zone-title { display: inline-block; margin-bottom: 6px; padding: 2px 6px; border-radius: 4px; background: #0b1220;
  font: 800 9px 'JetBrains Mono', monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.rear-card { position: relative; }
.rear-duct { display: flex; flex-direction: column; justify-content: space-between; min-height: 92px; padding: 0 2px;
  background: repeating-linear-gradient(90deg, rgba(71,85,105,0.10) 0 14px, transparent 14px 18px); border-left: 2px dashed #334155; border-right: 2px dashed #334155; }
.duct-lanes { flex: 1; min-height: 56px; }
.bus-bar { position: relative; height: 12px; border-radius: 3px; cursor: pointer;
  background: radial-gradient(circle at 6px 6px, #0b1220 2.2px, transparent 2.6px) 0 0 / 12px 12px, var(--bus); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.35); }
.bus-bar span { position: absolute; left: 4px; top: -1px; padding: 0 4px; border-radius: 3px; background: var(--bus); color: #fff; font: 800 8px/14px 'JetBrains Mono', monospace; }
.bus-pos { --bus: #b91c1c; }
.bus-neg { --bus: #1d4ed8; }
.bus-bar.jack-selected { outline: 2px solid #facc15; transform: none; }
#banana-wires-svg .wire-hit { pointer-events: stroke; }
/* Cara posterior: borneras según el PLC */
.rear-term { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 34px; flex-shrink: 0; padding: 2px 1px;
  background: #0f172a; border: 1px solid #1e293b; border-radius: 4px; }
.rt-lbl { font: 700 8.5px 'JetBrains Mono', monospace; color: #fff; white-space: nowrap; }
.rt-tag { max-width: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 6.5px 'JetBrains Mono', monospace; color: #94a3b8; }
.rear-dead { width: 15px; height: 15px; flex-shrink: 0; border-radius: 50%; border: 2px dashed #334155; }
.rear-vrow { display: flex; align-items: center; gap: 6px; height: 21px; padding: 0 4px; border-bottom: 1px solid #1e293b; font: 600 8.5px 'JetBrains Mono', monospace; }
.rear-strip-title { margin-bottom: 3px; font: 800 8.5px 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
.rear-device { display: inline-flex; flex-direction: column; gap: 6px; padding: 6px; background: #111827; border: 1px solid #334155; border-radius: 6px; }
.rear-device-name { padding: 6px; text-align: center; background: #617485; color: #fff; font: 700 11px Arial, sans-serif; border-radius: 3px; }
/* ViewCube 3D (CSS 3D): gira junto con la cámara */
.vc-stage { width: 104px; height: 104px; perspective: 340px; display: flex; align-items: center; justify-content: center; }
.vc-scene { position: relative; width: 50px; height: 50px; transform-style: preserve-3d; }
#vc-widget { opacity: 0.5; transform-origin: top right; transition: opacity 0.2s, transform 0.2s; }
#vc-widget:hover { opacity: 1; }
#vc-widget.vc-small { transform: scale(0.68); }
.vc-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; backface-visibility: hidden;
  background: linear-gradient(160deg, #475569, #273244); border: 1px solid #64748b; color: #e2e8f0;
  font: 800 8.5px 'Inter', sans-serif; letter-spacing: 0.03em; cursor: pointer; transition: background 0.12s; }
button.vc-face:hover, .vc-top-btn:hover { background: #fca5a5; color: #7f1d1d; }
.vc-front { transform: translateZ(25px); }
.vc-back { transform: rotateY(180deg) translateZ(25px); }
.vc-right { transform: rotateY(90deg) translateZ(25px); }
.vc-left { transform: rotateY(-90deg) translateZ(25px); }
.vc-top { transform: rotateX(90deg) translateZ(25px); background: linear-gradient(160deg, #64748b, #3b4a5f); cursor: default; }
.vc-bottom { transform: rotateX(-90deg) translateZ(25px); color: #94a3b8; cursor: default; }
.vc-top-btn { width: 100%; height: 100%; font: 800 8.5px 'Inter', sans-serif; color: #e2e8f0; }
.vc-corner { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #dc2626; color: transparent; font-size: 0;
  border: 2px solid #fff; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.vc-corner:hover { background: #facc15; }
.vc-ring { position: absolute; left: -27px; top: -27px; width: 104px; height: 104px; border-radius: 50%;
  border: 5px solid rgba(100, 116, 139, 0.45); transform: rotateX(90deg) translateZ(-26px); transform-style: preserve-3d; }
.vc-dir { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%;
  transform: rotate(var(--a)) translateY(52px) rotate(calc(-1 * var(--a))); background: #0b1528; border: 1px solid #64748b;
  color: #e2e8f0; font: 800 9px 'Inter', sans-serif; }
.vc-dir:hover { background: #dc2626; border-color: #fca5a5; }
.vc-home { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 20px; border-radius: 5px;
  background: rgba(11, 21, 40, 0.9); border: 1px solid #334155; color: #cbd5e1; font-family: 'JetBrains Mono', monospace; }
.vc-home:hover { background: #dc2626; color: #fff; }
.vc-home svg { width: 13px; height: 13px; }
/* ===== Tablero de control: hardware Siemens montado en riel DIN ===== */
#board-stage { display: inline-block; min-width: 100%; }
.hw-plate { width: max-content; padding: 8px 12px 10px; border-radius: 6px; border: 3px solid #4b535c;
  background: linear-gradient(180deg, #a3abb4, #8a939d); box-shadow: inset 0 0 0 1px #c4cad1, 0 6px 18px rgba(0,0,0,0.45); }
.hw-plate-title { font: 800 10px 'JetBrains Mono', monospace; color: #1f2937; letter-spacing: 0.08em; }
.hw-duct { height: 16px; margin: 5px 0; border-radius: 2px; background: repeating-linear-gradient(90deg, #6b7280 0 10px, #4b5563 10px 14px); box-shadow: inset 0 2px 3px rgba(0,0,0,0.4); }
.hw-rail { position: absolute; left: 0; right: 0; top: 50%; height: 26px; transform: translateY(-50%);
  background: linear-gradient(180deg, #e5e7eb 0, #9ca3af 18%, #f3f4f6 32%, #9ca3af 68%, #d1d5db 85%, #6b7280 100%);
  border-top: 1px solid #6b7280; border-bottom: 1px solid #4b5563; }
.hw-rail::after { content: ''; position: absolute; inset: 9px 0; border-radius: 2px; background: repeating-linear-gradient(90deg, transparent 0 18px, rgba(55,65,81,0.55) 18px 30px); }
.hw-rail-1500 { height: 44px; background: linear-gradient(180deg, #d1d5db, #9ca3af 50%, #6b7280); }
.hw-device { position: relative; z-index: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.35)); }
.hw-col { display: flex; flex-direction: column; width: 24px; }
.hw-gap, .hw-fill { display: flex; flex-direction: column; align-self: stretch; }
.hw-gap { width: 8px; }
.hw-fill { flex: 1; }
.hw-gap > .hw-cover, .hw-fill > .hw-cover { flex: 1; }
.hw-cover { background: #caccd9; }
.hw-cover-top, .hw-cover-bottom { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 0; }
.hw-cover-top { border-top: 1px solid #e5e7ee; }
.hw-cover-bottom { border-bottom: 1px solid #9ea3b3; }
.hw-cap { font: 700 7px 'JetBrains Mono', monospace; color: #475569; text-align: center; padding: 1px 0; letter-spacing: 0.05em; white-space: nowrap; }
.hw-tlabel { font: 700 8px 'JetBrains Mono', monospace; color: #1e293b; line-height: 1; white-space: nowrap; }
.hw-screw { position: relative; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px #111827;
  background: radial-gradient(circle at 35% 35%, #e5e7eb, #6b7280 60%, #374151); }
.hw-screw::after { content: ''; position: absolute; left: 2px; right: 2px; top: 5px; height: 2px; background: #1f2937; transform: rotate(-35deg); }
.hw-screw-light { background: radial-gradient(circle at 35% 35%, #ffffff, #a3a9b1 60%, #6b7280); }
/* Marcadores de cable con el tag (texto vertical) */
.hw-marker { height: 92px; margin: 0 2px 2px; padding: 3px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  writing-mode: vertical-rl; transform: rotate(180deg); font: 600 8.5px 'JetBrains Mono', monospace; color: #0f172a;
  background: #f8fafc; border: 1px solid #94a3b8; border-radius: 2px; text-align: left; }
.hw-cover-bottom + .hw-marker { margin: 2px 2px 0; }
.hw-marker-addr { color: #0369a1; font-weight: 800; }
.hw-marker-empty { visibility: hidden; }
.hw-marker-free { opacity: 0.45; }
/* LEDs de estado y de canal (se encienden en simulación) */
.sled { display: inline-block; width: 9px; height: 6px; border-radius: 1.5px; background: #1a2a20; box-shadow: inset 0 0 0 1px #0b0f0c; flex-shrink: 0; }
.sled.lit { background: #4ade80; box-shadow: 0 0 6px #4ade80, inset 0 0 1px #fff; }
.sled.lit.amber { background: #fbbf24; box-shadow: 0 0 6px #fbbf24, inset 0 0 1px #fff; }
.sled.sim { width: 7px; height: 7px; border-radius: 50%; }
.sled-gap { display: inline-block; height: 6px; }
.hw-st { display: flex; align-items: center; gap: 4px; font: 700 7px 'JetBrains Mono', monospace; color: #cbd5e1; white-space: nowrap; }
.hw-siemens { font: 900 13px 'Inter', sans-serif; letter-spacing: 0.12em; color: #2dd4bf; }
.hw-1200-body { display: flex; align-items: stretch; gap: 12px; width: 100%; height: 150px; padding: 10px 12px;
  background: #617485; border-top: 16px solid #536270; border-bottom: 16px solid #536270; }
.hw-1200-slot { width: 110px; display: flex; align-items: center; justify-content: center; border: 1px solid #1f2329; border-radius: 3px;
  background: #2b3036; font: 700 8px 'JetBrains Mono', monospace; color: #6b7280; }
.hw-rj45 { width: 44px; }
.hw-rj45 span { display: block; height: 22px; border: 2px solid #0b0f14; border-radius: 2px; background: linear-gradient(#1f2937, #0b0f14); }
.hw-x80 { display: flex; justify-content: space-around; padding: 2px 0; background: #111317; border: 1px solid #3f444b; border-radius: 2px;
  font: 700 7px 'JetBrains Mono', monospace; color: #cbd5e1; }
.hw-logo-display-off { background: #8f9a9c; }
.hw-contactor { width: 118px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
  background: linear-gradient(180deg, #4b5159, #3a3f46); border: 1px solid #2a2e33; border-radius: 4px; }
.hw-km-window { position: relative; width: 28px; height: 13px; margin: 3px 0; border-radius: 2px; background: #e5e7eb; border: 2px solid #0b0f14; }
.hw-km-window::after { content: 'O'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 8px 'JetBrains Mono', monospace; color: #111; }
.hw-km-window.lit { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.hw-km-window.lit::after { content: 'I'; }
.hw-overload { width: 118px; margin-top: 2px; padding: 5px; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, #5a626c, #454b53); border: 1px solid #2a2e33; border-radius: 4px; }
.hw-motor { position: relative; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #3b82f6, #1e3a8a 75%); border: 3px solid #93c5fd; color: #fff; font: 900 11px/11px 'Inter', sans-serif; text-align: center; }
.hw-motor-rot { position: absolute; inset: -9px; width: 70px; height: 70px; color: #475569; }
.hw-motor-rot.spin { color: #4ade80; animation: hw-spin 1.2s linear infinite; }
@keyframes hw-spin { to { transform: rotate(360deg); } }
.hw-ol-flag { width: 14px; height: 14px; border-radius: 2px; background: #334155; border: 1px solid #0b0f14; }
.hw-ol-flag.tripped { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.hw-ol-btn { padding: 2px 5px; border-radius: 3px; background: #2563eb; color: #fff; border: 1px solid #1e3a8a; font: 800 7px 'JetBrains Mono', monospace; }
/* Campo: botonera, mando bimanual, sensores, torreta, electroválvulas */
.hw-field { width: max-content; min-width: 100%; margin-top: 10px; padding: 8px; border-radius: 8px; background: #0b1220; border: 1px solid #1f2937; }
.hw-field-head { margin-bottom: 6px; font: 800 9px 'JetBrains Mono', monospace; color: #64748b; letter-spacing: 0.1em; }
.hw-station { overflow: hidden; border-radius: 8px; border: 2px solid #9ca3af; background: linear-gradient(180deg, #e5e7eb, #c9cdd2); box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.hw-station-yellow { border-color: #b45309; background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.hw-station-title { padding: 3px 8px; background: #374151; color: #f9fafb; font: 800 9px 'JetBrains Mono', monospace; letter-spacing: 0.12em; }
.hw-legend { min-width: 62px; padding: 1px 4px; text-align: center; background: #fff; border: 1px solid #6b7280; border-radius: 2px; font: 800 8px 'Inter', sans-serif; color: #111; }
.hw-pb-ring { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(circle, #d1d5db 55%, #9ca3af 56%, #e5e7eb 70%, #6b7280); }
.hw-pb { width: 38px; height: 38px; border-radius: 50%; color: #fff; border: 2px solid rgba(0,0,0,0.35); font: 900 14px 'Inter', sans-serif; transition: transform 0.06s; }
.hw-pb-green { background: radial-gradient(circle at 35% 30%, #4ade80, #15803d 70%); }
.hw-pb-red { background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c 70%); }
.hw-pb-palm { width: 52px; height: 52px; font-size: 18px; background: radial-gradient(circle at 35% 30%, #4b5563, #0b0f14 70%); }
.hw-field-card { background: #111827; border: 1px solid #334155; border-radius: 8px; }
.hw-field-title { padding: 4px 8px; border-bottom: 1px solid #1f2937; font: 800 8.5px 'JetBrains Mono', monospace; color: #94a3b8; letter-spacing: 0.08em; }
.hw-sensor { position: relative; width: 60px; height: 22px; display: flex; align-items: center; }
.hw-sensor-body { width: 46px; height: 18px; border-radius: 3px; border: 1px solid #475569; background: repeating-linear-gradient(90deg, #9ca3af 0 2px, #cbd5e1 2px 4px); }
.hw-sensor-led { position: absolute; left: 6px; top: -4px; width: 9px; height: 6px; border-radius: 2px; background: #713f12; }
.hw-sensor-led.lit { background: #facc15; box-shadow: 0 0 8px #facc15; }
.hw-sensor-lens { width: 12px; height: 14px; border-radius: 0 6px 6px 0; background: radial-gradient(circle at 30% 50%, #ef4444, #450a0a); }
.hw-tower-cap { width: 30px; height: 6px; border-radius: 4px 4px 0 0; background: #374151; }
.hw-tower-seg { width: 34px; height: 30px; border-left: 1px solid rgba(0,0,0,0.4); border-right: 1px solid rgba(0,0,0,0.4); border-bottom: 2px solid #1f2937; transition: background 0.15s, box-shadow 0.15s; }
.hw-tower-red { background: linear-gradient(90deg, #450a0a, #7f1d1d, #450a0a); }
.hw-tower-red.lit { background: linear-gradient(90deg, #dc2626, #fecaca, #dc2626); box-shadow: 0 0 18px #ef4444; }
.hw-tower-amber { background: linear-gradient(90deg, #451a03, #78350f, #451a03); }
.hw-tower-amber.lit { background: linear-gradient(90deg, #d97706, #fde68a, #d97706); box-shadow: 0 0 18px #f59e0b; }
.hw-tower-green { background: linear-gradient(90deg, #052e16, #14532d, #052e16); }
.hw-tower-green.lit { background: linear-gradient(90deg, #16a34a, #bbf7d0, #16a34a); box-shadow: 0 0 18px #22c55e; }
.hw-tower-base { width: 38px; height: 12px; border-radius: 2px; background: #1f2937; }
.hw-tower-pole { width: 8px; height: 34px; background: linear-gradient(90deg, #6b7280, #d1d5db, #6b7280); }
.hw-valve { position: relative; width: 54px; height: 40px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px;
  background: linear-gradient(180deg, #1f2937, #111827); border: 1px solid #475569; border-radius: 4px; }
.hw-valve-coil { font: 800 9px 'JetBrains Mono', monospace; color: #e5e7eb; }
.hw-valve-led { position: absolute; top: 4px; left: 50%; width: 10px; height: 6px; transform: translateX(-50%); border-radius: 2px; background: #422006; }
.hw-valve-led.lit { background: #facc15; box-shadow: 0 0 8px #facc15; }
