:root {
            --primary-color: #007bff;
            --primary-dark-color: #0056b3;
            --secondary-color: #6c757d;
            --success-color: #28a745;
            --danger-color: #dc3545;
            --warning-color: #ffc107;
            --info-color: #17a2b8;
            --light-color: #f8f9fa;
            --dark-color: #343a40;
            --text-color: #333;
            --bg-color: #f4f7f6;
            --border-color: #ced4da;
            --shadow-light: 0 2px 4px rgba(0,0,0,0.07);
            --shadow-medium: 0 4px 12px rgba(0,0,0,0.1);
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.6;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        header {
            background-color: var(--dark-color);
            color: white;
            padding: 15px 20px;
            text-align: center;
            box-shadow: var(--shadow-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        header h1 {
            margin: 0;
            font-size: 2.2em;
            flex-grow: 1;
            text-align: center;
        }
        #header-left, #header-right {
            flex-basis: 200px;
            display: flex;
            align-items: center;
        }
        #real-time-clock {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--light-color);
    background-color: rgba(0,0,0,0.2);
    padding: 5px 15px;
    border-radius: 5px;
    font-family: 'Courier New', Courier, monospace;
}
        #header-right {
           justify-content: flex-end;
        }
        #superadmin-context-selector {
            background-color: #fff;
            color: var(--dark-color);
            border: 1px solid var(--primary-color);
            padding: 5px 8px;
            border-radius: 5px;
            font-size: 0.9em;
        }

        nav#main-nav {
            background-color: #495057;
            padding: 10px 0;
            box-shadow: var(--shadow-medium);
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px;
        }
        nav#main-nav button {
            background-color: #5a6268;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            transition: background-color 0.3s ease, transform 0.2s ease;
        }
        nav#main-nav button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
        }
        nav#main-nav button.active-nav-btn {
            background-color: var(--primary-color);
            font-weight: bold;
            box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
        }
        main {
            flex-grow: 1;
            padding: 20px;
            max-width: 1200px;
            margin: 20px auto;
            width: 100%;
            box-sizing: border-box;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: var(--shadow-medium);
        }
        section {
            padding: 20px;
            margin-bottom: 20px;
            border-radius: 8px;
        }
        section h2 {
            color: var(--primary-color);
            border-bottom: 2px solid #e9ecef;
            padding-bottom: 10px;
            margin-top: 0;
            margin-bottom: 20px;
        }
        .hidden {
            display: none !important;
        }
        .form-agregar {
            display: flex;
            flex-direction: column;
            gap: 15px;
            padding: 20px;
            border: 1px solid #a2d2ff;
            border-radius: 8px;
            background-color: #eaf6ff;
            margin-top: 20px;
        }
        form {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        form label {
            font-weight: bold;
            margin-bottom: -10px;
            color: #555;
        }
        form input, form select, form textarea {
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 5px;
            font-size: 1em;
            width: 100%;
            box-sizing: border-box;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;
        }
        form input:focus, form select:focus, form textarea:focus {
            border-color: var(--primary-color);
            outline: 0;
            box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
        }
        input:read-only, input:disabled {
            background-color: #e9ecef;
            cursor: not-allowed;
        }
        .btn, button {
            color: white;
            padding: 12px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            transition: background-color 0.3s ease, transform 0.2s ease;
            text-align: center;
        }
    .btn:hover, button:hover {
            transform: translateY(-1px);
        }
        button:disabled {
            background-color: #adb5bd !important; /* Más oscuro para feedback claro */
            cursor: not-allowed;
            transform: none;
            opacity: 0.7;
        }
        .pagination-controls button:disabled {
            background-color: var(--secondary-color);
            cursor: not-allowed;
            opacity: 0.6;
        }
        /* NUEVOS ESTILOS PARA CAJA Y MOVIMIENTOS */
        .sub-nav {
            border-bottom: 2px solid var(--primary-color);
            margin-bottom: 20px;
        }
        .sub-nav button {
            background-color: transparent;
            border: none;
            padding: 10px 20px;
            font-size: 1.1em;
            cursor: pointer;
            color: var(--secondary-color);
            border-bottom: 3px solid transparent;
        }
        .sub-nav button.active {
            color: var(--primary-color);
            font-weight: bold;
            border-bottom-color: var(--primary-color);
        }
        #caja-sesiones-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
        }
        .caja-card {
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 15px;
            box-shadow: var(--shadow-light);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .caja-card.abierta {
            border-left: 5px solid var(--success-color);
            background-color: #f0fff4;
        }
        .caja-card.cerrada {
            border-left: 5px solid var(--secondary-color);
            background-color: #f8f9fa;
        }
        .caja-card h4 {
            margin: 0;
            color: var(--dark-color);
            font-size: 1.2em;
        }
        .caja-card p {
            margin: 0;
            font-size: 0.9em;
            color: #555;
        }
        .caja-card .moneda-badge {
            font-weight: bold;
            background-color: var(--warning-color);
            color: #333;
            padding: 2px 8px;
            border-radius: 10px;
            font-size: 0.8em;
            display: inline-block;
        }
        .caja-card-actions {
            margin-top: auto;
            padding-top: 10px;
            border-top: 1px solid #eee;
        }
        /* --- ESTILO PARA EL NUEVO DESPLEGABLE EN VENTAS/COMPRAS --- */
        .caja-selector-container {
            padding: 15px;
            border: 1px solid var(--info-color);
            background-color: #eaf6ff;
            border-radius: 8px;
            margin-top: 15px;
        }
        .btn-primary, button[type="submit"] {
            background-color: var(--primary-color);
        }
        .btn-primary:hover, button[type="submit"]:hover {
            background-color: var(--primary-dark-color);
        }
        .btn-secondary {
            background-color: var(--secondary-color);
        }
        .btn-secondary:hover{
            background-color: #5a6268;
        }
        .btn-success {
            background-color: var(--success-color);
        }
        .btn-success:hover {
            background-color: #218838;
        }
        .btn-eliminar {
            background-color: var(--danger-color);
        }
        .btn-eliminar:hover{
            background-color: #c82333;
        }
        .btn-editar, .btn-info {
            background-color: var(--info-color);
        }
        .btn-editar:hover, .btn-info:hover {
            background-color: #138496;
        }

        .btn-warning {
            background-color: var(--warning-color);
            color: #212529;
        }
        .btn-warning:hover {
            background-color: #e0a800;
        }
        .form-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            margin-top: 10px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            box-shadow: var(--shadow-light);
            background-color: white;
        }
        table th, table td {
            border: 1px solid #dee2e6;
            padding: 12px 15px;
            text-align: left;
            vertical-align: middle;
        }
        table th {
            background-color: #e9ecef;
            font-weight: bold;
            color: #495057;
            text-transform: uppercase;
            font-size: 0.9em;
        }
        table tbody tr:hover {
            background-color: #e2f0fb;
        }
        tr.anulado {
            text-decoration: line-through;
            color: #999;
            background-color: #f8d7da !important;
        }
        .anulado-info-icon {
            color: var(--danger-color);
            cursor: help;
            margin-left: 5px;
        }
        .actions-cell {
            display: flex;
            gap: 5px;
            flex-wrap: wrap;
            justify-content: flex-start;
        }

