:root {
    --primary-color: #111111; /* Negro para acciones principales y botones */
    --primary-hover: #333333;
    --secondary-color: #FACC15; /* Amarillo para acentos y detalles */
    --secondary-hover: #EAB308;
    --accent-color: #FACC15; /* Amarillo */
    --bg-color: #F3F4F6; /* Gris muy claro para contraste con tarjetas blancas */
    --card-bg: #FFFFFF; /* Blanco sólido para diseño limpio */
    --text-main: #111111; /* Negro para textos */
    --text-muted: #6B7280; /* Gris para textos secundarios */
    --sidebar-bg: #111111; /* Negro para el menú */
    --sidebar-text: #E5E7EB; /* Gris muy claro para textos del menú */
    --glass-border: rgba(0, 0, 0, 0.08); /* Bordes sutiles grises/negros */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); /* Sombras sobrias */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.sidebar.collapsed {
    width: 72px;
    padding: 1.25rem 0.5rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0 0.4rem;
}

.sidebar.collapsed #brand-name {
    display: none;
}

.btn-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 0.4rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    margin-bottom: 0.5rem;
    padding-right: 4px;
}

.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Base item style for all nav li elements */
.sidebar nav li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.42rem 0.65rem;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar nav li svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.sidebar nav li span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar nav li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar nav li:hover svg {
    opacity: 1;
}

