/* SODVENT 4.0.1 - Estilos personalizados */

:root {
  --primary: #102454;
  --secondary: #2abba5;
  --accent: #076d5d;
  --light: #d4d6d8;
}

/* Clases de color SODVENT para Tailwind */
.bg-sodvent-aqua {
  background-color: #2abba5 !important;
}

.bg-sodvent-green {
  background-color: #076d5d !important;
}

.bg-sodvent-blue {
  background-color: #102454 !important;
}

.text-sodvent-aqua {
  color: #2abba5 !important;
}

.text-sodvent-blue {
  color: #102454 !important;
}

.border-sodvent-aqua {
  border-color: #2abba5 !important;
}

.hover\:bg-sodvent-green:hover {
  background-color: #076d5d !important;
}

/* Estilos base */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* Botones personalizados */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--secondary);
  border-color: var(--secondary);
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Navegación activa */
.nav-active {
  background-color: var(--secondary);
  color: white;
  box-shadow: 0 2px 4px rgba(42, 187, 165, 0.3);
}

/* Cards de módulos */
.module-card {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--secondary);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Formularios */
.form-input {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.3s ease;
}

.form-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(42, 187, 165, 0.1);
  outline: none;
}

/* Tablas */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-striped tbody tr:nth-child(odd) {
  background-color: #f8f9fa;
}

.table-striped tbody tr:hover {
  background-color: rgba(42, 187, 165, 0.05);
}

/* Modal personalizado */
.modal-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Notificaciones toast */
.toast {
  animation: slideInRight 0.3s ease-out;
}

.toast.removing {
  animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Loading spinner */
.loading-spinner {
  animation: spin 1s linear infinite;
}

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

/* ========== NAVEGACIÓN TABS - DESKTOP Y MÓVIL ========== */
/* Estilos profesionales para pestañas de navegación */

#main-nav-container {
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, 
    rgba(0, 255, 136, 0.1) 0%,
    rgba(0, 255, 136, 0.8) 20%,
    rgba(0, 255, 136, 1) 50%,
    rgba(0, 255, 136, 0.8) 80%,
    rgba(0, 255, 136, 0.1) 100%
  ) 1;
  box-shadow: 0 2px 12px rgba(0, 255, 136, 0.4);
  padding: 0.5rem 1rem;
}

.tab-button,
.tab-button-historial,
.tab-button-admin {
  font-size: 0.875rem;
  padding: 8px 16px;
  min-height: 38px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(42, 187, 165, 0.15) 0%, rgba(16, 36, 84, 0.15) 100%);
  border: 1.5px solid rgba(42, 187, 165, 0.4);
  color: #ffffff;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tab-button:hover,
.tab-button-historial:hover,
.tab-button-admin:hover {
  background: linear-gradient(135deg, rgba(42, 187, 165, 0.3) 0%, rgba(16, 36, 84, 0.3) 100%);
  border-color: rgba(42, 187, 165, 0.7);
  box-shadow: 0 0 8px rgba(42, 187, 165, 0.4);
  transform: translateY(-1px);
}

