/* ==========================================================================
   VALBATER PIXEL MAP PRO — SUITE COMBINADA 2026
   Estilos Profesionales Pro-AV de Alto Rendimiento (60/120 FPS Fluid Drag)
   ========================================================================== */

:root {
  --bg-main: #07090e;
  --bg-panel: #0d1219;
  --bg-card: #121824;
  --bg-card-hover: #172030;
  --bg-input: #090e15;
  --border: #1e293b;
  --border-focus: #00f0ff;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-cyan: #00f0ff;
  --accent-cyan-glow: rgba(0, 240, 255, 0.25);
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #a855f7;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. NAVBAR SUPERIOR (PRO-AV HEADER)
   ========================================================================== */
.top-nav {
  height: 54px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 100;
  user-select: none;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.nav-back-link:hover {
  color: #fff;
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.nav-sep {
  color: var(--text-dim);
  font-size: 1rem;
}

.brand-titles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-app {
  font-weight: 900;
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge-pro {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* Pestañas de Vista */
.main-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.v-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.v-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.v-tab.active {
  background: var(--accent-cyan);
  color: #05080f;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 240, 255, 0.35);
}

/* Acciones Nav */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #05080f;
  font-weight: 800;
  border-color: var(--accent-cyan);
}

.btn-primary:hover {
  background: #38f4ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-subtle.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.btn-compact {
  padding: 0.3rem 0.6rem;
  font-size: 0.6875rem;
}

.btn-wa-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #25D366;
  color: #ffffff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.75rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-wa-header:hover {
  background: #20bd5a;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.4);
}

/* Dropdown Menu Exportar */
.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 290px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1000;
}

.dropdown-wrap.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(0, 240, 255, 0.08);
}

.dropdown-item .d-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.dropdown-item .d-info strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
}

.dropdown-item .d-info small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ==========================================================================
   2. APP LAYOUT (3 COLUMNAS PRO-AV)
   ========================================================================== */
.app-layout {
  display: flex;
  height: calc(100vh - 54px);
  overflow: hidden;
}

/* SIDEBAR IZQUIERDO */
.sidebar-left {
  width: 380px;
  min-width: 380px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0.85rem;
  gap: 0.85rem;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.pch-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-main);
}

.badge-mini {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Form Controls */
.field-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-item label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
}

.project-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.builder-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dimension-inputs-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.input-twin-col label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.num-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.num-stepper input {
  border: none;
  background: transparent;
  width: 100%;
  padding: 0.4rem 0.2rem;
  font-size: 0.8125rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.text-center {
  text-align: center;
}

.btn-step {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-step:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Badges de Cálculo en Vivo */
.calc-live-badge-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.clb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.clb-lbl {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.clb-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}

.clb-val.cyan {
  color: var(--accent-cyan);
}

/* Paleta de Colores */
.color-picker-palette {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.cp-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cp-swatch:hover {
  transform: scale(1.15);
}

.cp-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px var(--c);
  transform: scale(1.15);
}

.builder-actions-row {
  display: flex;
  gap: 0.4rem;
}

.btn-block {
  width: 100%;
}

/* Chips de Presets */
.templates-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip-template {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.chip-template:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
}

/* Lista de Tarjetas de Pantalla */
.screens-cards-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.1rem;
}

.btn-link-action {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-action:hover {
  color: var(--accent-red);
}

.screen-card-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-left: 4px solid var(--sc-c, var(--accent-cyan));
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.screen-card-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.screen-card-item.selected {
  background: rgba(0, 240, 255, 0.07);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.sci-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sci-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sci-coords {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.sci-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.sci-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.3rem;
}

.sci-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.625rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.sci-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border);
}

.sci-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

/* ==========================================================================
   3. COLUMNA CENTRAL (VIEWPORT & VISTAS)
   ========================================================================== */
.main-viewport-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg-main);
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
}

/* ==========================================================================
   VISTA 1: MESA DE SALIDA MASTER (CANVAS RESOLUME 60FPS)
   ========================================================================== */
.canvas-master-toolbar {
  height: 44px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  gap: 0.85rem;
  user-select: none;
  z-index: 10;
}

.cmt-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cmt-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}

