:root {
  /* Superficies y paleta clara vanguardista (Stitch · Teseracto) */
  --bg: #f1f5f9;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-solid: #ffffff;
  --panel-subtle: #f8fafc;
  --panel-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-med: #cbd5e1;
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #475569;
  --muted-light: #64748b;
  --accent: #0284c7;
  --accent-dark: #0369a1;
  --accent-soft: #e0f2fe;
  --accent-dim: rgba(2, 132, 199, 0.11);
  --hover: rgba(15, 23, 42, 0.045);
  --shadow-soft: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 12px 32px -4px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);

  /* Familias tipográficas definidas */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  /* Escala tipográfica estricta */
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --lh-tight: 1.25;
  --lh-xs: 1.35;
  --lh-sm: 1.45;
  --lh-md: 1.4;

  /* Retícula espacial de 4px y proporciones estandarizadas */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-pill: 999px;

  /* Alturas y geometría del espacio de trabajo */
  --tes-topbar-tabs-h: 40px;
  --tes-topbar-panels-h: 40px;
  --tes-topbar-h: 80px;
  --tes-statusbar-h: 28px;
  --tes-ticker-h: 24px;
  --tes-bottom-h: 52px;
  --tes-gap: 12px;
  --tes-dock-top: 92px;
  --tes-dock-bottom: 64px;
  --tes-left-w: 310px;
  --tes-right-w: 304px;
  --h-ctrl-xs: 22px;
  --h-ctrl-sm: 28px;
  --h-ctrl-md: 30px;
  --h-panel-head: 36px;
}

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

html,
body {
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

.mobile-only-btn,
.mobile-nav-dock,
.mobile-thumb-bar,
.mobile-sel-bar,
.mobile-sheet-backdrop,
.mobile-visual-popover {
  display: none;
}

/* Overlay Plantas Interactivas Cancelería y Puertas (escritorio + móvil) */
.tas-plantas-overlay {
  position: fixed;
  inset: 0;
  z-index: 9400;
  background: rgba(15, 23, 42, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.tas-plantas-card {
  width: 100%;
  max-width: 1520px;
  height: 92vh;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid #cbd5e1;
}

.tas-plantas-bar {
  min-height: 40px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  flex-shrink: 0;
}

.tas-plantas-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.tas-plantas-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tas-plantas-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tas-plantas-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tas-plantas-ext {
  color: #38bdf8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tas-plantas-close {
  background: #334155;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  height: 26px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tas-plantas-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #ffffff;
}

.hidden {
  display: none !important;
}

/* =========================================================================
   1. CINTA SUPERIOR PROPORCIONAL (40px + 40px = 80px)
   ========================================================================= */
.topbar.tes-ribbon-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tes-topbar-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--border-med);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  z-index: 40;
}

.ribbon-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--tes-topbar-tabs-h);
  padding: 0 10px;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--border);
  gap: 6px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.topbar-left {
  flex: 1 1 auto;
}

.topbar-right {
  flex: 0 0 auto;
  gap: 4px;
}

.tes-app-badge {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}

.tes-app-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.tes-menu-trigger {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.tes-menu-trigger:hover,
.tes-menu-trigger[aria-expanded="true"] {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.tes-app-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 196px;
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  padding: var(--sp-1);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tes-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--r-xs);
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-strong);
  cursor: pointer;
  white-space: nowrap;
}

.tes-menu-item:hover {
  background: var(--panel-muted);
  color: var(--accent-dark);
}

.tes-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

.brand {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  white-space: nowrap;
  padding-right: var(--sp-2);
  border-right: 1px solid var(--border);
  max-width: 176px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.tes-ribbon-tabs {
  display: flex;
  align-items: stretch;
  height: var(--tes-topbar-tabs-h);
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.tes-ribbon-tabs::-webkit-scrollbar {
  display: none;
}

.tes-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  height: 100%;
  padding: 0 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.tes-tab-btn:hover {
  color: var(--text-strong);
  background: var(--hover);
}

.tes-tab-btn.file-tab {
  background: #1e3a5f;
  color: #ffffff;
  border-radius: var(--r-xs);
  height: var(--h-ctrl-sm);
  margin: auto 4px auto 0;
  padding: 0 10px;
  font-weight: 600;
}

.tes-tab-btn.file-tab.active,
.tes-tab-btn.file-tab:hover {
  background: var(--accent);
  color: #ffffff;
}

.tes-tab-btn.active:not(.file-tab) {
  color: var(--accent);
  background: transparent;
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.ribbon-panels-bar {
  height: var(--tes-topbar-panels-h);
  display: flex;
  align-items: center;
  background: var(--panel-subtle);
  padding: 0 var(--sp-3);
}

.tes-ribbon-panel {
  display: none;
  align-items: center;
  width: 100%;
  height: 100%;
}

.tes-ribbon-panel.active {
  display: flex;
}

.ribbon-empty-hint {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted-light);
  user-select: none;
}

#ribbon-arquitectura-panel,
#ribbon-modify-panel,
#ribbon-vista-panel,
#ribbon-presupuestos-panel,
#ribbon-rfi-panel {
  gap: var(--sp-2);
}

.ribbon-cmd-group {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding-right: var(--sp-3);
  border-right: 1px solid var(--border);
  height: var(--h-ctrl-md);
}

.ribbon-group-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 3px;
  user-select: none;
  white-space: nowrap;
}

.ribbon-cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--h-ctrl-md);
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.ribbon-cmd-btn--accent {
  color: var(--accent-dark);
  font-weight: 600;
}

.ribbon-cmd-btn--success {
  color: #047857;
  font-weight: 600;
}

.ribbon-cmd-btn--danger {
  color: #b91c1c;
  font-weight: 600;
}

.ribbon-cmd-btn--strong {
  color: var(--text-strong);
  font-weight: 600;
}

.ribbon-cmd-btn.ribbon-icon-only {
  width: var(--h-ctrl-md);
  height: var(--h-ctrl-md);
  padding: 0;
  justify-content: center;
}

.ribbon-cmd-btn:hover {
  background: var(--panel-muted);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.ribbon-cmd-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.ribbon-cmd-glyph {
  font-size: var(--fs-md);
  line-height: 1;
  color: var(--accent-dark);
}

.ribbon-group-label {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  user-select: none;
}

.mcp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--h-ctrl-sm);
  padding: 0 7px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--panel-subtle);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

#btn-history {
  font-family: var(--font-mono);
}

.pill-btn {
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pill-btn:hover {
  background: var(--panel-muted);
  border-color: var(--border-med);
  color: var(--text-strong);
}

.mcp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.mcp-dot.online {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

body.ribbon-compact .topbar.tes-ribbon-topbar {
  height: var(--tes-topbar-tabs-h);
}

body.ribbon-compact .ribbon-panels-bar {
  display: none;
}

body.ribbon-compact .view-panel {
  top: var(--tes-topbar-tabs-h);
}

body.ribbon-compact .side-drawer,
body.ribbon-compact .side-right,
body.ribbon-compact .lateral-tabs-bar,
body.ribbon-compact .rfi-drawer,
body.ribbon-compact .hvac-audit-panel,
body.ribbon-compact .stair-module-panel {
  top: calc(var(--tes-topbar-tabs-h) + 12px);
}

body.ribbon-compact .viewcube-hud {
  top: calc(var(--tes-topbar-tabs-h) + 16px);
}

/* =========================================================================
   2. BOTONES BASE Y ALERTA DE SUBPROYECTO
   ========================================================================= */
.btn {
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  height: var(--h-ctrl-sm);
  padding: 0 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn:hover {
  background: var(--panel-muted);
  color: var(--text-strong);
  border-color: #94a3b8;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: var(--fs-md);
  line-height: 1;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-icon:hover {
  background: var(--panel-muted);
  border-color: var(--border);
  color: var(--text-strong);
}

.btn-primary-sm {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #ffffff;
  font-weight: 600;
}

.btn-primary-sm:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.workset-alert-banner {
  position: fixed;
  top: var(--tes-dock-top);
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 12px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-soft);
  font-size: var(--fs-sm);
  color: #78350f;
}

.alert-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d97706;
  color: #ffffff;
  font-weight: 700;
  font-size: var(--fs-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compact-select {
  height: var(--h-ctrl-sm);
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  border-radius: var(--r-sm);
  padding: 0 8px;
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  color: var(--text-strong);
}

/* =========================================================================
   3. VIEWPORT CENTRAL 3D
   ========================================================================= */
.view-panel {
  position: fixed;
  top: var(--tes-topbar-h);
  left: 0;
  right: 0;
  bottom: var(--tes-bottom-h);
  background: radial-gradient(circle at 50% 42%, #f8fafc 0%, #e5ecf4 100%);
}

body.viz-paper-bg .view-panel {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

body.plan-2d-mode #btn-sb-section-box {
  display: none;
}

#canvas-wrap,
#canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}

.lateral-tabs-bar {
  position: fixed;
  top: var(--tes-dock-top);
  left: var(--tes-gap);
  z-index: 32;
  display: inline-flex;
  gap: var(--sp-1);
}

.lateral-tab {
  background: var(--panel);
  border-color: var(--border-med);
  color: var(--text-strong);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

/* =========================================================================
   4. NAVEGADOR DE PROYECTOS (IZQUIERDA) Y PROPIEDADES (DERECHA)
   ========================================================================= */
.side-drawer {
  position: fixed;
  top: var(--tes-dock-top);
  left: var(--tes-gap);
  width: var(--tes-left-w);
  bottom: var(--tes-dock-bottom);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.side-right {
  position: fixed;
  top: var(--tes-dock-top);
  right: var(--tes-gap);
  width: var(--tes-right-w);
  bottom: var(--tes-dock-bottom);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.side-right.collapsed,
.floating-window.collapsed {
  bottom: auto !important;
  height: auto !important;
}

.side-right.collapsed > :not(.panel-head),
.floating-window.collapsed > :not(.panel-head) {
  display: none !important;
}

.floating-window.collapsed > .panel-head {
  border-bottom: none;
}

.floating-window {
  min-width: 224px;
  min-height: 160px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 156px);
}

.floating-window.collapsed {
  min-height: 0;
}

.floating-drag-handle {
  cursor: move;
  user-select: none;
}

.floating-window.dragging {
  opacity: 0.94;
  box-shadow: var(--shadow-elevated);
}

.win-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  border-right: 2px solid var(--border-med);
  border-bottom: 2px solid var(--border-med);
  border-bottom-right-radius: 3px;
  opacity: 0.7;
}

.win-resize-handle:hover {
  border-color: var(--accent);
  opacity: 1;
}

.win-resize-edge-left,
.win-resize-edge-right {
  position: absolute;
  top: 8px;
  bottom: 16px;
  width: 6px;
  cursor: col-resize;
  z-index: 8;
  border-radius: 3px;
  transition: background 0.12s;
}

.win-resize-edge-left {
  left: -2px;
}

.win-resize-edge-right {
  right: -2px;
}

.win-resize-edge-left:hover,
.win-resize-edge-right:hover,
.win-resize-edge-left.active,
.win-resize-edge-right.active {
  background: rgba(2, 132, 199, 0.45);
}

.tes-prop-desc-box {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: var(--text-strong);
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-2) 10px;
  margin: var(--sp-1) 0 var(--sp-2);
  word-break: break-word;
}

.tes-prop-param-chip {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  background: var(--border);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  margin-left: var(--sp-1);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  height: var(--h-panel-head);
  padding: 0 var(--sp-3);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tes-tree-root {
  flex: 1;
  overflow-y: auto;
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  padding: var(--sp-2) 10px;
}

.rtree-node {
  margin-bottom: var(--sp-1);
}

.rtree-header,
.rtree-subheader {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 6px;
  border-radius: var(--r-xs);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-strong);
  user-select: none;
}

.rtree-subheader {
  font-weight: 500;
  color: var(--muted);
  padding-left: 16px;
}

.rtree-header:hover,
.rtree-subheader:hover {
  background: var(--hover);
}

.rtree-caret {
  width: 12px;
  font-size: var(--fs-xs);
  color: var(--muted-light);
  display: inline-block;
  text-align: center;
}

.rtree-children,
.rtree-subchildren {
  display: none;
}

.rtree-node.open > .rtree-children {
  display: block;
}

.rtree-subnode.open > .rtree-subchildren {
  display: block;
}

.rtree-item {
  min-height: 26px;
  padding: 3px 8px 3px 26px;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rtree-item:hover {
  background: var(--hover);
}

.rtree-item.active {
  background: var(--accent-dim);
  color: var(--accent-dark);
  font-weight: 600;
}

.rtree-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.rtree-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted-light);
  flex-shrink: 0;
}

.ws-owner-tag {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--panel-subtle);
  color: var(--muted);
  flex-shrink: 0;
}

.ws-owner-tag.mine {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.ws-owner-tag.busy {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

.ws-owner-tag.guest {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

.mcp-pill.is-guest {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.tes-type-selector {
  background: var(--panel-subtle);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  margin: var(--sp-2) 10px var(--sp-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.props-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-1) 10px var(--sp-2);
}

.tes-props-section-hdr {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  padding: 5px 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: var(--sp-2);
}

.tes-props-section-hdr:first-child {
  margin-top: 0;
}

.tes-props-origin-group {
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  margin-bottom: var(--sp-2);
  overflow: hidden;
}

.tes-props-origin-group:last-child {
  margin-bottom: 0;
}

.tes-props-origin-hdr {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px;
  border: none;
  border-left: 3px solid var(--muted);
  background: var(--panel-subtle);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}

.tes-props-origin-group.is-teseracto > .tes-props-origin-hdr {
  border-left-color: var(--accent);
}

/* Modo sombreado para Parámetros de Revit (diferenciación visual vs. Datos internos de Teseracto) */
.tes-props-origin-group.is-revit {
  background: #edf1f6;
  border-color: #cbd5e1;
}

.tes-props-origin-group.is-revit > .tes-props-origin-hdr {
  background: #e2e8f0;
  color: #475569;
  border-left-color: #94a3b8;
}

.tes-props-origin-group.is-revit > .tes-props-origin-hdr:hover {
  background: #d8e1ec;
}

.tes-props-origin-group.is-revit > .tes-props-origin-body {
  background: #f1f5f9;
}

.tes-props-origin-group.is-revit .tes-props-section-hdr {
  background: #e5ebf3;
  color: #64748b;
  border-color: #d3dce6;
}

.tes-props-origin-group.is-revit .tes-prop-row {
  background: #f1f5f9;
  border-color: #d8e0ea;
}

.tes-props-origin-group.is-revit .tes-prop-k {
  color: #64748b;
}

.tes-props-origin-group.is-revit .tes-prop-v {
  color: #475569;
}

.tes-props-origin-group.is-revit .tes-prop-desc-box {
  background: #e9eef5;
  border-color: #cbd5e1;
  color: #475569;
}

.tes-props-origin-group.is-revit .compact-select {
  background: #e8eef4;
  border-color: #cbd5e1;
  color: #475569;
}

.tes-props-origin-group.is-revit .compact-select:focus {
  background: #f8fafc;
  color: #1e293b;
}

.tes-props-origin-hdr:hover {
  background: var(--hover);
}

.tes-props-origin-group.open > .tes-props-origin-hdr {
  border-bottom: 1px solid var(--border);
}

.tes-props-origin-caret {
  display: inline-block;
  width: 12px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted-light);
  transition: transform 0.14s ease;
  flex-shrink: 0;
}

.tes-props-origin-group:not(.open) > .tes-props-origin-hdr > .tes-props-origin-caret {
  transform: rotate(-90deg);
}

.tes-props-origin-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tes-props-origin-body {
  display: none;
}

.tes-props-origin-group.open > .tes-props-origin-body {
  display: block;
}

.tes-props-origin-body > .tes-props-section-hdr {
  border-left: none;
  border-right: none;
  border-top: none;
  margin-top: 0;
}

.tes-props-origin-body > :not(.tes-prop-row):not(.tes-props-section-hdr) + .tes-props-section-hdr {
  border-top: 1px solid var(--border);
}

.tes-props-origin-body > .tes-prop-row,
.tes-props-origin-body > .props-actions-row,
.tes-props-origin-body > .props-lock-note {
  border-left: none;
  border-right: none;
}

.tes-props-origin-body > .tes-prop-row:last-child,
.tes-props-origin-body > .props-actions-row:last-child,
.tes-props-origin-body > .props-lock-note:last-child {
  border-bottom: none;
}

.props-scroll-body > .props-actions-row {
  margin-bottom: var(--sp-2);
}

.tes-props-origin-body > .tes-prop-desc-box {
  margin: var(--sp-1) 8px var(--sp-2);
}

.tes-props-origin-body > .hvac-prop-card,
.tes-props-origin-body > .prop-ckt-pills-wrap,
.tes-props-origin-body > .prop-wire-card,
.tes-props-origin-body > #tes-prop-canceleria-details-card {
  margin-left: 8px !important;
  margin-right: 8px !important;
}

.tes-props-origin-body > .plan-anno-grid {
  border-left: none;
  border-right: none;
}

.tes-prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-top: none;
  font-size: var(--fs-sm);
  background: var(--panel-solid);
}

.tes-prop-k {
  color: var(--muted);
  flex: 0 0 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tes-prop-v {
  flex: 1;
  text-align: right;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tes-prop-row > .compact-select {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tes-prop-row.tes-prop-row-ws {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 5px 8px 6px;
}

.tes-prop-row.tes-prop-row-ws > .tes-prop-k {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
}

.tes-prop-row.tes-prop-row-ws > .compact-select {
  width: 100%;
  max-width: 100%;
  padding: 3px 22px 3px 6px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tes-prop-warn {
  color: #b45309;
  font-weight: 600;
}

.tes-link-inline-btn {
  border: none;
  background: transparent;
  color: #0369a1;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 4px;
  text-decoration: underline;
}

.tes-supplier-action-row {
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--border);
}

.tes-supplier-results {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tes-supplier-results.hidden {
  display: none;
}

.tes-sup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-subtle, #f8fafc);
}

.tes-sup-item-main {
  min-width: 0;
  flex: 1;
}

.tes-sup-item-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tes-sup-item-meta {
  font-size: 10px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tes-sup-tag {
  font-size: 9.5px;
  font-weight: 600;
  color: #0369a1;
}

.tes-sup-tag.alta {
  color: #15803d;
}

.tes-sup-custom-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.tes-sup-custom-row input {
  flex: 1;
  min-width: 0;
  font-size: 11px;
}

.tes-sup-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
  padding-top: 2px;
}

.tes-sup-footer-row a {
  color: #0369a1;
  text-decoration: underline;
  font-weight: 500;
}

.tes-prop-editable {
  cursor: text;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background 0.12s;
}

.tes-prop-editable:hover {
  background: var(--hover);
  text-decoration: underline dotted var(--muted);
}

.tes-prop-inline-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: var(--h-ctrl-sm);
  padding: 0 6px;
  font-size: var(--fs-sm);
  text-align: right;
}

.vt-save-row,
.vt-preset-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
}

.vt-save-row input,
.vt-preset-bar select {
  flex: 1;
  min-width: 0;
}

.iso-level-popover {
  width: 300px;
}

.iso-level-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iso-offsets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.iso-offset-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.iso-offset-field input {
  height: var(--h-ctrl-sm);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  padding: 0 6px;
  font-size: var(--fs-sm);
  color: var(--text-strong);
  background: var(--panel-solid);
  width: 100%;
}

.iso-level-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  background: var(--panel-solid);
}

.iso-level-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-strong);
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: left;
}

.iso-level-item:hover {
  background: var(--hover);
}

.iso-level-item.active {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
}

.iso-actions-row {
  display: flex;
  gap: 6px;
}

.iso-actions-row .btn {
  flex: 1;
}

.hist-tabs-row {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
  flex-shrink: 0;
}

.hist-tab-btn {
  flex: 1;
  height: 24px;
  border: 1px solid var(--border-med);
  border-radius: 4px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.hist-tab-btn.active {
  background: #0284c7;
  border-color: #0369a1;
  color: #ffffff;
}

#popover-history,
#popover-sync {
  width: min(94vw, 390px);
}

.sync-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  flex-shrink: 0;
}

.sync-last-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #bae6fd;
  border-radius: var(--r-sm);
  background: #f0f9ff;
  flex-shrink: 0;
}

.sync-last-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sync-last-kicker {
  font-size: 10px;
  font-weight: 600;
  color: #0369a1;
  letter-spacing: 0.02em;
}

.sync-last-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-last-sub {
  font-size: 11px;
  color: #475569;
  line-height: 1.35;
}

.sync-acc-group {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  overflow: hidden;
}

.sync-acc-head {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text-strong);
  font-family: inherit;
  line-height: 1.35;
}

.sync-acc-head:hover {
  background: #f8fafc;
}

.sync-acc-caret {
  width: 12px;
  flex-shrink: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.sync-acc-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sync-acc-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sync-acc-ver {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #0369a1;
}

.sync-acc-count {
  font-size: 10.5px;
  font-weight: 500;
  color: #475569;
}

.sync-acc-sub {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.3;
}

.sync-acc-body {
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.sync-acc-body.hidden {
  display: none;
}

.sync-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px 5px 22px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.sync-file-item:last-child {
  border-bottom: 0;
}

.sync-file-item:hover {
  background: #f1f5f9;
}

.sync-file-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sync-file-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-file-sub {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.3;
}

.sync-mod-note {
  padding: 5px 8px 6px 22px;
  font-size: 10.5px;
  color: #475569;
  line-height: 1.4;
}

.sync-imported-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  overflow: hidden;
  flex-shrink: 0;
}

.sync-imported-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.sync-imported-row:last-child {
  border-bottom: 0;
}

.sync-imported-row:hover {
  background: #f8fafc;
}

.sync-imported-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.sync-imported-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sync-imported-code {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
}

.sync-imported-sub {
  font-size: 10.5px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-state-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sync-state-tag.ok {
  color: #0f766e;
  background: #ccfbf1;
}

.sync-state-tag.pull {
  color: #0369a1;
  background: #e0f2fe;
}

.sync-state-tag.push {
  color: #9a3412;
  background: #ffedd5;
}

.sync-state-tag.both {
  color: #6d28d9;
  background: #ede9fe;
}

.sync-state-tag.cloud {
  color: #475569;
  background: #f1f5f9;
}

.sync-row-btn {
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.2;
  min-width: 26px;
  flex-shrink: 0;
}

.sync-row-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.tes-update-banner {
  position: fixed;
  top: calc(var(--tes-topbar-h, 76px) + 8px);
  right: 14px;
  z-index: 950;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(6px);
  font-size: 11.5px;
  font-weight: 500;
}

.tes-update-banner-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.tes-update-banner-close:hover {
  color: #ffffff;
}

.props-actions-row {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--panel-subtle);
}

.props-actions-row .btn {
  flex: 1;
  text-align: center;
  font-size: var(--fs-xs);
  height: 26px;
}

.props-lock-note {
  padding: 6px 8px;
  font-size: var(--fs-xs);
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-top: none;
}

.props-lock-note.guest-ro {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.mat-swatch-inline {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  vertical-align: middle;
  margin-right: 5px;
}

/* =========================================================================
   5. POPOVERS, HISTORIAL, BARRA IA Y MODAL LOGIN
   ========================================================================= */
.floating-popover {
  position: fixed;
  top: var(--tes-dock-top);
  right: var(--tes-gap);
  width: 312px;
  max-height: 70vh;
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  padding: 0;
  box-shadow: var(--shadow-elevated);
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 224px;
  min-height: 110px;
  overflow: hidden;
}

.floating-popover.floating-detached {
  max-height: none;
}

.floating-popover .popover-list,
.floating-popover .chat-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.floating-popover.dragging,
.budget-viewer-panel.dragging,
.rfi-drawer.dragging,
.tes-overlay-card.dragging {
  opacity: 0.94;
  box-shadow: var(--shadow-elevated);
}

.mosaic-snap-preview {
  position: fixed;
  z-index: 55;
  pointer-events: none;
  background: rgba(2, 132, 199, 0.14);
  border: 2px dashed var(--accent);
  border-radius: var(--r-md);
  transition: left 0.08s ease, top 0.08s ease, width 0.08s ease, height 0.08s ease;
}

.popover-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-2) 10px;
}