.tab-button.active,
.tab-button-historial.active,
.tab-button-admin.active {
  background: linear-gradient(135deg, #2abba5 0%, #102454 100%);
  border-color: #2abba5;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(42, 187, 165, 0.6);
}

/* Responsive específico para Tecno K15Q */
@media (max-width: 720px) and (max-height: 1612px) {
  /* Header más compacto */
  header .container {
    padding: 0.75rem 1rem;
  }
  
  header h1 {
    font-size: 1.125rem;
  }
  
  header p {
    font-size: 0.75rem;
  }
  
  /* Navegación horizontal scrollable */
  #main-nav {
    padding: 0.5rem 0;
    gap: 0.25rem;
  }
  
  #main-nav button {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    min-width: fit-content;
    white-space: nowrap;
  }
  
  /* Grid de módulos más compacto */
  .mobile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .module-card {
    padding: 1rem;
  }
  
  .module-card i {
    font-size: 2rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .module-card h3 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
  
  .module-card p {
    font-size: 0.75rem;
    line-height: 1.3;
  }
  
  /* Formularios más accesibles */
  .form-input {
    padding: 0.875rem;
    font-size: 0.875rem;
  }
  
  /* Botones más grandes para touch */
  button {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }
  
  /* Tablas responsivas */
  .table-responsive {
    font-size: 0.75rem;
  }
  
  .table-responsive th,
  .table-responsive td {
    padding: 0.5rem 0.25rem;
  }
  
  /* Modal full-screen en móvil con soporte para teclado */
  .modal-overlay .bg-white {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    position: relative;
  }
  
  /* Ajuste cuando el teclado está visible */
  .modal-overlay {
    align-items: flex-start !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  /* Scroll suave en modales */
  .modal-overlay .bg-white {
    scroll-behavior: smooth;
  }
  
  /* Inputs más grandes para mejor tap en móviles */
  input, select, textarea {
    min-height: 48px;
    font-size: 16px !important; /* Evita zoom automático en iOS */
    -webkit-appearance: none;
    appearance: none;
  }
  
  /* Botones más grandes para móviles */
  button {
    min-height: 48px;
    touch-action: manipulation;
  }
  
  /* Formularios más espaciados en móvil */
  form {
    padding-bottom: 1rem;
  }
  
  /* Labels más visibles */
  label {
    font-weight: 600;
    color: #374151;
  }
  
  /* Footer más compacto */
  footer {
    padding: 1rem 0;
  }
  
  footer p {
    font-size: 0.75rem;
  }
}

/* Landscape orientation para dispositivos móviles */
@media (max-height: 500px) and (orientation: landscape) {
  header .container {
    padding: 0.5rem 1rem;
  }
  
  header h1 {
    font-size: 1rem;
  }
  
  #main-nav {
    padding: 0.25rem 0;
  }
  
  main {
    padding: 1rem;
  }
  
  .module-card {
    padding: 0.75rem;
  }
}

/* Estados de carga */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(42, 187, 165, 0.2),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Elementos disabled */
.disabled {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}

/* Estados de éxito y error */
.success {
  border-color: #22c55e !important;
  background-color: rgba(34, 197, 94, 0.05);
}

.error {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.05);
}

