﻿:root {
  /* Primary palette */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;

  /* Semantic colors */
  --success: #059669;
  --success-dark: #047857;
  --success-light: #10b981;
  --warning: #d97706;
  --warning-dark: #b45309;
  --warning-light: #f59e0b;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-light: #ef4444;
  --info: #0284c7;
  --info-dark: #0369a1;
  --info-light: #0ea5e9;
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --purple-light: #a78bfa;

  /* Sidebar - dark theme */
  --sidebar-bg: #0f172a;
  --sidebar-bg-hover: #1e293b;
  --sidebar-bg-active: rgba(59, 130, 246, 0.15);
  --sidebar-border-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-text-active: #60a5fa;
  --sidebar-section-label: #475569;
  --sidebar-divider: #1e293b;
  --sidebar-header-bg: #0f172a;

  /* Page layout */
  --page-bg: #eef2f7;
  --header-bg: #ffffff;
  --header-border: #e2e8f0;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;

  /* Borders */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  /* Table */
  --table-header-bg: #f1f5f9;
  --table-row-hover: #f8fafc;
  --table-border: #e2e8f0;
}

/* ========================================
   GLOBAL LAYOUT OVERRIDES
   ======================================== */

/* Page background - subtle warm gray instead of pure white */
body.bg-gray-50,
body {
  background-color: var(--page-bg) !important;
}

/* ========================================
   GLOBAL SELECT FIX - Sin doble icono
   ======================================== */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  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 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1em 1em;
  padding-right: 2.5rem !important;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ========================================
   DARK SIDEBAR
   ======================================== */
#sidebar {
  background-color: var(--sidebar-bg) !important;
  border-right: none !important;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

/* Sidebar header */
#sidebar > div:first-child {
  background-color: var(--sidebar-header-bg) !important;
  border-bottom: 1px solid var(--sidebar-divider) !important;
}

#sidebar > div:first-child span {
  color: #f1f5f9 !important;
}

/* Mobile close button */
#menu-toggle-mobile-close {
  color: var(--sidebar-text) !important;
}
#menu-toggle-mobile-close:hover {
  color: var(--sidebar-text-hover) !important;
  background-color: var(--sidebar-bg-hover) !important;
}

/* Sidebar navigation links */
#main-nav a {
  color: var(--sidebar-text) !important;
  border-left: 3px solid transparent;
  border-radius: 0 0.5rem 0.5rem 0 !important;
  margin-left: -3px;
  transition: all 0.2s ease;
}

#main-nav a:hover {
  background-color: var(--sidebar-bg-hover) !important;
  color: var(--sidebar-text-hover) !important;
}

#main-nav a i {
  color: var(--sidebar-text) !important;
  transition: color 0.2s ease;
}

#main-nav a:hover i {
  color: var(--sidebar-text-hover) !important;
}

/* Active sidebar link */
#main-nav a.active-nav,
#main-nav a[aria-current="page"] {
  background-color: var(--sidebar-bg-active) !important;
  color: var(--sidebar-text-active) !important;
  border-left-color: var(--sidebar-border-active) !important;
  font-weight: 600;
}

#main-nav a.active-nav i,
#main-nav a[aria-current="page"] i {
  color: var(--sidebar-text-active) !important;
}

/* Section labels */
#main-nav .sidebar-section-label,
#main-nav p {
  color: var(--sidebar-section-label) !important;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
}

/* Section dividers */
#main-nav .border-t,
#main-nav > div > .border-t {
  border-color: var(--sidebar-divider) !important;
}

/* Sidebar footer */
#sidebar > div:last-child {
  border-top-color: var(--sidebar-divider) !important;
  background-color: var(--sidebar-bg) !important;
}

#sidebar > div:last-child p {
  color: var(--sidebar-text) !important;
}

#sidebar > div:last-child .bg-blue-100 {
  background-color: var(--sidebar-bg-hover) !important;
}

#sidebar > div:last-child i {
  color: var(--sidebar-text) !important;
}

/* ========================================
   HEADER IMPROVEMENTS
   ======================================== */
header.sticky,
header {
  background-color: var(--header-bg) !important;
  border-bottom: 1px solid var(--header-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Header page title icon */
header .bg-blue-50 {
  background-color: var(--primary-50) !important;
  border: 1px solid var(--primary-100);
}

/* User avatar in header */
header .bg-blue-100 {
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  ) !important;
}

header .bg-blue-100 span,
header #user-initials {
  color: white !important;
}

/* ========================================
   MAIN CONTENT - FULL WIDTH
   ======================================== */
#main-content .max-w-7xl,
#content-container.max-w-7xl,
.max-w-7xl {
  max-width: 100% !important;
}

/* ========================================
   CARDS - Enhanced with subtle contrast
   ======================================== */
.bg-white.rounded-xl,
.bg-white.rounded-lg {
  background-color: var(--card-bg);
  border-color: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* ========================================
   TABLE IMPROVEMENTS
   ======================================== */
.bg-gray-50.border-b thead,
thead.bg-gray-50,
table thead {
  background-color: var(--table-header-bg) !important;
}

table thead th {
  color: var(--text-secondary) !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

table tbody tr:hover {
  background-color: var(--table-row-hover) !important;
}

/* ========================================
   BADGE REFINEMENTS
   ======================================== */
.badge-warning,
.bg-yellow-100 {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  font-weight: 600;
}

.badge-success,
.bg-green-100 {
  background-color: #dcfce7 !important;
  color: #166534 !important;
}

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

/* ========================================
   BUTTON REFINEMENTS
   ======================================== */
.btn-primary,
.bg-blue-600 {
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  ) !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  border: none !important;
}

.btn-primary:hover:not(:disabled),
.bg-blue-600:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
  transform: translateY(-1px);
}

.bg-green-600 {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}
.bg-green-600:hover {
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4) !important;
  transform: translateY(-1px);
}

.bg-purple-600 {
  background: linear-gradient(135deg, #9333ea, #7e22ce) !important;
  box-shadow: 0 1px 3px rgba(147, 51, 234, 0.3);
}
.bg-purple-600:hover {
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.4) !important;
  transform: translateY(-1px);
}

.bg-orange-600 {
  background: linear-gradient(135deg, #ea580c, #c2410c) !important;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.3);
}
.bg-orange-600:hover {
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4) !important;
  transform: translateY(-1px);
}

/* ========================================
   DROPDOWN REFINEMENTS
   ======================================== */
#dropdown-options {
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.1),
    0 4px 10px rgba(0, 0, 0, 0.06) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 0.75rem !important;
}

/* ========================================
   FILTER / TOOLBAR AREA
   ======================================== */
.border-b.border-gray-200 select,
#quoteTypeFilter,
#items-per-page {
  background-color: var(--card-bg);
  border-color: var(--border-medium) !important;
  border-radius: 0.5rem;
}

/* Search input enhancement */
#searchInput {
  background-color: var(--table-header-bg) !important;
  border-color: var(--border-light) !important;
  transition: all 0.2s ease;
}

#searchInput:focus {
  background-color: white !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* ========================================
   TOAST NOTIFICATIONS - refined
   ======================================== */
.toast {
  border-radius: 0.75rem;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.15),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
}

/* ========================================
   MOBILE OVERLAY - darker
   ======================================== */
#mobile-overlay {
  background-color: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px);
}

/* ========================================
   APP LOADER - branded
   ======================================== */
#app-loader {
  background-color: var(--page-bg) !important;
}

#app-loader .border-t-blue-600 {
  border-top-color: var(--primary) !important;
}

/* ========================================
   SIDEBAR COLLAPSED STATE (desktop)
   ======================================== */
@media (min-width: 1024px) {
  .lg\:ml-0 {
    margin-left: 0 !important;
  }
}

/* Fix for 2-column layout with sticky sidebar */
#form-root {
  max-width: 100%;
  overflow: visible;
}

.form-layout-container {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 1rem;
}

.form-layout-flex {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .form-layout-flex {
    flex-direction: row;
    gap: 1.5rem;
  }
}

.form-main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .form-sidebar {
    display: block;
    width: 20rem;
    flex-shrink: 0;
  }
}

@media (min-width: 1280px) {
  .form-sidebar {
    width: 24rem;
  }
}

.form-sidebar-sticky {
  position: sticky;
  top: 5rem; /* 64px (header h-16) + 16px gap = 80px */
}

/* Mejoras de contraste visual para cards */
.card-header-enhanced {
  background: linear-gradient(to right, #f9fafb, #f3f4f6);
  border-bottom: 2px solid #e5e7eb;
}

/* ========================================
   GRID CARACTERÍSTICAS DE LA MUESTRA
   ======================================== */
.characteristics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
}

.char-field {
  min-width: 0;
}

.char-presentation {
  flex: 1 1 200px;
  max-width: 280px;
}

.char-quantity {
  flex: 0 0 auto;
}

.quantity-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.quantity-container input[type="number"] {
  width: 70px !important;
  flex-shrink: 0;
}

.quantity-container select.quantity-select {
  width: 70px !important;
  min-width: 70px !important;
  flex-shrink: 0;
}

.char-temperature {
  flex: 0 0 auto;
}

.temp-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.temp-input-wrapper .temp-input {
  width: 80px !important;
  flex-shrink: 0;
}

.temp-unit {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .characteristics-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .char-presentation {
    max-width: none;
  }

  .quantity-container input[type="number"],
  .quantity-container select.quantity-select,
  .temp-input-wrapper .temp-input {
    width: 100% !important;
    min-width: auto !important;
    flex: 1;
  }
}

/* Ocultar contadores de caracteres */
.character-counter {
  display: none !important;
}

/* Tabs de catálogos responsivos */
@media (max-width: 640px) {
  .catalog-tab {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem;
  }
  .catalog-tab i {
    margin-right: 0.25rem;
  }
}

/* Ocultar Choices.js completamente */
.choices,
.choices__inner,
.choices__list--dropdown,
.choices[data-type*="select-one"],
.choices[data-type*="select-multiple"],
.choices__list--single,
.choices__placeholder {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}

