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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    font-size: 1.8rem;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    transition: border-color 0.3s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.login-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
}

/* ============ App Layout ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
    width: 220px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

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

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    color: #475569;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

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

.nav-btn.active {
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.nav-btn.has-submenu {
    justify-content: space-between;
}

.nav-arrow {
    font-size: 1rem;
    transition: transform 0.2s ease;
    color: #94a3b8;
}

.nav-group.open .nav-arrow {
    transform: rotate(90deg);
}

.nav-btn.active .nav-arrow {
    color: white;
}

/* Submenu */
.nav-submenu {
    display: none;
    flex-direction: column;
    padding-left: 12px;
    margin-top: 2px;
    gap: 1px;
}

.nav-group.open .nav-submenu {
    display: flex;
}

.nav-sub-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background-color: transparent;
    color: #64748b;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    border-left: 2px solid transparent;
}

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

.nav-sub-btn.active {
    background-color: #eff6ff;
    color: #2563eb;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.user-info {
    margin-bottom: 8px;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.85rem;
    display: block;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.user-actions .btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 8px 12px;
}

.user-actions .btn-secondary {
    background: white;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.user-actions .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 32px;
    background-color: #f1f5f9;
    min-height: 100vh;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.mes-section {
    padding: 0;
}

.mes-description {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.mes-last-updated {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #95a5a6;
}

.mes-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px;
    color: #7f8c8d;
    font-size: 1rem;
}

.mes-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

th.num-col {
    text-align: right;
}

.mes-row-warning {
    background-color: #fff3cd;
}

.mes-row-warning:hover {
    background-color: #ffe8a1;
}

.mes-row-critical {
    background-color: #f8d7da;
}

.mes-row-critical:hover {
    background-color: #f5c6cb;
}

/* MES Controls */
.mes-controls {
    margin-bottom: 15px;
}

/* MES Sortable Columns */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

th.sortable:hover {
    background-color: #e9ecef;
}

th.sortable.sorted {
    background-color: #e3f2fd;
}

.sort-indicator {
    margin-left: 5px;
    font-size: 0.75rem;
    color: #3498db;
}

/* Reorder column styling */
.reorder-now {
    color: #e74c3c;
    font-weight: 700;
}

.reorder-soon {
    color: #e67e22;
    font-weight: 600;
}

/* MES Controls - Enhanced */
.mes-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mes-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mes-bulk-actions span {
    color: #666;
    font-size: 0.9rem;
}

.bulk-status-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
}

.bulk-status-select:focus {
    outline: none;
    border-color: #3498db;
}

/* MES Filters */
.mes-filters {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.filter-header span {
    font-weight: 600;
    color: #333;
}

.filter-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-row select,
.filter-row input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
}

.filter-row select:focus,
.filter-row input:focus {
    outline: none;
    border-color: #3498db;
}

.filter-column {
    min-width: 120px;
}

.filter-operator {
    min-width: 100px;
}

.filter-value {
    min-width: 100px;
    max-width: 150px;
}

.filter-remove {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.filter-remove:hover {
    color: #c0392b;
}

/* Checkbox column */
.checkbox-col {
    width: 40px;
    text-align: center;
}

.checkbox-col input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Status column */
.status-cell {
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-manufactured {
    background-color: #cce5ff;
    color: #004085;
}

.status-liquidation {
    background-color: #fff3cd;
    color: #856404;
}

.status-priority {
    background-color: #f8d7da;
    color: #721c24;
}

/* MES Table Mobile Responsive */
.mes-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mes-table {
    min-width: 100%;
}

.sku-cell {
    cursor: pointer;
    color: #3498db;
    transition: color 0.2s;
}

.sku-cell:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Sales Modal Chart */
.sales-modal-body {
    padding: 20px 25px 25px;
    height: 300px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #475569;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Sidebar responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 16px;
        border-bottom: 1px solid #e2e8f0;
        border-right: none;
    }

    .sidebar-header h1 {
        font-size: 1.1rem;
    }

    .sidebar-nav {
        flex-direction: column;
        padding: 12px 8px;
        gap: 2px;
        overflow-x: visible;
        overflow-y: auto;
        flex: 1;
    }

    .nav-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
        white-space: normal;
        flex-shrink: 0;
    }

    .sidebar-footer {
        border-top: 1px solid #e2e8f0;
        border-left: none;
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .sidebar-footer .user-info {
        display: block;
    }

    .sidebar-footer .user-actions {
        flex-direction: row;
    }

    .main-content {
        margin-left: 0;
        margin-top: 0;
        padding: 16px;
        padding-top: 70px;
    }

    .mes-table-container {
        margin: 0 -16px;
        padding: 0 16px;
        width: calc(100% + 32px);
    }

    .mes-table th,
    .mes-table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }

    .mes-table th:first-child,
    .mes-table td:first-child {
        position: sticky;
        left: 0;
        background-color: white;
        z-index: 1;
    }

    .mes-row-warning td:first-child {
        background-color: #fff3cd;
    }

    .mes-row-critical td:first-child {
        background-color: #f8d7da;
    }

    .sales-modal-body {
        height: 250px;
    }

    .modal-content.modal-large {
        max-width: 95%;
        margin: 10px;
    }
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #1e293b;
}

section {
    padding: 0;
    margin-bottom: 32px;
}