.select-compact {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  width: auto;
}

.input-compact {
  padding: 0.25rem 0.4rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.custom-res-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-icon-bar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon-bar:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.zoom-readout {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-main);
  width: 44px;
  text-align: center;
}

.btn-bar-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-bar-pill:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-bar-pill.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.ml-auto {
  margin-left: auto;
}

.cursor-coords-tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* EL VIEWPORT Y TRANSFORM LAYER */
.canvas-viewport {
  flex: 1;
  position: relative;
  background: #05070b;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.canvas-viewport.is-panning {
  cursor: grabbing !important;
}

.canvas-transform-wrapper {
  position: absolute;
  transform-origin: center center;
  will-change: transform;
}

/* EL CANVAS DE SALIDA RESOLUME (VIDEO OUT) */
.stage-video-canvas {
  position: relative;
  background: #000000;
  border: 2px solid #22c55e;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 0 14px rgba(34, 197, 94, 0.25);
  overflow: visible;
  will-change: width, height;
}

/* REJILLA Y GUÍAS CENTRALES */
.canvas-grid-layer {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

.canvas-crosshair-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(34, 197, 94, 0.4);
  pointer-events: none;
}

.canvas-crosshair-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(34, 197, 94, 0.4);
  pointer-events: none;
}

.canvas-origin-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: #22c55e;
  pointer-events: none;
  z-index: 5;
}

.canvas-bottom-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #22c55e;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

/* LÍNEAS DE GUÍA MAGNÉTICA */
.snap-guide-line {
  position: absolute;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  pointer-events: none;
  z-index: 90;
}

.snap-guide-v {
  width: 1.5px;
  top: -1000px;
  bottom: -1000px;
}

.snap-guide-h {
  height: 1.5px;
  left: -1000px;
  right: -1000px;
}

/* ==========================================================================
   CAJAS DE PANTALLA EN EL CANVAS (DRAG ULTRA FLUIDO 60FPS)
   ========================================================================== */
.canvas-screens-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen-canvas-box {
  position: absolute;
  box-sizing: border-box;
  border-width: 2px;
  border-style: solid;
  border-color: var(--box-c, var(--accent-cyan));
  background-color: var(--box-bg, rgba(0, 240, 255, 0.12));
  cursor: grab;
  user-select: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  will-change: left, top;
}

.screen-canvas-box.is-dragging {
  cursor: grabbing !important;
  z-index: 100 !important;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.7) !important;
  opacity: 0.95;
}

.screen-canvas-box.selected {
  outline: 2px dashed #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 20px var(--box-c, var(--accent-cyan));
  z-index: 10;
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.box-res-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.7);
  padding: 1px 5px;
  border-radius: 3px;
  align-self: flex-start;
  pointer-events: none;
}

.box-coords-badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 3px;
  align-self: flex-end;
  pointer-events: none;
}

/* Rejilla interna de módulos dentro de la caja */
.box-modules-grid {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
  opacity: 0.45;
}

.box-module-cell {
  border: 0.5px solid rgba(255, 255, 255, 0.25);
  box-sizing: border-box;
}

/* BARRA FLOTANTE DE PANTALLA SELECCIONADA */
.screen-selected-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 18, 25, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  z-index: 50;
  user-select: none;
}

.sst-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sst-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.sst-name {
  font-size: 0.8rem;
  color: #fff;
}