.sidebar nav li.active {
    background: var(--secondary-color, #f59e0b) !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.sidebar nav li.active svg {
    stroke: #0f172a !important;
    opacity: 1 !important;
}

/* 1. Group Headers (Dashboard, Pedidos en proceso, Configuración) */
.menu-group-header {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 0.45rem 0.65rem !important;
    margin-top: 3px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
}

.menu-group-header .chevron {
    margin-left: auto;
    width: 13px !important;
    height: 13px !important;
    opacity: 0.65;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
}

.menu-group-header:hover .chevron {
    opacity: 1;
}

/* 2. Group Content (Container of sub-items) */
.menu-group-content {
    display: none;
    list-style: none;
    padding: 0;
    margin: 2px 0 4px 0.75rem;
    padding-left: 0.45rem;
    border-left: 1.5px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.menu-group-content.show,
.menu-group-content[style*="display: block"] {
    animation: menuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Sub-menu items (Análisis Ped. APP, Aprobación Comercial, etc.) */
.sub-menu-item {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.55rem !important;
    color: rgba(255, 255, 255, 0.7) !important;
    gap: 0.55rem !important;
    border-radius: 5px !important;
}

.sub-menu-item svg {
    width: 14px !important;
    height: 14px !important;
}

/* 4. Subgroup Headers (PEDIDOS, VENTAS) */
.menu-subgroup-header {
    font-size: 0.73rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.35rem 0.55rem !important;
    margin-top: 3px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.55rem !important;
    border-radius: 5px !important;
}

.menu-subgroup-header svg {
    width: 14px !important;
    height: 14px !important;
}

.menu-subgroup-header .chevron {
    margin-left: auto;
    width: 12px !important;
    height: 12px !important;
    opacity: 0.65;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 5. Subgroup Content (Container of nested items) */
.menu-subgroup-content {
    display: none;
    list-style: none;
    padding: 0;
    margin: 2px 0 4px 0.6rem;
    padding-left: 0.4rem;
    border-left: 1.5px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.menu-subgroup-content.show,
.menu-subgroup-content[style*="display: block"] {
    animation: menuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. Nested Sub-menu items (RESUMEN, VTA MES, VTA CLIENTE, etc.) */
.nested-sub-menu-item {
    font-size: 0.71rem !important;
    font-weight: 500 !important;
    padding: 0.3rem 0.5rem !important;
    color: rgba(255, 255, 255, 0.65) !important;
    gap: 0.45rem !important;
    border-radius: 4px !important;
}

.nested-sub-menu-item svg {
    width: 13px !important;
    height: 13px !important;
}

.nested-sub-menu-item:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

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

.sidebar.collapsed .menu-group-header span,
.sidebar.collapsed .menu-subgroup-header span,
.sidebar.collapsed .chevron,
.sidebar.collapsed nav li span {
    display: none !important;
}

.sidebar.collapsed .menu-group-content,
.sidebar.collapsed .menu-subgroup-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
}

.sidebar.collapsed nav li {
    justify-content: center;
    padding: 0.5rem 0 !important;
}

.user-info {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar.collapsed .user-details {
    display: none;
}

.user-details p {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-details small {
    color: rgba(255, 255, 255, 0.5);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-bar {
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.viewport {
    padding: 2rem;
    flex-grow: 1;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 0.75rem;
    box-shadow: var(--shadow);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s;
}

.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
    background: white;
    border-radius: 1rem 1rem 0 0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    background: white;
    border-radius: 0 0 1rem 1rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem;
}

.btn-delete:hover {
    filter: drop-shadow(0 0 5px rgba(243, 101, 35, 0.5));
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 0.4rem 0.25rem;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 0.4rem 0.25rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge.administrador {
    background: #e5e7eb;
    color: #111827;
}

.badge.vendedor {
    background: #dcfce7;
    color: #166534;
}

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

.badge.logistica {
    background: #ddd6fe;
    color: #5b21b6;
}

.badge.status-borrador {
    background: #f3f4f6;
    color: #4b5563;
}

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

.badge.status-enviado,
.badge.status-comercial {
    background: #fef9c3;
    color: #854d0e;
}

.badge.status-ok_comerc {
    background: #e0f2fe;
    color: #0369a1;
}

.badge.status-aprobado {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.status-anulado {
    background: #fdebe1;
    color: #c9521c;
}

.badge.status-retenido {
    background: #fef2f2;
    color: #991b1b;
}

.badge.cliente {
    background: #e0f2fe;
    color: #0369a1;
}

.status-activo {
    color: var(--secondary-color);
    font-weight: 600;
}

.status-inactivo {
    color: var(--accent-color);
    font-weight: 600;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 0.4rem;
}

.form-group input[type="file"] {
    max-width: 100%;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    padding: 0.6rem 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.form-actions {
    grid-column: span 2;
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* Modal refinements */
.visible {
    display: flex;
    opacity: 1;
}

/* Notifications */
.notification-banner {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.3s ease-out;
}

.notification-banner.warning {
    background-color: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.notification-banner button {
    margin-left: auto;
    background: #c2410c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tabs UI Refinement */
.tabs-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tabs-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: #f1f5f9;
    border-radius: 0.75rem;
    width: fit-content;
}

.tab-btn {
    background-color: transparent;
    color: var(--text-muted);
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 105, 189, 0.3);
}

/* Order Editor Meta Info */
.order-editor-meta {
    background: #ffffff;
    padding: 1.5rem 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.order-editor-meta .meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.order-editor-meta .meta-item strong,
.order-editor-meta .meta-item label strong {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
}

.order-editor-meta .meta-item span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.order-editor-meta .total-item {
    margin-left: auto;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #bae6fd;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.1);
    align-items: flex-end;
}

.order-editor-meta .units-item {
    /* same base styles but no auto margin */
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #a7f3d0;
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.1);
    align-items: flex-end;
}

/* override colors for units-item */
.order-editor-meta .units-item {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
}


.order-editor-meta .total-item strong {
    color: #0369a1;
}

.order-editor-meta .total-item span {
    font-size: 1.75rem;
    color: #0284c7;
    line-height: 1;
}

/* units text colors */
.order-editor-meta .units-item strong {
    color: #059669;
}

.order-editor-meta .units-item span {
    font-size: 1.75rem;
    color: #047857;
    line-height: 1;
}

.order-editor-meta .meta-item select {
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: #f8fafc;
    font-size: 1rem;
    color: #334155;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7' /%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    min-width: 200px;
}

.order-editor-meta .meta-item select:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.15);
}

/* Dashboard Stat Cards Enhanced */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem !important;
}

.stat-card .stat-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 100px;
    height: 100px;
    opacity: 0.15;
    background: transparent !important;
    transform: rotate(-15deg);
}

.stat-card .stat-icon svg {
    width: 100%;
    height: 100%;
}

.stat-content {
    width: 100%;
    position: relative;
    z-index: 1;
}

.stat-content h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    display: block;
}

.stat-grid-goals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 0.75rem;
}

.stat-sub-item {
    display: flex;
    flex-direction: column;
}

.stat-sub-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.stat-sub-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
}

.stat-percentage {
    font-weight: 800;
    color: var(--primary-color);
}

/* Stat Cards Small Version */
.stat-card-small {
    padding: 0.75rem !important;
}

.stat-card-small .stat-icon {
    width: 60px;
    height: 60px;
    right: -5px;
    bottom: -5px;
}

.stat-card-small h3 {
    font-size: 0.65rem;
    margin-bottom: 0.25rem;
}

.stat-card-small .stat-value {
    font-size: 1.2rem;
    line-height: 1.2;
}

.stat-card-small .stat-main {
    gap: 0.4rem;
}

.stat-card-small .stat-grid-goals {
    padding-top: 0.5rem;
    gap: 0.25rem;
}

.stat-card-small .stat-sub-value {
    font-size: 0.75rem;
}

.stat-card-small .stat-sub-label {
    font-size: 0.6rem;
}

/* Base styles for the card (hidden on desktop) */
.mobile-item-card {
    display: none;
    border: 1px solid #94a3b8;
    border-radius: 0;
    background: #fff;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.mobile-only-block {
    display: none;
}

/* =========================================
   RESPONSIVE DESIGN (Mobile & Tablet)
   ========================================= */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        /* Permitir scroll en el cuerpo */
        height: auto;
    }

    .app-container {
        flex-direction: column;
        /* Cambiar layout a vertical */
        height: auto;
        overflow: visible;
    }

    /* Sidebar transformado en Men�� Superior de Botones */
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        overflow: visible;
    }

    .sidebar.collapsed {
        width: 100%;
        /* Desactivar colapso en m��vil */
    }

    .sidebar-header {
        justify-content: center;
        margin-bottom: 1rem;
    }

    #toggle-sidebar {
        display: none;
        /* Ocultar bot��n de colapsar */
    }

    .sidebar nav ul {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        /* 3 Columnas */
        gap: 0.5rem;
    }

    .sidebar nav li {
        flex-direction: column;
        /* Icono arriba, texto abajo */
        justify-content: center;
        text-align: center;
        padding: 0.8rem 0.5rem;
        gap: 0.3rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        white-space: normal;
    }

    .sidebar nav li span {
        display: block !important;
        font-size: 0.7rem;
        line-height: 1.1;
    }

    .user-info {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Ajustes de Contenido Principal */
    .main-content {
        overflow: visible;
        height: auto;
    }

    .viewport {
        padding: 4px 2px;
    }

    /* Grillas a 1 sola columna */
    .dashboard-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group {
        grid-column: span 1 !important;
    }

    /* Asegurar que los form-actions tambi��n se adapten a 1 columna */
    .form-actions {
        grid-column: span 1 !important;
    }

    /* Forzar campos de formulario que usen inline span 2 a 1 columna */
    .form-grid [style*="grid-column: span 2"],
    .form-grid [style*="grid-column:span 2"] {
        grid-column: span 1 !important;
    }

    /* Botones compactos con texto debajo del icono */
    .btn-primary span,
    .btn-secondary span {
        display: block !important;
        font-size: 0.65rem;
        margin-top: 2px;
        line-height: 1;
        white-space: normal;
        text-align: center;
    }

    .btn-primary,
    .btn-secondary {
        flex-direction: column !important;
        padding: 0.5rem 0.25rem !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important;
        min-width: 60px !important;
        height: auto !important;
    }

    .btn-primary svg,
    .btn-secondary svg {
        width: 18px;
        height: 18px;
    }

    /* Modales ajustados */
    .modal-content {
        width: 98%;
        margin: 4px auto;
        max-height: 98vh;
        overflow-y: auto;
    }

    .modal-body {
        padding: 1rem 2px;
    }

    .top-bar {
        padding: 0.5rem 1rem;
    }

    /* Responsive Orders Table & Toolbar */
    .desktop-only {
        display: none !important;
    }

    .mobile-only-block {
        display: block;
    }

    .orders-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem !important;
    }

    .orders-filters {
        flex-wrap: wrap;
        width: 100%;
    }

    .orders-filters select,
    .orders-filters input {
        flex: 1 1 40%;
        min-width: 0 !important;
        width: auto !important;
    }

    .orders-filters button {
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    /* Order Editor Meta Responsive */
    .order-editor-meta {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
        padding: 1rem;
    }

    .order-editor-meta .meta-item {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f1f5f9;
        gap: 0.5rem;
    }

    .order-editor-meta .meta-item:last-child {
        border-bottom: none;
    }

    .order-editor-meta .total-item {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border: 1px solid #bae6fd;
        border-radius: 0.75rem;
        padding: 1rem;
    }

    .order-editor-meta .meta-item select {
        width: 100%;
        min-width: 0;
        margin-top: 0.25rem;
    }

    /* New Responsive Order Item Card Grid */
    .mobile-item-card {
        display: grid;
        grid-template-columns: 1.25fr 1fr 2fr auto;
    }

    .data-table.responsive-order-table thead {
        display: none;
    }

    .data-table.responsive-order-table tbody,
    .data-table.responsive-order-table tr,
    .data-table.responsive-order-table td {
        display: block;
        padding: 0;
        border: none;
    }

    .data-table.responsive-order-table tbody tr+tr .mobile-item-card {
        border-top-width: 0;
    }

    .mic-col-info {
        padding: 2px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-right: 1px solid #f1f5f9;
    }

    .mic-col-sizes {
        padding: 2px;
        background: #e0f2fe;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        border-right: 1px solid #f1f5f9;
        min-width: 80px;
    }

    .mic-col-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, 1fr);
    }

    .mic-stat-box {
        padding: 2px;
        border-right: 1px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 0.7rem;
        text-align: center;
    }

    .mic-stat-box:nth-child(even) {
        border-right: none;
    }

    .mic-stat-box:nth-last-child(-n+2) {
        border-bottom: none;
    }

    .mic-col-delete {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2px;
        background: #fff;
        border-left: 1px solid #f1f5f9;
    }

    .mic-label {
        font-size: 0.55rem;
        color: #94a3b8;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 1px;
    }

    .mic-value {
        font-weight: 700;
        color: #475569;
        font-size: 0.75rem;
    }

    .mic-value.total {
        color: var(--primary-color);
    }
}


/* Loading Spinner */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Custom Font Style: Roboto for VTA MES Module Filters and Table */
#vta-mes-table,
#vta-mes-table th,
#vta-mes-table td,
#vta-mes-table button,
#vta-mes-table span,
[id^="vta-mes-filter"],
.vta-mes-tercero-item,
#vta-mes-tercero-preview-list {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}