.item-row {

    display: grid;
    grid-template-columns: 1fr 100px 120px 120px 40px; 
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}
        .item-row .item-name {
            font-weight: bold;
        }
        .item-row .item-quantity, .item-row .item-price {
            text-align: right;
            padding: 4px 6px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .item-row .subtotal-item {
            text-align: right;
            font-weight: 500;
        }
        .item-row .item-remove {
            padding: 4px 8px !important;
            line-height: 1;
            height: auto;
        }
        #notification-container {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            align-items: center;
        }
        .notification {
            padding: 15px 25px;
            border-radius: 8px;
            box-shadow: var(--shadow-medium);
            font-weight: bold;
            opacity: 0;
            transform: translateY(-20px);
            transition: opacity 0.4s ease, transform 0.4s ease;
        }
        .notification.show {
            opacity: 1;
            transform: translateY(0);
        }
        .notification.success {
            background-color: #d4edda;
            color: #155724;
        }
        .notification.error {
            background-color: #f8d7da;
            color: #721c24;
        }
        .notification.info {
            background-color: #d1ecf1;
            color: #0c5460;
        }
        footer {
            background-color: var(--dark-color);
            color: white;
            text-align: center;
            padding: 15px 0;
            margin-top: auto;
            font-size: 0.9em;
        }
        #login-section .login-box {
            max-width: 400px;
            margin: 40px auto;
            padding: 30px;
        }
        #permissions-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 10px;
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
        }
        #permissions-grid label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: normal;
        }
        .manager-view .btn-back {
            background-color: var(--secondary-color);
            margin-bottom: 20px;
        }
        .modal {
            display: none;
            position: fixed;
            z-index: 3000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.5);
            align-items: center;
            justify-content: center;
        }
        .modal.show {
            display: flex;
        }
        .modal-content {
            background-color: #fefefe;
            margin: auto;
            padding: 25px;
            border: 1px solid #888;
            width: 80%;
            max-width: 700px;
            border-radius: 8px;
            box-shadow: var(--shadow-medium);
        }
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
            margin-bottom: 15px;
        }
        .close-modal-btn {
            color: #aaa;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
        }
        .close-modal-btn:hover {
            color: #000;
        }
        .modal-body input[type="text"] {
            width: 100%;
            margin-bottom: 15px;
        }
        #search-results-container {
            max-height: 300px;
            overflow-y: auto;
        }
        .payment-options {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 15px;
        }
        .payment-options button {
            flex-grow: 1;
            background-color: var(--secondary-color);
        }
        .payment-options button.active {
            background-color: var(--primary-color);
            font-weight: bold;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
        }
        #venta-payment-details, #compra-payment-details, #venta-change-calculator, #compra-change-calculator {
            padding: 15px;
            border: 1px solid #a2d2ff;
            border-radius: 8px;
            background-color: #f8fcff;
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .change-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .change-row label {
            font-weight: bold;
        }
        .change-row input {
            text-align: right;
            font-size: 1.2em;
            max-width: 150px;
        }
        #venta-change-due, #compra-change-due {
            font-size: 1.4em;
            font-weight: bold;
            color: var(--success-color);
        }
        .filter-panel {
            padding: 15px;
            background-color: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            margin-bottom: 20px;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 15px;
            align-items: flex-end;
        }
        .filter-panel .form-actions {
            grid-column: 1 / -1;
            display: flex;
            gap: 10px;
            justify-content: flex-start;
        }
        .filter-panel label {
            font-weight: normal;
            margin-bottom: 5px;
        }
        .filter-panel input, .filter-panel select {
            width: 100%;
            padding: 8px;
        }
        #informe-filtros {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 15px;
            padding: 20px;
            border: 1px solid #a2d2ff;
            border-radius: 8px;
            background-color: #eaf6ff;
        }
        #informe-resultados-container {
            margin-top: 20px;
        }
        .pagination-controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 15px;
            padding: 10px;
            background-color: #f8f9fa;
            border-radius: 5px;
        }
        .pagination-controls button {
            padding: 8px 12px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .pagination-controls button:disabled {
            background-color: var(--secondary-color);
            cursor: not-allowed;
        }
        .pagination-controls select {
            padding: 5px 8px;
            border-radius: 4px;
            border: 1px solid var(--border-color);
        }
        .print-container{
            display:none;
        }
@media print {
    body > *:not(.print-container) {
        display: none !important;
    }
    .print-container {
        display: block !important;
        margin: 0;
        padding: 0;
    }
    .invoice-page {
        page-break-after: always;
        border: none;
        box-shadow: none;
        margin: 0;
    }
    .invoice-page:last-child {
        page-break-after: avoid;
    }

    /* --- ESTILOS PARA LA FACTURA A4 (NUEVO FORMATO) --- */
    .invoice-container-new {
        font-family: 'Arial', sans-serif;
        font-size: 9pt;
        line-height: 1.4;
        width: 190mm; /* Ancho ajustado para márgenes A4 */
        margin: 0 auto;
        border: 1px solid #333;
        padding: 5mm;
    }
    .invoice-header-new {
        display: flex;
        justify-content: space-between;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
    }
    .invoice-header-new .header-left {
        width: 55%;
        display: flex;
        align-items: flex-start;
    }
    .invoice-header-new .header-right {
        width: 40%;
        border: 1px solid #333;
        padding: 5px;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .invoice-header-new .header-right p {
        margin: 4px 0;
        font-size: 8pt;
    }
    .invoice-logo {
        max-width: 150px;
        max-height: 80px;
        margin-right: 15px;
        object-fit: contain;
    }
    .company-details {
        font-size: 8pt;
    }
    .invoice-title {
        background-color: #f2f2f2;
        padding: 5px;
        margin-top: 10px;
    }
    .invoice-title strong {
        display: block;
        font-size: 11pt;
    }

    .client-details-new {
        border: 1px solid #333;
        margin-top: 15px;
        padding: 8px;
    }
    .client-details-new .client-row {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }
    .client-details-new .client-row div {
        width: 49%;
    }

    .items-section-new {
        margin-top: 15px;
    }
    .items-section-new table {
        width: 100%;
        border-collapse: collapse;
    }
    .items-section-new th, .items-section-new td {
        border: 1px solid #333;
        padding: 4px;
    }
    .items-section-new th {
        background-color: #f2f2f2;
        font-size: 8pt;
    }

    .invoice-footer-new {
        margin-top: 10px;
    }
    .footer-totals {
        display: flex;
        justify-content: space-between;
        border: 1px solid #333;
        padding: 5px;
    }
    .footer-totals .left-col {
        width: 70%;
    }
    .footer-totals .right-col {
        width: 28%;
    }
    .footer-totals p {
        margin: 2px 0;
    }
    .footer-iva {
        border: 1px solid #333;
        border-top: none;
        padding: 5px;
        display: flex;
        gap: 15px;
    }
    .footer-iva p {
        margin: 2px 0;
    }
    .observations {
        margin-top: 5px;
        border: 1px solid #333;
        padding: 5px;
        min-height: 30px;
    }

    .text-right { text-align: right; }
    .text-center { text-align: center; }

    /* --- ESTILOS PARA EL TICKET Y PAGARÉ --- */
     .pagare-container {
        border: 2px solid #000;
        padding: 15mm;
        font-family: 'Times New Roman', serif;
    }
    .ticket-body {
        font-family: 'Courier New', monospace;
        font-size: 12px;
        line-height: 1.4;
        background: #fff;
        color: #000;
        padding: 5px;
        width: 300px; /* Ancho típico para ticket */
    }
    .ticket-body * { margin: 0; padding: 0; }
    .ticket-header { text-align: center; }
    .ticket-header img { max-width: 150px; margin-bottom: 5px; }
    .ticket-header p { font-size: 11px; }
    .ticket-info, .ticket-items, .ticket-totals, .ticket-footer {
        margin-top: 10px;
        border-top: 1px dashed #000;
        padding-top: 10px;
    }
    .ticket-body .ticket-items table { width: 100%; font-size: 11px; }
    .ticket-body .ticket-items th, .ticket-body .ticket-items td { padding: 2px 0; vertical-align: top; }
    .ticket-body .ticket-totals p { font-size: 12px; display: flex; justify-content: space-between; }
    .ticket-body .ticket-totals p strong { font-size: 14px; }
}

.item-row.venta {

    grid-template-columns: 1fr 100px 120px 60px 120px 40px; 
}

.item-details {
    display: flex;
    flex-direction: column;
}

.item-pricing-details {
    font-size: 0.8em;
    color: #555;
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

.original-price {
    text-decoration: line-through;
}

.discount-amount {
    color: var(--success-color);
    font-weight: bold;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 5px;
    overflow: hidden; 
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown-content.show {
    display: block;
}
/* --- Estilos para el Modal de Opciones de Impresión --- */
#print-options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.print-option-btn {
    padding: 15px 20px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
}

.print-option-btn i {
    font-size: 1.5em;
    width: 30px; /* Ancho fijo para alinear el texto de los botones */
    text-align: center;
    margin-right: 10px;
}


.item-row.compra {

    grid-template-columns: 1fr 100px 120px 60px 120px 40px; 
}
.item-lote-details, .item-registro-details { display: flex; gap: 8px; margin-top: 5px; }
.item-lote-details input, .item-registro-details select, .item-registro-details input {
    padding: 4px 6px; font-size: 0.85em; border: 1px solid #ccc; border-radius: 4px;
}
/* --- FIN ESTILOS PARA LOTES Y VENCIMIENTO (COMPRA) --- */

/* --- ESTILOS PARA IMPRESIÓN (TAMAÑO FUENTE LOTES) --- */
@media print {
    .items-section-new td small { font-size: 8pt !important; } /* Factura A4 */
    .ticket-body .lote-details-row td {
        border-top: 1px dashed #ccc; padding-top: 1px; padding-bottom: 1px;
        font-size: 8pt !important; /* Ticket */
        line-height: 1.1 !important;
    }
    .ticket-body .discount-row td { font-size: 8pt !important; } /* Ticket Descuento */
}
/* --- INICIO: ESTILOS PARA MODULO DE CREDITOS --- */

/* Estilos para el formulario de garantías en el modal de crédito manual */
.garantia-item-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 40px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.garantia-item-row select,
.garantia-item-row input {
    padding: 8px;
    font-size: 0.9em;
}
.garantia-item-row .btn-delete-garantia {
    padding: 6px 10px !important;
    line-height: 1;
}

/* Estilos para el modal de detalle de crédito */
#cred-info-garantias div,
#cred-historial-pagos div {
    border-bottom: 1px solid #eee; 
    padding: 5px 0;
}
#cred-info-garantias p,
#cred-historial-pagos p {
    margin: 0;
}
#cred-info-garantias small,
#cred-historial-pagos small {
    color: #555;
    font-size: 0.9em;
}