/* Scroll personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Print styles - Impresión profesional solo de reportes */
@media print {
  /* Ocultar elementos de navegación y UI */
  .no-print,
  header,
  #main-nav,
  nav,
  footer,
  button,
  .tab-button,
  #filtros-container,
  .mb-4.flex.flex-wrap.gap-2.justify-end {
    display: none !important;
  }
  
  /* Forzar fondo blanco */
  body {
    background: white !important;
    color: black !important;
  }
  
  /* Resetear colores de fondo */
  .bg-primary,
  .bg-secondary,
  .bg-accent,
  .bg-gray-50,
  .bg-gray-100 {
    background: white !important;
    color: black !important;
  }
  
  /* Mostrar solo el contenido del reporte */
  #reporte-ventas-content,
  #reporte-gastos-content,
  #reporte-productos-content,
  #reporte-balance-content {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Tablas optimizadas para impresión */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto !important;
  }
  
  thead {
    display: table-header-group !important;
  }
  
  tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  
  th, td {
    padding: 8px !important;
    border: 1px solid #ddd !important;
  }
  
  /* Headers de tabla con color para impresión */
  .bg-sodvent-blue,
  .bg-red-600 {
    background-color: #333 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Totales destacados */
  tfoot {
    font-weight: bold !important;
    background-color: #f0f0f0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Ajustar tamaño de fuente para impresión */
  body {
    font-size: 10pt !important;
  }
  
  h1, h2, h3 {
    page-break-after: avoid !important;
  }
  
  /* Eliminar sombras y efectos visuales */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}
/* =============================================================================
   ESTILOS PARA EL NUEVO MÓDULO DE ADMINISTRACIÓN
   ============================================================================= */

/* Tabs del módulo de administración */
.tab-button-admin {
    transition: all 0.3s ease;
    color: #6b7280;
}

.tab-button-admin.active {
    color: #2abba5 !important;
    border-bottom: 2px solid #2abba5 !important;
    font-weight: 600;
}

.tab-button-admin:hover:not(.active) {
    color: #4b5563;
    background-color: #f3f4f6;
}

.tab-content-admin {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

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

/* Estilos para tarjetas de usuarios */
.usuario-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.usuario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Checkbox personalizado para permisos */
input[type="checkbox"]:checked {
    background-color: #2abba5;
    border-color: #2abba5;
}

/* Toast notifications */
.toast-notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Estilos para inputs numéricos con estilo de código */
input[type="text"][maxlength="3"],
input[type="text"][maxlength="6"] {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 0.1em;
}

/* Modal overlay mejorado */
.modal-overlay {
    backdrop-filter: blur(2px);
}

/* =============================================================================
   OPTIMIZACIÓN MÓVIL ONLY - SODVENT 4.0.1
   Desktop permanece intacto. Solo móvil (<768px) se modifica.
   ============================================================================= */

@media (max-width: 768px) {
  /* ========== PANTALLA PRINCIPAL: GRID 2x4 - TODO VISIBLE SIN SCROLL ========== */
  /* Contenedor de botones holográficos */
  .holo-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
    padding: 0.5rem !important;
    padding-top: 50px !important; /* Espacio para header fixed (40px + 10px margen) */
    padding-bottom: 35px !important; /* Espacio para footer (30px + 5px) */
    min-height: 100vh !important;
    overflow-y: auto !important;
    align-content: start !important;
    position: relative !important;
    z-index: 1 !important;
  }
  
  /* Botones holográficos más compactos */
  .holo-button {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1/1 !important; /* Botones cuadrados 1:1 */
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem 0.25rem !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 2 !important;
  }
  
  .holo-button i {
    font-size: 2rem !important; /* Iconos más pequeños */
    margin-bottom: 0.35rem !important;
  }
  
  .holo-button span {
    font-size: 0.65rem !important; /* Texto más pequeño */
    text-align: center !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
  }
  
  /* ========== ENCABEZADO: 1 FILA HORIZONTAL (IGUAL QUE DESKTOP) ========== */
  .holo-header,
  header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    height: 40px !important;
    max-height: 40px !important;
    padding: 0.2rem 0.5rem !important;
    width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(0, 0, 0, 0.98) !important;
    gap: 0.25rem !important;
    overflow: hidden !important;
    pointer-events: auto !important;
  }
  
  /* Asegurar que elementos del header sean clickeables */
  .holo-header * {
    pointer-events: auto !important;
  }
  
  /* Logo cliente compacto - IZQUIERDA */
  .logo-center {
    width: 30px !important;
    height: 30px !important;
    flex-shrink: 0 !important;
    order: 1 !important;
  }
  
  /* Nombre negocio compacto - CENTRO */
  .business-name {
    font-size: 0.65rem !important; /* 10px */
    letter-spacing: 0.2px !important;
    margin: 0 !important;
    padding: 0 0.25rem !important;
    line-height: 1.1 !important;
    flex: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    order: 2 !important;
  }
  
  /* Contenedor Usuario + Salir - DERECHA */
  .holo-header > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-shrink: 0 !important;
    order: 3 !important;
  }
  
  /* Usuario y Rol compactos */
  .holo-header .text-right {
    text-align: right !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
  }
  
  .holo-header .text-xs {
    font-size: 0.5rem !important; /* 8px */
    line-height: 1 !important;
    white-space: nowrap !important;
  }
  
  .holo-header .flex.items-center {
    gap: 0.25rem !important;
    flex-shrink: 0 !important;
    flex-direction: row !important;
  }
  
  /* ========== FOOTER: 1 LÍNEA COMPACTA JUSTIFICADA ========== */
  .sod-footer {
    height: 30px !important;
    padding: 0.25rem 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .sod-footer-content {
    gap: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .sod-footer-logo {
    width: 25px !important;
    height: 25px !important;
  }
  
  .sod-footer-brand {
    font-size: 0.625rem !important; /* 10px */
    letter-spacing: 1px !important;
    line-height: 1.1 !important;
  }
  
  .sod-footer-slogan {
    font-size: 0.625rem !important; /* 10px */
    line-height: 1.1 !important;
  }
  
  /* ========== BOTÓN SALIR: SOLO ICONO (OCULTAR TEXTO "Salir") ========== */
  button[onclick*="logout"] span,
  .logout-button span,
  #logout-button span {
    display: none !important;
  }
  
  button[onclick*="logout"] {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0.5rem !important;
  }
  
  /* ========== FIX: HEADER SIEMPRE VISIBLE (INCLUSO EN MÓDULOS) ========== */
  .module-active .holo-header {
    display: flex !important; /* Override display: none */
  }
  
  /* ========== FIX: OCULTAR GRID CUANDO HAY MÓDULO ACTIVO ========== */
  .module-active .holo-grid {
    display: none !important;
  }
  
  /* ========== FIX: ESTILO DE CONTENEDORES CUANDO HAY MÓDULO ACTIVO ========== */
  /* Usar clases controladas por JavaScript para máxima compatibilidad móvil */
  
  #main-nav-container.nav-visible {
    position: fixed !important;
    top: 40px !important; /* Pegado al header */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 100 !important;
    background: rgba(0, 0, 0, 0.95) !important; /* Fondo oscuro para contraste */
    border-bottom: 2px solid transparent !important;
    border-image: linear-gradient(90deg, 
      rgba(0, 255, 136, 0.1) 0%,
      rgba(0, 255, 136, 0.8) 20%,
      rgba(0, 255, 136, 1) 50%,
      rgba(0, 255, 136, 0.8) 80%,
      rgba(0, 255, 136, 0.1) 100%
    ) 1 !important;
    box-shadow: 0 2px 12px rgba(0, 255, 136, 0.4) !important; /* Glow effect NEON */
    padding: 0.4rem 0.5rem !important;
    height: auto !important;
    max-height: 50px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  
  #app-content-container.content-visible {
    position: fixed !important;
    top: 90px !important; /* header (40px) + nav (50px) SIN espacio negro */
    left: 0 !important;
    right: 0 !important;
    bottom: 30px !important; /* Espacio para footer */
    width: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 50 !important;
    background: #1a1a2e !important;
    -webkit-overflow-scrolling: touch !important; /* Scroll suave iOS */
  }
  
  /* Asegurar que app-content sea visible y scrolleable */
  #app-content-container.content-visible #app-content {
    display: block !important;
    width: 100% !important;
    min-height: calc(100vh - 135px) !important; /* Altura completa */
    padding: 0.5rem !important;
    padding-bottom: 3rem !important; /* Espacio extra para scroll completo */
    background: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* ELIMINAR franjas negras entre elementos */
  #app-content > * {
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* ELIMINAR franja negra después de alertas */
  #app-content .bg-yellow-50,
  #app-content .bg-red-50,
  #app-content .bg-green-50,
  #app-content .bg-blue-50 {
    margin-bottom: 0.5rem !important;
    margin-top: 0 !important;
  }
  
  /* ========== FIX: ASEGURAR CLICKS EN BOTONES ========== */
  /* Fondo holográfico no debe bloquear clicks */
  .holographic-bg {
    pointer-events: none !important;
  }
  
  /* TODOS los elementos interactivos DEBEN ser clickeables */
  .holo-header,
  .holo-header *,
  .holo-grid,
  .holo-button,
  .holo-button *,
  button,
  a,
  input,
  select,
  textarea,
  #main-nav-container,
  #main-nav-container *,
  #app-content-container,
  #app-content-container * {
    pointer-events: auto !important;
  }
  
  .holo-grid {
    pointer-events: auto !important; /* Grid clickeable */
  }
  
  .holo-button {
    pointer-events: auto !important; /* Botones clickeables */
    touch-action: manipulation !important; /* Mejor respuesta touch */
  }
  
  /* ========== CONTENEDORES Y ESPACIADO ========== */
  .bg-white.rounded-lg.shadow-lg {
    padding: 0.75rem !important;
    margin: 0.5rem !important;
  }
  
  /* Contenedor principal sin scroll horizontal */
  #app-content-container,
  #app-content,
  main {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  /* Main container: altura ajustada para grid */
  .main-container {
    min-height: calc(100vh - 70px) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* ========== BOTONES: SOLO ICONOS EN MÓVIL ========== */
  /* Ocultar texto, mostrar solo iconos */
  .btn-text,
  button .btn-text,
  a .btn-text {
    display: none !important;
  }
  
  /* Botones: mínimo 44x44px para toque fácil */
  button,
  .btn,
  a[role="button"] {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.75rem !important;
    font-size: 1.25rem !important; /* Iconos más grandes */
  }
  
  /* Iconos centrados en botones */
  button i,
  .btn i,
  a[role="button"] i {
    margin: 0 !important;
  }
  
  /* ========== ICONOS CON BORDES REDONDEADOS ========== */
  button i.fas,
  button i.far,
  button i.fa,
  a[role="button"] i.fas,
  a[role="button"] i.far {
    background: rgba(255, 255, 255, 0.15) !important;
    padding: 0.4rem !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    display: inline-block !important;
  }
  
  /* ============================================================================
     DISEÑO PROFESIONAL MÓVIL - MÓDULOS INTERNOS
     Requisito: Misma estructura desktop, solo más compacta y ordenada
     ============================================================================ */
  
  /* ========== BOTONES DE FUNCIÓN: CUADRADOS 30px PERFECTOS ========== */
  #app-content button:not(.tab-button):not(.holo-button) {
    min-width: 30px !important;
    max-width: 30px !important;
    width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 2px !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    position: relative !important;
    overflow: hidden !important;
  }
  
  /* ELIMINAR círculos internos - solo iconos cuadrados */
  #app-content button::before {
    display: none !important; /* Elimina pseudo-elementos circulares */
  }
  
  #app-content button i {
    font-size: 14px !important;
    margin: 0 !important;
    z-index: 2 !important;
    position: relative !important;
    background: transparent !important; /* Sin círculo */
  }
  
  /* Ocultar texto de botones, solo mostrar iconos */
  #app-content button .btn-text,
  #app-content button span:not(.badge) {
    display: none !important;
  }
  
  /* ELIMINAR backgrounds circulares o no cuadrados */
  #app-content button > * {
    background: transparent !important;
    border-radius: 0 !important;
  }
  
  /* ========== DEGRADADOS PROFESIONALES CONSISTENTES EN TODOS LOS BOTONES ========== */
  
  /* Primarios: Guardar, Aceptar, Registrar, Procesar */
  #app-content button[onclick*="guardar"],
  #app-content button[onclick*="registrar"],
  #app-content button[type="submit"],
  #app-content button[onclick*="procesar"],
  #app-content button[onclick*="confirmar"] {
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Secundarios: Cancelar, Volver, Cerrar */
  #app-content button[onclick*="cancelar"],
  #app-content button[onclick*="cerrar"],
  #app-content button[onclick*="volver"],
  #app-content button[onclick*="navigateTo('home')"] {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Destructivos: Eliminar, Borrar */
  #app-content button[onclick*="eliminar"],
  #app-content button[onclick*="delete"],
  #app-content button[onclick*="borrar"] {
    background: linear-gradient(135deg, #ff4757 0%, #cc3a47 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Búsqueda/Filtros - MISMO COLOR SIEMPRE (naranja) */
  #app-content button[onclick*="buscar"],
  #app-content button[onclick*="filtrar"],
  #app-content button[onclick*="load"],
  #app-content button[onclick*="filtro"] {
    background: linear-gradient(135deg, #ffa502 0%, #cc8400 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Especiales: Imprimir, Excel, PDF - MISMO COLOR (púrpura) */
  #app-content button[onclick*="imprimir"],
  #app-content button[onclick*="exportar"],
  #app-content button[onclick*="descargar"],
  #app-content button[onclick*="Excel"],
  #app-content button[onclick*="PDF"] {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Nuevos/Agregar - Verde */
  #app-content button[onclick*="mostrarForm"],
  #app-content button[onclick*="Nuevo"],
  #app-content button[onclick*="agregar"],
  #app-content button[onclick*="añadir"] {
    background: linear-gradient(135deg, #00b894 0%, #008a6d 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Editar - Amarillo-Naranja */
  #app-content button[onclick*="editar"],
  #app-content button[onclick*="modificar"] {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Incremento/Decremento (+ / -) - Cyan claro */
  #app-content button[onclick*="incrementar"],
  #app-content button[onclick*="decrementar"],
  #app-content button.btn-increment,
  #app-content button.btn-decrement {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Refrescar/Reload - Teal */
  #app-content button[onclick*="refresh"],
  #app-content button[onclick*="reload"],
  #app-content button[onclick*="actualizar"] {
    background: linear-gradient(135deg, #00cec9 0%, #00b8b8 100%) !important;
    color: white !important;
    border: none !important;
  }
  
  /* Botones en fondos blancos - VISIBLES CON BORDE */
  #app-content .bg-white button:not([onclick]),
  #app-content button.bg-white,
  #app-content button[style*="background: white"],
  #app-content button[style*="background:#fff"],
  #app-content button[style*="background-color: white"],
  #app-content button[style*="background-color:#fff"] {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 1.5px solid #102454 !important;
    color: #102454 !important;
    font-weight: 500 !important;
  }
  
  #app-content .bg-white button:not([onclick]):hover,
  #app-content button.bg-white:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%) !important;
    border-color: #2abba5 !important;
    box-shadow: 0 0 8px rgba(42, 187, 165, 0.3) !important;
  }
  
  /* Botones de selección de archivo - VISIBLES */
  #app-content input[type="file"] + label,
  #app-content label[for*="file"],
  #app-content .file-input-label {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 1.5px solid #102454 !important;
    color: #102454 !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
  }
  
  #app-content input[type="file"] + label:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%) !important;
    border-color: #2abba5 !important;
    box-shadow: 0 0 8px rgba(42, 187, 165, 0.3) !important;
  }
  
  /* ========== CAMPOS DE FORMULARIO: ANCHOS RACIONALES ========== */
  /* Fecha: Ancho apropiado */
  input[type="date"],
  input[name*="fecha"],
  input[id*="fecha"] {
    width: 140px !important;
    max-width: 140px !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Hora: Ancho apropiado */
  input[type="time"],
  input[name*="hora"],
  input[id*="hora"] {
    width: 100px !important;
    max-width: 100px !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Cantidad: Pequeño */
  input[type="number"][name*="cantidad"],
  input[type="number"][id*="cantidad"],
  input[type="number"][name*="qty"] {
    width: 80px !important;
    max-width: 80px !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Precio/Valor: Mediano */
  input[type="number"][name*="precio"],
  input[type="number"][name*="valor"],
  input[type="number"][id*="precio"],
  input[type="number"][id*="valor"] {
    width: 110px !important;
    max-width: 110px !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Texto general: Ancho medio */
  input[type="text"]:not([name*="fecha"]) {
    width: 180px !important;
    max-width: 100% !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Email: Ancho medio */
  input[type="email"] {
    width: 200px !important;
    max-width: 100% !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Select: Ancho medio */
  select {
    width: 180px !important;
    max-width: 100% !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    height: 32px !important;
  }
  
  /* Textarea: Ancho completo pero compacto */
  textarea {
    width: 100% !important;
    font-size: 14px !important;
    padding: 6px 8px !important;
    min-height: 60px !important;
  }
  
  /* ========== TODOS LOS INPUTS: ALTURA REDUCIDA 30% (44px → 32px) ========== */
  #app-content input:not([type="checkbox"]):not([type="radio"]),
  #app-content select,
  #app-content textarea {
    height: 32px !important; /* Reducción del 30% */
    min-height: 32px !important;
    font-size: 14px !important; /* 16px evita zoom en iOS, pero 14px es más compacto */
    padding: 4px 8px !important; /* Padding reducido */
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(0, 0, 0, 0.3) !important;
    color: #ffffff !important;
    transition: all 0.2s ease !important;
  }
  
  #app-content textarea {
    height: auto !important; /* Textarea permite altura variable */
    min-height: 60px !important;
    resize: vertical !important;
  }
  
  #app-content input:focus,
  #app-content select:focus,
  #app-content textarea:focus {
    border-color: #2abba5 !important;
    box-shadow: 0 0 0 2px rgba(42, 187, 165, 0.2) !important;
    outline: none !important;
  }
  
  /* Labels compactos y profesionales */
  #app-content label,
  #app-content .label-text,
  #app-content .form-label {
    font-size: 0.7rem !important; /* 11.2px */
    line-height: 1.3 !important;
    margin-bottom: 3px !important;
    display: block !important;
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }
  
  /* Headers de secciones más compactos */
  #app-content h3,
  #app-content .section-header,
  #app-content .form-section-title {
    font-size: 0.85rem !important; /* 13.6px */
    padding: 5px 10px !important;
    margin-bottom: 8px !important;
    margin-top: 12px !important;
    background: linear-gradient(135deg, rgba(42, 187, 165, 0.1) 0%, rgba(16, 36, 84, 0.1) 100%) !important;
    border-left: 3px solid #2abba5 !important;
    border-radius: 4px !important;
  }
  
  /* ========== AGRUPACIÓN INTELIGENTE 2-3 CAMPOS POR FILA ========== */
  #app-content .grid,
  #app-content form > div:not(.tab-button-container) {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(90px, auto)) !important;
    gap: 0.5rem !important;
    align-items: start !important;
  }
  
  /* Grupos específicos */
  .fecha-hora-group,
  .grid.grid-cols-2 {
    grid-template-columns: 140px 100px !important;
  }
  
  .grid.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(80px, auto)) !important;
  }
  
  /* ========== TABLAS: SCROLL HORIZONTAL (MANTENER ESTRUCTURA DESKTOP) ========== */
  #app-content table {
    display: table !important; /* Mantener como tabla */
    overflow-x: auto !important;
    overflow-y: visible !important;
    white-space: nowrap !important;
    font-size: 0.7rem !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }
  
  #app-content table thead {
    position: sticky !important;
    top: 0 !important;
    background: #1a1a2e !important;
    z-index: 10 !important;
  }
  
  #app-content table th {
    padding: 6px 8px !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    border: 1px solid #374151 !important;
  }
  
  #app-content table td {
    padding: 4px 6px !important;
    font-size: 0.7rem !important;
    border: 1px solid #374151 !important;
  }
  
  /* Botones en tablas más pequeños */
  #app-content table button {
    min-width: 26px !important;
    width: 26px !important;
    height: 26px !important;
    margin: 0 1px !important;
  }
  
  #app-content table button i {
    font-size: 12px !important;
  }
  
  /* Wrapper de tabla con scroll */
  #app-content .overflow-x-auto,
  #app-content div[id*="-table"] {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* ========== DASHBOARD: ORIENTACIÓN HORIZONTAL EN LANDSCAPE ========== */
  @media (max-width: 768px) and (orientation: landscape) {
    /* Métricas en fila horizontal */
    #dashboard-metricas,
    .dashboard-stats {
      display: flex !important;
      flex-direction: row !important;
      justify-content: space-around !important;
      gap: 0.5rem !important;
    }
    
    /* Cards de métricas compactos */
    .dashboard-stat-card {
      flex: 1 !important;
      min-width: 100px !important;
      max-width: 150px !important;
    }
    
    /* Gráfico aprovecha ancho completo */
    #dashboard-chart {
      width: 100% !important;
      height: 50vh !important;
    }
  }
  
  /* ========== MODALES COMPACTOS ========== */
  .modal-overlay .bg-white,
  .fixed.inset-0 .bg-white {
    width: 90vw !important;
    max-width: 90vw !important;
    max-height: 85vh !important;
    margin: auto !important;
    overflow-y: auto !important;
    padding: 0.75rem !important;
  }
  
  /* ========== PESTAÑAS (TABS) COMPACTAS ========== */
  /* ========== PESTAÑAS DE NAVEGACIÓN VISIBLES Y PROFESIONALES ========== */
  .tab-button {
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
    min-height: 34px !important;
    border-radius: 6px !important;
    background: linear-gradient(135deg, rgba(42, 187, 165, 0.15) 0%, rgba(16, 36, 84, 0.15) 100%) !important;
    border: 1.5px solid rgba(42, 187, 165, 0.4) !important;
    color: #ffffff !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .tab-button:hover {
    background: linear-gradient(135deg, rgba(42, 187, 165, 0.3) 0%, rgba(16, 36, 84, 0.3) 100%) !important;
    border-color: rgba(42, 187, 165, 0.7) !important;
    box-shadow: 0 0 8px rgba(42, 187, 165, 0.4) !important;
  }
  
  .tab-button.active {
    background: linear-gradient(135deg, #2abba5 0%, #102454 100%) !important;
    border-color: #2abba5 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 0 12px rgba(42, 187, 165, 0.6) !important;
  }
  
  #main-nav-container {
    white-space: nowrap !important;
    overflow-x: auto !important;
  }
  
  #main-nav-container .flex {
    flex-direction: row !important;
    gap: 0.25rem !important;
    flex-wrap: nowrap !important;
  }
  
  /* ========== ENCABEZADOS COMPACTOS ========== */
  #app-content h1 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  #app-content h2 {
    font-size: 1rem !important;
    margin-bottom: 0.4rem !important;
  }
  
  #app-content h3 {
    font-size: 0.9rem !important;
    margin-bottom: 0.3rem !important;
  }
  
  /* ========== FLEX: MANTENER ESTRUCTURA DESKTOP ========== */
  #app-content .flex {
    flex-direction: row !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
  }
  
  #app-content .flex.flex-col {
    flex-direction: column !important;
  }
  
  /* ========== ESPACIADO COMPACTO Y CONSISTENTE ========== */
  #app-content .mb-6,
  #app-content .my-6 {
    margin-bottom: 0.5rem !important;
    margin-top: 0.5rem !important;
  }
  
  #app-content .mb-4,
  #app-content .my-4 {
    margin-bottom: 0.4rem !important;
    margin-top: 0.4rem !important;
  }
  
  #app-content .mb-2,
  #app-content .my-2 {
    margin-bottom: 0.3rem !important;
    margin-top: 0.3rem !important;
  }
  
  #app-content .p-6 {
    padding: 0.5rem !important;
  }
  
  #app-content .p-4 {
    padding: 0.4rem !important;
  }
  
  #app-content .gap-4 {
    gap: 0.4rem !important;
  }
  
  #app-content .gap-2 {
    gap: 0.2rem !important;
  }
  
  /* ========== ALERTAS Y NOTIFICACIONES COMPACTAS ========== */
  #app-content .bg-yellow-50,
  #app-content .bg-red-50,
  #app-content .bg-green-50,
  #app-content .bg-blue-50 {
    padding: 0.4rem !important;
    font-size: 0.7rem !important;
    border-radius: 4px !important;
    margin-bottom: 0.3rem !important; /* Eliminar espacios negros entre mensajes */
  }
  
  /* ========== BADGES Y ESTADOS ========== */
  #app-content .badge,
  #app-content .tag,
  #app-content span[class*="bg-"][class*="rounded"] {
    font-size: 0.65rem !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
  }
  
  /* ========== CONTENEDORES ESPECÍFICOS POR MÓDULO ========== */
  /* Productos */
  #productos-container,
  #productos-table-container {
    padding: 0.5rem !important;
  }
  
  /* Ventas */
  #ventas-container,
  #carrito-container {
    padding: 0.5rem !important;
    max-height: calc(100vh - 140px) !important; /* Permitir scroll completo en pedidos */
    overflow-y: auto !important;
  }
  
  /* Caja */
  #caja-container {
    padding: 0.5rem !important;
  }
  
  /* Por Cobrar */
  #cuentas-cobrar-container {
    padding: 0.5rem !important;
  }
  
  /* Gastos */
  #gastos-container {
    padding: 0.5rem !important;
  }
  
  /* Reportes */
  #reportes-container {
    padding: 0.5rem !important;
  }
  
  /* ========== OPTIMIZACIÓN CONTENEDORES Y SCROLL ========== */
  #app-content {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  
  #app-content > div {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* ========== IMÁGENES Y MEDIA ========== */
  #app-content img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* ========== CARDS Y PANELES ========== */
  #app-content .bg-white,
  #app-content .card,
  #app-content .panel {
    border-radius: 6px !important;
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  /* ========== RESUMEN Y TOTALES ========== */
  #app-content .total,
  #app-content .resumen {
    font-size: 0.85rem !important;
    padding: 0.4rem !important;
    border-radius: 4px !important;
  }
  
  /* ========== SEPARADORES Y DIVISORES ========== */
  #app-content hr {
    margin: 0.5rem 0 !important;
  }
  
  /* ========== FIX FINAL: PREVENIR OVERFLOW HORIZONTAL ========== */
  body,
  #app-content-container.content-visible,
  #app-content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  * {
    box-sizing: border-box !important;
  }
}

/* =============================================================================
   FIN OPTIMIZACIÓN MÓVIL
   ============================================================================= */