.hint {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.drop-zone {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.drop-zone p {
    margin: 10px 0;
    color: #7f8c8d;
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    letter-spacing: 0.2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: #fff;
    color: #1e293b;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #cbd5e1;
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #334155;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 0.9rem;
}

.btn-sort {
    background-color: #ecf0f1;
    color: #555;
}

.btn-sort:hover {
    background-color: #bdc3c7;
}

.btn-sort.active {
    background-color: #3498db;
    color: white;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: #fff3cd;
    border-radius: 4px;
}

.bulk-actions span {
    font-size: 0.9rem;
    color: #856404;
    font-weight: 600;
}

.th-checkbox {
    width: 40px;
    text-align: center;
}

.td-checkbox {
    text-align: center;
}

.td-checkbox input,
.th-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

tr.selected {
    background-color: #e8f4fd;
}

.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

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

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table tbody tr:hover {
    background-color: #f8fafc;
}

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

.quantity-input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    text-align: center;
}

.actions {
    display: flex;
    gap: 8px;
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
    display: none;
}

.empty-message.show {
    display: block;
}

.no-results {
    text-align: center;
    color: #7f8c8d;
    padding: 30px;
}

table.hidden {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    /* More breathing room on the sides, especially on desktop */
    padding: clamp(16px, 4vw, 40px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 20px 25px 22px;
}

.modal-large {
    max-width: 680px;
}

.modal-xlarge {
    max-width: 920px;
}

.modal-small {
    max-width: 380px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.modal-close:hover {
    color: #1e293b;
    background-color: #e2e8f0;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #ecf0f1;
}

.tab-btn.active {
    background: white;
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

.tab-content {
    display: none;
    padding: 25px;
}

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

.modal-content .form-group {
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Modal form body padding */
.modal-content form {
    padding: 20px 25px;
}

.modal-content form .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-content form .form-row > .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Edit modal without tabs needs padding */
#editModal .modal-content {
    padding: 0;
}

#editModal form {
    padding: 25px;
}

/* Holded Import */
.holded-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.holded-search {
    flex: 1;
}

.holded-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
}

.holded-search input:disabled {
    background-color: #f5f5f5;
}

.holded-loading {
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
}

.holded-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.holded-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.holded-item:hover {
    background-color: #f8f9fa;
}

.holded-item.selected {
    background-color: #e8f4fd;
}

.holded-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.holded-item-info {
    flex: 1;
    min-width: 0;
}

.holded-item-name {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.holded-item-details {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 2px;
}

.holded-item-sku {
    font-weight: 600;
}

#holdedActions {
    justify-content: space-between;
    align-items: center;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
}

.select-all-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#holdedSelected {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-left: auto;
    margin-right: 10px;
}

.holded-empty {
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .header-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Supplier Modal Styles */
.supplier-modal-body {
    padding: 20px 25px;
}

.supplier-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.supplier-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1rem;
}

.supplier-form .form-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.supplier-form .form-group {
    flex: 1;
    min-width: 120px;
}

.supplier-form .form-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.supplier-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.supplier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

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

.supplier-item.default-supplier {
    background-color: #f0f8ff;
}

.supplier-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.supplier-info strong {
    color: #2c3e50;
}

.supplier-leadtime {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.supplier-actions {
    display: flex;
    gap: 8px;
}

.supplier-cell {
    white-space: nowrap;
    color: #555;
}

/* Btn danger style */
.btn-danger {
    background-color: #e74c3c;
    color: white;
}

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

/* Supplier modal responsive */
@media (max-width: 600px) {
    .supplier-form .form-row {
        flex-direction: column;
    }

    .supplier-form .form-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .supplier-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .supplier-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Team Modal Styles */
.team-modal-body {
    padding: 20px 25px;
}

.team-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.team-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1rem;
}

.team-form .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.team-form .form-group {
    flex: 1;
    min-width: 0;
}

.permissions-section {
    margin-bottom: 15px;
}

.permissions-section > label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.permissions-checkboxes {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.team-list {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

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

.team-item.current-user {
    background-color: #e8f4fd;
}

.team-item.inactive-user {
    opacity: 0.6;
    background-color: #f5f5f5;
}

.team-info {
    flex: 1;
}

.team-name {
    font-weight: 600;
    color: #2c3e50;
}

.team-login {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.team-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.team-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background-color: #d4edda;
    color: #155724;
}

.badge-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-section {
    background-color: #e2e3e5;
    color: #383d41;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.team-actions {
    display: flex;
    gap: 8px;
}

/* User History Modal */
.user-history-content {
    max-height: 65vh;
    overflow-y: auto;
}

.history-date-group {
    margin-bottom: 20px;
}

.history-date-group:last-child {
    margin-bottom: 0;
}

.history-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-date {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
}

.history-date-summary {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.history-entries {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: box-shadow 0.15s ease;
}

.history-entry:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.history-entry-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-op-name {
    font-size: 0.9rem;
    color: #1e293b;
}

.history-product {
    font-size: 0.78rem;
    color: #64748b;
}

.history-order {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 500;
}

.history-entry-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.history-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.history-stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.history-stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

@media (max-width: 768px) {
    .history-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .history-entry-stats {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    .history-stat {
        min-width: 50px;
    }
}

/* Login page responsive */
@media (max-width: 500px) {
    .login-container {
        margin: 15px;
        padding: 25px;
    }

    .login-container h1 {
        font-size: 1.5rem;
    }
}

/* Team modal responsive */
@media (max-width: 600px) {
    .team-form .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .permissions-checkboxes {
        flex-direction: column;
        gap: 10px;
    }

    .team-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .team-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ============ MES Manufacturing Section ============ */

.mes-manufacturing-section {
    padding: 0;
}

.mes-manufacturing-section .section-header {
    margin-bottom: 24px;
}

/* MES Topbar - shown when sidebar is hidden */
.mes-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.mes-topbar-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.mes-topbar-logout {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #64748b;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mes-topbar-logout:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

/* MES Sub-navigation */
.mes-subnav {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mes-subnav::-webkit-scrollbar {
    display: none;
}

.mes-subnav-btn {
    padding: 9px 16px;
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.mes-subnav-btn:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}

.mes-subnav-btn.active {
    color: #1e40af;
    background: #eff6ff;
}

.mes-subpage {
    display: none;
}

.mes-subpage.active {
    display: block;
}

.subpage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.subpage-header h3 {
    font-size: 1.4rem;
    color: #1e293b;
    margin: 0;
    font-weight: 700;
}

.subpage-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
    width: 200px;
    max-width: 100%;
    min-width: 0;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Clean List Styles */
.clean-list {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.clean-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
}

.clean-list-item:last-child {
    border-bottom: none;
}

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

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

.list-item-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.list-item-subtitle {
    color: #64748b;
    font-size: 0.8rem;
}

.list-item-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.list-item-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tag-raw {
    background: #fef3c7;
    color: #92400e;
}

.tag-intermediate {
    background: #dbeafe;
    color: #1e40af;
}

.tag-active {
    background: #dcfce7;
    color: #166534;
}

.tag-inactive {
    background: #f1f5f9;
    color: #64748b;
}

.list-item-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.85rem;
    min-width: 60px;
    text-align: right;
}

.list-item-unit {
    color: #64748b;
    font-size: 0.75rem;
    min-width: 50px;
}

/* 3-dot menu */
.menu-dots {
    position: relative;
}

.menu-dots-btn {
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: #64748b;
    font-size: 1.2rem;
    line-height: 1;
}

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

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 140px;
    display: none;
}

.menu-dropdown.show {
    display: block;
}

.menu-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
}

.menu-dropdown-item:hover {
    background: #f8fafc;
    color: #1e293b;
}

.menu-dropdown-item.danger {
    color: #dc2626;
}

.menu-dropdown-item.danger:hover {
    background: #fef2f2;
}

/* Team stats card */
.team-stat-card {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    gap: 16px;
}

.team-stat-card:last-child {
    border-bottom: none;
}

.team-stat-card:hover {
    background: #f8fafc;
}

.team-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

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

.team-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.team-login {
    color: #64748b;
    font-size: 0.8rem;
}

.team-stats {
    display: flex;
    gap: 24px;
    flex-shrink: 0;
}

.team-stat {
    text-align: center;
}

.team-stat-value {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.1rem;
}

.team-stat-label {
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Permissions grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

/* MES Tables */
.mes-manufacturing-section table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.mes-manufacturing-section th,
.mes-manufacturing-section td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.mes-manufacturing-section th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mes-manufacturing-section td {
    font-size: 0.95rem;
    color: #334155;
}

.mes-manufacturing-section tbody tr {
    transition: background-color 0.15s ease;
}

.mes-manufacturing-section tbody tr:hover {
    background-color: #f8fafc;
}

.mes-manufacturing-section tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges in MES */
.status-active {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 20px;
}

.status-inactive {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 20px;
}

/* Action buttons in MES tables */
.mes-manufacturing-section .action-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mes-manufacturing-section .action-btns .btn {
    padding: 7px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Unit display */
.unit-badge {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Scope badge */
.scope-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.scope-global {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.scope-product {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* MES responsive */
@media (max-width: 768px) {
    .mes-subnav {
        gap: 2px;
        padding: 3px;
        margin-bottom: 16px;
        border-radius: 8px;
    }

    .mes-subnav-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
        border-radius: 6px;
    }

    .mes-topbar {
        margin-bottom: 12px;
    }

    .subpage-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .subpage-header h3 {
        font-size: 1.2rem;
    }

    .mes-manufacturing-section table {
        border-radius: 8px;
    }

    .mes-manufacturing-section th,
    .mes-manufacturing-section td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .mes-manufacturing-section .action-btns {
        flex-direction: column;
        gap: 4px;
    }

    .mes-manufacturing-section .action-btns .btn {
        width: 100%;
        text-align: center;
        padding: 8px 10px;
    }
}

/* MES ag-Grid containers */
.mes-grid-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#mesOrdersGrid.ag-theme-quartz,
#mesPurchasesGrid.ag-theme-quartz,
#mesProductosGrid.ag-theme-quartz,
#mesInventarioGrid.ag-theme-quartz,
#mesOperacionesGrid.ag-theme-quartz,
#mesEquipoGrid.ag-theme-quartz {
    height: 500px;
    width: 100%;
    --ag-font-family: 'Montserrat', sans-serif;
    --ag-font-size: 13px;
    --ag-row-height: 44px;
    --ag-header-height: 48px;
    --ag-header-background-color: #f8fafc;
    --ag-header-foreground-color: #334155;
    --ag-odd-row-background-color: #ffffff;
    --ag-row-hover-color: #f1f5f9;
    --ag-border-color: #e2e8f0;
    --ag-cell-horizontal-border: none;
    --ag-row-border-color: #f1f5f9;
    --ag-header-column-separator-display: none;
    --ag-borders: none;
    --ag-border-radius: 8px;
}

#mesOrdersGrid .ag-header-cell-label,
#mesPurchasesGrid .ag-header-cell-label,
#mesProductosGrid .ag-header-cell-label,
#mesInventarioGrid .ag-header-cell-label,
#mesOperacionesGrid .ag-header-cell-label,
#mesEquipoGrid .ag-header-cell-label {
    justify-content: center;
    font-weight: 600;
}

#mesOrdersGrid .ag-header-cell,
#mesPurchasesGrid .ag-header-cell,
#mesProductosGrid .ag-header-cell,
#mesInventarioGrid .ag-header-cell,
#mesOperacionesGrid .ag-header-cell,
#mesEquipoGrid .ag-header-cell {
    border-bottom: 2px solid #e2e8f0;
}

#mesOrdersGrid .ag-row,
#mesPurchasesGrid .ag-row,
#mesProductosGrid .ag-row,
#mesInventarioGrid .ag-row,
#mesOperacionesGrid .ag-row,
#mesEquipoGrid .ag-row {
    border-bottom: 1px solid #f1f5f9;
}

#mesOrdersGrid .ag-row:hover,
#mesPurchasesGrid .ag-row:hover,
#mesProductosGrid .ag-row:hover,
#mesInventarioGrid .ag-row:hover,
#mesOperacionesGrid .ag-row:hover,
#mesEquipoGrid .ag-row:hover {
    background-color: #f8fafc;
}

#mesOrdersGrid .ag-cell,
#mesPurchasesGrid .ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#mesOrdersGrid .ag-paging-panel,
#mesPurchasesGrid .ag-paging-panel {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
}

/* Inventory Categories */
.inventory-category {
    margin-bottom: 32px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.inventory-category:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background-color: #3498db;
}

/* Different colors for each category */
.inventory-category:nth-child(1) {
    border-top: 3px solid #ef4444;
}

.inventory-category:nth-child(1) .category-title::before {
    background-color: #ef4444;
}

.inventory-category:nth-child(2) {
    border-top: 3px solid #f59e0b;
}

.inventory-category:nth-child(2) .category-title::before {
    background-color: #f59e0b;
}

.inventory-category:nth-child(3) {
    border-top: 3px solid #22c55e;
}

.inventory-category:nth-child(3) .category-title::before {
    background-color: #22c55e;
}

.inventory-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.inventory-category table {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    margin-bottom: 0;
}

.category-empty {
    color: #64748b;
    font-style: italic;
    padding: 24px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
}

/* Orders Styles */
.order-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-open {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.status-closed {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
}

/* ========== Orders View Toggle ========== */
.orders-view-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.orders-view-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.15s ease;
}

.orders-view-btn:hover {
    color: #1e293b;
}

.orders-view-btn.active {
    background: white;
    color: #1e40af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========== Orders View Containers ========== */
.orders-view {
    display: none;
}

.orders-view.active {
    display: block;
}

.orders-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========== Order Card ========== */
.order-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #94a3b8;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.order-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.order-card-header {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    gap: 16px;
}

.order-card-header:hover {
    background: #f8fafc;
}

.order-card-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.order-card.expanded .order-card-toggle {
    transform: rotate(90deg);
}

.order-card-main {
    flex: 1;
    min-width: 0;
}

.order-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.order-card-ref {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.order-card-sku {
    font-size: 0.8rem;
    color: #94a3b8;
}

.order-card-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.order-card-date {
    font-size: 0.8rem;
    color: #94a3b8;
}

.order-card-notes {
    font-size: 0.85rem;
    color: #94a3b8;
    cursor: help;
}

/* ========== Order Card Details (Expandable) ========== */
.order-card-details {
    display: none;
    border-top: 1px solid #e2e8f0;
    padding: 16px 20px;
    background: #f8fafc;
}

.order-card.expanded .order-card-details {
    display: block;
}

.order-card-detail-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

/* ========== Order Detail Lines ========== */
.order-detail-line {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 8px;
    gap: 16px;
}

.order-detail-line:last-child {
    margin-bottom: 0;
}

.order-detail-line-info {
    flex: 1;
    min-width: 0;
}

.order-detail-line-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
    display: block;
}

.order-detail-line-sku {
    font-size: 0.75rem;
    color: #94a3b8;
}

.order-detail-line-progress {
    width: 150px;
    flex-shrink: 0;
}

/* ========== Priority Badge ========== */
.priority-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ========== Product Aggregate View ========== */
.product-agg-pending {
    font-size: 0.85rem;
    color: #f59e0b;
    font-weight: 600;
}

.product-agg-total {
    font-size: 0.8rem;
    color: #94a3b8;
}

.product-agg-order-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 6px;
    gap: 12px;
}

.product-agg-order-row:last-child {
    margin-bottom: 0;
}

.product-agg-order-ref {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.85rem;
    flex: 1;
}

.product-agg-order-qty {
    font-size: 0.8rem;
    color: #64748b;
}

/* ========== Responsive: Orders ========== */
@media (max-width: 768px) {
    .order-card-header {
        padding: 12px;
        gap: 10px;
    }

    .order-card-title-row {
        gap: 6px;
    }

    .order-detail-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .order-detail-line-progress {
        width: 100%;
    }

    .product-agg-order-row {
        flex-wrap: wrap;
    }
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
    border-radius: 12px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: #1e293b;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Order Lines in Modal */
.order-lines-section {
    margin-top: 15px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.order-lines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-lines-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

#orderLinesContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 6px;
}

.order-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.order-line-fields {
    display: flex;
    gap: 10px;
    flex: 1;
    align-items: center;
    min-width: 0;
}

.order-line-product {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    background: white;
}

.order-line-product:focus,
.order-line-quantity:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.order-line-quantity {
    width: 80px;
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    text-align: center;
}

.order-line-completed {
    color: #16a34a;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .order-line-fields {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .order-line-quantity {
        width: 100%;
    }
}

/* Success and Warning buttons */
.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #219a52;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

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

/* Work Logging Styles */
.work-logging-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .work-logging-container {
        grid-template-columns: 1fr;
    }
}

.work-log-form-section,
.pending-work-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.work-log-form-section h4,
.pending-work-section h4,
.recent-logs-section h4 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.work-log-form-section h4::before,
.pending-work-section h4::before,
.recent-logs-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: 8px;
}

/* Pending Work List */
.pending-work-list {
    max-height: 300px;
    overflow-y: auto;
}

.pending-work-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #3b82f6;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pending-work-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pending-work-item:last-child {
    margin-bottom: 0;
}

