/* Tipografía y densidad visual unificadas.
   Incidencias es la referencia: títulos claros, subtítulos discretos y texto
   de trabajo compacto. Este archivo se carga al final y no modifica lógica. */
:root {
  --bim-font-family: "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --bim-font-xs: 10px;
  --bim-font-sm: 11px;
  --bim-font-base: 12px;
  --bim-font-subtitle: 13px;
  --bim-font-title: 15px;
  --bim-tree-font: 12px;
  --bim-tree-meta-font: 11px;
  --bim-tree-row-min-height: 28px;
  --bim-line-compact: 1.2;
  --bim-line-normal: 1.38;
}

/* ===== Familia tipográfica común ===== */
body,
button,
input,
select,
textarea,
optgroup,
option {
  font-family: var(--bim-font-family) !important;
}

.sidebar,
.viewer-card,
.mass-info-panel,
.properties-column,
.clash-column,
.works-column,
.plans-drawer,
.issues-panel-shell,
.general-settings-panel,
.loading-card,
.cloud-overlay,
.cloud-changes-panel,
.bim-dialog-overlay {
  font-family: var(--bim-font-family) !important;
  font-size: var(--bim-font-sm) !important;
  line-height: var(--bim-line-normal) !important;
}

/* Texto normal y controles: mismas proporciones que Incidencias. */
.sidebar button,
.sidebar input,
.sidebar select,
.viewer-card button,
.viewer-card input,
.viewer-card select,
.mass-info-panel button,
.mass-info-panel input,
.mass-info-panel select,
.mass-info-panel textarea,
.properties-column button,
.properties-column input,
.properties-column select,
.clash-column button,
.clash-column input,
.clash-column select,
.works-column button,
.works-column input,
.works-column select,
.plans-drawer button,
.plans-drawer input,
.plans-drawer select,
.general-settings-panel button,
.general-settings-panel input,
.general-settings-panel select,
.cloud-overlay button,
.cloud-overlay input,
.cloud-overlay select,
.cloud-changes-panel button,
.cloud-changes-panel input,
.cloud-changes-panel select,
.bim-dialog button,
.bim-dialog input,
.bim-dialog select,
.bim-dialog textarea {
  font-size: var(--bim-font-sm) !important;
  line-height: var(--bim-line-compact) !important;
}

/* Entradas de lectura/escritura ligeramente mayores que etiquetas auxiliares. */
.issues-search,
.issues-select,
.issues-input,
.issues-textarea,
.gi-input,
.gi-select,
.works-input,
.works-select,
.properties-search,
.tree-search,
.plans-search-input,
.plans-pdf-quality-select,
.general-settings-row select,
.cloud-field input,
.bim-dialog-input {
  font-size: var(--bim-font-base) !important;
}

/* ===== Jerarquía de títulos ===== */
.panel h2,
.issues-panel-heading strong,
.loading-card strong,
.general-settings-title strong,
.cloud-title-wrap strong,
.cloud-changes-panel-header strong,
.bim-dialog-title,
.viewer-overlay strong {
  font-size: var(--bim-font-title) !important;
  font-weight: 700 !important;
  line-height: 1.22 !important;
  letter-spacing: 0 !important;
}

.panel h3,
.property-group h3,
.issues-section-title strong,
.issues-view-heading strong,
.issues-config-heading strong,
.works-field-label,
.works-summary-title,
.clash-results-titlebar h3,
.general-settings-section-title,
.cloud-panel-title,
.bim-dialog-input-label {
  font-size: var(--bim-font-subtitle) !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
}

.issues-panel-heading span,
.issues-config-heading span,
.issues-view-heading span,
.general-settings-title span,
.cloud-title-wrap span,
.loading-card span,
.loading-card small,
.bim-dialog-subtitle,
.gi-subtle,
.works-partidas-summary,
.plans-status,
.header-status {
  font-size: var(--bim-font-sm) !important;
  line-height: var(--bim-line-normal) !important;
}

/* El estado vacío inicial y las ventanas de carga ya no dominan visualmente. */
.viewer-overlay strong { font-size: 19px !important; }
.viewer-overlay span { font-size: var(--bim-font-base) !important; }
.loading-card { gap: 8px !important; }
.loading-card strong { font-size: 14px !important; }
.loading-card span,
.loading-card small { font-size: var(--bim-font-sm) !important; }

/* ===== Ventanas flotantes y diálogos ===== */
.general-settings-panel,
.cloud-card,
.cloud-changes-panel,
.bim-dialog {
  font-size: var(--bim-font-sm) !important;
}
.general-settings-title strong,
.cloud-title-wrap strong,
.bim-dialog-title { font-size: var(--bim-font-title) !important; }
.cloud-title-wrap span,
.general-settings-note,
.bim-dialog-message { font-size: var(--bim-font-base) !important; line-height: 1.45 !important; }
.bim-dialog-header { padding: 16px 16px 11px !important; }
.bim-dialog-body { padding: 16px !important; }
.bim-dialog-actions { padding: 11px 16px 15px !important; }
.bim-dialog-icon { width: 32px !important; height: 32px !important; font-size: 16px !important; }
.bim-dialog-button { min-height: 32px !important; font-size: var(--bim-font-sm) !important; }
.cloud-title-wrap strong { font-size: var(--bim-font-title) !important; }
.cloud-panel-title,
.cloud-field span { font-size: var(--bim-font-sm) !important; }
.cloud-primary,
.cloud-secondary,
.cloud-login-button { font-size: var(--bim-font-sm) !important; }