/* Estilos para las insignias (badges) de estado en la tabla */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.8em;
    color: #333;
}
.status-badge.success { background-color: #d4edda; color: #155724; }
.status-badge.warning { background-color: #fff3cd; color: #856404; }
.status-badge.danger { background-color: #f8d7da; color: #721c24; }

/* Estilos para el modal de plantillas */
#plantilla-contenido {
    font-family: monospace;
    font-size: 1.1em;
    line-height: 1.5;
    background-color: #fdfdfd;
    border-color: #ccc;
}

/* Estilos para la impresión de documentos formales */
@media print {
    .documento-formal-print {
        font-family: 'Times New Roman', Times, serif;
        font-size: 12pt;
        line-height: 1.5;
        padding: 1cm;
        box-sizing: border-box;
    }
    .documento-formal-print h1 {
        text-align: center;
        font-size: 16pt;
    }
    .documento-formal-print p {
        text-align: justify;
        margin-bottom: 1em;
    }
    .documento-formal-print table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10pt;
    }
    .documento-formal-print th, 
    .documento-formal-print td {
        border: 1px solid #000;
        padding: 5px;
    }
}
/* --- FIN: ESTILOS PARA MODULO DE CREDITOS --- */
/* --- INICIO CORRECCIÓN Z-INDEX MODAL BÚSQUEDA --- */
/* Esto asegura que el modal de búsqueda (#search-modal)
  siempre aparezca ENCIMA de cualquier otro modal (como #linea-credito-modal).
*/
#search-modal {
    z-index: 4000;
}
/* --- FIN CORRECCIÓN --- */
/* --- INICIO: Mejora Grilla de Permisos de Usuario (Estilo Celda) --- */

