/**
 * CUSTOM CSS - IFC System
 * Solo para casos que Tailwind no puede manejar
 * Mobile first - diseño simple y profesional
 * 
 * NOTA: Componentes generales movidos a components.css
 * Este archivo solo contiene estilos específicos del sistema
 */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* Main content - sin zoom para mejor compatibilidad móvil */

/* ============================================
   COMPONENTES: BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
}

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

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

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-neutral {
  background-color: #f3f4f6;
  color: #374151;
}

.badge-primary {
  background-color: #dbeafe;
  color: #1d4ed8;
}

/* ============================================
   COMPONENTES: BOTONES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn i {
  font-size: 0.875rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background-color: #f9fafb;
}

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

.btn-danger:hover {
  background-color: #b91c1c;
}

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

.btn-success:hover {
  background-color: #15803d;
}

/* Botones pequeños (para tablas) */
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  gap: 0.25rem;
}

.btn-sm i {
  font-size: 0.75rem;
}

/* Variante de tabla para botones más compactos */
.table-actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  gap: 0.25rem;
}

.table-actions .btn i {
  font-size: 0.75rem;
}

/* Botones de icono (para tablas) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-icon-primary {
  color: #2563eb;
  background-color: #eff6ff;
}

.btn-icon-primary:hover {
  background-color: #dbeafe;
}

.btn-icon-secondary {
  color: #6b7280;
  background-color: #f3f4f6;
}

.btn-icon-secondary:hover {
  background-color: #e5e7eb;
}

.btn-icon-warning {
  color: #d97706;
  background-color: #fffbeb;
}

.btn-icon-warning:hover {
  background-color: #fef3c7;
}

.btn-icon-danger {
  color: #dc2626;
  background-color: #fef2f2;
}

.btn-icon-danger:hover {
  background-color: #fee2e2;
}

/* ============================================
   COMPONENTES: TABLAS
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

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

.table-standard thead {
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table-standard th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-standard td {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #374151;
}

.table-standard tbody tr:hover {
  background-color: #f9fafb;
}

.table-row-selected {
  background-color: #eff6ff !important;
}

/* Variante de tabla simple */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table-header {
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table-th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-th-left {
  text-align: left;
}

.table-th-center {
  text-align: center;
}

.table-th-right {
  text-align: right;
}

.table-cell-muted {
  color: #6b7280;
  font-size: 0.75rem;
}

/* ============================================
   COMPONENTES: TABS
   ============================================ */
.tab-content {
  display: none;
}

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

#content-gestion.active,
#content-datos.active {
  display: block;
}

#tab-gestion.active,
#tab-datos.active {
  border-bottom-color: #2563eb;
  color: #2563eb;
}

/* Tabs dinámicos para informes finales */
.tabs-header-row {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
}