.pending-work-info {
    flex: 1;
}

.pending-work-info strong {
    display: block;
    color: #1e293b;
    font-weight: 600;
}

.pending-work-sku {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}

.pending-work-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 15px;
}

.pending-count {
    font-weight: 700;
    color: #ef4444;
    font-size: 1.1rem;
}

.completed-count {
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 500;
}

/* Recent Logs Section */
.recent-logs-section {
    margin-top: 24px;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.recent-logs-section .table-container {
    max-height: 400px;
    overflow-y: auto;
}

/* ============ MES Dashboard Styles ============ */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.dashboard-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.dashboard-section h4 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
}

.progress-summary {
    margin-top: 10px;
}

.progress-summary .progress-bar-container {
    height: 32px;
    margin-bottom: 12px;
    position: relative;
    border-radius: 16px;
}

.progress-summary .progress-text {
    position: static;
    transform: none;
    text-align: center;
    font-size: 0.95rem;
    color: #475569;
    font-weight: 600;
}

.product-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.product-progress-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-progress-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.product-progress-card .product-name {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.product-progress-card .progress-bar-container {
    height: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.product-progress-card .progress-bar {
    border-radius: 5px;
}

.product-progress-card .progress-numbers {
    font-size: 0.8rem;
    color: #64748b;
    text-align: right;
    font-weight: 500;
}

.recent-activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    transition: background-color 0.15s ease;
}

.activity-item:hover {
    background-color: #f8fafc;
}

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

.activity-user {
    font-weight: 600;
    color: #3b82f6;
}

.activity-action {
    color: #475569;
}

.activity-product {
    color: #22c55e;
    font-weight: 600;
}

.activity-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Dashboard responsive */
@media (max-width: 600px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        border-radius: 12px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .product-progress-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-section {
        padding: 16px;
        border-radius: 12px;
    }

    .activity-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .activity-time {
        margin-left: 0;
        margin-top: 4px;
    }
}

/* ============ Operation Input/Output Checkbox Selection ============ */

.operation-io-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 15px 0 20px 0;
}