/* 1. El contenedor principal de los permisos */
#permissions-grid {
    display: grid;
    /* 3 columnas de tamaño idéntico */
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px; /* Un espacio pequeño entre "celdas" */
    
    /* Estilo del contenedor (como una hoja de Excel) */
    background-color: #f0f2f5;
    padding: 6px;
    border-radius: 5px;
    border: 1px solid #d0d7e0;
}

/* 2. La "Celda" (cada etiqueta que contiene el checkbox y el texto) */
#permissions-grid label {
    display: flex;
    flex-direction: row; /* Checkbox al inicio, texto después */
    align-items: center; /* Centrado vertical */
    justify-content: flex-start; /* Alineado a la izquierda */
    
    /* El aspecto de "Celda" */
    background-color: #ffffff;
    border: 1px solid #d0d7e0;
    border-radius: 4px;
    padding: 10px 12px;
    
    font-weight: normal;
    gap: 10px; /* Espacio entre checkbox y texto */
    transition: background-color 0.2s;
    cursor: pointer;
}

/* 3. Efecto visual al pasar el mouse */
#permissions-grid label:hover {
    background-color: #eaf6ff;
    border-color: var(--primary-color);
}

/* 4. Estilo del Checkbox (para que esté bien alineado) */
#permissions-grid label input[type="checkbox"] {
    width: 1.2em;  /* Un poco más grande */
    height: 1.2em;
    flex-shrink: 0; /* Evita que el checkbox se encoja */
    margin: 0; /* Quita márgenes por defecto */
}
/* --- FIN: Mejora Permisos de Usuario --- */
/* --- INICIO: Mejora Modal de Arqueo de Caja (Estilo Celda) --- */