.popover-list > * {
  flex-shrink: 0;
}

.popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.popover-row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.popover-row-title {
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-row-sub {
  font-size: var(--fs-xs);
  color: var(--muted-light);
}

.ai-popover {
  width: min(92vw, 376px);
  max-height: 70vh;
  padding: 0;
  overflow: hidden;
}

.ai-panel-head {
  padding: 0 10px 0 var(--sp-3);
  gap: 6px;
  flex-shrink: 0;
}

.ai-head-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ai-project-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-project-tag.muted {
  color: var(--muted);
  background: var(--panel-muted);
}

.ai-head-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.ai-head-controls .btn-icon.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

.ai-guides-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: var(--fs-xs);
  background: #f0f9ff;
  border-top: 1px solid #bae6fd;
  color: #0c4a6e;
}

.ai-guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  font-weight: 600;
}

.ai-guides-clear {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #0369a1;
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 4px;
}

.ai-model-select {
  height: 26px;
  font-size: var(--fs-xs);
  padding: 0 6px;
  max-width: 124px;
}

.ai-config-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-2) 10px;
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-conn-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ai-key-form {
  display: flex;
  gap: 6px;
}

.ai-key-form input {
  flex: 1;
  min-width: 0;
  height: var(--h-ctrl-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 0 8px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  outline: none;
}

.ai-key-form input:focus {
  border-color: var(--accent);
}

.ai-messages-body {
  min-height: 150px;
  max-height: 44vh;
}

.ai-msg-text {
  white-space: pre-wrap;
}

.chat-msg.ai-blocked {
  background: #fef2f2;
  color: #991b1b;
}

.ai-mic-btn {
  width: var(--h-ctrl-md);
  height: var(--h-ctrl-md);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
  background: var(--panel-subtle);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.ai-mic-btn:hover {
  background: var(--panel-muted);
  border-color: #94a3b8;
}

.ai-mic-btn.listening,
.voice-mcp-pill.listening {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  animation: rfiMicPulse 1.1s ease-in-out infinite;
}

.voice-mcp-pill {
  gap: 4px;
  padding-left: 7px;
  padding-right: 7px;
}

#btn-ai-tts.muted {
  opacity: 0.45;
}

/* Modo exclusivo de modelado 3D para usuarios externos */
body.external-modeling-only #btn-online,
body.external-modeling-only #btn-critical-alerts,
body.external-modeling-only #btn-chat,
body.external-modeling-only #btn-access-requests,
body.external-modeling-only #mcp-status-pill,
body.external-modeling-only #btn-cmd-addin-download,
body.external-modeling-only [data-rtab="presupuestos"],
body.external-modeling-only [data-rtab="rfi"],
body.external-modeling-only [data-rtab="analizar"],
body.external-modeling-only [data-rtab="colaborar"],
body.external-modeling-only [data-rtab="gestionar"],
body.external-modeling-only [data-rtab="insertar"],
body.external-modeling-only [data-rtab="anotar"],
body.external-modeling-only [data-rtab="masa"],
body.external-modeling-only [data-rtree-node="incidencias"] {
  display: none !important;
}

.ai-sys-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.ai-sys-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.ai-sys-card:hover {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.ai-sys-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.ai-sys-title {
  font-weight: 600;
  color: var(--text-strong);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-sys-status {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  flex-shrink: 0;
}

.ai-sys-status.ok {
  background: #dcfce7;
  color: #166534;
}

.ai-sys-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.ai-sys-meta {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--sp-1);
}

.ai-sys-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-1);
}

.ai-sys-actions .btn {
  font-size: var(--fs-xs);
  height: 24px;
  padding: 0 8px;
  text-decoration: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
}

.modal-card {
  width: 320px;
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}

.field-input {
  width: 100%;
  height: var(--h-ctrl-md);
  padding: 0 10px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  background: var(--panel-solid);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-2);
}

.auth-gate {
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(8px);
  z-index: 200;
}

.auth-card {
  width: 332px;
  padding: 24px 22px 20px;
  gap: var(--sp-4);
  border-radius: var(--r-md);
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 0 4px;
}

.auth-brand-logo {
  width: 224px;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  user-select: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-platforms-slot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.btn-google-signin {
  width: 100%;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.btn-google-signin:hover {
  background: var(--panel-subtle);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.google-g-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.auth-error {
  font-size: var(--fs-xs);
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  padding: var(--sp-2) 10px;
}

.auth-beta-link {
  display: block;
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  text-decoration: none;
}

.auth-beta-link:hover {
  color: #0c4a6e;
  text-decoration: underline;
}

.tes-prop-check {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

.btn-inline-link {
  background: transparent;
  border: none;
  color: var(--accent-dark);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-inline-link:hover {
  text-decoration: underline;
}

/* =========================================================================
   6. VIEWCUBE 3D Y BARRA INFERIOR
   ========================================================================= */
.viewcube-hud {
  position: fixed;
  top: calc(var(--tes-dock-top) + 4px);
  right: calc(var(--tes-right-edge, var(--tes-right-w)) + var(--tes-gap) + 16px);
  width: 88px;
  height: 88px;
  z-index: 28;
  user-select: none;
  touch-action: none;
  transition: right 0.15s ease;
}

body.props-hidden .viewcube-hud {
  right: 20px;
}

body.plan-2d-mode .viewcube-hud {
  display: none;
}

.vc-home-btn {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: var(--fs-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}

.vc-home-btn:hover {
  color: var(--accent-dark);
  background: var(--panel-solid);
}

.vc-scene {
  width: 100%;
  height: 100%;
  perspective: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vc-compass {
  position: absolute;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 1.5px solid rgba(100, 116, 139, 0.35);
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.vc-dir {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: #334155;
}

.vc-n { top: 1px; left: 50%; transform: translateX(-50%); color: #dc2626; }
.vc-s { bottom: 1px; left: 50%; transform: translateX(-50%); }
.vc-e { right: 3px; top: 50%; transform: translateY(-50%); }
.vc-o { left: 3px; top: 50%; transform: translateY(-50%); }

.vc-cube {
  width: 46px;
  height: 46px;
  position: relative;
  transform-style: preserve-3d;
}

.vc-face {
  position: absolute;
  width: 46px;
  height: 46px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid #64748b;
  color: #1e293b;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backface-visibility: hidden;
  transition: background 0.12s, color 0.12s;
}

.vc-face:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-dark);
}

.vc-face.has-corner-hover {
  background: rgba(241, 245, 249, 0.95);
  color: #1e293b;
  border-color: #64748b;
}

.vc-corner {
  position: absolute;
  width: 11px;
  height: 11px;
  z-index: 4;
  background: transparent;
  transition: background 0.1s ease;
}

.vc-tl { top: -1px; left: -1px; border-bottom-right-radius: 3px; }
.vc-tr { top: -1px; right: -1px; border-bottom-left-radius: 3px; }
.vc-bl { bottom: -1px; left: -1px; border-top-right-radius: 3px; }
.vc-br { bottom: -1px; right: -1px; border-top-left-radius: 3px; }

.vc-corner:hover,
.vc-corner.corner-hover {
  background: var(--accent);
}

.vc-front  { transform: translateZ(23px); }
.vc-back   { transform: rotateY(180deg) translateZ(23px); }
.vc-right  { transform: rotateY(90deg) translateZ(23px); }
.vc-left   { transform: rotateY(-90deg) translateZ(23px); }
.vc-top    { transform: rotateX(90deg) translateZ(23px); background: rgba(226, 232, 240, 0.96); }
.vc-bottom { transform: rotateX(-90deg) translateZ(23px); background: rgba(203, 213, 225, 0.96); }

.tes-statusbar {
  position: fixed;
  bottom: var(--tes-ticker-h);
  left: 0;
  right: 0;
  height: var(--tes-statusbar-h);
  background: var(--panel-solid);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  z-index: 40;
}

.sb-left {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-right {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#sb-counts,
#sb-app-version {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

#sb-app-version {
  cursor: pointer;
}

#sb-app-version:hover {
  color: #0369a1;
  text-decoration: underline;
}

.sb-sep {
  color: var(--border-med);
}

.sb-workset-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.sb-icon-btn {
  width: var(--h-ctrl-xs);
  height: var(--h-ctrl-xs);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.sb-icon-btn:hover {
  background: var(--panel-muted);
  border-color: var(--border-med);
}

.sb-icon-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.sb-icon-btn.has-missing::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #f59e0b;
}

.sb-workset-select {
  height: var(--h-ctrl-xs);
  max-width: 204px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--text-strong);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xs);
  padding: 0 6px;
}

.worksets-popover {
  top: auto !important;
  bottom: var(--tes-dock-bottom);
  right: var(--tes-gap);
  left: auto !important;
  width: 344px;
  max-height: 360px;
}

.visual-style-popover {
  top: auto !important;
  bottom: var(--tes-dock-bottom);
  left: 68px;
  right: auto !important;
  width: 204px;
}

.detail-level-popover {
  left: 52px;
  width: 156px;
}

.viz-switches-block {
  margin-top: var(--sp-1);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viz-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: var(--fs-sm);
  color: var(--text-strong);
  border-radius: var(--r-xs);
  cursor: pointer;
  user-select: none;
}

.viz-switch-row:hover {
  background: var(--panel-muted);
}

.viz-switch-row input[type='checkbox'] {
  accent-color: var(--accent);
  cursor: pointer;
}

.vis-tree-popover {
  top: var(--tes-dock-top);
  left: var(--tes-gap);
  right: auto;
  width: 500px;
  min-width: 390px;
  max-width: 94vw;
  min-height: 240px;
  max-height: 85vh;
  resize: both;
  overflow: auto;
}

.vis-tree-body {
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: calc(74vh - 38px);
  overflow-y: auto;
}

.vis-tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px var(--sp-1) 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-1);
}

.vis-tree-summary {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vt-mode-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
}

.vt-mode-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.4;
}

.vt-mode-tab.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.vt-ht-elems {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.vt-ht-elems-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-muted);
  border-bottom: 1px solid var(--border);
}

.vg-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 64px 78px 42px;
  align-items: center;
  gap: 4px;
}

.vg-table-head {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  padding: 4px 6px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.vg-table-head .vg-col-ht,
.vg-table-head .vg-col-tr,
.vg-table-head .vg-col-cnt {
  text-align: center;
}

.vg-table-rows {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}

.vg-col-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.vg-col-ht {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vg-col-tr {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vg-col-cnt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.vg-empty-cell {
  font-size: 10px;
  color: var(--muted-light);
  opacity: 0.6;
}

.vis-tree-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  font-size: var(--fs-sm);
  color: var(--text-strong);
  user-select: none;
}

.vis-tree-node-row:hover {
  background: var(--hover);
}

.vis-tree-node-row.lvl-bldg {
  font-weight: 600;
  background: var(--panel-muted);
}

.vis-tree-node-row.lvl-file {
  font-weight: 600;
  background: rgba(241, 245, 249, 0.55);
}

.vis-tree-node-row.lvl-file .vg-col-name {
  padding-left: 8px;
}

.vis-tree-node-row.lvl-ws {
  font-weight: 400;
}

.vis-tree-node-row.lvl-ws .vg-col-name {
  padding-left: 24px;
}

.vis-tree-node-row.lvl-ws .rtree-badge {
  min-width: 34px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.vt-step {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 72px;
  height: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
  overflow: hidden;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.vt-step.active {
  border-color: #0284c7;
  background: #f0f9ff;
}

.vt-step.is-mixed {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #64748b;
}

.vt-step-btn {
  width: 18px;
  height: 100%;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 9px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vt-step-btn:hover {
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
}

.vt-step-val {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: #334155;
  cursor: pointer;
  line-height: 1;
}

.vt-step.active .vt-step-val {
  color: #0369a1;
  font-weight: 600;
}

.vt-step.is-mixed .vt-step-val {
  color: #64748b;
  font-weight: 600;
}

/* Vistas clasificadas: Vistas en planos vs Vistas de Teseracto por especialidad */
.rtree-nested-group {
  padding-left: 8px;
}

.rtree-subheader-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rtree-hdr-btns {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.rtree-mini-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0369a1;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.4;
}

.rtree-mini-btn:hover {
  background: #e0f2fe;
  border-color: #0284c7;
}

.rtree-save-view-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 18px;
}

.rtree-save-view-row.hidden {
  display: none;
}

.rtree-save-view-row input {
  flex: 1;
  min-width: 0;
}

.rtree-save-view-row select {
  width: 92px;
}

.rtree-item-tesview {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rtree-item-acts {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.rtree-item-tesview:hover .rtree-item-acts,
.rtree-item-tesview.active .rtree-item-acts {
  opacity: 1;
}

.rtree-act-btn {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  padding: 0 3px;
  border-radius: 2px;
  line-height: 1.2;
}

.rtree-act-btn:hover {
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
}

.rtree-act-btn.danger:hover {
  background: rgba(220, 38, 38, 0.14);
  color: #dc2626;
}

/* Panel flotante: Cálculo Eléctrico (Analizar) */
.elec-calc-panel {
  width: 660px;
  min-width: 440px;
  max-width: 94vw;
  height: 520px;
  max-height: 82vh;
  top: var(--tes-dock-top);
  right: var(--tes-gap);
  left: auto;
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.elec-calc-panel.hidden {
  display: none;
}

.elec-calc-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-muted);
  flex-wrap: wrap;
}

.elec-calc-bar select {
  max-width: 195px;
}

.elec-calc-slice-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-strong);
  cursor: pointer;
  user-select: none;
  margin-left: auto;
}

.elec-calc-kpis {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  background: #ffffff;
}

.elec-kpi b {
  color: var(--text-strong);
  font-family: 'JetBrains Mono', monospace;
}

.elec-kpi.ok {
  color: #047857;
  font-weight: 600;
  margin-left: auto;
}

.elec-kpi.warn {
  color: #b45309;
  font-weight: 600;
  margin-left: auto;
}

.elec-calc-table-wrap {
  flex: 1;
  overflow: auto;
  background: #ffffff;
}

.elec-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.elec-calc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.elec-calc-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-strong);
  white-space: nowrap;
}

.elec-calc-table td.num {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}

.elec-ckt-row {
  cursor: pointer;
}

.elec-ckt-row:hover {
  background: #f0f9ff;
}

.elec-ckt-row.active {
  background: #e0f2fe;
}

.ec-ckt-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.ec-exp-btn {
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
  padding: 0 3px;
  font-size: 11px;
}

.ec-ckt-id {
  font-family: 'JetBrains Mono', monospace;
  color: #0369a1;
}

.ec-mini-inp {
  width: 48px;
  height: 20px;
  padding: 1px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  background: #ffffff;
}

.ec-mini-sel {
  height: 20px;
  padding: 0 3px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-size: 10.5px;
  background: #ffffff;
}

.ec-v-sel {
  width: 56px;
  font-family: 'JetBrains Mono', monospace;
}

.ec-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

.ec-badge.ok {
  background: #dcfce7;
  color: #166534;
}

.ec-badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.elec-sub-row {
  background: #f8fafc;
  cursor: pointer;
}

.elec-sub-row:hover {
  background: #eff6ff;
}

.ec-sub-name {
  padding-left: 20px !important;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-sub-meta {
  font-size: 10px;
  color: var(--muted);
}

.elec-sub-pipe td {
  padding-left: 20px !important;
  font-size: 10.5px;
  color: #0369a1;
  font-style: italic;
}

.elec-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.walk-hud {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  font-size: 11.5px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(6px);
}

.walk-hud.hidden {
  display: none;
}

.walk-hud-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.walk-hud-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.walk-hud-fov {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #cbd5e1;
}

.walk-hud-fov input[type="range"] {
  width: 68px;
  accent-color: #38bdf8;
  cursor: pointer;
}

.walk-hud-keys {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.vis-tree-caret {
  width: 12px;
  text-align: center;
  cursor: pointer;
  color: var(--muted-light);
  font-size: var(--fs-xs);
  flex-shrink: 0;
}

.vis-tree-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.vis-tree-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.22);
  flex-shrink: 0;
}

.vis-tree-children.collapsed {
  display: none;
}

.vstyle-opt {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text-strong);
  cursor: pointer;
}

.vstyle-opt:hover {
  background: var(--hover);
}

.vstyle-opt.active {
  background: var(--accent-dim);
  color: var(--accent-dark);
  font-weight: 600;
}

.sb-left-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.sb-viz-bar,
.sb-nav-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sb-micro-sep {
  opacity: 0.45;
  margin: 0 2px;
}

.sb-scale-select {
  height: var(--h-ctrl-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-strong);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xs);
  padding: 0 4px;
}

.sb-discipline-select {
  font-family: var(--font-ui);
  max-width: 108px;
}

.sb-discipline-select.active {
  color: #0369a1;
  border-color: #7dd3fc;
  background: #f0f9ff;
  font-weight: 600;
}

/* Capa de marcas RFI sobre lienzo 3D y sobre Planos abiertos */
.rfi-markup-svg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 52;
}

.rfi-markup-svg.drawing {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  z-index: 54;
}

/* Menú expandible RFI */
.rfi-drawer {
  position: fixed;
  top: var(--tes-dock-top);
  right: var(--tes-gap);
  bottom: var(--tes-dock-bottom);
  width: 296px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  z-index: 56;
  overflow: hidden;
}

.rfi-filters-row {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
}

.rfi-filter-btn {
  flex: 1;
  height: 26px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 0 6px;
  border-radius: var(--r-pill);
  cursor: pointer;
}

.rfi-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #ffffff;
  font-weight: 600;
}

.rfi-list-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) 10px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.rfi-card {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0;
  background: var(--panel-solid);
  transition: box-shadow 0.12s, border-color 0.12s, background 0.12s;
  overflow: hidden;
}

.rfi-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.rfi-card.is-expanded {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.12);
}

.rfi-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text-strong);
}

.rfi-card-header:hover {
  background: var(--panel-subtle);
}

.rfi-card.is-expanded > .rfi-card-header {
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
}

.rfi-card-caret {
  width: 11px;
  font-size: 10px;
  color: var(--muted-light);
  flex-shrink: 0;
  text-align: center;
}

.rfi-card-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rfi-card-head-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-strong);
  min-width: 0;
}

.rfi-card-code {
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
}

.rfi-card-snippet {
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfi-card-body {
  padding: 8px 9px;
}

.rfi-card-view-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.rfi-view-btn {
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rfi-view-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.rfi-view-btn.active {
  background: #e0f2fe;
  border-color: var(--accent);
  color: #0369a1;
  font-weight: 600;
}

.rfi-viz-switch {
  margin-left: 0;
  margin-right: 4px;
  font-size: 11px;
}

/* Nodo Incidencias en el Navegador de proyectos */
.rfi-tree-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px 5px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
}

.rfi-tree-empty {
  padding: 4px 8px 6px 24px;
  font-size: 11px;
  color: var(--muted-light);
}

.rfi-tree-item {
  border-radius: var(--r-xs);
  margin: 1px 4px;
}

.rfi-tree-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 3px 6px 3px 16px;
  border: 0;
  background: transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  color: var(--text);
  text-align: left;
}

.rfi-tree-row:hover {
  background: var(--hover);
}

.rfi-tree-item.is-expanded > .rfi-tree-row {
  background: #eff6ff;
  color: #0369a1;
  font-weight: 600;
}

.rfi-tree-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.rfi-tree-dot.is-crit {
  background: #dc2626;
}

.rfi-tree-dot.is-ok {
  background: #16a34a;
}

.rfi-tree-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfi-tree-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #475569;
  flex-shrink: 0;
}

.rfi-tree-detail {
  margin: 2px 4px 5px 22px;
  padding: 6px 8px;
  border-left: 2px solid var(--accent);
  background: var(--panel-subtle);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 11px;
  line-height: 1.38;
  color: var(--text);
}

.rfi-tree-detail-meta {
  font-size: 10.5px;
  color: var(--muted-light);
  margin-top: 4px;
}

.rfi-tree-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.rfi-sheet-pill {
  position: fixed;
  top: calc(var(--tes-dock-top) + 46px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 57;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  max-width: min(560px, calc(100vw - 40px));
}

.rfi-sheet-pill.hidden {
  display: none;
}

.rfi-sheet-pill-code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #fda4af;
  flex-shrink: 0;
}

.rfi-sheet-pill-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfi-sheet-pill-close {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}

.rfi-sheet-pill-close:hover {
  color: #ffffff;
}

.rfi-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: var(--sp-1);
}

.rfi-card-comment {
  font-size: var(--fs-sm);
  color: var(--text);
  margin-bottom: 6px;
  line-height: var(--lh-sm);
}

.rfi-card-meta {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  margin-bottom: 6px;
}

.rfi-card-thumb {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  margin-bottom: 6px;
}

.rfi-card-actions {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
}

/* Visores modales compactos (Planos, Tablas, Render) */
.tes-overlay-card {
  position: fixed;
  top: calc(var(--tes-dock-top) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 40px));
  max-height: calc(100vh - var(--tes-dock-top) - var(--tes-dock-bottom) - 8px);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  z-index: 44;
  overflow: hidden;
}

.sheet-viewer-body,
.schedule-viewer-body {
  padding: var(--sp-3);
  overflow: auto;
  font-size: var(--fs-sm);
}

.sheet-frame {
  border: 2px solid #334155;
  background: #fdfdfd;
  padding: var(--sp-3);
  border-radius: var(--r-xs);
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-3);
}

.sheet-vp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-2);
}