.operation-io-column {
    display: flex;
    flex-direction: column;
}

.operation-io-column > label {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 1rem;
}

.operation-io-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.operation-io-list:empty::before {
    content: "No hay materiales disponibles";
    color: #94a3b8;
    font-style: italic;
    font-size: 0.85rem;
    display: block;
    text-align: center;
    padding: 24px;
}

.operation-io-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s ease;
}

.operation-io-item:last-child {
    border-bottom: none;
}

.operation-io-item:hover {
    background: #f1f5f9;
}

.operation-io-item.checked {
    background: #eff6ff;
}

.operation-io-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.operation-io-item .item-name {
    flex: 1;
    font-size: 0.9rem;
    color: #334155;
}

.operation-io-item .item-unit {
    font-size: 0.8rem;
    color: #64748b;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.operation-io-item .item-qty {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    background: white;
}

.operation-io-item .item-qty:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

.operation-io-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 10px 14px 6px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .operation-io-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============ Legacy Material Input/Output (keep for compatibility) ============ */

.material-io-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 15px 0 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.material-io-column {
    display: flex;
    flex-direction: column;
}

.material-io-column > label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.material-io-list {
    min-height: 100px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    background: white;
    margin-bottom: 12px;
}

.material-io-list:empty::before {
    content: "No hay materiales agregados";
    color: #999;
    font-style: italic;
    font-size: 0.85rem;
    display: block;
    text-align: center;
    padding: 20px;
}

.material-io-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.material-io-row:last-child {
    margin-bottom: 0;
}

.material-io-row .material-select {
    flex: 2;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    background: white;
}

.material-io-row .material-quantity {
    width: 90px;
    flex-shrink: 0;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
}

.material-io-row .btn-danger {
    padding: 8px 12px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.form-hint {
    font-size: 0.8rem;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.empty-hint {
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

@media (max-width: 750px) {
    .material-io-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-xlarge {
        max-width: 95%;
        margin: 10px;
    }
}

/* Product Operations Modal */
.modal-subtitle {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.operations-manager {
    margin-bottom: 20px;
}

.operations-add-section {
    margin-bottom: 20px;
}

.operations-add-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.operations-add-row {
    display: flex;
    gap: 10px;
}

.operations-add-row select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
}

.operations-list-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.operations-list {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
}

.operations-list .empty-message {
    text-align: center;
    padding: 30px;
    color: #888;
    font-style: italic;
    margin: 0;
}

.operation-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    transition: background-color 0.2s;
}

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

.operation-item:hover {
    background-color: #f8f9fa;
}

.operation-order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4a90d9;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.operation-name {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
}

.operation-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.operation-actions .btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    min-width: 32px;
}

.operation-actions .btn-small:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#productOperationsModal .modal-body {
    padding: 20px 25px;
}

#productOperationsModal .modal-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* ============ Marketplace Refresh Modal ============ */
.marketplace-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #3498db;
    background-color: #f8fafc;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #3498db;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 25px;
    border-top: 1px solid #e0e0e0;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.refresh-status {
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.9rem;
}

