/*
  Estilos centralizados para todos los modales - Memosoft
  Archivo: modal.css
  Objetivo: Unificar todos los estilos de modales en un solo archivo
*/

/* ===== MODAL OVERLAY BASE ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== MODAL OVERLAY CONTAINER (2 COLUMNAS) ===== */
.modal-overlay-container {
  display: flex;
  justify-content: center;
  max-width: 1100px;
  align-items: center;
}

/* ===== MODAL CONTENT ===== */
.modal-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 0;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* ===== MODAL HEADER ===== */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.modal-content-with-sidebar .modal-header {
  padding-left: 20px;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--subtle);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

/* ===== MODAL BODY ===== */
.modal-body {
  flex: 1;
  overflow-y: auto;
}

/* ===== MODAL FORM ===== */
.modal-form {
  padding: 20px;
}

/* ===== MODAL FOOTER ===== */
.modal-footer {
  display: flex;
  gap: 20px;
  align-items: stretch;
  flex-shrink: 0;
  background: var(--surface);
}

/* ===== PESTAÑA DETALLES ===== */
.ta-task-details,
.ta-ticket-details {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ta-detail-section {
  background: var(--surface);
  padding: 0px 0px 0px 20px;
  border-left: 4px solid var(--border);
}

/* Títulos de sección */
.ta-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

/* Sección de contexto del ticket (para vista de tarea) */
.ta-detail-ticket-context {
  border-left-color: #888;
}

/* Sección de detalles de tarea */
.ta-detail-task-info {
  border-left-color: #888;
}

/* Sección principal del ticket (para vista de ticket) */
.ta-detail-ticket-main {
  border-left-color: #888;
}

/* Sección de cada tarea en vista de ticket */
.ta-detail-task-item {
  border-left-color: #666;
  margin-top: 16px;
}

/* Fila de ancho completo */
.ta-full-width {
  grid-column: 1 / -1;
}

.ta-detail-row {
  margin-bottom: 16px;
}

.ta-detail-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-detail-value {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  display: block;
  line-height: 1.5;
  padding: 8px 12px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== SECCIÓN PRINCIPAL (ANCHO COMPLETO) ===== */
.ta-detail-main .ta-detail-row {
  margin-bottom: 16px;
}

.ta-detail-main .ta-detail-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-detail-main .ta-detail-value {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  display: block;
  line-height: 1.5;
  padding: 8px 12px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== GRID DE 2 COLUMNAS ===== */
.ta-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== SECCIÓN SECUNDARIA (2 COLUMNAS) ===== */
.ta-detail-secondary .ta-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ta-detail-secondary .ta-detail-row {
  margin-bottom: 0;
  /* Sin margen porque el grid maneja el espaciado */
}

.ta-detail-secondary .ta-detail-label {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-detail-secondary .ta-detail-value {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  display: block;
  line-height: 1.4;
  padding: 6px 10px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== PESTAÑA HISTORIAL ===== */
.ta-history-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ta-history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ta-history-stats .ta-stat-item {
  text-align: center;
  padding: 8px;
  background: var(--input-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ta-history-stats .ta-stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.ta-history-stats .ta-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px;
  max-height: none;
}

.ta-history-list,
.ta-history-list * {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ta-history-item {
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.ta-history-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-weight: 600;
  color: white;
  position: relative;
}

.ta-history-item-header[data-type="inicio"] {
  background: #FF6600;
  color: white;
}

.ta-history-item-header[data-type="actualizacion"],
.ta-history-item-header[data-type="actualizar"] {
  background: #2196F3;
  color: white;
}

.ta-history-item-header[data-type="transferencia"],
.ta-history-item-header[data-type="transferir"] {
  background: #2196F3;
  color: white;
}

.ta-history-item-header[data-type="completado"],
.ta-history-item-header[data-type="completar"] {
  background: #4CAF50;
  color: white;
}

.ta-history-item-header[data-type="anular"],
.ta-history-item-header[data-type="anulada"] {
  background: #6c757d;
  color: white;
}

.ta-history-item-header[data-type="reactivada"],
.ta-history-item-header[data-type="reactivar"] {
  background: #FF9800;
  color: white;
}

.ta-history-item-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-history-item-type svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ta-history-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  margin-top: 12px;
}

.ta-history-item-header[data-type="inicio"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #FF6600;
  background: rgb(255 102 0 / 10%);
}

.ta-history-item-header[data-type="actualizacion"]+.ta-history-item-content .ta-history-info,
.ta-history-item-header[data-type="actualizar"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #2196F3;
  background: rgb(33 150 243 / 10%);
}

.ta-history-item-header[data-type="transferencia"]+.ta-history-item-content .ta-history-info,
.ta-history-item-header[data-type="transferir"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #2196F3;
  background: rgb(33 150 243 / 10%);
}

.ta-history-item-header[data-type="completado"]+.ta-history-item-content .ta-history-info,
.ta-history-item-header[data-type="completar"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #4CAF50;
  background: rgb(76 175 80 / 10%);
}

.ta-history-item-header[data-type="anular"]+.ta-history-item-content .ta-history-info,
.ta-history-item-header[data-type="anulada"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #6c757d;
  background: rgb(108 117 125 / 10%);
}

.ta-history-item-header[data-type="reactivada"]+.ta-history-item-content .ta-history-info,
.ta-history-item-header[data-type="reactivar"]+.ta-history-item-content .ta-history-info {
  border-left: 3px solid #FF9800;
  background: rgb(255 152 0 / 10%);
}

.ta-history-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.ta-history-info-item strong {
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
}

.ta-history-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ta-history-item-header[data-type="inicio"]+.ta-history-item-content .ta-history-icon {
  color: #FF6600;
}

.ta-history-item-header[data-type="actualizacion"]+.ta-history-item-content .ta-history-icon,
.ta-history-item-header[data-type="actualizar"]+.ta-history-item-content .ta-history-icon {
  color: #2196F3;
}

.ta-history-item-header[data-type="transferencia"]+.ta-history-item-content .ta-history-icon,
.ta-history-item-header[data-type="transferir"]+.ta-history-item-content .ta-history-icon {
  color: #2196F3;
}

.ta-history-item-header[data-type="completado"]+.ta-history-item-content .ta-history-icon,
.ta-history-item-header[data-type="completar"]+.ta-history-item-content .ta-history-icon {
  color: #4CAF50;
}

.ta-history-item-header[data-type="anular"]+.ta-history-item-content .ta-history-icon,
.ta-history-item-header[data-type="anulada"]+.ta-history-item-content .ta-history-icon {
  color: #6c757d;
}

.ta-history-item-header[data-type="reactivada"]+.ta-history-item-content .ta-history-icon,
.ta-history-item-header[data-type="reactivar"]+.ta-history-item-content .ta-history-icon {
  color: #FF9800;
}

.ta-history-separator {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.ta-history-item-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  margin-left: auto;
}

.ta-history-item-comment {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  position: relative;
}

.ta-history-item-comment .ta-history-icon {
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Responsive para detalles */
@media (max-width: 768px) {
  .ta-task-details {
    gap: 16px;
  }

  .ta-detail-section {
    padding: 16px;
  }

  /* En móviles, la sección secundaria vuelve a una columna */
  .ta-detail-secondary .ta-detail-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ta-detail-secondary .ta-detail-row {
    margin-bottom: 12px;
  }

  .ta-history-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== PESTAÑA TIMELINE ===== */
.ta-timeline-icon[data-type="inicio"] {
  background: #4CAF50;
  color: white;
}

.ta-timeline-icon[data-type="actualizacion"] {
  background: #2196F3;
  color: white;
}

.ta-timeline-icon[data-type="transferencia"] {
  background: #2196F3;
  color: white;
}

.ta-timeline-icon[data-type="completado"] {
  background: #4CAF50;
  color: white;
}

.ta-timeline-icon[data-type="anulado"] {
  background: #6c757d;
  color: white;
}

.ta-timeline-icon[data-type="anular"] {
  background: #6c757d;
  color: white;
}

.ta-timeline-icon[data-type="reactivada"] {
  background: #FF9800;
  color: white;
}

.ta-timeline-type[data-type="inicio"] {
  color: #4CAF50;
}

.ta-timeline-type[data-type="actualizacion"] {
  color: #2196F3;
}

.ta-timeline-type[data-type="transferencia"] {
  color: #2196F3;
}

.ta-timeline-type[data-type="completado"] {
  color: #4CAF50;
}

.ta-timeline-type[data-type="anulado"] {
  color: #6c757d;
}

.ta-timeline-type[data-type="anular"] {
  color: #6c757d;
}

.ta-timeline-type[data-type="reactivada"] {
  color: #FF9800;
}

.ta-timeline-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  padding: 20px 0;
}

.ta-timeline-container::before {
  content: '';
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  z-index: 1;
}

.ta-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
  max-height: 400px;
}

.ta-timeline-item {
  position: relative;
  margin-bottom: 24px;
  padding-left: 50px;
  z-index: 2;
}

.ta-timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 8px;
  width: 20px;
  height: 2px;
  background: var(--border);
  z-index: 1;
}

.ta-timeline-icon {
  position: absolute;
  left: -30px;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ta-timeline-content {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.ta-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 600;
  color: white;
  position: relative;
}

.ta-timeline-header[data-type="inicio"] {
  background: #4CAF50;
  color: white;
}

.ta-timeline-header[data-type="actualizacion"] {
  background: #2196F3;
  color: white;
}

.ta-timeline-header[data-type="transferencia"] {
  background: #2196F3;
  color: white;
}

.ta-timeline-header[data-type="completado"] {
  background: #4CAF50;
  color: white;
}

.ta-timeline-header[data-type="anulado"] {
  background: #6c757d;
  color: white;
}

.ta-timeline-header[data-type="anular"] {
  background: #6c757d;
  color: white;
}

.ta-timeline-header[data-type="reactivada"] {
  background: #FF9800;
  color: white;
}

.ta-timeline-type {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-timeline-time {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 500;
}

.ta-timeline-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  position: relative;
  padding-left: 20px;
}

.ta-timeline-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
}

.ta-timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.ta-timeline-user {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Cuando NO hay ta-timeline-assigned, ta-timeline-user debe tener negrita y color */
.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user {
  font-weight: 600;
  color: var(--text);
}

/* Colores del usuario cuando NO hay ta-timeline-assigned */
.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user[data-type="actualizacion"] {
  color: #2196F3;
}

.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user[data-type="completado"] {
  color: #4CAF50;
}

.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user[data-type="anulado"] {
  color: #6c757d;
}

.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user[data-type="anular"] {
  color: #6c757d;
}

.ta-timeline-item:not(:has(.ta-timeline-assigned)) .ta-timeline-user[data-type="reactivada"] {
  color: #FF9800;
}

.ta-timeline-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.ta-timeline-header .ta-timeline-time {
  color: rgba(255, 255, 255, 0.9);
}

.ta-timeline-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}

.ta-timeline-assigned,
.ta-timeline-deadline,
.ta-timeline-comment {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ta-timeline-assigned {
  font-weight: 500;
}

.ta-timeline-assigned[data-type="inicio"] {
  color: #4CAF50;
}

.ta-timeline-assigned[data-type="actualizacion"] {
  color: #2196F3;
}

.ta-timeline-assigned[data-type="transferencia"] {
  color: #2196F3;
}

.ta-timeline-assigned[data-type="completado"] {
  color: #4CAF50;
}

.ta-timeline-assigned[data-type="anulado"] {
  color: #6c757d;
}

.ta-timeline-assigned[data-type="anular"] {
  color: #6c757d;
}

.ta-timeline-assigned[data-type="reactivada"] {
  color: #FF9800;
}

.ta-timeline-details {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

/* ===== PESTAÑA ADJUNTOS ===== */
.ta-attachments-container {
  height: 100%;
  overflow-y: auto;
}

.ta-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ta-attachments-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--subtle);
}

.ta-attachments-empty svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.ta-attachments-empty p {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.ta-attachment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.ta-attachment-card:hover {
  background: var(--task-hover);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ta-attachment-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}

.ta-attachment-info {
  flex: 1;
  min-width: 0;
}

.ta-attachment-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ta-attachment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--subtle);
  flex-wrap: wrap;
}

.ta-attachment-user {
  font-weight: 500;
}

.ta-attachment-separator {
  opacity: 0.5;
}

.ta-attachment-time,
.ta-attachment-type {
  color: var(--subtle);
}

.ta-attachment-comment {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--input-bg);
  border-left: 3px solid var(--brand);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.ta-attachment-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.ta-attachment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  border-radius: 8px;
  color: var(--brand);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ta-attachment-btn:hover {
  background: var(--brand);
  color: white;
  transform: scale(1.05);
}

.ta-attachment-btn:active {
  transform: scale(0.95);
}

/* ===== PESTAÑA ESTADÍSTICAS ===== */
.ta-stats-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
  overflow: hidden;
}

.ta-stats-section-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-stats-section-title:first-child {
  margin-top: 0;
}

.ta-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.ta-stat-item-full {
  grid-column: 1 / -1;
}

.ta-stat-item {
  margin-bottom: 0;
}

.ta-stat-item:nth-child(1) .ta-stat-label,
.ta-stat-item:nth-child(2) .ta-stat-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-stat-item:nth-child(1) .ta-stat-value,
.ta-stat-item:nth-child(2) .ta-stat-value {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  display: block;
  line-height: 1.5;
  padding: 8px 12px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Estilos destacados para Tiempo Total, Tiempo Computable, Cambios y Comentarios */
.ta-stat-item:nth-child(3),
.ta-stat-item:nth-child(4),
.ta-stat-item:nth-child(5),
.ta-stat-item:nth-child(6) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s ease;
}

.ta-stat-item:nth-child(3):hover,
.ta-stat-item:nth-child(4):hover,
.ta-stat-item:nth-child(5):hover,
.ta-stat-item:nth-child(6):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ta-stat-item:nth-child(3) .ta-stat-label,
.ta-stat-item:nth-child(4) .ta-stat-label,
.ta-stat-item:nth-child(5) .ta-stat-label,
.ta-stat-item:nth-child(6) .ta-stat-label {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: block;
}

.ta-stat-item:nth-child(3) .ta-stat-value,
.ta-stat-item:nth-child(4) .ta-stat-value,
.ta-stat-item:nth-child(5) .ta-stat-value,
.ta-stat-item:nth-child(6) .ta-stat-value {
  font-weight: 700;
  font-size: 28px;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
  background: none;
  border: none;
  padding: 0;
}

/* Estilos para el campo de cumplimiento */
.ta-cumplimiento-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ta-cumplimiento-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--input-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.ta-cumplimiento-vencimiento {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

/* Indicador de días */
.ta-cumplimiento-dias {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Colores según cumplimiento */
.ta-cumplimiento-dias.en-termino {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.ta-cumplimiento-dias.fuera-termino {
  background: rgba(244, 67, 54, 0.15);
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.ta-cumplimiento-dias.sin-diferencia {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text);
  border: 1px solid var(--border);
}

.ta-stats-overview h3,
.ta-stats-breakdown h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

.ta-time-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ta-time-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.ta-time-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ta-time-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ta-time-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.ta-activity-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.ta-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.ta-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ta-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.ta-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ta-progress-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
}

.ta-progress-item {
  margin-bottom: 16px;
}

.ta-progress-item:last-child {
  margin-bottom: 0;
}

.ta-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.ta-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--input-bg);
  border-radius: 4px;
  overflow: hidden;
}

.ta-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #2196F3);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.ta-progress-percentage {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.ta-chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
  text-align: center;
}

.ta-chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  background: var(--input-bg);
  border: 2px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

/* Responsive para estadísticas */
@media (max-width: 768px) {
  .ta-stats-container {
    padding: 16px;
  }

  .ta-stats-grid {
    grid-template-columns: 1fr;
  }

  .ta-time-summary {
    grid-template-columns: 1fr;
  }

  .ta-activity-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  flex: 1;
  height: 48px;
  padding: 0 24px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1;
  vertical-align: top;
}

.modal-footer .btn-primary {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
}

.modal-footer .btn-secondary {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-footer .btn-primary:hover {
  background: color-mix(in srgb, var(--brand) 90%, black);
  transform: translateY(-1px);
}

.modal-footer .btn-secondary:hover {
  background: color-mix(in srgb, var(--text) 15%, transparent);
  transform: translateY(-1px);
}

.modal-footer .btn-primary:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.modal-footer .btn-secondary:focus {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ===== FORMULARIOS DE MODALES ===== */
.register-form,
.contact-form,
.update-ticket-form,
.transfer-ticket-form,
.complete-ticket-form,
.anular-ticket-form,
.reactivate-ticket-form,
.update-task-form,
.transfer-task-form,
.complete-task-form,
.anular-task-form,
.reactivate-task-form {
  padding: 0 24px 24px 24px;
}

.register-form .field,
.contact-form .field,
.update-ticket-form .field,
.transfer-ticket-form .field,
.complete-ticket-form .field,
.anular-ticket-form .field,
.reactivate-ticket-form .field,
.update-task-form .field,
.transfer-task-form .field,
.complete-task-form .field,
.anular-task-form .field,
.reactivate-task-form .field {
  margin-bottom: 20px;
}

/* ===== FORMULARIO DE USUARIOS ===== */
.modal-form .form-group {
  margin-bottom: 20px;
}

.modal-form .form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-form .form-group input,
.modal-form .form-group select,
.modal-form .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--input-bg, #2a2a2a);
  border: 1px solid var(--input-border, #404040);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.modal-form .form-group input::placeholder,
.modal-form .form-group textarea::placeholder {
  color: var(--text-muted, #888);
}

.modal-form .form-group input:focus,
.modal-form .form-group select:focus,
.modal-form .form-group textarea:focus {
  border-color: var(--brand, #ff6600);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.modal-form .form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  appearance: none;
}

.modal-form .form-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}


/* ===== CONTENEDORES DE FECHA Y HORA ===== */
.fm-datetime-row {
  display: flex;
  gap: 16px;
}

.fm-datetime-group {
  flex: 1;
}

.fm-datetime-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fm-datetime-container .fm-date-input,
.fm-datetime-container .fm-time-input {
  flex: 1;
}

/* ===== CONTENEDORES DE TIEMPO (REAL Y FACTURABLE) ===== */
.fm-tiempo-contacto-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.fm-tiempo-section {
  flex: 1;
}

.fm-contacto-section {
  flex: 1;
}

.fm-tiempo-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.fm-tiempo-labels label {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}

.fm-tiempo-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.fm-tiempo-readonly,
.fm-tiempo-facturable {
  flex: 1;
  text-align: center;
}

.fm-tiempo-readonly {
  background-color: var(--input-disabled-bg);
  color: var(--text);
  cursor: not-allowed;
}

.fm-tiempo-facturable[readonly] {
  background-color: var(--input-disabled-bg);
  cursor: not-allowed;
}

.fm-tiempo-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fm-tiempo-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.fm-tiempo-checkbox label {
  margin: 0;
  font-size: 0.9em;
  white-space: nowrap;
  cursor: pointer;
  font-weight: normal;
}

/* ===== COMBOBOX EN MODALES ===== */
.fm-combobox-container {
  position: relative;
  width: 100%;
}

.fm-combobox-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fm-combobox-dropdown .combobox-option {
  padding: 12px 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.fm-combobox-dropdown .combobox-option:hover {
  background: var(--task-hover);
}

.fm-combobox-dropdown .combobox-option:last-child {
  border-bottom: none;
}

/* ===== CAMPOS DE ARCHIVO ===== */
.field input[type="file"] {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 160ms ease;
  cursor: pointer;
}

.field input[type="file"]:focus {
  border-color: var(--brand);
}

.field input[type="file"]::-webkit-file-upload-button {
  background: var(--brand);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 12px;
}

.field input[type="file"]::-webkit-file-upload-button:hover {
  background: color-mix(in srgb, var(--brand) 90%, black);
}

/* ===== TEXTAREA EN MODALES ===== */
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--input-text, var(--text));
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.field textarea::placeholder {
  color: var(--input-placeholder);
}

.field textarea:focus {
  border-color: var(--brand);
}

/* ===== CAMPOS NUMÉRICOS EN MODALES ===== */
.field input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--input-text, var(--text));
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input[type="number"]::placeholder {
  color: var(--input-placeholder);
}

.field input[type="number"]:focus {
  border-color: var(--brand);
}

/* ===== MODALES ESPECÍFICOS ===== */

/* Modal de confirmación de eliminación */
#deleteConfirmModal .modal-footer {
  padding: 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

#deleteConfirmModal .modal-footer .fm-btn-secondary {
  background: #6c757d;
  color: white;
  border: 1px solid #6c757d;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#deleteConfirmModal .modal-footer .fm-btn-secondary:hover {
  background: #5a6268;
  border-color: #5a6268;
}

/* Modal de detalles de tarea */
.ta-task-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  min-width: 100%;
  min-height: 100%;
}

.ta-task-details-modal.active {
  opacity: 1;
  visibility: visible;
}

.ta-task-details-modal .ta-modal-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 0;
  height: 90vh !important;
  max-height: 900px !important;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ta-task-details-modal.active .ta-modal-content {
  transform: scale(1) translateY(0);
}



.ta-task-details-modal .modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.ta-task-details-modal .modal-close {
  background: none;
  border: none;
  color: var(--subtle);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ta-task-details-modal .modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.ta-task-details-modal .modal-footer {
  display: flex;
  gap: 12px;
  padding: 24px;
  align-items: stretch;
  flex-shrink: 0;
}

.ta-task-details-modal .modal-footer .btn-primary,
.ta-task-details-modal .modal-footer .btn-secondary {
  flex: 1;
  height: 48px;
  padding: 0 24px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1;
  vertical-align: top;
  cursor: pointer;
  border: none;
  outline: none;
}

.ta-task-details-modal .modal-footer .btn-primary {
  background: var(--brand);
  color: #ffffff;
  border: none;
}

.ta-task-details-modal .modal-footer .btn-secondary {
  background: #808080;
  color: #ffffff;
  border: 1px solid #808080;
}

.ta-task-details-modal .modal-footer .btn-primary:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 8px 24px rgb(255 102 0 / 35%);
  filter: brightness(1.08);
}

.ta-task-details-modal .modal-footer .btn-secondary:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 8px 24px rgb(255 255 255 / 18%);
  border-color: #ffffff;
  filter: brightness(0.98);
}

.ta-task-details-modal .modal-footer .btn-primary:focus {
  background-color: #ffffff;
  color: var(--brand);
  outline: 1px solid var(--brand);
  outline-width: 2px;
  transform: scale(1.02);
  transition: all 0.3s ease-in;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.3);
  transform-origin: center center;
}

.ta-task-details-modal .modal-footer .btn-secondary:focus {
  background-color: white;
  color: #808080;
  outline: 1px solid #808080;
  outline-width: 2px;
  transform: scale(1.02);
  transition: all 0.3s ease-in;
  box-shadow: 0 8px 24px rgba(107, 114, 128, 0.3);
  transform-origin: center center;
}

/* Modal general con pestañas */
.ta-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.ta-modal-content {
  background-color: var(--bg-color);
  margin: 2% auto;
  padding: 0;
  border-radius: 12px;
  width: 552px;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.ta-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--brand);
  color: white;
}