.sst-res {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.sst-inputs-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sst-input {
  width: 65px;
  padding: 0.2rem 0.35rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-align: center;
}

.sst-actions-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   VISTA 2: DETALLE TÉCNICO & CABLEADO CON RETORNO A PISO (SMARTLCT)
   ========================================================================== */
.detail-top-controls {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  user-select: none;
}

.dtc-screen-selector, .dtc-cabling-settings {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dtc-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dtc-view-toggles {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-checkbox-label input {
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

.detail-svg-viewport {
  flex: 1;
  background: #06090e;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.screen-detail-svg {
  background: #ffffff;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  max-width: 95%;
  max-height: 90%;
}

/* MONITOR DE PUERTOS NOVASTAR INFERIOR */
.ports-monitor-panel {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 160px;
  overflow-y: auto;
}

.pmp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pmp-header strong {
  font-size: 0.78rem;
  color: #fff;
}

.pmp-header small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ports-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.port-monitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--port-c, var(--accent-cyan));
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pmc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pmc-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}

.pmc-percent {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--port-c, var(--accent-cyan));
}

.pmc-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.pmc-bar-fill {
  height: 100%;
  background: var(--port-c, var(--accent-cyan));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.pmc-bar-fill.overloaded {
  background: var(--accent-red) !important;
}

.pmc-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.625rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   VISTA 3: ESCENARIO 3D (THREE.JS)
   ========================================================================== */
.stage-3d-toolbar {
  height: 44px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.s3t-info strong {
  font-size: 0.78rem;
  color: #fff;
  margin-right: 0.5rem;
}

.s3t-info small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.stage-3d-canvas-wrap {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   VISTA 4: LOGÍSTICA & ANVIL
   ========================================================================== */
.logistics-page-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.logistics-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logistics-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
}

.logistics-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.logistics-kpis-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kpi-icon {
  font-size: 1.6rem;
}

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
}

.kpi-value.cyan {
  color: var(--accent-cyan);
}

.kpi-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.logistics-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.ltc-header h3 {
  font-size: 0.875rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.85rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.logistics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.logistics-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.55rem 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.logistics-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  white-space: nowrap;
}

.logistics-table tr:hover td {
  background: rgba(0, 240, 255, 0.03);
}

.hardware-recommendation-card {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hrc-icon {
  font-size: 2rem;
}

.hrc-info h4 {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 0.25rem;
}

.hrc-info p {
  font-size: 0.75rem;
  color: var(--text-main);
}

/* ==========================================================================
   SCROLLBARS ESTILO PRO-AV
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ==========================================================================
   CONSTRUCTOR v2: METROS / MÓDULOS · COMBINACIÓN 50×50 + 50×100
   ========================================================================== */
.seg-control {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn:hover { color: var(--text-main); }

.seg-btn.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.45);
}

.seg-small .seg-btn { font-size: 0.65rem; padding: 0.25rem 0.35rem; }

.modules-inputs-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.mix-box {
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mix-box .toggle-checkbox-label { color: #e9d5ff; font-size: 0.7rem; }

.mix-pos-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.mix-pos-row .seg-control { flex: 1; }

.fit-notice {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
}

.live-counts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.count-chip {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.count-chip.c100 { border-color: rgba(0, 240, 255, 0.45); color: var(--accent-cyan); }
.count-chip.c50 { border-color: rgba(168, 85, 247, 0.5); color: #d8b4fe; }
.count-chip.case { border-color: rgba(245, 158, 11, 0.5); color: #fcd34d; }
.count-chip.cable { border-color: rgba(16, 185, 129, 0.5); color: #6ee7b7; }

.live-preview-wrap {
  background: #05070b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.live-preview-head {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 0.3rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.live-preview-svg {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.live-preview-svg svg {
  width: 100%;
  height: auto;
  max-height: 220px;
}

/* Cableado dibujado sobre las cajas de la mesa de salida */
.box-cabling-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.btn-preview {
  background: rgba(168, 85, 247, 0.15);
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.5);
}

.btn-preview:hover {
  background: rgba(168, 85, 247, 0.28);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);
}

/* El plano del detalle ya tiene fondo blanco propio */
.screen-detail-svg {
  width: 100%;
  height: auto;
  max-height: none;
}

/* ==========================================================================
   MODAL DE VISTA PREVIA
   ========================================================================== */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.preview-modal.open { display: block; }

.preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.82);
  backdrop-filter: blur(6px);
}

.preview-modal-dialog {
  position: absolute;
  inset: 2.5vh 2.5vw;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pmIn 0.18s ease-out;
}

@keyframes pmIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.pm-title-wrap h2 { font-size: 1rem; font-weight: 900; color: #fff; }
.pm-title-wrap small { font-size: 0.7rem; color: var(--text-muted); }

.pm-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pm-page-info {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.pm-body {
  flex: 1;
  overflow: auto;
  background: #1a1f29;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.pm-body svg {
  width: 100%;
  max-width: 1400px;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}