.refresh-status.loading {
    background-color: #e3f2fd;
    color: #1565c0;
}

.refresh-status.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.refresh-status.error {
    background-color: #ffebee;
    color: #c62828;
}

/* ============ Work Log Operations Cards ============ */

/* ============ Work Logging Section ============ */

.work-section {
    margin-bottom: 32px;
}

.work-section h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.work-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
}

.work-operations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Work Operation Card - Expandable */
.work-op-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.work-op-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.work-op-card.pending {
    border-left: 4px solid #f59e0b;
}

.work-op-card.free {
    border-left: 4px solid #22c55e;
}

.work-op-card.active {
    border-left: 4px solid #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.work-op-card.locked {
    opacity: 0.7;
    border-left: 4px solid #94a3b8;
}

.work-op-header {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    gap: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.work-op-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 100%);
}

.work-op-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: transform 0.2s ease;
}

.work-op-card.expanded .work-op-toggle {
    transform: rotate(90deg);
}

.work-op-info {
    flex: 1;
}

.work-op-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.work-op-summary {
    font-size: 0.85rem;
    color: #64748b;
}

.work-op-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.work-op-progress-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
    max-width: 200px;
}

.work-op-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.work-op-progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    min-width: 45px;
}

.work-op-stat.complete .work-op-stat-value {
    color: #22c55e;
    font-size: 1.3rem;
}

.work-op-stats {
    display: flex;
    gap: 16px;
}

.work-op-stat {
    text-align: center;
}

.work-op-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    display: block;
}

.work-op-stat-value.needed {
    color: #f59e0b;
}

.work-op-stat-value.possible {
    color: #22c55e;
}

.work-op-stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.work-op-action {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.work-op-action.start {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.work-op-action.start:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.work-op-locked-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fee2e2;
    color: #dc2626;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Expandable Details */
.work-op-details {
    display: none;
    border-top: 1px solid #e2e8f0;
    padding: 20px;
    background: #f8fafc;
}

.work-op-card.expanded .work-op-details {
    display: block;
}

.work-op-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .work-op-details-grid {
        grid-template-columns: 1fr;
    }
}

.work-op-detail-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.work-op-detail-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin: 0 0 12px 0;
}

.work-op-inventory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.work-op-inv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.work-op-inv-name {
    color: #334155;
}

.work-op-inv-qty {
    font-weight: 600;
    color: #1e293b;
}

.work-op-orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.work-op-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 6px;
}

.work-op-order-ref {
    font-weight: 500;
    color: #334155;
}

.work-op-order-qty {
    font-weight: 600;
    color: #f59e0b;
}

/* Active Operation Panel */
.work-op-active-panel {
    display: none;
    border-top: 2px solid #3b82f6;
    padding: 32px 24px;
    background: #f8fafc;
}

.work-op-card.active .work-op-active-panel {
    display: block;
}

.work-op-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}

.work-op-stopwatch {
    font-size: 3rem;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Montserrat', sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    background: white;
    padding: 16px 36px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.work-op-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 28px;
}

.work-op-counter-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.work-op-counter-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.work-op-counter-btn:active {
    transform: scale(0.93);
}

.work-op-counter-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0f172a;
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.work-op-counter-label {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.work-op-finish {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.work-op-finish-btn {
    padding: 12px 32px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.15s ease;
}

.work-op-finish-btn.cancel {
    background: white;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.work-op-finish-btn.cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.work-op-finish-btn.complete {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.work-op-finish-btn.complete:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Legacy - keep for compatibility */
.operations-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .operations-sections {
        grid-template-columns: 1fr;
    }
}

.operations-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.operations-section h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.operations-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
}

.section-description {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 20px 0;
}

.operations-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.operation-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.operation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.operation-card.operation-pending {
    border-left: 4px solid #f59e0b;
}

.operation-card.operation-free {
    border-left: 4px solid #22c55e;
}

.operation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px 16px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.operation-card-header .operation-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.operation-card-header .operation-unit {
    font-size: 0.75rem;
    color: #64748b;
    background: #e2e8f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.operation-card-body {
    padding: 16px;
}

.operation-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.operation-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.operation-stats .stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.operation-stats .stat-number.needed {
    color: #f59e0b;
}

.operation-stats .stat-number.orders {
    color: #8b5cf6;
}

.operation-stats .stat-number.possible {
    color: #22c55e;
}

.operation-stats .stat-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    font-weight: 600;
}

.operation-inputs {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 12px;
}

.operation-inputs .inputs-label {
    font-weight: 600;
    color: #334155;
}

.operation-inputs .inputs-value {
    color: #64748b;
}

.operation-products {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.operation-card-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
}

/* Work Log Modal Info */
.work-log-info {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.work-log-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.work-log-info .info-row:last-child {
    border-bottom: none;
}

.work-log-info .info-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.work-log-info .info-value {
    color: #1e293b;
    font-weight: 500;
}

/* ============ Comprehensive Mobile Responsive ============ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    .modal {
        padding: 12px;
    }

    .modal-content {
        border-radius: 12px;
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px 20px;
        border-radius: 12px 12px 0 0;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-content form {
        padding: 16px 20px;
    }

    .inventory-category {
        padding: 16px;
        border-radius: 10px;
        margin-bottom: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 15px;
    }

    .work-log-form-section,
    .pending-work-section {
        padding: 16px;
        border-radius: 10px;
    }

    .recent-logs-section {
        padding: 16px;
        border-radius: 10px;
    }

    .operations-add-row {
        flex-direction: column;
    }

    .operations-add-row select {
        width: 100%;
    }

    .operations-add-row .btn {
        width: 100%;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .mes-subnav {
        gap: 2px;
        padding: 3px;
    }

    .mes-subnav-btn {
        padding: 7px 10px;
        font-size: 0.72rem;
    }

    .subpage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .subpage-header h3 {
        font-size: 1.1rem;
    }

    .subpage-header .btn {
        width: 100%;
    }

    .subpage-controls {
        width: 100%;
        flex-direction: column;
    }

    .subpage-controls .btn {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .pending-work-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pending-work-stats {
        align-items: flex-start;
        margin-right: 0;
        flex-direction: row;
        gap: 15px;
    }

    .pending-work-item .btn {
        width: 100%;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .modal {
        padding: 0;
        align-items: stretch;
    }

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

    .modal-header {
        border-radius: 0;
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
    }

    .operation-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .operation-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .mes-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .mes-bulk-actions {
        flex-wrap: wrap;
    }

    .search-box {
        width: 100%;
        max-width: none;
    }

    .work-op-header {
        flex-wrap: wrap;
    }

    .work-op-stats {
        order: 3;
        width: 100%;
        justify-content: space-around;
        padding-top: 8px;
        border-top: 1px solid #f1f5f9;
        margin-top: 8px;
    }

    .work-op-action {
        order: 2;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .mes-subnav-btn {
        padding: 6px 8px;
        font-size: 0.68rem;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn-small {
        min-height: 36px;
    }

    .mes-subnav-btn {
        min-height: 40px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .clean-list-item {
        padding: 14px 16px;
        min-height: 56px;
    }

    .menu-dots-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .pending-work-item:hover {
        transform: none;
    }

    .product-progress-card:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
    }
}

/* ==================== Marketplaces Section ==================== */

.marketplaces-section {
    padding: 24px;
}

.mp-subpage {
    display: none;
}

.mp-subpage.active {
    display: block;
}

/* Presencia table styles */
.center-col {
    text-align: center;
}

.presence-yes {
    color: #10b981;
    font-weight: 700;
    font-size: 1.1rem;
}

.presence-no {
    color: #ef4444;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Price styling for Decathlon prices */
.price-discounted {
    color: #10b981;
    font-weight: 600;
}

.price-original {
    color: #9ca3af;
    text-decoration: line-through;
    font-size: 0.85em;
    margin-left: 4px;
}

/* Stock zero highlighting for presencia */
#presenciaTable .stock-zero {
    color: #ef4444;
    font-weight: 600;
}

/* ==================== FBA Section Styles ==================== */

#fbaTable .excluded-row {
    opacity: 0.6;
    background-color: #f5f5f5;
}

#fbaTable .excluded-row td {
    color: #888;
}