.tab-header {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  border-radius: 0.375rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-header:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.tab-header.active {
  background-color: white;
  color: #2563eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-close {
  padding: 0.25rem;
  margin-left: 0.25rem;
  color: #9ca3af;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.tab-close:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.tab-content-wrapper {
  padding: 1.5rem;
}

/* ============================================
   COMPONENTES: MODALES
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-backdrop.active {
  display: flex;
}

/* Modal Overlay (alternativo para compatibilidad) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
  display: none;
}

.modal,
.modal-content {
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg {
  max-width: 40rem;
}

.modal-xl {
  max-width: 56rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  padding: 0.5rem;
  font-size: 1.25rem;
  color: #6b7280;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body > div + div {
  margin-top: 1rem;
}

.modal-footer,
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
  border-radius: 0 0 0.75rem 0.75rem;
}

/* ============================================
   COMPONENTES: MODALES PERSONALIZADOS
   ============================================ */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.custom-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.custom-modal-content {
  position: relative;
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-appear 0.2s ease-out;
}

/* ============================================
   COMPONENTES: CHARACTER COUNTER
   ============================================ */
.character-counter {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  transition: color 0.2s;
}

.character-counter .counter-current {
  font-weight: 600;
}

.character-counter.text-red-600 .counter-current {
  font-weight: 700;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.custom-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.custom-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

.custom-modal-icon i {
  font-size: 2rem;
}

/* Variantes de color por tipo */
.custom-modal-info .custom-modal-icon {
  background-color: #dbeafe;
  color: #2563eb;
}

.custom-modal-warning .custom-modal-icon {
  background-color: #fef3c7;
  color: #d97706;
}

.custom-modal-danger .custom-modal-icon {
  background-color: #fee2e2;
  color: #dc2626;
}

.custom-modal-success .custom-modal-icon {
  background-color: #d1fae5;
  color: #059669;
}

.custom-modal-error .custom-modal-icon {
  background-color: #fee2e2;
  color: #dc2626;
}

.custom-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.custom-modal-message {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.custom-modal-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

body.modal-open {
  overflow: hidden;
}

/* ============================================
   COMPONENTES: PAGINACIÓN
   ============================================ */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
}

.pagination-info strong {
  color: #111827;
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-current {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

/* ============================================
   COMPONENTES: ESTADOS VACÍOS
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state i {
  font-size: 3rem;
  color: #d1d5db;
  margin-bottom: 1rem;
}

.empty-state p:first-of-type {
  font-size: 1rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.empty-state p:last-of-type {
  font-size: 0.875rem;
  color: #9ca3af;
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-slideDown {
  animation: slideDown 0.3s ease-out;
}

.animate-slideUp {
  animation: slideUp 0.3s ease-out;
}

/* Transiciones de entrada para tablas */
.enter-from {
  opacity: 0;
  transform: translateY(8px);
}

.enter-to,
.enter-to-fast {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
}

/* ============================================
   UTILIDADES
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Highlight para botones */
.highlight-pulse {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
}

/* ============================================
   ESTILOS PARA CARDS MÓVILES
   ============================================ */
.quotes-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.quotes-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
}

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

.quote-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.quote-card-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.quote-card-title-btn {
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.quote-card-fim {
  margin-bottom: 0.5rem;
}

.quote-card-total {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.quote-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.quote-card-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: #2563eb;
  background: none;
  border: none;
  cursor: pointer;
}

.btn-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* ============================================
   ESTILOS PARA MODAL COMPARTIR
   ============================================ */
.credentials-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.75rem;
}

.credentials-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.credentials-row {
  display: flex;
  gap: 0.5rem;
}

.credentials-note {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.5rem;
  font-style: italic;
}

.section-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.info-text {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ============================================
   ESTILOS PARA TEMPLATES
   ============================================ */
.template-info {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.template-info i {
  font-size: 1.25rem;
  color: #2563eb;
  margin-top: 0.125rem;
}

.template-name {
  font-weight: 500;
  color: #111827;
}

.template-description {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

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

/* ============================================
   ESTILOS PARA OI HANDLER
   ============================================ */
.table-cell {
  padding: 0.75rem 1rem;
}

.table-cell-text {
  font-size: 0.875rem;
  color: #374151;
}

.table-cell-text-bold {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.table-cell-error {
  padding: 2rem;
  text-align: center;
  color: #dc2626;
}

.table-row {
  cursor: pointer;
  transition: background-color 0.15s;
}

.table-row:hover {
  background-color: #f9fafb;
}

/* FIM List Items (Orden Interna) */
.fim-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.fim-list-item:hover {
  background-color: #f9fafb;
}

.fim-list-item-selected {
  background-color: #eff6ff;
  border-left-color: #2563eb;
}

.fim-list-item-selected:hover {
  background-color: #dbeafe;
}

.fim-list-item-content {
  flex: 1;
  min-width: 0;
}

.fim-list-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fim-list-item-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.fim-list-item-quote {
  font-size: 0.75rem;
  color: #6b7280;
  background-color: #f3f4f6;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.fim-list-item-company {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fim-list-item-arrow {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-left: 0.5rem;
  transition: transform 0.15s ease;
}

.fim-list-item:hover .fim-list-item-arrow {
  transform: translateX(2px);
  color: #6b7280;
}

.fim-list-item-selected .fim-list-item-arrow {
  color: #2563eb;
}

/* Status badges para OI */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.status-in-progress {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-completed {
  background-color: #dcfce7;
  color: #166534;
}

.status-cancelled {
  background-color: #fee2e2;
  color: #991b1b;
}

/* ============================================
   ESTILOS PARA FINAL REPORT
   ============================================ */
.tab-results-max-height {
  max-height: 60vh;
  overflow-y: auto;
}

.sample-data-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.75rem;
}

.sample-data-list li {
  padding: 0.125rem 0;
}

.result-input,
.unit-input {
  width: 100%;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.result-input:focus,
.unit-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .no-print,
  .sidebar,
  .header,
  button,
  .mobile-overlay {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .card,
  .table {
    box-shadow: none !important;
  }

  @page {
    margin: 1cm;
    size: letter;
  }

  .card,
  tr {
    page-break-inside: avoid;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Clases de animación */
.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-slideDown {
  animation: slideDown 0.3s ease-out;
}

.animate-slideUp {
  animation: slideUp 0.3s ease-out;
}

/* 
 * SECCIÓN DUPLICADA ELIMINADA
 * Los estilos de .line-clamp-*, .custom-scrollbar, 
 * @media (prefers-reduced-motion), y *:focus-visible
 * están definidos en las líneas 751-784 de este archivo
 */

/* ============================================
   FORMULARIOS: VALIDACION
   ============================================ */
.is-invalid {
  border-color: #dc2626 !important;
  background-color: #fef2f2 !important;
}

.is-invalid:focus {
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.is-valid {
  border-color: #16a34a !important;
}

.error-message {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: #dc2626;
}

.error-message i {
  font-size: 0.75rem;
}

.error-summary {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.error-summary h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 0.5rem;
}

.error-summary ul {
  list-style: none;
  padding-left: 1.5rem;
  margin: 0;
}

.error-summary li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #991b1b;
  padding: 0.25rem 0;
}

.error-summary li i {
  font-size: 0.375rem;
  color: #dc2626;
}

.character-counter {
  font-size: 0.75rem;
  text-align: right;
  margin-top: 0.25rem;
}

.counter-normal {
  color: #6b7280;
}

.counter-warning {
  color: #d97706;
}

.counter-danger {
  color: #dc2626;
  font-weight: 600;
}

.slide-up {
  animation: slideUp 0.3s ease-out forwards;
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ============================================
   FORM HANDLER - MUESTRA STYLES
   ============================================ */
.muestra-fieldset {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.muestra-fieldset:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.muestra-fieldset.is-editing {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.muestra-fieldset.removing {
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.2s ease;
}

.muestra-fieldset.cloned {
  animation: pulse-border 0.5s ease;
}

@keyframes pulse-border {
  0%,
  100% {
    border-color: #e5e7eb;
  }
  50% {
    border-color: #3b82f6;
  }
}

.muestra-fieldset.highlight {
  animation: highlight-bg 0.9s ease;
}

@keyframes highlight-bg {
  0%,
  100% {
    background-color: white;
  }
  50% {
    background-color: #eff6ff;
  }
}

/* Muestra Head */
.muestra-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
}

.muestra-head .collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.muestra-head .collapse-btn:hover {
  color: #374151;
}

.muestra-head .collapse-btn i {
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.muestra-fieldset.collapsed .muestra-head .collapse-btn i {
  transform: rotate(-90deg);
}

.muestra-head .head-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  font-size: 0.813rem;
}

.muestra-head .head-title > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  background: #2563eb;
  color: white;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  flex-shrink: 0;
}

.muestra-head .head-name {
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.muestra-head .head-meta {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muestra-head .head-meta .muted {
  color: #9ca3af;
}

.muestra-head .head-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
  flex-shrink: 0;
}

.muestra-head .head-count {
  font-size: 0.75rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.muestra-head .head-count i {
  font-size: 0.625rem;
  color: #2563eb;
}

.muestra-head .summary-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.muestra-head .summary-action-btn:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.muestra-head .summary-action-btn:last-child:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.muestra-head .summary-action-btn i {
  font-size: 0.75rem;
}

/* Muestra Body */
.muestra-body {
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.muestra-fieldset.collapsed .muestra-body {
  display: none;
}

.muestra-body > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Section Subtitle */
.section-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin: 0;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e5e7eb;
}

/* Form grid inside muestra body - disabled to allow custom grid layouts */
/* .muestra-body > div > div:not(.section-subtitle):not(:first-child) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .muestra-body > div > div:not(.section-subtitle):not(:first-child) {
    grid-template-columns: repeat(2, 1fr);
  }
} */

/* Analysis table inside muestra */
.muestra-body table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.375rem;
  font-size: 0.813rem;
}

.muestra-body table th {
  padding: 0.375rem 0.5rem;
  text-align: left;
  font-size: 0.625rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.muestra-body table td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

.muestra-body .th-cell {
  padding: 0.375rem 0.5rem;
}

/* Grammage/Quantity groups */
.grammage-group,
.temperature-group {
  display: flex;
  gap: 0.5rem;
}

.grammage-group input,
.grammage-group select {
  flex: 1;
}

.temperature-group input {
  flex: 1;
}

.temperature-group .temp-unit {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-left: 0;
  border-radius: 0 0.375rem 0.375rem 0;
  font-size: 0.813rem;
  color: #6b7280;
}

.temperature-group input {
  border-radius: 0.375rem 0 0 0.375rem;
}

/* Analysis count badge */
.analysis-count {
  font-size: 0.75rem;
  color: #6b7280;
  background-color: #f3f4f6;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

/* Analysis header row */
.muestra-body
  > div
  > div:has(.section-subtitle):has([data-action="add-analysis"]) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.muestra-body
  > div
  > div:has(.section-subtitle):has([data-action="add-analysis"])
  > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.muestra-body
  > div
  > div:has(.section-subtitle):has([data-action="add-analysis"])
  .section-subtitle {
  border-bottom: none;
  padding-bottom: 0;
}

/* ============================================
   FORM CONTROLS - UNIFIED SYSTEM
   ============================================ */

/* Base input styles - mobile first */
/* Only apply when no Tailwind padding classes are present */
input:not([type="checkbox"]):not([type="radio"]):not([class*="py-"]):not(
    [class*="px-"]
  ),
select:not([class*="py-"]):not([class*="px-"]),
textarea:not([class*="py-"]):not([class*="px-"]) {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box !important;
}

/* Altura consistente para inputs normales */
input:not([type="checkbox"]):not([type="radio"]):not([class*="py-"]):not(
    [class*="px-"]
  ):not([readonly]),
select:not([class*="py-"]):not([class*="px-"]) {
  min-height: 38px !important;
  height: auto !important;
  line-height: 1.5 !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Textareas y inputs readonly auto-expand sin scrollbar */
textarea:not([class*="py-"]):not([class*="px-"]),
input[readonly]:not([type="checkbox"]):not([type="radio"]):not(
    [class*="py-"]
  ):not([class*="px-"]) {
  min-height: 38px !important;
  height: auto !important;
  resize: none !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.5 !important;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

/* Inputs y selects con clases de Tailwind - altura consistente con dropdowns */
input[type="text"].px-3,
input[type="tel"].px-3,
input[type="email"].px-3,
input[type="number"].px-3,
textarea.px-3,
select.px-3 {
  min-height: 38px !important;
  height: auto !important;
  line-height: 1.5rem !important;
  box-sizing: border-box !important;
  font-size: 0.875rem !important;
}

/* Textareas específicamente */
textarea.px-3 {
  resize: none !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Choices.js - compact unified */
.choices {
  margin-bottom: 0;
}

.choices__inner {
  min-height: 38px !important;
  height: auto !important;
  max-height: none !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.375rem !important;
  border: 1px solid #d1d5db !important;
  background: white !important;
  font-size: 0.875rem !important;
  line-height: 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.choices__inner:focus,
.choices.is-focused .choices__inner {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2) !important;
}

.choices__list--single .choices__item {
  padding: 0 !important;
  font-size: 0.875rem !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  line-height: 1.5 !important;
}

.choices__list--dropdown {
  border-radius: 0.375rem;
  border-color: #e5e7eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 100 !important;
}

.choices__list--dropdown .choices__item {
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  white-space: normal !important;
  word-wrap: break-word !important;
  line-height: 1.4 !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
  background-color: #eff6ff;
}

.choices__placeholder {
  opacity: 0.6;
  font-size: 0.75rem;
}

/* Limitar ancho del dropdown de Análisis */
.analysis-select + .choices .choices__list--dropdown {
  max-width: 400px;
  width: max-content;
  min-width: 100%;
}

/* Dropdown de Matriz - solo ajuste de ancho del dropdown */
.analysis-matrix-select + .choices .choices__list--dropdown {
  width: max-content;
  min-width: 100%;
  max-width: 250px;
}

/* Dropdown de Cantidad - solo ajuste de ancho del dropdown */
.quantity-select + .choices .choices__list--dropdown {
  min-width: 100%;
  width: max-content;
  max-width: 150px;
}

.choices[data-type*="select-one"] .choices__inner {
  padding-right: 1.75rem !important;
}

/* Muestra Summary (sidebar) */
.muestra-summary {
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: white;
  margin-bottom: 0.5rem;
  transition: all 0.15s ease;
}

.muestra-summary:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.muestra-summary:last-child {
  margin-bottom: 0;
}

.muestra-summary > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.muestra-summary > div:first-child > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.muestra-summary > div:first-child > div:first-child > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  background: #2563eb;
  color: white;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  flex-shrink: 0;
}

.muestra-summary > div:first-child > div:first-child > p {
  font-size: 0.75rem;
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.muestra-summary > div:first-child > div:last-child {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.muestra-summary .summary-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.muestra-summary .summary-action-btn:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.muestra-summary .summary-action-btn:last-child:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.muestra-summary .summary-action-btn i {
  font-size: 0.625rem;
}

.muestra-summary > p {
  font-size: 0.625rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
}

.muestra-summary > p > span {
  color: #9ca3af;
}

.muestra-summary > div:last-child {
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid #f3f4f6;
}

.muestra-summary > div:last-child > p {
  font-size: 0.625rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.25rem;
}

.muestra-summary > div:last-child > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.muestra-summary > div:last-child > ul > li {
  font-size: 0.625rem;
  color: #6b7280;
  padding: 0.125rem 0;
  padding-left: 0.5rem;
  position: relative;
}

.muestra-summary > div:last-child > ul > li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2563eb;
}

.muestra-summary > div:last-child > ul > li.italic {
  font-style: italic;
  color: #9ca3af;
}

.muestra-summary > div:last-child > ul > li.italic::before {
  display: none;
}

.muestra-summary > div:last-child > ul > li > div.italic {
  font-size: 0.5625rem;
  font-style: italic;
  color: #9ca3af;
  margin-top: 0.125rem;
}

/* ============================================
   FLATPICKR CALENDAR POSITIONING
   ============================================ */
.flatpickr-calendar {
  z-index: 9999 !important;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  position: fixed !important;
}

.flatpickr-calendar.arrowTop,
.flatpickr-calendar.arrowBottom {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Asegurar que el calendario se posicione correctamente */
.flatpickr-input {
  background-color: white !important;
}

.flatpickr-alt {
  cursor: pointer !important;
}

.flatpickr-input:focus,
.flatpickr-alt:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2) !important;
}

.flatpickr-day.selected {
  background-color: #2563eb;
  border-color: #2563eb;
}

.flatpickr-day.selected:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}