.sheet-vp-card {
  border: 1px dashed #64748b;
  border-radius: var(--r-xs);
  padding: 10px;
  background: var(--panel-subtle);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.sheet-vp-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.sheet-titleblock {
  border-top: 2px solid #334155;
  padding-top: var(--sp-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
}

.tes-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.tes-sched-table th,
.tes-sched-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

.tes-sched-table th {
  background: var(--panel-muted);
  font-weight: 600;
}

.render-controls-row {
  display: flex;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  align-items: center;
  background: var(--panel-subtle);
}

.render-status-line {
  padding: 6px var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.render-preview-wrap {
  padding: var(--sp-3);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: 58vh;
}

.render-preview-box {
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  overflow: hidden;
  background: #0f172a;
}

.render-preview-box img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 46vh;
  object-fit: contain;
}

.render-preview-cap {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  color: #cbd5e1;
  background: #1e293b;
}

.fam-cat-hdr {
  padding: 4px 8px 4px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.fam-cat-hdr:hover {
  background: var(--hover);
}

.fam-type-row {
  padding: 3px 8px 3px 26px;
  font-size: var(--fs-sm);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.fam-type-row:hover {
  background: var(--hover);
  color: var(--text-strong);
}

.loading-toast {
  position: fixed;
  bottom: var(--tes-dock-bottom);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  z-index: 50;
  box-shadow: var(--shadow-soft);
}

@media (max-width: 900px) {
  .side-drawer,
  .side-right {
    width: 224px;
  }
  .viewcube-hud {
    right: 248px;
    width: 76px;
    height: 76px;
  }
}

@media (max-width: 768px) {
  .side-drawer,
  .side-right {
    width: min(86vw, 304px);
    max-height: calc(100vh - 148px);
  }
  .viewcube-hud {
    right: 10px;
    top: 96px;
    width: 64px;
    height: 64px;
  }
  .tes-statusbar {
    overflow-x: auto;
    white-space: nowrap;
    gap: 6px;
  }
  .sb-workset-select {
    max-width: 150px;
  }
}

/* Captura de observación RFI con dictado por voz */
.rfi-obs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
}
.rfi-obs-card {
  width: min(92vw, 392px);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.rfi-obs-head {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
}
.rfi-obs-row {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
}
.rfi-obs-text {
  flex: 1;
  resize: vertical;
  min-height: 68px;
  font: inherit;
  font-size: var(--fs-sm);
  padding: var(--sp-2) 10px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  outline: none;
}
.rfi-obs-text:focus {
  border-color: var(--accent);
}
.rfi-obs-mic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-med);
  background: var(--panel-subtle);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.rfi-obs-mic.listening {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  animation: rfiMicPulse 1.1s ease-in-out infinite;
}
@keyframes rfiMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
}
.rfi-obs-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.rfi-session-bar {
  position: fixed;
  top: calc(var(--tes-topbar-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 58;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}
.rfi-session-bar.hidden {
  display: none;
}
.rfi-session-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #dc2626;
  padding: 0 4px;
  white-space: nowrap;
}
.rfi-session-bar .btn.active {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}
.btn-rfi-ai {
  background: #0f172a !important;
  border-color: #0f172a !important;
  color: #ffffff !important;
  font-weight: 600;
}
.btn-rfi-ai:hover {
  background: #1e293b !important;
}

.isolate-popover {
  left: 140px;
  width: 196px;
}
.sb-icon-btn.isolate-on {
  outline: 2px solid #06b6d4;
  outline-offset: 1px;
  background: #ecfeff;
}

/* Chat del proyecto */
.chat-popover {
  top: auto;
  bottom: var(--tes-dock-bottom);
  right: calc(var(--tes-right-edge, var(--tes-right-w)) + var(--tes-gap) + var(--tes-gap));
  width: min(92vw, 304px);
  height: 252px;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
}
body.props-hidden .chat-popover:not(.floating-detached) {
  right: var(--tes-gap);
}
.chat-list {
  flex: 1 1 auto;
  min-height: 90px;
  overflow-y: auto;
  padding: var(--sp-2) 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg {
  max-width: 85%;
  padding: 6px 10px;
  border-radius: var(--r-md);
  background: var(--panel-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  align-self: flex-start;
  word-break: break-word;
}
.chat-msg.mine {
  align-self: flex-end;
  background: var(--accent-soft);
}
.chat-msg-meta {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  margin-bottom: 2px;
}
.chat-form {
  display: flex;
  gap: 6px;
  padding: var(--sp-2) 10px;
  border-top: 1px solid var(--border);
  background: var(--panel-subtle);
  flex-shrink: 0;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  height: var(--h-ctrl-md);
  font: inherit;
  font-size: var(--fs-sm);
  padding: 0 10px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  outline: none;
}
.chat-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: #dc2626;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 18px;
  text-align: center;
  margin-left: 4px;
}

/* =========================================================================
   SELECTOR DE EDIFICIOS Y ESPECIALIDADES (MÍNIMO BÁSICO)
   ========================================================================= */
.bldg-pill {
  border-color: var(--border-med);
  color: var(--text-strong);
  font-weight: 500;
  padding: 0 10px;
  margin-right: 4px;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bldg-pill.multi-on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.bldg-caret {
  font-size: var(--fs-xs);
  color: var(--muted-light);
}

.buildings-popover {
  left: var(--tes-gap);
  right: auto;
  top: 46px;
  width: min(356px, calc(100vw - 24px));
  max-height: 440px;
}

.bldg-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.bldg-actions-group {
  display: inline-flex;
  gap: 4px;
}

.bldg-disc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.bldg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  transition: border-color 0.12s, background 0.12s;
}

.bldg-row:hover {
  border-color: var(--border-med);
  background: #fafcff;
}

.bldg-row.active-bldg {
  border-color: var(--accent);
  background: rgba(2, 132, 199, 0.05);
}

.bldg-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bldg-row-head input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.bldg-row-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-strong);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
}

.bldg-row-btn:hover {
  color: var(--accent-dark);
}

.bldg-row-sub {
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--muted-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bldg-disc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-left: 20px;
}

.bldg-disc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--panel-subtle);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.bldg-disc-chip:hover {
  border-color: var(--border-med);
  color: var(--text-strong);
  background: var(--panel-solid);
}

.bldg-disc-chip.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.bldg-disc-chip.overlaid {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.bldg-tree-subnode {
  margin-bottom: 2px;
}

.bldg-tree-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 6px 3px 12px;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text);
}

.bldg-tree-hdr:hover {
  background: var(--hover);
}

.bldg-tree-hdr.active {
  background: var(--accent-dim);
  color: var(--accent-dark);
  font-weight: 600;
}

.bldg-tree-hdr input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.bldg-tree-discs {
  padding-left: 14px;
}

.bldg-tree-toolbar {
  display: flex;
  gap: 4px;
  padding: 2px 6px 4px 12px;
}

.bldg-tree-toolbar .btn {
  flex: 1;
  height: 24px;
  font-size: var(--fs-xs);
  padding: 0 6px;
}

/* =========================================================================
   CORTE TÉCNICO POR PRIORIDAD Y ACHURADO DE MATERIAL (MÍNIMO BÁSICO)
   ========================================================================= */
.section-legend-popover {
  top: var(--tes-dock-top);
  right: calc(var(--tes-right-edge, var(--tes-right-w)) + var(--tes-gap) + var(--tes-gap));
  width: min(304px, calc(100vw - 24px));
  max-height: 430px;
}

body.props-hidden .section-legend-popover {
  right: var(--tes-gap);
}

@media (max-width: 768px) {
  .section-legend-popover {
    right: var(--tes-gap);
  }
}

.sec-preset-row {
  display: flex;
  gap: var(--sp-1);
  padding-bottom: 6px;
  margin-bottom: var(--sp-1);
  border-bottom: 1px solid var(--border);
}

.sec-preset-btn {
  flex: 1;
  height: 26px;
  padding: 0 8px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--panel-subtle);
  color: var(--muted);
  cursor: pointer;
}

.sec-preset-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.sec-subhdr {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  padding: var(--sp-1) 2px 2px;
}

.sec-prio-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--panel-solid);
  font-size: var(--fs-sm);
}

.sec-prio-code {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-strong);
  width: 24px;
  flex-shrink: 0;
}

.sec-prio-line-wrap {
  width: 34px;
  height: 12px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sec-prio-line {
  width: 100%;
  border-radius: 99px;
  background: var(--text-strong);
}

.sec-prio-label {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sec-hatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-1);
}

.sec-hatch-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--panel-solid);
  font-size: var(--fs-xs);
  color: var(--text);
  min-width: 0;
}

.sec-hatch-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sec-hatch-swatch {
  flex-shrink: 0;
  vertical-align: middle;
  display: inline-block;
}

.sec-prop-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

/* =========================================================================
   MÓDULO PRESUPUESTOS AIN (DIVISIONES MASTERFORMAT) — DISEÑO MÍNIMO BÁSICO
   ========================================================================= */
.budget-viewer-panel {
  position: fixed;
  bottom: var(--tes-dock-bottom);
  left: 50%;
  transform: translateX(-50%);
  width: min(1040px, calc(100vw - 36px));
  height: min(48vh, 440px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  z-index: 43;
  overflow: hidden;
}

.budget-viewer-panel.expanded {
  top: var(--tes-dock-top);
  bottom: var(--tes-dock-bottom);
  width: calc(100vw - 24px);
  height: auto;
}

.budget-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
}

.budget-report-select {
  min-width: 230px;
  max-width: 300px;
  font-weight: 500;
}

.budget-div-select {
  min-width: 175px;
  max-width: 245px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-val-select {
  min-width: 122px;
  max-width: 150px;
}
.budget-class-select {
  min-width: 148px;
  max-width: 185px;
  font-weight: 500;
}
.budget-stage-select {
  min-width: 145px;
  max-width: 175px;
}

.budget-search-input {
  flex: 1;
  min-width: 140px;
}

.budget-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--panel-solid);
}

.budget-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-subtle);
  min-width: 0;
}

.budget-kpi-k {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-kpi-v {
  font-size: var(--fs-xl);
  line-height: var(--lh-tight);
  font-weight: 700;
  color: var(--text-strong);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-table-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  background: var(--panel-solid);
}

.budget-subhdr {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  margin: 2px 0 6px;
}

.budget-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: 6px;
}

.budget-empty {
  padding: var(--sp-6) var(--sp-3);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.budget-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  font-size: var(--fs-xs);
}

.budget-table td {
  font-size: var(--fs-sm);
  vertical-align: middle;
}

.budget-table td.num,
.budget-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.budget-table td.center,
.budget-table th.center {
  text-align: center;
  white-space: nowrap;
}

.budget-table td.mono {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.budget-table td.bold {
  font-weight: 600;
  color: var(--text-strong);
}

.budget-table td.desc-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-table tr.budget-item-row {
  cursor: pointer;
}

.budget-table tr.budget-item-row:hover {
  background: var(--panel-subtle);
}

.budget-table tr.budget-item-row.selected {
  background: var(--accent-soft);
}

.budget-table tr.budget-item-row.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.budget-table tr.budget-item-row:hover td.desc-cell,
.budget-table tr.budget-item-row.selected td.desc-cell {
  white-space: normal;
}

.budget-formula-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  border-bottom: 1px solid #bae6fd;
  background: #f0f9ff;
  font-size: var(--fs-sm);
  color: var(--text-strong);
}

.budget-formula-code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-dark);
  white-space: nowrap;
}

.budget-formula-expr {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-formula-bar:hover .budget-formula-expr {
  white-space: normal;
}

.budget-src-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.budget-src-pill.direct {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.budget-src-pill.formula {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.budget-src-pill.ref {
  background: var(--border);
  color: var(--text);
  border-color: var(--border-med);
}

#btn-budget-live-mode.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-dark);
}

.budget-div-row {
  background: var(--panel-muted);
  cursor: pointer;
}

.budget-div-row:hover {
  background: var(--border);
}

.budget-sec-row td {
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 4px 8px 4px 18px;
}

.budget-total-row td {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
}

.budget-caret {
  display: inline-block;
  width: 12px;
  color: var(--muted);
}

.budget-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 1px solid rgba(15, 23, 42, 0.22);
}

.budget-muted {
  color: var(--muted);
  font-weight: 400;
}

.budget-mini-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.linked-qty {
  color: var(--accent-dark);
  font-weight: 600;
}

.act-cell {
  display: flex;
  gap: var(--sp-1);
  justify-content: center;
  align-items: center;
}

.btn-mini {
  padding: 2px 7px;
  font-size: var(--fs-xs);
  line-height: 1.4;
  border: 1px solid var(--border-med);
  border-radius: var(--r-xs);
  background: var(--panel-solid);
  color: var(--text-strong);
  cursor: pointer;
}

.btn-mini:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn-mini.link-3d {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
  font-weight: 600;
}

/* =========================================================================
   VALIDACIÓN POR COSTOS, BLOQUEOS Y CORTES EN EL TIEMPO (MÍNIMO BÁSICO)
   ========================================================================= */
.budget-val-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.budget-val-pill:hover {
  border-color: var(--accent);
  color: var(--text-strong);
  background: var(--accent-soft);
}
.budget-val-pill.in_review {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.budget-val-pill.locked {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
  font-weight: 600;
  font-family: var(--font-mono);
}
.budget-val-pill.locked:hover {
  background: #d1fae5;
  border-color: #10b981;
}
.budget-val-pill.readonly {
  cursor: default;
}
.budget-val-drift {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  vertical-align: middle;
}
.budget-table tr.budget-item-row.val-locked {
  background: rgba(236, 253, 245, 0.45);
}
.budget-table tr.budget-item-row.val-locked:hover {
  background: rgba(209, 250, 229, 0.55);
}
.budget-table tr.budget-item-row.val-diff {
  background: rgba(254, 243, 199, 0.45);
}
.budget-div-val-tag {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: #065f46;
  font-weight: 600;
}
.budget-timetravel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px var(--sp-3);
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  color: #78350f;
  font-size: var(--fs-xs);
  flex-wrap: wrap;
}
.budget-timetravel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.budget-timetravel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.budget-val-drawer {
  border-bottom: 1px solid var(--border-med);
  background: var(--panel-subtle);
  max-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.budget-val-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--panel-solid);
  flex-wrap: wrap;
}
.budget-val-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}
.budget-val-tab {
  padding: 3px 8px;
  font-size: var(--fs-xs);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--panel-solid);
  color: var(--muted);
  cursor: pointer;
}
.budget-val-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}
.budget-val-snap-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 360px;
  justify-content: flex-end;
}
.budget-val-snap-form input {
  flex: 1;
  min-width: 120px;
  height: 24px;
  font-size: var(--fs-xs);
}
.budget-val-drawer-body {
  overflow: auto;
  padding: 6px var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.budget-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
}
.budget-val-row.active-preview {
  border-color: #f59e0b;
  background: #fffbeb;
}
.budget-val-row-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.budget-val-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.budget-val-config-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px;
  font-size: var(--fs-xs);
}
.budget-val-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.budget-val-config-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  height: 26px;
  font-size: var(--fs-xs);
}
.budget-val-inline-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--sp-3);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  flex-wrap: wrap;
}
#btn-budget-val-history.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.budget-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.budget-bar {
  height: 3px;
  border-radius: 2px;
  min-width: 2px;
}

.rtree-mf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.rtree-mf-amt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: #047857;
  flex-shrink: 0;
}

@media (max-width: 820px) {
  .budget-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Módulo compacto Cancelería Planta Baja */
.canceleria-panel-body {
  padding: var(--sp-2) 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
}

.can-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.can-kpi {
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.can-kpi span {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
}

.can-kpi small {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.can-sec-head {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.can-layer-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.can-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-strong);
  cursor: pointer;
}

.can-tramo-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.can-tramo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
}

.can-tramo-row:hover,
.can-tramo-row.active {
  border-color: var(--accent);
  background: #f0f9ff;
}

.can-tramo-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.can-tramo-info strong {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
}

.can-tramo-info span {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.can-tramo-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.canceleria-2d-body {
  padding: 10px;
  overflow: auto;
  background: var(--panel-solid);
}

.canceleria-2d-svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
}


/* =========================================================================
   ANOTACIÓN 2D EN PLANTA, PLANTILLAS DE VISTA Y VISOR DE PLANOS TIPO PDF
   ========================================================================= */
.plan-annotation-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

body.plan-2d-paper #canvas-wrap {
  background: #ffffff !important;
}

.plan-anno-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
}

.plan-anno-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.sheet-viewer-card {
  width: min(1160px, calc(100vw - 40px)) !important;
  max-height: calc(100vh - var(--tes-dock-top) - var(--tes-dock-bottom));
  display: flex;
  flex-direction: column;
}

.sheet-viewer-card .sheet-viewer-body {
  padding: var(--sp-3);
  background: var(--border);
  overflow: auto;
  flex: 1;
}

.sheet-pdf-paper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 244px;
  gap: var(--sp-3);
  background: var(--panel-solid);
  border: 2px solid var(--text-strong);
  padding: var(--sp-3);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  min-height: 500px;
}

.sheet-pdf-main {
  display: grid;
  gap: var(--sp-3);
  align-content: start;
  border: 1px solid var(--border-med);
  padding: var(--sp-2);
  background: var(--panel-solid);
}

.sheet-pdf-main.single-vp {
  grid-template-columns: 1fr;
}

.sheet-pdf-main.multi-vp {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.sheet-pdf-vp {
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sheet-pdf-vp:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.sheet-pdf-vp-canvas {
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-solid);
  overflow: hidden;
}

.sheet-vp-svg {
  width: 100%;
  height: auto;
  display: block;
}

.sheet-pdf-vp-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--sp-2);
  border-top: 1.5px solid var(--text-strong);
  background: var(--panel-subtle);
  font-size: var(--fs-sm);
}

.sheet-vp-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.4px solid var(--text-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-strong);
  flex-shrink: 0;
}

.sheet-vp-name {
  font-weight: 700;
  color: var(--text-strong);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-vp-scale {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-shrink: 0;
}

.sheet-vp-placeholder,
.sheet-empty-vp {
  padding: 28px var(--sp-4);
  text-align: center;
  color: var(--muted-light);
  font-size: var(--fs-sm);
}

.sheet-vp-legend-box {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-vp-legend-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-strong);
  border-bottom: 1px solid var(--text-strong);
  padding-bottom: 4px;
}

.sheet-pdf-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.sheet-side-box {
  border: 1px solid #334155;
  padding: var(--sp-2);
  background: var(--panel-solid);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sheet-side-hdr {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-strong);
  border-bottom: 1px solid var(--border-med);
  padding-bottom: 3px;
  margin-bottom: 2px;
}

.sheet-north-box {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
}

.sheet-north-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xs);
  color: var(--text);
}

.sheet-north-meta strong {
  font-size: var(--fs-sm);
  color: var(--text-strong);
}

.sheet-sym-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text);
}

.sheet-sym-swatch {
  width: 22px;
  height: 11px;
  flex-shrink: 0;
  display: inline-block;
  border: 1px solid var(--text-strong);
}

.sheet-sym-swatch.col {
  background: #05080f;
}

.sheet-sym-swatch.wall {
  background: repeating-linear-gradient(45deg, #1e293b 0 2px, #cbd5e1 2px 5px);
}

.sheet-sym-swatch.floor {
  background: var(--panel-muted);
  border-color: #94a3b8;
}

.sheet-sym-swatch.axis {
  border: none;
  border-bottom: 1.5px dashed var(--muted);
  height: 6px;
}

.sheet-sym-swatch.door {
  border: none;
  border-left: 1.5px solid var(--text-strong);
  border-top: 1px dashed var(--muted);
  border-top-right-radius: 10px;
}

.sheet-sym-swatch.npt {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin: 0 5px;
  background: conic-gradient(#0f172a 0 90deg, #fff 90deg 180deg, #0f172a 180deg 270deg, #fff 270deg);
}

.sheet-areas-box {
  flex: 1;
  min-height: 90px;
  overflow: auto;
}

.sheet-area-grp {
  margin-bottom: 6px;
}

.sheet-area-grp-hdr {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-strong);
  border-bottom: 1px dotted var(--border-med);
  padding-bottom: 2px;
  margin-bottom: 2px;
}

.sheet-area-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sheet-area-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-area-row span:last-child {
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sheet-area-total {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-1);
  padding-top: var(--sp-1);
  border-top: 1.5px solid var(--text-strong);
  font-size: var(--fs-sm);
  color: var(--text-strong);
}

.sheet-area-empty {
  font-size: var(--fs-xs);
  color: var(--muted-light);
}

.sheet-titleblock-pdf {
  border: 2px solid var(--text-strong);
  margin-top: auto;
  gap: 4px;
}

.sheet-tb-brand {
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-strong);
  border-bottom: 1.5px solid var(--text-strong);
  padding-bottom: 4px;
}

.sheet-tb-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sheet-tb-row strong {
  color: var(--text-strong);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-tb-code {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-strong);
  text-align: center;
  padding: 4px 0;
  border-top: 1px solid var(--border-med);
  border-bottom: 1px solid var(--border-med);
  margin: 2px 0;
}

.sheet-tb-foot {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
}

@media (max-width: 820px) {
  .sheet-pdf-paper {
    grid-template-columns: 1fr;
  }
}

/* Cinta interactiva en vivo de órdenes de cambio (debajo de los comandos de visualización) */
.change-ticker-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tes-ticker-h);
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  font-size: var(--fs-xs);
  z-index: 38;
  border-top: 1px solid rgba(51, 65, 85, 0.85);
}
.change-ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(2, 132, 199, 0.28);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--r-xs);
  height: 18px;
  padding: 0 7px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.change-ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
}
.change-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  padding-left: 100%;
  animation: tesTickerScroll 42s linear infinite;
}
.change-ticker-viewport:hover .change-ticker-track {
  animation-play-state: paused;
}
.change-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.change-ticker-rev {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #38bdf8;
}
.change-ticker-src {
  font-size: var(--fs-xs);
  color: #fbbf24;
  font-weight: 600;
}
.change-ticker-user {
  font-size: var(--fs-xs);
  color: #94a3b8;
}
.ticker-update-pill {
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: var(--r-xs);
  height: 18px;
  padding: 0 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
@keyframes tesTickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* =========================================================================
   MODO MÓVIL ULTRA-COMPACTO Y MANIPULACIÓN TÁCTIL INTERACTIVA (<= 768px)
   ========================================================================= */
.mob-dock-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}

.mob-dock-btn:active {
  transform: scale(0.92);
  background: rgba(2, 132, 199, 0.18);
}

.mob-dock-btn.active {
  background: var(--accent-dim);
  color: var(--accent-dark);
}

.mob-dock-btn.pan-active {
  background: #fef3c7;
  color: #b45309;
}

@media (min-width: 769px) {
  :root {
    --tes-topbar-tabs-h: 40px;
    --tes-topbar-panels-h: 40px;
    --tes-topbar-h: 80px;
    --tes-dock-top: 80px;
  }

  .ribbon-tabs-row {
    height: var(--tes-topbar-tabs-h);
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-left::-webkit-scrollbar {
    display: none;
  }

  .brand {
    max-width: 72px;
    border-right: none;
    padding: 0 4px;
    font-size: var(--fs-sm);
    font-weight: 700;
  }

  .brand:empty {
    display: none;
  }

  .topbar-right {
    margin-left: auto;
    flex-shrink: 0;
  }

  #btn-session {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #btn-session #session-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tes-ribbon-tabs {
    height: 40px;
    align-items: center;
    border-top: none;
    gap: 2px;
    margin-left: 2px;
  }

  .tes-tab-btn {
    height: 28px;
    padding: 0 8px;
    border-radius: 5px;
    border-bottom: none;
    font-size: var(--fs-sm);
  }

  .tes-tab-btn.active:not(.file-tab) {
    background: var(--accent);
    color: #ffffff;
    border-bottom: none;
    font-weight: 500;
  }
}

/* (Reglas móviles consolidadas al final del archivo para máxima prioridad en cascada) */

/* Planos integrados del módulo de Montaje (en visor Planos de Teseracto) */
.montaje-detail-svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
}
.montaje-sheet-page {
  background: var(--panel-solid);
  border: 1px solid #94a3b8;
  border-radius: var(--r-xs);
  padding: var(--sp-3);
  box-shadow: var(--shadow-soft);
  max-width: 1240px;
  margin: 0 auto;
  color: var(--text-strong);
}
.montaje-sheet-page.no-sidebar {
  grid-template-columns: 1fr;
}
.montaje-sheet-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.ms-sheet-coordbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-med);
  background: var(--panel-subtle);
  font-size: var(--fs-xs);
  color: #334155;
}
.ms-mosaic-grid {
  display: grid;
  gap: var(--sp-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ms-mosaic-grid.cols-1 {
  grid-template-columns: 1fr;
}
.ms-mosaic-cell {
  border: 1px dashed #94a3b8;
  border-radius: var(--r-xs);
  padding: 6px;
  background: var(--panel-solid);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}
.ms-mosaic-cell.span-full {
  grid-column: 1 / -1;
}
.ms-mosaic-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #334155;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.ms-mosaic-coord {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--text-strong);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ms-mosaic-body {
  min-width: 0;
  overflow-x: auto;
}
.ms-mosaic-body .montaje-detail-svg,
.ms-mosaic-body svg {
  max-width: 100%;
  height: auto;
  display: block;
}
.ms-mosaic-body .montaje-detail-svg {
  border: none;
  border-radius: 0;
}
.montaje-sheet-titleblock.is-hidden {
  display: none !important;
}
.sheet-sym-swatch.glass {
  background: #e0f2fe;
  border-color: #0284c7;
}
.sheet-sym-swatch.alum {
  background: #94a3b8;
  border-color: #1e293b;
}
.sheet-sym-swatch.cut {
  border: none;
  border-bottom: 1.8px dashed #dc2626;
  height: 6px;
}
.sheet-sym-swatch.det {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  margin: 0 4px;
  background: #ffffff;
  border: 1.5px solid #0369a1;
}
.sheet-loading-state {
  padding: 36px 20px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  max-width: 480px;
  margin: 28px auto;
}
/* Árbol multinivel de Planos de Teseracto (Disciplina -> Subdisciplina -> Montaje) */
#tree-sheets .rtree-subchildren .rtree-subheader {
  padding-left: 6px;
}
#tree-sheets .rtree-subheader > span:not(.rtree-caret) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
#tree-sheets .rtree-subnode[data-sheet-subdisc] > .rtree-subheader {
  font-weight: 500;
  color: var(--text);
}
#tree-sheets .rtree-subnode[data-sheet-montaje] > .rtree-subheader {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
}
#tree-sheets .rtree-subnode[data-sheet-montaje] > .rtree-subchildren > .rtree-item {
  padding-left: 10px;
}
.montaje-sheet-frame {
  border: 1.6px solid var(--text-strong);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.montaje-sheet-titleblock {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.6fr 1fr 0.7fr;
  border-top: 1.5px solid var(--text-strong);
  padding-top: 6px;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
}
.ms-tb-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border-med);
  padding-right: 6px;
}
.ms-tb-cell:last-child {
  border-right: none;
  text-align: right;
}
.ms-tb-cell span {
  font-size: var(--fs-2xs);
  color: var(--muted-light);
  text-transform: uppercase;
}
.ms-tb-num strong {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--accent-dark);
}
.ms-sec-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 6px;
}
.ms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-xs);
}
.ms-table th,
.ms-table td {
  border: 1px solid var(--border-med);
  padding: 4px 6px;
  text-align: left;
}
.ms-table th {
  background: var(--panel-muted);
  font-weight: 600;
  color: var(--text);
}
.ms-table a {
  color: var(--accent-dark);
  font-weight: 600;
}
.ms-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.ms-tag-pill {
  font-size: var(--fs-xs);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--panel-muted);
  border: 1px solid var(--border-med);
}
.ms-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}
.ms-empty {
  padding: var(--sp-3);
  background: var(--panel-subtle);
  border: 1px dashed var(--border-med);
  border-radius: var(--r-sm);
  color: var(--muted-light);
}
@media (max-width: 768px) {
  .montaje-sheet-titleblock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ms-two-col {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   MULTI-EMPRESA, PROYECTOS Y MODELADO 3D (DISENO MINIMO BASICO)
   ========================================================================= */
#ribbon-archivo-panel {
  gap: var(--sp-2);
}

.empty-workspace-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}