.ta-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.ta-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.ta-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Modal footer específico para tareas */
.ta-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0px 20px 20px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-top: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .modal-header,
  .register-form,
  .contact-form,
  .update-ticket-form,
  .transfer-ticket-form,
  .complete-ticket-form,
  .anular-ticket-form,
  .reactivate-ticket-form,
  .update-task-form,
  .transfer-task-form,
  .complete-task-form,
  .anular-task-form,
  .reactivate-task-form {
    padding-left: 20px;
    padding-right: 20px;
  }

  .modal-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    height: 44px;
    font-size: 15px;
  }

  .ta-modal-close {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .ta-task-details-modal .ta-modal-content {
    width: 95vw !important;
    height: 95vh !important;
  }

  .ta-modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px auto;
  }

  .modal-footer {
    padding: 16px 20px;
    gap: 8px;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-secondary {
    height: 44px;
    font-size: 15px;
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .ta-task-details-modal .ta-modal-content {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
  }
}

/* ===== MODALES DE CALENDARIO ===== */

/* Modal de confirmación de eliminación de ICS */
#deleteICSModal {
  z-index: 10001;
  /* Mayor que todos los otros modales */
}

#deleteICSModal .modal-content {
  max-width: 600px;
  width: 95%;
  border: 2px solid #dc2626;
  box-shadow: 0 10px 25px rgba(220, 38, 38, 0.2);
}