/* Asegurar que los selects nativos se muestren correctamente - SIN doble icono */
select.form-select,
select#citySelect,
select#stateSelect,
select.analysis-select,
select.matrix-select,
select.presentation-select,
select.quantity-select {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: white !important;
  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 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 0.5rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1.5em 1.5em !important;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  font-size: 0.875rem !important;
  width: 100% !important;
  height: auto !important;
  min-height: 38px !important;
  cursor: pointer;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

/* Permitir que las opciones dentro del dropdown muestren texto completo */
select.form-select option,
select.analysis-select option,
select.matrix-select option,
select.presentation-select option,
select.quantity-select option {
  white-space: normal;
  word-wrap: break-word;
  overflow: visible;
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
}

/* Forzar visibilidad de citySelect incluso si está dentro de un wrapper de Choices */
#citySelect {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 10 !important;
}

select.form-select:focus,
select.analysis-select:focus {
  border-color: #3b82f6 !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

/* Step navigation transitions */
.step-content {
  animation: fadeIn 0.3s ease-in-out;
}

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

.step-btn {
  transition: all 0.2s ease-in-out;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-secondary {
  background-color: white;
  color: #374151;
  border-color: #d1d5db;
}
.btn-secondary:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #9ca3af;
}
.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-dark);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.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;
}
.choices.is-open {
  z-index: 50 !important;
}
.choices__inner {
  border-color: #d1d5db;
  border-radius: 0.5rem;
  min-height: 42px;
  padding: 0.5rem 1rem;
}
.choices__list--dropdown.is-active {
  z-index: 100 !important;
  border-color: #d1d5db;
}
.choices__item--selectable {
  padding: 0.5rem 1rem;
}
.quantity-container {
  position: relative;
  z-index: 20;
}
.temperature-container {
  position: relative;
  z-index: 10;
}
.fim-signature-box {
  position: relative;
  border: 2px dashed #d1d5db;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  padding: 1rem;
}
.fim-signature-box.signed::after {
  content: "✓ Firmado";
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #10b981;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.analysis-quantity-badge {
  position: relative;
}
.analysis-quantity-badge::after {
  content: attr(data-quantity);
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #ef4444;
  color: white;
  border-radius: 9999px;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.data-table-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f9fafb;
}
.table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .table-wrapper {
    margin: 0 -1rem;
  }
  .table thead {
    display: none;
  }
  .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
  }
  .table tbody td {
    display: block;
    text-align: right;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
  }
  .table tbody td:last-child {
    border-bottom: none;
  }
  .table tbody td::before {
    content: attr(data-label);
    float: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6b7280;
  }
}
@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);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.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;
}
@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;
    border: 1px solid #d1d5db !important;
  }
  @page {
    margin: 1cm;
    size: letter;
  }
  .card,
  tr {
    page-break-inside: avoid;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
@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;
}
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 0.25rem;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 0.25rem;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 
 * ACCESIBILIDAD
 * .sr-only: Oculta visualmente pero accesible a lectores de pantalla
 * .visually-hidden: Oculta completamente del DOM (no accesible)
 */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.visually-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.visually-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.toast {
  min-width: 280px;
  max-width: 420px;
  background: white;
  border-radius: 0.75rem;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 1rem 1.25rem;
  border-left: 4px solid;
}
.toast.success {
  border-left-color: #10b981;
}
.toast.warning {
  border-left-color: #f59e0b;
}
.toast.error {
  border-left-color: #ef4444;
}
.toast.info {
  border-left-color: #3b82f6;
}
.loader,
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-sm,
.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.card-hover {
  transition: all 0.2s ease;
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}
.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  border-left: 4px solid;
}
.alert-success {
  background-color: #dcfce7;
  border-left-color: #10b981;
  color: #166534;
}
.alert-warning {
  background-color: #fef3c7;
  border-left-color: #f59e0b;
  color: #92400e;
}
.alert-danger {
  background-color: #fee2e2;
  border-left-color: #ef4444;
  color: #991b1b;
}
.alert-info {
  background-color: #dbeafe;
  border-left-color: #3b82f6;
  color: #1e40af;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: #6b7280;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  font-size: 0.875rem;
}
.nav-link:hover {
  background-color: #f3f4f6;
  color: #111827;
}
.nav-link-active {
  background-color: #dbeafe;
  color: #2563eb;
  font-weight: 500;
}
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}
@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
.list-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
}
.list-item:hover {
  background-color: #f9fafb;
}
.list-item:last-child {
  border-bottom: none;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}
.form-control {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.input-group {
  display: flex;
  gap: 0.5rem;
}
.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.stat-card-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
}
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}
.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover:not(:disabled) {
  background-color: var(--success-dark);
}
.btn-warning {
  background-color: var(--warning);
  color: white;
}
.btn-warning:hover:not(:disabled) {
  background-color: var(--warning-dark);
}
.btn-ghost {
  background-color: transparent;
  color: #6b7280;
  border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) {
  background-color: #f3f4f6;
  color: #111827;
}
.btn-link {
  background-color: transparent;
  color: #3b82f6;
  border: none;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover:not(:disabled) {
  color: #2563eb;
}
.badge-primary {
  background-color: #dbeafe;
  color: #1e40af;
}
.badge-purple {
  background-color: #f3e8ff;
  color: #7c3aed;
}
.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 {
  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-description {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
}
.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;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}
.card-header-secondary {
  background-color: #f9fafb;
}
.card-body {
  padding: 1.25rem;
}
.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb;
}
.table-standard {
  width: 100%;
  border-collapse: collapse;
}
.table-standard thead {
  background-color: #f9fafb;
}
.table-standard th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}
.table-standard td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #e5e7eb;
}
.table-standard tbody tr {
  transition: background-color 0.15s;
}
.table-standard tbody tr:hover {
  background-color: #f9fafb;
}
.login-input {
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.login-input:hover:not(:focus) {
  border-color: #9ca3af;
}
.login-input:focus {
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.05);
}
.login-input.border-red-500 {
  border-color: #ef4444;
  background-color: #fef2f2;
}
.login-input.border-red-500:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.login-error-message {
  animation: slideDown 0.2s ease-out;
}
.login-type-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  background-color: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #4b5563;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.login-type-card i {
  font-size: 0.9375rem;
  transition: transform 0.25s ease;
}
.login-type-card:hover:not(.active) {
  border-color: #9ca3af;
  background-color: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.login-type-card.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}
.login-type-card.active i {
  transform: scale(1.05);
}
.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}
.password-toggle:hover {
  transform: translateY(-50%) scale(1.1);
}
.group {
  position: relative;
}
.uppercase {
  text-transform: uppercase;
}
.cursor-pointer {
  cursor: pointer;
}
.table-header {
  background-color: #f9fafb;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}
@media (max-width: 640px) {
  button,
  a {
    min-height: 44px;
    min-width: 44px;
  }
  .modal,
  .modal-content {
    max-width: 95vw;
    margin: 0.5rem;
  }
}

/* Fix para botones de sincronización - sobrescribir reset de Tailwind */
button[type="button"].bg-purple-600,
button[type="button"].\!bg-purple-600 {
  background-color: rgb(147, 51, 234) !important;
}

button[type="button"].bg-purple-800,
button[type="button"].\!bg-purple-800 {
  background-color: rgb(107, 33, 168) !important;
}

button[type="button"].bg-blue-600,
button[type="button"].\!bg-blue-600 {
  background-color: rgb(37, 99, 235) !important;
}

button[type="button"].bg-green-600,
button[type="button"].\!bg-green-600 {
  background-color: rgb(22, 163, 74) !important;
}

button[type="button"].bg-yellow-600,
button[type="button"].\!bg-yellow-600 {
  background-color: rgb(202, 138, 4) !important;
}

button[type="button"].bg-orange-600,
button[type="button"].\!bg-orange-600 {
  background-color: rgb(234, 88, 12) !important;
}

button[type="button"].bg-indigo-600,
button[type="button"].\!bg-indigo-600 {
  background-color: rgb(79, 70, 229) !important;
}

button[type="button"].bg-cyan-600,
button[type="button"].\!bg-cyan-600 {
  background-color: rgb(8, 145, 178) !important;
}

button[type="button"].bg-teal-600,
button[type="button"].\!bg-teal-600 {
  background-color: rgb(13, 148, 136) !important;
}

button[type="button"].bg-sky-600,
button[type="button"].\!bg-sky-600 {
  background-color: rgb(2, 132, 199) !important;
}

button[type="button"].bg-lime-600,
button[type="button"].\!bg-lime-600 {
  background-color: rgb(101, 163, 13) !important;
}

button[type="button"].bg-rose-600,
button[type="button"].\!bg-rose-600 {
  background-color: rgb(225, 29, 72) !important;
}

button[type="button"].bg-pink-600,
button[type="button"].\!bg-pink-600 {
  background-color: rgb(219, 39, 119) !important;
}

button[type="button"].bg-fuchsia-600,
button[type="button"].\!bg-fuchsia-600 {
  background-color: rgb(192, 38, 211) !important;
}

button[type="button"].bg-emerald-600,
button[type="button"].\!bg-emerald-600 {
  background-color: rgb(5, 150, 105) !important;
}

button[type="button"].text-white,
button[type="button"].\!text-white {
  color: rgb(255, 255, 255) !important;
}

/* ========================================
   DISEÑO DEL FORMULARIO - MUESTRAS
   ======================================== */

/* Contenedor muestra-fieldset */
.muestra-fieldset {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.muestra-fieldset:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.muestra-fieldset.is-editing {
  border-color: var(--primary);
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.06);
}

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

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

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

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

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

#card-client.is-collapsed #clientForm {
  display: none;
}

#card-client.is-collapsed .collapse-btn i {
  transform: rotate(-90deg);
}

/* Cabecera de la muestra */
.muestra-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

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

.head-name {
  font-weight: 600;
  color: #111827;
  font-size: 0.875rem;
}

.head-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

.muted {
  color: #9ca3af;
  font-weight: 400;
}