/* 1. El contenedor: 2 columnas de celdas */
#denominacion-container {
    display: grid;
    /* Dos columnas */
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    
    /* Estilos del contenedor */
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #d0d7e0; /* Borde del contenedor */
    padding: 6px;
    background-color: #f0f2f5; /* Fondo */
    border-radius: 5px;
}

/* 2. La celda (cada fila de denominación) 
   Usamos !important para sobre-escribir los estilos que genera el JS
*/
#denominacion-container > div {
    /* Re-definir la grilla interna de la celda */
    display: grid !important;
    /* Col 1: Label | Col 2: Input | Col 3: Subtotal */
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    gap: 10px !important;
    
    /* Estilo de Celda */
    background-color: #ffffff;
    border: 1px solid #d0d7e0 !important; /* Borde de celda */
    border-radius: 4px;
    padding: 8px 10px !important;
}

/* 3. Alinear el contenido de la celda */
#denominacion-container > div label {
    font-weight: bold;
    text-align: left !important; /* Alineado a la izquierda */
    margin: 0;
}

#denominacion-container > div input.denominacion-input {
    width: 70px !important; /* Ancho fijo para el input */
    text-align: right;
}

#denominacion-container > div .denominacion-subtotal {
    text-align: right !important;
    font-size: 0.95em;
    color: #555;
}
/* --- FIN: Mejora Modal de Arqueo --- */
/* --- INICIO SOLUCIÓN: Z-Index Modales Globales --- */
/* Esto asegura que el modal de confirmación (#global-confirm-modal) 
  y el de prompt (#global-prompt-modal) siempre aparezcan 
  ENCIMA de otros modales (como #linea-detalle-modal).
*/
#global-confirm-modal,
#global-prompt-modal {
    z-index: 5000 !important;
}
/* --- FIN SOLUCIÓN --- */
/* --- INICIO: ESTILOS DE MARCA DE AGUA "ANULADO" (V2: ADAPTABLE Y AL FRENTE) --- */