.badge-excluded {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: #ef4444;
    color: white;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

#fbaTable .stock-zero {
    color: #ef4444;
    font-weight: 600;
}

#fbaTable .stock-warning {
    color: #f59e0b;
    font-weight: 600;
}

/* ==================== SKU Matching Section ==================== */

.sku-matching-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.sku-matching-filters .search-box {
    flex: 1;
    min-width: 200px;
}

.sku-matching-filters .filter-select select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

.sku-matching-filters .filter-select select:focus {
    outline: none;
    border-color: #3498db;
}

#skuMatchingTable .sku-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
}

#skuMatchingTable .sku-input:focus {
    outline: none;
    border-color: #3498db;
}

#skuMatchingTable .sku-input.mapped {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.status-badge.mapped {
    background-color: #d1fae5;
    color: #065f46;
}

.marketplace-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.marketplace-badge.shopify {
    background-color: #e0f2fe;
    color: #0369a1;
}

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

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

#skuMatchingTable .btn-small {
    padding: 6px 12px;
}

#skuMatchingTable .action-buttons {
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .sku-matching-filters {
        flex-direction: column;
    }

    .sku-matching-filters .filter-select {
        width: 100%;
    }

    .sku-matching-filters .filter-select select {
        width: 100%;
    }
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    gap: 8px;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
}

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

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    background-color: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.pagination-btn.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: #6b7280;
}

/* Productos Section - AG Grid */
.productos-section {
    padding: 20px;
}

.productos-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.productos-section .section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.productos-grid-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Pedidos Section - AG Grid */
.pedidos-section {
    padding: 20px;
}

.pedidos-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pedidos-section .section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.pedidos-grid-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.pedidos-summary {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
}

.pedidos-summary-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.pedidos-summary-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pedidos-summary-value {
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 700;
}

/* ==================== Panel de Control ==================== */
.panel-control-summary {
    margin-top: 0;
}

.panel-control-summary-item {
    grid-column: 1 / -1;
}

.panel-control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

.panel-control-kpis {
    margin-top: 14px;
    margin-bottom: 16px;
}

.panel-control-kpis {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.panel-control-kpis .stat-card {
    padding: 18px;
}

.panel-control-kpis .stat-value {
    font-size: 2.1rem;
}

.panel-control-presencia-card {
    background: white;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.05);
    padding: 16px;
}

.panel-control-presencia-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-control-presencia-title {
    margin: 0;
    font-size: 1.0rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.panel-control-presencia-sub {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 600;
}

.panel-control-presencia-list {
    display: grid;
    gap: 14px;
}

.panel-control-presencia-item {
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.panel-control-presencia-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.panel-control-presencia-label {
    font-weight: 800;
    color: #0f172a;
    font-size: 0.9rem;
}

.panel-control-presencia-metric {
    font-weight: 800;
    color: #0f172a;
    font-size: 0.9rem;
    white-space: nowrap;
}

.panel-control-presencia-metric-muted {
    margin-left: 8px;
    font-weight: 700;
    color: #64748b;
    font-size: 0.8rem;
}

.panel-control-presencia-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
}

.panel-control-presencia-bar.mini {
    height: 8px;
}

.panel-control-presencia-bar .progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
}

.panel-control-presencia-bar .progress-bar.amazon {
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.panel-control-presencia-split {
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
    border: 1px solid rgba(253, 186, 116, 0.35);
}

.panel-control-presencia-split-title {
    font-weight: 800;
    color: #9a3412;
    font-size: 0.85rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.panel-control-presencia-split-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 900px) {
    .panel-control-kpis {
        grid-template-columns: 320px 1fr;
        align-items: stretch;
    }
    .panel-control-presencia-split-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.panel-control-card {
    background: white;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.05);
    padding: 16px 16px 12px 16px;
}

.panel-control-card-title {
    margin: 0 0 10px 0;
    font-size: 1.0rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.panel-control-chart {
    height: 360px;
}

.panel-control-status {
    margin-top: 12px;
}

@media (min-width: 1100px) {
    .panel-control-grid {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }
    /* Marketplace full-width for balance */
    .panel-control-card:nth-child(3) {
        grid-column: 1 / -1;
    }
}

#pedidosGrid.ag-theme-quartz {
    height: calc(100vh - 200px);
    width: 100%;
    --ag-font-family: 'Montserrat', sans-serif;
    --ag-font-size: 13px;
    --ag-row-height: 44px;
    --ag-header-height: 48px;
    --ag-header-background-color: #f8fafc;
    --ag-header-foreground-color: #334155;
    --ag-odd-row-background-color: #ffffff;
    --ag-row-hover-color: #f1f5f9;
    --ag-border-color: #e2e8f0;
    --ag-cell-horizontal-border: none;
    --ag-row-border-color: #f1f5f9;
    --ag-header-column-separator-display: none;
    --ag-borders: none;
    --ag-border-radius: 8px;
}

#pedidosGrid .ag-header-cell-label {
    justify-content: center;
    font-weight: 600;
}

#pedidosGrid .ag-header-cell {
    border-bottom: 2px solid #e2e8f0;
}

#pedidosGrid .ag-row {
    border-bottom: 1px solid #f1f5f9;
}

#pedidosGrid .ag-row:hover {
    background-color: #f8fafc;
}

#pedidosGrid .ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#pedidosGrid .ag-paging-panel {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
}

/* Shipping Prices Modal */
.file-selected {
    margin-top: 10px;
    padding: 10px 15px;
    background: #e8f5e9;
    border-radius: 6px;
    color: #2e7d32;
    font-size: 0.9rem;
}