.head-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.head-count {
  font-size: 0.875rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.collapse-btn {
  flex-shrink: 0;
  padding: 0.375rem;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.collapse-btn:hover {
  color: #4b5563;
  background-color: #f3f4f6;
}

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

.summary-action-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease-in-out;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.summary-action-btn.btn-duplicate {
  color: #2563eb;
  border-color: #dbeafe;
}

.summary-action-btn.btn-duplicate:hover {
  background-color: #eff6ff;
  color: #1d4ed8;
}

.summary-action-btn.btn-remove {
  color: #dc2626;
  border-color: #fee2e2;
}

.summary-action-btn.btn-remove:hover {
  background-color: #fef2f2;
  color: #b91c1c;
}

/* Cuerpo de la muestra */
.muestra-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

/* Subtítulos de sección */
.section-subtitle {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.75rem;
}

.section-subtitle-inline {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.section-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.75rem;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Tablas de análisis */
.analysis-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.375rem;
  font-size: 0.813rem;
}

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

.analysis-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;
}

.analysis-table td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

.analysis-table td:has(.analysis-select) {
  overflow: visible;
}

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

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

/* Grid del formulario */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.form-grid-12 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-12 {
    grid-template-columns: repeat(2, 1fr);
  }
  .head-title {
    flex-wrap: nowrap;
  }
}

@media (min-width: 1024px) {
  .form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .form-grid-12 {
    grid-template-columns: repeat(12, 1fr);
  }
}

.col-span-4 {
  grid-column: span 4 / span 4;
}

.col-span-5 {
  grid-column: span 5 / span 5;
}

.col-span-3 {
  grid-column: span 3 / span 3;
}

/* Etiquetas del formulario */
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

/* Grupos especiales */
.quantity-container {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  min-width: 0;
}

.quantity-container input {
  flex: 1;
  min-width: 0;
}

.quantity-container select {
  flex-shrink: 0;
  width: 5rem;
}

.grammage-group,
.temperature-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  min-width: 0;
}

.grammage-group input,
.temperature-group input {
  flex: 1;
  min-width: 0;
}

.grammage-group span,
.temperature-group span {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

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

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

.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;
}

/* Animación enter-from */
.enter-from {
  animation: slideInFromTop 0.3s ease-out;
}

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

/* ========================================
   MODALES FLOTANTES 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;
  z-index: 10000;
}

@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;
}

.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;
}

/* ========================================
   RESUMEN LATERAL - MEJORADO
   ======================================== */

#muestrasSummaryCard {
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

#muestrasSummaryList {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f3f4f6;
}

#muestrasSummaryList::-webkit-scrollbar {
  width: 6px;
}

#muestrasSummaryList::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

#muestrasSummaryList::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

#muestrasSummaryList::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

#asideClientSummary {
  /* El fondo ya está en el contenedor padre con bg-blue-600 */
  /* Este elemento solo contiene los items del cliente */
}

#asideClientSummary span,
#asideClientSummary i,
#asideClientName {
  color: white !important;
}

/* ========================================
   INPUTS Y FORMS - MEJORADO
   ======================================== */

.form-input,
.form-select,
.form-textarea {
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  background-color: white;
  width: 100%;
  box-sizing: border-box;
}

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

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.form-input[readonly],
.form-textarea[readonly] {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
  border-color: #e5e7eb;
}

textarea.form-input,
.form-textarea {
  resize: none;
  min-height: 2.5rem;
}

textarea.form-input.resize-vertical,
.form-textarea.resize-vertical {
  resize: vertical;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}

/* Choices.js dropdown fix */
.choices__list--dropdown {
  z-index: 100 !important;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-top: 0.25rem;
}

.choices__inner {
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  background-color: white;
  min-height: 2.5rem;
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.choices__list--dropdown .choices__item--selectable {
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

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

.choices__item--choice.is-selected {
  background-color: #dbeafe;
  color: #1e40af;
}

.choices[data-type*="select-one"] .choices__inner {
  padding-bottom: 0.625rem;
}

.choices__placeholder {
  opacity: 0.5;
}

.choices__list--dropdown .choices__item--selectable:active {
  background-color: #dbeafe;
}

.choices__list--dropdown .choices__item--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f9fafb;
  color: #9ca3af;
  text-decoration: line-through;
  pointer-events: none;
}

.choices__list--dropdown .choices__item--disabled:hover {
  background-color: #f9fafb;
  color: #9ca3af;
}

.choices__item[data-value*="COMPLETADO"] {
  font-weight: 600;
}

.choices__item[data-value*="ÚLTIMO"] {
  color: #f59e0b;
  font-weight: 500;
}

.muestra-summary {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  transition: all 0.15s ease;
  background-color: white;
}

.muestra-summary:hover {
  border-color: #3b82f6;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transform: translateX(2px);
}

.muestra-summary > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

.muestra-summary > div:first-child > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  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.5rem;
  height: 1.5rem;
  background-color: #3b82f6;
  color: white;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.muestra-summary > div:first-child > div:first-child p {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.summary-action-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: #6b7280;
  background-color: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.summary-action-btn:hover {
  color: #3b82f6;
  background-color: #eff6ff;
  border-color: #dbeafe;
}

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

.muestra-summary > p {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.muestra-summary > p span {
  font-weight: 600;
  color: #374151;
}

.muestra-summary > div:last-child {
  background-color: #f9fafb;
  padding: 0.5rem;
  border-radius: 0.375rem;
}

.muestra-summary > div:last-child > p {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 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.75rem;
  color: #6b7280;
  padding: 0.25rem 0;
  padding-left: 0.5rem;
  border-left: 2px solid #dbeafe;
  margin-bottom: 0.25rem;
}

.muestra-summary > div:last-child ul li:last-child {
  margin-bottom: 0;
}

.muestra-summary > div:last-child ul li.italic {
  color: #9ca3af;
  border-left-color: #e5e7eb;
}

.muestra-summary.enter-from {
  opacity: 0;
  transform: translateY(-8px);
}

.muestra-summary.enter-to {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   TABS SYSTEM - Para Informes Finales y Laboratorio
   ======================================== */
.tabs-container {
  position: relative;
}

.tabs-header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.tab-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-header:hover {
  color: #3b82f6;
  border-color: #93c5fd;
  background: #eff6ff;
}

.tab-header.active {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #3b82f6;
}

.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.25rem;
  color: #94a3b8;
  border-radius: 0.25rem;
  transition: all 0.15s ease;
}

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

.tab-content-wrapper {
  display: none;
}

.tab-content-wrapper:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.tab-content-wrapper.active {
  display: flex;
  flex-direction: column;
}

/* ========================================
   ESTILOS PARA ORDEN DE TRABAJO (OI)
   ======================================== */

/* Lista de FIMs - Items */
.fim-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.fim-list-item-selected {
  background: linear-gradient(to right, #eff6ff, #dbeafe);
  border-left: 4px solid #3b82f6;
}

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

.fim-list-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}

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

.fim-list-item-quote {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.fim-list-item-company {
  font-size: 0.8125rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fim-list-item-arrow {
  color: #94a3b8;
  font-size: 0.75rem;
  transition:
    transform 0.15s ease,
    color 0.15s ease;
}

.fim-list-item:hover .fim-list-item-arrow,
.fim-list-item-selected .fim-list-item-arrow {
  color: #3b82f6;
  transform: translateX(2px);
}

/* Muestras y Análisis en pestaña Gestión */
.oi-sample-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
}

.oi-sample-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(to right, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e2e8f0;
}

.oi-sample-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #3b82f6;
  cursor: pointer;
}

.oi-sample-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1e293b;
}

.oi-sample-subtitle {
  font-size: 0.8125rem;
  color: #64748b;
  margin-left: 0.5rem;
}

.oi-sample-body {
  padding: 0;
}

/* Items de análisis dentro de muestras */
.oi-analysis-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

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

.oi-analysis-item:hover {
  background: #fafafa;
}

.oi-analysis-checkbox {
  margin-top: 0.125rem;
  width: 1rem;
  height: 1rem;
  accent-color: #3b82f6;
  cursor: pointer;
}

.oi-analysis-content {
  flex: 1;
  min-width: 0;
}

.oi-analysis-code {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #1e40af;
}

.oi-analysis-name {
  font-size: 0.8125rem;
  color: #475569;
  margin-top: 0.125rem;
}

.oi-analysis-method {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Badge de estado */
.oi-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  white-space: nowrap;
}

.oi-status-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.oi-status-completed {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

/* Sección de Análisis Externos */
.oi-external-section {
  margin-top: 1.5rem;
}

.oi-external-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.oi-external-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(to right, #fffbeb, #fef3c7);
  border-bottom: 1px solid #fde68a;
}

.oi-external-sample-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #92400e;
}

.oi-external-sample-subtitle {
  font-size: 0.8125rem;
  color: #b45309;
  margin-left: 0.5rem;
}

.oi-external-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

@media (min-width: 640px) {
  .oi-external-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
}

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

.oi-external-info {
  flex: 1;
  min-width: 0;
}

.oi-external-code {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #1e40af;
}

.oi-external-method {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
  max-width: 100%;
  word-wrap: break-word;
  white-space: normal;
}

@media (min-width: 640px) {
  .oi-external-method {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
  }
}

.oi-external-lab-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: white;
  color: #374151;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .oi-external-lab-select {
    width: auto;
    min-width: 220px;
  }
}