/* 1. El contenedor debe ser relativo para posicionar la marca de agua */
.invoice-page,
.ticket-body,
.pagare-container {
    position: relative;
    overflow: hidden; /* Asegura que la marca no se salga */
}

/* 2. El contenedor que activa la marca de agua (ADAPTABLE Y AL FRENTE) */
.watermarked-anulado::before {
    content: 'A N U L A D O';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    
    /* * Usa 'vw' (viewport width) para que el tamaño de la fuente 
     * se adapte al ancho del papel (A4 o Ticket). 
     * '13vw' es 13% del ancho del papel.
     */
    font-size: 13vw; 
    
    font-weight: 900; /* Más grueso */
    color: rgba(220, 53, 69, 0.12); /* Rojo (danger) muy transparente */
    
    /* Poner AL FRENTE (z-index alto) */
    z-index: 1000; 
    
    pointer-events: none; /* Evita que se pueda seleccionar o bloquear clicks */
    line-height: 1;
    white-space: nowrap; /* Evita que el texto se parta */
    overflow: hidden; /* Seguridad extra */
}

/* 3. Asegurar que el contenido del ticket/factura esté por DETRÁS */
.ticket-body *,
.invoice-container-new *,
.pagare-container * {
    position: relative;
    z-index: 1; /* El contenido se queda en z-index 1 */
}

