/* =====================================================
   J5 SISTEMA - ESTILOS PRINCIPALES
   Colores: Azul Marino (#1a237e) y Naranja (#ff6f00)
   ===================================================== */

:root {
    --color-primary: #1a237e;
    --color-primary-dark: #0d1642;
    --color-primary-light: #3949ab;
    --color-secondary: #ff6f00;
    --color-secondary-dark: #e65100;
    --color-secondary-light: #ff9800;
    --color-success: #2e7d32;
    --color-danger: #c62828;
    --color-warning: #f9a825;
    --color-info: #0277bd;
    --color-light: #f5f5f5;
    --color-dark: #212121;
    --color-white: #ffffff;
    --color-gray: #757575;
    --color-border: #e0e0e0;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: var(--color-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-primary);
    color: var(--color-white);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-secondary);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.sidebar-header p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 5px;
}

.sidebar-menu {
    padding: 15px 0;
    list-style: none;
}

.sidebar-menu li {
    margin: 2px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: var(--color-white);
    border-left-color: var(--color-secondary);
}

.sidebar-menu .icon {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ===== HEADER ===== */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 999;
}

.header-left h3 {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: var(--color-light);
    border-radius: 25px;
    cursor: pointer;
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 25px;
    min-height: calc(100vh - var(--header-height));
}

.page-title {
    margin-bottom: 25px;
}

.page-title h1 {
    color: var(--color-primary);
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.page-title p {
    color: var(--color-gray);
    font-size: 0.9rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.card-body {
    padding: 20px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid var(--color-primary);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.orange { border-left-color: var(--color-secondary); }
.stat-card.green { border-left-color: var(--color-success); }
.stat-card.red { border-left-color: var(--color-danger); }
.stat-card.blue { border-left-color: var(--color-info); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--color-white);
}

.stat-icon.primary { background: var(--color-primary); }
.stat-icon.orange { background: var(--color-secondary); }
.stat-icon.green { background: var(--color-success); }
.stat-icon.red { background: var(--color-danger); }

.stat-info h4 {
    font-size: 1.6rem;
    color: var(--color-dark);
    font-weight: 700;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--color-gray);
}

/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-secondary);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(255,111,0,0.3);
}

.btn-primary:hover {
    background: var(--color-secondary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,111,0,0.4);
}

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

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

.btn-success {
    background: var(--color-success);
    color: var(--color-white);
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
}

.btn-warning {
    background: var(--color-warning);
    color: var(--color-dark);
}

