/* ===== CCDOP UNIFIED CSS - Sistema Centralizado ===== */

/* === VARIABLES CSS === */
:root {
  /* Colores principales */
  --primary-color: #f2b400;
  --primary-hover: #BA8E23;
  --primary-dark: #120368;
  --primary-dark-hover: #0B0242;
  
  /* Colores secundarios */
  --secondary-color: #50ADF5;
  --secondary-hover: #3E87BF;
  --secondary-blue: #007bff;
  --secondary-blue-hover: #0056b3;
  
  /* Colores de estado */
  --success-color: #28a745;
  --success-hover: #218838;
  --danger-color: #f64d4d;
  --danger-hover: #e53e3e;
  --warning-color: #ff8c00;
  --warning-hover: #e67e00;
  --info-color: #17a2b8;
  --info-hover: #138496;
  
  /* Colores neutros */
  --light-color: #f8f9fa;
  --light-hover: #e9ecef;
  --dark-color: #343a40;
  --dark-hover: #23272b;
  
  /* Colores de texto */
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --text-white: #fff;
  --text-black: #000;
  
  /* Espaciado - más compacto */
  --spacing-xs: 2px;
  --spacing-sm: 6px;
  --spacing-md: 10px;
  --spacing-lg: 14px;
  --spacing-xl: 18px;
  --spacing-xxl: 24px;
  
  /* Border radius - más sutil */
  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 7px;
  --radius-xl: 9px;
  
  /* Sombras - más sutiles */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.08);
  --shadow-xl: 0 6px 12px rgba(0,0,0,0.08);
  
  /* Transiciones */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* === ESTILOS BASE === */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding: 0;
  margin: 0;
  background-color: #f4f4f4;
  color: #333;
}

header:not(.index-header-style) {
  background-color: #f2b400;
  color: #3b0078;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header img { height: 80px; margin-right: 15px; }
header h1 { margin: 0; font-size: 24px; }

nav a {
  color: #3b0078;
  margin-left: 20px;
  text-decoration: none;
  font-weight: bold;
}
nav a:hover { text-decoration: underline; }

/* === WRAPPER RESPONSIVO COMÚN === */
.page-wrap,
.assignments-wrap,
.container,
.content,
main.page-wrap {
  max-width: 1100px;
  margin-inline: auto;
  padding: 16px 12px;
}

main { padding: 20px; }

/* === SISTEMA DE BOTONES UNIFICADO === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  user-select: none;
  white-space: nowrap;
  min-height: 32px;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Tamaños de botones */
.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 11px;
  min-height: 24px;
}

/* === BOTÓN GENERAR CON IA - ESTILO UNIFICADO === */
.btn-generate-ai {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: none !important;
  color: white !important;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-generate-ai:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-generate-ai:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.btn-generate-ai .fas.fa-robot {
  margin-right: 6px;
  font-size: 0.9em;
  animation: pulse-robot 2s infinite;
}

@keyframes pulse-robot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Efecto de brillo sutil en hover */
.btn-generate-ai::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-generate-ai:hover::before {
  left: 100%;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 14px;
  min-height: 36px;
}

/* Botón Primario */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-black);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(242, 193, 0, 0.35);
}

/* Botón Secundario */
.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--text-black);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
  border-color: var(--secondary-hover);
}

/* Botón de Cancelar (rojo marca de agua) */
.btn-cancel {
  background-color: #ffe9e9;
  border-color: #f2b4b4;
  color: #b00020;
}

.btn-cancel:hover:not(:disabled) {
  filter: brightness(0.98);
}

/* Botón de Peligro (rojo marca de agua) */
.btn-danger {
  background-color: #f64d4d;
  border-color: #f64d4d;
  color: var(--text-white);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(0.98);
}

/* Botón de Éxito (verde) */
.btn-success {
  background-color: #28a745;
  border-color: #28a745;
  color: var(--text-white);
}

.btn-success:hover:not(:disabled) {
  background-color: #218838;
  border-color: #218838;
}

/* Botón de Advertencia (naranja) */
.btn-warning {
  background-color: #ff8c00;
  border-color: #ff8c00;
  color: var(--text-white);
}

.btn-warning:hover:not(:disabled) {
  background-color: #e67e00;
  border-color: #e67e00;
}

/* === SISTEMA DE MODALES UNIFICADO === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000000 !important;
  padding: var(--spacing-md);
  box-sizing: border-box;
}

.modal.show {
  display: flex;
}

.modal.hidden {
  display: none;
}

.modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 1600px;
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.modal-content.wide {
  width: 98%;
  max-width: 1900px;
}

/* Modales específicos para calendarios - más grandes y mejor espaciados */
.modal-content.calendar-modal {
  width: 95%;
  max-width: 1200px;
  min-height: 600px;
}

/* Asegurar que todos los modales estén por encima del header */
.modal,
#processPicker,
#processPicker.modal {
  z-index: 10000000 !important;
}

/* Modal AI siguiendo el patrón estándar de la plataforma */
#aiOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000000;
}

#aiOvBox {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#aiOvClose {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  z-index: 10;
}

#aiCloseBtn {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#aiCloseBtn:hover {
  background: #f5f5f5;
  color: #333;
}

#aiFrame {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

/* Bloquear scroll cuando modal AI está abierto */
body.ai-modal-open {
  overflow: hidden !important;
}

.modal-content.calendar-modal .form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.modal-content.calendar-modal .form-group {
  flex: 1;
  min-width: 300px;
}

.modal-content.calendar-modal .form-group:only-child {
  flex: none;
  max-width: 100%;
}

.modal-content.calendar-modal .modal-body {
  padding: 30px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content.compact {
  width: 80%;
  max-width: 1000px;
}

.modal-header {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  background: #fafafa;
}

/* === SISTEMA DE FORMULARIOS UNIFICADO === */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-normal);
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(242, 180, 0, 0.1);
}

.form-group small {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Estilos para elementos de formulario fuera de form-group (timeline, team, items, etc.) */
.timeline-phase,
.timeline-desc,
.timeline-duration,
.team-role,
.team-name,
.team-responsibility,
.item-description,
.item-quantity,
.item-price,
.item-total {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-normal);
  box-sizing: border-box;
}

.timeline-phase:focus,
.timeline-desc:focus,
.timeline-duration:focus,
.team-role:focus,
.team-name:focus,
.team-responsibility:focus,
.item-description:focus,
.item-quantity:focus,
.item-price:focus,
.item-total:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(242, 180, 0, 0.1);
}

.error {
  display: block;
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: #ffe9e9;
  border: 1px solid #f2b4b4;
  border-radius: var(--radius-md);
  color: #b00020;
  font-size: 0.9rem;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
}

/* === SISTEMA DE TARJETAS UNIFICADO === */
.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Variantes de tamaño para cards */
.card-small {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
  max-width: 400px;
  width: 100%;
}

.card-small:hover {
  box-shadow: var(--shadow-md);
}

.card-medium {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
  max-width: 600px;
  width: 100%;
}

/* Wrapper específico para calendarios - más amplio */
.calendar-wrapper {
  max-width: 1000px !important;
  width: 100%;
}

/* Estilos específicos para gestión de calendarios */
.calendar-management .calendar-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.calendar-management .calendar-controls {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  margin-bottom: 20px;
}

.calendar-management .control-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  flex: 0 0 auto;
}

.calendar-management .control-group button {
  margin-top: auto;
  align-self: flex-start;
  height: 36px;
  padding: 8px 16px;
}

.calendar-management .control-group label {
  font-weight: 500;
  margin-bottom: 5px;
  color: #333;
}

.calendar-management .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
}

.calendar-management .card-header h2 {
  margin: 0;
  color: #333;
}

.calendar-management .card-actions {
  display: flex;
  gap: 10px;
}

.calendar-management .card-body {
  padding: 0 20px 20px;
}

.calendar-management .session-controls,
.calendar-management .student-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calendar-management .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.calendar-management .empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.calendar-management .empty-state p {
  margin: 0;
  font-size: 16px;
}

.calendar-management .calendar-list,
.calendar-management .sessions-list,
.calendar-management .student-list,
.calendar-management .schedule-list {
  min-height: 200px;
}

.calendar-management .btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.calendar-management .btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
}

.calendar-management .btn-outline:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.card-medium:hover {
  box-shadow: var(--shadow-md);
}

.card-large {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
  max-width: 800px;
  width: 100%;
}

.card-large:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid #eee;
}

.card-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  margin-bottom: var(--spacing-lg);
}

.card-footer {
  padding-top: var(--spacing-md);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
}

/* === SISTEMA DE TABLAS UNIFICADO === */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th,
.table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid #eee;
}

.table th {
  background: var(--primary-color);
  color: var(--text-black);
  font-weight: 600;
  font-size: 14px;
}

.table tbody tr:hover {
  background: #f8f9fa;
}

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

/* === SISTEMA DE ESTADÍSTICAS UNIFICADO === */
.stats-grid,
.objectives-stats,
.strategy-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-dark);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* === SISTEMA DE FILTROS UNIFICADO === */
.filters,
.objectives-filters,
.strategy-filters,
.users-filters,
.commercial-filters,
.clients-filters,
.operations-filters {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
}

.filters input[type="search"],
.objectives-filters input[type="search"],
.strategy-filters input[type="search"],
.users-filters input[type="search"],
.commercial-filters input[type="search"],
.clients-filters input[type="search"],
.operations-filters input[type="search"] {
  flex: 1;
  min-width: 240px;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
}

.filters select,
.objectives-filters select,
.strategy-filters select,
.users-filters select,
.commercial-filters select,
.clients-filters select,
.operations-filters select {
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fff;
}

/* === SISTEMA DE GRIDS UNIFICADO === */
.grid,
.objectives-grid,
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

/* === SISTEMA DE BADGES UNIFICADO === */
.badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--primary-color);
  color: var(--text-black);
}

.badge-secondary {
  background: var(--secondary-color);
  color: var(--text-black);
}

.badge-success {
  background: var(--success-color);
  color: var(--text-white);
}

.badge-danger {
  background: var(--danger-color);
  color: var(--text-white);
}

.badge-warning {
  background: var(--warning-color);
  color: var(--text-black);
}

.badge-info {
  background: var(--info-color);
  color: var(--text-white);
}

/* === ESTILOS ESPECÍFICOS DE MÓDULOS === */

/* Objectives Module */
.objective-card,
.strategy-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.objective-card:hover,
.strategy-card:hover {
  box-shadow: var(--shadow-md);
}

.objective-header,
.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-md);
}

.objective-title,
.strategy-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.objective-type,
.status-badge {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.objective-type {
  background: #e3f2fd;
  color: #1976d2;
}

.status-badge {
  background: #e3f2fd;
  color: #1976d2;
}

.objective-description,
.strategy-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: var(--spacing-md);
}

.objective-meta,
.strategy-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: var(--spacing-md);
}

.objective-actions,
.strategy-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: space-between;
  align-items: center;
}

.objective-actions .btn-group,
.strategy-actions .btn-group {
  display: flex;
  gap: var(--spacing-xs);
}

/* Users Module */
#users-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--spacing-md) var(--spacing-xxl);
}

#users-app .toolbar {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}

#users-app .toolbar-row {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

#users-app .table td.actions {
  white-space: nowrap;
}

#users-app .actions .btn {
  margin: 0 var(--spacing-xs) var(--spacing-xs) 0;
}

#users-app .badge.green { 
  background: #e8f6ec; 
  color: #1a7f37; 
}

#users-app .badge.gray { 
  background: #eee; 
  color: #555; 
}

/* Assignments Module */
.assignments-wrap {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 var(--spacing-md);
}

/* Filtros de asignaciones - estilo consistente con otros módulos */
.assignments-filters {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.assignments-filters {
  position: relative; /* Para el dropdown */
}

.assignments-filters input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: border-color var(--transition-normal);
}

.assignments-filters input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(242, 180, 0, 0.1);
}

.assignments-filters .tabs {
  display: flex;
  gap: var(--spacing-sm);
}

.assignments-filters .btn {
  white-space: nowrap;
}

/* Dropdown de cursos */
.dropdown-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(0,0,0,.08);
  max-height: 280px;
  overflow: auto;
  z-index: 10000000 !important;
  padding: 6px 0;
}

.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background-color var(--transition-normal);
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.dropdown-item .title {
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-item .meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive para filtros de asignaciones */
@media (max-width: 768px) {
  .assignments-filters {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }
  
  .assignments-filters input[type="text"] {
    min-width: auto;
    width: 100%;
  }
  
  .assignments-filters .tabs {
    justify-content: center;
  }
  
  .assignments-filters .btn {
    width: 100%;
  }
}

/* Tabs específicos para asignaciones - corregir conflicto con perfil */
.assignments-wrap .tabs {
  display: flex;
  gap: var(--spacing-sm);
}

.assignments-wrap .tab {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  background: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  display: inline-block; /* Sobrescribir display: none del perfil */
}

.assignments-wrap .tab.active {
  background: var(--primary-color);
  color: var(--text-black);
  border-color: var(--primary-color);
}

.assignments-wrap .card {
  padding: 14px var(--spacing-lg);
  margin: var(--spacing-lg) 0;
}

.assignments-wrap .toolbar .toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.assignments-wrap .toolbar .right {
  display: inline-flex;
  gap: 10px;
  margin-left: auto;
}

.assignments-wrap .assign-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #eee;
  border-radius: var(--radius-xl);
  background: #fff;
  overflow: hidden;
}

.assignments-wrap .assign-table thead th {
  background: var(--primary-color);
  color: var(--text-black);
  font-weight: 700;
  text-align: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--primary-hover);
}

.assignments-wrap .assign-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f1f1;
}

.assignments-wrap .assign-table tbody tr:hover {
  background: #fffdf3;
}