.oi-external-lab-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Botones de generación de OI/Externa */
.oi-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.oi-generate-btn-primary {
  background: linear-gradient(to bottom, #3b82f6, #2563eb);
  color: white;
  border: none;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.oi-generate-btn-primary:hover {
  background: linear-gradient(to bottom, #2563eb, #1d4ed8);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.oi-generate-btn-external {
  background: linear-gradient(to bottom, #f59e0b, #d97706);
  color: white;
  border: none;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
}

.oi-generate-btn-external:hover {
  background: linear-gradient(to bottom, #d97706, #b45309);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4);
}

/* Botones de solicitud externa (dinámicos por laboratorio) */
.external-request-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  background: linear-gradient(to bottom, #f97316, #ea580c);
  color: white;
  border: none;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.3);
  transition: all 0.15s ease;
  cursor: pointer;
}

.external-request-btn:hover {
  background: linear-gradient(to bottom, #ea580c, #c2410c);
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.4);
  transform: translateY(-1px);
}

.external-request-btn:active {
  transform: translateY(0);
}

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

/* Datos del FIM - Pestaña Datos */
.oi-data-section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.oi-data-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  background: linear-gradient(to right, #3b82f6, #2563eb);
  color: white;
}

.oi-data-header i {
  font-size: 1rem;
}

.oi-data-header h3 {
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0;
}

.oi-data-body {
  padding: 1.25rem;
}

.oi-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.oi-data-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.oi-data-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.oi-data-value {
  font-size: 0.875rem;
  color: #1e293b;
  font-weight: 500;
}

/* Sample cards en Datos del FIM */
.oi-sample-detail-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  margin-top: 1rem;
  overflow: hidden;
}

.oi-sample-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(to right, #f1f5f9, #e2e8f0);
  border-bottom: 1px solid #e2e8f0;
}

.oi-sample-detail-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.oi-sample-detail-title i {
  color: #3b82f6;
}

.oi-sample-detail-body {
  padding: 1rem;
}

.oi-analysis-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.oi-analysis-detail-item:last-child {
  border-bottom: none;
}

.oi-analysis-detail-code {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #1e40af;
  min-width: 100px;
}

.oi-analysis-detail-info {
  flex: 1;
}

.oi-analysis-detail-name {
  font-size: 0.8125rem;
  color: #334155;
}

.oi-analysis-detail-method {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ========================================
   Página de Detalles de Cotización
   ======================================== */

.quote-details-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tarjetas de información */
.info-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.info-card .card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  padding: 1rem 1.25rem;
  background: linear-gradient(to right, #3b82f6, #2563eb);
  color: white;
  margin: 0;
}

.info-card .card-title i {
  font-size: 1rem;
  opacity: 0.9;
}

/* Grid de información */
.info-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
}

@media (min-width: 640px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .info-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.info-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.info-field p {
  font-size: 0.9375rem;
  color: #1e293b;
  font-weight: 500;
  margin: 0;
}

.info-field .field-detail {
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 400;
  margin-top: 0.125rem;
}

/* Tarjeta de items/servicios */
.items-table-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.items-table-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(to right, #059669, #047857);
}

.items-table-header .card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin: 0;
  padding: 0;
  background: none;
}

.items-table-header .card-title i {
  font-size: 1rem;
  opacity: 0.9;
}

.items-table-header .item-count {
  font-weight: 400;
  opacity: 0.9;
  font-size: 0.875rem;
}

/* Tabla de items */
.items-table-card table {
  width: 100%;
  border-collapse: collapse;
}

.items-table-card thead {
  background: #f8fafc;
}

.items-table-card th {
  padding: 0.875rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.items-table-card td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.items-table-card tbody tr:hover {
  background: #f8fafc;
}

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

.items-table-card tfoot {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
}

.items-table-card tfoot td {
  padding: 1rem;
  font-weight: 600;
  border-bottom: none;
}

/* Sección de comentarios */
.comments-text {
  font-size: 0.9375rem;
  color: #475569;
  line-height: 1.6;
  padding: 1.25rem;
  margin: 0;
}

/* Estado vacío de items */
.empty-message {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9375rem;
}

/* Card de error */
.error-card {
  background: white;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.error-icon {
  font-size: 3rem;
  color: #ef4444;
  margin-bottom: 1rem;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 0.9375rem;
  color: #dc2626;
  margin-bottom: 1.5rem;
}

/* ========================================
   MOBILE-FIRST RESPONSIVE SYSTEM
   Sistema completo de adaptación mobile
   ======================================== */

/* ----------------------------------------
   1. TABLAS RESPONSIVE (Card Layout)
   ---------------------------------------- */
.table-mobile-cards {
  width: 100%;
}

/* En mobile: Convertir a cards */
@media (max-width: 767px) {
  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .table-mobile-cards tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .table-mobile-cards tbody tr:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    transition: all 0.2s ease;
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    gap: 0.5rem;
    font-size: 0.875rem;
  }

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

  /* Header de cada card (primera celda) */
  .table-mobile-cards tbody td:first-child {
    background: #f8fafc;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
  }

  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    flex-shrink: 0;
    min-width: 100px;
  }

  .table-mobile-cards tbody td:first-child::before {
    display: none;
  }

  /* Celda de acciones */
  .table-mobile-cards tbody td[data-label="Acciones"],
  .table-mobile-cards tbody td[data-label="Acción"],
  .table-mobile-cards tbody td.cell-actions {
    background: #f8fafc;
    justify-content: center;
    padding: 0.875rem 1rem;
  }

  .table-mobile-cards tbody td[data-label="Acciones"]::before,
  .table-mobile-cards tbody td[data-label="Acción"]::before,
  .table-mobile-cards tbody td.cell-actions::before {
    display: none;
  }
}

/* ----------------------------------------
   2. MODALES RESPONSIVE
   ---------------------------------------- */
@media (max-width: 639px) {
  .modal-backdrop,
  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal,
  .modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 1rem 1rem 0 0;
    margin: 0;
  }

  .modal-header {
    padding: 1rem;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
  }

  .modal-title {
    font-size: 1rem;
  }

  .modal-body {
    padding: 1rem;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
  }

  .modal-footer,
  .modal-actions {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    position: sticky;
    bottom: 0;
    background: #f9fafb;
  }

  .modal-footer button,
  .modal-actions button {
    width: 100%;
    justify-content: center;
  }

  /* Modal grande en mobile */
  .modal-lg,
  .modal-xl {
    max-width: 100%;
  }
}

/* ----------------------------------------
   3. SELECTORES MEJORADOS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  select,
  .form-select {
    font-size: 16px !important; /* Evita zoom en iOS */
    padding: 0.75rem 1rem;
    min-height: 48px;
  }

  /* Filtros en toolbar */
  .filter-select-mobile {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* ----------------------------------------
   4. PAGINACIÓN RESPONSIVE
   ---------------------------------------- */
.pagination-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

@media (max-width: 639px) {
  #pagination-container,
  .pagination-container {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  #pagination-container .text-sm,
  .pagination-container .text-sm {
    order: 2;
    font-size: 0.8125rem;
  }

  #pagination-container .flex.items-center.gap-2,
  .pagination-container .flex.items-center.gap-2 {
    order: 1;
    justify-content: center;
    width: 100%;
  }

  #pagination-container button,
  .pagination-container button {
    flex: 1;
    justify-content: center;
    max-width: 140px;
  }
}

/* ----------------------------------------
   5. TOOLBAR/FILTROS RESPONSIVE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de filtros */
  .filters-toolbar {
    flex-direction: column;
    gap: 0.75rem;
  }

  .filters-toolbar .flex.items-center.gap-2,
  .filters-toolbar .flex.items-center.gap-4 {
    flex-wrap: wrap;
    width: 100%;
  }

  .filters-toolbar .flex.items-center.gap-2 > *,
  .filters-toolbar .flex.items-center.gap-4 > * {
    flex: 1 1 auto;
    min-width: 120px;
  }

  /* Labels de filtros */
  .filters-toolbar label {
    display: none;
  }

  /* Búsqueda full width */
  .search-bar-container {
    width: 100%;
    max-width: none;
  }
}

/* ----------------------------------------
   6. CARDS Y CONTENEDORES
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Padding reducido en cards */
  .card-body,
  .card-header,
  .card-footer {
    padding: 1rem;
  }

  /* Info cards */
  .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Stats cards en grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }
}

/* ----------------------------------------
   7. BOTONES MOBILE - Mejorado
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Botones táctiles con tamaños apropiados */
  .btn {
    min-height: 42px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    gap: 0.375rem;
  }

  /* Evitar que botones genéricos hereden estilos incorrectos */
  button:not(.btn):not([class*="btn-"]) {
    min-height: auto;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }

  .btn-lg {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
  }

  /* Botones en grupo */
  .btn-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .btn-group-mobile > * {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------
   8. PÁGINA INFORMES FINALES - MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Tabla de FIMs como cards */
  #fim-search-results-body tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }

  #fim-search-results-body td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
  }

  #fim-search-results-body td:last-child {
    border-bottom: none;
    background: #f8fafc;
    justify-content: center;
  }

  #fim-search-results-body td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
  }

  /* Ocultar thead */
  .tabs-container table thead {
    display: none;
  }

  .tabs-container table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ----------------------------------------
   9. PÁGINA LABORATORIO - MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Cards de informes firmados */
  #signed-reports-body tr,
  .signed-reports-table tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }
}

/* ----------------------------------------
   10. PÁGINA USUARIOS - MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Tabla de usuarios como cards */
  .table-standard tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }

  .table-standard thead {
    display: none;
  }

  .table-standard tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .table-standard tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
  }

  .table-standard tbody td:last-child {
    border-bottom: none;
    background: #f8fafc;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .table-standard tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
  }
}

/* ----------------------------------------
   11. TOASTS RESPONSIVE
   ---------------------------------------- */
@media (max-width: 639px) {
  #toast-container {
    left: 0.5rem;
    right: 0.5rem;
    top: auto;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
    width: 100%;
  }
}

/* ----------------------------------------
   12. HEADER MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Título de página */
  header h1 {
    font-size: 1rem;
  }

  /* User dropdown */
  #dropdown-button .hidden.md\\:block {
    display: none !important;
  }

  /* Iconos de header */
  header .flex.items-center.gap-3 {
    gap: 0.5rem;
  }
}