.btn-info {
    background: var(--color-info);
    color: var(--color-white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

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

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== FORMULARIOS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--color-dark);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--color-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-control.is-invalid {
    border-color: var(--color-danger);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--color-secondary);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: var(--color-primary);
    color: var(--color-white);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.data-table tbody tr:hover {
    background: rgba(26,35,126,0.03);
}

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

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: #e8f5e9; color: var(--color-success); }
.badge-danger { background: #ffebee; color: var(--color-danger); }
.badge-warning { background: #fffde7; color: var(--color-warning); }
.badge-info { background: #e3f2fd; color: var(--color-info); }
.badge-primary { background: #e8eaf6; color: var(--color-primary); }
.badge-secondary { background: #fff3e0; color: var(--color-secondary); }

/* ===== ALERTAS ===== */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.alert-success { background: #e8f5e9; color: var(--color-success); border-left: 4px solid var(--color-success); }
.alert-danger { background: #ffebee; color: var(--color-danger); border-left: 4px solid var(--color-danger); }
.alert-warning { background: #fffde7; color: var(--color-warning); border-left: 4px solid var(--color-warning); }
.alert-info { background: #e3f2fd; color: var(--color-info); border-left: 4px solid var(--color-info); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--color-white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--color-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-gray);
}

.modal-body { padding: 20px; }
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

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

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .main-header { left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== LOGIN ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.login-box {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-box h2 {
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 5px;
    font-size: 1.8rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--color-gray);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo span {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-secondary);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* ===== PRODUCTOS GRID ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-secondary);
}

.product-card.selected {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(255,111,0,0.2);
}

.product-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray);
    font-size: 3rem;
}

.product-info {
    padding: 15px;
}

.product-info h4 {
    font-size: 0.95rem;
    color: var(--color-dark);
    margin-bottom: 5px;
}

.product-info p {
    font-size: 0.8rem;
    color: var(--color-gray);
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-secondary);
    margin-top: 8px;
}

/* ===== VENTA PANEL ===== */
.venta-panel {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.venta-sidebar {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 80px;
}

.venta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.venta-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--color-primary);
}

.venta-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.venta-total-row.grand-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

/* ===== COMPRABANTE ===== */
.comprobante {
    background: var(--color-white);
    padding: 30px;
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid var(--color-border);
}

.comprobante-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px dashed var(--color-border);
}

.comprobante-header h2 {
    color: var(--color-primary);
    font-size: 1.3rem;
}

.comprobante-body {
    font-size: 0.9rem;
}

.comprobante-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.comprobante-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed var(--color-border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-gray);
}

/* ===== QR REGISTRO ===== */
.qr-container {
    text-align: center;
    padding: 40px;
}

.qr-code {
    width: 250px;
    height: 250px;
    margin: 20px auto;
    background: var(--color-white);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* ===== BORDADO SECTION ===== */
.bordado-section {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 15px;
    border: 2px dashed var(--color-secondary-light);
}

.bordado-section h4 {
    color: var(--color-secondary-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.logo-item {
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--color-white);
}

.logo-item:hover,
.logo-item.selected {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(255,111,0,0.15);
}

.logo-item img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 5px;
}

.logo-item p {
    font-size: 0.75rem;
    color: var(--color-dark);
}

/* ===== DASHBOARD CHARTS ===== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar, .main-header, .btn, .no-print { display: none !important; }
    .main-content { margin: 0; padding: 0; }
    .comprobante { border: none; box-shadow: none; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--color-primary-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-gray { color: var(--color-gray); }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.w-100 { width: 100%; }
.hidden { display: none; }

/* ===== TABS ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    color: var(--color-gray);
    transition: all 0.2s;
}

.tab:hover { color: var(--color-primary); }
.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-secondary);
}

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

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary-light);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination a {
    background: var(--color-white);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.pagination a:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.pagination .current {
    background: var(--color-secondary);
    color: var(--color-white);
    font-weight: 600;
}

/* ===== PRODUCCION BOARD ===== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.kanban-column {
    background: var(--color-light);
    border-radius: var(--border-radius);
    padding: 15px;
    min-height: 400px;
}

.kanban-column-header {
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-weight: 700;
    text-align: center;
    color: var(--color-white);
}

.kanban-column-header.pendiente { background: var(--color-danger); }
.kanban-column-header.en_proceso { background: var(--color-warning); }
.kanban-column-header.completado { background: var(--color-success); }
.kanban-column-header.entregado { background: var(--color-info); }

.kanban-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    border-left: 4px solid var(--color-primary);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
}

.kanban-card h5 {
    font-size: 0.9rem;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.kanban-card p {
    font-size: 0.8rem;
    color: var(--color-gray);
    margin-bottom: 3px;
}

/* ===== RESPONSIVE TABLE ===== */
@media (max-width: 768px) {
    .data-table thead { display: none; }
    .data-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        border-bottom: 1px solid var(--color-border);
    }
    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--color-primary);
    }
    .data-table td:last-child { border-bottom: none; }
}

/* =====================================================================
   J5 SISTEMA v2 - Estilos adicionales
   Mantienen la paleta original: azul marino #1a237e y naranja #ff6f00
   ===================================================================== */

/* ---------- Utilidades ---------- */
.hidden { display: none !important; }
.inline { display: inline-block; }
.mt-2 { margin-top: 10px; }
.text-naranja { color: var(--color-secondary); font-weight: 600; }
.text-left { text-align: left; }
.hide-sm { display: inline; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }

/* ---------- Barras de filtros ---------- */
.filtros {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1;
}
.filtros .form-control { width: auto; min-width: 140px; flex: 0 1 auto; }
.input-mini { width: 110px !important; text-align: right; padding: 6px 8px !important; }

/* ---------- Estado vacío ---------- */
.vacio { text-align: center; padding: 40px 20px; color: var(--color-gray); }
.vacio i { font-size: 2.6rem; color: #cfd8dc; margin-bottom: 12px; display: block; }
.vacio p { margin-bottom: 14px; }

/* ---------- Paginación ---------- */
.paginacion { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.paginacion a {
    display: inline-block; padding: 7px 13px; border-radius: 6px;
    background: #fff; border: 1px solid var(--color-border);
    color: var(--color-primary); text-decoration: none; font-size: .88rem; font-weight: 600;
}
.paginacion a:hover { background: #e8eaf6; }
.paginacion a.activa { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Insignia en el menú ---------- */
.menu-badge {
    margin-left: auto; background: var(--color-secondary); color: #fff;
    border-radius: 10px; padding: 1px 8px; font-size: .72rem; font-weight: 700;
}
.sidebar-menu a { display: flex; align-items: center; gap: 12px; }

/* ---------- Campos con icono ---------- */
.input-icono { position: relative; }
.input-icono > i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--color-gray); pointer-events: none;
}
.input-icono > i + .form-control { padding-left: 40px; }
.ver-clave {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--color-gray); cursor: pointer; padding: 6px;
}

/* ---------- Buscador de cliente ---------- */
.buscador-cliente { position: relative; }
.resultados-busqueda {
    position: fixed; z-index: 3000;
    background: #fff; border: 1px solid var(--color-border); border-radius: 8px;
    box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto;
}
.resultado-item {
    display: block; width: 100%; text-align: left; padding: 10px 14px;
    background: none; border: 0; border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.resultado-item:hover { background: #e8eaf6; }
.resultado-item strong { display: block; color: var(--color-primary); font-size: .9rem; }
.resultado-item small { color: var(--color-gray); font-size: .78rem; }
.resultado-vacio { padding: 12px 14px; color: var(--color-gray); font-size: .85rem; }
.resultado-item.resaltado { background: #e8eaf6; }
.resultado-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
/* Un fallo de la busqueda se ve, no se oculta en silencio. */
.resultado-error {
    color: #b71c1c; background: #ffebee; border-left: 3px solid #c62828;
    font-weight: 500; line-height: 1.5;
}

.cliente-seleccionado {
    position: relative; background: #e8eaf6; padding: 14px 16px;
    border-radius: 8px; margin-top: 10px; border-left: 4px solid var(--color-primary);
}
.cliente-seleccionado h4 { color: var(--color-primary); margin-bottom: 6px; font-size: .98rem; }
.cliente-seleccionado p { margin: 2px 0; font-size: .84rem; }
.quitar-cliente {
    position: absolute; top: 8px; right: 10px; background: none; border: 0;
    font-size: 1.4rem; line-height: 1; color: var(--color-gray); cursor: pointer;
}

/* ---------- Tarjetas de producto ---------- */
.product-img { position: relative; overflow: hidden; background: #eceff1; }
.product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.etiqueta-stock {
    position: absolute; top: 8px; left: 8px; background: var(--color-danger);
    color: #fff; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 10px;
}
.punto-color {
    display: inline-block; width: 11px; height: 11px; border-radius: 50%;
    border: 1px solid #bbb; vertical-align: middle; margin-right: 3px;
}
.miniatura-tabla {
    width: 38px; height: 38px; object-fit: cover; border-radius: 5px;
    vertical-align: middle; margin-right: 8px; background: #eceff1;
}
.preview-actual {
    max-width: 140px; max-height: 140px; border-radius: 8px;
    border: 1px solid var(--color-border); background: #fff; padding: 4px;
}

/* ---------- Catálogo de logos ---------- */
.logos-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px;
}
.logo-card {
    background: #fff; border: 1px solid var(--color-border); border-radius: var(--border-radius);
    overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.logo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.logo-card-img {
    height: 150px; display: flex; align-items: center; justify-content: center;
    background: #f5f5f5; padding: 10px;
}
.logo-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-card-body { padding: 12px 14px; }
.logo-card-body h4 { color: var(--color-primary); font-size: .95rem; margin-bottom: 3px; }
.logo-card-body p { font-size: .78rem; margin: 2px 0; }
.logo-card-meta { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.logo-card-acciones { display: flex; gap: 6px; margin-top: 10px; }

/* ---------- Modal ancho ---------- */
.modal-ancho { max-width: 820px; width: 96%; }
.titulo-prenda {
    font-weight: 700; color: var(--color-primary); font-size: 1rem;
    background: #e8eaf6; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px;
}
.aviso-info {
    background: #e3f2fd; border-left: 4px solid var(--color-info);
    padding: 12px 14px; border-radius: 6px; font-size: .85rem; line-height: 1.6;
}

/* ---------- Aplicaciones de bordado ---------- */
.aplicacion-card {
    border: 2px solid var(--color-border); border-radius: 8px;
    margin-bottom: 14px; overflow: hidden; background: #fff;
}
.aplicacion-header {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--color-primary); color: #fff; padding: 8px 14px;
}
.aplicacion-num { font-weight: 700; font-size: .88rem; }
.aplicacion-body { display: flex; gap: 16px; padding: 14px; flex-wrap: wrap; }
.aplicacion-logo { width: 190px; flex-shrink: 0; }
.aplicacion-logo .logo-preview {
    display: none; width: 100%; height: 130px; object-fit: contain;
    background: #f5f5f5; border: 1px solid var(--color-border);
    border-radius: 6px; margin-bottom: 8px;
}
.aplicacion-logo .logo-preview.visible { display: block; }
.aplicacion-campos { flex: 1; min-width: 260px; }
.form-control-sm { padding: 6px 10px !important; font-size: .84rem !important; }

.bloque-cobro {
    background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px; padding: 14px 16px;
}
.bloque-cobro h4 { color: var(--color-primary); font-size: .92rem; margin-bottom: 10px; }
.opcion-cobro {
    display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
    cursor: pointer; font-size: .88rem;
}
.opcion-cobro input { margin-top: 3px; }
.opcion-cobro small { color: var(--color-gray); }

.resumen-modal {
    display: flex; gap: 20px; flex-wrap: wrap; background: var(--color-primary);
    color: #fff; border-radius: 8px; padding: 14px 18px; margin-top: 16px; font-size: .86rem;
}
.resumen-modal span { color: #c5cae9; display: block; font-size: .74rem; text-transform: uppercase; }
.resumen-modal strong { font-size: 1.05rem; }
.resumen-modal .destacado { margin-left: auto; }
.resumen-modal .destacado strong { color: var(--color-secondary); font-size: 1.3rem; }

/* ---------- Carrito de la venta ---------- */
.titulo-resumen { color: var(--color-primary); margin-bottom: 15px; font-size: 1.05rem; }
.venta-item {
    display: flex; justify-content: space-between; gap: 12px;
    border-bottom: 1px solid var(--color-border); padding: 12px 0;
}
.venta-item-info { flex: 1; min-width: 0; }
.venta-item-info strong { color: var(--color-primary); font-size: .9rem; }
.venta-item-info p { font-size: .78rem; margin: 2px 0; }
.venta-item-acciones { text-align: right; flex-shrink: 0; }
.venta-item-total { font-weight: 700; color: var(--color-secondary); margin: 4px 0; }
.venta-item-botones { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.cantidad-control { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.cantidad-control button {
    width: 26px; height: 26px; border-radius: 5px; border: 1px solid var(--color-border);
    background: #fff; cursor: pointer; font-weight: 700; color: var(--color-primary);
}
.cantidad-control button:hover { background: var(--color-primary); color: #fff; }
.cantidad-control span { min-width: 24px; text-align: center; font-weight: 700; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 5px 0; }
.chip {
    background: #fff3e0; color: #e65100; border: 1px solid #ffcc80;
    border-radius: 10px; padding: 2px 8px; font-size: .7rem; font-weight: 600;
}

/* ---------- Bloque de pago en la venta ---------- */
.bloque-pago {
    background: #f5f7fb; border: 1px solid var(--color-border);
    border-radius: 8px; padding: 14px 16px; margin-top: 16px;
}
.bloque-pago h4 { color: var(--color-primary); font-size: .92rem; margin-bottom: 10px; }
.botones-pago { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.saldo-preview {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: 6px; background: #eceff1; font-size: .9rem;
}
.saldo-preview strong { font-size: 1.15rem; }
.saldo-preview.pagado { background: #e8f5e9; color: #1b5e20; }
.saldo-preview.parcial { background: #fff8e1; color: #e65100; }
.saldo-preview.pendiente { background: #ffebee; color: #b71c1c; }

/* ---------- Banda de estado de pago (ver venta) ---------- */
.banda-pago {
    display: flex; gap: 26px; flex-wrap: wrap; align-items: center;
    background: #fff; border-radius: var(--border-radius); box-shadow: var(--shadow-sm);
    padding: 18px 22px; margin-bottom: 20px; border-left: 6px solid var(--color-gray);
    position: relative;
}
.banda-pago.banda-pagado { border-left-color: var(--color-success); }
.banda-pago.banda-parcial { border-left-color: var(--color-warning); }
.banda-pago.banda-pendiente { border-left-color: var(--color-danger); }
.banda-pago .etiqueta {
    display: block; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .5px; color: var(--color-gray);
}
.banda-pago strong { font-size: 1.25rem; color: var(--color-primary); }
.badge-grande { font-size: .82rem !important; padding: 6px 14px !important; }
.barra-progreso {
    position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
    background: #eceff1; border-radius: 0 0 var(--border-radius) var(--border-radius); overflow: hidden;
}
.barra-progreso span { display: block; height: 100%; background: var(--color-success); transition: width .4s; }

/* ---------- Líneas de datos ---------- */
.linea-dato {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 7px 0; border-bottom: 1px solid #f2f2f2; font-size: .9rem;
}
.linea-dato:last-child { border-bottom: 0; }
.linea-dato.total {
    border-top: 2px solid var(--color-primary); border-bottom: 0;
    margin-top: 10px; padding-top: 10px; font-weight: 700;
    font-size: 1.15rem; color: var(--color-primary);
}
.linea-dato.total span:last-child { color: var(--color-secondary); }
.nota-observacion {
    background: #f5f7fb; border-left: 3px solid var(--color-primary);
    padding: 10px 12px; border-radius: 4px; font-size: .84rem; margin-top: 10px;
}

/* ---------- Detalle de prendas ---------- */
.detalle-prenda { border-bottom: 1px solid var(--color-border); padding: 14px 0; }
.detalle-prenda:last-child { border-bottom: 0; }
.detalle-prenda-cab { display: flex; gap: 12px; align-items: flex-start; }
.detalle-prenda-cab p { font-size: .8rem; margin: 2px 0; }
.detalle-prenda-total {
    margin-left: auto; font-weight: 700; color: var(--color-secondary);
    font-size: 1.05rem; white-space: nowrap;
}
.miniatura-prenda {
    width: 56px; height: 56px; object-fit: cover; border-radius: 6px;
    background: #eceff1; flex-shrink: 0;
}
.bloque-bordado {
    background: #fff8f0; border: 1px solid #ffe0b2; border-left: 4px solid var(--color-secondary);
    border-radius: 6px; padding: 12px; margin-top: 10px;
}
.bloque-bordado-cab {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 10px; font-size: .86rem; color: #e65100;
}
.bloque-bordado-pie {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    border-top: 1px dashed #ffcc80; padding-top: 8px; margin-top: 6px; font-size: .82rem;
}
.aplicacion-fila {
    display: flex; gap: 12px; align-items: flex-start;
    background: #fff; border-radius: 5px; padding: 9px 11px; margin-bottom: 7px;
}
.aplicacion-fila img {
    width: 56px; height: 56px; object-fit: contain; background: #f5f5f5;
    border: 1px solid var(--color-border); border-radius: 4px; flex-shrink: 0;
}
.aplicacion-fila > div { flex: 1; font-size: .84rem; line-height: 1.55; min-width: 0; }
.aplicacion-fila strong { color: var(--color-primary); }
.aplicacion-precio { font-weight: 700; color: var(--color-secondary); white-space: nowrap; }

/* ---------- Formulario de pago ---------- */
.atajos-monto { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.fila-anulada { opacity: .55; text-decoration: line-through; }
.fila-anulada .badge { text-decoration: none; }
.fila-urgente { background: #fff5f5; }

/* ---------- Producción ---------- */
.enlace-tarjeta { text-decoration: none; color: inherit; }
.trabajo-card {
    border: 1px solid var(--color-border); border-radius: var(--border-radius);
    margin-bottom: 16px; overflow: hidden; background: #fff;
}
.trabajo-card.urgente { border-color: var(--color-danger); box-shadow: 0 0 0 1px rgba(198,40,40,.15); }
.trabajo-cab {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap; background: #f5f7fb; padding: 11px 16px; border-bottom: 1px solid var(--color-border);
}
.trabajo-codigo {
    font-weight: 700; color: var(--color-primary); text-decoration: none;
    font-size: 1rem; margin-right: 8px;
}
.trabajo-entrega { font-size: .84rem; color: var(--color-gray); }
.trabajo-cuerpo { display: flex; gap: 20px; padding: 14px 16px; flex-wrap: wrap; }
.trabajo-datos { flex: 1; min-width: 240px; }
.trabajo-datos p { font-size: .86rem; margin: 3px 0; }
.trabajo-aplicaciones { flex: 1.4; min-width: 280px; }
.titulo-aplicaciones { font-size: .84rem; color: var(--color-secondary); font-weight: 700; margin-bottom: 8px; }
.trabajo-acciones {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    background: #fafafa; padding: 11px 16px; border-top: 1px solid var(--color-border);
}
.trabajo-acciones .form-control { width: auto; min-width: 130px; flex: 0 1 auto; }
.trabajo-acciones input[type=text] { flex: 1; min-width: 180px; }
.bitacora { padding: 0 16px 12px; font-size: .82rem; }
.bitacora summary { cursor: pointer; color: var(--color-primary); padding: 6px 0; }
.bitacora pre {
    background: #f5f5f5; padding: 10px; border-radius: 5px;
    white-space: pre-wrap; font-size: .78rem; margin-top: 6px;
}

/* ---------- Configuración / QR ---------- */
.bitacora-smtp {
    background: #263238; color: #b0bec5; padding: 12px; border-radius: 6px;
    font-size: .74rem; max-height: 260px; overflow: auto; white-space: pre-wrap;
}
.bloque-url {
    background: #f5f5f5; padding: 10px; border-radius: 5px;
    display: block; word-break: break-all; font-size: .82rem;
}
.lista-pasos { margin-left: 20px; color: #333; font-size: .86rem; line-height: 1.9; }

/* ---------- Botón cargando ---------- */
.btn.cargando { opacity: .6; cursor: wait; }
.menu-toggle {
    display: none; background: none; border: 0; font-size: 1.25rem;
    color: var(--color-primary); cursor: pointer; margin-right: 12px;
}

/* ---------- Impresión ---------- */
@media print {
    .sidebar, .main-header, .no-print, .btn, .filtros { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; page-break-inside: avoid; }
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .menu-toggle { display: inline-block; }
    .hide-sm { display: none; }
    .aplicacion-logo { width: 100%; }
    .resumen-modal .destacado { margin-left: 0; }
}
@media (max-width: 600px) {
    .filtros { flex-direction: column; align-items: stretch; }
    .filtros .form-control { width: 100%; }
    .banda-pago { gap: 14px; }
    .banda-pago > div { flex: 1 1 45%; }
    .venta-item { flex-direction: column; }
    .venta-item-acciones { text-align: left; }
    .venta-item-botones, .cantidad-control { justify-content: flex-start; }
    .trabajo-acciones .form-control { width: 100%; }
    .logos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* =====================================================================
   Buscador dentro de los desplegables (assets/js/select-buscador.js)
   ===================================================================== */
.j5-select { position: relative; width: 100%; }
.j5-select-oculto {
    position: absolute !important; opacity: 0; pointer-events: none;
    width: 1px; height: 1px; padding: 0; margin: 0; border: 0;
}
.j5-select-boton {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; text-align: left; cursor: pointer; background: #fff;
    font-family: inherit; font-size: inherit;
}
.j5-select-boton:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,.12);
}
.j5-select-texto {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.j5-select-texto.j5-select-placeholder { color: #9e9e9e; }
.j5-select-flecha { color: var(--color-gray); font-size: .72rem; flex-shrink: 0; }
.j5-select-boton[aria-expanded="true"] .j5-select-flecha { transform: rotate(180deg); }

/* position:fixed para que ningún contenedor con overflow:hidden lo recorte */
.j5-select-panel {
    position: fixed; z-index: 3000;
    background: #fff; border: 1px solid var(--color-border);
    border-radius: var(--border-radius); box-shadow: var(--shadow-lg);
    overflow: hidden; display: flex; flex-direction: column;
}
.j5-select-buscar {
    width: 100%; border: 0; border-bottom: 1px solid var(--color-border);
    padding: 10px 12px; font-size: .88rem; font-family: inherit; outline: none;
}
.j5-select-buscar:focus { background: #f5f7fb; }
.j5-select-lista { flex: 1; overflow-y: auto; min-height: 0; }
.j5-select-grupo {
    padding: 7px 12px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--color-gray); background: #fafafa;
}
.j5-select-opcion {
    padding: 9px 12px; font-size: .88rem; cursor: pointer; line-height: 1.35;
}
.j5-select-opcion:hover, .j5-select-opcion.activa { background: #e8eaf6; }
.j5-select-opcion.elegida {
    background: var(--color-primary); color: #fff; font-weight: 600;
}
.j5-select-opcion.deshabilitada { color: #bdbdbd; cursor: not-allowed; }
.j5-select-vacio {
    padding: 14px 12px; text-align: center; color: var(--color-gray); font-size: .85rem;
}

/* Dentro de una barra de filtros el desplegable no debe estirarse */
.filtros .j5-select { width: auto; min-width: 150px; flex: 0 1 auto; }
.trabajo-acciones .j5-select { width: auto; min-width: 140px; flex: 0 1 auto; }
@media (max-width: 600px) {
    .filtros .j5-select, .trabajo-acciones .j5-select { width: 100%; min-width: 0; }
}

/* Versión compacta para el modal de bordados */
.form-control-sm + .j5-select-panel, .j5-select .form-control-sm { font-size: .84rem; }

/* ---------- Zona de carga de logos en el modal de bordado ---------- */
.zona-logos {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: #e8f5e9; border: 2px dashed #66bb6a; border-radius: 8px;
    padding: 14px 16px; margin: 14px 0;
}
.zona-logos-texto { flex: 1; min-width: 240px; }
.zona-logos-texto strong { color: #2e7d32; font-size: .92rem; display: block; margin-bottom: 4px; }
.zona-logos-texto p { font-size: .8rem; color: #558b2f; margin: 0; line-height: 1.5; }
.zona-logos-accion { flex-shrink: 0; }
.zona-logos-estado { flex-basis: 100%; font-size: .82rem; line-height: 1.6; }
.zona-logos-estado:empty { display: none; }

/* Miniatura del logo dentro de la aplicación, un poco mayor para revisarla */
.aplicacion-logo .logo-preview { height: 150px; }