/* --- INICIO: CORRECCIÓN MARCA DE AGUA TICKET (V3) --- */

/* * Esto anula la regla '13vw' anterior, pero SÓLO para el ticket,
 * forzando un tamaño de 48px que sí cabe en el ancho de 300px del ticket.
*/
.ticket-body.watermarked-anulado::before {
    font-size: 48px; /* Tamaño fijo en píxeles para el ticket */
    color: rgba(220, 53, 69, 0.1); /* Un poco más transparente */
}

/* --- FIN: CORRECCIÓN MARCA DE AGUA TICKET --- */
/* modulo_pro.css */

/* Estilos para la lista de conceptos en el formulario de nómina */
.nomina-concepto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.6);
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
}

.nomina-concepto-item span {
    font-size: 0.95em;
}

.nomina-concepto-item strong {
    font-size: 1.05em;
}

/* Ocultar el selector de caja de nómina por defecto */
#nomina-caja-container {
    display: block; /* Se mostrará u ocultará con JS */
}

/* Ocultar el input[type=file] real y estilizar el label */
#gasto-comprobante-url-display {
    font-size: 0.85em;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

/* Estilo para celda de detalles en tabla de ajustes */
.ajuste-item-details-list {
    margin: 0;
    padding-left: 15px;
    font-size: 0.9em;
    color: #444;
}
.ajuste-item-details-list li {
    margin-bottom: 3px;
}

/* --- INICIO: CORRECCIÓN DE SUPERPOSICIÓN DE MODALES --- */
#search-modal {
    z-index: 4000;
}

/* Modal de Lotes (PRO) debe estar sobre el modal de Ajuste (3000) */
#pro-lot-selection-modal {
    z-index: 6000;
}

#global-confirm-modal,
#global-prompt-modal {
    z-index: 5000;
}
/* --- FIN: CORRECCIÓN DE SUPERPOSICIÓN DE MODALES --- */


/* --- INICIO: ESTILOS PARA COTIZACIÓN (NUEVO) --- */
/* Estilos inferidos de 'estilos.css' para '.item-row' */
.items-container {
    border: 1px solid #ddd;
    background: #fdfdfd;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
}

.item-row {
    display: grid;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
}

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

.item-row .item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.item-row .item-name {
    font-weight: bold;
}
.item-row input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100px;
    text-align: right;
}
.item-row .subtotal-item {
    font-weight: bold;
    text-align: right;
    min-width: 100px;
}
.item-row .item-remove {
    padding: 4px 8px;
    font-size: 0.9em;
    justify-self: center;
}

/* Estilos específicos para Cotización */
.item-row.cotizacion {
    /* Colummnas: [Nombre] [Cant] [x] [Precio] [Moneda] [Subtotal] [Btn] */
    grid-template-columns: 1fr auto auto auto auto auto auto;
}

.item-row.cotizacion .item-quantity { max-width: 80px; }
.item-row.cotizacion .item-price { max-width: 120px; }
.item-row.cotizacion .item-price-currency { font-size: 0.9em; color: #555; }
/* --- FIN: ESTILOS PARA COTIZACIÓN --- */
/* modulo_pro.css */

/* Estilos para la lista de conceptos en el formulario de nómina */
.nomina-concepto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.6);
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
}