.files-selected {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #e8f5e9;
    border-radius: 6px;
    color: #2e7d32;
    font-size: 0.85rem;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .remove-file {
    background: none;
    border: none;
    color: #c62828;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
    margin-left: 8px;
}

.file-item .remove-file:hover {
    color: #b71c1c;
}

.shipping-status {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shipping-status:empty {
    display: none;
}

.shipping-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.shipping-status.warning {
    background: #fff8e1;
    color: #92400e;
}

.shipping-status.error {
    background: #ffebee;
    color: #c62828;
}

.shipping-status.info {
    background: #e3f2fd;
    color: #1565c0;
}

.shipping-status.loading {
    background: #e3f2fd;
    color: #1565c0;
}

/* Radio Group Styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.radio-option {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #3b82f6;
}

.radio-option input[type="radio"]:checked ~ .radio-description {
    color: #64748b;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.radio-label {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-label::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.2s ease;
}

.radio-option:has(input[type="radio"]:checked) .radio-label::before {
    border-color: #3b82f6;
    background: #3b82f6;
    box-shadow: inset 0 0 0 3px white;
}

.radio-description {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
    margin-left: 26px;
}

.refresh-status {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-status:empty {
    display: none;
}

.refresh-status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.refresh-status.error {
    background: #ffebee;
    color: #c62828;
}

.refresh-status.info {
    background: #e3f2fd;
    color: #1565c0;
}

.refresh-status.loading {
    background: #e3f2fd;
    color: #1565c0;
}

/* Status icons (spinner + small "bubble") */
.shipping-status.loading::before,
.refresh-status.loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(21, 101, 192, 0.25);
    border-top-color: rgba(21, 101, 192, 0.9);
    animation: status-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.shipping-status.success::before,
.refresh-status.success::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
    flex: 0 0 auto;
}

.shipping-status.warning::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    flex: 0 0 auto;
}

.shipping-status.error::before,
.refresh-status.error::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
    flex: 0 0 auto;
}

.shipping-status.info::before,
.refresh-status.info::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    flex: 0 0 auto;
}

@keyframes status-spin {
    to { transform: rotate(360deg); }
}

/* Order Items Table */
.order-items-table {
    width: 100%;
    border-collapse: collapse;
}

.order-items-table th,
.order-items-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.order-items-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.order-items-table td {
    font-size: 0.9rem;
    color: #334155;
}

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

.order-items-table tr:hover td {
    background: #f8fafc;
}

/* Large modal */
.modal-content.modal-lg {
    max-width: 700px;
}

/* Clickable row styling */
.ag-row.clickable-row {
    cursor: pointer;
}

/* Selection Action Bar - Fixed Bottom */
.productos-action-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #1e40af;
    color: white;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.productos-action-bar.show {
    display: flex;
    animation: slideUp 0.25s ease-out;
}

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

.productos-action-bar .action-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.productos-action-bar .selection-count {
    font-weight: 600;
    font-size: 0.9rem;
}

.productos-action-bar .btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.productos-action-bar .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.productos-action-bar .btn-action-bar {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.productos-action-bar .btn-action-bar:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.productos-action-bar .action-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.productos-action-bar .action-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.productos-action-bar .action-dropdown label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
}

.productos-action-bar .action-dropdown select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 150px;
}

.productos-action-bar .action-dropdown select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.productos-action-bar .action-dropdown select option {
    background: #1e40af;
    color: white;
}

/* AG Grid Theme Customization - Modern Clean Design */
#productosGrid.ag-theme-quartz {
    height: calc(100vh - 200px);
    width: 100%;
    --ag-font-family: 'Montserrat', sans-serif;
    --ag-font-size: 13px;
    --ag-row-height: 44px;
    --ag-header-height: 48px;
    --ag-header-background-color: #f8fafc;
    --ag-header-foreground-color: #334155;
    --ag-odd-row-background-color: #ffffff;
    --ag-row-hover-color: #f1f5f9;
    --ag-border-color: #e2e8f0;
    --ag-cell-horizontal-border: none;
    --ag-row-border-color: #f1f5f9;
    --ag-header-column-separator-display: none;
    --ag-borders: none;
    --ag-border-radius: 8px;
}

#productosGrid .ag-header-cell-label {
    justify-content: center;
    font-weight: 600;
}

#productosGrid .ag-header-cell {
    border-bottom: 2px solid #e2e8f0;
}

#productosGrid .ag-row {
    border-bottom: 1px solid #f1f5f9;
}

#productosGrid .ag-row:hover {
    background-color: #f8fafc;
}

#productosGrid .ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#productosGrid .ag-paging-panel {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
}

/* Translation Section */
.translation-section {
    padding: 20px;
}

.translation-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.translation-section .section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.translation-grid-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#translationGrid.ag-theme-quartz {
    height: calc(100vh - 200px);
    width: 100%;
    --ag-font-family: 'Montserrat', sans-serif;
    --ag-font-size: 13px;
    --ag-row-height: 44px;
    --ag-header-height: 48px;
    --ag-header-background-color: #f8fafc;
    --ag-header-foreground-color: #334155;
    --ag-odd-row-background-color: #ffffff;
    --ag-row-hover-color: #f1f5f9;
    --ag-border-color: #e2e8f0;
    --ag-cell-horizontal-border: none;
    --ag-row-border-color: #f1f5f9;
    --ag-header-column-separator-display: none;
    --ag-borders: none;
    --ag-border-radius: 8px;
}

#translationGrid .ag-header-cell-label {
    justify-content: center;
    font-weight: 600;
}

#translationGrid .ag-header-cell {
    border-bottom: 2px solid #e2e8f0;
}

#translationGrid .ag-row {
    border-bottom: 1px solid #f1f5f9;
}

#translationGrid .ag-row:hover {
    background-color: #f8fafc;
}

#translationGrid .ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#translationGrid .ag-paging-panel {
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
}

/* Translation Family Modal */
.translation-family-modal {
    max-width: 95vw;
    width: 1400px;
}

.translation-modal-table-container {
    overflow: auto;
    max-height: 60vh;
}

.translation-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.translation-modal-table th,
.translation-modal-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.translation-modal-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

.translation-modal-table th.th-group {
    background: #eef2ff;
    color: #4338ca;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.translation-modal-table td:first-child {
    font-weight: 600;
    color: #1e293b;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    min-width: 160px;
}

.translation-modal-table textarea {
    width: 100%;
    min-width: 180px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
    min-height: 32px;
    max-height: 120px;
    transition: border-color 0.2s;
}

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

.translation-modal-table textarea.field-changed {
    border-color: #3b82f6;
}

.translation-modal-table textarea.field-overlength {
    border-color: #ef4444;
    background: #fef2f2;
}

/* Translation Cell Popup */
.translation-cell-popup {
    position: fixed;
    width: 320px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    overflow: hidden;
}

.translation-cell-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.translation-cell-popup-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.translation-cell-popup-close:hover {
    color: #475569;
}

.translation-cell-popup-textarea {
    width: 100%;
    min-height: 100px;
    max-height: 200px;
    padding: 10px;
    border: none;
    outline: none;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
    box-sizing: border-box;
}