/* Modal específico para asignaciones - más compacto */
.assignments-wrap .modal .modal-card {
  max-width: 600px; /* Más compacto que el default */
  width: 90%;
  padding: var(--spacing-lg);
}

.assignments-wrap .modal .modal-header {
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid #eee;
  margin-bottom: var(--spacing-md);
}

.assignments-wrap .modal .modal-body {
  padding: 0;
}

.assignments-wrap .modal .modal-footer {
  padding: var(--spacing-md) 0 0 0;
  border-top: 1px solid #eee;
  margin-top: var(--spacing-md);
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
}

/* Tabla dentro del modal más compacta */
.assignments-wrap .modal .table-sm {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-sm) 0;
}

.assignments-wrap .modal .table-sm th,
.assignments-wrap .modal .table-sm td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.assignments-wrap .modal .table-sm th {
  background: #f8f9fa;
  font-weight: 600;
  color: var(--text-primary);
}

.assignments-wrap .modal .table-sm tbody tr:hover {
  background: #f8f9fa;
}

/* Input de búsqueda en modal */
.assignments-wrap .modal input[type="search"] {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: var(--spacing-md);
}

.assignments-wrap .modal input[type="search"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(242, 180, 0, 0.1);
}

/* Texto de ayuda en modal */
.assignments-wrap .modal .modal-help {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: #f8f9fa;
  border-radius: var(--radius-sm);
}

/* Responsive para modal de asignaciones */
@media (max-width: 768px) {
  .assignments-wrap .modal .modal-card {
    max-width: 95%;
    width: 95%;
    padding: var(--spacing-md);
    margin: var(--spacing-sm);
  }
  
  .assignments-wrap .modal .modal-footer {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .assignments-wrap .modal .modal-footer .btn {
    width: 100%;
  }
  
  .assignments-wrap .modal .table-sm th,
  .assignments-wrap .modal .table-sm td {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 12px;
  }
}

/* === SISTEMA DE OVERLAY/MODAL ALTERNATIVO === */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000000 !important;
  padding: var(--spacing-md);
  box-sizing: border-box;
}

.overlay.hidden {
  display: none;
}

.overlay-panel {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 1600px;
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.overlay-header {
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.overlay-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.overlay-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.overlay-body {
  padding: var(--spacing-xl);
  overflow-y: auto;
  flex: 1;
}

.overlay-footer {
  padding: var(--spacing-lg) var(--spacing-xl);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  background: #fafafa;
}

/* === ESTILOS ESPECÍFICOS DE USERS === */
.users-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}


.roles-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.roles-checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  background: #f8f9fa;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-weight: normal;
  margin-bottom: 0;
}

.roles-checkbox-group label:hover {
  background: #e9ecef;
  border-color: var(--primary-color);
}

.roles-checkbox-group input[type="checkbox"] {
  margin: 0;
  width: auto;
}

.roles-checkbox-group label:has(input:checked) {
  background: var(--primary-color);
  color: var(--text-black);
  border-color: var(--primary-color);
}

.message-area {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

/* === ESTILOS ESPECÍFICOS DE ASSIGNMENTS === */
.card--toolbar {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.tabs {
  display: flex;
  gap: var(--spacing-sm);
}

.tab {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  background: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--transition-normal);
}

/* Solo aplicar fondo amarillo a botones de tab, no a secciones de contenido */
.tab:not(.card).active {
  background: var(--primary-color);
  color: var(--text-black);
  border-color: var(--primary-color);
}

.context-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: #e3f2fd;
  border-radius: var(--radius-md);
  margin-top: var(--spacing-md);
}

.context-title {
  font-weight: 600;
  color: var(--text-primary);
}

.chip {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.table-area {
  margin: var(--spacing-lg) 0;
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background: #f8f9fa;
  border-radius: var(--radius-md);
}

.table-actions .left,
.table-actions .right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.searchbox {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
  min-width: 200px;
}

.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 1600px;
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

/* === ESTILOS ESPECÍFICOS DE PROCESOS === */
.pb-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--spacing-lg);
}

.pb-board {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.pb-toolbar {
  position: sticky;
  top: 0;
  z-index: 10000000 !important;
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: var(--spacing-sm);
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.pb-toolbar .btn-secondary.active {
  outline: 2px solid var(--primary-dark);
}

.pb-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#flowCanvas {
  width: 100%;
  height: 70vh;
  display: block;
  background: #fff;
  border: 1px solid #eee;
}

.pb-inspector {
  background: #fff;
  border: 1px solid #eee;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  min-height: 70vh;
}

.pb-inspector h4,
.pb-inspector h5 {
  margin: var(--spacing-sm) 0;
}

.pb-topbar {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.pb-topbar .left {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.pb-topbar .right {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.pill {
  display: inline-flex;
  gap: var(--spacing-sm);
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  margin: 2px;
  background: #fff;
}

.pb-legend {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  align-items: center;
}

.legend-item {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  font-size: 12px;
  color: #555;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #bbb;
}

.sw-start { background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 100%); }
.sw-task { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); }
.sw-decision { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }
.sw-io { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }
.sw-end { background: linear-gradient(135deg, #424242 0%, #757575 100%); }

/* ===== Mejoras del Process Builder Studio ===== */

/* Encabezado del módulo mejorado */
.pb-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
}

.page-title h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #1a202c;
}

.page-title p {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.pb-page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pb-version-badge {
  background: #edf2ff;
  color: #3730a3;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.pb-version-badge.published {
  background: #d4edda;
  color: #155724;
}

.pb-version-badge.archived {
  background: #f8d7da;
  color: #721c24;
}

.pb-version-badge.draft {
  background: #edf2ff;
  color: #3730a3;
}

/* Midpanel con tabs mejorados */
.pb-midpanel {
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 1.5rem;
}

.pb-midpanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.pb-midpanel-tabs {
  display: inline-flex;
  gap: 0.25rem;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0.2rem;
}

.pb-midpanel-tab {
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: transparent;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.2s ease;
}

.pb-midpanel-tab:hover {
  background: rgba(255, 255, 255, 0.5);
}

.pb-midpanel-tab.is-active {
  background: white;
  box-shadow: 0 2px 6px rgba(148, 163, 184, 0.4);
  color: #1f2933;
  font-weight: 600;
}

.pb-midpanel-body {
  margin-top: 0.5rem;
}

.pb-tab-panel {
  display: none;
}

.pb-tab-panel.is-active {
  display: block;
}

.pb-ai-textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  resize: vertical;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.pb-ai-textarea:focus {
  outline: none;
  border-color: #3b0078;
  box-shadow: 0 0 0 3px rgba(59, 0, 120, 0.1);
}

.pb-label {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.pb-ai-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.pb-helper-text {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

/* Toolbar mejorado */
.pb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.pb-tools-left,
.pb-tools-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.pb-tool.is-active {
  background: #1d4ed8 !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.3);
}

/* Canvas con grid */
.pb-canvas-wrap {
  position: relative;
  background-image: radial-gradient(circle at 1px 1px, #e5e7eb 1px, transparent 0);
  background-size: 24px 24px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* Para que el SVG no tape el grid */
#flowCanvas {
  display: block;
  width: 100%;
  height: 520px;
  background: transparent;
}

/* Controles de zoom */
.pb-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.pb-zoom-label {
  min-width: 3ch;
  text-align: center;
  font-size: 0.8rem;
  color: #4b5563;
  font-weight: 500;
}

.pb-zoom-btn {
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Leyenda mejorada */
.pb-legend-items {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Inspector con secciones jerárquicas */
.pb-inspector-section {
  margin-bottom: 1.5rem;
}

.pb-inspector-section + .pb-inspector-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.pb-inspector-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.pb-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.pb-field label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

.pb-field input,
.pb-field textarea,
.pb-field select {
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pb-field input:focus,
.pb-field textarea:focus,
.pb-field select:focus {
  outline: none;
  border-color: #3b0078;
  box-shadow: 0 0 0 3px rgba(59, 0, 120, 0.1);
}

.pb-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

/* Responsive */
@media (max-width: 1080px) {
  .pb-wrap {
    grid-template-columns: 1fr;
  }
  
  .pb-inspector {
    margin-top: 1rem;
  }
  
  .pb-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .pb-midpanel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Canvas y formas */
.shape {
  fill: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  stroke: #1e40af;
  stroke-width: 2;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.shape.start {
  fill: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 100%);
  stroke: #4caf50;
}

.shape.end {
  fill: linear-gradient(135deg, #424242 0%, #757575 100%);
  stroke: #212121;
}

.shape.task {
  fill: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  stroke: #1e3a8a;
}

.shape.decision {
  fill: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  stroke: #92400e;
}

.shape.io {
  fill: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  stroke: #5b21b6;
}

.shape.raised {
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.06)) drop-shadow(0 6px 14px rgba(0,0,0,.10));
}

/* Texto */
text.label {
  font: 16px/1.25 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  fill: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* Flujos */
line.flow {
  stroke: #666;
  stroke-width: 2.4;
  stroke-linecap: round;
}

line.flow.tmp {
  stroke-dasharray: 4 3;
  pointer-events: none;
}

text.flow-label {
  font: 13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  fill: #333;
}

/* Selección */
g.step.selected .shape,
line.flow.selected {
  stroke: #7a23ff;
  stroke-width: 2.6;
}

/* Anclajes discretos */
g.step .anchor {
  fill: #fff;
  stroke: #7a23ff;
  stroke-width: 1.4;
  opacity: 0;
  transition: opacity .12s, r .12s;
  pointer-events: all;
}

g.step .anchor-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

svg.connector-mode g.step .anchor {
  opacity: .92;
}

svg.connector-mode g.step:hover .anchor {
  opacity: 1;
}

g.step .anchor.hot {
  r: 10.5;
}

/* Inspector */
#inspector {
  padding: var(--spacing-md);
  border-left: 1px solid #eee;
  min-width: 300px;
}

#inspector label {
  font-size: 16px;
  color: #666;
  margin-top: var(--spacing-sm);
  display: block;
}

#inspector .row-grid {
  display: grid;
  grid-template-columns: max-content 1fr max-content 1fr;
  gap: var(--spacing-sm);
  align-items: center;
}

#inspector .smalllbl {
  color: #666;
  font-size: 16px;
}

/* Toasts */
.toast-wrap {
  position: fixed;
  right: var(--spacing-md);
  bottom: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  z-index: 10000000 !important;
}

.toast {
  background: #1a1a1a;
  color: #fff;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
}

.toast.error {
  background: #a30000;
}

#inspector .modwrap {
  margin-top: var(--spacing-sm);
}

#crsResults .row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 4px 0;
}

#crsResults .itm {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill .pillx {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0 var(--spacing-sm);
}

/* === ESTILOS ESPECÍFICOS DE AI WIZARD === */

/* AI Wizard Tabs - específico para genai_wizard.html */
.tabs .vstep-item {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  background: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 14px;
  font-weight: 500;
}

.tabs .vstep-item:hover {
  background: #f8f9fa;
  border-color: var(--primary-color);
}

.tabs .vstep-item.active {
  background: var(--primary-color);
  color: var(--text-black);
  border-color: var(--primary-color);
}

/* Contenido de tabs del AI Wizard */
.vpanel {
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: var(--spacing-lg);
  min-height: 400px;
}

.vpanel.hidden {
  display: none;
}

/* Estilos específicos para el contenido del wizard */
.subpanel {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-sm) 0;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* === ESTILOS ESPECÍFICOS DE AI WIZARD (ACTUALIZADO) === */
/* Usar definición principal arriba - esta sección eliminada para evitar conflictos */

.ai-modal-header {
  padding: 20px 24px !important;
  border-bottom: 2px solid #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #f8fafc !important;
  border-radius: 16px 16px 0 0 !important;
}

.ai-modal-header h3 {
  margin: 0 !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #1f2937 !important;
}

.ai-close {
  border: none !important;
  background: #ef4444 !important;
  color: white !important;
  font-size: 18px !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
}

.ai-close:hover {
  background: #dc2626 !important;
  transform: scale(1.1) !important;
}

.ai-modal-body {
  padding: 24px !important;
  overflow: auto !important;
  flex: 1 !important;
  background: #fff !important;
}

.ai-modal-footer {
  padding: 20px 24px !important;
  border-top: 2px solid #e5e7eb !important;
  display: flex !important;
  gap: 12px !important;
  justify-content: flex-end !important;
  background: #f8fafc !important;
  border-radius: 0 0 16px 16px !important;
}

.ai-spinner {
  padding: var(--spacing-md) 0;
  font-weight: 600;
}

.ai-error {
  background: #ffe9e9;
  color: #900;
  border: 1px solid #f5bcbc;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.ai-preview {
  display: block;
}

.ai-section {
  margin-bottom: var(--spacing-md);
}

.ai-table-wrap {
  overflow: auto;
  border: 1px solid #eee;
  border-radius: var(--radius-md);
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
}

.ai-table th,
.ai-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid #f3f3f3;
  text-align: left;
}

.ai-table thead th {
  background: #fafafa;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.ai-mini-graph {
  background: #0f172a;
  color: #e5e7eb;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.ai-warnings {
  background: #fff8e6;
  border: 1px solid #ffe4a3;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

/* === ESTILOS ESPECÍFICOS DE CALENDARIOS === */
/* Grid principal del calendario - distribución equitativa */
.calendar-management .grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Distribución 50/50 */
  gap: var(--spacing-xl);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Contenedor principal más amplio */
.calendar-management main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.calendar-management .card,
.calendar-management .card-small,
.calendar-management .card-medium,
.calendar-management .card-large {
  min-width: 0; /* Permite que el contenido se ajuste */
  width: 100%;
  min-height: 600px; /* Altura mínima para equilibrio visual */
  display: flex;
  flex-direction: column;
}

/* Mantener distribución equitativa en pantallas grandes */
@media (min-width: 1200px) {
  .calendar-management .grid {
    grid-template-columns: 1fr 1fr; /* Mantener 50/50 */
    gap: var(--spacing-xxl);
    max-width: 1600px;
  }
}

@media (min-width: 1400px) {
  .calendar-management .grid {
    grid-template-columns: 1fr 1fr; /* Mantener 50/50 */
    max-width: 1800px;
  }
}

/* Responsive para pantallas más pequeñas */
@media (max-width: 1199px) {
  .calendar-management .grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    max-width: 1000px;
  }
}

@media (max-width: 768px) {
  .calendar-management main {
    padding: 0 var(--spacing-md);
  }
  
  .calendar-management .grid {
    gap: var(--spacing-md);
  }
}
.flex-between { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: var(--spacing-sm); 
}

.table { 
  width: 100%; 
  border-collapse: collapse; 
}

.table th, 
.table td { 
  padding: var(--spacing-md); 
  border-bottom: 1px solid #eee; 
  text-align: left; 
}

.table thead th { 
  background: var(--primary-color); 
  color: var(--text-black); 
}

.course-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-sm);
}