.delete-confirmation-content {
  text-align: center;
  padding: var(--ca-spacing-lg);
}

.warning-icon {
  color: #dc2626;
  margin-bottom: var(--ca-spacing-lg);
}

.warning-icon svg {
  width: 48px;
  height: 48px;
}

.delete-confirmation-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--ca-spacing-lg);
  text-align: center;
}

.calendar-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--ca-border-radius);
  padding: var(--ca-spacing-md);
  margin-bottom: var(--ca-spacing-lg);
  text-align: left;
}

.calendar-info h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--ca-spacing-sm) 0;
}

.calendar-info p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  word-break: break-all;
  line-height: 1.4;
}

.calendar-url {
  font-family: monospace;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin: 4px 0 8px 0;
  font-size: 0.8rem;
  word-break: break-all;
  line-height: 1.3;
  color: var(--text);
  opacity: 0.9;
}

.warning-message {
  background: rgba(220, 38, 38, 0.1);
  border: 2px solid #dc2626;
  border-radius: var(--ca-border-radius);
  padding: var(--ca-spacing-md);
  margin-bottom: var(--ca-spacing-lg);
  text-align: left;
}

.warning-message p {
  margin: 0 0 var(--ca-spacing-sm) 0;
  font-size: 0.875rem;
  color: #dc2626;
  line-height: 1.4;
}