.workspaces-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(780px, 94vw);
  max-height: 82vh;
  z-index: 65;
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

.ws-grid {
  display: grid;
  grid-template-columns: 272px 1fr;
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(82vh - 68px);
  overflow: hidden;
}

.ws-col {
  display: flex;
  flex-direction: column;
  padding: var(--sp-3);
  gap: var(--sp-2);
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ws-col-left {
  border-right: 1px solid var(--border);
  background: var(--panel-subtle);
}

.ws-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-strong);
}

.ws-subhead {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--sp-1);
}

.ws-inline-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-2);
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
}

.ws-inline-form input,
.ws-member-form input,
.mb-fields-grid input,
.mb-fields-grid select {
  width: 100%;
  height: var(--h-ctrl-sm);
  padding: 0 var(--sp-2);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--panel-solid);
}

.ws-form-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-form-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.ws-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  text-align: left;
  padding: var(--sp-2) 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.ws-item-row:hover {
  background: var(--panel-muted);
  border-color: var(--border-med);
}

.ws-item-row.active {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.ws-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ws-item-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-item-sub {
  font-size: var(--fs-xs);
  color: var(--muted-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-members-box {
  margin-top: auto;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}

.ws-member-form {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: 6px;
}

.ws-members-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.ws-member-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--panel-solid);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.ws-member-chip button {
  border: none;
  background: transparent;
  color: var(--muted-light);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1;
}

.ws-status-line {
  padding: 6px var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--panel-subtle);
  min-height: 28px;
}

.model-builder-panel {
  position: fixed;
  top: var(--tes-dock-top);
  left: 50%;
  transform: translateX(-50%);
  width: min(448px, 94vw);
  z-index: 48;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
}

.mb-kinds-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
}

.mb-kinds-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.mb-kinds-base {
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  align-items: center;
}

.mb-base-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-right: 2px;
}

.mb-kinds-row .btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.montaje-mf-div {
  margin-bottom: 4px;
}

.montaje-mf-div-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.montaje-mf-div-hdr:hover {
  background: #e2e8f0;
}

.montaje-mf-sec-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 3px 6px 3px 14px;
  font-size: 10.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.montaje-mf-sec-hdr:hover {
  background: #f1f5f9;
}

.montaje-mf-items {
  padding-left: 10px;
}

.mb-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
}

.mb-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mb-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mb-field.full {
  grid-column: 1 / -1;
}

.mb-field label {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.mb-actions-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .ws-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .ws-col-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* Panel Auditoría Técnica Versionada (Analizar) */
.audit-ver-row {
  padding: var(--sp-2) 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.audit-summary-line {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.audit-card-active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.25);
}
.audit-badge-missing {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
.audit-badge-error {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fcd34d !important;
}
.audit-badge-fixed {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.audit-detail-text {
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  color: #334155;
  margin-top: var(--sp-1);
}
.audit-fix-text {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--accent-dark);
  margin-top: 3px;
}
.ribbon-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.ribbon-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 204px;
  background: var(--panel-solid);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  padding: var(--sp-1);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ribbon-dropdown-menu.hidden {
  display: none !important;
}
.ribbon-dropdown-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-strong);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
}
.ribbon-dropdown-item:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* =========================================================================
   AUDITORÍA CLIMA, ANÁLISIS TÉRMICO 3D Y MEMORIAS EN PÁGINA (MÍNIMO BÁSICO)
   ========================================================================= */
.hvac-audit-panel {
  left: calc(var(--tes-left-w) + var(--tes-gap) + var(--tes-gap));
  right: auto;
  top: var(--tes-dock-top);
  width: min(344px, calc(100vw - 24px));
  max-height: calc(100vh - var(--tes-dock-top) - var(--tes-dock-bottom));
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .hvac-audit-panel {
    left: var(--tes-gap);
  }
}

.hvac-head-tabs {
  display: inline-flex;
  gap: var(--sp-1);
}

.hvac-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--r-xs);
  cursor: pointer;
}

.hvac-tab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.hvac-audit-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  min-height: 0;
}

.hvac-kpi-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r-xs);
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text);
}

.hvac-ctrl-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hvac-ctrl-row > select {
  flex: 1;
  min-width: 0;
}

.hvac-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text);
}

.hvac-toggle-row label,
.hvac-inline-chk {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.hvac-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  overflow: hidden;
  background: var(--panel-subtle);
}

.hvac-seg button {
  border: none;
  background: transparent;
  height: 24px;
  padding: 0 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.hvac-seg button.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.hvac-slider-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-strong);
}

.hvac-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.hvac-slider-row .muted {
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.hvac-legend-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hvac-legend-grad {
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, #2563eb 0%, #10b981 34%, #f59e0b 62%, #ea580c 84%, #b91c1c 100%);
}

.hvac-legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hvac-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  overflow-y: auto;
  max-height: 250px;
  padding-right: 2px;
}

.hvac-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--panel-solid);
  font-family: var(--font-sans);
  cursor: pointer;
}

.hvac-item-row:hover {
  background: var(--panel-subtle);
  border-color: var(--border-med);
}

.hvac-item-row.active {
  background: rgba(3, 105, 161, 0.08);
  border-color: var(--accent);
}

.hvac-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hvac-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hvac-item-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hvac-item-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hvac-item-val {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.hvac-detail-box {
  padding: 6px 8px;
  border-radius: var(--r-xs);
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--fs-xs);
}

.hvac-det-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-strong);
}

.hvac-det-head span {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hvac-det-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text);
}

.hvac-det-line {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: #334155;
}

.hvac-det-act {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--accent-dark);
  font-weight: 500;
}

.hvac-det-sub {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.hvac-eq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: 2px;
}

.hvac-eq-chip {
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  cursor: pointer;
}

.hvac-eq-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.hvac-empty {
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Etiquetas 3D proyectadas sobre habitaciones */
.thermal-labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 12;
}

.thermal-room-tag {
  position: absolute;
  top: 0;
  left: 0;
  right: auto !important;
  bottom: auto !important;
  width: max-content !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 1px 3.5px;
  max-width: 68px;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-left: 2px solid var(--accent-dark);
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.20);
  font-family: var(--font-sans);
  font-size: 7px;
  line-height: 1.12;
  color: #f8fafc;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.thermal-room-tag:hover {
  background: rgba(15, 23, 42, 0.96);
  border-color: var(--trt-sel-color, #38bdf8);
  z-index: 15;
}

.thermal-room-tag.muted {
  opacity: 0.72;
}

.thermal-room-tag.dimmed-other {
  background: rgba(71, 85, 105, 0.78);
  border-color: rgba(148, 163, 184, 0.68);
  color: #f1f5f9;
  opacity: 0.85;
}

.thermal-room-tag .trt-details {
  display: none;
}

.thermal-room-tag.selected {
  right: auto !important;
  bottom: auto !important;
  width: max-content !important;
  height: auto !important;
  min-height: 0 !important;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  border-color: var(--trt-sel-color, #38bdf8);
  border-left-width: 2.5px;
  border-left-color: var(--trt-sel-color, #38bdf8);
  max-width: 185px;
  padding: 3.5px 6px;
  box-shadow: 0 0 0 1px var(--trt-sel-color, rgba(56, 189, 248, 0.45)), 0 3px 10px rgba(0, 0, 0, 0.42);
  z-index: 30;
}

.thermal-room-tag.selected.trt-pos-left::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 4px 0 4px 5px;
  border-style: solid;
  border-color: transparent transparent transparent var(--trt-sel-color, #38bdf8);
}

.thermal-room-tag.selected.trt-pos-right::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 4px 5px 4px 0;
  border-style: solid;
  border-color: transparent var(--trt-sel-color, #38bdf8) transparent transparent;
}

.thermal-room-tag.selected .trt-name {
  max-width: 164px;
  font-size: 8px;
  font-weight: 700;
  color: var(--trt-sel-color, #38bdf8);
}

.thermal-room-tag.selected .trt-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
  padding-top: 2px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 7.2px;
  line-height: 1.18;
  color: #e2e8f0;
  text-align: left;
  white-space: normal;
}

.trt-name {
  font-weight: 600;
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trt-val {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Bloque Auditoría Clima dentro de Propiedades */
.hvac-prop-card {
  margin: var(--sp-1) 0 6px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-med);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hvac-prop-status {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hvac-prop-diag {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: #334155;
}

.hvac-prop-act {
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--accent-dark);
  font-weight: 600;
}

/* Árbol Memorias y Visor integrado en página */
.mem-tree-code {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 3px;
}

.rtree-subnode[data-mem-spec] > .rtree-subchildren > .rtree-item {
  padding-left: 34px;
}

.mem-tab-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  margin-right: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
}

.tes-memorias-overlay {
  position: fixed;
  inset: 0;
  z-index: 9450;
  background: rgba(15, 23, 42, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

.tes-memorias-card {
  width: 100%;
  max-width: 1440px;
  height: 92vh;
  background: var(--panel-solid);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border-med);
}

.tes-memorias-bar {
  height: 40px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 var(--sp-3);
  flex-shrink: 0;
}

.tes-memorias-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.mem-tab-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  cursor: pointer;
  white-space: nowrap;
}

.mem-tab-btn.active {
  background: var(--accent);
  border-color: #38bdf8;
  color: #ffffff;
}

.tes-memorias-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mem-act-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #1e293b;
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  height: 26px;
  line-height: 24px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.mem-act-btn:hover {
  background: #334155;
  color: #ffffff;
}

.mem-close-btn {
  background: #334155;
  color: #ffffff;
  border: none;
  border-radius: var(--r-xs);
  height: 26px;
  padding: 0 10px;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.tes-memorias-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--panel-solid);
}

/* =========================================================================
   HERRAMIENTAS DE MEDICIÓN 3D / ISOMÉTRICO (PESTAÑA MODIFICAR)
   ========================================================================= */
.ribbon-cmd-group.hidden {
  display: none !important;
}

.measure-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 16;
  overflow: visible;
}

.measure-labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 17;
  overflow: hidden;
}

.measure-session-bar {
  position: absolute;
  top: var(--tes-gap);
  left: 50%;
  transform: translateX(-50%);
  z-index: 43;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--panel);
  border: 1px solid var(--border-med);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.measure-session-bar.hidden {
  display: none;
}

.measure-session-mode {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-dark);
  padding: 0 4px;
  white-space: nowrap;
}

.measure-session-submodes {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.measure-session-submodes.hidden {
  display: none;
}

.measure-session-bar .btn {
  font-size: var(--fs-xs);
  height: 24px;
  padding: 0 8px;
}

.measure-session-bar .btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.measure-session-readout {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-strong);
  padding: 0 8px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.tes-m-pill {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.65);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
  user-select: none;
}

.tes-m-pill-level {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-strong);
  border-color: var(--accent-dark);
}

.tes-m-pill-diff {
  border-color: #10b981;
}

.tes-m-pill-area {
  border-color: #0ea5e9;
}

.tes-m-pill-volume {
  border-color: #a78bfa;
}

.tes-m-sub {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  opacity: 0.8;
}

.tes-m-del {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  font-size: var(--fs-md);
  line-height: 1;
  padding: 0 1px 0 2px;
}

.tes-m-del:hover {
  opacity: 1;
}

.tes-m-node {
  position: absolute;
  top: 0;
  left: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.45);
  pointer-events: auto;
  cursor: grab;
  transition: transform 0.08s ease;
}

.tes-m-node:hover {
  background: #0ea5e9;
}

.tes-m-node:active {
  cursor: grabbing;
}

.tes-m-node-diff {
  background: #059669;
}

/* =========================================================================
   MÓDULO INTEGRAL DE ESCALERAS (DISENO-MINIMO-BASICO)
   ========================================================================= */
.stair-module-panel {
  left: calc(var(--tes-left-edge, var(--tes-left-w)) + var(--tes-gap) + var(--tes-gap));
  right: auto;
  top: var(--tes-dock-top);
  width: min(452px, calc(100vw - 24px));
  max-height: calc(100vh - var(--tes-dock-top) - var(--tes-dock-bottom));
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .stair-module-panel {
    left: var(--tes-gap);
  }
}

.stair-module-body {
  padding: 10px var(--sp-3) var(--sp-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
}

.stair-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.stair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.stair-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stair-field.full {
  grid-column: 1 / -1;
}

.stair-field label {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.stair-field input,
.stair-field select {
  height: var(--h-ctrl-sm);
  padding: 0 var(--sp-2);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  background: var(--panel-solid);
  color: var(--text-strong);
}

.stair-kpi-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  background: var(--panel-subtle);
}

.stair-kpi-strip.st-ok {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.stair-kpi-strip.st-warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.stair-kpi-strip.st-bad {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.stair-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.stair-chk {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-strong);
  cursor: pointer;
}

.stair-note {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.stair-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow-x: auto;
}

.stair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.stair-table th,
.stair-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.stair-table th {
  background: var(--panel-subtle);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}

.stair-table tr.active {
  background: #eff6ff;
}

.stair-table td.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}

.stair-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.stair-val-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.stair-val-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  border: 1px solid var(--border);
}