.translation-cell-popup-charcount {
    padding: 4px 10px 6px;
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: right;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.translation-cell-popup-charcount.over {
    color: #ef4444;
    font-weight: 600;
}

/* Productos Grid - Status text styling (no background, just colored text) */
.productos-status {
    font-weight: 600;
    text-transform: capitalize;
    background: none !important;
}

.pg-status-active {
    color: #16a34a;
}

.pg-status-priority {
    color: #dc2626;
}

.pg-status-liquidation {
    color: #f59e0b;
}

/* Presence indicators for Productos grid */
.presence-yes {
    color: #16a34a;
    font-weight: 600;
}

.presence-no {
    color: #dc2626;
    font-weight: 400;
    opacity: 0.5;
}

/* FBA/FBM badges */
.fba-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f97316;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.fbm-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #6b7280;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Reorder indicators */
.reorder-now {
    color: #dc2626;
    font-weight: 700;
}

.reorder-soon {
    color: #f59e0b;
    font-weight: 600;
}

/* Productos Export Modal */
.export-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

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

.export-mini-table th,
.export-mini-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.export-mini-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    position: sticky;
    top: 0;
    z-index: 1;
}

.export-mini-table td:first-child {
    font-weight: 500;
    color: #1e293b;
}

.export-mini-table td:last-child {
    width: 100px;
}

.export-mini-table input[type="number"] {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.export-mini-table input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.export-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

/* Refresh Modal */
/* View Selector */
.view-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 16px;
    padding-right: 16px;
    border-right: 1px solid #e2e8f0;
}

.view-selector select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    min-width: 160px;
    cursor: pointer;
}

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

.view-selector .btn-ghost {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #64748b;
    border: 1px solid #e2e8f0;
    background: transparent;
}

.view-selector .btn-ghost:hover {
    background: #f1f5f9;
    color: #334155;
}

.view-selector .btn-danger-ghost {
    color: #dc2626;
    border-color: #fecaca;
}

.view-selector .btn-danger-ghost:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.modal-refresh {
    max-width: 460px;
}

.refresh-modal-desc {
    margin-bottom: 16px;
    color: #64748b;
    font-size: 0.9rem;
}

.refresh-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.radio-option:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.radio-option:has(input:checked) {
    background: #eff6ff;
    border-color: #3b82f6;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.radio-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-option-label {
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

.radio-option-desc {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 400;
}

.radio-option:has(input:checked) .radio-option-label {
    color: #1e40af;
}

.radio-option:has(input:checked) .radio-option-desc {
    color: #60a5fa;
}

.refresh-status {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
    align-items: center;
    gap: 10px;
}

.refresh-status.loading {
    display: flex;
    background: #eff6ff;
    color: #1e40af;
}

.refresh-status.loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid #1e40af;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.refresh-status.success {
    display: flex;
    background: #dcfce7;
    color: #166534;
}

.refresh-status.success::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #166534;
    border-radius: 50%;
    flex-shrink: 0;
}

.refresh-status.error {
    display: flex;
    background: #fee2e2;
    color: #991b1b;
}

.refresh-status.error::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #991b1b;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Column Selection Modal */
.modal-content.productos-columns-modal {
    max-width: 550px;
}

.productos-columns-modal .modal-body {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

.productos-columns-modal .modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
}

/* Column Groups */
.column-group {
    margin-bottom: 20px;
}

.column-group:last-child {
    margin-bottom: 0;
}

.column-group-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.column-group-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.columns-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.column-checkbox:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.column-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.column-checkbox label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    user-select: none;
    flex: 1;
}

@media (max-width: 480px) {
    .columns-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Productos Mobile Responsive ==================== */

@media (max-width: 768px) {
    /* Section padding */
    .productos-section {
        padding: 12px;
    }

    /* Header: stack title and buttons vertically */
    .productos-section .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 12px;
    }

    .productos-section .section-header h2 {
        font-size: 1.25rem;
    }

    /* Header buttons: wrap into rows */
    .productos-section .header-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* View selector: full width, stack items */
    .productos-section .view-selector {
        width: 100%;
        margin-right: 0;
        padding-right: 0;
        border-right: none;
        padding-bottom: 8px;
        border-bottom: 1px solid #e2e8f0;
    }

    .productos-section .view-selector select {
        flex: 1;
        min-width: 0;
    }

    /* Buttons: flex-fill so they use available space */
    .productos-section .header-buttons > .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.8rem;
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* Grid: fill viewport height minus header/summary */
    #productosGrid.ag-theme-quartz {
        height: calc(100vh - 260px);
        --ag-font-size: 12px;
        --ag-row-height: 40px;
        --ag-header-height: 40px;
    }

    /* Summary bar */
    .productos-section .pedidos-summary {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Action bar: full width on mobile, stack if needed */
    .productos-action-bar {
        left: 0;
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .productos-action-bar .action-bar-left,
    .productos-action-bar .action-bar-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .productos-action-bar .action-dropdown select {
        min-width: 120px;
    }

    /* Column modal: full-screen on mobile */
    .modal-content.productos-columns-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .productos-columns-modal .modal-body {
        max-height: 70vh;
        padding: 12px;
    }

    .column-group-items {
        grid-template-columns: 1fr;
    }

    /* Refresh modal */
    .modal-content.modal-refresh {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .productos-section {
        padding: 8px;
    }

    .productos-section .section-header h2 {
        font-size: 1.1rem;
    }

    #productosGrid.ag-theme-quartz {
        height: calc(100vh - 240px);
        --ag-font-size: 11px;
        --ag-row-height: 36px;
        --ag-header-height: 36px;
    }

    /* Action bar buttons smaller */
    .productos-action-bar .btn-action-bar {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .productos-action-bar .selection-count {
        font-size: 0.8rem;
    }
}

/* ============ Row Actions Dropdown (Kebab Menu) ============ */
.row-actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1.2rem;
    color: #64748b;
    line-height: 1;
    letter-spacing: 2px;
    transition: background-color 0.15s, color 0.15s;
}

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

.row-actions-dropdown {
    position: fixed;
    z-index: 9999;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    padding: 4px 0;
    display: none;
}

.row-actions-dropdown.open {
    display: block;
}

.row-actions-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    transition: background-color 0.1s;
}

.row-actions-dropdown .dropdown-item:hover {
    background-color: #f1f5f9;
}

.row-actions-dropdown .dropdown-item.danger {
    color: #dc2626;
}

.row-actions-dropdown .dropdown-item.danger:hover {
    background-color: #fef2f2;
}

.row-actions-dropdown .dropdown-item.success {
    color: #16a34a;
}

.row-actions-dropdown .dropdown-item.success:hover {
    background-color: #f0fdf4;
}

.row-actions-dropdown .dropdown-item.warning {
    color: #d97706;
}

.row-actions-dropdown .dropdown-item.warning:hover {
    background-color: #fffbeb;
}