.warning-message p:last-child {
  margin-bottom: 0;
  font-weight: 600;
  color: #dc2626;
}

.modal-actions {
  display: flex;
  gap: var(--ca-spacing-md);
  justify-content: center;
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
  padding: var(--ca-spacing-sm) var(--ca-spacing-lg);
  border-radius: var(--ca-border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--ca-spacing-sm);
  transition: var(--ca-transition);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.2;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-danger:active {
  background: #991b1b;
  border-color: #991b1b;
}

.btn-danger:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: not-allowed;
}

/* Modal de agregar ICS */
.add-ics-form {
  padding: 0 24px 24px 24px;
}

.add-ics-form .field {
  margin-bottom: var(--ca-spacing-lg);
}

.add-ics-form .field-help {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--ca-spacing-xs);
  font-style: italic;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--ca-spacing-sm);
  cursor: pointer;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.checkbox-label .checkmark {
  display: none;
}

/* Modal de listar ICS */
.list-ics-content {
  padding: var(--ca-spacing-lg);
}

.ics-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--ca-spacing-xxl);
  color: var(--text-muted);
}

.ics-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--ca-spacing-md);
}

.ics-list {
  max-height: 400px;
  overflow-y: auto;
}

.ics-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ca-spacing-md);
  border: 1px solid var(--border);
  border-radius: var(--ca-border-radius);
  margin-bottom: var(--ca-spacing-sm);
  background: var(--surface);
  transition: var(--ca-transition);
}