.course-table th,
.course-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid #eee;
  text-align: left;
}

.course-table thead th {
  background: var(--primary-color);
  color: var(--text-black);
  font-weight: 600;
}

.course-table .actions {
  text-align: right;
  white-space: nowrap;
}

.course-table .actions button {
  margin-left: var(--spacing-xs);
}

.table-shell {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Course/Edition Picker */
.course-picker { 
  position: relative; 
}

.course-picker .cp-input { 
  width: 100%; 
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
}

.course-picker .cp-panel {
  position: absolute; 
  inset-inline: 0; 
  top: 100%; 
  background: #fff; 
  border: 1px solid #ddd;
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-lg); 
  margin-top: var(--spacing-xs);
  max-height: 320px; 
  overflow-y: auto; 
  z-index: 10000000 !important; 
  display: none;
}

.course-picker.open .cp-panel { 
  display: block; 
}

.course-picker .cp-row { 
  padding: var(--spacing-md); 
  cursor: pointer; 
  display: grid; 
  gap: var(--spacing-xs); 
  border-bottom: 1px solid #f0f0f0;
}

.course-picker .cp-row:hover { 
  background: #f8f9fa; 
}

.course-picker .cp-row:last-child {
  border-bottom: none;
}

.course-picker .cp-title { 
  font-weight: 600; 
  color: var(--text-dark);
}

.course-picker .cp-desc { 
  color: var(--text-muted); 
  font-size: 0.8rem; 
}

/* Calendar Modal Specific */
#calModal .modal-content,
#sesModal .modal-content { 
  max-height: 90vh; 
  overflow-y: auto; 
}

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
  flex-shrink: 0;
}

.wizard-header h3 {
  margin: 0;
  color: var(--text-dark);
}

.wizard-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Legacy vform styles - manteniendo compatibilidad */
.vform {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
}

.vform label {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  font-weight: 500;
  color: var(--text-dark);
}

.vform input,
.vform select,
.vform textarea {
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: border-color var(--transition-normal);
}

.vform input:focus,
.vform select:focus,
.vform textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(242, 180, 0, 0.1);
}

.error-label {
  color: var(--danger-color);
  font-size: 0.9rem;
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: #ffe9e9;
  border: 1px solid #f2b4b4;
  border-radius: var(--radius-md);
}

/* === ESTILOS ESPECÍFICOS DE OBJETIVOS === */
/* Modales de objetivos con mejor espaciado */
#objective-modal .modal-content,
#ai-modal .modal-content,
#objective-detail-modal .modal-content {
  max-width: 700px; /* Más compacto que el default */
  padding: var(--spacing-xl); /* Más padding interno */
}

/* Formularios en modales de objetivos */
#objective-modal .form-group,
#ai-modal .form-group {
  margin-bottom: var(--spacing-lg); /* Más espacio entre elementos */
}

#objective-modal .form-group input,
#objective-modal .form-group select,
#objective-modal .form-group textarea,
#ai-modal .form-group input,
#ai-modal .form-group select,
#ai-modal .form-group textarea {
  padding: var(--spacing-md) var(--spacing-lg); /* Padding horizontal más generoso */
  font-size: 14px; /* Tamaño de fuente más manejable */
}

/* Textareas específicamente más compactas */
#objective-modal .form-group textarea,
#ai-modal .form-group textarea {
  min-height: 80px; /* Altura mínima más razonable */
  resize: vertical;
}

/* Form-row en modales de objetivos */
#objective-modal .form-row {
  gap: var(--spacing-lg); /* Más espacio entre columnas */
  margin-bottom: var(--spacing-md);
}

/* Botones del modal */
#objective-modal .modal-footer,
#ai-modal .modal-footer,
#objective-detail-modal .modal-footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
}

/* Labels más compactos */
#objective-modal .form-group label,
#ai-modal .form-group label {
  margin-bottom: var(--spacing-sm);
  font-size: 13px;
  font-weight: 600;
}

/* Modal de detalles específico */
#objective-detail-modal .modal-content {
  max-width: 800px; /* Un poco más ancho para mostrar información */
}

#objective-detail-modal .objective-detail-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

#objective-detail-modal .objective-detail-section {
  margin-bottom: var(--spacing-lg);
}

#objective-detail-modal .objective-detail-section h4 {
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

#objective-detail-modal .objective-detail-meta-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid #f0f0f0;
}

#objective-detail-modal .objective-detail-meta-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
}

#objective-detail-modal .objective-detail-meta-value {
  color: var(--text-primary);
  font-size: 13px;
}

/* Responsive para modales de objetivos */
@media (max-width: 768px) {
  #objective-modal .modal-content,
  #ai-modal .modal-content,
  #objective-detail-modal .modal-content {
    max-width: 95%;
    padding: var(--spacing-lg);
    margin: var(--spacing-md);
  }
  
  #objective-modal .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  #objective-modal .modal-footer,
  #ai-modal .modal-footer,
  #objective-detail-modal .modal-footer {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  #objective-modal .modal-footer .btn,
  #ai-modal .modal-footer .btn,
  #objective-detail-modal .modal-footer .btn {
    width: 100%;
  }
  
  #objective-detail-modal .objective-detail-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

/* Responsive para pestañas del perfil */
@media (max-width: 768px) {
  .profile-tabs {
    flex-direction: column;
    gap: var(--spacing-xs);
  }
  
  .profile-tabs .tab-btn {
    width: 100%;
    text-align: center;
    border-radius: var(--radius-md);
  }
}

/* === ESTILOS ESPECÍFICOS DE ESTRATEGIA === */
/* Modales de estrategia con mejor espaciado */
#createStrategyModal .modal-content,
#aiGeneratorModal .modal-content,
#strategyDetailModal .modal-content {
  max-width: 700px; /* Más compacto que el default */
  padding: var(--spacing-xl); /* Más padding interno */
}

/* Formularios en modales de estrategia */
#createStrategyModal .form-group,
#aiGeneratorModal .form-group,
#strategyDetailModal .form-group {
  margin-bottom: var(--spacing-lg); /* Más espacio entre elementos */
}

#createStrategyModal .form-group input,
#createStrategyModal .form-group select,
#createStrategyModal .form-group textarea,
#aiGeneratorModal .form-group input,
#aiGeneratorModal .form-group select,
#aiGeneratorModal .form-group textarea,
#strategyDetailModal .form-group input,
#strategyDetailModal .form-group select,
#strategyDetailModal .form-group textarea {
  padding: var(--spacing-md) var(--spacing-lg); /* Padding horizontal más generoso */
  font-size: 14px; /* Tamaño de fuente más manejable */
}

/* Textareas específicamente más compactas */
#createStrategyModal .form-group textarea,
#aiGeneratorModal .form-group textarea,
#strategyDetailModal .form-group textarea {
  min-height: 80px; /* Altura mínima más razonable */
  resize: vertical;
}

/* Form-row en modales de estrategia */
#createStrategyModal .form-row,
#aiGeneratorModal .form-row,
#strategyDetailModal .form-row {
  gap: var(--spacing-lg); /* Más espacio entre columnas */
  margin-bottom: var(--spacing-md);
}

/* Botones del modal */
#createStrategyModal .modal-buttons,
#aiGeneratorModal .modal-buttons,
#strategyDetailModal .modal-footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
}

/* Labels más compactos */
#createStrategyModal .form-group label,
#aiGeneratorModal .form-group label,
#strategyDetailModal .form-group label {
  margin-bottom: var(--spacing-sm);
  font-size: 13px;
  font-weight: 600;
}

/* Responsive para modales de estrategia */
@media (max-width: 768px) {
  #createStrategyModal .modal-content,
  #aiGeneratorModal .modal-content,
  #strategyDetailModal .modal-content {
    max-width: 95%;
    padding: var(--spacing-lg);
    margin: var(--spacing-md);
  }
  
  #createStrategyModal .form-row,
  #aiGeneratorModal .form-row,
  #strategyDetailModal .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  #createStrategyModal .modal-buttons,
  #aiGeneratorModal .modal-buttons,
  #strategyDetailModal .modal-footer {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  #createStrategyModal .modal-buttons .btn,
  #aiGeneratorModal .modal-buttons .btn,
  #strategyDetailModal .modal-footer .btn {
    width: 100%;
  }
}

/* === ESTILOS ESPECÍFICOS DE PERFIL === */
/* Navegación de pestañas del perfil - estilo consistente */
.profile-tabs {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
  padding: 0;
}

.profile-tabs .tab-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  background: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 14px;
  font-weight: 500;
}

.profile-tabs .tab-btn:hover {
  background: #f8f9fa;
  border-color: var(--primary-color);
}

.profile-tabs .tab-btn.active {
  background: var(--primary-color);
  color: var(--text-black);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(242, 180, 0, 0.2);
}

/* Avatar y controles */
.avatar-wrap { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}

.avatar { 
  width: 96px; 
  height: 96px; 
  border-radius: 50%; 
  object-fit: cover; 
  border: 2px solid #ddd; 
}

/* Inputs y textareas específicos del perfil */
.input, 
.textarea { 
  width: 100%; 
  padding: var(--spacing-md); 
  border: 1px solid #ddd; 
  border-radius: var(--radius-md); 
  font: inherit; 
  transition: border-color var(--transition-normal);
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.input:not(:first-child) { 
  margin-top: var(--spacing-sm); 
}

.textarea { 
  resize: vertical; 
}

/* Tabs específicos del perfil */
.profile-page .tab { 
  display: none; 
  background: #fff; /* Fondo blanco para secciones de contenido */
}

.profile-page .tab.active { 
  display: block; 
  background: #fff; /* Fondo blanco para sección activa */
}

/* Estilos duplicados eliminados - ya están definidos en .profile-tabs .tab-btn.active */

/* Grid para bloques por rol */
.role-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: var(--spacing-md); 
}

/* Estilos específicos para el perfil */
.profile-page .page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.profile-page .card {
  margin-bottom: var(--spacing-lg);
}

.profile-page .tabs {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-md);
}

.profile-page .table-area {
  margin: var(--spacing-md) 0;
}

.profile-page .actions {
  text-align: right;
  white-space: nowrap;
}

.profile-page .actions button {
  margin-left: var(--spacing-xs);
}

/* Sticky footer para acciones */
.profile-page .sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 10000000 !important;
  border-top: 1px solid #eee;
  background: #fff;
  padding: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

/* === ESTILOS ESPECÍFICOS DE ORGANIGRAMAS === */
.org-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--spacing-lg);
}

.org-pane {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: var(--spacing-sm);
}

.org-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0 var(--spacing-md);
}

.org-kpi {
  font-size: 12px;
  color: #475569;
}

/* Canvas SVG */
#org-canvas {
  width: 100%;
  height: 70vh;
  border-radius: var(--radius-lg);
  outline: 1px dashed #e5e7eb;
  background: #f8fafc;
  touch-action: none;
}

/* Sidebar de propiedades */
#org-sidebar {
  height: 70vh;
  overflow: auto;
}

/* Controles pequeños bajo el lienzo (zoom) */
.org-mini-controls {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.org-mini-controls .btn {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 12px;
}

/* Grid del lienzo */
.org-grid line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

/* Nodos del organigrama */
.org-node rect {
  fill: #ffffff;
  stroke: #94a3b8;
  stroke-width: 1.25;
  rx: var(--radius-md);
}

.org-node .title {
  font-weight: 700;
  font-size: 12px;
  fill: #0f172a;
}

.org-node .subtitle {
  font-size: 11px;
  fill: #475569;
}

.org-node.selected rect {
  stroke: #0ea5e9;
  stroke-width: 2;
}

/* Chips/etiquetas pequeñas */
.org-chip {
  display: inline-block;
  padding: 4px var(--spacing-sm);
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  color: #334155;
}

/* Tips/ayudas */
.org-hint {
  font-size: 12px;
  color: #64748b;
  margin-top: var(--spacing-sm);
}

/* === ESTILOS ESPECÍFICOS DE AI WIZARD DE ORGANIGRAMAS === */
.org-ai-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
}

.org-ai-pane {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
}

.org-ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin: var(--spacing-sm) 0 var(--spacing-md);
}

.org-ai-kpi {
  font-size: 12px;
  color: #475569;
  margin-left: auto;
}

/* Zona de chat / conversación */
.org-ai-chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--spacing-sm);
  height: 72vh;
  min-height: 520px;
}

.org-ai-chatlog {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
  background: #ffffff;
  overflow: auto;
}

.org-ai-msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.org-ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #334155;
}

.org-ai-bubble {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
  background: #f8fafc;
  color: #0f172a;
  line-height: 1.4;
}

.org-ai-msg.user .org-ai-bubble {
  background: #eff6ff;
  border-color: #bae6fd;
}

.org-ai-msg.ai .org-ai-bubble {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.org-ai-timestamp {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

/* Prompt / input inferior */
.org-ai-promptbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--spacing-sm);
  align-items: start;
}