.nomina-concepto-item span {
    font-size: 0.95em;
}

.nomina-concepto-item strong {
    font-size: 1.05em;
}

/* Ocultar el selector de caja de nómina por defecto */
#nomina-caja-container {
    display: block; /* Se mostrará u ocultará con JS */
}

/* Ocultar el input[type=file] real y estilizar el label */
#gasto-comprobante-url-display {
    font-size: 0.85em;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

/* Estilo para celda de detalles en tabla de ajustes */
.ajuste-item-details-list {
    margin: 0;
    padding-left: 15px;
    font-size: 0.9em;
    color: #444;
}
.ajuste-item-details-list li {
    margin-bottom: 3px;
}

/* --- INICIO: CORRECCIÓN DE SUPERPOSICIÓN DE MODALES --- */
#search-modal {
    z-index: 4000;
}

/* Modal de Lotes (PRO) debe estar sobre el modal de Ajuste (3000) */
#pro-lot-selection-modal {
    z-index: 6000;
}

#global-confirm-modal,
#global-prompt-modal {
    z-index: 5000;
}
/* --- FIN: CORRECCIÓN DE SUPERPOSICIÓN DE MODALES --- */


/* --- INICIO: ESTILOS PARA COTIZACIÓN (NUEVO) --- */
/* Estilos inferidos de 'estilos.css' para '.item-row' */
.items-container {
    border: 1px solid #ddd;
    background: #fdfdfd;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
}

.item-row {
    display: grid;
    align-items: center;
    gap: 8px;
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
}

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

.item-row .item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.item-row .item-name {
    font-weight: bold;
}
.item-row input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 100px;
    text-align: right;
}
.item-row .subtotal-item {
    font-weight: bold;
    text-align: right;
    min-width: 100px;
}
.item-row .item-remove {
    padding: 4px 8px;
    font-size: 0.9em;
    justify-self: center;
}

/* Estilos específicos para Cotización */
.item-row.cotizacion {
    /* Colummnas: [Nombre] [Cant] [x] [Precio] [Moneda] [Subtotal] [Btn] */
    grid-template-columns: 1fr auto auto auto auto auto auto;
}

.item-row.cotizacion .item-quantity { max-width: 80px; }
.item-row.cotizacion .item-price { max-width: 120px; }
.item-row.cotizacion .item-price-currency { font-size: 0.9em; color: #555; }
/* --- FIN: ESTILOS PARA COTIZACIÓN --- */

/* --- INICIO: ESTILOS FASE 2 y 3 --- */

/* Estilos para la tabla de precios en el modal de producto */
#producto-precios-table-container table td,
#timbrados-table-container table td,
#sucursal-registros-table-container table td {
    padding: 8px 10px;
    font-size: 0.9em;
}

#producto-precios-table-container table .btn-eliminar,
#timbrados-table-container table .btn-eliminar,
#sucursal-registros-table-container table .btn-eliminar {
    padding: 4px 8px;
    font-size: 0.9em;
}

/* Estilos para la lista de items en el modal de recepción de transferencia */
#recepcion-items-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

#recepcion-items-list .item-recepcion {
    padding: 8px;
    border-bottom: 1px solid #eee;
}
#recepcion-items-list .item-recepcion:last-child {
    border-bottom: none;
}
#recepcion-items-list .item-recepcion-nombre {
    font-weight: bold;
}
#recepcion-items-list .item-recepcion-lote {
    font-size: 0.9em;
    color: #555;
    margin-left: 10px;
}

/* Z-index para los nuevos modales de gestión (Fase 2 y 3) */
/* Deben estar por encima del modal base (3000) pero por debajo de search (4000) y confirm (5000) */
#timbrado-modal,
#sucursal-registro-modal,
#producto-precio-sucursal-modal,
#transferencia-recepcion-modal {
    z-index: 3500;
}

/* --- FIN: ESTILOS FASE 2 y 3 --- */