.ics-item:hover {
  background: color-mix(in srgb, var(--brand) 5%, transparent);
  border-color: var(--brand);
}

.ics-item-info {
  flex: 1;
  margin-right: var(--ca-spacing-md);
}

.ics-item-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--ca-spacing-xs);
}

.ics-item-url {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: var(--ca-spacing-xs);
}

.ics-item-meta {
  display: flex;
  gap: var(--ca-spacing-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ics-item-freq {
  display: flex;
  align-items: center;
  gap: var(--ca-spacing-xs);
}

.ics-item-global {
  display: flex;
  align-items: center;
  gap: var(--ca-spacing-xs);
  color: var(--brand);
  font-weight: 500;
}

.ics-item-actions {
  display: flex;
  gap: var(--ca-spacing-sm);
}

.ics-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--ca-border-radius);
  cursor: pointer;
  transition: var(--ca-transition);
}

.ics-delete-btn:hover {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.ics-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--ca-spacing-xxl);
  text-align: center;
  color: var(--text-muted);
}

.ics-empty .empty-icon {
  margin-bottom: var(--ca-spacing-md);
  opacity: 0.5;
}

.ics-empty h3 {
  margin: 0 0 var(--ca-spacing-sm) 0;
  color: var(--text);
}

.ics-empty p {
  margin: 0 0 var(--ca-spacing-lg) 0;
  font-size: 0.9rem;
}