/* ----------------------------------------
   13. ESPACIADO GENERAL MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Main content padding */
  main {
    padding: 0.75rem;
  }

  main > .p-6,
  main > .px-6,
  main > div > .p-6 {
    padding: 0.75rem;
  }

  /* Gaps reducidos */
  .gap-6 {
    gap: 1rem;
  }

  .gap-4 {
    gap: 0.75rem;
  }

  /* Cards full width */
  .bg-white.rounded-xl,
  .bg-white.rounded-lg {
    border-radius: 0.75rem;
  }
}

/* ----------------------------------------
   14. FORMULARIOS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  .form-group {
    margin-bottom: 1rem;
  }

  .form-label {
    font-size: 0.8125rem;
  }

  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  textarea {
    font-size: 16px; /* Evita zoom iOS */
    padding: 0.75rem;
    min-height: 48px;
  }

  textarea {
    min-height: 100px;
  }
}

/* ----------------------------------------
   15. TABS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  .tabs-header-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tabs-header-row::-webkit-scrollbar {
    display: none;
  }

  .tab-header {
    white-space: nowrap;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }
}

/* ----------------------------------------
   16. ALERTAS/MENSAJES MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  .alert {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
  }

  .alert .flex.items-center.gap-3 {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .alert svg,
  .alert i {
    font-size: 1.5rem;
  }
}

/* ----------------------------------------
   17. DATOS DEL CLIENTE - MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Info del cliente en cards - usando clase específica */
  .client-info-mobile .flex {
    flex-direction: column;
    gap: 0.125rem;
  }

  .client-info-mobile .flex .font-bold {
    font-size: 0.6875rem;
    color: #64748b;
  }

  .client-info-mobile .flex span:last-child {
    font-size: 0.8125rem;
    color: #1e293b;
  }
}

/* ----------------------------------------
   18. QUOTE CARDS MOBILE - Mejoras Completas
   ---------------------------------------- */

/* Contenedor de lista mobile */
.quotes-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Card individual */
.quotes-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Header de la card - ULTRA COMPACTO */
.quote-card-header {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 0.25rem 0.5rem 0.125rem !important;
  border-bottom: 1px solid #f3f4f6;
  text-align: center;
}

.quote-card-info {
  flex: 1;
  min-width: 0;
}

.quote-card-title-btn {
  display: block;
  text-align: center;
  background: none;
  border: none;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  width: 100%;
}

.quote-card-title {
  font-size: 0.8125rem !important;
  font-weight: 600;
  color: #1e293b;
  margin: 0 !important;
  line-height: 1.1 !important;
}

.quote-card-subtitle {
  font-size: 0.625rem !important;
  color: #64748b;
  margin: 0 !important;
  line-height: 1.1 !important;
}

/* Summary - Badge centrado SIN margen */
.quote-card-summary {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.125rem !important;
  flex-wrap: wrap;
  margin: 0.125rem 0 0 0 !important;
  padding: 0 !important;
}

.quote-card-fim {
  flex-shrink: 0;
}

.quote-card-total {
  font-size: 0.6875rem !important;
  font-weight: 600;
  color: #374151;
  margin: 0 !important;
}

/* Acciones de la card - MUY COMPACTAS */
.quote-card-actions {
  padding: 0.1875rem 0.375rem !important;
  background: #f8fafc;
}

.quote-card-buttons {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.25rem !important;
  margin: 0 !important;
}

.quote-card-buttons .btn {
  flex: 1 1 calc(50% - 0.125rem);
  min-width: 0;
  padding: 0.25rem 0.375rem !important;
  font-size: 0.6875rem !important;
  justify-content: center;
  min-height: 26px !important;
  height: auto !important;
}

.quote-card-buttons .btn i {
  font-size: 0.6875rem !important;
}

.quote-card-buttons .btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.6875rem !important;
}

/* Botón de detalle - MÍNIMO */
.quote-card-actions > .btn-link {
  display: block;
  text-align: center;
  padding: 0 !important;
  font-size: 0.625rem !important;
  color: #3b82f6;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  margin: 0.0625rem 0 0 0 !important;
  line-height: 1.2 !important;
}

.quote-card-actions > .btn-link:hover {
  text-decoration: underline;
}

/* FIM Pill - COMPACTO */
.quote-card-fim .badge,
.quote-card-fim .fim-pill {
  font-size: 0.625rem !important;
  padding: 0.0625rem 0.25rem !important;
  line-height: 1.2 !important;
}

/* ----------------------------------------
   19. EMPTY STATES MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  .empty-state,
  [class*="empty"] {
    padding: 2rem 1rem;
  }

  .empty-state i,
  [class*="empty"] i {
    font-size: 2.5rem;
  }

  .empty-state p,
  [class*="empty"] p {
    font-size: 0.875rem;
  }
}

/* ----------------------------------------
   20. DROPDOWN MENUS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  #dropdown-menu {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: auto;
    bottom: 1rem;
    width: auto;
    max-width: none;
    border-radius: 0.75rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }

  #dropdown-menu a,
  #dropdown-menu button {
    padding: 1rem;
    font-size: 1rem;
  }
}

/* ----------------------------------------
   21. MEJORAS GLOBALES MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedores principales */
  .max-w-7xl {
    padding-left: 0;
    padding-right: 0;
  }

  /* Padding de main reducido */
  main.p-4,
  main.p-6,
  main.p-8 {
    padding: 0.5rem !important;
  }

  /* Cards principales sin bordes redondeados en móvil muy pequeño */
  .bg-white.rounded-xl.shadow-sm {
    border-radius: 0.625rem;
    margin: 0 -0.25rem;
  }

  /* Headers de sección */
  .px-4.py-4,
  .px-6.py-4 {
    padding: 0.75rem !important;
  }

  /* Títulos */
  h2.text-lg {
    font-size: 1rem;
    line-height: 1.4;
  }

  /* Descripciones ocultas en móvil muy pequeño */
  p.text-sm.text-gray-600.hidden {
    display: none !important;
  }

  /* Botones de acción principales */
  .btn.w-full,
  button.w-full {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  /* Iconos en botones */
  .btn i,
  button i {
    font-size: 0.875rem;
  }

  /* Badges y pills */
  .badge,
  .pill,
  [class*="badge-"],
  [class*="pill-"] {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.5rem;
  }
}

/* ----------------------------------------
   22. AJUSTES DE OVERFLOW Y LÍMITES
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Prevenir overflow horizontal */
  body {
    overflow-x: hidden;
  }

  /* Contenedores que pueden causar overflow */
  .overflow-x-auto {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  /* Textos largos */
  .truncate,
  [class*="truncate"] {
    max-width: 100%;
  }

  /* Flex items que no deben desbordar */
  .flex > * {
    min-width: 0;
  }

  /* Tablas */
  table {
    width: 100%;
    table-layout: fixed;
  }
}

/* ----------------------------------------
   23. TIPOGRAFÍA MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Tamaños de fuente consistentes */
  .text-xs {
    font-size: 0.6875rem;
  }

  .text-sm {
    font-size: 0.8125rem;
  }

  .text-base {
    font-size: 0.875rem;
  }

  .text-lg {
    font-size: 1rem;
  }

  .text-xl {
    font-size: 1.125rem;
  }

  /* Line heights */
  p,
  span,
  div {
    line-height: 1.5;
  }
}

/* ----------------------------------------
   24. ICONOS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Tamaños de iconos Font Awesome */
  .fa-lg {
    font-size: 1rem;
  }

  .fa-xl,
  .fa-2x {
    font-size: 1.25rem;
  }

  .fa-3x {
    font-size: 1.5rem;
  }

  /* Iconos en headers */
  header i,
  .card-title i {
    font-size: 0.875rem;
  }

  /* Iconos en botones - ya definido arriba */
}

/* ----------------------------------------
   25. ESPACIADO ENTRE ELEMENTOS
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Gaps más pequeños */
  .gap-4 {
    gap: 0.625rem;
  }

  .gap-3 {
    gap: 0.5rem;
  }

  .gap-2 {
    gap: 0.375rem;
  }

  /* Space-y */
  .space-y-4 > * + * {
    margin-top: 0.625rem;
  }

  .space-y-3 > * + * {
    margin-top: 0.5rem;
  }

  /* Margin y padding */
  .p-6 {
    padding: 0.75rem;
  }

  .p-4 {
    padding: 0.625rem;
  }

  .px-6 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .py-4 {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }
}
/* ----------------------------------------
   26. TOOLBAR Y FILTROS MOBILE - Específico
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de filtros */
  .px-4.sm\:px-6.py-4.border-b {
    padding: 0.75rem !important;
  }

  /* Selects en mobile */
  select {
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    font-size: 0.875rem;
    background-position: right 0.5rem center;
  }

  /* Input de búsqueda */
  input[type="text"],
  input[type="search"] {
    min-height: 44px;
    font-size: 0.875rem;
  }

  /* Flex containers en filtros */
  .flex.flex-col.sm\:flex-row {
    flex-direction: column !important;
  }

  /* Items de filtro ocupan todo el ancho */
  .flex.items-center.gap-2.flex-1.sm\:flex-none {
    width: 100%;
  }

  /* Labels ocultos en móvil muy pequeño */
  label.text-sm.text-gray-600.whitespace-nowrap.hidden.sm\:inline {
    display: none !important;
  }
}

/* ----------------------------------------
   27. BOTÓN ACTUALIZAR MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Botón de actualizar */
  #quotes-refresh-btn,
  button[id$="-refresh-btn"],
  .refresh-btn {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    min-height: 40px;
  }

  /* Header de card con título y botón */
  .px-4.sm\:px-6.py-4.flex.flex-col.sm\:flex-row {
    padding: 0.75rem !important;
    gap: 0.75rem !important;
  }

  /* Título h2 */
  h2.text-lg.font-semibold {
    font-size: 1rem;
    margin-bottom: 0;
  }
}

/* ----------------------------------------
   28. CARDS MOBILE - Estructura general con espaciado
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor principal de la card blanca */
  .bg-white.rounded-xl.shadow-sm.border {
    border-radius: 0.5rem;
    margin: 0;
  }

  /* Secciones dentro de la card - padding compacto */
  .px-4.sm\:px-6.py-4 {
    padding: 0.5rem 0.625rem !important;
  }

  /* Border bottom en secciones */
  .border-b.border-gray-200 {
    border-color: #e5e7eb;
  }
}