.org-ai-textarea {
  width: 100%;
  min-height: 44px;
  max-height: 200px;
  resize: vertical;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  font: inherit;
  color: #0f172a;
  background: #ffffff;
}

.org-ai-actions {
  display: flex;
  gap: var(--spacing-sm);
}

/* Sugerencias (chips) */
.org-ai-suggestions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-top: 4px;
}

.org-ai-suggestion {
  cursor: pointer;
}

.org-ai-suggestion:hover {
  filter: brightness(0.98);
}

/* Sidebar derecho */
.org-ai-sidebar {
  display: grid;
  gap: var(--spacing-md);
  height: 72vh;
  min-height: 520px;
  overflow: auto;
}

.org-ai-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
}

.org-ai-card h4 {
  margin: 0 0 var(--spacing-sm);
  font-size: 14px;
  color: #0f172a;
}

/* Stepper / Progreso del wizard */
.org-ai-steps {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.org-ai-step {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 12px;
  color: #334155;
}

.org-ai-step.is-active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

.org-ai-step.is-done {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

/* Resultados / preview del org generado */
.org-ai-preview {
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  background: #f8fafc;
  overflow: auto;
  min-height: 120px;
}

/* Skeletons / loading */
.org-ai-skel {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: org-ai-shimmer 1.2s ease-in-out infinite;
}

@keyframes org-ai-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Toasts / notificaciones rápidas */
.org-ai-toast {
  position: fixed;
  right: var(--spacing-md);
  bottom: var(--spacing-md);
  z-index: 10000000 !important;
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(2,6,23,0.12);
}

/* Modal genérico */
.org-ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000000 !important;
}

.org-ai-modal.is-open {
  display: flex;
}

.org-ai-modal .org-ai-dialog {
  width: min(720px, 92vw);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid #e5e7eb;
  padding: var(--spacing-lg);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  body { overflow-x: hidden; }
  header { 
    flex-direction: row; 
    align-items: center; 
    flex-wrap: wrap;
    padding: 10px 15px;
  }
  header h1 { font-size: 18px; }
  header img { height: 60px; }
  nav { 
    margin-top: 0; 
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  nav a { 
    display: inline-block; 
    margin: 0; 
    padding: 5px 10px;
    font-size: 14px;
  }
  
  .modal {
    padding: var(--spacing-sm);
    align-items: flex-start;
    padding-top: var(--spacing-lg);
  }
  
  .modal-content {
    max-height: 95vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  
  .modal-content.wide,
  .modal-content.compact {
    width: 100%;
    max-width: 100%;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-md);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .grid,
  .objectives-grid,
  .strategy-grid {
    grid-template-columns: 1fr;
  }
  
  .pb-wrap,
  .org-wrap {
    grid-template-columns: 1fr;
  }
  
  .org-ai-wrap {
    grid-template-columns: 1fr;
  }
  
  .org-ai-chat,
  .org-ai-sidebar {
    height: auto;
    min-height: 0;
  }
  
  .filters,
  .objectives-filters,
  .strategy-filters,
  .users-filters,
  .commercial-filters,
  .clients-filters,
  .operations-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filters input[type="search"],
  .objectives-filters input[type="search"],
  .strategy-filters input[type="search"],
  .users-filters input[type="search"],
  .commercial-filters input[type="search"],
  .clients-filters input[type="search"],
  .operations-filters input[type="search"] {
    min-width: auto;
  }
}

/* === ESTILOS ESPECÍFICOS PARA PLAYBOOKS === */
.editor-toolbar {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--light-color);
  border-radius: var(--radius-md);
  border: 1px solid #e0e0e0;
}

.media-preview {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--light-color);
  border-radius: var(--radius-sm);
  border: 1px solid #e0e0e0;
}

.media-preview img {
  display: block;
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.media-info {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

/* === ESTILOS PARA VISTA PREVIA DE PLAYBOOKS === */
.playbook-preview {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.preview-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border);
}

.preview-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
}

.preview-meta {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-md);
}

.preview-status, .preview-process {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.875rem;
}

.preview-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.preview-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

/* Secciones en vista previa */
.preview-section {
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.preview-section-header {
  background: var(--light-color);
  padding: var(--spacing-lg);
  border-bottom: 2px solid var(--border);
}

.preview-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.preview-section-content {
  padding: var(--spacing-xl);
}

.preview-text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-color);
  white-space: pre-wrap;
  font-weight: 400;
}

.preview-media {
  margin-top: var(--spacing-md);
}

.preview-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Checklists en vista previa */
.preview-checklist {
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.preview-checklist-header {
  background: var(--light-color);
  padding: var(--spacing-lg);
  border-bottom: 2px solid var(--border);
}

.preview-checklist-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0 0 var(--spacing-sm) 0;
}

.preview-checklist-description {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0;
}

.preview-checklist-items {
  padding: var(--spacing-xl);
}

.preview-checklist-item {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: var(--spacing-sm);
}

.preview-checklist-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.preview-checkbox {
  flex-shrink: 0;
  position: relative;
}

.preview-checkbox input {
  width: 22px;
  height: 22px;
  cursor: not-allowed;
}

.preview-item-content {
  flex: 1;
}

.preview-item-label {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: var(--spacing-sm);
  font-size: 1.1rem;
}

.preview-item-description {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
  line-height: 1.5;
}

.preview-item-meta {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.preview-empty-items {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--text-muted);
  font-style: italic;
}

/* Estilos para botones de exportación */
.overlay-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.overlay-actions .btn {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.overlay-actions .btn span {
  font-size: 1rem;
}

/* === ESTILOS PARA GENERADOR DE IA === */
.ai-generator-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.ai-generator-actions {
  text-align: center;
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--border);
}

/* Sección de resultado de IA */
#aiResultSection {
  display: none;
}

#aiResultSection:not(.hidden) {
  display: block;
}

.ai-result-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--success-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--success-color);
}

.ai-result-header h4 {
  color: var(--success-color);
  margin: 0 0 var(--spacing-sm) 0;
}

.ai-result-header p {
  color: var(--text-muted);
  margin: 0;
}

.ai-result-preview {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  background: white;
  margin-bottom: var(--spacing-lg);
}

.ai-result-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

.ai-preview-playbook {
  font-family: var(--font-family);
}

.ai-preview-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--primary-color);
}

.ai-preview-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.ai-preview-description {
  color: var(--text-muted);
  font-size: 1rem;
}

.ai-preview-sections {
  margin-bottom: var(--spacing-lg);
}

.ai-preview-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
}

.ai-preview-section-header {
  background: var(--light-color);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.ai-preview-section-title {
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.ai-preview-section-content {
  padding: var(--spacing-md);
}

.ai-preview-section-content h3,
.ai-preview-section-content h4 {
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.ai-preview-section-content h3:first-child,
.ai-preview-section-content h4:first-child {
  margin-top: 0;
}

.ai-preview-checklists {
  margin-top: var(--spacing-lg);
}

.ai-preview-checklist {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
}

.ai-preview-checklist-header {
  background: var(--light-color);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.ai-preview-checklist-title {
  font-weight: 600;
  color: var(--text-color);
  margin: 0 0 var(--spacing-xs) 0;
}

.ai-preview-checklist-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.ai-preview-checklist-items {
  padding: var(--spacing-md);
}

.ai-preview-checklist-item {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid #f0f0f0;
}

.ai-preview-checklist-item:last-child {
  border-bottom: none;
}

.ai-preview-checkbox {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  min-width: 40px;
}

.ai-preview-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: not-allowed;
}

.ai-preview-checkbox .checkbox-icon {
  font-size: 1.2rem;
  line-height: 1;
}


.ai-preview-item-content {
  flex: 1;
}

.ai-preview-item-label {
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: var(--spacing-xs);
}

.ai-preview-item-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
}

.ai-preview-item-meta {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

/* Estados de carga */
.ai-loading .ai-generator-form {
  opacity: 0.6;
  pointer-events: none;
}

.ai-loading .ai-generator-actions {
  position: relative;
}

.ai-loading .ai-generator-actions::after {
  content: "GENERANDO CONTENIDO CON IA...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  z-index: 10000000 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.ai-loading #btnGeneratePlaybookAI {
  background: var(--secondary-color);
  color: var(--text-muted);
  cursor: not-allowed;
}

.ai-loading #btnGeneratePlaybookAI span:not(#aiSpinner) {
  opacity: 0.3;
}

#aiSpinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: var(--spacing-xs);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.editor-content {
  min-height: 400px;
  padding: var(--spacing-lg);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid #e0e0e0;
}

.editor-content.preview-mode .editor-item-actions,
.editor-content.preview-mode .checklist-actions {
  display: none;
}

.empty-state {
  text-align: center;
  padding: var(--spacing-xxl);
  color: var(--text-muted);
  font-style: italic;
}

.editor-item {
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  background: #fafafa;
}

.editor-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid #e0e0e0;
}

.editor-item-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.editor-item-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.editor-item-content {
  padding-left: var(--spacing-md);
}

.section-content {
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid #f0f0f0;
  min-height: 60px;
}

.checklist-description {
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid #f0f0f0;
  margin-bottom: var(--spacing-md);
  font-style: italic;
  color: var(--text-secondary);
}

.checklist-items {
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid #f0f0f0;
  overflow: hidden;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-bottom: 1px solid #f0f0f0;
  transition: background-color var(--transition-fast);
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-item:hover {
  background: #f8f9fa;
}

.checklist-item input[type="checkbox"] {
  margin: 0;
  cursor: not-allowed;
  opacity: 0.7;
}

.checklist-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.checklist-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.preview-content {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid #e0e0e0;
}

.preview-content .editor-item {
  background: white;
  border: 1px solid #e0e0e0;
}

.preview-content .editor-item-header {
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: var(--spacing-sm);
}

.preview-content .section-content {
  background: #fafafa;
  border: none;
}

.preview-content .checklist-description {
  background: #fafafa;
  border: none;
}

.preview-content .checklist-items {
  background: #fafafa;
  border: none;
}

.preview-content .checklist-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-sm);
}

.preview-content .checklist-item:last-child {
  margin-bottom: 0;
}

/* Badges específicos para playbooks */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.gray {
  background: #6c757d;
  color: white;
}

.badge.green {
  background: var(--success-color);
  color: white;
}

.badge.orange {
  background: var(--warning-color);
  color: white;
}

.badge.red {
  background: var(--danger-color);
  color: white;
}

.badge.blue {
  background: var(--secondary-color);
  color: white;
}

/* === FORMULARIOS OVERLAY === */
.form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000000 !important;
  padding: var(--spacing-md);
  box-sizing: border-box;
}

/* === PANEL PEXELS === */
.pexels-panel {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-lg);
  max-height: 400px;
  overflow-y: auto;
}

.pexels-panel .panel-header {
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: var(--spacing-sm);
}

.inline-field {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.inline-field input {
  flex: 1;
}

.form-modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.form-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
}

.form-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid #eee;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  background: #fafafa;
}

/* Responsive para editor de playbooks */
@media (max-width: 768px) {
  .editor-toolbar {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  .editor-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
  
  .editor-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .checklist-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
  
  .checklist-actions {
    align-self: flex-end;
  }
  
  .form-modal {
    width: 95%;
    max-width: none;
  }
  
  .form-header,
  .form-body,
  .form-footer {
    padding: var(--spacing-md);
  }
  
  .form-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: var(--spacing-sm);
    padding-top: var(--spacing-lg);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-sm);
  }
}

/* ===== MODAL DE CONFIRMACIÓN PERSONALIZADO PARA PLAN COMPLETO ===== */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000000 !important;
  backdrop-filter: blur(4px);
}

.ai-modal-overlay .card-large {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ai-modal-overlay .card-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: var(--text-white);
  border-bottom: none;
  position: relative;
  padding: var(--spacing-lg);
}

.ai-modal-overlay .card-header h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.ai-modal-overlay .btn-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

.ai-modal-overlay .btn-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-icon-large {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 8px 25px rgba(242, 180, 0, 0.3);
}

.ai-icon-large i {
  font-size: 2rem;
  color: var(--text-white);
}

.plan-elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
}

.plan-element {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--light-color);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-element:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.plan-element-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.plan-element-icon i {
  color: var(--text-white);
  font-size: 1.1rem;
}

.plan-element-content h6 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}

.plan-element-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.btn-ai-large {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: var(--text-white);
  border: none;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(242, 180, 0, 0.3);
}

.btn-ai-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242, 180, 0, 0.4);
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

.btn-ai-large:active {
  transform: translateY(0);
}

/* Responsive para el modal */
@media (max-width: 768px) {
  .ai-modal-overlay .card-large {
    width: 95%;
    margin: var(--spacing-md);
  }
  
  .plan-elements-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .plan-element {
    padding: var(--spacing-sm);
  }
  
  .ai-icon-large {
    width: 60px;
    height: 60px;
  }
  
  .ai-icon-large i {
    font-size: 1.5rem;
  }
}

/* ===== ESTILOS ESPECÍFICOS PARA MÓDULO DE EQUIPOS ===== */

/* Sidebar específico para equipos */
.sidebar {
  background: var(--primary-dark);
  min-height: 100vh;
  padding: 0;
}

.sidebar-content {
  padding: 1.5rem 1rem;
}