.ics-empty .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--ca-spacing-sm);
}




/* Estilos específicos para el modal de tabla */
#tableItemModal .form-group {
  margin-bottom: 20px;
}

#tableItemModal .form-group.hidden {
  display: none;
}

/* ===== MODALES DE LLAMADOS ===== */

.ll-modal-overlay {
  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: 1000;
  animation: fadeIn 0.3s ease;
}

.ll-modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 95%;
  max-height: 80vh;
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

.ll-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.ll-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.ll-modal-close {
  background: none;
  border: none;
  color: var(--subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.ll-modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.ll-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.ll-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.ll-detail-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.ll-detail-row:last-child {
  border-bottom: none;
}

.ll-detail-row.ll-detail-full-width {
  grid-template-columns: 1fr;
  gap: 8px;
}

.ll-detail-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ll-detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.ll-modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Animaciones del modal */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== MODALES DE CSV IMPORTER ===== */

.csv-import-modal {
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  background: var(--background-color, #1a1a1a);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .csv-import-modal {
  transform: scale(1);
}



/* ===== RESPONSIVE PARA MODALES ===== */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    width: 95%;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-secondary {
    height: 44px;
    font-size: 15px;
  }

  /* Fecha/hora en columna en pantallas pequeñas */
  .fm-datetime-row {
    flex-direction: column;
    gap: 20px;
  }

  /* Tiempo y contacto en columna en pantallas pequeñas */
  .fm-tiempo-contacto-row {
    flex-direction: column;
    gap: 20px;
  }
}

/* ===== MODAL CONTEXT PANEL (COLUMNA 1) ===== */
.modal-context-panel {
  width: 280px;
  padding: 16px;
  background: var(--surface);
  border-radius: 16px 0px 0px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 16px;
  transform: translateX(32px) scaleX(0.2);
  transform-origin: right center;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.3, 1), opacity 0.25s ease;
}

.modal-overlay.active .modal-context-panel {
  transform: translateX(0) scaleX(1);
  opacity: 1;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary, #212121);
  text-transform: uppercase;
}

.sidebar-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #757575);
  line-height: 1.4;
}