/* ----------------------------------------
   29. QUOTES MOBILE - Cards SUPER compactas
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Lista de cotizaciones mobile - gap mínimo */
  .quotes-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0;
  }

  /* Card individual */
  .quotes-card {
    margin: 0;
    border-radius: 0.375rem;
  }

  /* Header - SIN espacio extra */
  .quote-card-header {
    padding: 0.25rem 0.5rem 0.1875rem !important;
    gap: 0 !important;
  }

  /* Título - pegado */
  .quote-card-title {
    font-size: 0.75rem !important;
    line-height: 1.1 !important;
    margin: 0 !important;
  }

  /* Subtítulo - pegado al título */
  .quote-card-subtitle {
    font-size: 0.5625rem !important;
    line-height: 1.1 !important;
    margin: 0 !important;
  }

  /* Summary - mínimo margen */
  .quote-card-summary {
    margin: 0.125rem 0 0 0 !important;
    padding: 0 !important;
    gap: 0.125rem !important;
  }

  /* FIM badge */
  .quote-card-fim .fim-pill,
  .quote-card-fim .badge {
    font-size: 0.5625rem !important;
    padding: 0.0625rem 0.25rem !important;
    line-height: 1.2 !important;
  }

  /* Acciones - padding mínimo */
  .quote-card-actions {
    padding: 0.1875rem 0.375rem !important;
  }

  /* Botones - gap mínimo */
  .quote-card-buttons {
    gap: 0.25rem !important;
    margin-bottom: 0 !important;
  }

  /* Link detalle - sin espacio extra */
  .quote-card-actions > .btn-link {
    padding: 0.0625rem !important;
    font-size: 0.5625rem !important;
    margin: 0 !important;
  }
}

/* ----------------------------------------
   30. PAGINACIÓN MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Container de paginación */
  #pagination-container {
    padding: 0.75rem;
  }

  /* Solo afectar contenedores de paginación, NO headers */
  #pagination-container > div {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  /* Info de paginación */
  #pagination-container .text-sm.text-gray-600 {
    text-align: center;
    font-size: 0.75rem;
  }

  /* Controles de navegación */
  #pagination-container .flex.gap-2 {
    justify-content: center;
  }

  /* Botones de paginación */
  #pagination-container button {
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ----------------------------------------
   31. RESPONSIVE TABLES GENÉRICO
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Ocultar tabla default en contenedor */
  #quotes-table-container > table {
    display: none;
  }

  /* Mostrar solo la lista mobile */
  #quotes-table-container .quotes-mobile-list {
    display: flex;
  }

  /* Border del contenedor */
  #quotes-table-container {
    border: none;
    border-radius: 0;
    overflow: visible;
  }
}

/* ----------------------------------------
   32. TABLA MOBILE CARDS (class-based)
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Tablas con clase table-mobile-cards */
  .table-mobile-cards {
    display: block;
    border: none;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
  }

  .table-mobile-cards tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    margin: 0;
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    gap: 0.5rem;
  }

  .table-mobile-cards tbody td:last-child {
    border-bottom: none;
    background: #f8fafc;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.6875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    flex-shrink: 0;
    min-width: 5rem;
  }

  /* Celda de acciones - sin label */
  .table-mobile-cards tbody td.cell-actions::before,
  .table-mobile-cards tbody td[data-label="Acciones"]::before {
    display: none;
  }

  /* Botones en celda de acciones */
  .table-mobile-cards tbody td.cell-actions,
  .table-mobile-cards tbody td[data-label="Acciones"] {
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
  }

  .table-mobile-cards tbody td.cell-actions .btn,
  .table-mobile-cards tbody td[data-label="Acciones"] .btn,
  .table-mobile-cards tbody td.cell-actions button,
  .table-mobile-cards tbody td[data-label="Acciones"] button {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    min-height: 32px;
  }

  .table-mobile-cards tbody td.cell-actions .btn i,
  .table-mobile-cards tbody td[data-label="Acciones"] .btn i {
    font-size: 0.75rem;
  }
}

/* ----------------------------------------
   33. USUARIOS TABLE MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  #users-table-container {
    border: none;
    overflow: visible;
  }

  #users-table-container > table,
  #users-table-body {
    border: none;
  }
}

/* ----------------------------------------
   34. ADMIN QUOTES MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  #admin-quotes-container {
    border: none;
    overflow: visible;
  }
}

/* ----------------------------------------
   35. FINAL REPORT MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  #fim-search-results-container {
    border: none;
    overflow: visible;
  }
}

/* ----------------------------------------
   36. LAB MOBILE
   ---------------------------------------- */
@media (max-width: 767px) {
  #signed-reports-container,
  .signed-reports-table {
    border: none;
    overflow: visible;
  }
}

/* ========================================
   SISTEMA MOBILE MEJORADO V3
   ======================================== */

/* ----------------------------------------
   37. HEADER MOBILE V3 - SIMPLIFICADO
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Header - solo ajustes mínimos */
  header.sticky,
  header[role="banner"] {
    height: auto !important;
    min-height: 52px;
  }

  /* Título más pequeño */
  header h1 {
    font-size: 1rem !important;
    font-weight: 600 !important;
  }

  /* Ocultar icono decorativo del título */
  header .hidden.sm\:flex {
    display: none !important;
  }

  /* Avatar más pequeño */
  #dropdown-button .w-8,
  #dropdown-button .w-9 {
    width: 32px !important;
    height: 32px !important;
  }

  #user-initials {
    font-size: 0.6875rem !important;
  }

  /* Ocultar texto del usuario */
  #dropdown-button .hidden.md\:block {
    display: none !important;
  }

  /* Ocultar chevron */
  #dropdown-button .fa-chevron-down {
    display: none !important;
  }
}

/* ----------------------------------------
   38. BUSCADOR Y FILTROS MOBILE V2
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de toolbar */
  .px-6.py-4.border-b,
  .px-4.sm\:px-6.py-4.border-b {
    padding: 0.875rem !important;
  }

  /* Input de búsqueda - full width pero con altura controlada */
  input[type="text"],
  input[type="search"] {
    min-height: 42px;
    height: 42px;
    font-size: 16px; /* Evita zoom en iOS */
    padding-left: 2.5rem !important;
    padding-right: 2.25rem !important;
    border-radius: 0.5rem;
  }

  /* Placeholder más legible */
  input::placeholder {
    font-size: 0.8125rem;
    color: #9ca3af;
  }

  /* Icono de búsqueda - posición fija */
  .relative .fa-search,
  .relative i.fa-search {
    position: absolute;
    left: 0.75rem !important;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    pointer-events: none;
    color: #9ca3af;
  }

  /* Botón limpiar */
  #clearSearchBtn,
  #clear-search,
  .clear-search-btn,
  button[id*="clear"] {
    position: absolute;
    right: 0.625rem !important;
    top: 50%;
    transform: translateY(-50%);
  }

  /* Contenedor de filtros - flex row wrap */
  .flex.flex-col.sm\:flex-row.items-stretch {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  /* Cada grupo de filtro */
  .flex.items-center.gap-2.flex-1 {
    flex: 1 1 calc(50% - 0.25rem) !important;
    min-width: 0;
    width: auto !important;
  }

  /* Selects de filtro - NO full width */
  select {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 40px;
    height: 40px;
    font-size: 0.8125rem;
    padding: 0.5rem 2rem 0.5rem 0.625rem;
    background-position: right 0.5rem center;
    border-radius: 0.5rem;
  }

  /* Labels de filtro - ocultos pero select tiene placeholder */
  label.text-sm.text-gray-600 {
    display: none !important;
  }

  /* Gap en contenedores de filtro */
  .flex.flex-col.gap-3,
  .flex.flex-col.gap-4 {
    gap: 0.75rem;
  }

  /* Botón de acción (Actualizar, Nuevo, etc) */
  button.inline-flex.items-center.gap-2 {
    width: auto !important;
    flex: 0 0 auto;
    padding: 0.5rem 0.875rem !important;
    font-size: 0.8125rem !important;
  }

  /* Botón refresh en header de card - auto width */
  #final-report-refresh-btn,
  #quotes-refresh-btn,
  #users-refresh-btn,
  #oi-refresh-btn,
  #catalogs-refresh-btn,
  [id$="-refresh-btn"] {
    width: auto !important;
    min-width: fit-content;
  }
}

/* ----------------------------------------
   39. CARDS DE CONTENIDO MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Main content - MÁS espaciado lateral */
  #main-content,
  main[role="main"] {
    padding: 0.75rem 1rem !important;
  }

  /* Contenedor max-w - sin padding extra */
  .max-w-7xl {
    margin: 0;
    padding: 0;
  }

  /* Card principal contenedora - CON PADDING INTERNO */
  .bg-white.rounded-xl.shadow-sm.border {
    border-radius: 0.75rem;
    margin: 0;
  }

  /* Padding dentro de la card contenedora para quotes */
  .bg-white.rounded-xl.shadow-sm.border .p-4,
  .bg-white.rounded-xl.shadow-sm.border .px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Header de card */
  .px-6.py-4.flex.items-center.justify-between,
  .px-4.sm\:px-6.py-4.flex {
    padding: 0.875rem !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    flex-wrap: wrap;
  }

  /* Contenedor de título en header de card */
  .px-4.sm\:px-6.py-4.flex > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Título de sección */
  h2.text-lg {
    font-size: 1rem;
    line-height: 1.3;
  }

  /* Descripción de sección - ocultar en mobile muy pequeño */
  .px-6.py-4 p.text-sm.text-gray-600 {
    display: none;
  }

  /* Botón de actualizar - full width */
  .px-6.py-4 button[id$="-refresh"],
  .px-6.py-4 button[id$="-refresh-btn"],
  #quotes-refresh-btn,
  #signed-reports-refresh {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------
   40. TABLAS MOBILE - SISTEMA CARDS V2 COMPACTO
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Contenedores de tabla con margen lateral */
  .overflow-x-auto.border {
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    margin: 0 0.25rem;
  }

  /* Tablas que se convierten a cards */
  .table-mobile-cards,
  table.w-full {
    display: block;
  }

  .table-mobile-cards thead,
  table.w-full thead {
    display: none;
  }

  .table-mobile-cards tbody,
  table.w-full tbody {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .table-mobile-cards tbody tr,
  table.w-full tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    overflow: hidden;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .table-mobile-cards tbody td,
  table.w-full tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    gap: 0.5rem;
    min-height: auto;
    font-size: 0.75rem;
  }

  .table-mobile-cards tbody td:last-child,
  table.w-full tbody td:last-child {
    border-bottom: none;
    background: #f8fafc;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
  }

  /* Labels de datos */
  .table-mobile-cards tbody td::before,
  table.w-full tbody td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.625rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    flex-shrink: 0;
    min-width: 5rem;
  }

  /* Celda de acciones */
  td.cell-actions::before,
  td[data-label="Acciones"]::before {
    display: none !important;
  }
}

