/* ==========================================================================
   ORGANISMOS: ENCABEZADOS DE NAVEGACIÓN, PANELES DE SECCIÓN Y TABLAS DE DATOS
   Diseño Corporativo Impecable con Delimitadores Claros y Contraste Óptimo
   ========================================================================== */

/* 1. Barra de Navegación Superior Fija (Enterprise Header) */
.organism-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 32px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.organism-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.organism-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px var(--brand-glow);
}

.organism-brand-title {
  display: flex;
  flex-direction: column;
}

.organism-brand-subtitle {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* 2. PANELES DE SECCIÓN CORPORATIVOS CON DELIMITADORES DESTACADOS */
.section-panel-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 36px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.section-panel-container:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.section-panel-header {
  padding: 20px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.section-panel-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-panel-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.section-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-panel-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

/* 3. TABLAS DE DATOS CORPORATIVAS CON BORDES DEFINIDOS */
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: 14px 24px;
  background: var(--bg-body);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  border-top: none;
}

.data-table td {
  padding: 16px 24px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  transition: background-color 0.15s ease;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background-color: var(--bg-card-hover);
}

/* Entity Avatar para Empresas y Usuarios */
.entity-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.entity-info-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.entity-text-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.entity-text-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   4. MODALES CORPORATIVOS (ORGANISMS: MODALS & DIALOGS)
   ========================================================================== */
.builder-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.builder-modal-backdrop.active {
  display: flex !important;
}

.builder-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.builder-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.builder-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
}

.builder-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.builder-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-body);
}