/* ===== Cabecera: Guía junto a Pantalla completa ===== */
.top-header {
  font-family: var(--bim-font-family) !important;
}
.top-left-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}
.top-center-guide { display: none !important; }
.fullscreen-toggle-button,
.header-guide-link,
.header-upload,
.cloud-login-button {
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 12px !important;
  font-size: var(--bim-font-base) !important;
  border-radius: 8px !important;
  line-height: 1 !important;
}
.header-guide-link {
  position: static !important;
  transform: none !important;
  flex: 0 0 auto !important;
}

/* ===== Datos: barra de configuraciones sin recortes ===== */
.mass-info-panel {
  grid-template-rows: 44px minmax(0, 1fr) !important;
}
.saved-config-bar {
  grid-template-columns: 38px minmax(130px, .9fr) minmax(170px, 1.15fr) 86px !important;
  gap: 7px !important;
  min-height: 44px !important;
  height: 44px !important;
  padding: 6px 7px !important;
  align-items: center !important;
  overflow: visible !important;
}
.saved-config-name-input,
.saved-config-select,
.saved-config-save-button,
.saved-config-delete-button {
  height: 32px !important;
  min-height: 32px !important;
  min-width: 0 !important;
}
.saved-config-name-input,
.saved-config-select {
  width: 100% !important;
  padding-inline: 8px !important;
}
.saved-config-delete-button {
  width: 86px !important;
  padding-inline: 8px !important;
}

/* Obras usa la misma iconografía y densidad del bloque de Datos. */
.works-saved-config-bar {
  grid-template-columns: 38px minmax(130px, 1fr) minmax(150px, 1fr) 86px !important;
  min-height: 46px !important;
  padding: 7px !important;
}
.works-saved-config-name-input,
.works-saved-config-select,
.works-saved-config-save-button,
.works-saved-config-delete-button {
  height: 32px !important;
  min-height: 32px !important;
  min-width: 0 !important;
}

/* Icono Guardar minimalista, grande y legible. */
.saved-config-save-button,
.works-saved-config-save-button {
  width: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #eaf6ff !important;
}
.bim-save-icon {
  display: block !important;
  width: 23px !important;
  height: 23px !important;
  flex: 0 0 23px !important;
  color: currentColor !important;
}