/* ----------------------------------------
   41. TABLA DE ANÁLISIS MOBILE (Informe Final)
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Tabla de análisis dentro del tab */
  #results-container table,
  [id^="results-container-"] table {
    display: block;
    font-size: 0.75rem;
  }

  [id^="results-container-"] thead {
    display: none;
  }

  [id^="results-container-"] tbody {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  [id^="results-container-"] tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
  }

  [id^="results-container-"] tbody td {
    display: flex;
    flex-direction: column;
    padding: 0.375rem 0;
    border: none !important;
    width: 100% !important;
    gap: 0.25rem;
  }

  /* Inputs en tabla de análisis */
  [id^="results-container-"] input {
    width: 100% !important;
    min-height: 36px;
    font-size: 0.8125rem !important;
  }

  /* Lista de datos de muestra */
  .sample-data-list {
    font-size: 0.6875rem !important;
    line-height: 1.4 !important;
  }

  .sample-data-list li {
    margin-bottom: 0.125rem;
  }
}

/* ----------------------------------------
   42. BOTONES DE ACCIÓN MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de botones de acción */
  .table-actions,
  .quote-card-buttons,
  .flex.gap-2.flex-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    width: 100%;
  }

  /* Botones dentro de contenedor de acciones */
  .table-actions .btn,
  .table-actions button,
  .quote-card-buttons .btn,
  td.cell-actions .btn,
  td.cell-actions button,
  td[data-label="Acciones"] .btn,
  td[data-label="Acciones"] button {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    min-height: 36px;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Botones de 3 o más - el último ocupa toda la fila */
  .table-actions .btn:nth-child(3),
  .quote-card-buttons .btn:nth-child(3) {
    flex: 1 1 100%;
  }

  /* Iconos en botones pequeños */
  .table-actions .btn i,
  .table-actions button i,
  td.cell-actions .btn i,
  td.cell-actions button i {
    font-size: 0.75rem;
  }

  /* Texto en botones - truncar si es necesario */
  .table-actions .btn span,
  .table-actions button span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ----------------------------------------
   43. PAGINACIÓN MOBILE V2
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Container de paginación */
  #pagination-container {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  /* Controles de navegación */
  #pagination-container .flex.gap-2 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    order: 1;
  }

  /* Texto informativo */
  #pagination-container .text-sm {
    text-align: center;
    font-size: 0.75rem;
    order: 2;
  }

  /* Botones de paginación */
  #pagination-container button,
  #prev-page,
  #next-page,
  #pagination-prev,
  #pagination-next {
    min-height: 40px;
    min-width: 40px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Ocultar texto en botones de paginación mobile */
  #prev-page span,
  #next-page span,
  #pagination-prev span,
  #pagination-next span {
    display: none;
  }

  /* Número de página */
  #page-numbers,
  #pagination-current {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ----------------------------------------
   44. SECCIÓN DE ABREVIATURAS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de abreviaturas */
  .abbreviations-section,
  [class*="abbreviations"] {
    padding: 0.75rem;
  }

  /* Título de abreviaturas */
  .abbreviations-section h3,
  h4.text-sm.font-semibold {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
  }

  /* Pills de abreviaturas */
  .abbreviation-pill,
  .abbrev-tag,
  .inline-flex.items-center.gap-1.px-2 {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
  }

  /* Grid de abreviaturas */
  .flex.flex-wrap.gap-2 {
    gap: 0.375rem;
  }
}

/* ----------------------------------------
   45. BOTONES PRINCIPALES MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor de botones al final de un tab */
  .flex.gap-2.mt-4,
  .flex.gap-3.mt-4,
  .flex.flex-wrap.gap-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  /* Botones principales de acción (guardar, ver, etc) */
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .btn-success,
  .btn-warning,
  button[data-action] {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 44px;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    justify-content: center;
    text-align: center;
  }

  /* Botón que ocupa todo el ancho (cuando es único o especial) */
  .btn.w-full,
  button.w-full,
  .btn-primary:only-child,
  .btn-secondary:only-child {
    flex: 1 1 100%;
  }

  /* Badge de estado en botones */
  .btn .badge,
  button .badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
  }
}

/* ----------------------------------------
   46. SUBMIT REPORT PAGE MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Header de página de cargar informe */
  .flex.items-center.gap-3 > div > h1 {
    font-size: 0.9375rem !important;
  }

  /* Tabla de informes firmados */
  #signed-reports-body tr {
    display: flex;
    flex-direction: column;
  }

  #signed-reports-body td {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid #f3f4f6;
  }

  #signed-reports-body td:last-child {
    justify-content: center;
    background: #f8fafc;
    padding: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
}

/* ----------------------------------------
   47. ESPACIADO Y OVERFLOW MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Prevenir overflow horizontal */
  body {
    overflow-x: hidden;
  }

  main {
    padding: 0.5rem !important;
  }

  /* Max width containers */
  .max-w-7xl,
  .max-w-6xl,
  .max-w-5xl {
    padding-left: 0;
    padding-right: 0;
  }

  /* Truncar textos largos */
  .truncate {
    max-width: 100%;
  }

  /* Flex items no desbordan */
  .flex > * {
    min-width: 0;
  }
}

/* ----------------------------------------
   48. TABS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Header de tabs */
  .tabs-header-row {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    padding: 0 0.5rem;
  }

  .tabs-header-row::-webkit-scrollbar {
    display: none;
  }

  /* Tab individual */
  .tab-header {
    flex-shrink: 0;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  /* Contenido del tab */
  .tab-content,
  .tab-content-wrapper {
    padding: 0.5rem;
  }
}

/* ----------------------------------------
   49. ANÁLISIS TABLE MOBILE - MEJORADO
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Contenedor de tabla de análisis - scroll horizontal suave */
  [id^="results-container-"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
  }

  /* Tabla con ancho mínimo para evitar aplastamiento */
  [id^="results-container-"] table {
    min-width: 700px;
    font-size: 0.6875rem;
    border-collapse: collapse;
  }

  /* Celdas más compactas */
  [id^="results-container-"] th,
  [id^="results-container-"] td {
    padding: 0.375rem 0.25rem;
    vertical-align: top;
  }

  /* Headers de tabla */
  [id^="results-container-"] th {
    font-size: 0.625rem !important;
    padding: 0.5rem 0.25rem;
  }

  /* Inputs en la tabla */
  [id^="results-container-"] input {
    min-height: 32px;
    font-size: 0.75rem !important;
    padding: 0.375rem;
    width: 100%;
  }

  /* Lista de datos de muestra compacta */
  .sample-data-list {
    font-size: 0.5625rem !important;
    line-height: 1.4 !important;
    margin: 0;
    padding: 0;
  }

  .sample-data-list li {
    margin-bottom: 0.125rem !important;
  }

  .sample-data-list strong {
    font-weight: 600;
    display: inline-block;
    min-width: 60px;
  }

  /* Indicador de scroll horizontal */
  [id^="results-container-"]::after {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    opacity: 0.3;
    margin-top: 0.5rem;
  }
}

/* Mobile muy pequeño - aún más compacto */
@media (max-width: 480px) {
  [id^="results-container-"] table {
    min-width: 600px;
    font-size: 0.625rem;
  }

  [id^="results-container-"] th {
    font-size: 0.5625rem !important;
    padding: 0.375rem 0.125rem;
    word-wrap: break-word;
  }

  [id^="results-container-"] td {
    padding: 0.25rem 0.125rem;
  }

  .sample-data-list {
    font-size: 0.5rem !important;
    line-height: 1.3 !important;
  }
}

/* ----------------------------------------
   50. FOOTER Y MODALES MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Modales */
  .modal,
  [role="dialog"] .modal {
    width: calc(100% - 1rem);
    max-width: none;
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
  }

  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
  }

  /* Footer de modal */
  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-footer button {
    width: 100%;
    justify-content: center;
  }
}