/* Colores del panel lateral del ticket */

/* Modo Claro (Default) */
.modal-context-panel .sidebar-label {
  color: #888888;
}

.modal-context-panel .sidebar-value,
.modal-context-panel .sidebar-subvalue {
  color: #333333;
}

/* Modo Oscuro */
[data-theme="dark"] .modal-context-panel .sidebar-label {
  color: #333333;
}

[data-theme="dark"] .modal-context-panel .sidebar-value,
[data-theme="dark"] .modal-context-panel .sidebar-subvalue {
  color: #888888;
}

.sidebar-subvalue {
  font-size: 12px;
  color: var(--text-secondary, #757575);
  line-height: 1.3;
}

.sidebar-multiline {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 80px;
  overflow-y: auto;
}

/* Contenedor de abonos en el panel lateral */
#completeTaskClientAbonos {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-badges {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
  color: var(--badge-text, #2e7d32);
  border: 1px solid var(--badge-text, #2e7d32);
}

.sidebar-badge svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.sidebar-badge.hardware {
  --badge-bg: #ffebee;
  --badge-text: #c62828;
  --badge-border: #ffcdd2;
}

.sidebar-badge.software {
  --badge-bg: #e0f2f1;
  --badge-text: #00695c;
  --badge-border: #b2dfdb;
}

.sidebar-badge.networking {
  --badge-bg: #f3e5f5;
  --badge-text: #6a1b9a;
  --badge-border: #e1bee7;
}

.sidebar-badge.other {
  --badge-bg: #fff3e0;
  --badge-text: #e65100;
  --badge-border: #ffe0b2;
}

/* Responsive para sidebar */
@media (max-width: 1024px) {
  .modal-content-with-sidebar {
    max-width: 95vw;
  }

  .modal-sidebar {
    width: 240px;
    padding: 16px;
    gap: 20px;
  }

  .sidebar-label {
    font-size: 10px;
  }

  .sidebar-value {
    font-size: 12px;
  }

  .sidebar-subvalue {
    font-size: 11px;
  }
}

@media (max-width: 1024px) {
  .modal-overlay-container {
    flex-direction: column;
    gap: 20px;
  }

  .modal-context-panel {
    width: 100%;
    max-width: 580px;
  }
}

@media (max-width: 768px) {
  .modal-overlay-container {
    flex-direction: column;
    gap: 16px;
  }

  .modal-context-panel {
    width: 100%;
    max-width: 100%;
    padding: 16px;
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
  }

  .sidebar-section {
    gap: 4px;
  }
}