/* ===== Interferencias: Grupo A/B más compacto y diferenciable ===== */
.clash-group {
  gap: 4px !important;
  grid-template-rows: 18px auto minmax(120px, 1fr) auto !important;
}
.clash-group > h3 {
  min-height: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  padding: 0 2px !important;
  display: flex !important;
  align-items: center !important;
  font-size: var(--bim-font-xs) !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
}
.clash-group:nth-child(1) > h3 { color: #38bdf8 !important; }
.clash-group:nth-child(2) > h3 { color: #f59e0b !important; }
.clash-project-search-row { min-height: 28px !important; }
.clash-project-search { height: 28px !important; }
.clash-tree-row { font-size: var(--bim-font-sm) !important; }
.clash-result-main,
.clash-item { font-size: var(--bim-font-sm) !important; }
.clash-result-main small,
.clash-item small { font-size: var(--bim-font-xs) !important; }

/* Menús y títulos internos mantienen la misma escala en todos los módulos. */
.issues-menu-tab,
.works-menu-button,
.clash-menu-tab {
  font-size: var(--bim-font-base) !important;
}
.sidebar-toggle-row span,
.control-section-toggle,
.gi-section-header,
.works-section-toggle,
.plans-counter-row,
.properties-header h2 {
  font-size: var(--bim-font-subtitle) !important;
}

/* Tablas y metadatos. */
.property-table,
.gi-table,
.works-partidas-table,
.works-summary-table,
.plans-list,
.clash-results-table {
  font-size: var(--bim-font-sm) !important;
}
.property-table th,
.gi-table th,
.works-partidas-table th,
.works-summary-table th {
  font-size: var(--bim-font-sm) !important;
  font-weight: 700 !important;
}


/* ===== Ajuste fino de escala: selector de modelos, Interferencias y navegación ===== */
/* El selector de modelos no heredaba la escala compacta de los paneles y por eso
   los nombres del árbol se mostraban con el tamaño base del navegador. */
.project-load-card {
  font-family: var(--bim-font-family) !important;
  font-size: var(--bim-font-sm) !important;
  line-height: var(--bim-line-normal) !important;
}
.project-load-header strong {
  font-size: var(--bim-font-title) !important;
  line-height: 1.22 !important;
}
.project-load-header span,
.project-load-summary {
  font-size: var(--bim-font-sm) !important;
  line-height: var(--bim-line-normal) !important;
}
.project-load-tree {
  font-size: var(--bim-font-sm) !important;
}
.project-load-node {
  min-height: 25px !important;
  padding-block: 3px !important;
  font-size: var(--bim-font-sm) !important;
  line-height: 1.25 !important;
}
.project-load-name {
  font-size: var(--bim-font-sm) !important;
  line-height: 1.25 !important;
}
.project-load-status,
.project-load-count,
.project-load-node small {
  font-size: var(--bim-font-xs) !important;
  line-height: 1.2 !important;
}
.project-load-toolbar button,
.project-load-secondary,
.project-load-primary {
  font-size: var(--bim-font-sm) !important;
}
.project-load-empty {
  font-size: var(--bim-font-sm) !important;
}

/* Árboles principales: Panel de control es la referencia visual. */
#projectTree .tree-parent,
#projectTree .tree-child,
#categoryList .category-parent,
#categoryList .tree-child,
.clash-tree-row,
.clash-tree-name {
  font-size: var(--bim-tree-font) !important;
  line-height: 1.25 !important;
}

#projectTree .tree-parent,
#projectTree .tree-child,
#categoryList .category-parent,
#categoryList .tree-child,
.clash-tree-row {
  min-height: var(--bim-tree-row-min-height) !important;
}

#projectTree .tree-count,
#categoryList .tree-count,
.clash-tree-row small,
.clash-tree-row .tree-count {
  font-size: var(--bim-tree-meta-font) !important;
  line-height: 1.2 !important;
}

/* Interferencias usa la misma escala normal que los demás paneles; únicamente
   metadatos y textos auxiliares se mantienen un nivel por debajo. */
.clash-column,
.clash-panel,
.clash-panel button,
.clash-panel input,
.clash-panel select,
.clash-item,
.clash-result-main,
.clash-field,
.clash-group-filters h4,
.clash-empty {
  font-size: var(--bim-font-sm) !important;
}
.clash-item small,
.clash-result-main small,
.clash-config-status small {
  font-size: var(--bim-font-xs) !important;
}
.clash-row h2,
.clash-row h3,
.clash-results-titlebar h3 {
  font-size: var(--bim-font-subtitle) !important;
}

/* Los selectores principales son acciones esenciales y deben destacar un poco más. */
.viewer-card .mobile-panel-button,
.mobile-panel-buttons .mobile-panel-button {
  font-size: 14px !important;
  letter-spacing: 0 !important;
}

@media (max-width: 900px) {
  :root {
    --bim-tree-font: 11px;
    --bim-tree-meta-font: 10px;
    --bim-tree-row-min-height: 25px;
  }
}

@media (max-width: 600px) {
  :root {
    --bim-tree-font: 10px;
    --bim-tree-meta-font: 9px;
    --bim-tree-row-min-height: 23px;
  }

  #projectTree .tree-parent,
  #projectTree .tree-child,
  #categoryList .category-parent,
  #categoryList .tree-child,
  .clash-tree-row {
    padding-block: 3px !important;
  }
}

@media (max-width: 820px) {
  .viewer-card .mobile-panel-button,
  .mobile-panel-buttons .mobile-panel-button { font-size: 11px !important; }
  .top-left-actions { gap: 5px !important; }
  .fullscreen-toggle-button,
  .header-guide-link,
  .header-upload,
  .cloud-login-button {
    min-height: 32px !important;
    height: 32px !important;
    padding-inline: 9px !important;
    font-size: var(--bim-font-sm) !important;
  }
  .saved-config-bar,
  .works-saved-config-bar {
    grid-template-columns: 36px minmax(110px, 1fr) minmax(130px, 1fr) 78px !important;
  }
  .saved-config-delete-button,
  .works-saved-config-delete-button { width: 78px !important; }
}

@media (max-width: 380px), (pointer: coarse) and (max-width: 380px) {
  .viewer-card .mobile-panel-button,
  .mobile-panel-buttons .mobile-panel-button { font-size: 10px !important; }
}


/* v18.12.1 - Mejora de legibilidad para iconos pequeños del toolbar del visor */
#gridButton,
#fitButton,
#fadeUnselectedButton,
#resetButton {
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

#sectionBoxButton .tool-icon {
  width: 25px !important;
  height: 25px !important;
  stroke-width: 2.15 !important;
}

@media (max-width: 1100px), (pointer: coarse) and (max-width: 1400px) {
  #gridButton,
  #fitButton,
  #fadeUnselectedButton,
  #resetButton {
    font-size: 17px !important;
  }

  #sectionBoxButton .tool-icon {
    width: 20px !important;
    height: 20px !important;
  }
}

@media (max-width: 460px) {
  #gridButton,
  #fitButton,
  #fadeUnselectedButton,
  #resetButton {
    font-size: 16px !important;
  }

  #sectionBoxButton .tool-icon {
    width: 19px !important;
    height: 19px !important;
  }
}