.stair-val-item.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.stair-val-item.aceptable {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.stair-val-item.alerta {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.stair-sys-card {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-subtle);
  font-size: var(--fs-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stair-2d-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
}

.stair-2d-bar .btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.stair-svg-box {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-solid);
  overflow: hidden;
}

.stair-svg-box svg {
  width: 100%;
  height: auto;
  display: block;
}

.btn-xs {
  height: 24px;
  padding: 0 8px;
  font-size: var(--fs-xs);
}

.rfi-callouts-layer {
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  overflow: hidden;
}

.rfi-callouts-layer.hidden {
  display: none;
}

.rfi-callout-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.rfi-callout-pin:hover,
.rfi-callout-pin.active {
  background: #e11d48;
  transform: translate(-50%, -50%) scale(1.16);
  z-index: 28;
}

.rfi-relation-panel {
  position: absolute;
  left: 12px;
  bottom: 34px;
  z-index: 33;
  width: min(360px, calc(100vw - 24px));
  max-height: 280px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.rfi-relation-panel.hidden {
  display: none;
}

.rfi-relation-panel.collapsed .rfi-relation-body {
  display: none;
}

.rfi-relation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
}

.rfi-relation-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rfi-relation-body {
  overflow-y: auto;
  max-height: 230px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rfi-relation-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}

.rfi-relation-row:hover,
.rfi-relation-row.active {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.rfi-relation-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.rfi-relation-row.active .rfi-relation-num {
  background: #e11d48;
}

.rfi-relation-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rfi-relation-main {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfi-relation-sub {
  font-size: 10.5px;
  color: #475569;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfi-invite-inline {
  display: flex;
  gap: 5px;
  align-items: center;
}

.rfi-invite-inline input {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 11.5px;
  font-family: inherit;
}

.rfi-rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  cursor: pointer;
}

/* =========================================================================
   PERMISOS TEMPORALES, ROLES Y ALERTAS DE AUTORIZACIÓN (5m / 1h / 1d)
   ========================================================================= */
#btn-access-requests.has-pending {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

#btn-access-requests.has-grant {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}

.access-popover {
  width: 330px;
  max-height: 72vh;
}

.ac-popover-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ac-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #475569);
  padding: 4px 2px 2px;
}

.ac-card {
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ac-card--active {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.ac-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ac-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-strong, #0f172a);
}

.ac-card-sub {
  font-size: 11px;
  color: var(--muted, #475569);
}

.ac-card-actions,
.ac-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.ac-wa-box {
  border-top: 1px solid var(--border, #e2e8f0);
  margin-top: 4px;
  padding-top: 6px;
}

.ac-wa-form {
  display: flex;
  gap: 5px;
}

.ac-wa-form input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
}

.tes-access-toast {
  position: fixed;
  right: 14px;
  bottom: 62px;
  z-index: 9300;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid #f59e0b;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ac-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #92400e;
}

.ac-toast-msg {
  font-size: 12px;
  color: #0f172a;
  line-height: 1.35;
}

.ac-toast-reason {
  margin-top: 3px;
  font-size: 11px;
  color: #475569;
}

.access-req-modal {
  width: 360px;
  max-width: calc(100vw - 24px);
}

.ac-modal-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ac-modal-body input[type="text"] {
  height: 30px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
}

.ac-wa-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
}

.ws-proj-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-proj-card .ws-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ws-proj-open-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.ws-proj-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ws-proj-admins-box {
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* =========================================================================
   INTERFAZ MÓVIL PRÁCTICA DE PULGAR (<= 768px) Y HORIZONTAL (LANDSCAPE)
   Diseño mínimo básico: máxima área 3D, botones táctiles claros, hojas
   inferiores expandibles, barra contextual de selección y cero solapamientos.
   ========================================================================= */
.mob-more-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 1.5px #ffffff;
  pointer-events: none;
}

.mob-more-dot.is-grant {
  background: #10b981;
}

.mob-thumb-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mob-sel-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1.5px #ffffff;
}

.mob-viz-body {
  padding: 10px 12px 14px;
  gap: 10px;
}

.mob-viz-sec {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.mob-viz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mob-viz-chip {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.mob-viz-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}

.mob-viz-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mob-viz-actions .btn {
  height: 38px;
  font-size: 12px;
  border-radius: 8px;
}

@media (max-width: 768px) {
  :root {
    --tes-mob-safe-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-only-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 1. Barra superior limpia + accesos rápidos arriba (CERO botones en el borde inferior del teléfono) */
  .topbar.tes-ribbon-topbar {
    height: auto !important;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 68 !important;
  }

  .ribbon-tabs-row {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding: 5px 8px 4px;
    gap: 4px 5px;
    background: transparent;
    border-bottom: none;
  }

  .topbar-left {
    display: contents;
  }

  .tes-app-badge {
    display: none;
  }

  .tes-home-brand-btn {
    order: 0;
    height: 32px;
    padding: 0 3px;
    gap: 0;
  }

  .tes-home-brand-btn .tes-brand-isotipo {
    width: 24px;
    height: 24px;
  }

  .tes-home-brand-btn .tes-brand-wordmark {
    display: none;
  }

  .tes-app-menu-wrap {
    order: 1;
    flex-shrink: 0;
  }

  .tes-menu-trigger {
    width: 34px;
    height: 34px;
    font-size: 16px;
    border-radius: 8px;
  }

  .tes-app-menu-dropdown {
    min-width: 228px;
    padding: 6px;
    border-radius: 12px;
    gap: 2px;
  }

  .tes-menu-item {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    display: flex;
    align-items: center;
  }

  .brand {
    order: 1;
    flex: 1 1 56px;
    min-width: 48px;
    max-width: none;
    font-size: 13px;
    padding: 4px 4px 4px 2px;
    border-right: none;
    cursor: pointer;
  }

  #btn-buildings {
    order: 1;
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
    gap: 3px;
    max-width: 96px;
    overflow: hidden;
    flex-shrink: 1;
  }

  #buildings-pill-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    order: 2;
    margin-left: auto;
    gap: 4px;
    flex-shrink: 0;
  }

  #btn-session,
  #btn-online,
  #btn-history,
  #btn-access-requests,
  #mcp-status-pill {
    display: none !important;
  }

  .topbar-right .mcp-pill,
  .topbar-right .btn-icon {
    height: 32px;
    padding: 0 9px;
    font-size: 12px;
    gap: 4px;
    border-radius: 8px;
  }

  .topbar-right .btn-icon {
    min-width: 32px;
    padding: 0 6px;
    font-size: 15px;
    position: relative;
  }

  /* 5 accesos principales (Vistas, Props, Orbitar, Visual, Inicio) integrados arriba:
     siempre tocables, jamás se atoran con los botones inferiores del teléfono */
  .mobile-thumb-bar {
    display: flex;
    width: 100%;
    height: 38px;
    padding: 3px 6px;
    gap: 4px;
    background: var(--panel-subtle);
    border-top: 1px solid var(--border);
    align-items: stretch;
    justify-content: space-between;
  }

  .mob-thumb-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    padding: 0 4px;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
  }

  .mob-thumb-btn.active {
    background: var(--accent-soft);
    border-color: rgba(2, 132, 199, 0.28);
    color: var(--accent-dark);
  }

  .mob-thumb-btn.pan-active {
    background: #fef3c7;
    border-color: rgba(217, 119, 6, 0.35);
    color: #b45309;
  }

  .tes-ribbon-tabs {
    order: 3;
    flex-basis: 100%;
    height: 32px;
    padding-top: 2px;
    border-top: 1px solid var(--border);
    gap: 2px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .tes-tab-btn {
    font-size: 12px;
    padding: 0 9px;
    height: 30px;
    line-height: 1.1;
    scroll-snap-align: start;
  }

  .tes-tab-btn.file-tab {
    padding: 0 9px;
    height: 24px;
    margin: auto 2px auto 0;
  }

  body.ribbon-compact .tes-ribbon-tabs {
    display: none !important;
  }

  /* Tira de comandos: plegada por defecto en móvil hasta tocar pestaña con comandos */
  .ribbon-panels-bar {
    display: none;
    height: 42px;
    padding: 0 8px;
    border-top: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.98);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  }

  .ribbon-panels-bar::-webkit-scrollbar {
    display: none;
  }

  body.ribbon-has-commands.mob-ribbon-cmds-open:not(.ribbon-compact) .ribbon-panels-bar {
    display: flex;
  }

  .ribbon-group-tag,
  .ribbon-group-label,
  .ribbon-empty-hint {
    display: none;
  }

  .ribbon-cmd-group {
    height: 34px;
    gap: 6px;
    padding-right: 8px;
    flex-shrink: 0;
  }

  .ribbon-cmd-btn {
    height: 34px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 8px;
  }

  .ribbon-cmd-btn.ribbon-icon-only {
    width: 36px;
    height: 34px;
  }

  .ribbon-cmd-btn.ribbon-icon-only svg {
    width: 18px;
    height: 18px;
  }

  .ribbon-dropdown-menu {
    min-width: 224px;
    padding: 6px;
    border-radius: 12px;
  }

  .ribbon-dropdown-item {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
  }

  /* 2. Área 3D a pantalla completa abajo (0 barras fijadas al borde inferior del celular) */
  .view-panel,
  body.ribbon-compact .view-panel {
    top: var(--tes-top-offset, 114px) !important;
    bottom: 0 !important;
  }

  .tes-statusbar,
  .lateral-tabs-bar,
  body.ribbon-compact .lateral-tabs-bar {
    display: none !important;
  }

  .viewcube-hud,
  body.props-hidden .viewcube-hud,
  body.ribbon-compact .viewcube-hud {
    top: calc(var(--tes-top-offset, 114px) + 6px) !important;
    right: 6px !important;
    width: 88px;
    height: 88px;
    transform: scale(0.66);
    transform-origin: top right;
  }

  /* 3. Cápsula táctil lateral derecha debajo del ViewCube (lejos de los botones inferiores del teléfono) */
  .mobile-nav-dock {
    display: inline-flex;
    flex-direction: column;
    position: fixed;
    left: auto;
    right: 8px;
    top: calc(var(--tes-top-offset, 114px) + 74px);
    bottom: auto;
    transform: none;
    z-index: 33;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(203, 213, 225, 0.95);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
    touch-action: none;
    transition: opacity 0.14s ease;
  }

  #btn-mob-nav-mode,
  #btn-mob-home {
    display: none;
  }

  .mob-dock-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .mob-dock-btn svg {
    width: 17px;
    height: 17px;
  }

  body.mob-sheet-open .mobile-nav-dock,
  body.mob-sheet-open .mobile-sel-bar {
    opacity: 0;
    pointer-events: none;
  }

  /* 4. Píldora contextual de selección 3D arriba a la izquierda (lejos de los botones inferiores del teléfono) */
  .mobile-sel-bar {
    display: flex;
    position: fixed;
    top: calc(var(--tes-top-offset, 114px) + 8px);
    left: 8px;
    right: 76px;
    bottom: auto;
    z-index: 35;
    align-items: center;
    gap: 4px;
    padding: 4px 5px 4px 10px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.93);
    color: #ffffff;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.26);
    transition: opacity 0.14s ease;
  }

  .mob-sel-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mob-sel-btn {
    height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mob-sel-btn.primary {
    background: var(--accent);
    border-color: #38bdf8;
    color: #ffffff;
  }

  .mob-sel-btn.icon {
    width: 28px;
    padding: 0;
    font-size: 16px;
    border-color: transparent;
    background: transparent;
    color: #cbd5e1;
  }

  /* Aviso discreto de actualización nueva arriba a la izquierda (nunca abajo) */
  .change-ticker-bar {
    background: transparent;
    border: none;
    pointer-events: none;
    height: 0;
    padding: 0 0 0 8px;
    top: calc(var(--tes-top-offset, 114px) + 8px);
    bottom: auto;
    justify-content: flex-start;
  }

  .change-ticker-badge,
  .change-ticker-viewport {
    display: none !important;
  }

  .ticker-update-pill {
    pointer-events: auto;
    height: 28px;
    border-radius: var(--r-pill);
    padding: 0 12px;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
  }

  /* 5. Velo de cierre (debajo del topbar z-68) y Paneles anclados arriba con margen seguro inferior (>= 68px) */
  .mobile-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 58;
  }

  .side-drawer,
  .side-right,
  .rfi-drawer,
  .canceleria-panel,
  .floating-popover,
  .chat-popover,
  .ai-popover,
  .buildings-popover,
  .vis-tree-popover,
  .worksets-popover,
  .visual-style-popover,
  .detail-level-popover,
  .isolate-popover,
  .section-legend-popover,
  .hvac-audit-panel,
  .stair-module-panel,
  .model-builder-panel,
  .access-popover,
  .mobile-visual-popover,
  body.props-hidden .chat-popover:not(.floating-detached) {
    left: 8px !important;
    right: 8px !important;
    top: calc(var(--tes-top-offset, 114px) + 6px) !important;
    bottom: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - var(--tes-mob-safe-bottom, 68px)) !important;
    border-radius: 14px !important;
    border: 1px solid var(--border-med) !important;
    padding: 0 !important;
    z-index: 62 !important;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.24);
    background: var(--panel-solid);
  }

  .topbar-right button,
  .floating-popover button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .ai-popover:not(.hidden),
  .chat-popover:not(.hidden) {
    display: flex !important;
    flex-direction: column !important;
  }

  .ai-popover,
  .chat-popover {
    height: min(56dvh, calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - var(--tes-mob-safe-bottom, 68px))) !important;
  }

  body.mob-kbd-open .ai-popover,
  body.mob-kbd-open .chat-popover {
    height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - 10px) !important;
    max-height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - 10px) !important;
  }

  .ai-popover.mob-sheet-tall,
  .chat-popover.mob-sheet-tall {
    height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - var(--tes-mob-safe-bottom, 68px)) !important;
  }

  .ai-panel-head {
    padding: 0 6px 0 10px !important;
    gap: 4px !important;
    min-height: 40px;
  }

  .ai-project-tag {
    display: none !important;
  }

  .ai-head-controls {
    gap: 3px !important;
    flex-shrink: 0;
    min-width: 0;
  }

  .ai-head-controls .btn-icon {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    font-size: 13px !important;
  }

  .ai-messages-body,
  .chat-list {
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 0% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .ai-guides-strip {
    flex-shrink: 0;
  }

  .hvac-audit-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hvac-list {
    max-height: none;
  }

  .hvac-head-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    max-width: calc(100% - 42px);
  }

  .hvac-head-tabs::-webkit-scrollbar {
    display: none;
  }

  .hvac-tab-btn {
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Popover compacto (⋯) anclado arriba a la derecha */
  .mobile-more-popover {
    left: auto !important;
    right: 8px !important;
    top: calc(var(--tes-top-offset, 114px) + 6px) !important;
    bottom: auto !important;
    width: min(264px, calc(100vw - 16px)) !important;
    max-height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - var(--tes-mob-safe-bottom, 68px)) !important;
    border-radius: 12px !important;
    border: 1px solid var(--border-med) !important;
    padding: 0 !important;
    box-shadow: var(--shadow-elevated);
  }

  .win-resize-handle,
  .win-resize-edge-left,
  .win-resize-edge-right {
    display: none !important;
  }

  .panel-head {
    height: 42px;
    font-size: 13px;
    padding: 0 12px;
    position: relative;
  }

  .panel-head .btn-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
    border-radius: 8px;
  }

  .tes-tree-root,
  .props-scroll-body,
  .popover-list,
  .rfi-list-body,
  .canceleria-panel-body,
  .chat-list,
  .stair-module-body {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    font-size: 13px;
    padding-bottom: 14px;
  }

  .rtree-header,
  .rtree-subheader,
  .rtree-item,
  .popover-row,
  .vstyle-opt,
  .fam-cat-hdr,
  .fam-type-row,
  .vis-tree-node-row {
    min-height: 40px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 13px;
  }

  .tes-type-selector {
    padding: 9px 12px;
    font-size: 13px;
  }

  .tes-prop-row {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }

  .props-actions-row .btn,
  .rfi-filter-btn,
  .mb-kinds-row .btn,
  .mb-actions-row .btn,
  .stair-actions-row .btn {
    min-height: 36px;
    font-size: 12px;
    padding: 0 10px;
  }

  .chat-form {
    padding: 8px 10px;
    gap: 6px;
  }

  .chat-form input,
  .ws-inline-form input,
  .ws-member-form input,
  .mb-fields-grid input,
  .mb-fields-grid select,
  .stair-field input,
  .stair-field select,
  .ac-modal-body input[type="text"],
  .ac-wa-form input,
  .budget-search-input,
  .ai-key-form input,
  #render-notes-input {
    font-size: 16px !important;
    min-height: 38px;
  }

  .chat-form .btn,
  .ai-mic-btn {
    height: 38px;
    min-width: 36px;
    flex-shrink: 0;
    padding: 0 10px;
    font-size: 13px;
  }

  .ai-model-select {
    max-width: 82px;
    height: 28px;
    font-size: 11px;
    padding: 0 4px;
  }

  /* 6. Panel de Presupuestos AIN (anclado debajo del topbar, despejado abajo) */
  .budget-viewer-panel {
    left: 8px !important;
    right: 8px !important;
    top: calc(var(--tes-top-offset, 114px) + 6px) !important;
    bottom: auto !important;
    transform: none !important;
    width: auto !important;
    height: calc(var(--tes-vvh, 100dvh) - var(--tes-top-offset, 114px) - var(--tes-mob-safe-bottom, 68px)) !important;
    max-height: none !important;
    border-radius: 14px !important;
    z-index: 64 !important;
  }

  .budget-viewer-panel.expanded {
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    height: calc(var(--tes-vvh, 100dvh) - var(--tes-mob-safe-bottom, 68px) - 8px) !important;
  }

  .budget-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .budget-report-select,
  .budget-div-select,
  .budget-search-input {
    min-width: 0;
    max-width: none;
    flex: 1 1 100%;
    height: 36px;
  }

  .budget-toolbar .btn {
    height: 34px;
    font-size: 12px;
    padding: 0 10px;
  }

  .budget-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 6px 10px;
    gap: 6px;
  }

  .budget-kpi {
    padding: 6px 8px;
  }

  .budget-kpi-v {
    font-size: 13px;
  }

  .budget-table-body {
    padding: 6px 8px 16px;
    -webkit-overflow-scrolling: touch;
  }

  /* 7. Modales dedicados con amplio margen inferior libre de los botones del teléfono */
  .tes-overlay-card {
    left: 8px !important;
    right: 8px !important;
    transform: none !important;
    width: auto !important;
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    bottom: var(--tes-mob-safe-bottom, 68px) !important;
    max-height: none !important;
    border-radius: 14px !important;
    z-index: 75 !important;
  }

  .workspaces-modal {
    left: 8px !important;
    right: 8px !important;
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    bottom: var(--tes-mob-safe-bottom, 68px) !important;
    transform: none !important;
    width: auto !important;
    max-height: none !important;
    border-radius: 14px !important;
    z-index: 76 !important;
  }

  .ws-grid {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 14px;
  }

  .ws-col {
    overflow: visible;
    flex: 0 0 auto;
    padding: 10px;
  }

  .ws-col-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .ws-form-row {
    flex-wrap: wrap;
  }

  .ws-form-row > input,
  .ws-form-row > select {
    flex: 1 1 120px !important;
    width: auto !important;
  }

  .ws-item-row {
    min-height: 44px;
    padding: 8px 10px;
  }

  .access-req-modal {
    top: 46% !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    transform: translateY(-50%) !important;
    height: auto !important;
    max-height: 76dvh !important;
    z-index: 82 !important;
  }

  .render-controls-row {
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  .render-controls-row select,
  .render-controls-row input {
    flex: 1 1 100%;
    height: 36px;
  }

  .render-controls-row .btn {
    flex: 1 1 auto;
    height: 36px;
  }

  /* 8. Barras contextuales sobre el 3D (Medir, RFI, Relación de datos, Alertas) */
  .measure-session-bar {
    top: 6px;
    left: 6px;
    right: 6px;
    transform: none;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 5px 8px;
    gap: 6px;
    border-radius: 10px;
  }

  .measure-session-bar::-webkit-scrollbar {
    display: none;
  }

  .measure-session-bar .btn {
    height: 32px;
    font-size: 12px;
    padding: 0 10px;
    flex-shrink: 0;
  }

  .tes-m-node {
    width: 16px;
    height: 16px;
    touch-action: none;
  }

  .tes-m-node::after {
    content: '';
    position: absolute;
    inset: -10px;
  }

  .rfi-session-bar {
    top: 6px;
    left: 6px;
    right: 6px;
    transform: none;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 5px 6px;
    gap: 5px;
    border-radius: 10px;
  }

  .rfi-session-bar::-webkit-scrollbar {
    display: none;
  }

  .rfi-session-bar .btn {
    height: 32px;
    font-size: 12px;
    padding: 0 10px;
    flex-shrink: 0;
  }

  .rfi-relation-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: var(--tes-mob-safe-bottom, 68px);
    max-height: 42dvh;
    border-radius: 12px;
  }

  .tes-access-toast {
    top: calc(var(--tes-top-offset, 114px) + 8px);
    bottom: auto;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }

  .workset-alert-banner {
    top: calc(var(--tes-top-offset, 114px) + 8px);
    left: 8px;
    right: 8px;
    transform: none;
    flex-wrap: wrap;
    font-size: 12px;
  }

  /* 9. Overlays a pantalla completa con resguardo inferior */
  .tes-memorias-overlay,
  .tas-plantas-overlay {
    padding: 0 0 var(--tes-mob-safe-bottom, 68px) !important;
    background: #0f172a !important;
  }

  .tes-memorias-card,
  .tas-plantas-card {
    height: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .tes-memorias-bar,
  .tas-plantas-bar {
    height: auto;
    min-height: 44px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .tes-memorias-tabs {
    flex: 1 1 100%;
    order: 2;
    scrollbar-width: none;
  }

  .tes-memorias-tabs::-webkit-scrollbar {
    display: none;
  }

  .tes-memorias-actions {
    order: 1;
    width: 100%;
    justify-content: flex-end;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mem-tab-btn,
  .mem-act-btn,
  .mem-close-btn,
  .tas-plantas-close {
    height: 32px;
    line-height: 30px;
    font-size: 12px;
  }

  .tas-plantas-sub {
    display: none;
  }

  .empty-workspace-cta {
    flex-direction: column;
    align-items: stretch;
    width: min(280px, calc(100vw - 32px));
    padding: 14px;
    gap: 8px;
    border-radius: 12px;
  }

  .empty-workspace-cta .btn {
    height: 42px;
    font-size: 13px;
  }

  .auth-card {
    width: min(340px, calc(100vw - 24px));
    padding: 22px 18px;
    border-radius: 14px;
  }

  .btn-google-signin {
    height: 44px;
    font-size: 14px;
  }

  .loading-toast {
    top: calc(var(--tes-top-offset, 114px) + 12px);
    bottom: auto;
    font-size: 12px;
    padding: 6px 14px;
  }
}

/* Orientación horizontal (landscape) en teléfonos */
@media (max-width: 932px) and (max-height: 480px) and (orientation: landscape) {
  :root {
    --tes-mob-safe-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .ribbon-tabs-row {
    padding: 3px 8px 2px;
  }

  .tes-menu-trigger,
  .topbar-right .mcp-pill,
  .topbar-right .btn-icon,
  #btn-buildings {
    height: 28px;
  }

  .tes-menu-trigger {
    width: 28px;
  }

  .mobile-thumb-bar {
    height: 32px;
  }

  .tes-ribbon-tabs {
    height: 26px;
  }

  .tes-tab-btn {
    height: 24px;
    font-size: 11px;
  }
}

/* =========================================================================
   PANEL LATERAL: SISTEMAS · CIRCUITOS Y CABLEADO (NOM-001-SEDE-2012)
   ========================================================================= */
.elec-circuits-panel {
  position: fixed;
  top: 90px;
  left: 12px;
  right: auto;
  bottom: 56px;
  width: min(760px, calc(100vw - 320px));
  max-height: none;
  display: flex;
  flex-direction: column;
  z-index: 62;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.elec-circuits-panel.is-wide {
  width: min(1280px, calc(100vw - 24px));
}
.ec-cuadro-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 8px;
  background: #1b365d;
  color: #f8fafc;
  font-size: 10.5px;
}
.ec-cuadro-banner strong { color: #ffffff; }
.ec-schedule-table thead th {
  background: #1e3a5f !important;
  color: #ffffff !important;
  border-bottom: 1px solid #0f2544 !important;
  font-size: 9.8px;
  line-height: 1.2;
  white-space: nowrap;
}
.ec-schedule-table thead th.ec-th-phA { background: #0369a1 !important; }
.ec-schedule-table thead th.ec-th-phB { background: #15803d !important; }
.ec-schedule-table thead th.ec-th-phC { background: #7e22ce !important; }
.ec-schedule-table td {
  white-space: nowrap;
}
.ec-schedule-table td:nth-child(4) {
  white-space: normal;
  min-width: 175px;
}
.ec-schedule-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.ec-schedule-table tbody tr.ec-row.active {
  background: #fee2e2 !important;
  box-shadow: inset 3px 0 0 #dc2626;
}
.ec-schedule-table tbody tr.ec-row.active td.ec-sticky-1,
.ec-schedule-table tbody tr.ec-row.active td.ec-sticky-2 {
  background: #fee2e2;
}
.ec-schedule-table th.ec-sticky-1,
.ec-schedule-table td.ec-sticky-1 {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
}
.ec-schedule-table th.ec-sticky-2,
.ec-schedule-table td.ec-sticky-2 {
  position: sticky;
  left: 34px;
  z-index: 2;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
}
.ec-schedule-table thead th.ec-sticky-1,
.ec-schedule-table thead th.ec-sticky-2 {
  z-index: 4;
}
.ec-col-ph {
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s;
}
.ec-col-ph.ph-A.has-val { background: rgba(2, 132, 199, 0.10); color: #0369a1; font-weight: 700; }
.ec-col-ph.ph-B.has-val { background: rgba(22, 163, 74, 0.10); color: #15803d; font-weight: 700; }
.ec-col-ph.ph-C.has-val { background: rgba(147, 51, 234, 0.10); color: #7e22ce; font-weight: 700; }
.ec-col-ph:hover { outline: 1px solid #0284c7; }
.ec-cuadro-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  padding: 6px 9px;
  background: #f1f5f9;
  border-top: 1px solid #cbd5e1;
  font-size: 10.2px;
  color: #1e293b;
}
.ec-table tr.ec-total-row td {
  background: #dbeafe !important;
  border-top: 2px solid #1b365d;
  color: #0f172a;
  font-size: 10.5px;
}

/* Formato oficial de entrega · Cuadro de Cargas por Circuito */
.ec-delivery-banner {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 10px;
  background: #0f172a;
  border-bottom: 2px solid #334155;
}
.ec-delivery-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
}
.ec-delivery-sub {
  font-size: 9.8px;
  font-weight: 500;
  color: #cbd5e1;
}
.ec-delivery-table {
  border-collapse: collapse;
}
.ec-delivery-table th,
.ec-delivery-table td {
  border: 1px solid #cbd5e1;
  padding: 3px 5px;
  text-align: center;
}
.ec-delivery-table thead th {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
  font-size: 8.8px;
  font-weight: 700;
  line-height: 1.15;
  vertical-align: middle;
  padding: 4px 4px;
}
.ec-delivery-table thead th.ec-th-load {
  min-width: 68px;
  max-width: 96px;
  white-space: normal;
  background: #1e293b !important;
}
.ec-delivery-table thead th.ec-th-group {
  background: #1b365d !important;
}
.ec-delivery-table th.ec-sticky-1,
.ec-delivery-table td.ec-sticky-1 {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 44px;
  width: 44px;
  text-align: center;
  border-right: 1px solid #94a3b8;
}
.ec-delivery-table th.ec-sticky-2,
.ec-delivery-table td.ec-sticky-2 {
  position: sticky;
  left: 44px;
  z-index: 2;
  min-width: 190px;
  max-width: 240px;
  text-align: left;
  border-right: 1px solid #94a3b8;
}
.ec-delivery-table td:nth-child(4) {
  white-space: nowrap;
  min-width: auto;
}
.ec-delivery-table td.ec-zone-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9.6px;
  font-weight: 600;
}
.ec-delivery-table td.ec-zone-cell .ec-wire {
  font-size: 9.6px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ec-delivery-table td.ec-qty-cell {
  font-weight: 600;
  color: #0f172a;
}
.ec-delivery-table td.ec-long-green,
.ec-delivery-table td.ec-long-green strong {
  color: #15803d !important;
  font-weight: 700;
}
.ec-delivery-unbal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 7px 10px;
  background: #f8fafc;
  border-top: 2px solid #0f172a;
  font-size: 10px;
  color: #1e293b;
}
.ec-unbal-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ec-unbal-legend {
  font-size: 9px;
  color: #475569;
  font-weight: 600;
}
.ec-unbal-right {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}
.ec-unbal-formula {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 10.5px;
  color: #0f172a;
}
.ec-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  font-size: 9.5px;
}
.ec-frac-num {
  border-bottom: 1.5px solid #0f172a;
  padding: 0 4px 1px;
}
.ec-frac-den {
  padding-top: 1px;
}
.ec-unbal-val {
  padding: 4px 9px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 10.8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}
.ec-unbal-val.ok {
  color: #15803d;
  border-color: #86efac;
  background: #f0fdf4;
}
.ec-unbal-val.err {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fef2f2;
}

.ec-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  font-size: 11.5px;
}

.ec-top-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ec-board-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.ec-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ec-circ-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-muted);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.ec-circ-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.ec-circ-pill .ec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.ec-circ-pill .ec-w {
  font-weight: 500;
  opacity: 0.78;
  font-size: 10px;
}

.ec-circ-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ec-circ-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.ec-circ-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

.ec-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.ec-badge.ok { background: #dcfce7; color: #166534; }
.ec-badge.warn { background: #fef3c7; color: #92400e; }
.ec-badge.err { background: #fee2e2; color: #991b1b; }

.ec-params-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ec-params-bar label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

.ec-params-bar select {
  font-size: 10.5px;
  padding: 2px 4px;
}

.ec-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.ec-kpi {
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}
.ec-kpi span { font-size: 9.5px; color: var(--muted); }
.ec-kpi strong { font-size: 12.5px; color: var(--ink); line-height: 1.2; }
.ec-kpi small { font-size: 9.5px; color: var(--muted-light); }
.ec-kpi.ok strong { color: #15803d; }
.ec-kpi.warn strong { color: #b45309; }
.ec-kpi.err strong { color: #b91c1c; }

.ec-audit-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  padding: 5px 8px;
}
.ec-audit-box summary {
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  cursor: pointer;
}
.ec-formulas {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  line-height: 1.38;
  color: #334155;
}
.ec-exp-note {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px dashed #cbd5e1;
  color: #475569;
}

.ec-subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.ec-subtab {
  border: 1px solid transparent;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.ec-subtab.active {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.ec-table-wrap {
  flex: 1;
  min-height: 110px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.ec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}
.ec-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.ec-table th.num, .ec-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ec-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.ec-table tr.ec-row { cursor: pointer; }
.ec-table tr.ec-row:hover { background: #eff6ff; }
.ec-id { font-weight: 600; color: #0f172a; }
.ec-wire { font-weight: 600; color: #1e293b; }
.ec-sub { font-size: 9.5px; color: #64748b; }
.ec-shared {
  display: inline-block;
  font-size: 9px;
  padding: 0 4px;
  border-radius: 3px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  margin-left: 3px;
}
.ec-fill.ok { color: #15803d; font-weight: 600; }
.ec-fill.err { color: #b91c1c; font-weight: 700; }

.ec-footer-acts {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  padding-top: 2px;
}

.ec-board-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.ec-itm-chk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.ec-phase-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.ec-ph-box {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}
.ec-ph-box span { font-size: 9.5px; color: var(--muted); font-weight: 600; }
.ec-ph-box strong { font-size: 12px; color: var(--ink); line-height: 1.2; }
.ec-ph-box small { font-size: 9.5px; color: var(--muted-light); }
.ec-ph-box.ph-A { border-left: 3px solid #0284c7; }
.ec-ph-box.ph-B { border-left: 3px solid #16a34a; }
.ec-ph-box.ph-C { border-left: 3px solid #9333ea; }
.ec-ph-box.ok strong { color: #15803d; }
.ec-ph-box.warn strong { color: #b45309; }

.ec-length-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border: 1px solid #334155;
}
.ec-length-hero.pick-active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}
.ec-length-hero-main {
  min-width: 0;
  flex: 1;
}
.ec-length-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}
.ec-length-name {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 500;
}
.ec-length-sub {
  margin-top: 3px;
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.35;
}
.ec-length-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  padding-left: 10px;
  border-left: 1px solid rgba(148, 163, 184, 0.3);
  white-space: nowrap;
}
.ec-length-tag {
  font-size: 8.5px;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #fbbf24;
}
.ec-length-readout strong {
  font-size: 20px;
  line-height: 1.1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.ec-length-readout small {
  font-size: 9.5px;
  color: #cbd5e1;
}
.ec-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #38bdf8;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
  text-decoration: underline;
}
.ec-action-strip {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.btn-danger-sm {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
}
.ec-edit-card {
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ec-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.ec-edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
}
.ec-edit-grid label.ec-ed-wide {
  grid-column: span 2;
}
.ec-edit-grid input,
.ec-edit-grid select {
  font-size: 11px;
  padding: 3px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}
.ec-edit-foot {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.ec-empty-board {
  padding: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  color: #475569;
}
.ec-table tr.ec-row.active {
  background: #e0f2fe;
}
.ec-len-cell strong {
  color: #0f172a;
  font-size: 11.5px;
}
.ec-phase {
  display: inline-block;
  width: 18px;
  text-align: center;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 0;
}
.ec-phase.ph-A { background: #e0f2fe; color: #0369a1; }
.ec-phase.ph-B { background: #dcfce7; color: #15803d; }
.ec-phase.ph-C { background: #f3e8ff; color: #7e22ce; }
.ec-step-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.ec-step-tag.st-emt { background: #e0f2fe; color: #0369a1; }
.ec-step-tag.st-codo { background: #fef3c7; color: #92400e; }
.ec-step-tag.st-caja { background: #e2e8f0; color: #334155; }
.ec-step-tag.st-flex { background: #cffafe; color: #0e7490; }
.ec-step-tag.st-bajada { background: #fee2e2; color: #991b1b; }
.ec-star {
  display: inline-block;
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: #fef3c7;
  color: #b45309;
  margin-left: 3px;
}
.ec-del-item {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}
.ec-del-item:hover { color: #dc2626; }

.ec-pipe-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 5px 6px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.ec-fbtn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}
.ec-fbtn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.ec-fbtn.f-ilum.active { background: #0284c7; border-color: #0284c7; }
.ec-fbtn.f-cont.active { background: #16a34a; border-color: #16a34a; }
.ec-fbtn.f-shared.active { background: #ea580c; border-color: #ea580c; }

.ec-sys-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.ec-sys-tag.sys-ilum { background: #e0f2fe; color: #0369a1; }
.ec-sys-tag.sys-cont { background: #dcfce7; color: #15803d; }
.ec-sys-tag.sys-fuerza { background: #fef3c7; color: #92400e; }
.ec-sys-tag.sys-mixto { background: #fae8ff; color: #a21caf; }
.ec-sys-tag.sys-none { background: #f1f5f9; color: #475569; }

.prop-ckt-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0 6px;
}
.prop-ckt-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.prop-ckt-pill:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
}
.prop-ckt-pill small {
  font-weight: 500;
  color: #475569;
  font-size: 9.5px;
}
.prop-wire-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  margin: 4px 0 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #0284c7;
  border-radius: 5px;
}
.prop-wire-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: #0f172a;
}
.prop-wire-line span {
  font-size: 10px;
  color: #475569;
}
.prop-wire-line.is-gnd strong {
  color: #15803d;
}


/* =========================================================================
   SIMULACIÓN DE VIENTO EN FACHADAS 3D (CFE-MDOC 2020) — public/wind_module.js
   ========================================================================= */
.wind-panel {
  position: fixed;
  top: 76px;
  left: 288px;
  width: 470px;
  max-width: calc(100vw - 24px);
  height: min(690px, calc(100vh - 110px));
  min-width: 340px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
  z-index: 42;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
}
.wind-panel.hidden { display: none !important; }
.wind-win-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: linear-gradient(90deg, #0f172a, #1e3a5f);
  color: #f8fafc;
  cursor: move;
  user-select: none;
}
.wind-win-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.wind-win-actions { display: flex; align-items: center; gap: 4px; }
.wind-win-actions .btn-icon-xs {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.wind-win-actions .btn-icon-xs:hover { background: rgba(255, 255, 255, 0.28); }
.wind-controls-bar {
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.wind-ctrl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  align-items: end;
}
.wind-ctrl-span2 { grid-column: 1 / -1; }
.wind-ctrl-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: #475569;
  font-weight: 600;
}
.wind-ctrl-field select,
.wind-ctrl-field input[type="range"] {
  width: 100%;
  font-size: 11px;
}
.wind-inline-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.wind-ctrl-checks {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  color: #334155;
  font-weight: 600;
  padding-bottom: 2px;
}
.wind-ctrl-checks label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.wind-tabs-bar {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 0 6px;
  gap: 2px;
}
.wind-tab {
  border: none;
  background: transparent;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.wind-tab.active {
  color: #0369a1;
  border-bottom-color: #0284c7;
  background: #ffffff;
}
.wind-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 10px;
  background: #ffffff;
}
.wind-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.wind-kpi {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wind-kpi span { font-size: 9.5px; color: #64748b; font-weight: 600; }
.wind-kpi strong { font-size: 12.5px; color: #0f172a; }
.wind-kpi small { font-size: 9px; color: #64748b; }
.wind-kpi--crit { background: #fef2f2; border-color: #fca5a5; }
.wind-kpi--crit strong { color: #b91c1c; }
.wind-kpi--alert { background: #fffbeb; border-color: #fcd34d; }
.wind-kpi--alert strong { color: #b45309; }
.wind-kpi--ok { background: #ecfdf5; border-color: #86efac; }
.wind-kpi--ok strong { color: #047857; }
.wind-source-note {
  font-size: 10px;
  color: #475569;
  margin-bottom: 8px;
  padding: 4px 6px;
  background: #f1f5f9;
  border-radius: 4px;
}
.wind-spots-list { display: flex; flex-direction: column; gap: 8px; }
.wind-spot-card {
  border: 1px solid #cbd5e1;
  border-left-width: 4px;
  border-radius: 6px;
  padding: 8px 9px;
  background: #ffffff;
}
.wind-spot-card--critico { border-left-color: #dc2626; background: #fffbfb; }
.wind-spot-card--alerta { border-left-color: #d97706; background: #fffdf7; }
.wind-spot-card--ok { border-left-color: #059669; background: #f9fefb; }
.wind-spot-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 5px;
}
.wind-spot-title { font-size: 11.5px; font-weight: 700; color: #0f172a; }
.wind-spot-sub { font-size: 10px; color: #64748b; }
.wind-spot-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 8px;
  font-size: 10.5px;
  margin-bottom: 6px;
  padding: 5px 6px;
  background: rgba(241, 245, 249, 0.75);
  border-radius: 4px;
}
.wind-spot-metrics span { color: #64748b; margin-right: 4px; }
.wind-spot-metrics strong { color: #0f172a; }
.wind-spot-rec {
  font-size: 10.5px;
  line-height: 1.4;
  color: #1e293b;
  margin-bottom: 6px;
}
.wind-spot-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.wind-spot-actions .btn-xs {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
}
.wind-spot-actions .btn-xs:hover { background: #e0f2fe; border-color: #7dd3fc; color: #0369a1; }
.wind-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.wind-badge--crit { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.wind-badge--alert { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.wind-badge--ok { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.wind-table-wrap { overflow-x: auto; }
.wind-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}
.wind-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 5px 5px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 9.5px;
}
.wind-table th.num, .wind-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.wind-table td {
  padding: 5px 5px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.wind-row { cursor: pointer; }
.wind-row:hover { background: #f0f9ff; }
.wind-row--critico { background: rgba(254, 226, 226, 0.35); }
.wind-row--alerta { background: rgba(254, 243, 199, 0.35); }
.wind-norma-box { font-size: 11px; line-height: 1.48; color: #1e293b; }
.wind-norma-box h4 { margin: 0 0 6px; font-size: 12px; color: #0f172a; }
.wind-norma-box ul { margin: 0 0 10px; padding-left: 16px; }
.wind-norma-box li { margin-bottom: 5px; }
.wind-export-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wind-cfd-note {
  padding: 7px 9px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 10.5px;
  color: #334155;
}
.wind-legend-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 10px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 10px;
}
.wind-leg-title { font-weight: 700; color: #334155; }
.wind-leg-chip {
  padding: 1px 6px;
  border-radius: 3px;
  color: #ffffff;
  font-weight: 700;
  font-size: 9.5px;
}
.wind-empty {
  padding: 18px;
  text-align: center;
  color: #64748b;
  font-size: 11.5px;
}


/* =========================================================================
   ESTUDIO DE LUMINANCIA E ILUMINACIÓN 3D (LÚMENES / LUX / CD/M² · NOM-025)
   ========================================================================= */
.luminance-study-panel {
  position: fixed;
  left: 274px;
  right: auto;
  top: 94px;
  bottom: auto;
  width: min(620px, calc(100vw - 290px));
  max-width: calc(100vw - 24px);
  height: calc(100vh - 138px);
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  z-index: 64;
}
.luminance-study-panel.hidden { display: none !important; }
.luminance-study-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 65%, #334155 100%);
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}
.lum-head-titles { display: flex; flex-direction: column; min-width: 0; }
.lum-head-main { font-size: 12px; font-weight: 700; color: #fde68a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lum-head-sub { font-size: 10px; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lum-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.lum-head-actions .btn-mini {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  cursor: pointer;
}
.lum-head-actions .btn-mini:hover { background: rgba(255, 255, 255, 0.22); }
.lum-head-actions .btn-icon { color: #f8fafc; }

.lum-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: #0f172a;
}

.lum-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.lum-ctrl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lum-field { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; font-size: 10.5px; font-weight: 600; color: #334155; }
.lum-field select {
  flex: 1 1 auto;
  min-width: 160px;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
}
.lum-btn {
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
}
.lum-btn:hover { background: #f1f5f9; }
.lum-btn--accent { background: #0f172a; color: #fde68a; border-color: #0f172a; }
.lum-btn--accent:hover { background: #1e293b; }

.lum-mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.lum-tab {
  padding: 5px 4px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  text-align: center;
}
.lum-tab:hover { background: #f1f5f9; }
.lum-tab.is-active {
  background: #0369a1;
  color: #ffffff;
  border-color: #0369a1;
}

.lum-opts-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: #334155;
}
.lum-chk { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 500; }
.lum-mini-sel { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin-left: auto; }
.lum-mini-sel select {
  padding: 2px 4px;
  font-size: 10.5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}

.lum-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lum-kpi {
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.lum-kpi--gold {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
}
.lum-kpi-val { font-size: 13px; font-weight: 800; color: #0f172a; line-height: 1.2; }
.lum-kpi--gold .lum-kpi-val { color: #b45309; }
.lum-kpi-lbl { font-size: 9.5px; color: #475569; margin-top: 2px; }

.lum-legend {
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.lum-legend-lbl { display: block; font-size: 10px; font-weight: 700; color: #334155; margin-bottom: 4px; }
.lum-legend-bar { height: 9px; border-radius: 4px; border: 1px solid rgba(15, 23, 42, 0.15); }
.lum-legend-bar--isolux {
  background: linear-gradient(90deg, #121644 0%, #1e40af 12%, #06b6d4 25%, #10b981 40%, #eab308 58%, #f97316 76%, #dc2626 91%, #fef08a 100%);
}
.lum-legend-bar--lumens {
  background: linear-gradient(90deg, #94a3b8 0%, #38bdf8 14%, #10b981 34%, #facc15 60%, #f97316 82%, #dc2626 100%);
}
.lum-legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: #475569;
  margin-top: 3px;
}
.lum-legend--pills { display: flex; flex-wrap: wrap; gap: 5px; }
.lum-status-pill {
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid transparent;
}

.lum-detail-card {
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lum-detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lum-detail-title { font-size: 12px; font-weight: 800; color: #0f172a; }
.lum-detail-lvl { font-weight: 500; color: #64748b; font-size: 11px; }
.lum-detail-norm { font-size: 10px; color: #475569; margin-top: 1px; }
.lum-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px 6px;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.lum-detail-grid div { display: flex; flex-direction: column; }
.lum-detail-grid span { font-size: 9.5px; color: #64748b; }
.lum-detail-grid strong { font-size: 11px; color: #0f172a; }
.lum-bk-list { display: flex; flex-direction: column; gap: 3px; }
.lum-bk-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  padding: 3px 6px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 4px;
}
.lum-bk-row.muted { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
.lum-bk-val { font-weight: 700; color: #92400e; white-space: nowrap; }
.lum-detail-actions { display: flex; gap: 6px; }

.lum-table-head-bar { display: flex; gap: 6px; align-items: center; }
.lum-table-head-bar input {
  flex: 1 1 auto;
  padding: 4px 7px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.lum-table-head-bar select {
  padding: 4px 6px;
  font-size: 10.5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}

.lum-table-wrap {
  flex: 1 1 200px;
  min-height: 170px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.lum-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.lum-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 5px 6px;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
  z-index: 2;
}
.lum-table tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.lum-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lum-table td.muted { color: #64748b; }
.lum-col-lm { font-weight: 800; color: #b45309; }
.lum-row { cursor: pointer; }
.lum-row:hover { background: #f8fafc; }
.lum-row.is-selected { background: #fef9c3 !important; }
.lum-area-name { font-weight: 600; color: #0f172a; }
.lum-area-lvl { font-size: 9.5px; color: #64748b; }
.lum-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 9px;
  font-size: 9.5px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lum-empty { padding: 20px; text-align: center; color: #64748b; }

/* Etiquetas 3D flotantes proyectadas sobre cada espacio en el visor */
.lum-3d-labels-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 12;
}
.lum-3d-badge {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: rgba(15, 23, 42, 0.84);
  color: #f8fafc;
  border: 1.3px solid #f59e0b;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(3px);
  transition: transform 0.05s linear, background 0.12s ease;
}
.lum-3d-badge:hover {
  background: rgba(15, 23, 42, 0.98);
  z-index: 20;
}
.lum-3d-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}
.lum-3d-badge-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #f1f5f9;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lum-3d-badge.is-selected {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 264px;
  max-width: 310px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 8px;
  border-width: 1.5px;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.55), 0 10px 26px rgba(0, 0, 0, 0.52);
  white-space: normal;
  cursor: default;
  z-index: 30;
}
.lum-3d-pop-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 5px;
}
.lum-3d-pop-title {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lum-3d-pop-pill {
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lum-3d-pop-btn {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border: none;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  cursor: pointer;
  line-height: 1.3;
}
.lum-3d-pop-btn:hover {
  background: rgba(250, 204, 21, 0.28);
  color: #ffffff;
}
.lum-3d-pop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
}
.lum-3d-pop-floor {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.48);
}
.lum-3d-pop-floor span {
  font-size: 8.5px;
  color: #fde68a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
}
.lum-3d-pop-floor strong {
  font-size: 11px;
  color: #ffffff;
  font-weight: 800;
}
.lum-3d-pop-floor strong small {
  font-weight: 500;
  color: #cbd5e1;
}
.lum-floor-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 5px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid #f59e0b;
  color: #ffffff;
}
.lum-floor-banner span {
  font-size: 9.5px;
  color: #fde68a;
  font-weight: 700;
}
.lum-floor-banner strong {
  font-size: 11.5px;
  color: #ffffff;
  font-weight: 800;
}
.lum-3d-pop-grid > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lum-3d-pop-grid span {
  font-size: 8.5px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.lum-3d-pop-grid strong {
  font-size: 10.5px;
  font-weight: 700;
  color: #f8fafc;
}
.lum-3d-pop-grid strong.lum-gold {
  color: #fde047;
}
.lum-3d-pop-grid small {
  font-weight: 500;
  color: #cbd5e1;
  font-size: 9px;
}
.lum-3d-pop-bks {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lum-3d-pop-bk {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 9.5px;
  color: #cbd5e1;
}
.lum-3d-pop-bk b { color: #fde047; }
.lum-3d-badge-lm { font-size: 10.5px; font-weight: 800; color: #fde047; }
.lum-3d-badge-sub { font-size: 9px; font-weight: 700; background: rgba(255, 255, 255, 0.92); padding: 0 4px; border-radius: 3px; }

/* =========================================================================
   v2.6.104 — INTERFAZ LIMPIA TESERACTO (SANDBOX → PRODUCCIÓN)
   ========================================================================= */
body.ticker-collapsed {
  --tes-ticker-h: 0px;
  --tes-bottom-h: 28px;
  --tes-dock-bottom: 40px;
}

.change-ticker-bar.ticker-collapsed {
  display: none !important;
}

.sb-ticker-toggle {
  width: 20px;
  height: 20px;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  margin-left: 2px;
}

.tes-home-brand-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 7px 0 4px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-strong);
  font-family: var(--font-sans);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.tes-home-brand-btn .tes-app-badge,
.tes-home-brand-btn .tes-brand-isotipo {
  order: 0;
}

.tes-home-brand-btn .tes-home-brand-name,
.tes-home-brand-btn .tes-brand-wordmark {
  order: 1;
}

.tes-brand-isotipo {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.tes-brand-wordmark {
  height: 11px;
  width: auto;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

@media (min-width: 769px) and (max-width: 1180px) {
  .tes-home-brand-btn {
    padding: 0 4px;
    gap: 0;
  }
  .tes-home-brand-btn .tes-brand-wordmark {
    display: none;
  }
}

.tes-home-brand-btn:hover {
  background: var(--hover);
  border-color: var(--border);
}

.tes-home-brand-name {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  white-space: nowrap;
}

/* Grupos de cinta limpios con etiquetas textuales claras */
.ribbon-cmd-group {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 6px;
  height: 28px;
  gap: 4px;
}

.ribbon-group-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-right: 4px;
  margin-right: 2px;
  border-right: 1px solid var(--border);
}

.tes-ribbon-panel {
  gap: 6px;
}

.ribbon-cmd-btn {
  height: 28px;
  padding: 0 10px;
  border-color: var(--border-med);
  background: var(--panel-solid);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.ribbon-cmd-group .ribbon-cmd-btn {
  height: 22px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  font-size: var(--fs-xs);
}

.ribbon-cmd-btn:hover {
  background: var(--panel-muted);
  border-color: var(--accent);
}

.ribbon-cmd-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.ribbon-cmd-btn--primary,
.ribbon-cmd-group .ribbon-cmd-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 500;
}

.ribbon-cmd-btn--primary:hover,
.ribbon-cmd-group .ribbon-cmd-btn--primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

/* Paneles acoplados estilo React Sandbox + solapas permanentes de 18px (escritorio) */
@media (min-width: 769px) and (max-width: 1120px) {
  :root {
    --tes-left-w: 224px;
    --tes-right-w: 244px;
  }
}

@media (min-width: 769px) {
  .lateral-tabs-bar,
  body.ribbon-compact .lateral-tabs-bar {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 34;
    display: block;
  }

  .side-drawer {
    top: var(--tes-topbar-h);
    left: 0;
    bottom: var(--tes-bottom-h);
    width: var(--tes-left-w);
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    box-shadow: none;
    background: var(--panel-solid);
  }

  .side-right {
    top: var(--tes-topbar-h);
    right: 0;
    bottom: var(--tes-bottom-h);
    width: var(--tes-right-w);
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-right: none;
    box-shadow: none;
    background: var(--panel-solid);
  }

  body.ribbon-compact .side-drawer,
  body.ribbon-compact .side-right {
    top: var(--tes-topbar-tabs-h);
  }

  .edge-tab-solapa {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: auto;
    min-height: 88px;
    padding: 10px 0;
    pointer-events: auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--panel-solid);
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    user-select: none;
    transition: background 0.14s, color 0.14s, border-color 0.14s, left 0.14s, right 0.14s;
  }

  .edge-tab-solapa:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
  }

  .edge-tab-left {
    left: var(--tes-left-edge, var(--tes-left-w));
    border-left: none;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    transform: translateY(-50%) rotate(180deg);
  }

  body.browser-hidden .edge-tab-left {
    left: 0;
  }

  .edge-tab-right {
    right: var(--tes-right-edge, var(--tes-right-w));
    border-right: none;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
  }

  body.props-hidden .edge-tab-right {
    right: 0;
  }

  body.tes-panel-resizing .edge-tab-solapa,
  body.tes-panel-resizing .viewcube-hud {
    transition: none !important;
  }

  .viewcube-hud {
    top: calc(var(--tes-topbar-h) + 6px);
    right: calc(var(--tes-right-edge, var(--tes-right-w)) + 12px);
  }

  body.ribbon-compact .viewcube-hud {
    top: calc(var(--tes-topbar-tabs-h) + 6px);
  }

  body.props-hidden .viewcube-hud {
    right: 12px;
  }

  /* Visores de Planos y Memorias acoplados al lienzo: el Navegador de proyectos permanece siempre visible */
  .tas-plantas-overlay,
  .tes-memorias-overlay {
    top: var(--tes-topbar-h);
    left: var(--tes-left-edge, var(--tes-left-w));
    right: 0;
    bottom: var(--tes-bottom-h);
    padding: 0;
    background: var(--panel-solid);
    z-index: 32;
    border-left: 1px solid var(--border);
  }

  body.ribbon-compact .tas-plantas-overlay,
  body.ribbon-compact .tes-memorias-overlay {
    top: var(--tes-topbar-tabs-h);
  }

  body.browser-hidden .tas-plantas-overlay,
  body.browser-hidden .tes-memorias-overlay {
    left: 0;
    border-left: none;
  }

  .tas-plantas-overlay .tas-plantas-card,
  .tes-memorias-overlay .tes-memorias-card {
    width: 100%;
    max-width: none;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .sheet-viewer-card {
    left: calc(var(--tes-left-edge, var(--tes-left-w)) + 12px) !important;
    right: 12px !important;
    top: calc(var(--tes-topbar-h) + 8px) !important;
    bottom: calc(var(--tes-bottom-h) + 8px) !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 33;
  }

  body.browser-hidden .sheet-viewer-card {
    left: 12px !important;
  }

  body.ribbon-compact .sheet-viewer-card {
    top: calc(var(--tes-topbar-tabs-h) + 8px) !important;
  }
}

.tes-readonly-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  min-height: 24px;
  border-radius: 4px;
  background: var(--panel-subtle, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
  color: var(--text-strong, #0f172a);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Botón Integral y Luminancia 3D dentro de Memorias normativas */
.rtree-subheader-mem {
  padding-right: 4px;
}

.mem-integral-btn,
.mem-lum-3d-btn {
  margin-left: auto;
  padding: 0 5px;
  height: 17px;
  line-height: 15px;
  border-radius: 3px;
  border: 1px solid var(--border-med);
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

.mem-integral-btn:hover,
.mem-lum-3d-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.mem-lum-3d-btn--render {
  background: #0f172a;
  color: #fde68a;
  border-color: #f59e0b;
  font-weight: 600;
}

.mem-lum-3d-btn--render:hover {
  background: #1e293b;
  color: #fef3c7;
  border-color: #fbbf24;
}

.rtree-item--lum-render {
  padding-left: 24px !important;
  font-size: 11px;
  color: #1e293b;
}

.lum-tab--render.is-active {
  background: #0f172a !important;
  color: #fde68a !important;
  border-color: #f59e0b !important;
}

.lum-render-bar {
  margin-top: 6px;
  padding: 8px 9px;
  border-radius: 6px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  border: 1px solid #334155;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
}

.lum-render-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: #fde68a;
  font-size: 11px;
}

.lum-render-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lum-render-slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 155px;
  color: #cbd5e1;
}

.lum-render-slider input[type="range"] {
  flex: 1;
  accent-color: #f59e0b;
  cursor: pointer;
}

.lum-render-bar .lum-mini-sel,
.lum-render-bar .lum-chk {
  color: #e2e8f0;
}

.lum-render-bar select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
}

.lum-render-cams {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-top: 5px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.lum-render-cams-lbl {
  font-size: 10px;
  color: #94a3b8;
  margin-right: 2px;
}

.lum-cam-chip {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 10.5px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.lum-cam-chip:hover {
  border-color: #38bdf8;
  color: #ffffff;
}

.lum-cam-chip.is-active {
  background: #f59e0b;
  color: #0f172a;
  border-color: #fde68a;
  font-weight: 600;
}

.lum-render-tip {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.35;
}

/* ViewCube translúcido en reposo y nítido al pasar el cursor */
.viewcube-hud {
  opacity: 0.44;
  transition: opacity 0.16s ease, right 0.15s ease;
}

.viewcube-hud:hover,
.viewcube-hud:focus-within {
  opacity: 0.98;
}

/* Jerarquía visual limpia en Navegador de proyectos */
.rtree-header {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-strong);
}

.rtree-subheader {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}

.rtree-children {
  margin-left: 8px;
  padding-left: 4px;
  border-left: 1px solid var(--border);
}

.rtree-subchildren {
  margin-left: 10px;
  padding-left: 4px;
  border-left: 1px solid rgba(203, 213, 225, 0.72);
}

.rtree-item {
  padding-left: 14px;
  border-left: 2px solid transparent;
}

.rtree-item.active {
  border-left-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent-dark);
  font-weight: 600;
}

/* Logo institucional CONSASUR en visor de Memorias */
.mem-brand-logo {
  height: 24px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  flex-shrink: 0;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
}


/* =========================================================================
   DIAGRAMA UNIFILAR GENERAL INTERACTIVO (SVG + TABLA NOM-001 + 3D)
   ========================================================================= */
.elec-unifilar-panel {
  position: fixed;
  left: calc(var(--tes-left-edge, var(--tes-left-w)) + 10px);
  right: auto;
  top: 86px;
  bottom: auto;
  width: min(1240px, calc(100vw - var(--tes-left-edge, var(--tes-left-w)) - 20px));
  max-width: calc(100vw - 20px);
  height: calc(100vh - 118px);
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  z-index: 66;
}
.unif-active-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unif-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.elec-unifilar-panel.hidden { display: none !important; }
.elec-unifilar-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 70%, #334155 100%);
  color: #f8fafc;
  border-bottom: 1px solid #334155;
}
.unif-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 10px;
  font-size: 11px;
  color: #0f172a;
  overflow: hidden;
}

.unif-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.unif-tabs { display: flex; gap: 4px; }
.unif-tab {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}
.unif-tab.is-active { background: #0f172a; color: #fde68a; border-color: #0f172a; }
.unif-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.unif-zoom-lbl { font-size: 10.5px; font-weight: 700; min-width: 38px; text-align: center; color: #334155; }
.unif-btn {
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
}
.unif-btn:hover { background: #f1f5f9; }
.unif-btn--accent { background: #0f172a; color: #fde68a; border-color: #0f172a; }
.unif-btn--accent:hover { background: #1e293b; }
.unif-btn--blue { background: #0284c7; color: #ffffff; border-color: #0284c7; }
.unif-btn--blue:hover { background: #0369a1; }

.unif-branch-strip {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.unif-bchip {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--bc, #0f172a);
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}
.unif-bchip:hover { background: #f8fafc; }
.unif-bchip.is-active { background: var(--bc, #0f172a); color: #ffffff; border-color: var(--bc, #0f172a); }

.unif-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.unif-kpi {
  padding: 5px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
}
.unif-kpi--blue { background: #eff6ff; border-color: #93c5fd; }
.unif-kpi-v { font-size: 12.5px; font-weight: 800; color: #0f172a; }
.unif-kpi--blue .unif-kpi-v { color: #1d4ed8; }
.unif-kpi-l { font-size: 9.5px; color: #475569; }

.unif-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 8px;
}
.unif-main-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
  overflow: hidden;
}
.unif-svg-viewport {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  position: relative;
  user-select: none;
}
.unif-svg-viewport:active { cursor: grabbing; }
.unif-svg-stage {
  transform-origin: 0 0;
  display: inline-block;
  will-change: transform;
}

.unif-inspector {
  min-height: 0;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px;
}
.unif-insp-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.unif-insp-code { font-size: 13px; font-weight: 800; }
.unif-insp-sub { font-size: 10.5px; color: #475569; margin-top: 2px; }
.unif-insp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.unif-insp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.unif-insp-grid div { display: flex; flex-direction: column; }
.unif-insp-grid span { font-size: 9px; color: #64748b; }
.unif-insp-grid strong { font-size: 10.5px; color: #0f172a; }
.unif-insp-block {
  padding: 6px 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.unif-insp-lbl { font-size: 9.5px; font-weight: 800; color: #334155; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 3px; }
.unif-insp-txt { font-size: 10.5px; color: #1e293b; line-height: 1.38; margin-top: 2px; }

.unif-feeders-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}
.unif-feeders-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.unif-feeders-bar input {
  flex: 1 1 auto;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.unif-feeders-cnt { font-size: 10.5px; font-weight: 700; color: #475569; white-space: nowrap; }
.unif-table-scroll { flex: 1 1 auto; overflow: auto; }
.unif-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.unif-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 6px;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
  z-index: 2;
}
.unif-table tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.unif-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unif-frow { cursor: pointer; }
.unif-frow:hover { background: #f8fafc; }
.unif-frow.is-selected { background: #fef9c3 !important; }
.unif-empty { padding: 24px; text-align: center; color: #64748b; }

@media (max-width: 960px) {
  .unif-kpis { grid-template-columns: repeat(3, 1fr); }
  .unif-workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 220px; }
}

/* Switch compacto Aislar disciplina y punto de color en Vínculos */
.tes-iso-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted, #475569);
  cursor: pointer;
  user-select: none;
  margin-left: auto;
  flex-shrink: 0;
}
.tes-iso-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.tes-iso-switch-track {
  position: relative;
  width: 24px;
  height: 13px;
  border-radius: 999px;
  background: #cbd5e1;
  display: inline-flex;
  align-items: center;
  padding: 1.5px;
  transition: background 140ms ease;
}
.tes-iso-switch-track > span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.28);
  transition: transform 140ms ease;
}
.tes-iso-switch input:checked + .tes-iso-switch-track {
  background: var(--primary, #0284c7);
}
.tes-iso-switch input:checked + .tes-iso-switch-track > span {
  transform: translateX(11px);
}
.tes-iso-switch.active {
  color: var(--primary, #0284c7);
  font-weight: 600;
}
.sb-iso-disc-switch {
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--bg, #f8fafc);
  margin-left: 0;
  font-size: 11px;
}
.sb-iso-disc-switch.active {
  border-color: var(--primary, #0284c7);
  background: #e0f2fe;
}
.rtree-disc-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  display: inline-block;
}
.iso-disc-sw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 600;
}
.mem-doc-title {
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rtree-node-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}
.rtree-node-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rtree-node-btn:hover {
  background: var(--bg, #f1f5f9);
  border-color: var(--border, #cbd5e1);
  color: var(--text-strong, #0f172a);
}
.ec-tree-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted, #64748b);
  margin-right: 3px;
}
.rtree-subnode-ec-grp > .rtree-subchildren {
  margin-left: 6px;
  padding-left: 2px;
}
.rtree-subnode-ec-grp > .rtree-subchildren > .rtree-item {
  padding-left: 10px;
}

/* Subencabezado plegable de agrupación dentro de E. Eléctrico -> Cuadros de Carga */
.rtree-subheader.rtree-ec-subhdr {
  min-height: 22px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #0369a1;
  background: #f0f9ff;
  border-left: 3px solid #0284c7;
  padding: 2px 6px;
  margin: 4px 4px 2px 4px;
  border-radius: 3px;
}
.rtree-subheader.rtree-ec-subhdr:hover {
  background: #e0f2fe;
}
.rtree-subheader.rtree-ec-subhdr .rtree-caret {
  color: #0284c7;
}
.rtree-subheader.rtree-ec-subhdr .rtree-badge {
  color: #0369a1;
  font-weight: 700;
}

/* =========================================================================
   ALERTAS DE REPORTES CRÍTICOS (CAMPANITA + POPOVER MÍNIMO BÁSICO)
   ========================================================================= */
.critical-alerts-pill {
  padding: 0 7px;
  gap: 4px;
}

.critical-alerts-pill .crit-bell-svg {
  flex-shrink: 0;
}

.critical-alerts-pill.has-critical {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.critical-alerts-pill.has-critical:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.critical-alerts-pill .crit-alerts-badge {
  margin-left: 0;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
}

.critical-alerts-popover {
  width: 356px;
  max-height: 74vh;
}

.crit-popover-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.crit-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
  flex-shrink: 0;
}

.crit-filter-btn {
  border: 1px solid var(--border-med);
  background: var(--panel-solid);
  color: var(--muted);
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.45;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.crit-filter-btn:hover {
  background: var(--panel-muted);
  color: var(--text-strong);
}

.crit-filter-btn.active {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 600;
}

.crit-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.crit-item-card {
  width: 100%;
  text-align: left;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-left: 3px solid #dc2626;
  border-radius: var(--r-sm);
  padding: 7px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  font-family: var(--font-sans);
  transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.crit-item-card:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}

.crit-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.crit-item-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

.crit-item-cat {
  font-size: 10.5px;
  color: var(--muted-light);
  white-space: nowrap;
}

.crit-item-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.crit-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-strong);
  line-height: 1.35;
}

.crit-item-detail {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crit-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-light);
}

/* =========================================================================
   MÓDULO VDC 4D Y VIDEO ORBITAL 360° (VENTANA SEPARADA DEL MODELO 3D)
   ========================================================================= */
:root {
  --tes-vdc-h: 272px;
  --tes-vdc-sep-h: 6px;
  --tes-vdc-w: 304px;
  --tes-vdc-sep-w: 6px;
}

.vdc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* División estricta sin traslape: ventana superior del Modelo 3D y ventana inferior VDC */
body.vdc-active #canvas-wrap,
body.vdc-active #plan-annotation-svg,
body.vdc-active #rfi-markup-svg,
body.vdc-active #measure-overlay-svg,
body.vdc-active #measure-labels-layer,
body.vdc-active #thermal-labels-layer,
body.vdc-active #rfi-callouts-layer {
  position: absolute;
  top: 0;
  left: var(--tes-left-edge, 0px);
  right: var(--tes-right-edge, 0px);
  bottom: calc(var(--tes-vdc-h, 272px) + var(--tes-vdc-sep-h, 6px));
  width: auto;
  height: auto;
}

body.vdc-active.browser-hidden #canvas-wrap,
body.vdc-active.browser-hidden #plan-annotation-svg,
body.vdc-active.browser-hidden #rfi-markup-svg,
body.vdc-active.browser-hidden #measure-overlay-svg,
body.vdc-active.browser-hidden #measure-labels-layer,
body.vdc-active.browser-hidden #thermal-labels-layer,
body.vdc-active.browser-hidden #rfi-callouts-layer {
  left: 0;
}

body.vdc-active.props-hidden #canvas-wrap,
body.vdc-active.props-hidden #plan-annotation-svg,
body.vdc-active.props-hidden #rfi-markup-svg,
body.vdc-active.props-hidden #measure-overlay-svg,
body.vdc-active.props-hidden #measure-labels-layer,
body.vdc-active.props-hidden #thermal-labels-layer,
body.vdc-active.props-hidden #rfi-callouts-layer {
  right: 0;
}

@media (min-width: 769px) {
  body.vdc-active .edge-tab-solapa {
    top: calc(var(--tes-topbar-h) + (100vh - var(--tes-topbar-h) - var(--tes-bottom-h) - var(--tes-vdc-h, 272px) - var(--tes-vdc-sep-h, 6px)) * 0.5);
  }
  body.vdc-active.ribbon-compact .edge-tab-solapa {
    top: calc(var(--tes-topbar-tabs-h) + (100vh - var(--tes-topbar-tabs-h) - var(--tes-bottom-h) - var(--tes-vdc-h, 272px) - var(--tes-vdc-sep-h, 6px)) * 0.5);
  }
}

.vdc-split-resizer {
  position: fixed;
  left: var(--tes-left-edge, 0px);
  right: var(--tes-right-edge, 0px);
  bottom: calc(var(--tes-bottom-h) + var(--tes-vdc-h, 272px));
  height: var(--tes-vdc-sep-h, 6px);
  z-index: 37;
  background: #e2e8f0;
  border-top: 1px solid var(--border-med);
  border-bottom: 1px solid var(--border-med);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  transition: background 0.12s ease;
}

.vdc-split-resizer:hover,
body.vdc-resizing .vdc-split-resizer {
  background: #bae6fd;
  border-color: var(--accent);
}

.vdc-split-resizer.hidden {
  display: none !important;
}

.vdc-split-grip {
  width: 38px;
  height: 2px;
  border-radius: 2px;
  background: #94a3b8;
}

.vdc-split-resizer:hover .vdc-split-grip,
body.vdc-resizing .vdc-split-grip {
  background: var(--accent-dark);
}

body.vdc-resizing {
  cursor: ns-resize !important;
  user-select: none !important;
}

.vdc-dock-panel {
  position: fixed;
  left: var(--tes-left-edge, 0px);
  right: var(--tes-right-edge, 0px);
  bottom: var(--tes-bottom-h);
  height: var(--tes-vdc-h, 272px);
  z-index: 36;
  background: var(--panel-solid);
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.browser-hidden .vdc-dock-panel,
body.browser-hidden .vdc-split-resizer {
  left: 0;
}

body.props-hidden .vdc-dock-panel,
body.props-hidden .vdc-split-resizer {
  right: 0;
}

.vdc-dock-panel.hidden {
  display: none !important;
}

.vdc-win-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #bae6fd;
  border-radius: var(--r-xs);
  padding: 1px 6px;
  line-height: 1.4;
  white-space: nowrap;
}

.vdc-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.vdc-transport,
.vdc-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vdc-play-btn {
  min-width: 28px;
  font-weight: 700;
}

.vdc-date-readout {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  min-width: 82px;
}

.vdc-pct-readout {
  font-size: 12px;
  font-weight: 700;
  color: #059669;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

.vdc-count-readout {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.vdc-orbit-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.vdc-dur-select {
  width: 60px;
  font-size: 11px;
  padding: 2px 4px;
}

.vdc-rec-btn.is-recording {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
}

.vdc-scrubber-row {
  position: relative;
  padding: 6px 10px 4px;
  background: var(--panel-solid);
}

.vdc-phase-strip {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 3px;
}

.vdc-strip-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  opacity: 0.8;
}

.vdc-timeline-slider {
  width: 100%;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.vdc-video-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
}

.vdc-video-result.hidden {
  display: none !important;
}

.vdc-video-preview {
  width: 148px;
  height: 84px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #0f172a;
  object-fit: contain;
  flex-shrink: 0;
}

.vdc-video-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: #065f46;
  min-width: 0;
}

.vdc-video-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vdc-gantt-wrap {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  min-height: 0;
  overflow: hidden;
}

.vdc-gantt-wrap.hidden {
  display: none !important;
}

.vdc-gantt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background: var(--panel-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.vdc-cfg-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.vdc-cfg-field .compact-select {
  font-size: 11px;
  height: 22px;
  padding: 0 5px;
}

.vdc-days-input {
  width: 58px;
  text-align: right;
}

.vdc-custom-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted-light);
}

.vdc-gantt-body {
  overflow-y: auto;
  max-height: 205px;
  background: var(--panel-solid);
}

.vdc-gantt-hdr,
.vdc-gantt-row {
  display: grid;
  grid-template-columns: 148px 106px 1fr 38px;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 11px;
}

.vdc-gantt-hdr {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.vdc-gantt-row {
  cursor: pointer;
  transition: background 0.1s ease;
}

.vdc-gantt-row:hover {
  background: #f8fafc;
}

.vdc-gantt-row.is-active {
  background: #ecfdf5;
}

.vdc-gantt-row.is-selected {
  background: #eff6ff;
}

.vdc-col-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.vdc-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-strong);
  font-weight: 500;
}

.vdc-row-cnt {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted-light);
  font-variant-numeric: tabular-nums;
}

.vdc-col-dates {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vdc-col-track {
  position: relative;
  height: 14px;
  background: #f8fafc;
  border-radius: 3px;
}

.vdc-gantt-ticks {
  background: transparent;
  height: 14px;
}

.vdc-gantt-ticks > span {
  position: absolute;
  top: 0;
  font-size: 9.5px;
  color: var(--muted-light);
  transform: translateX(-15%);
  white-space: nowrap;
}

.vdc-gantt-ticks > span:last-child {
  transform: translateX(-95%);
}

.vdc-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border: 1px solid;
  border-radius: 2px;
  overflow: hidden;
}

.vdc-bar-fill {
  height: 100%;
  transition: width 0.12s linear;
}

.vdc-playhead {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 1.5px;
  background: #dc2626;
  pointer-events: none;
}

.vdc-col-pct {
  text-align: right;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.vdc-prop-date {
  width: 124px;
  font-size: 11px;
  padding: 2px 4px;
}

/* =========================================================================
   MODO LATERAL VDC (BARRA DE TIEMPO A LA DERECHA · MODELO 3D ALTURA COMPLETA)
   ========================================================================= */
@media (min-width: 769px) {
  body.vdc-active.vdc-side #canvas-wrap,
  body.vdc-active.vdc-side #plan-annotation-svg,
  body.vdc-active.vdc-side #rfi-markup-svg,
  body.vdc-active.vdc-side #measure-overlay-svg,
  body.vdc-active.vdc-side #measure-labels-layer,
  body.vdc-active.vdc-side #thermal-labels-layer,
  body.vdc-active.vdc-side #rfi-callouts-layer {
    top: 0;
    bottom: 0;
    left: var(--tes-left-edge, 0px);
    right: calc(var(--tes-right-edge, 0px) + var(--tes-vdc-w, 304px) + var(--tes-vdc-sep-w, 6px));
  }

  body.vdc-active.vdc-side.browser-hidden #canvas-wrap,
  body.vdc-active.vdc-side.browser-hidden #plan-annotation-svg,
  body.vdc-active.vdc-side.browser-hidden #rfi-markup-svg,
  body.vdc-active.vdc-side.browser-hidden #measure-overlay-svg,
  body.vdc-active.vdc-side.browser-hidden #measure-labels-layer,
  body.vdc-active.vdc-side.browser-hidden #thermal-labels-layer,
  body.vdc-active.vdc-side.browser-hidden #rfi-callouts-layer {
    left: 0;
  }

  body.vdc-active.vdc-side.props-hidden #canvas-wrap,
  body.vdc-active.vdc-side.props-hidden #plan-annotation-svg,
  body.vdc-active.vdc-side.props-hidden #rfi-markup-svg,
  body.vdc-active.vdc-side.props-hidden #measure-overlay-svg,
  body.vdc-active.vdc-side.props-hidden #measure-labels-layer,
  body.vdc-active.vdc-side.props-hidden #thermal-labels-layer,
  body.vdc-active.vdc-side.props-hidden #rfi-callouts-layer {
    right: calc(var(--tes-vdc-w, 304px) + var(--tes-vdc-sep-w, 6px));
  }

  body.vdc-active.vdc-side .viewcube-hud {
    right: calc(var(--tes-right-edge, var(--tes-right-w)) + var(--tes-vdc-w, 304px) + var(--tes-vdc-sep-w, 6px) + 12px);
  }

  body.vdc-active.vdc-side.props-hidden .viewcube-hud {
    right: calc(var(--tes-vdc-w, 304px) + var(--tes-vdc-sep-w, 6px) + 12px);
  }

  body.vdc-active.vdc-side .edge-tab-solapa,
  body.vdc-active.vdc-side.ribbon-compact .edge-tab-solapa {
    top: 50%;
  }

  body.vdc-resizing-side {
    cursor: ew-resize !important;
    user-select: none !important;
  }

  body.vdc-resizing-side .viewcube-hud {
    transition: none !important;
  }

  body.vdc-active.vdc-side .vdc-split-resizer {
    top: var(--tes-topbar-h);
    bottom: var(--tes-bottom-h);
    left: auto;
    right: calc(var(--tes-right-edge, 0px) + var(--tes-vdc-w, 304px));
    width: var(--tes-vdc-sep-w, 6px);
    height: auto;
    border-top: none;
    border-bottom: none;
    border-left: 1px solid var(--border-med);
    border-right: 1px solid var(--border-med);
    cursor: ew-resize;
  }

  body.vdc-active.vdc-side.ribbon-compact .vdc-split-resizer {
    top: var(--tes-topbar-tabs-h);
  }

  body.vdc-active.vdc-side.props-hidden .vdc-split-resizer {
    right: var(--tes-vdc-w, 304px);
  }

  body.vdc-active.vdc-side .vdc-split-resizer:hover,
  body.vdc-resizing-side .vdc-split-resizer {
    background: #bae6fd;
    border-color: var(--accent);
  }

  body.vdc-active.vdc-side .vdc-split-grip {
    width: 2px;
    height: 38px;
  }

  body.vdc-active.vdc-side .vdc-dock-panel {
    top: var(--tes-topbar-h);
    bottom: var(--tes-bottom-h);
    left: auto;
    right: var(--tes-right-edge, 0px);
    width: var(--tes-vdc-w, 304px);
    height: auto;
    border-left: none;
  }

  body.vdc-active.vdc-side.ribbon-compact .vdc-dock-panel {
    top: var(--tes-topbar-tabs-h);
  }

  body.vdc-active.vdc-side.props-hidden .vdc-dock-panel {
    right: 0;
  }

  body.vdc-active.vdc-side .vdc-bar-top {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
  }

  body.vdc-active.vdc-side .vdc-transport {
    justify-content: flex-start;
    gap: 5px;
  }

  body.vdc-active.vdc-side .vdc-count-readout {
    width: 100%;
    font-size: 10.5px;
  }

  body.vdc-active.vdc-side .vdc-controls {
    justify-content: flex-start;
    gap: 5px;
  }

  body.vdc-active.vdc-side .vdc-controls #btn-vdc-close {
    margin-left: auto;
  }

  body.vdc-active.vdc-side .vdc-scrubber-row {
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border);
  }

  body.vdc-active.vdc-side .vdc-video-result {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  body.vdc-active.vdc-side .vdc-video-preview {
    width: 100%;
    height: 112px;
  }

  body.vdc-active.vdc-side .vdc-gantt-wrap {
    flex: 1 1 auto;
    border-top: none;
  }

  body.vdc-active.vdc-side .vdc-gantt-meta {
    gap: 6px;
    padding: 5px 10px;
  }

  body.vdc-active.vdc-side .vdc-custom-hint {
    margin-left: 0;
    width: 100%;
    font-size: 10px;
  }

  body.vdc-active.vdc-side .vdc-gantt-body {
    flex: 1 1 auto;
    max-height: none;
  }

  body.vdc-active.vdc-side .vdc-gantt-hdr {
    grid-template-columns: 1fr 34px;
    padding: 5px 10px;
  }

  body.vdc-active.vdc-side .vdc-gantt-hdr .vdc-col-dates,
  body.vdc-active.vdc-side .vdc-gantt-hdr .vdc-col-track {
    display: none;
  }

  body.vdc-active.vdc-side .vdc-gantt-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 3px 6px;
    padding: 6px 10px;
  }

  body.vdc-active.vdc-side .vdc-gantt-row .vdc-col-name {
    grid-column: 1;
    grid-row: 1;
  }

  body.vdc-active.vdc-side .vdc-gantt-row .vdc-col-pct {
    grid-column: 2;
    grid-row: 1;
    font-size: 11px;
  }

  body.vdc-active.vdc-side .vdc-gantt-row .vdc-col-dates {
    display: none;
  }

  body.vdc-active.vdc-side .vdc-gantt-row .vdc-col-track {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 12px;
  }

  /* Modo riel lateral ultra compacto cuando Programa está oculto */
  body.vdc-active.vdc-side.vdc-side-compact .vdc-bar-top {
    padding: 6px 6px;
    gap: 4px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-transport {
    justify-content: center;
    gap: 4px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-win-tag,
  body.vdc-active.vdc-side.vdc-side-compact .vdc-count-readout,
  body.vdc-active.vdc-side.vdc-side-compact .vdc-orbit-chk,
  body.vdc-active.vdc-side.vdc-side-compact .vdc-dur-select,
  body.vdc-active.vdc-side.vdc-side-compact .vdc-rec-btn {
    display: none;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-date-readout {
    width: 100%;
    min-width: 0;
    text-align: center;
    font-size: 10.5px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-pct-readout {
    width: 100%;
    min-width: 0;
    text-align: center;
    font-size: 12px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-controls .btn {
    width: 100%;
    padding: 0 4px;
    font-size: 10.5px;
    height: 24px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-controls #btn-vdc-close {
    margin-left: 0;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-scrubber-row {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    padding: 12px 10px;
    border-bottom: none;
    min-height: 120px;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-phase-strip {
    width: 6px;
    height: auto;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  body.vdc-active.vdc-side.vdc-side-compact .vdc-timeline-slider {
    width: 24px;
    height: 100%;
    writing-mode: vertical-lr;
    direction: ltr;
  }
}

@media (max-width: 768px) {
  body.vdc-active #canvas-wrap,
  body.vdc-active #plan-annotation-svg,
  body.vdc-active #rfi-markup-svg,
  body.vdc-active #measure-overlay-svg,
  body.vdc-active #measure-labels-layer,
  body.vdc-active #thermal-labels-layer,
  body.vdc-active #rfi-callouts-layer {
    left: 0;
    right: 0;
    bottom: calc(var(--tes-vdc-h, 224px) + var(--tes-vdc-sep-h, 6px));
  }
  .vdc-split-resizer {
    left: 0;
    right: 0;
    bottom: var(--tes-vdc-h, 224px);
  }
  .vdc-dock-panel {
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--tes-vdc-h, 224px);
  }
  .vdc-gantt-hdr,
  .vdc-gantt-row {
    grid-template-columns: 112px 1fr 34px;
  }
  .vdc-col-dates {
    display: none;
  }
}

/* =========================================================================
   OVERLAY DE VISTA 2D EN PLANTA + DETALLE MARCADO (CON ZOOM VECTORIAL)
   ========================================================================= */
.tes-p2d-zoom-grp {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
}
.tes-p2d-zbtn,
.tes-p2d-zval {
  height: 26px;
  border: none;
  background: transparent;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tes-p2d-zbtn {
  width: 26px;
  padding: 0;
  font-size: 14px;
}
.tes-p2d-zval {
  min-width: 46px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}
.tes-p2d-zbtn:hover,
.tes-p2d-zval:hover {
  background: rgba(255, 255, 255, 0.14);
}
.tes-plan2d-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tes-p2d-split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.92fr);
  gap: 8px;
  align-items: stretch;
}
.tes-p2d-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
}
.tes-p2d-pane.is-detail {
  border-color: #fca5a5;
}
.tes-p2d-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  flex-shrink: 0;
}
.tes-p2d-pane-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tes-p2d-zmini {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  overflow: hidden;
}
.tes-p2d-zmini button {
  height: 22px;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 6px;
}
.tes-p2d-zmini button:hover {
  background: #f1f5f9;
}
.tes-p2d-zmini .tes-p2d-zmini-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  min-width: 40px;
}
.tes-p2d-host {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tes-p2d-host > svg {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  cursor: grab;
}
.tes-p2d-host > svg.is-panning {
  cursor: grabbing !important;
}
.tes-p2d-meta {
  padding: 7px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11.5px;
  color: #1e293b;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
  flex-shrink: 0;
}
.tes-p2d-meta strong {
  color: #0f172a;
}
.tes-p2d-meta-fix {
  color: #047857;
  font-weight: 500;
}
@media (max-width: 1020px) {
  .tes-p2d-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .tes-p2d-host {
    min-height: 290px;
  }
}

/* =========================================================================
   VISOR VECTORIAL 2D DE PLANOS DE ESCRITORIO — ESTILO AUTODESK VIEWER
   ========================================================================= */
.sheet-viewer-card.is-adsk-sheet {
  padding: 0;
  overflow: hidden;
  border-color: #94a3b8;
}

.sheet-viewer-card.is-adsk-sheet .panel-head {
  background: #ffffff;
  border-bottom: 1px solid #d5dce4;
  min-height: 36px;
  padding: 4px 10px 4px 12px;
}

#sheet-viewer-title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-title-meta {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sheet-viewer-card.is-adsk-sheet .sheet-viewer-body {
  padding: 0 !important;
  overflow: hidden !important;
  background: #d2d6de;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sheet-viewer-card.is-sheet-fullscreen {
  position: fixed !important;
  inset: 8px !important;
  left: 8px !important;
  right: 8px !important;
  top: 8px !important;
  bottom: 8px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 90 !important;
}

.adsk-sheet-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  flex: 1 1 auto;
  background: #d2d6de;
  overflow: hidden;
  outline: none;
  user-select: none;
  transition: background-color 0.18s ease;
}

.adsk-sheet-root.is-dark-canvas {
  background: #1e222b;
}

.adsk-sheet-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.adsk-sheet-stage.is-grabbing {
  cursor: grabbing;
}

.adsk-sheet-paper {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.24), 0 0 0 1px rgba(15, 23, 42, 0.1);
  will-change: transform;
}

.adsk-sheet-root.is-dark-canvas .adsk-sheet-paper {
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.adsk-base-canvas,
.adsk-svg-img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.adsk-detail-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.06s ease-out;
}

.adsk-detail-canvas.is-ready {
  opacity: 1;
}

.adsk-sheet-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 8;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.adsk-sheet-progress.is-loading {
  opacity: 1;
}

.adsk-sheet-progress > span {
  display: block;
  width: 38%;
  height: 100%;
  background: #0696d7;
  animation: adskProgressSlide 1.05s infinite ease-in-out;
}

@keyframes adskProgressSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}

.adsk-sheet-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  z-index: 6;
}

/* Barra flotante inferior estilo Autodesk Viewer */
.adsk-sheet-dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: rgba(24, 29, 38, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  color: #f1f5f9;
  max-width: calc(100% - 24px);
}

.adsk-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.adsk-dock-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.adsk-dock-btn-txt {
  padding: 0 9px;
  font-size: 11.5px;
  white-space: nowrap;
}

.adsk-dock-zoom-readout {
  min-width: 48px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.adsk-dock-zoom-readout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.adsk-dock-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 3px;
  flex-shrink: 0;
}

.adsk-dock-pager {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.adsk-dock-pager.hidden {
  display: none;
}

.adsk-page-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #cbd5e1;
  padding: 0 4px;
  white-space: nowrap;
}

.adsk-dock-views-wrap {
  position: relative;
}

.adsk-views-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 220px;
  max-width: 300px;
  max-height: 240px;
  overflow-y: auto;
  background: #181d26;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.adsk-views-popover.hidden {
  display: none;
}

.adsk-view-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #f1f5f9;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}

.adsk-view-item:hover {
  background: rgba(6, 150, 215, 0.28);
}

.adsk-view-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adsk-view-item-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Estado limpio cuando una lámina aún no tiene PDF vectorial publicado */
.adsk-pending-root {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.adsk-pending-paper {
  width: min(560px, 92%);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.adsk-pending-code {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.adsk-pending-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
}

.adsk-pending-meta {
  font-size: 11.5px;
  color: #64748b;
  font-family: var(--font-mono);
}

.adsk-pending-note {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.adsk-pending-views {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.adsk-pending-vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 11.5px;
  cursor: pointer;
}

.adsk-pending-vp-btn:hover {
  border-color: #0696d7;
  background: #e6f4fb;
}

.adsk-pending-vp-btn small {
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.rtree-badge.is-pdf-badge {
  background: #0284c7;
  color: #ffffff;
  font-weight: 600;
}

/* =========================================================================
   PANTALLA DIVIDIDA DE PRESUPUESTOS (IZQUIERDA: PRESUPUESTO | DERECHA: MODELO 3D)
   ========================================================================= */
body.budget-split-active {
  --bs-left: var(--tes-left-edge, 0px);
  --bs-right: var(--tes-right-edge, 0px);
  --bs-vsep: var(--tes-budget-vsep, 6px);
  --bs-ratio: var(--tes-budget-split-ratio, 0.46);
  --bs-avail-w: calc(100% - var(--bs-left) - var(--bs-right) - var(--bs-vsep));
  --bs-budget-w: calc(var(--bs-avail-w) * var(--bs-ratio));
  --bs-model-left: calc(var(--bs-left) + var(--bs-budget-w) + var(--bs-vsep));
}

body.budget-split-active.browser-hidden {
  --bs-left: 0px;
}

body.budget-split-active.props-hidden {
  --bs-right: 0px;
}

/* PANEL DERECHO: Modelo 3D principal ocupa el lado derecho completo */
body.budget-split-active #canvas-wrap,
body.budget-split-active #plan-annotation-svg,
body.budget-split-active #rfi-markup-svg,
body.budget-split-active #measure-overlay-svg,
body.budget-split-active #measure-labels-layer,
body.budget-split-active #thermal-labels-layer,
body.budget-split-active #rfi-callouts-layer {
  position: absolute;
  top: 0;
  left: var(--bs-model-left);
  right: var(--bs-right);
  bottom: 0;
  width: auto;
  height: auto;
}

.budget-split-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-med);
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  max-width: 66%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.budget-split-left-tag {
  position: absolute;
  top: 10px;
  left: calc(var(--bs-model-left, 0px) + 12px);
  z-index: 22;
  pointer-events: none;
}

/* SEPARADOR VERTICAL ARRASTRABLE (Izquierda: Presupuesto | Derecha: Modelo 3D) */
.budget-split-v-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--bs-left, 0px) + var(--bs-budget-w, 46%));
  width: var(--bs-vsep, 6px);
  z-index: 40;
  background: #e2e8f0;
  border-left: 1px solid var(--border-med);
  border-right: 1px solid var(--border-med);
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  transition: background 0.12s ease;
}

.budget-split-v-resizer:hover,
body.budget-split-resizing-v .budget-split-v-resizer {
  background: #bae6fd;
  border-color: var(--accent);
}

.budget-split-v-grip {
  width: 2px;
  height: 44px;
  border-radius: 2px;
  background: #94a3b8;
}

.budget-split-v-resizer:hover .budget-split-v-grip,
body.budget-split-resizing-v .budget-split-v-grip {
  background: var(--accent-dark);
}

.budget-split-h-resizer {
  display: none !important;
}

body.budget-split-resizing-v {
  cursor: ew-resize !important;
  user-select: none !important;
}

/* VISOR 3D DE CONCEPTO (ARMADO / CONCRETO / CIMBRA / AISLADO) EN EL PANEL DERECHO */
.budget-concept-pane {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--bs-model-left, 50%);
  right: var(--bs-right, 0px);
  z-index: 25;
  background: radial-gradient(circle at 50% 42%, #f8fafc 0%, #e5ecf4 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.viz-paper-bg .budget-concept-pane {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.budget-concept-bar {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.budget-concept-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
}

.budget-concept-actions .btn {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--border-med);
  font-size: 11px;
  font-weight: 500;
  height: 26px;
  padding: 0 9px;
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.budget-concept-actions .btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-dark);
}

.budget-concept-canvas-wrap,
.budget-concept-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
}

.budget-concept-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-med);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
  font-size: 11px;
  color: var(--text-strong);
  pointer-events: none;
}

.budget-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.budget-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.28);
  flex-shrink: 0;
}

.budget-cutlist-card {
  position: absolute;
  top: 44px;
  right: 12px;
  z-index: 6;
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 110px);
  overflow: auto;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-med);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: var(--text-strong);
}

.budget-cutlist-card.hidden {
  display: none !important;
}

.budget-cutlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 12px;
}

.budget-cutlist-norms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 5px 8px;
  margin-bottom: 8px;
  border-radius: var(--r-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text);
}

.budget-cutlist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.budget-cutlist-table th,
.budget-cutlist-table td {
  padding: 4px 5px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.budget-cutlist-table th:first-child,
.budget-cutlist-table td:first-child {
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 600;
}

.budget-cutlist-foot {
  margin-top: 6px;
  font-size: 10.5px;
  color: #0f766e;
  font-weight: 600;
}

/* SIMULADOR 3D DE PROCESO CONSTRUCTIVO POR CONCEPTOS */
#btn-budget-story-mode.active {
  background: #0f766e;
  color: #ffffff;
  border-color: #115e59;
}

.budget-table tr.budget-item-row.story-active {
  background: #e0f2fe;
}

.budget-table tr.budget-item-row.story-active td:first-child {
  box-shadow: inset 3px 0 0 #0284c7;
}

.budget-story-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-med);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
}

.budget-story-hud.hidden {
  display: none !important;
}

.budget-story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.budget-story-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-strong);
}

.budget-story-phase {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: #0f766e;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.budget-story-metrics {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.budget-story-cost {
  font-weight: 700;
  color: #0f766e;
}

.budget-story-narrative {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text);
}

.budget-story-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.budget-story-slider {
  flex: 1;
  min-width: 80px;
  accent-color: #0f766e;
  cursor: pointer;
}

/* Panel del Concepto Ensamblado + Animación Paso a Paso */
.budget-asm-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 9.5px;
  font-weight: 600;
  vertical-align: middle;
}

.budget-assembly-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 44%;
  padding: 9px 11px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-med);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
}

.budget-assembly-panel.hidden {
  display: none !important;
}

.budget-asm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.budget-asm-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--text-strong);
}

.budget-asm-title-wrap span {
  font-size: 11px;
  color: #0f766e;
  font-weight: 600;
}

.budget-asm-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.budget-asm-steps {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: 185px;
}

.budget-asm-step-row {
  display: grid;
  grid-template-columns: 20px 10px 76px 1fr auto auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: rgba(248, 250, 252, 0.85);
  color: var(--text);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.budget-asm-step-row:hover {
  background: #f1f5f9;
  border-color: var(--border-med);
}

.budget-asm-step-row.is-active {
  background: rgba(15, 118, 110, 0.10);
  border-color: #0f766e;
  font-weight: 600;
}

.budget-asm-step-row.is-pending {
  opacity: 0.45;
}

.budget-asm-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
}

.budget-asm-step-row.is-active .budget-asm-step-num {
  background: #0f766e;
  color: #ffffff;
}

.budget-asm-step-row.is-done .budget-asm-step-num {
  background: #16a34a;
  color: #ffffff;
}

.budget-asm-step-code {
  font-size: 10.5px;
  color: var(--muted);
}

.budget-asm-step-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-asm-step-qty {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.budget-asm-step-amt {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
}

.budget-concept-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.budget-concept-pane.hidden,
.budget-split-left-tag.hidden,
.budget-split-v-resizer.hidden,
.budget-split-h-resizer.hidden,
.budget-concept-legend.hidden,
.budget-concept-empty.hidden {
  display: none !important;
}

/* PANEL IZQUIERDO: Presupuesto con conceptos a altura completa */
body.budget-split-active .budget-viewer-panel {
  position: fixed;
  top: var(--tes-topbar-h);
  bottom: var(--tes-bottom-h);
  left: var(--bs-left);
  right: auto;
  width: calc((100vw - var(--bs-left) - var(--bs-right) - var(--bs-vsep)) * var(--bs-ratio));
  height: auto;
  transform: none;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: none;
  box-shadow: none;
  z-index: 38;
}

body.budget-split-active.ribbon-compact .budget-viewer-panel {
  top: var(--tes-topbar-tabs-h);
}

body.budget-split-active .budget-viewer-panel.expanded {
  top: var(--tes-topbar-h);
  bottom: var(--tes-bottom-h);
  left: var(--bs-left);
  right: var(--bs-right);
  width: auto;
  height: auto;
  z-index: 44;
}

body.budget-split-active.ribbon-compact .budget-viewer-panel.expanded {
  top: var(--tes-topbar-tabs-h);
}

body.budget-split-active .budget-viewer-panel .win-resize-handle {
  display: none;
}

body.budget-split-active .budget-viewer-panel .floating-drag-handle {
  cursor: default;
}

body.budget-split-active .budget-toolbar {
  padding: 6px 10px;
  gap: 5px;
}

body.budget-split-active .budget-report-select {
  min-width: 170px;
  flex: 1 1 180px;
  max-width: none;
}

body.budget-split-active .budget-class-select,
body.budget-split-active .budget-div-select {
  min-width: 155px;
  flex: 1 1 165px;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.budget-split-active .budget-search-input {
  min-width: 130px;
  flex: 2 1 150px;
}

body.budget-split-active .budget-kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 10px;
  gap: 6px;
}

body.budget-split-active .budget-kpi {
  padding: 5px 8px;
}

body.budget-split-active .budget-kpi-v {
  font-size: 13px;
}

body.budget-split-active .budget-table-body {
  padding: 4px 8px 10px;
}

body.budget-split-active .budget-viewer-panel:not(.expanded) .budget-table td,
body.budget-split-active .budget-viewer-panel:not(.expanded) .budget-table th {
  padding: 5px 6px;
  font-size: 11.5px;
}

body.budget-split-active .budget-viewer-panel:not(.expanded) .budget-table td.desc-cell {
  max-width: 240px;
  white-space: normal;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.budget-split-active .budget-viewer-panel:not(.expanded) .budget-table tr.budget-item-row.selected td.desc-cell,
body.budget-split-active .budget-viewer-panel:not(.expanded) .budget-table tr.budget-item-row:hover td.desc-cell {
  display: table-cell;
  -webkit-line-clamp: unset;
  white-space: normal;
}

/* Badges visuales para Acero (Armado), Concreto y Cimbra */
.budget-src-pill.struct-acero {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.budget-src-pill.struct-concreto {
  background: #e2e8f0;
  color: #334155;
  border-color: #94a3b8;
}

.budget-src-pill.struct-cimbra {
  background: #fef3c7;
  color: #9a3412;
  border-color: #f59e0b;
}

#btn-budget-split-toggle.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #7dd3fc;
}

@media (min-width: 769px) {
  body.budget-split-active .viewcube-hud {
    left: auto;
    right: calc(var(--bs-right) + 14px);
  }
  body.budget-split-active.budget-concept-shown .viewcube-hud {
    opacity: 0;
    pointer-events: none;
  }
  body.budget-split-active .edge-tab-solapa {
    top: calc(var(--tes-topbar-h) + (100vh - var(--tes-topbar-h) - var(--tes-bottom-h)) * 0.5);
  }
  body.budget-split-active.ribbon-compact .edge-tab-solapa {
    top: calc(var(--tes-topbar-tabs-h) + (100vh - var(--tes-topbar-tabs-h) - var(--tes-bottom-h)) * 0.5);
  }
}

@media (max-width: 768px) {
  #btn-cmd-budget-split,
  #btn-budget-split-toggle,
  .budget-concept-pane,
  .budget-split-left-tag,
  .budget-split-v-resizer,
  .budget-split-h-resizer {
    display: none !important;
  }
}

/* =========================================================================
   RECORRIDO FOTORREALISTA 360° PROYECTIVO (MÍNIMO BÁSICO)
   ========================================================================= */
.tes-photoreal-hud {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 420;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  font-size: 12px;
  line-height: 1.2;
}
.tes-photoreal-hud.hidden {
  display: none !important;
}
.tes-pr-title {
  padding: 0 6px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tes-pr-btn {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.tes-pr-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.tes-pr-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
}
.tes-pr-btn.tes-pr-close {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}
.tes-pr-btn.tes-pr-close:hover {
  background: rgba(220, 38, 38, 0.35);
}
.tes-pr-align-bar {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 4px;
  border-left: 1px solid rgba(148, 163, 184, 0.28);
}
.tes-pr-align-bar.hidden,
.tes-pr-btn.hidden {
  display: none !important;
}
.tes-pr-yaw-val {
  min-width: 34px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #7dd3fc;
}
@media (max-width: 768px) {
  .tes-photoreal-hud {
    max-width: calc(100% - 16px);
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 12px;
    bottom: 10px;
    padding: 5px 7px;
    gap: 4px;
  }
  .tes-pr-title {
    max-width: 120px;
  }
}

/* Zoom interactivo y validación en Visor de Planos de Teseracto */
.sheet-zoom-grp {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  border-right: 1px solid var(--border);
}
.sheet-zoom-grp.hidden {
  display: none !important;
}
.sheet-zoom-viewport {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #e2e8f0;
  padding: 10px;
}
.sheet-zoom-viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}
.sheet-zoom-stage {
  transform-origin: top left;
  transition: transform 0.08s ease-out;
}
.btn-sheet-validate {
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 600;
}
.btn-sheet-validate.is-validated {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #166534 !important;
}
.rtree-val-check {
  color: #16a34a;
  font-weight: 800;
  margin-left: 4px;
  font-size: 11px;
}

/* Cuadernillo de Mobiliario Doble Carta Horizontal (431.8×279.4 mm) en Blanco y Negro técnico */
.montaje-sheet-page.is-doble-carta-bw {
  aspect-ratio: 431.8 / 279.4;
  max-width: 1360px;
  margin: 0 auto;
  background: #ffffff;
}
.montaje-sheet-page.is-doble-carta-bw svg {
  filter: grayscale(1) contrast(1.18);
}

/* Botón y Modal Cotizar MasterFormat (Presupuestos) */
.btn-budget-quote-toolbar {
  background: #0f766e !important;
  border-color: #0f766e !important;
  color: #ffffff !important;
  font-weight: 600;
}
.btn-budget-quote-toolbar:hover {
  background: #115e59 !important;
}
.quote-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 115;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.quote-modal-card {
  width: min(1040px, 96vw);
  max-height: 90vh;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans);
}
.quote-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.quote-modal-body {
  padding: 12px 14px;
  overflow: auto;
  display: grid;
  gap: 10px;
}
.quote-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.quote-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: auto;
  max-height: 44vh;
}
.quote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.quote-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 11px;
}
.quote-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.quote-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
}
.quote-pill.ok {
  background: #dcfce7;
  color: #166534;
}
.quote-pill.high {
  background: #dbeafe;
  color: #1e40af;
}
.quote-modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}


/* ===== Números generadores activos (v2.6.294) ===== */
.budget-qty-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent-dark, #0f766e);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}
.budget-qty-link:hover { color: #c2410c; }

.budget-gen-panel {
  position: absolute;
  left: 12px;
  top: 46px;
  bottom: 12px;
  width: min(540px, 64%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border-med);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  font-size: 11px;
  color: var(--text);
}
.budget-gen-panel.hidden { display: none !important; }
.budget-gen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-strong);
}
.budget-gen-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.budget-gen-total b { font-size: 14px; color: #c2410c; }
.budget-gen-muted { color: var(--text-muted, #64748b); font-size: 10.5px; }
.budget-gen-levels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 150px;
  overflow-y: auto;
  flex-shrink: 0;
}
.budget-gen-lv {
  display: grid;
  grid-template-columns: 1fr auto 84px;
  gap: 8px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: rgba(248, 250, 252, 0.9);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.budget-gen-lv span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-gen-lv span:last-child { text-align: right; }
.budget-gen-lv:hover { background: #f1f5f9; border-color: var(--border-med); }
.budget-gen-lv.is-active { background: rgba(249, 115, 22, 0.12); border-color: #f97316; font-weight: 600; }
.budget-gen-table-wrap { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--border-med); }
.budget-gen-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.budget-gen-table th,
.budget-gen-table td { padding: 3px 5px; border-bottom: 1px solid #eef2f6; white-space: nowrap; }
.budget-gen-table td:nth-child(2) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.budget-gen-table th { position: sticky; top: 0; background: #f8fafc; text-align: left; font-weight: 600; z-index: 1; }
.budget-gen-table .num { text-align: right; }
.budget-gen-table tbody tr[data-gen-piece] { cursor: pointer; }
.budget-gen-table tbody tr[data-gen-piece]:hover { background: #f1f5f9; }
.budget-gen-table tbody tr.is-active { background: rgba(15, 118, 110, 0.12); font-weight: 600; }
.budget-gen-lvrow td { background: #fff7ed; font-weight: 600; color: #9a3412; }
.budget-gen-table tfoot td { position: sticky; bottom: 0; background: #f8fafc; font-weight: 700; border-top: 1px solid var(--border-med); }
.budget-gen-buy { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.budget-gen-buy b { font-size: 13px; color: #0f766e; }
.budget-gen-buy-inp {
  width: 64px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border-med);
  border-radius: var(--r-xs);
  font: inherit;
  text-align: right;
}
.budget-gen-title { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.budget-gen-title span { font-size: 11px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-gen-lvrow { cursor: pointer; }
.budget-gen-ver {
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid #fdba74;
  border-radius: var(--r-xs);
  background: #ffffff;
  color: #9a3412;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.budget-gen-ver.is-ok { border-color: #0f766e; background: #0f766e; color: #ffffff; }
.budget-gen-ver.is-stale { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.budget-gen-ver-ok { color: #0f766e; font-weight: 700; }
.budget-gen-ver-stale { color: #b91c1c; font-weight: 600; font-size: 10.5px; }