/* ----------------------------------------
   51. INFORME FINAL - TAB CONTENT MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Contenedor del tab de informe */
  .tab-content-wrapper .p-3,
  .tab-content-wrapper .p-4,
  .tab-content-wrapper .p-6 {
    padding: 0.5rem !important;
  }

  /* Grid de información del informe */
  .tab-content-wrapper .grid {
    gap: 0.5rem;
  }

  /* Labels más pequeños */
  .tab-content-wrapper .lbl,
  .tab-content-wrapper label {
    font-size: 0.625rem !important;
  }

  /* Inputs del informe */
  .tab-content-wrapper .inp,
  .tab-content-wrapper input[type="text"],
  .tab-content-wrapper textarea,
  .tab-content-wrapper select {
    font-size: 0.75rem !important;
    padding: 0.5rem !important;
    min-height: 36px;
  }

  /* Textarea más compacto */
  .tab-content-wrapper textarea {
    min-height: 60px !important;
    max-height: 120px !important;
  }

  /* Sección de abreviaturas */
  [id^="abbr-container-"] {
    gap: 0.25rem !important;
    flex-wrap: wrap;
  }

  [id^="abbr-container-"] span,
  [id^="abbr-container-"] .bg-gray-100 {
    font-size: 0.5625rem !important;
    padding: 0.25rem 0.375rem !important;
    max-width: calc(50% - 0.25rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Sección "Abreviaturas del Informe" título */
  .tab-content-wrapper h4 {
    font-size: 0.6875rem !important;
    margin-bottom: 0.375rem;
  }

  /* Estado aprobado/bloqueado */
  .tab-content-wrapper .bg-green-100,
  .tab-content-wrapper .bg-amber-100 {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.625rem !important;
  }

  .tab-content-wrapper .bg-green-100 i,
  .tab-content-wrapper .bg-amber-100 i {
    font-size: 0.75rem !important;
  }
}

/* ----------------------------------------
   52. HEADER DROPDOWN MOBILE MEJORADO
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Dropdown de usuario más compacto */
  #dropdown-options {
    width: calc(100vw - 2rem) !important;
    max-width: 280px;
    right: -0.5rem;
  }

  #dropdown-options .px-4 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  #dropdown-options a,
  #dropdown-options button {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }

  /* Botón de usuario header */
  #dropdown-button {
    padding: 0.375rem 0.5rem;
    gap: 0.25rem;
  }

  /* Iniciales más pequeñas en mobile */
  #dropdown-button .w-10 {
    width: 2rem;
    height: 2rem;
  }

  #user-initials {
    font-size: 0.6875rem !important;
  }
}

/* ----------------------------------------
   53. CONTENIDO PRINCIPAL MOBILE - ESPACIADO MEJORADO
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Main content con MÁS espacio lateral */
  #main-content,
  main {
    padding: 0.875rem 1rem !important;
  }

  /* Contenedor principal con padding */
  .max-w-7xl {
    padding: 0 0.125rem;
  }

  /* Cards principales */
  .bg-white.rounded-xl {
    border-radius: 0.5rem;
  }

  /* Headers de sección - compactos */
  .bg-white.rounded-xl > .px-4:first-child,
  .bg-white.rounded-xl > .px-6:first-child {
    padding: 0.625rem 0.75rem !important;
  }

  /* Título de sección */
  .bg-white.rounded-xl h2 {
    font-size: 0.9375rem !important;
  }

  /* Descripción oculta en mobile */
  .bg-white.rounded-xl .text-sm.text-gray-600 {
    display: none;
  }
}

/* ----------------------------------------
   54. BOTONES GLOBALES MOBILE - COMPACTOS
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Botones primarios - más compactos */
  .btn,
  [class*="bg-blue-600"],
  [class*="bg-green-600"],
  [class*="bg-red-600"],
  [class*="bg-amber-600"],
  [class*="bg-purple-600"] {
    padding: 0.375rem 0.625rem !important;
    font-size: 0.6875rem !important;
    min-height: 32px;
  }

  /* Íconos en botones */
  .btn i,
  button i.fas,
  button i.far {
    font-size: 0.6875rem !important;
    margin-right: 0.1875rem;
  }

  /* Botón de actualizar */
  #final-report-refresh-btn,
  [id$="-refresh-btn"] {
    padding: 0.375rem 0.625rem !important;
  }
}

/* ----------------------------------------
   55. INFORMACIÓN DE CLIENTE/EMPRESA MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Secciones de info en grid */
  .tab-content-wrapper .grid-cols-2,
  .tab-content-wrapper .sm\\:grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 0.375rem;
  }

  /* Info compacta en card */
  .tab-content-wrapper .bg-gray-50 {
    padding: 0.5rem !important;
  }

  .tab-content-wrapper .bg-gray-50 .text-xs {
    font-size: 0.5625rem !important;
    margin-bottom: 0.125rem;
  }

  .tab-content-wrapper .bg-gray-50 .text-sm,
  .tab-content-wrapper .bg-gray-50 .font-semibold {
    font-size: 0.75rem !important;
  }
}

/* ----------------------------------------
   56. SCROLL SUAVE Y OVERFLOW CONTROL
   ---------------------------------------- */
@media (max-width: 767px) {
  /* Scroll suave en todos los contenedores */
  .overflow-x-auto,
  .overflow-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Ocultar scrollbar pero mantener funcionalidad */
  .overflow-x-auto::-webkit-scrollbar {
    height: 4px;
  }

  .overflow-x-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
  }

  .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 2px;
  }

  /* Prevenir overflow en body */
  body {
    overflow-x: hidden;
  }

  /* Contenedores que pueden desbordar */
  .tab,
  .tab-content-wrapper,
  .tabs-container {
    overflow-x: hidden;
    max-width: 100vw;
  }
}

/* ----------------------------------------
   57. FIM TABS DINÁMICOS MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Header de tabs dinámicos (FIM) */
  .tabs-header-row {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0;
    gap: 0;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
  }

  .tabs-header-row::-webkit-scrollbar {
    display: none;
  }

  /* Cada tab header */
  .tab-header {
    flex-shrink: 0;
    padding: 0.625rem 0.75rem;
    font-size: 0.6875rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border-bottom: 2px solid transparent;
    min-width: fit-content;
  }

  .tab-header.active {
    border-bottom-color: #2563eb;
    background: white;
  }

  .tab-header i {
    font-size: 0.75rem;
  }

  /* Botón cerrar tab */
  .tab-header .close-tab,
  .tab-header button[aria-label*="Cerrar"] {
    padding: 0.125rem;
    font-size: 0.625rem;
    margin-left: 0.25rem;
  }

  /* Contenido del FIM tab */
  .tab[data-tab-id] {
    padding: 0;
  }

  .tab[data-tab-id] > .p-4,
  .tab[data-tab-id] > .p-6 {
    padding: 0.5rem !important;
  }

  /* Info header del FIM */
  .tab[data-tab-id] .bg-gradient-to-r {
    padding: 0.5rem !important;
    border-radius: 0.375rem;
  }

  .tab[data-tab-id] .bg-gradient-to-r h3 {
    font-size: 0.8125rem !important;
  }

  .tab[data-tab-id] .bg-gradient-to-r .text-xs,
  .tab[data-tab-id] .bg-gradient-to-r .text-sm {
    font-size: 0.625rem !important;
  }
}

/* ----------------------------------------
   58. CARDS DE COTIZACIÓN MOBILE
   ---------------------------------------- */
@media (max-width: 639px) {
  /* Cards de cotización en lista */
  .quote-card,
  [class*="quote-card"] {
    padding: 0.75rem;
  }

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

  .quote-card-header h3,
  .quote-card-header .font-bold {
    font-size: 0.875rem;
  }

  .quote-card-body {
    font-size: 0.75rem;
  }

  .quote-card-summary {
    gap: 0.375rem;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
  }

  .quote-card-summary > div {
    font-size: 0.6875rem;
  }

  /* Acciones de card */
  .quote-card-actions,
  .quote-card-footer {
    padding-top: 0.5rem;
    gap: 0.375rem;
    flex-wrap: wrap;
  }

  .quote-card-actions button,
  .quote-card-footer button {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    padding: 0.375rem 0.5rem;
    font-size: 0.625rem;
  }
}

/* ----------------------------------------
   59. RESPONSIVE UTILITIES
   ---------------------------------------- */
/* Ocultar en mobile */
@media (max-width: 639px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Mostrar solo en mobile */
@media (min-width: 640px) {
  .show-mobile-only {
    display: none !important;
  }
}

/* Texto truncado mobile */
@media (max-width: 639px) {
  .truncate-mobile {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .truncate-mobile-sm {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ========================================
   ZOOM GLOBAL - 90%
   ======================================== */
html {
  font-size: 90%;
}

/* ========================================
   SELECTS PERSONALIZADOS
   ======================================== */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

select:hover {
  border-color: #9ca3af;
  background-color: #f9fafb;
}

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

select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Select pequeño */
select.select-sm {
  padding: 0.375rem 2rem 0.375rem 0.625rem;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
}

/* ========================================
   PAGINACIÓN UNIFICADA
   ======================================== */
#pagination-container {
  padding: 0.75rem 1rem;
}

#pagination-container > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Info text */
#pagination-container .text-sm.text-gray-600 {
  font-size: 0.8125rem;
}

/* Controles de navegación */
#pagination-container .flex.gap-2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botones de paginación - estilo unificado */
#pagination-container button,
.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#pagination-container button:hover:not(:disabled),
.pagination-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

#pagination-container button:disabled,
.pagination-btn:disabled {
  background: #f9fafb;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  box-shadow: none;
}

#pagination-container button i,
.pagination-btn i {
  font-size: 0.75rem;
}

/* Indicador de página actual */
#pagination-container .font-semibold.text-gray-700,
#pagination-container span.px-3.py-2 {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  background: #f1f5f9;
  border-radius: 0.375rem;
}

/* ========================================
   ESTILOS DE FILTROS UNIFICADOS
   ======================================== */
.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

/* Contenedor de filtros responsive */
.filters-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* ========================================
   AJUSTES MOBILE PARA PAGINACIÓN
   ======================================== */
@media (max-width: 639px) {
  #pagination-container {
    padding: 0.625rem 0.75rem;
  }

  #pagination-container > div {
    flex-direction: column;
    gap: 0.5rem;
  }

  #pagination-container .text-sm.text-gray-600 {
    font-size: 0.75rem;
    text-align: center;
    order: 2;
  }

  #pagination-container .flex.gap-2 {
    order: 1;
    width: 100%;
    justify-content: center;
  }

  #pagination-container button {
    padding: 0.4375rem 0.625rem;
    font-size: 0.75rem;
  }

  #pagination-container button span {
    display: none;
  }

  #pagination-container .font-semibold.text-gray-700,
  #pagination-container span.px-3.py-2 {
    padding: 0.4375rem 0.625rem;
    font-size: 0.75rem;
  }

  /* Selects en mobile */
  select {
    font-size: 0.8125rem;
    padding: 0.4375rem 2rem 0.4375rem 0.625rem;
  }
}
