/* ==========================================================================
   MOBILE & PWA OPTIMIZATIONS
   ========================================================================== */

/* Solo se activa en pantallas menores a 768px (Tablets y Celulares) */
@media (max-width: 768px) {

    /* --- 1. LAYOUT GENERAL --- */

    /* Ocultar Sidebar lateral */
    .sidebar {
        display: none !important;
    }

    /* Expandir contenido principal */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
        padding-bottom: 80px !important;
        /* Espacio para la navbar inferior */
        width: 100% !important;
    }

    /* Ocultar Header superior grande (opcional, dejamos el título) */
    .top-bar {
        padding: 0.5rem 1rem !important;
        justify-content: center !important;
        /* Centrar título */
    }

    /* Ocultar botón hamburguesa */
    #menu-toggle-btn {
        display: none !important;
    }

    /* Ajustar título para que no quede pegado si estaba a la derecha del botón */
    .page-title {
        margin-left: 0 !important;
        text-align: center;
        font-size: 1.2rem !important;
    }

    .top-bar-search {
        display: none !important;
        /* Ahorrar espacio */
    }

    /* --- 2. BOTTOM NAVIGATION BAR --- */
    /* --- 2. BOTTOM NAVIGATION BAR (Premium Glass) --- */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 75px;
        /* Taller for better touch target */
        background: rgba(255, 255, 255, 0.85);
        /* Translucent */
        backdrop-filter: blur(20px) saturate(180%);
        /* iOS Frost Effect */
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
        z-index: 10000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        border-radius: 20px 20px 0 0;
        /* Smooth rounded top */
    }

    body[data-theme="dark"] .mobile-bottom-nav {
        background: rgba(30, 41, 59, 0.85);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 600;
        width: 100%;
        height: 100%;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: none;
        border: none;
        cursor: pointer;
        position: relative;
        overflow: visible;
        padding-bottom: 5px;
    }

    .nav-item i {
        font-size: 1.5rem;
        margin-bottom: 4px;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* Active State Enhancements */
    .nav-item.active {
        color: var(--primary-color);
    }

    .nav-item.active i {
        transform: translateY(-6px) scale(1.1);
        filter: drop-shadow(0 4px 6px rgba(var(--primary-rgb), 0.4));
    }

    /* Glowing Dot Indicator */
    .nav-item.active::after {
        content: '';
        position: absolute;
        bottom: 8px;
        /* Safe area handled by padding usually, but adjust if needed */
        width: 6px;
        height: 6px;
        background: var(--primary-color);
        border-radius: 50%;
        box-shadow: 0 0 10px var(--primary-color);
        animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    @keyframes popDot {
        0% {
            transform: scale(0);
            opacity: 0;
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    /* Touch Feedback */
    .nav-item:active i {
        transform: scale(0.9);
    }

    /* Botón flotante central (Inventario o Más) */
    .nav-item.special-fab {
        position: relative;
        top: -25px;
        /* Lifted higher */
        background: var(--gradient-primary);
        color: white;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
        /* Stronger glow */
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 60px;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
        border: 4px solid rgba(255, 255, 255, 0.8);
        /* Border against nav bg */
        background-clip: padding-box;
    }

    body[data-theme="dark"] .nav-item.special-fab {
        border-color: rgba(30, 41, 59, 1);
    }

    .nav-item.special-fab.active {
        color: white !important;
        /* Keep white icon */
    }

    .nav-item.special-fab.active::after {
        display: none;
        /* No dot for FAB */
    }

    .nav-item.special-fab:active {
        transform: scale(0.95);
        box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);
    }

    .nav-item.special-fab i {
        font-size: 1.8rem;
        margin: 0;
        transform: none !important;
        /* Fab handles its own transform */
    }

    /* Rotate FAB icon if active/open menu style? Optional. */

    .nav-item.special-fab span {
        display: none;
    }

    /* --- 3. REDISEÑO DASHBOARD COMPACTO --- */

    /* Contenedor principal sin desbordes */
    #dashboard-content {
        overflow-x: hidden !important;
        width: 100% !important;
        padding: 0 !important;
    }

    /* Header del Dashboard */
    #dashboard-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem !important;
        width: 100%;
        overflow-x: hidden;
    }

    /* ELIMINAR ESTILO DE TARJETA EN LA BARRA DE HERRAMIENTAS */
    /* Apuntamos a la primera tarjeta del dashboard que contiene los filtros */
    #dashboard-content>.card:first-child {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0.5rem 0 !important;
        /* Quitar padding lateral */
        margin-bottom: 0.5rem !important;
        border-radius: 0 !important;
    }

    #dashboard-content>.card:first-child>.report-toolbar {
        padding: 0 !important;
        display: block !important;
        /* Romper el flex de escritorio */
    }

    /* Selector de Sucursal: Botón Grande Blanco */
    #dashboard-branch-filter {
        width: 100% !important;
        display: block;
        margin-bottom: 1rem !important;
        padding: 0.8rem 1rem !important;
        border: none;
        border-radius: 12px;
        background-color: white;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        /* Sombra suave */
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-color);
        -webkit-appearance: none;
        /* Quitar estilo nativo feo */
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 1em;
    }

    /* Contenedor padre de los filtros */
    .report-toolbar>div:first-child {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    /* BARRA DE FILTROS HORIZONTAL (Pills) */
    .filter-controls {
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        width: 100vw !important;
        /* Ancho de pantalla completo */
        margin-left: -1rem !important;
        /* Contrarrestar padding del main-content */
        padding: 0.2rem 1rem 0.5rem 1rem !important;
        /* Padding interno para que no toque bordes */

        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;

        /* Ocultar barra scroll */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    /* Botones de Filtro (Pills) */
    .date-filter-btn {
        background: white !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 20px !important;
        padding: 0.5rem 1.2rem !important;
        font-size: 0.85rem !important;
        flex-shrink: 0;
        /* No encogerse */
        color: var(--text-muted) !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    }

    .date-filter-btn.active {
        background: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    }

    /* Inputs de fecha manual (OCULTOS POR DEFECTO + ESTILO LIMPIO) */
    #custom-date-inputs {
        display: none !important;
        /* Oculto por defecto */
        background: white !important;
        padding: 10px !important;
        border-radius: 12px;
        margin-top: 10px;
        width: 100%;
        box-sizing: border-box;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        justify-content: center;
        gap: 5px;
    }

    /* Mostrar solo cuando tenga la clase active (manejado por JS) o si el usuario selecciona personalizado */
    /* Nota: El JS actual usa .style.display = 'flex', eso sobrescribirá el none, así que está bien */

    /* Reloj (Ocultar en móvil para limpiar) */
    #clock-container {
        display: none !important;
    }

    /* Corrección final para el contenedor "fantasma" blanco */
    .report-toolbar {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .card .report-toolbar {
        margin: 0 !important;
    }

    /* Ajuste para que el selector no se vea cortado */
    .report-toolbar>div {
        border: none !important;
        /* Quitar cualquier borde heredado */
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* Ocultar highlight viejo en móvil si causa problemas */
    .filter-highlight {
        display: none !important;
    }

    .date-filter-btn {
        background: transparent;
        border-radius: 20px;
    }

    .date-filter-btn.active {
        background: var(--primary-color) !important;
        color: white !important;
        box-shadow: 0 2px 5px rgba(79, 70, 229, 0.3);
    }

    /* Grid de tarjetas en 1 SOLA COLUMNA (Vertical Stack) */
    #dashboard-stats-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Tarjetas amplias horizontales */
    .stat-card {
        padding: 1rem !important;
        flex-direction: row !important;
        /* Icono izquierda, texto derecha */
        align-items: center !important;
        justify-content: flex-start !important;
        /* Contenido al inicio */
        min-height: 80px;
        width: 100% !important;
        box-sizing: border-box !important;
        gap: 1rem !important;
    }

    /* Iconos */
    .stat-card-icon {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.2rem !important;
        margin-bottom: 0 !important;
        margin-right: 0 !important;
        flex-shrink: 0;
    }

    /* Textos */
    .stat-card-info {
        flex: 1;
        text-align: left;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .stat-card-info p {
        font-size: 0.75rem !important;
        margin-bottom: 0.1rem !important;
        opacity: 0.9;
        white-space: nowrap !important;
    }

    .stat-card-info h3 {
        font-size: 1.4rem !important;
        line-height: 1.1 !important;
    }

    /* Eliminar regla de la última tarjeta, ya todas son full width */
    .stat-card:last-child {
        grid-column: auto;
    }

    .stat-card:last-child .stat-card-icon {
        margin-right: 0 !important;
    }

    /* GRÁFICOS APILADOS (Uno debajo del otro) */
    .dashboard-grid[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        /* Forzar 1 columna */
        gap: 1.5rem !important;
    }

    .chart-container {
        padding: 0.5rem !important;
        height: 300px !important;
        /* Un poco más de altura para que respire */
    }

    /* Ajuste de fuentes global en móvil */
    .card-header h3 {
        font-size: 1.1rem !important;
    }

    /* Listas aún más compactas */
    .modern-list-item {
        padding: 0.5rem !important;
    }

    .modern-list-title {
        font-size: 0.85rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .modern-list-amount {
        font-size: 0.9rem !important;
    }

    /* --- 4. MODALES FULLSCREEN --- */
    .modal-content {
        border-radius: 0 !important;
        height: 100% !important;
        display: flex;
        flex-direction: column;
        border: none !important;
    }

    .modal-wrapper {
        padding-top: 0 !important;
        align-items: flex-end !important;
        /* Bottom sheet style or full */
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
    }

}

/* Ocultar en escritorio */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}

/* --- 5. QUOTATIONS MOBILE LAYOUT --- */
@media (max-width: 768px) {

    /* 1. Layout Container -> Vertical Stack */
    .quotation-management-layout {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    /* 2. Left Panel (Colas) -> Top Horizontal Tabs */
    .quote-panel-left {
        width: 100% !important;
        height: auto !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding: 10px 15px !important;
        background: var(--bg-color, #fff) !important;
        order: 1 !important;
        position: sticky !important;
        top: 0;
        z-index: 99;
        /* Stay on top */
    }

    /* Hide "Colas de Trabajo" Header */
    .quote-panel-left .panel-header {
        display: none !important;
    }

    /* Horizontal List Style */
    #quote-filters-list ul {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Filter Pills */
    .filter-item {
        background: var(--surface-color, #f8f9fa) !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 20px !important;
        padding: 6px 16px !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        color: var(--text-muted) !important;
        transition: all 0.2s;
    }

    .filter-item.active {
        background: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
    }

    .filter-item span {
        font-size: 0.9rem !important;
        font-weight: 500;
    }

    .filter-count-badge {
        margin-left: 0 !important;
        background: rgba(0, 0, 0, 0.1) !important;
        border-radius: 10px !important;
        padding: 0 8px !important;
        font-size: 0.75rem !important;
        color: inherit !important;
    }

    /* 3. Center Panel (List) -> Full Cards */
    .quote-panel-center {
        width: 100% !important;
        order: 2 !important;
        padding: 10px 15px !important;
        border: none !important;
    }

    .quote-panel-center .panel-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 0 15px 0 !important;
        border-bottom: none !important;
    }

    /* "Cotizaciones" Title -> Smaller */
    .quote-panel-center .panel-header h3 {
        font-size: 1.25rem !important;
        margin: 0;
    }

    /* New Quote Button -> Floating Action Button (FAB) Style or kept top right */
    #new-quote-btn {
        padding: 8px 16px !important;
        border-radius: 20px !important;
        font-size: 0.9rem !important;
    }

    /* List Container */
    #quote-list-container {
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Card Style Items */
    .quote-list-item {
        background: var(--card-bg, #fff) !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        padding: 16px !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        margin-bottom: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .quote-list-item.active {
        border-color: var(--primary-color) !important;
        background: var(--surface-color, #f8f9fa) !important;
    }

    /* Item Header */
    .quote-item-header {
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .quote-item-header span:first-child {
        font-weight: 700;
        font-size: 1rem;
    }

    .status-badge {
        padding: 4px 10px !important;
        border-radius: 8px !important;
        font-size: 0.75rem !important;
        font-weight: 600;
    }

    /* Item Body */
    .quote-item-body {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-end !important;
        width: 100% !important;
    }

    /* Client Name */
    .quote-item-body span:first-child {
        font-size: 0.9rem;
        color: var(--text-muted);
        max-width: 60%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Price */
    .quote-item-total {
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: var(--text-color) !important;
    }

    /* 4. Right Panel (Details) -> HIDDEN (Handled by JS Modal/Overlay) */
    .quote-panel-right {
        display: none !important;
    }

    /* Active Overlay State (Toggled by JS) */
    .quote-panel-right.mobile-overlay-active {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        z-index: 2000 !important;
        background: var(--bg-color, #fff) !important;
        overflow-y: auto !important;
        padding-bottom: 80px;
        /* Bottom nav space */
    }

    .quote-panel-right.mobile-overlay-active .panel-header {
        position: sticky;
        top: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        z-index: 10;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding: 15px !important;
        display: flex !important;
        align-items: center;
    }

    /* --- FORMULARIO DE COTIZACIÓN (Mobile Reflow) --- */

    /* 1. Header: Stack inputs vertically */
    .zoho-style-form .form-header-section {
        flex-direction: column !important;
        background: transparent !important;
        padding: 0 !important;
        border: none !important;
        gap: 15px !important;
    }

    .zoho-style-form .form-group-inline {
        display: flex !important;
        flex-direction: column !important;
        /* Stack Cot#, Seller, Date */
        gap: 12px !important;
        width: 100% !important;
    }

    .zoho-style-form .form-group {
        width: 100% !important;
        min-width: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Input Styling Tweak for Mobile */
    .zoho-style-form input,
    .zoho-style-form select,
    .zoho-style-form textarea {
        font-size: 1rem !important;
        /* Prevent zoom on iOS */
        padding: 10px !important;
        height: auto !important;
    }

    /* 2. Product Table -> Stacked Card List */
    .form-table-section {
        margin-top: 20px !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .quote-items-table .table-header {
        display: none !important;
        /* Ocultar cabecera de tabla */
    }

    .quote-items-table .table-body {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    /* Row as Card */
    .quote-items-table .table-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        /* 2 Columnas */
        gap: 12px !important;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        position: relative;
        align-items: start !important;
    }

    /* Item Name: Top Full Width */
    .quote-items-table .col-item {
        grid-column: 1 / -1;
        width: 100% !important;
        margin-bottom: 8px;
    }

    .quote-items-table .col-item strong {
        font-size: 1.1rem;
        color: var(--primary-color);
        display: block;
        margin-bottom: 5px;
    }

    .quote-items-table .item-description {
        width: 100% !important;
        font-size: 0.9rem !important;
    }

    /* Inputs wrapper */
    .quote-items-table .col-qty,
    .quote-items-table .col-price,
    .quote-items-table .col-discount,
    .quote-items-table .col-subtotal {
        width: 100% !important;
    }

    /* Labels before inputs */
    .quote-items-table .col-qty::before {
        content: 'Cantidad';
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 2px;
    }

    .quote-items-table .col-price::before {
        content: 'Precio';
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 2px;
    }

    .quote-items-table .col-discount::before {
        content: 'Descuento';
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 2px;
    }

    .quote-items-table .col-subtotal::before {
        content: 'Subtotal';
        display: block;
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 2px;
    }

    /* Total Line */
    .quote-items-table .col-total {
        grid-column: 1 / -1;
        text-align: right;
        border-top: 1px dashed #e2e8f0;
        padding-top: 12px;
        margin-top: 5px;
        font-size: 1.25rem;
        font-weight: 800;
        color: var(--text-color);
    }

    /* Delete Button */
    .quote-items-table .col-action {
        position: absolute !important;
        top: 16px;
        right: 16px;
        width: auto !important;
    }

    /* 3. Footer Stack */
    .zoho-style-form .form-footer-section {
        flex-direction: column !important;
        gap: 20px !important;
        margin-top: 30px;
    }

    .notes-container,
    .totals-container {
        width: 100% !important;
    }

    /* 4. Actions Stack */
    .quote-form-actions {
        flex-direction: column-reverse !important;
        gap: 15px !important;
        padding: 20px 0;
    }

    .save-options {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .quote-form-actions button {
        width: 100%;
        margin: 0 !important;
        padding: 14px !important;
        border-radius: 12px;
    }
}

/* --- 6. QUOTATIONS RICH DESIGN (Mobile Specific) --- */

@media (min-width: 769px) {
    .mobile-search-header {
        display: none !important;
    }
}

@media (max-width: 768px) {

    /* SEARCH BAR */
    .mobile-search-header {
        padding: 10px 15px 5px 15px;
        background: transparent;
    }

    .search-input-wrapper {
        position: relative;
        width: 100%;
    }

    .search-input-wrapper i {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
    }

    .search-input-wrapper input {
        width: 100%;
        padding: 12px 12px 12px 45px;
        border-radius: 12px;
        border: none;
        background: white;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        font-size: 0.95rem;
        outline: none;
        color: var(--text-color);
    }

    .search-input-wrapper input:focus {
        box-shadow: 0 4px 12px -1px rgba(var(--primary-rgb), 0.15);
    }

    /* RICH CARD DESIGN */
    .quote-mobile-card {
        padding: 18px !important;
        background: white !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02) !important;
        border: 1px solid rgba(0, 0, 0, 0.03) !important;
        display: flex;
        flex-direction: column;
        gap: 14px;
        margin-bottom: 12px;
        position: relative;
        overflow: hidden;
    }

    /* Top Row: Client & Date */
    .card-top-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .client-info h4 {
        margin: 0 0 2px 0;
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--text-color);
        letter-spacing: -0.02em;
    }

    .quote-ref {
        font-size: 0.8rem;
        color: #94a3b8;
        font-weight: 500;
    }

    .card-date {
        font-size: 0.75rem;
        color: #94a3b8;
        display: flex;
        align-items: center;
        gap: 5px;
        background: #f8fafc;
        padding: 4px 8px;
        border-radius: 6px;
    }

    /* Middle Row: Amount & Status */
    .card-middle-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 5px;
    }

    .quote-amount {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 800;
        color: var(--text-color);
        letter-spacing: -0.03em;
    }

    .status-pill {
        padding: 6px 12px;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 6px;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    /* Specific Status Colors */
    .status-warning {
        background: #fff7ed;
        color: #ea580c;
        border: 1px solid #ffedd5;
    }

    .status-success {
        background: #f0fdf4;
        color: #16a34a;
        border: 1px solid #dcfce7;
    }

    .status-danger {
        background: #fef2f2;
        color: #dc2626;
        border: 1px solid #fee2e2;
    }

    .status-info {
        background: #eff6ff;
        color: #2563eb;
        border: 1px solid #dbeafe;
    }

    .status-default {
        background: #f1f5f9;
        color: #475569;
    }

    /* ACTIONS ROW */
    .card-actions-row {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #f1f5f9;
        margin-top: 5px;
    }

    .btn-action {
        border: none;
        border-radius: 10px;
        padding: 10px 0;
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        color: white;
        transition: transform 0.1s, opacity 0.2s;
        cursor: pointer;
    }

    .btn-action:active {
        transform: scale(0.96);
    }

    .btn-view {
        background: #6366f1;
        box-shadow: 0 2px 5px rgba(99, 102, 241, 0.2);
    }

    .btn-whatsapp {
        background: #10b981;
        box-shadow: 0 2px 5px rgba(16, 185, 129, 0.2);
    }

    .btn-edit {
        background: #e2e8f0;
        color: #475569;
        font-weight: 600;
    }

    /* FLOATING BUTTON (FAB) for New Quote */
    #new-quote-btn {
        position: fixed !important;
        bottom: 90px !important;
        /* Above nav info */
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 99 !important;
        width: auto !important;
        padding: 12px 24px !important;
        border-radius: 50px !important;
        box-shadow: 0 8px 20px -5px rgba(99, 102, 241, 0.5) !important;
        background: linear-gradient(135deg, var(--primary-color), #4f46e5) !important;
        color: white !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center;
        gap: 10px !important;
        white-space: nowrap !important;
    }

    #new-quote-btn i {
        font-size: 1.1rem;
    }

    /* Ensure title doesn't shift awkwardly */
    .quote-panel-center .panel-header {
        justify-content: center !important;
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    .quote-panel-center .panel-header h3 {
        display: none !important;
        /* Hide redundant title if we have tabs/search ? No, keep title or user wants it gone? Image has "Gestion de Cotizaciones" at top. Which is page-title. */
    }
}

/* --- 7. QUOTATION FORM PREMIUM RE-WORK ("Chuleria" Upgrade) --- */
@media (max-width: 768px) {

    /* Container: Light Gray & Spaced */
    .zoho-style-form {
        background: #f8fafc !important;
        padding: 15px !important;
        padding-bottom: 120px !important;
        /* Space for sticky footer */
        min-height: 100vh;
    }

    /* SECTIONS: Card Style (White on Gray) */
    .zoho-style-form .form-header-section,
    .zoho-style-form .form-table-section,
    .zoho-style-form .form-footer-section {
        background: white !important;
        padding: 20px !important;
        border-radius: 20px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
        margin-bottom: 20px !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* 1. Header Inputs */
    .zoho-style-form .form-group-inline {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        width: 100% !important;
    }

    .zoho-style-form .form-group {
        width: 100% !important;
        margin: 0 !important;
    }

    .zoho-style-form label {
        font-size: 0.8rem !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #94a3b8 !important;
        font-weight: 700 !important;
        margin-bottom: 8px !important;
    }

    .zoho-style-form input,
    .zoho-style-form select,
    .zoho-style-form textarea {
        background: #f1f5f9 !important;
        border: 1px solid transparent !important;
        border-radius: 12px !important;
        padding: 14px !important;
        font-size: 1rem !important;
        color: #334155 !important;
        font-weight: 500;
        transition: all 0.2s;
    }

    .zoho-style-form input:focus {
        background: white !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.1);
    }

    /* TomSelect Overrides for Mobile */
    .ts-control {
        border-radius: 12px !important;
        border: 1px solid #e2e8f0 !important;
        padding: 12px !important;
        font-size: 1rem !important;
        box-shadow: none !important;
        background: #f1f5f9 !important;
    }

    .ts-dropdown {
        border-radius: 12px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
        border: none !important;
    }

    /* 2. Product List ("Cards") */
    .quote-items-table .table-header {
        display: none !important;
    }

    .quote-items-table .table-body {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .quote-items-table .table-row {
        background: #f8fafc !important;
        /* Slightly distinct from card bg */
        border: 1px solid #f1f5f9 !important;
        border-radius: 16px !important;
        padding: 16px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 12px !important;
        position: relative;
    }

    /* Item Name */
    .quote-items-table .col-item {
        grid-column: 1 / -1;
        width: 100% !important;
        margin-bottom: 10px;
    }

    .quote-items-table .col-item strong {
        font-size: 1.1rem;
        color: var(--text-color);
        display: block;
        margin-bottom: 5px;
    }

    /* Inputs within Card */
    .quote-items-table .col-qty input,
    .quote-items-table .col-price input,
    .quote-items-table .col-discount input {
        background: white !important;
        /* White inputs on gray card */
        border: 1px solid #e2e8f0 !important;
        padding: 8px 12px !important;
        text-align: center;
    }

    /* Labels */
    .quote-items-table .col-qty::before {
        content: 'CANT';
        font-size: 0.7rem;
        font-weight: 800;
        color: #cbd5e1;
        display: block;
        text-align: center;
        margin-bottom: 4px;
    }

    .quote-items-table .col-price::before {
        content: 'PRECIO';
        font-size: 0.7rem;
        font-weight: 800;
        color: #cbd5e1;
        display: block;
        text-align: center;
        margin-bottom: 4px;
    }

    .quote-items-table .col-total {
        grid-column: 1 / -1;
        text-align: right;
        font-size: 1.3rem;
        font-weight: 800;
        color: var(--primary-color);
        margin-top: 10px;
        padding-top: 10px;
        border-top: 2px dashed #e2e8f0;
    }

    .quote-items-table .col-action {
        position: absolute !important;
        top: 10px;
        right: 10px;
    }

    /* 3. Totals Section */
    .totals-container .summary-line {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        font-size: 0.95rem;
        color: #64748b;
    }

    .totals-container .summary-line.total {
        font-size: 1.5rem;
        color: var(--text-color);
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #e2e8f0;
    }

    /* --- MOBILE BOTTOM NAV --- */
    body.login-active .mobile-bottom-nav {
        display: none !important;
    }

    .mobile-bottom-nav {
        position: fixed;
        bottom: 0px;
        /* Floating slightly */
        left: 0;
        width: 100%;
        height: 70px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
        display: flex;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
        z-index: 1000;
        border-top: 1px solid rgba(255, 255, 255, 0.5);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        padding-bottom: 5px;
        /* Safe Area */
    }

    /* 4. STICKY BOTTOM ACTIONS BAR */
    .quote-form-actions {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 15px 20px 30px 20px !important;
        /* Safe area */
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1) !important;
        z-index: 2100 !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 15px !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Hide standard buttons setup */
    .save-options {
        flex-direction: row !important;
        width: 100% !important;
        gap: 15px;
    }

    #cancel-quote-btn {
        display: none !important;
    }

    /* Back button exists in header */

    #save-draft-btn {
        background: #f1f5f9;
        color: #64748b;
        font-weight: 600;
        border: none;
        flex: 1 !important;
        border-radius: 12px !important;
    }

    #save-send-btn {
        background: linear-gradient(135deg, var(--primary-color), #4338ca) !important;
        color: white;
        font-weight: 700;
        border: none;
        box-shadow: 0 5px 20px rgba(79, 70, 229, 0.4);
        flex: 2 !important;
        /* Wider */
        font-size: 1rem !important;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        border-radius: 12px !important;
    }

    #save-send-btn::after {
        content: ' \f1d8';
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
    }

    /* Input Styling Tweak for Mobile */
    .zoho-style-form input,
    .zoho-style-form select,
    .zoho-style-form textarea {
        font-size: 1rem !important;
    }
}

/* --- 8. QUOTATION FORM FINAL REFINEMENT ("Single Card" Design) --- */
@media (max-width: 768px) {

    /* Main Container: The Card */
    .zoho-style-form {
        background: white !important;
        border-radius: 20px !important;
        padding: 20px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        margin: 15px !important;
        padding-bottom: 20px !important;
        min-height: auto !important;
        /* Let it grow naturally */
    }

    /* Sections: Remove individual card styling to merge them */
    .zoho-style-form .form-header-section,
    .zoho-style-form .form-table-section,
    .zoho-style-form .form-footer-section {
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
        margin-bottom: 25px !important;
        border: none !important;
        gap: 15px !important;
    }

    /* Inputs: Clean & Modern */
    .zoho-style-form input,
    .zoho-style-form select,
    .zoho-style-form textarea {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        padding: 12px 15px !important;
        font-size: 0.95rem !important;
        color: #334155 !important;
        box-shadow: none !important;
    }

    .zoho-style-form label {
        font-size: 0.85rem !important;
        color: #64748b !important;
        margin-bottom: 6px !important;
        font-weight: 600 !important;
    }

    /* 2. Compact Product List (Linear, not cards) */
    .quote-items-table .table-header {
        display: none !important;
    }

    .quote-items-table .table-body {
        gap: 0 !important;
        /* List flow */
        background: transparent !important;
    }

    .quote-items-table .table-row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        background: transparent !important;
        border-bottom: 1px solid #f1f5f9 !important;
        border-radius: 0 !important;
        padding: 12px 0 !important;
        box-shadow: none !important;
        gap: 0 !important;
        margin: 0 !important;
    }

    /* Item Name: Left, 60% */
    .quote-items-table .col-item {
        width: 60% !important;
        padding-right: 10px;
        grid-column: auto !important;
        margin: 0 !important;
    }

    .quote-items-table .col-item strong {
        font-size: 0.95rem;
        color: #1e293b;
        font-weight: 600;
        margin: 0 !important;
    }

    .quote-items-table .item-description {
        display: none !important;
    }

    /* Qty & Price: Right aligned inline */
    .quote-items-table .col-qty,
    .quote-items-table .col-price,
    .quote-items-table .col-discount {
        width: auto !important;
        flex: 1;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }

    /* Inputs inside rows: Minimalist Text Look */
    .quote-items-table .col-qty input,
    .quote-items-table .col-price input {
        background: transparent !important;
        border: none !important;
        text-align: right !important;
        padding: 0 !important;
        font-size: 0.95rem !important;
        color: #64748b;
        font-weight: 500;
        width: auto !important;
        min-width: 30px;
        display: inline-block;
    }

    /* Simulate "x1 $45,000" look */
    .quote-items-table .col-qty::before {
        content: 'x';
        color: #cbd5e1;
        margin-right: 2px;
        font-size: 0.8rem;
        margin-bottom: 0 !important;
        text-align: right;
    }

    .quote-items-table .col-price::before {
        content: '';
        margin-left: 5px;
        display: none !important;
    }

    /* Remove labels from prev design */
    .quote-items-table .col-qty::after,
    .quote-items-table .col-price::after {
        content: none !important;
    }

    .quote-items-table .col-total {
        display: none !important;
        /* Hide line total to save space */
    }

    .quote-items-table .col-action {
        width: 30px;
        display: flex;
        justify-content: flex-end;
        position: static !important;
        /* In flow */
    }

    /* 3. Totals */
    .totals-container .summary-line {
        font-size: 0.9rem;
        color: #64748b;
        padding: 6px 0;
        border-bottom: 1px dashed #f1f5f9;
        display: flex !important;
        justify-content: space-between !important;
    }

    .totals-container .summary-line:last-child {
        border-bottom: none;
    }

    .totals-container .summary-line.total {
        font-size: 1.4rem;
        color: #2563eb;
        /* Blue like image */
        font-weight: 800;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 2px solid #f1f5f9;
        border-bottom: none;
    }

    /* 4. Actions: Stacked Vertical at Bottom (Static) */
    .quote-form-actions {
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 20px 0 0 0 !important;
        flex-direction: column !important;
        gap: 12px !important;
        border: none !important;
        display: flex !important;
    }

    .save-options {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        display: flex !important;
    }

    #save-draft-btn {
        background: #6366f1 !important;
        /* Purple/Blue */
        color: white !important;
        padding: 14px !important;
        border-radius: 12px !important;
        width: 100% !important;
        font-weight: 600;
        box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
    }

    #save-send-btn {
        background: #10b981 !important;
        /* Green */
        color: white !important;
        padding: 14px !important;
        border-radius: 12px !important;
        width: 100% !important;
        font-weight: 600;
        box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
    }

    #save-send-btn::after {
        display: none !important;
    }

    #cancel-quote-btn {
        display: block !important;
        /* Show Cancel */
        background: #94a3b8 !important;
        /* Gray */
        color: white !important;
        padding: 14px !important;
        border-radius: 12px !important;
        width: 100% !important;
        border: none !important;
        font-weight: 600;
    }
}

/* --- 9. INVENTORY MOBILE OPTIMIZATION (ALL TABS) --- */
@media (max-width: 768px) {

    /* ============================
       1. GLOBAL & HEADER STYLES
       ============================ */
    #inventory-submodule-content>.card,
    #kits-table-wrapper,
    #adj-table-container {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .inventory-modern-header {
        background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
        border-radius: 24px !important;
        padding: 24px !important;
        margin-bottom: 24px !important;
        box-shadow: 0 10px 30px -10px rgba(79, 70, 229, 0.5) !important;
        position: relative;
        overflow: hidden;
    }

    .inventory-modern-header * {
        color: white !important;
    }

    .inventory-header-title i,
    .btn-new-item-modern {
        display: none !important;
    }

    .inventory-header-title h2 {
        font-size: 1.5rem !important;
        font-weight: 800;
        text-align: center;
        width: 100%;
        margin-bottom: 20px !important;
    }

    /* Stats Grid Default */
    .inventory-stats {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
    }

    .inventory-stats .inventory-stat-item {
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px !important;
        padding: 10px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .inventory-stats i {
        display: none !important;
    }

    .inventory-stats .inventory-stat-label {
        font-size: 0.65rem !important;
        opacity: 0.8;
    }

    .inventory-stats .inventory-stat-value {
        font-size: 0.9rem !important;
        font-weight: 700;
    }

    /* Filters Generic */
    .inventory-filters-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 15px !important;
        background: white !important;
        border-radius: 20px;
        margin-bottom: 20px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    }

    .filter-group-modern:first-child {
        grid-column: 1 / -1;
    }

    .filter-control-modern,
    #export-btn-main,
    #kits-export-btn {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        padding: 12px !important;
        font-size: 0.9rem !important;
    }

    /* Common Card Reset for Tables */
    .inventory-table-container table,
    .inventory-table-container tbody,
    #kits-table-wrapper table,
    #kits-table-wrapper tbody,
    #adj-table-container table,
    #adj-table-container tbody {
        display: block !important;
    }

    .inventory-table-container thead,
    #kits-table-wrapper thead,
    #adj-table-container thead {
        display: none !important;
    }

    .inventory-table-container tbody,
    #kits-table-body,
    #adj-table-container tbody {
        display: flex !important;
        flex-direction: column;
        gap: 20px;
    }

    /* ============================
       2. TAB: INVENTORY LIST & KITS (Shared Logic)
       ============================ */

    /* Base Card Style */
    .inventory-table-container tr,
    #kits-table-body tr {
        background: white !important;
        border-radius: 24px !important;
        padding: 20px !important;
        box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.06) !important;
        display: grid !important;
        /* Default Layout: Icon | Rest */
        grid-template-columns: 85px 1fr !important;
        align-items: center;
        gap: 5px 15px !important;
    }

    /* Unwrap TD1 content */
    .inventory-table-container td:first-child,
    .inventory-table-container td:first-child .product-cell,
    #kits-table-body td:first-child,
    #kits-table-body td:first-child .product-cell {
        display: contents !important;
    }

    /* Common Product Elements */
    .product-info {
        grid-area: info;
        text-align: center !important;
        width: 100%;
        margin-bottom: 5px;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .product-name {
        font-size: 1.25rem !important;
        font-weight: 800 !important;
        color: #1e293b;
        line-height: 1.2 !important;
        margin-bottom: 4px !important;
        text-align: center;
    }

    .product-sub {
        font-size: 0.8rem !important;
        color: #94a3b8;
        background: #f1f5f9;
        padding: 2px 8px;
        border-radius: 10px;
        width: fit-content;
    }

    .product-icon {
        grid-area: icon;
        align-self: start;
        width: 85px !important;
        height: 85px !important;
        border-radius: 16px !important;
        background: #f8fafc;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    .product-icon img {
        height: 100%;
        width: 100%;
        object-fit: cover;
    }

    /* Action Buttons Group */
    .action-btn-group,
    #kits-table-body .action-buttons {
        grid-area: btns;
        display: flex !important;
        justify-content: space-between !important;
        gap: 15px !important;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px dashed #f1f5f9;
    }

    .action-btn-group .btn-icon-modern,
    #kits-table-body .btn-icon-action {
        flex: 1;
        height: 48px !important;
        border-radius: 14px !important;
        border: none !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        color: #64748b;
        background: #f8fafc;
        width: 100% !important;
        margin: 0 !important;
    }

    /* Specific Button Colors */
    .btn-icon-modern:nth-child(1),
    .btn-icon-action.edit {
        background: #eff6ff !important;
        color: #3b82f6 !important;
    }

    .btn-icon-modern:nth-child(2),
    .btn-icon-action.log {
        background: #f5f3ff !important;
        color: #7c3aed !important;
    }

    .btn-icon-modern:nth-child(3),
    .btn-icon-action.activate,
    .btn-icon-action.delete {
        background: #f0fdf4 !important;
        color: #16a34a !important;
    }

    .btn-icon-modern.delete,
    .btn-icon-action.delete {
        background: #fef2f2 !important;
        color: #ef4444 !important;
    }


    /* --- SPECIFIC: INVENTORY LIST LAYOUT --- */
    .inventory-table-container tr {
        grid-template-areas:
            "info info"
            "cat cat"
            "icon stock"
            "icon price"
            "btns btns";
    }

    /* Mappings List */
    .inventory-table-container td:nth-child(2) {
        grid-area: cat;
        text-align: center;
    }

    .inventory-table-container td:nth-child(2) .category-badge {
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 20px;
        padding: 4px 12px;
        font-weight: 600;
        font-size: 0.75rem;
        color: #64748b;
    }

    .inventory-table-container td:nth-child(3) {
        grid-area: stock;
        justify-self: end;
        width: 100%;
        direction: rtl;
    }

    /* RTL to align stock block right? No, standard block right aligned */
    .inventory-table-container .stock-cell {
        text-align: right;
        background: #f8fafc;
        padding: 8px;
        border-radius: 8px;
        border: 1px solid #f1f5f9;
    }

    .inventory-table-container .stock-number {
        justify-content: flex-end;
        font-weight: 700;
        color: #334155;
    }

    .inventory-table-container td:nth-child(5) {
        grid-area: price;
        justify-self: end;
        text-align: right;
        font-weight: 900;
        font-size: 1.4rem;
        color: var(--primary-color);
        letter-spacing: -0.5px;
        align-self: start;
    }

    .inventory-table-container td:last-child {
        display: contents;
    }

    /* Unwrap to let buttons be grid item? No, specific TD contains buttons */
    .inventory-table-container td:last-child {
        grid-area: btns;
        display: block;
        width: 100%;
    }

    .inventory-table-container td:nth-child(4) {
        display: none;
    }


    /* --- SPECIFIC: KITS LAYOUT --- */
    #kits-table-body tr {
        grid-template-areas:
            "info info"
            "status status"
            "icon price"
            "btns btns";
    }

    /* Kits Mappings */
    /* TD1 is unwrapped (Icon/Name/SKU). Info->info, Icon->icon */
    /* Price is TD2 */
    #kits-table-body td:nth-child(2) {
        grid-area: price;
        text-align: right;
        font-weight: 900;
        font-size: 1.4rem;
        color: var(--primary-color);
        justify-self: end;
        align-self: center;
    }

    /* Status is TD3 */
    #kits-table-body td:nth-child(3) {
        grid-area: status;
        justify-self: center;
        margin-bottom: 10px;
    }

    #kits-table-body .status-badge {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 0.8rem;
        font-weight: 600;
    }

    #kits-table-body .status-active {
        background: #dcfce7;
        color: #166534;
    }

    #kits-table-body .status-inactive {
        background: #fee2e2;
        color: #991b1b;
    }

    /* Actions TD4 */
    #kits-table-body td:last-child {
        grid-area: btns;
        display: block !important;
        width: 100%;
    }


    /* ============================
       3. TAB: STOCK ADJUSTMENTS
       ============================ */

    #adj-table-container tr {
        background: white !important;
        border-radius: 20px !important;
        padding: 20px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
        margin-bottom: 15px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas:
            "name name"
            "sku sku"
            "sys input"
            "diff diff"
            "reason reason";
        gap: 12px !important;
        align-items: center;
    }

    #adj-table-container td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
    }

    /* TD1: Name (Top) */
    #adj-table-container td:first-child {
        grid-area: name;
        text-align: center;
    }

    #adj-table-container td:first-child div:first-child {
        font-size: 1.1rem;
        font-weight: 800;
        color: #1e293b;
    }

    /* Name */
    #adj-table-container td:first-child div:last-child {
        font-size: 0.8rem;
        color: #94a3b8;
        margin-top: 2px;
        text-transform: uppercase;
        font-weight: 600;
    }

    /* Cat */

    /* TD2: SKU */
    #adj-table-container td:nth-child(2) {
        grid-area: sku;
        text-align: center;
        color: #cbd5e1;
        font-family: monospace;
        font-size: 0.9rem;
        background: #f8fafc;
        border-radius: 8px;
        padding: 4px;
        width: fit-content;
        justify-self: center;
    }

    /* TD3: System Stock */
    #adj-table-container td:nth-child(3) {
        grid-area: sys;
        text-align: center;
        background: #f1f5f9;
        padding: 10px;
        border-radius: 12px;
    }

    #adj-table-container td:nth-child(3)::before {
        content: 'Sistema';
        display: block;
        font-size: 0.7rem;
        text-transform: uppercase;
        color: #94a3b8;
        margin-bottom: 4px;
    }

    /* TD4: Input Physical */
    #adj-table-container td:nth-child(4) {
        grid-area: input;
    }

    #adj-table-container input.form-control {
        height: 50px !important;
        font-size: 1.2rem !important;
        font-weight: 700;
        text-align: center;
        border: 2px solid #e2e8f0 !important;
        border-radius: 12px !important;
        background: white !important;
    }

    #adj-table-container input.form-control:focus {
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    }

    /* TD5: Diff Badge */
    #adj-table-container td:nth-child(5) {
        grid-area: diff;
        text-align: center;
    }

    #adj-table-container td:nth-child(5) .badge {
        font-size: 1rem !important;
        padding: 6px 16px !important;
        border-radius: 20px;
    }

    /* TD6: Reason */
    #adj-table-container td:last-child {
        grid-area: reason;
    }

    #adj-table-container select.form-control {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        height: 45px !important;
        border-radius: 10px !important;
    }

    /* FAB for Kits */
    .inventory-submodule-kits .btn-new-item-modern {
        /* If specific targeting needed, but generic works */
    }

    #inventory-pagination {
        padding-bottom: 120px !important;
        gap: 20px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        margin-top: 30px !important;
        margin-bottom: 20px !important;
    }
}