.sidebar-title {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav .nav-link {
  color: var(--text-white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-nav .nav-link:hover {
  background: rgba(242, 180, 0, 0.1);
  color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
  background: var(--primary-color);
  color: var(--primary-dark);
  font-weight: 600;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
}

/* Contenido principal */
.main-content {
  padding: 2rem;
  background: var(--light-color);
  min-height: 100vh;
}

/* Secciones de contenido */
.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
  color: var(--primary-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-actions {
  display: flex;
  gap: 1rem;
}

/* Tarjetas de filtros */
.filters-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.filters-card .row {
  align-items: end;
}

/* Grid de equipos */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.team-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
}

.team-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.team-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.team-type {
  background: var(--primary-color);
  color: var(--primary-dark);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.team-description {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.team-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.team-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: block;
}

.team-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.team-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.team-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Estados de equipos */
.team-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.team-status.active {
  background: var(--success-color);
  color: white;
}

.team-status.inactive {
  background: var(--warning-color);
  color: white;
}

.team-status.archived {
  background: var(--danger-color);
  color: white;
}

/* Lista de tareas */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.task-item {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.task-item:hover {
  box-shadow: var(--shadow-md);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.task-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.task-priority {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.task-priority.low {
  background: var(--info-color);
  color: white;
}

.task-priority.medium {
  background: var(--warning-color);
  color: white;
}

.task-priority.high {
  background: var(--danger-color);
  color: white;
}

.task-priority.critical {
  background: var(--primary-dark);
  color: white;
}

.task-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.task-progress {
  margin-bottom: 1rem;
}

.task-progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.task-progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Estados de tareas */
.task-status {
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.task-status.pending {
  background: var(--info-color);
  color: white;
}

.task-status.in_progress {
  background: var(--primary-color);
  color: var(--primary-dark);
}

.task-status.blocked {
  background: var(--danger-color);
  color: white;
}

.task-status.completed {
  background: var(--success-color);
  color: white;
}

.task-status.cancelled {
  background: var(--text-muted);
  color: white;
}

/* Urgencia de tareas */
.task-urgency.overdue {
  border-left: 4px solid var(--danger-color);
}

.task-urgency.due_today {
  border-left: 4px solid var(--warning-color);
}

.task-urgency.due_soon {
  border-left: 4px solid var(--info-color);
}

.task-urgency.on_time {
  border-left: 4px solid var(--success-color);
}

/* Miembros de equipo */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.member-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.member-card:hover {
  box-shadow: var(--shadow-md);
}

.member-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.member-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 1.25rem;
}

.member-info h4 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1.125rem;
}

.member-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.member-role {
  background: var(--primary-color);
  color: var(--primary-dark);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.member-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

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

.member-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: block;
}

.member-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Asignaciones */
.assignments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.assignment-item {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.assignment-item:hover {
  box-shadow: var(--shadow-md);
}

.assignment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.assignment-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.assignment-type {
  background: var(--info-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.assignment-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* KPIs */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.kpi-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.kpi-type {
  background: var(--primary-color);
  color: var(--primary-dark);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.kpi-target {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.kpi-progress {
  margin-top: 1rem;
}

.kpi-progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.kpi-progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

/* Capacidad */
.capacity-chart {
  background: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.capacity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.capacity-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.capacity-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.capacity-stat {
  text-align: center;
  padding: 1rem;
  background: var(--light-color);
  border-radius: var(--radius-md);
}

.capacity-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: block;
}

.capacity-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Paginación */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination li {
  display: flex;
}

.pagination a {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.pagination a:hover {
  background: var(--primary-color);
  color: var(--primary-dark);
  border-color: var(--primary-color);
}

.pagination .active a {
  background: var(--primary-color);
  color: var(--primary-dark);
  border-color: var(--primary-color);
}

/* Responsive para equipos */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .teams-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 576px) {
  .filters-card .row {
    flex-direction: column;
  }
  
  .filters-card .col-md-3,
  .filters-card .col-md-2 {
    width: 100%;
    margin-bottom: 1rem;
  }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 16px;
    min-width: 300px;
    max-width: 400px;
    z-index: 10000000 !important;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 4px solid #ccc;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.toast-content i {
    font-size: 18px;
}

.toast-success {
    border-left-color: #28a745;
}

.toast-success .toast-content i {
    color: #28a745;
}

.toast-error {
    border-left-color: #dc3545;
}

.toast-error .toast-content i {
    color: #dc3545;
}

.toast-info {
    border-left-color: #17a2b8;
}

.toast-info .toast-content i {
    color: #17a2b8;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toast-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ===== SELECT CON SCROLL ===== */
select[size] {
    max-height: 200px;
    overflow-y: auto;
}

select optgroup {
    font-weight: bold;
    background-color: #f8f9fa;
}

select option {
    padding: 4px 8px;
}

/* ===== USER SEARCH COMPONENT ===== */
.user-search-container {
    position: relative;
}

.user-search-container input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000000 !important;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
}

.search-result-name {
    font-weight: 500;
    color: #333;
}

.search-result-email {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.search-result-role {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
}

.search-no-results {
    padding: 12px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ===== ALERT STYLES ===== */
.alert {
    padding: 12px 16px;
    margin: 12px 0;
    border: 1px solid transparent;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left-color: #28a745;
}

.toast-error {
    border-left-color: #dc3545;
}

.toast-info {
    border-left-color: #17a2b8;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-content i {
    font-size: 18px;
}

.toast-success .toast-content i {
    color: #28a745;
}

.toast-error .toast-content i {
    color: #dc3545;
}

.toast-info .toast-content i {
    color: #17a2b8;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toast-close:hover {
    background-color: #f5f5f5;
}

/* =====================================================
   MÓDULO DE COLABORACIÓN Y FORO
   ===================================================== */

/* Dashboard de colaboración */
.collaboration-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.collaboration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.collaboration-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.collaboration-filters input,
.collaboration-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.collaboration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Tarjetas de canales */
.channel-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.channel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.channel-type {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.channel-description {
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.channel-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-muted);
}

.channel-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.channel-actions {
    display: flex;
    gap: 10px;
}

.channel-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Modal de chat */
/* Modal de chat - usando sistema estándar de modales */

/* Contenedor de chat dentro del modal estándar */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header del chat manejado por modal-header estándar */

.chat-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.chat-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.message-author {
    font-weight: 600;
    color: var(--text-color);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
}

.message-text {
    color: var(--text-color);
    line-height: 1.4;
}

/* Mensajes con fondo garantizado */

.no-messages {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    margin: 20px 0;
}

/* Input del chat manejado por modal-footer estándar */

/* Estados de carga */
.collaboration-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.collaboration-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive para colaboración */
@media (max-width: 768px) {
    .collaboration-header {
        flex-direction: column;
        align-items: stretch;
    }

    .collaboration-filters {
        justify-content: center;
    }

    .collaboration-grid {
        grid-template-columns: 1fr;
    }

    .chat-container {
        width: 95%;
        height: 90%;
    }

    .channel-stats {
        flex-direction: column;
        gap: 10px;
    }

    .channel-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .collaboration-dashboard {
        padding: 10px;
    }

    .channel-card {
        padding: 15px;
    }

    .chat-messages {
        padding: 15px;
    }
}

/* ===== MÓDULO INFO WRAPPERS - Sistema de Información de Módulos ===== */

/* Wrapper base para información de módulos */
.module-info-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.module-info-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.module-info-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.module-info-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.module-info-wrapper:hover .module-info-icon {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.module-info-text h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.2;
}

.module-info-text p {
    margin: 0 0 12px 0;
    opacity: 0.9;
    line-height: 1.5;
    font-size: 0.95rem;
}

.module-info-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.module-info-feature {
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.module-info-feature:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

/* === PALETA DE COLORES POR CATEGORÍA === */

/* Módulos Estratégicos */
.module-info-strategic { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.module-info-initiatives { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.module-info-incubator { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }

/* Módulos Organizacionales */
.module-info-org { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.module-info-processes { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.module-info-positions { background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%); }

/* Módulos de Capacidad */
.module-info-capacity { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); color: #333; }
.module-info-assignments { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); color: #333; }

/* Módulos de Aprendizaje */
.module-info-learning { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); color: #333; }
.module-info-courses { background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%); color: #333; }
.module-info-tasks { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); }

/* Módulos de Gestión */
.module-info-teams { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.module-info-collaboration { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.module-info-objectives { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.module-info-projects { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.module-info-roles { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }

/* Responsive Design */
@media (max-width: 768px) {
    .module-info-content {
        flex-direction: column;
        text-align: center;
    }
    
    .module-info-icon {
        align-self: center;
    }
    
    .module-info-features {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .module-info-wrapper {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .module-info-text h3 {
        font-size: 1.1rem;
    }
    
    .module-info-text p {
        font-size: 0.9rem;
    }
    
    .module-info-feature {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

/* === HEADER BACKGROUND - WAIFLOW BRANDING === */
.index-header-style {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
}

/* === HEADER RESPONSIVE ADICIONAL === */
@media (max-width: 480px) {
  .index-header-style {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
  }
  
  header h1 {
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  header img {
    height: 50px;
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  nav {
    margin-left: 0;
    justify-content: center;
    width: 100%;
  }
  
  nav a {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* === ESTILOS PARA MÓDULO COMERCIAL === */

/* Pipeline Container */
.pipeline-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 16px 0;
  min-height: 600px;
}

.pipeline-column {
  flex: 1;
  min-width: 280px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transition: all 0.2s ease;
}

.pipeline-column.drag-over {
  background: #e3f2fd;
  border: 2px dashed #2196f3;
  transform: scale(1.02);
}

.pipeline-column.drag-source {
  background: #fff3e0;
  border: 2px dashed #ff9800;
}

.column-header {
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.column-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-count {
  background: #6c757d;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.column-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Opportunity Cards */
.opportunity-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.opportunity-card:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.opportunity-card:active {
  cursor: grabbing;
}

.opportunity-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  z-index: 1000;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f3f4;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #212529;
  flex: 1;
}

.card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.opportunity-card:hover .card-actions {
  opacity: 1;
}

.btn-icon {
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 4px;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.btn-icon:hover {
  background: #f8f9fa;
  color: #495057;
}

.btn-icon.btn-danger {
  color: #dc3545;
}

.btn-icon.btn-danger:hover {
  background: #f8d7da;
  color: #721c24;
}

.card-body {
  padding: 12px 16px;
}

.opportunity-info {
  margin-bottom: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.info-row .label {
  color: #6c757d;
  font-weight: 500;
}

.info-row .value {
  color: #212529;
  font-weight: 600;
}

.next-action {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 6px 8px;
  margin: 8px 0;
  font-size: 0.75rem;
  color: #856404;
  display: flex;
  align-items: center;
  gap: 4px;
}

.notes {
  background: #f8f9fa;
  border-left: 3px solid #6c757d;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 0.75rem;
  color: #495057;
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.card-footer {
  padding: 8px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 8px 8px;
}

.opportunity-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #6c757d;
  flex-wrap: wrap;
  gap: 8px;
}

.opportunity-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Stage Badges */
.stage-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stage-prospecto {
  background: #6c757d;
  color: white;
}

.stage-contactado {
  background: #17a2b8;
  color: white;
}

.stage-cotizacion {
  background: #ffc107;
  color: #212529;
}

.stage-negociacion {
  background: #fd7e14;
  color: white;
}

.stage-ganado {
  background: #28a745;
  color: white;
}

.stage-perdido {
  background: #dc3545;
  color: white;
}

/* Opportunity Details */
.opportunity-details {
  padding: 16px;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
}

.details-header h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #212529;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item label {
  font-weight: 600;
  color: #495057;
  font-size: 0.85rem;
}

.detail-item span {
  color: #212529;
  font-size: 0.9rem;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section label {
  font-weight: 600;
  color: #495057;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 8px;
}

.detail-section p {
  margin: 0;
  color: #212529;
  line-height: 1.5;
  background: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  border-left: 3px solid #6c757d;
}

/* Responsive Pipeline */
@media (max-width: 1200px) {
  .pipeline-container {
    flex-direction: column;
    gap: 12px;
  }
  
  .pipeline-column {
    min-width: 100%;
    max-height: 400px;
  }
}

@media (max-width: 768px) {
  .pipeline-container {
    padding: 8px 0;
  }
  
  .pipeline-column {
    min-width: 100%;
    max-height: 300px;
  }
  
  .column-header {
    padding: 12px;
  }
  
  .column-content {
    padding: 12px;
  }
  
  .opportunity-card {
    margin-bottom: 8px;
  }
  
  .card-header {
    padding: 8px 12px;
  }
  
  .card-body {
    padding: 8px 12px;
  }
  
  .card-footer {
    padding: 6px 12px;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* === ESTILOS PARA DASHBOARD COMERCIAL === */

/* KPIs Grid */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f2b400, #120368);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-header i {
  font-size: 1.2rem;
  color: #f2b400;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 8px;
  line-height: 1;
}

.kpi-subtitle {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 500;
}

.kpi-progress {
  margin-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 600;
}

/* Dashboard Sections */
.dashboard-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
  margin: 0 0 20px 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Pipeline Stages */
.pipeline-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.pipeline-stage {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.pipeline-stage:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-left: 12px;
}

.stage-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
}

.stage-count {
  background: #6c757d;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.stage-details {
  padding-left: 12px;
}

.stage-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 4px;
}

.stage-weighted {
  font-size: 0.8rem;
  color: #6c757d;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.chart-container {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
}

.chart-container canvas {
  max-height: 300px;
}

/* Activities Grid */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
}

.activities-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.activities-section h3 {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #f2b400;
  transition: all 0.2s ease;
}

.activity-item:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.activity-icon {
  width: 40px;
  height: 40px;
  background: #f2b400;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 600;
  color: #212529;
  margin-bottom: 4px;
}

.activity-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: #6c757d;
}

.client {
  font-weight: 500;
}

/* Inactive Clients */
.inactive-clients {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  border-left: 4px solid #ffc107;
}

.client-info {
  flex: 1;
}

.client-name {
  font-weight: 600;
  color: #212529;
  margin-bottom: 2px;
}

.client-company {
  font-size: 0.8rem;
  color: #6c757d;
}

.client-meta {
  text-align: right;
  font-size: 0.8rem;
  color: #856404;
}

.last-purchase {
  margin-bottom: 2px;
}

.days-inactive {
  font-weight: 600;
}

.no-data {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 20px;
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
  .kpis-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .activities-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpis-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .kpi-card {
    padding: 16px;
  }
  
  .kpi-value {
    font-size: 1.5rem;
  }
  
  .dashboard-section {
    padding: 16px;
  }
  
  .pipeline-stages {
    grid-template-columns: 1fr;
  }
  
  .chart-container {
    padding: 16px;
  }
  
  .activities-section {
    padding: 16px;
  }
  
  .client-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .client-meta {
    text-align: left;
  }
}

/* Chart Fallback Tables */
.chart-fallback {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-fallback h4 {
  color: #333;
  margin-bottom: 16px;
  font-size: 1.1rem;
  border-bottom: 2px solid #f1f3f4;
  padding-bottom: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #f1f3f4;
}

.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.data-table tr:hover {
  background: #f8f9fa;
}

/* === ESTILOS PARA COTIZACIONES COMERCIALES === */

/* Formulario de cotización */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-section {
  margin-bottom: 24px;
}

.form-section h4 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #f1f3f4;
  padding-bottom: 8px;
}

/* Items de cotización */
.quotation-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* Items de propuesta en dos filas */
#proposalModal .quotation-item {
  grid-template-columns: 2fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 12px;
}

#proposalModal .quotation-item .item-description {
  grid-column: 1 / -2; /* Ocupa toda la primera fila excepto el botón */
  grid-row: 1;
}

#proposalModal .quotation-item .item-quantity {
  grid-column: 1;
  grid-row: 2;
}

#proposalModal .quotation-item .item-price {
  grid-column: 2;
  grid-row: 2;
}

#proposalModal .quotation-item .item-total {
  grid-column: 3;
  grid-row: 2;
}

#proposalModal .quotation-item button {
  grid-column: -1; /* Última columna */
  grid-row: 1 / -1; /* Ocupa ambas filas */
  align-self: center;
}

.quotation-item input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.quotation-item input:focus {
  outline: none;
  border-color: #f2b400;
  box-shadow: 0 0 0 2px rgba(242, 180, 0, 0.2);
}

/* Detalles de cotización */
.quotation-details {
  background: white;
  border-radius: 8px;
  padding: 20px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item label {
  font-weight: 600;
  color: #495057;
  font-size: 0.85rem;
}

.detail-item span {
  color: #212529;
  font-size: 0.9rem;
}

.total-amount {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: #28a745 !important;
}

/* Badges de estado */
.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-info {
  background: #d1ecf1;
  color: #0c5460;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
}

.badge-secondary {
  background: #e2e3e5;
  color: #383d41;
}

/* Modal grande */
.modal-large {
  max-width: 900px;
  width: 90%;
}

/* Modal extra grande */
.modal-xl {
  max-width: 1400px;
  width: 95%;
}

/* Layout responsivo para propuestas */
@media (max-width: 1200px) {
  .modal-xl {
    width: 98%;
    max-width: 100%;
  }
  
  /* Hacer que el grid de dos columnas se apile en móviles */
  .modal-xl [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Form section para items de propuestas - mejoras visuales */
#proposalModal .form-section {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

#proposalModal .form-section h4 {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-primary);
  font-size: 1.1em;
  font-weight: 600;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: var(--spacing-xs);
}

#proposalItemsContainer {
  margin-bottom: var(--spacing-md);
  min-height: 50px;
  width: 100%;
}

#proposalItemsContainer:empty::after {
  content: "No hay items agregados. Haz clic en 'Agregar Item' para comenzar.";
  display: block;
  padding: var(--spacing-md);
  text-align: center;
  color: #999;
  font-style: italic;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: var(--spacing-md);
}

/* Responsive para cotizaciones */
@media (max-width: 768px) {
  .quotation-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
  }
}

/* === ESTILOS PARA MÓDULO DE CLIENTES === */
.client-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-info strong {
  color: var(--color-primary);
  font-weight: 600;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9em;
  color: var(--color-text-secondary);
}

.contact-info i {
  width: 12px;
  margin-right: 4px;
  color: var(--color-primary);
}

.client-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.details-section {
  background: var(--color-background-light);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}

.details-section h4 {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-primary);
  font-size: 1.1em;
  font-weight: 600;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: var(--spacing-xs);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-item label {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item span {
  color: var(--color-text);
  font-size: 1em;
}

.notes-content {
  background: var(--color-background);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Responsive para detalles de cliente */
@media (max-width: 768px) {
  .details-grid {
    grid-template-columns: 1fr;
  }
  
  .client-details {
    gap: var(--spacing-md);
  }
  
  .details-section {
    padding: var(--spacing-sm);
  }
}

/* === ESTILOS PARA ACTIVIDADES DE CLIENTES === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--color-border);
}

.section-header h3 {
  margin: 0;
  color: var(--color-primary);
  font-size: 1.3em;
}

.client-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.summary-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--color-background-light);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}

.summary-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.5em;
}

.summary-icon.success {
  background: #d4edda;
  color: #28a745;
}

.summary-icon.info {
  background: #d1ecf1;
  color: #17a2b8;
}

.summary-icon.warning {
  background: #fff3cd;
  color: #ffc107;
}

.summary-icon.danger {
  background: #f8d7da;
  color: #dc3545;
}

.summary-icon.secondary {
  background: #e2e3e5;
  color: #6c757d;
}

.summary-content {
  flex: 1;
}

.summary-value {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.summary-label {
  font-size: 0.85em;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.btn-icon.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-icon.btn-info:hover {
  background-color: #138496;
}

/* Responsive para actividades */
@media (max-width: 768px) {
  .client-summary {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
}

/* =====================================================
   ESTILOS PARA MÓDULO DE FINANZAS
   ===================================================== */

/* Filtros de finanzas - usar la misma clase que comercial */
.finance-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.finance-filters input,
.finance-filters select {
  min-width: 150px;
}

/* Form controls para campos de fecha */
.form-control {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-normal);
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(242, 180, 0, 0.1);
}

.form-control[type="date"] {
  min-width: 150px;
}

/* Resumen financiero */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.finance-summary .summary-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.finance-summary .summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
}

.finance-summary .summary-icon.success {
  background: #28a745;
}

.finance-summary .summary-icon.danger {
  background: #dc3545;
}

.finance-summary .summary-icon.info {
  background: #17a2b8;
}

.finance-summary .summary-icon.warning {
  background: #ffc107;
  color: #212529;
}

.finance-summary .summary-content {
  flex: 1;
}

.finance-summary .summary-value {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.finance-summary .summary-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Secciones del formulario */
.form-section {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
}

.form-section h4 {
  margin: 0 0 16px 0;
  color: #333;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h4 i {
  color: #007bff;
}

/* Modal ancho para formularios complejos */
.modal-content.wide {
  max-width: 900px;
  width: 95%;
}

/* Tabla de datos */
.table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #e0e0e0;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}

.data-table td.order-costs {
  vertical-align: middle;
  text-align: right;
  position: relative;
  min-width: 120px;
  max-width: 150px;
  width: 150px;
  overflow: visible;
  box-sizing: border-box;
}

.data-table td.order-costs > .order-costs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-end;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.data-table td.sla-status {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
  min-width: 100px;
  max-width: 120px;
  width: 120px;
  box-sizing: border-box;
}

.data-table td.sla-status .sla-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

/* Columna de Tipo más angosta */
#ordersTable th:nth-child(3),
#ordersTable td:nth-child(3) {
  max-width: 110px;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

/* Empty state mejorado */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-icon {
  font-size: 48px;
  color: #ccc;
  margin-bottom: 16px;
}

.empty-state h3 {
  margin: 0 0 8px 0;
  color: #333;
}

.empty-state p {
  margin: 0 0 20px 0;
  color: #666;
}

/* Responsive para finanzas */
@media (max-width: 768px) {
  .finance-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .finance-filters input,
  .finance-filters select {
    min-width: auto;
  }
  
  .finance-summary {
    grid-template-columns: 1fr;
  }
  
  .modal-content.wide {
    width: 98%;
    max-width: none;
  }
  
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 4px;
  }
}

/* === ESTILOS PARA BADGES DE INFORMACIÓN === */
.card-header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-info {
  background-color: #17a2b8;
  color: white;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

.badge-warning {
  background-color: #ffc107;
  color: #212529;
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

/* === ESTILOS ESPECÍFICOS PARA WRAPPERS DE MÓDULOS === */
/* Wrapper específico para módulo comercial */
.module-info-commercial {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Wrapper específico para módulo de finanzas */
.module-info-finance {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Wrapper específico para módulo de operaciones */
.module-info-operations {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Wrapper específico para módulo de tokens */
.module-info-tokens {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #333;
}

/* ===== MÓDULO DE OPERACIONES ===== */

/* ===== MÓDULO DE ÓRDENES DE TRABAJO ===== */

/* Resumen de órdenes */
.summary-section {
    margin-bottom: 2rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.summary-content {
    flex: 1;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.summary-label {
    font-size: 0.875rem;
    color: #718096;
    margin-top: 0.25rem;
}

/* Tabla de órdenes */
.orders-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.order-folio {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-folio strong {
    font-weight: 600;
    color: #2d3748;
}

.order-folio small {
    color: #718096;
    font-size: 0.75rem;
}

.order-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-type i {
    color: #667eea;
}

/* .order-costs ya está definido arriba para .data-table td.order-costs .order-costs */
/* Esta regla solo aplica fuera de tablas */
.order-costs:not(.data-table td .order-costs) {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.data-table td.order-costs .cost-item {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.cost-item.margin {
    color: #38a169;
    font-weight: 600;
}

/* Estados SLA - solo para elementos fuera de tablas */
.sla-status:not(td) {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    flex-direction: row;
    flex-wrap: nowrap;
}

.sla-status.sla-ontime {
    color: #38a169;
}

.sla-status.sla-warning {
    color: #ed8936;
}

.sla-status.sla-overdue {
    color: #e53e3e;
}

.sla-status.sla-late {
    color: #e53e3e;
}

.sla-status.sla-ontrack {
    color: #38a169;
}

.sla-status.sla-none {
    color: #718096;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
}

/* Detalle de orden */
.order-detail {
    padding: 1rem;
}

.order-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.order-basic-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-basic-info h4 {
    margin: 0;
    color: #2d3748;
}

.order-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.875rem;
}

.info-group span {
    color: #2d3748;
}

.order-notes {
    margin-bottom: 1.5rem;
}

.notes-content {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-top: 0.5rem;
}

.order-items h5,
.order-costs h5 {
    margin-bottom: 1rem;
    color: #2d3748;
    font-weight: 600;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.item-name {
    font-weight: 600;
    color: #2d3748;
}

.item-description {
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #718096;
}

.costs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* .cost-item para modales y detalles (no tablas) */
.order-detail .cost-item,
.order-detail .costs-grid .cost-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cost-item.total {
    font-weight: 600;
    color: #2d3748;
    border-top: 2px solid #e2e8f0;
    padding-top: 0.5rem;
}

.cost-item.margin {
    color: #38a169;
    font-weight: 600;
}

/* Filtros activos */
.active-filters {
    background: #edf2f7;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.active-filters-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tag {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .order-info-grid {
        grid-template-columns: 1fr;
    }
    
    .costs-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .order-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .order-basic-info {
        flex-wrap: wrap;
    }
}

/* Dashboard de KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 16px;
}

.kpi-content {
  flex: 1;
}

.kpi-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Gráficos del dashboard */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.chart-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.chart-card canvas {
  max-height: 250px;
}

/* Tablero Kanban */
.kanban-section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.kanban-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  min-height: 400px;
}

.kanban-column {
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kanban-column-header {
  padding: 12px 16px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-column-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.kanban-count {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

.kanban-column-content {
  padding: 12px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: white;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.kanban-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kanban-folio {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.kanban-priority {
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.kanban-card-body {
  margin-bottom: 8px;
}

.kanban-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kanban-type {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.kanban-team {
  font-size: 11px;
  color: var(--text-muted);
}

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.kanban-sla {
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.sla-ontime { background: #d4edda; color: #155724; }
.sla-late { background: #f8d7da; color: #721c24; }
.sla-overdue { background: #f5c6cb; color: #721c24; }
.sla-warning { background: #fff3cd; color: #856404; }
.sla-ontrack { background: #cce5ff; color: #004085; }
.sla-none { background: #e2e3e5; color: #383d41; }

.kanban-deadline {
  color: var(--text-muted);
  font-size: 10px;
}

/* Controles de órdenes */
.orders-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.orders-table-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

/* Modal de orden */
.modal.wide {
  max-width: 90vw;
  width: 1200px;
}

.order-detail {
  padding: 20px;
}

.order-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e9ecef;
}

.order-basic-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-basic-info h4 {
  margin: 0;
  color: var(--text-primary);
}

.order-sla-info {
  display: flex;
  align-items: center;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-group label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-group span {
  color: var(--text-primary);
  font-size: 14px;
}

.order-notes {
  margin-bottom: 24px;
}

.order-notes label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.notes-content {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid var(--primary-color);
  color: var(--text-primary);
}

.order-items {
  margin-bottom: 24px;
}

.order-items h5 {
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 16px;
  transition: border-color 0.2s ease;
}

.item-card:hover {
  border-color: var(--primary-color);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.item-name {
  font-weight: 600;
  color: var(--text-primary);
}

.item-description {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 14px;
}

.item-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.order-costs h5 {
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}

.costs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.cost-item {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
}

.cost-item.total {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.cost-item.margin {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
}

.cost-item label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}

.cost-item span {
  font-size: 18px;
  font-weight: bold;
}

/* ===== MODAL DE PROGRESO DE IA PARA INICIATIVAS ===== */
.initiatives-ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000001 !important;
  animation: initiativesOverlayFadeIn 0.3s ease-out;
}

@keyframes initiativesOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.initiatives-ai-progress-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 10000002 !important;
  animation: initiativesModalSlideIn 0.4s ease-out;
}

@keyframes initiativesModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.initiatives-ai-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.initiatives-ai-progress-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.initiatives-ai-brain-animation {
  position: relative;
  width: 40px;
  height: 40px;
}

.initiatives-brain-core {
  width: 40px;
  height: 40px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 50%;
  position: relative;
  animation: initiativesBrainPulse 2s ease-in-out infinite;
}

.initiatives-brain-pulse {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: initiativesPulseRing 2s ease-out infinite;
}

@keyframes initiativesBrainPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(78, 205, 196, 0);
  }
}

@keyframes initiativesPulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.initiatives-ai-progress-title {
  flex: 1;
  color: white;
}

.initiatives-ai-progress-title h3 {
  margin: 0 0 5px 0;
  font-size: 20px;
  font-weight: 600;
}

.initiatives-ai-progress-title p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.initiatives-ai-progress-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.initiatives-ai-progress-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.initiatives-ai-progress-content {
  padding: 30px;
  color: white;
}

/* Progreso Principal */
.initiatives-progress-main {
  margin-bottom: 25px;
}

.initiatives-progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.initiatives-progress-bar-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
}

.initiatives-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 25px;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.initiatives-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: initiativesProgressShine 2s infinite;
}

@keyframes initiativesProgressShine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.initiatives-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.initiatives-ai-progress-percent {
  font-size: 18px;
  font-weight: bold;
  color: #4ecdc4;
}

.initiatives-ai-progress-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

/* Estadísticas de Tokens */
.initiatives-ai-token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.initiatives-token-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.initiatives-token-stat-icon {
  font-size: 20px;
  width: 30px;
  text-align: center;
}

.initiatives-token-stat-content {
  flex: 1;
}

.initiatives-token-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.initiatives-token-stat-value {
  font-size: 14px;
  font-weight: bold;
  color: white;
}

/* Progreso Detallado */
.initiatives-ai-progress-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.initiatives-progress-step {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.initiatives-progress-step.active {
  background: rgba(78, 205, 196, 0.2);
  border-color: #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.initiatives-progress-step.completed {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.initiatives-step-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.initiatives-progress-step.active .initiatives-step-icon {
  background: #4ecdc4;
  color: white;
  animation: initiativesPulseRing 1.5s infinite;
}

.initiatives-progress-step.completed .initiatives-step-icon {
  background: #22c55e;
  color: white;
}

.initiatives-step-content {
  flex: 1;
}

.initiatives-step-title {
  font-size: 13px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.initiatives-step-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.initiatives-step-status {
  position: relative;
  width: 20px;
  height: 20px;
}

.initiatives-step-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: initiativesSpin 1s linear infinite;
}

.initiatives-progress-step.completed .initiatives-step-spinner {
  border: 2px solid #22c55e;
  border-top: 2px solid #22c55e;
  animation: none;
}

.initiatives-progress-step.completed .initiatives-step-spinner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

@keyframes initiativesSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Log de Actividad */
.initiatives-ai-activity-log {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.initiatives-activity-log-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 10px;
}

.initiatives-activity-log-content {
  color: #00ff00;
  font-size: 11px;
  line-height: 1.4;
}

.initiatives-log-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  align-items: flex-start;
}

.initiatives-log-time {
  color: #888;
  font-weight: bold;
  min-width: 35px;
}

.initiatives-log-message {
  color: #00ff00;
  flex: 1;
}

/* Responsive para modal de iniciativas */
@media (max-width: 768px) {
  .initiatives-ai-progress-modal {
    width: 95%;
    margin: 10px;
  }
  
  .initiatives-ai-progress-header {
    padding: 15px;
  }
  
  .initiatives-ai-progress-content {
    padding: 20px;
  }
  
  .initiatives-ai-token-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .initiatives-ai-progress-steps {
    grid-template-columns: 1fr;
  }
}

/* ===== MODAL DE PROGRESO DE IA PARA ORGANIGRAMAS ===== */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: overlayFadeIn 0.3s ease-out;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ai-progress-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
  max-width: 800px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  animation: modalSlideIn 0.5s ease-out;
  margin: 20px;
  z-index: 10000002 !important;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ai-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ai-progress-icon {
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-brain-animation {
  width: 50px;
  height: 50px;
  position: relative;
}

.brain-core {
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  border-radius: 50%;
  animation: brainPulse 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

.brain-pulse {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes brainPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes pulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.ai-progress-title {
  flex: 1;
  color: white;
}

.ai-progress-title h3 {
  margin: 0 0 5px 0;
  font-size: 24px;
  font-weight: 600;
}

.ai-progress-title p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

.ai-progress-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-progress-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.ai-progress-content {
  background: transparent;
  padding: 30px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
  color: white;
}

/* Progreso Principal */
.progress-main {
  margin-bottom: 30px;
}

.progress-bar-container {
  position: relative;
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 6px;
  width: 0%;
  transition: width 0.8s ease;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-weight: 600;
}

.ai-progress-percent {
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.ai-progress-status {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

/* Estadísticas de Tokens */
.ai-token-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.token-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s ease;
}

.token-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.token-stat-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 10px;
}

.token-stat-content {
  flex: 1;
}

.token-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
}

.token-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

/* Progreso Detallado */
.ai-progress-steps {
  margin-bottom: 30px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-step.active {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  opacity: 1;
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.progress-step.completed {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.4);
  opacity: 1;
}

.step-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  flex-shrink: 0;
}

.progress-step.active .step-icon {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.progress-step.completed .step-icon {
  background: rgba(34, 197, 94, 0.3);
}

.step-content {
  flex: 1;
}

.step-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: white;
}

.step-description {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.step-status {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-spinner {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  box-sizing: border-box;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.progress-step.completed .step-spinner {
  border: 2px solid rgba(34, 197, 94, 0.5);
  border-top: 2px solid #22c55e;
  animation: none;
}

.progress-step.completed .step-spinner::after {
  content: '✓';
  color: #22c55e;
  font-weight: bold;
  display: block;
  text-align: center;
  line-height: 1;
  font-size: 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Log de Actividad */
.ai-activity-log {
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
}

.activity-log-header {
  background: #2d2d2d;
  padding: 12px 20px;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-log-content {
  padding: 15px;
  max-height: 150px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.log-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  color: #e0e0e0;
}

.log-time {
  color: #00ff00;
  min-width: 40px;
}

.log-message {
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .ai-modal-overlay {
    padding: 10px;
  }
  
  .ai-progress-modal {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 15px;
  }
  
  .ai-progress-header {
    padding: 15px;
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .ai-progress-content {
    padding: 20px;
  }
  
  .ai-token-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .token-stat-card {
    padding: 15px;
  }
  
  .progress-step {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding: 12px;
  }
  
  .ai-activity-log {
    border-radius: 8px;
  }
  
  .activity-log-content {
    padding: 10px;
    max-height: 120px;
  }
}

/* Paginación */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.pagination-container button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive para operaciones */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .kanban-board {
    grid-template-columns: 1fr;
  }
  
  .orders-controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .order-info-grid {
    grid-template-columns: 1fr;
  }
  
  .costs-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

/* ===== MODAL DE PROGRESO DE IA PARA OBJETIVOS ===== */
.objectives-ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000001 !important;
  animation: objectivesOverlayFadeIn 0.3s ease-out;
}

@keyframes objectivesOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.objectives-ai-progress-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 10000002 !important;
  animation: objectivesModalSlideIn 0.4s ease-out;
}

@keyframes objectivesModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.objectives-ai-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.objectives-ai-progress-icon {
  margin-right: 15px;
  position: relative;
}

.objectives-ai-brain-animation {
  width: 50px;
  height: 50px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.objectives-brain-core {
  width: 30px;
  height: 30px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  border-radius: 50%;
  position: relative;
  z-index: 2;
  animation: objectivesBrainPulse 2s ease-in-out infinite;
}

.objectives-brain-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: rgba(255, 107, 107, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: objectivesPulseRing 2s ease-in-out infinite;
}

@keyframes objectivesBrainPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes objectivesPulseRing {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

.objectives-ai-progress-title {
  flex: 1;
  color: white;
}

.objectives-ai-progress-title h3 {
  margin: 0 0 5px 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.objectives-ai-progress-title p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.objectives-ai-progress-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.objectives-ai-progress-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.objectives-ai-progress-content {
  padding: 30px;
  color: white;
}

.objectives-progress-main {
  margin-bottom: 25px;
}

.objectives-progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.objectives-progress-bar-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
}

.objectives-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 25px;
  width: 0%;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.objectives-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: objectivesProgressShine 2s infinite;
}

@keyframes objectivesProgressShine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.objectives-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.objectives-ai-progress-percent {
  font-size: 18px;
  font-weight: bold;
  color: #4ecdc4;
}

.objectives-ai-progress-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.objectives-ai-token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.objectives-token-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.objectives-token-stat-icon {
  font-size: 20px;
  width: 30px;
  text-align: center;
}

.objectives-token-stat-content {
  flex: 1;
}

.objectives-token-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.objectives-token-stat-value {
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.objectives-ai-progress-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.objectives-progress-step {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.objectives-progress-step.active {
  background: rgba(78, 205, 196, 0.2);
  border-color: #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.objectives-progress-step.completed {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.objectives-step-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.objectives-progress-step.active .objectives-step-icon {
  background: #4ecdc4;
  color: white;
  animation: objectivesPulseRing 1.5s infinite;
}

.objectives-progress-step.completed .objectives-step-icon {
  background: #22c55e;
  color: white;
}

.objectives-step-content {
  flex: 1;
}

.objectives-step-title {
  font-size: 13px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.objectives-step-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.objectives-step-status {
  margin-left: 15px;
}

.objectives-step-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: objectivesSpin 1s linear infinite;
}

.objectives-progress-step.completed .objectives-step-spinner {
  border: 2px solid #22c55e;
  border-top: 2px solid #22c55e;
  animation: none;
}

.objectives-progress-step.completed .objectives-step-spinner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

@keyframes objectivesSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.objectives-ai-activity-log {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.objectives-activity-log-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: bold;
}

.objectives-ai-activity-log-content {
  color: #00ff00;
  font-size: 11px;
  line-height: 1.4;
  padding: 15px;
  max-height: 200px;
  overflow-y: auto;
}

.objectives-log-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  align-items: flex-start;
}

.objectives-log-time {
  color: #888;
  font-weight: bold;
  min-width: 35px;
}

.objectives-log-message {
  color: #00ff00;
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .objectives-ai-progress-modal {
    width: 95%;
    max-height: 90vh;
  }
  
  .objectives-ai-progress-header {
    padding: 15px;
  }
  
  .objectives-ai-progress-content {
    padding: 20px;
  }
  
  .objectives-ai-token-stats {
    grid-template-columns: 1fr;
  }
  
  .objectives-progress-step {
    padding: 12px;
  }
  
  .objectives-step-icon {
    width: 35px;
    height: 35px;
    margin-right: 12px;
  }
}

/* ===== MODAL DE PROGRESO DE IA PARA PROYECTOS ===== */
.projects-ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000001 !important;
  animation: projectsOverlayFadeIn 0.3s ease-out;
}

@keyframes projectsOverlayFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

.projects-ai-progress-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 10000002 !important;
  animation: projectsModalSlideIn 0.4s ease-out;
}

@keyframes projectsModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.projects-ai-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.projects-ai-progress-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.projects-ai-brain-animation {
  position: relative;
  width: 40px;
  height: 40px;
}

.projects-brain-core {
  width: 40px;
  height: 40px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 50%;
  position: relative;
  animation: projectsBrainPulse 2s ease-in-out infinite;
}

.projects-brain-pulse {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: projectsPulseRing 2s ease-out infinite;
}

@keyframes projectsBrainPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(78, 205, 196, 0);
  }
}

@keyframes projectsPulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.projects-ai-progress-title {
  flex: 1;
  color: white;
}

.projects-ai-progress-title h3 {
  margin: 0 0 5px 0;
  font-size: 20px;
  font-weight: 600;
}

.projects-ai-progress-title p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.projects-ai-progress-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.projects-ai-progress-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.projects-ai-progress-content {
  padding: 30px;
  color: white;
}

.projects-progress-main {
  margin-bottom: 25px;
}

.projects-progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.projects-progress-bar-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
}

.projects-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 25px;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.projects-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: projectsProgressShine 2s infinite;
}

@keyframes projectsProgressShine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.projects-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.projects-ai-progress-percent {
  font-size: 18px;
  font-weight: bold;
  color: #4ecdc4;
}

.projects-ai-progress-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.projects-ai-token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.projects-token-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.projects-token-stat-icon {
  font-size: 20px;
  width: 30px;
  text-align: center;
}

.projects-token-stat-content {
  flex: 1;
}

.projects-token-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.projects-token-stat-value {
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.projects-ai-progress-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.projects-progress-step {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.projects-progress-step.active {
  background: rgba(78, 205, 196, 0.2);
  border-color: #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.projects-progress-step.completed {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.projects-step-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.projects-progress-step.active .projects-step-icon {
  background: #4ecdc4;
  color: white;
  animation: projectsPulseRing 1.5s infinite;
}

.projects-progress-step.completed .projects-step-icon {
  background: #22c55e;
  color: white;
}

.projects-step-content {
  flex: 1;
}

.projects-step-title {
  font-size: 13px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.projects-step-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.projects-step-status {
  position: relative;
  width: 20px;
  height: 20px;
}

.projects-step-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: projectsSpin 1s linear infinite;
}

.projects-progress-step.completed .projects-step-spinner {
  border: 2px solid #22c55e;
  border-top: 2px solid #22c55e;
  animation: none;
}

.projects-progress-step.completed .projects-step-spinner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

@keyframes projectsSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.projects-ai-activity-log {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.projects-activity-log-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 10px;
}

.projects-activity-log-content {
  color: #00ff00;
  font-size: 11px;
  line-height: 1.4;
}

.projects-log-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  align-items: flex-start;
}

.projects-log-time {
  color: #888;
  font-weight: bold;
  min-width: 35px;
}

.projects-log-message {
  color: #00ff00;
  flex: 1;
}

/* Responsive para proyectos */
@media (max-width: 768px) {
  .projects-ai-progress-modal {
    width: 95%;
    margin: 10px;
  }
  
  .projects-ai-progress-header {
    padding: 15px;
  }
  
  .projects-ai-progress-content {
    padding: 20px;
  }
  
  .projects-ai-token-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .projects-ai-progress-steps {
    grid-template-columns: 1fr;
  }
}

/* ===== MODAL DE PROGRESO DE IA PARA PLAYBOOKS ===== */
.playbooks-ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000001 !important;
  animation: playbooksOverlayFadeIn 0.3s ease-out;
}

@keyframes playbooksOverlayFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

.playbooks-ai-progress-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  z-index: 10000002 !important;
  animation: playbooksModalSlideIn 0.4s ease-out;
}

@keyframes playbooksModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.playbooks-ai-progress-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.playbooks-ai-progress-icon {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.playbooks-ai-brain-animation {
  position: relative;
  width: 40px;
  height: 40px;
}

.playbooks-brain-core {
  width: 40px;
  height: 40px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 50%;
  position: relative;
  animation: playbooksBrainPulse 2s ease-in-out infinite;
}

.playbooks-brain-pulse {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: playbooksPulseRing 2s ease-out infinite;
}

@keyframes playbooksBrainPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(78, 205, 196, 0);
  }
}

@keyframes playbooksPulseRing {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.playbooks-ai-progress-title {
  flex: 1;
  color: white;
}

.playbooks-ai-progress-title h3 {
  margin: 0 0 5px 0;
  font-size: 20px;
  font-weight: 600;
}

.playbooks-ai-progress-title p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.playbooks-ai-progress-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.playbooks-ai-progress-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.playbooks-ai-progress-content {
  padding: 30px;
  color: white;
}

.playbooks-progress-main {
  margin-bottom: 25px;
}

.playbooks-progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.playbooks-progress-bar-bg {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
}

.playbooks-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 25px;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

.playbooks-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: playbooksProgressShine 2s infinite;
}

@keyframes playbooksProgressShine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.playbooks-progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.playbooks-ai-progress-percent {
  font-size: 18px;
  font-weight: bold;
  color: #4ecdc4;
}

.playbooks-ai-progress-status {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.playbooks-ai-token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.playbooks-token-stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.playbooks-token-stat-icon {
  font-size: 20px;
  width: 30px;
  text-align: center;
}

.playbooks-token-stat-content {
  flex: 1;
}

.playbooks-token-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}

.playbooks-token-stat-value {
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.playbooks-ai-progress-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.playbooks-progress-step {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.playbooks-progress-step.active {
  background: rgba(78, 205, 196, 0.2);
  border-color: #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.playbooks-progress-step.completed {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.playbooks-step-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.playbooks-progress-step.active .playbooks-step-icon {
  background: #4ecdc4;
  color: white;
  animation: playbooksPulseRing 1.5s infinite;
}

.playbooks-progress-step.completed .playbooks-step-icon {
  background: #22c55e;
  color: white;
}

.playbooks-step-content {
  flex: 1;
}

.playbooks-step-title {
  font-size: 13px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.playbooks-step-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.playbooks-step-status {
  position: relative;
  width: 20px;
  height: 20px;
}

.playbooks-step-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #4ecdc4;
  border-radius: 50%;
  animation: playbooksSpin 1s linear infinite;
}

.playbooks-progress-step.completed .playbooks-step-spinner {
  border: 2px solid #22c55e;
  border-top: 2px solid #22c55e;
  animation: none;
}

.playbooks-progress-step.completed .playbooks-step-spinner::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

@keyframes playbooksSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.playbooks-ai-activity-log {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.playbooks-activity-log-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 10px;
  gap: 8px;
}

.playbooks-activity-log-content {
  color: #00ff00;
  font-size: 11px;
  line-height: 1.4;
}

.playbooks-log-entry {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  align-items: flex-start;
}

.playbooks-log-time {
  color: #888;
  font-weight: bold;
  min-width: 35px;
}

.playbooks-log-message {
  color: #00ff00;
  flex: 1;
}

/* Responsive para playbooks */
@media (max-width: 768px) {
  .playbooks-ai-progress-modal {
    width: 95%;
    margin: 10px;
  }
  
  .playbooks-ai-progress-header {
    padding: 15px;
  }
  
  .playbooks-ai-progress-content {
    padding: 20px;
  }
  
  .playbooks-ai-token-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .playbooks-ai-progress-steps {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   WAIFLOW COMPONENTS
   ============================================ */

/* Selector de Waiflow */
.waiflow-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 16px 0;
}

.waiflow-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
}

.waiflow-selector-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.waiflow-selector-clear {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.waiflow-selector-clear:hover {
  background: #e5e7eb;
  color: #374151;
}

/* Badge de Waiflow */
.waiflow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.waiflow-badge-active {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

/* Estadísticas del waiflow en el selector */
.waiflow-stats {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 11px;
}

.waiflow-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #4b5563;
  white-space: nowrap;
}

.waiflow-stat-item i {
  font-size: 10px;
  opacity: 0.7;
  color: #6b7280;
}

.waiflow-stat-item span {
  font-weight: 600;
  min-width: 12px;
  text-align: center;
  color: #1f2937;
}

/* Contenedor del nombre del organigrama */
.org-title-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.org-name-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.org-name-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

/* Checkbox inline de vinculación */
.waiflow-link-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.waiflow-link-checkbox-inline:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.waiflow-link-checkbox-inline input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.waiflow-link-checkbox-inline input[type="checkbox"]:checked + .waiflow-link-checkbox-label-inline {
  color: #10b981;
}

.waiflow-link-checkbox-label-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #4b5563;
}

.waiflow-link-checkbox-label-inline i {
  font-size: 0.875rem;
}

.waiflow-link-checkbox-text-inline {
  font-weight: 500;
}

/* Checkbox de vinculación */
.waiflow-link-checkbox-container {
  margin: 16px 0;
}

.waiflow-link-checkbox {
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #93c5fd;
  border-radius: 8px;
  margin: 0;
  transition: all 0.2s ease;
}

.waiflow-link-checkbox:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.waiflow-link-checkbox label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #1e40af;
  font-weight: 500;
  margin: 0;
}

.waiflow-link-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

.waiflow-link-checkbox label span {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.waiflow-link-checkbox label i {
  color: #3b82f6;
  font-size: 1rem;
}

.waiflow-link-checkbox label strong {
  color: #1e3a8a;
  font-weight: 600;
}

/* Filtro de Waiflow */
.waiflow-filter {
  padding: 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.waiflow-filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

/* Diagrama de Waiflow */
.waiflow-diagram-container {
  background: #fff;
  border-radius: 12px;
  padding: 12px 8px; /* Padding superior e inferior mínimo, lateral mínimo para botones */
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden; /* Hidden para que el carrusel no se salga */
  position: relative;
}

.waiflow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px; /* Reducido al mínimo */
  margin-top: 12px; /* Margen superior mínimo para el indicador */
  padding: 0 12px; /* Padding lateral reducido */
  padding-bottom: 6px; /* Reducido al mínimo */
  border-bottom: 2px solid #e5e7eb;
}

.waiflow-header-info h3 {
  margin: 0 0 4px 0;
  font-size: 1.25rem;
  color: #1f2937;
}

.waiflow-header-info p {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.waiflow-progress-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.waiflow-progress-bar {
  width: 200px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.waiflow-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s ease;
}

.waiflow-progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.waiflow-carousel-wrapper {
  position: relative;
  width: 100%;
  padding-top: 0;
  margin-top: 0;
  margin-bottom: 0; /* Sin margen inferior, el padding del contenedor lo maneja */
  overflow: visible; /* Cambiar a visible para que el indicador no se corte */
}

.waiflow-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.waiflow-carousel-btn:hover {
  background: #f9fafb;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.waiflow-carousel-btn-left {
  left: 4px; /* Movido un poco más hacia adentro */
}

.waiflow-carousel-btn-right {
  right: 4px; /* Movido un poco más hacia adentro */
}

.waiflow-carousel-btn i {
  color: #6b7280;
  font-size: 1rem;
}

.waiflow-carousel-btn:hover i {
  color: #3b82f6;
}

.waiflow-steps-container.waiflow-carousel {
  display: flex;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
  overflow-y: visible; /* Cambiar a visible para que el indicador no se corte */
  padding: 16px 40px;
  padding-top: 60px; /* Espacio suficiente arriba para el indicador (reducido) */
  min-height: 200px; /* Altura mínima reducida */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 40px, black calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 40px, black calc(100% - 40px), transparent 100%);
}

.waiflow-steps-container::-webkit-scrollbar {
  height: 8px;
}

.waiflow-steps-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.waiflow-steps-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.waiflow-steps-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.waiflow-step-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
}

.waiflow-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 280px;
  min-width: 280px;
  position: relative; /* Importante para posicionar el indicador relativo al step */
  flex-shrink: 0;
}

.waiflow-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.waiflow-step.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.waiflow-step-completed {
  border-color: #10b981;
  background: #f0fdf4;
}

.waiflow-step-pending {
  border-color: #e5e7eb;
  background: #f9fafb;
  opacity: 0.7;
}

/* Asegurar que waiflow-step-active NO tenga estilos azules por defecto */
.waiflow-step-active {
  /* Sin estilos especiales - solo se aplicará azul si también tiene .active */
  border-color: #e5e7eb;
  background: #f9fafb;
}

/* Solo aplicar azul si tiene AMBAS clases: active Y es el paso actual */
.waiflow-step.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

/* Si tiene waiflow-step-active pero NO tiene active, no debe ser azul */
.waiflow-step-active:not(.active) {
  border-color: #e5e7eb;
  background: #f9fafb;
}

.waiflow-step-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 8px;
  font-size: 1.25rem;
  color: #6b7280;
  flex-shrink: 0;
}

.waiflow-step.active .waiflow-step-icon {
  background: #3b82f6;
  color: #fff;
}

.waiflow-step-completed .waiflow-step-icon {
  background: #10b981;
  color: #fff;
}

.waiflow-step-content {
  flex: 1;
}

.waiflow-step-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.waiflow-step-desc {
  font-size: 0.875rem;
  color: #6b7280;
}

.waiflow-step-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.875rem;
  color: #f59e0b;
}

.waiflow-step {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: 120px;
  position: relative; /* Importante para posicionar el indicador relativo al step */
}

.waiflow-step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.waiflow-step-check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #10b981;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  position: absolute;
  top: 8px;
  right: 8px;
}

.waiflow-step-warning-icon {
  position: absolute;
  top: 8px;
  right: 36px;
  width: 24px;
  height: 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 0.75rem;
}

.waiflow-step-details-toggle {
  margin-top: 12px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.waiflow-step-details-toggle:hover {
  background: #e5e7eb;
  color: #374151;
}

.waiflow-step-details-toggle i {
  transition: transform 0.2s ease;
}

.waiflow-step-details {
  margin-top: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.waiflow-step-details::-webkit-scrollbar {
  width: 6px;
}

.waiflow-step-details::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.waiflow-step-details::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.waiflow-step-details::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.waiflow-step-details-content {
  font-size: 0.75rem;
  color: #4b5563;
  line-height: 1.6;
}

.waiflow-step-detail-section {
  margin-bottom: 16px;
}

.waiflow-step-detail-section:last-child {
  margin-bottom: 0;
}

.waiflow-step-detail-section strong {
  display: block;
  color: #111827;
  margin-bottom: 6px;
  font-size: 0.8125rem;
}

.waiflow-step-detail-section p {
  margin: 0;
  color: #6b7280;
}

.waiflow-step-warning-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.waiflow-step-warning-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 4px;
  font-size: 0.6875rem;
}

.waiflow-step-warning-item span:first-child {
  flex-shrink: 0;
}

.waiflow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 1.25rem;
  width: 32px;
  min-width: 32px;
  flex-shrink: 0;
}

.waiflow-arrow.completed {
  color: #10b981;
}

.waiflow-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
}

/* Modo compacto */
.waiflow-compact {
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.waiflow-compact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.waiflow-compact .waiflow-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.875rem;
}

.waiflow-compact .waiflow-progress {
  font-weight: 600;
  color: #3b82f6;
  font-size: 0.875rem;
}

.waiflow-compact .waiflow-progress-bar {
  width: 100%;
  height: 6px;
}

.waiflow-error {
  padding: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  text-align: center;
}

/* Indicador visual del paso actual */
.waiflow-current-indicator {
  position: absolute;
  top: -52px; /* Ajustado para que quede justo arriba del step */
  left: 50%; /* Centrado horizontalmente */
  transform: translateX(-50%); /* Centrar perfectamente */
  display: flex;
  flex-direction: column-reverse; /* Invertir orden: label arriba, flecha abajo apuntando al step */
  align-items: center;
  gap: 4px;
  z-index: 15; /* Aumentar z-index para asegurar que esté por encima */
  pointer-events: none;
  animation: waiflowPulse 2s ease-in-out infinite;
  width: auto; /* Asegurar que no tenga ancho fijo que cause desfase */
}

.waiflow-current-arrow {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  animation: waiflowBounce 1.5s ease-in-out infinite;
}

.waiflow-current-arrow i {
  color: #fff;
  font-size: 1.5rem;
  animation: waiflowArrowPulse 1s ease-in-out infinite;
}

.waiflow-current-label {
  background: #1f2937;
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.waiflow-step-current {
  border-color: #3b82f6 !important;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2) !important;
  transform: scale(1.02);
}

.waiflow-step-current .waiflow-step-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

@keyframes waiflowPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes waiflowBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes waiflowArrowPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}