/* ============================================
   PROVEEDORES — Diseño Profesional ERP
   ============================================ */

/* ---- Contenedor principal ---- */
#pageArticulos,
#pageListaPrecios,
#pageProveedores,
#pageBancos,
#pageCategorias,
#pageCondicionesPago,
#pageEmpresas,
#pageTiposDocumento,
#pageVendedores,
#pageUnidadesMedida,
#pageUbigeo,
#pageCargos,
#pageAreas,
#pageEmpleados,
#pageChoferes,
#pageUsuarios,
#pageRoles,
#pageTransportistas,
#pageVehiculos,
#pageFamilias,
#pageSubfamilias,
#pageMotivosGuia,
#pageStockValorizado,
#pageKardexValorizado,
#pageKardexArticulo,
#pageStockCorteFecha,
#pageStockMinimoActual,
#pageArticulosSinMovimiento,
#pageConciliacionFisica,
#pageMargenArticulo,
#pageRotacionInventario {
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: provFadeIn 0.25s ease;
}

#pageArticulos > .prov-header,
#pageArticulos > .prov-toolbar,
#pageArticulos > .prov-paginacion,
#pageListaPrecios > .prov-header,
#pageListaPrecios > .prov-toolbar,
#pageListaPrecios > .prov-paginacion {
    flex-shrink: 0;
}

#pageProveedores > .prov-header,
#pageBancos > .prov-header,
#pageCategorias > .prov-header,
#pageCondicionesPago > .prov-header,
#pageEmpresas > .prov-header,
#pageTiposDocumento > .prov-header,
#pageVendedores > .prov-header,
#pageUnidadesMedida > .prov-header,
#pageUbigeo > .prov-header,
#pageStockValorizado > .prov-header,
#pageKardexArticulo > .prov-header,
#pageProveedores > .prov-toolbar,
#pageBancos > .prov-toolbar,
#pageCategorias > .prov-toolbar,
#pageCondicionesPago > .prov-toolbar,
#pageEmpresas > .prov-toolbar,
#pageTiposDocumento > .prov-toolbar,
#pageVendedores > .prov-toolbar,
#pageUnidadesMedida > .prov-toolbar,
#pageUbigeo > .prov-toolbar,
#pageCargos > .prov-toolbar,
#pageAreas > .prov-toolbar,
#pageEmpleados > .prov-toolbar,
#pageChoferes > .prov-toolbar,
#pageUsuarios > .prov-toolbar,
#pageRoles > .prov-toolbar,
#pageTransportistas > .prov-toolbar,
#pageVehiculos > .prov-toolbar,
#pageFamilias > .prov-toolbar,
#pageSubfamilias > .prov-toolbar,
#pageMotivosGuia > .prov-toolbar,
#pageStockValorizado > .prov-toolbar,
#pageKardexArticulo > .prov-toolbar,
#pageProveedores > .prov-paginacion,
#pageBancos > .prov-paginacion,
#pageCategorias > .prov-paginacion,
#pageCondicionesPago > .prov-paginacion,
#pageEmpresas > .prov-paginacion,
#pageTiposDocumento > .prov-paginacion,
#pageVendedores > .prov-paginacion,
#pageUnidadesMedida > .prov-paginacion,
#pageUbigeo > .prov-paginacion,
#pageCargos > .prov-paginacion,
#pageAreas > .prov-paginacion,
#pageEmpleados > .prov-paginacion,
#pageChoferes > .prov-paginacion,
#pageUsuarios > .prov-paginacion,
#pageRoles > .prov-paginacion,
#pageTransportistas > .prov-paginacion,
#pageVehiculos > .prov-paginacion,
#pageFamilias > .prov-paginacion,
#pageSubfamilias > .prov-paginacion,
#pageMotivosGuia > .prov-paginacion,
#pageStockValorizado > .prov-paginacion,
#pageKardexArticulo > .prov-paginacion {
    flex-shrink: 0;
}

@keyframes provFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Header de sección ---- */
.prov-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--azul-50);
    border: 1px solid var(--gris-200);
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.prov-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prov-header-icon {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, rgba(37,99,160,0.10), rgba(37,99,160,0.03));
    border: 1px solid rgba(37,99,160,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--azul-400);
}

.prov-header-titulo h2 {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--gris-800);
    line-height: 1.2;
}

.prov-header-titulo p {
    font-size: 0.65rem;
    color: var(--gris-400);
    margin-top: 1px;
}

/* ---- Toolbar ---- */
.prov-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px;
    background: var(--azul-50);
    border-left: 1px solid var(--gris-200);
    border-right: 1px solid var(--gris-200);
    border-bottom: 1px solid var(--gris-200);
    flex-wrap: wrap;
}

.prov-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.prov-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botones */
.btn-prov {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-prov-primario {
    background: var(--azul-400);
    color: var(--blanco);
    box-shadow: 0 2px 8px rgba(37,99,160,0.25);
}

.btn-prov-primario:hover {
    background: var(--azul-500);
    box-shadow: 0 4px 16px rgba(37,99,160,0.35);
    transform: translateY(-1px);
}

.btn-prov-primario:active {
    transform: translateY(0);
}

.btn-prov-secundario {
    background: var(--blanco);
    color: var(--azul-400);
    border: 1px solid var(--azul-300);
}

.btn-prov-secundario:hover {
    background: #f8fafc;
    border-color: var(--azul-400);
}

/* Buscador */
.prov-buscador {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.prov-buscador input {
    width: 100%;
    padding: 6px 14px 6px 36px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    color: var(--gris-800);
    background: var(--blanco);
    outline: none;
    transition: all 0.2s ease;
}

.prov-buscador input:focus {
    border-color: var(--azul-400);
    box-shadow: 0 0 0 3px rgba(37,99,160,0.12);
    background: var(--blanco);
}

.prov-buscador input::placeholder {
    color: var(--gris-400);
}

.prov-buscador i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gris-400);
    font-size: 0.85rem;
    pointer-events: none;
}

/* Filtro */
.prov-filtro {
    padding: 6px 32px 6px 14px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--gris-700);
    outline: none;
    cursor: pointer;
    background: var(--blanco);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394A3B8' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
}

.prov-filtro:focus {
    border-color: var(--azul-400);
}

.prov-contador {
    font-size: 0.8rem;
    color: var(--gris-400);
    white-space: nowrap;
    font-weight: 500;
}

/* ============================================
   TABLA
   ============================================ */
/*.prov-tabla-wrap {
    background: var(--blanco);
    border-radius: 12px;
    border: 1px solid var(--gris-200);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
*/

.prov-tabla-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    background: var(--blanco);
    border: 1px solid var(--gris-200);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.prov-tabla-wrap::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.prov-tabla-wrap::-webkit-scrollbar-track {
    background: var(--gris-50);
}

.prov-tabla-wrap::-webkit-scrollbar-thumb {
    background: var(--gris-300);
    border-radius: 6px;
}

.prov-tabla-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--gris-400);
}

.prov-tabla {
    width: 100%;
    border-collapse: collapse;
}

.prov-tabla th {
    position: sticky !important;
    top: 0;
    z-index: 999;
}
.prov-tabla tbody {
    position: relative;
    z-index: 1;
}
/* clip-path en thead/tr interfiere con position: sticky en th */
/* Las esquinas redondeadas las da .prov-tabla-wrap border-radius + overflow */

.prov-tabla thead th {
    padding: 10px 10px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--blanco);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--azul-500);
    border-bottom: 2px solid var(--azul-700);
    white-space: nowrap;
    user-select: none;
}

.prov-th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.prov-th-content > span:first-child {
    flex: 1;
    text-align: center;
}

.prov-th-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.prov-btn-sort,
.prov-btn-filtro {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.prov-btn-sort:hover,
.prov-btn-filtro:hover {
    background: rgba(255,255,255,0.15);
    color: var(--blanco);
}

.prov-btn-filtro.activo {
    color: var(--accent);
}

.prov-sort-icon {
    font-size: 0.6rem;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.prov-sort-icon.activo {
    opacity: 1;
    color: var(--accent);
}

.prov-sort-icon.activo.asc {
    color: var(--accent);
}

.prov-sort-icon.activo.desc {
    color: var(--accent);
}

.prov-tabla tbody td {
    padding: 1px 8px;
    font-size: 0.7rem;
    line-height: 1.2;
    color: var(--gris-700);
    border-bottom: 1px solid var(--gris-100);
    vertical-align: middle;
}

.prov-tabla tbody tr {
    transition: background 0.15s ease;
}

.prov-tabla tbody tr:last-child td {
    border-bottom: none;
}

.prov-tabla tbody tr {
    cursor: pointer;
}

.prov-tabla tbody tr:hover {
    background: rgba(37,99,160,0.08);
}

.prov-tabla tbody tr:active {
    background: rgba(37,99,160,0.12);
}

.prov-tabla tbody .col-codigo {
    font-size: 0.7rem;
    color: var(--azul-500);
}

.prov-tabla tbody .col-razon {
    color: var(--gris-800);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prov-tabla tbody .col-doc {
    font-size: 0.7rem;
    color: var(--gris-600);
}

.prov-tabla tbody .col-contacto {
    font-size: 0.7rem;
    color: var(--gris-500);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prov-tabla tbody .col-categoria {
    font-size: 0.7rem;
    color: var(--azul-500);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* Badges de estado */
.prov-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.prov-badge-activo {
    background: rgba(16,185,129,0.08);
    color: #059669;
    border: 1px solid rgba(16,185,129,0.15);
}

.prov-badge-inactivo {
    background: rgba(239,68,68,0.06);
    color: #DC2626;
    border: 1px solid rgba(239,68,68,0.12);
}

.prov-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.prov-badge-activo .prov-badge-dot {
    background: #10B981;
    box-shadow: 0 0 6px rgba(16,185,129,0.4);
}

.prov-badge-inactivo .prov-badge-dot {
    background: #EF4444;
}

/* Botones de acción */
.prov-acciones {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.prov-btn-accion {
    width: 26px;
    height: 26px;
    border: 1px solid var(--gris-200);
    border-radius: 5px;
    background: var(--blanco);
    color: var(--gris-400);
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.prov-btn-accion:hover {
    border-color: var(--azul-300);
    color: var(--azul-500);
    background: rgba(37,99,160,0.04);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.prov-btn-eliminar:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239,68,68,0.04);
    box-shadow: 0 2px 6px rgba(239,68,68,0.08);
}

/* Estado vacío */
.prov-vacio {
    text-align: center;
    padding: 56px 24px;
    color: var(--gris-400);
}

.prov-vacio i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
    color: var(--gris-200);
}

.prov-vacio p {
    font-size: 0.92rem;
    font-weight: 500;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.prov-paginacion {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: var(--azul-50);
    border-top: none;
    font-size: 0.75rem;
    color: var(--gris-600);
    border-radius: 0 0 12px 12px;
    border: 1px solid var(--gris-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.prov-pag-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.prov-pag-btn {
    min-width: 28px;
    height: 28px;
    border: 1px solid var(--gris-200);
    border-radius: 8px;
    background: var(--blanco);
    color: var(--gris-600);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    transition: all 0.2s ease;
}

.prov-pag-btn:hover:not(:disabled) {
    border-color: var(--azul-400);
    color: var(--azul-400);
    background: rgba(37,99,160,0.06);
}

.prov-pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.prov-pag-btn.activo {
    background: var(--azul-400);
    border-color: var(--azul-400);
    color: var(--blanco);
    box-shadow: 0 2px 8px rgba(37,99,160,0.3);
}

/* ============================================
   FORMULARIO EN MODAL
   ============================================ */
.prov-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.prov-form .prov-field-full {
    grid-column: 1 / -1;
}

.prov-form .prov-field-dos {
    grid-column: span 2;
}

.prov-field,
.prov-field-full,
.prov-field-dos {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prov-field label,
.prov-field-full label,
.prov-field-dos label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gris-600);
    letter-spacing: 0.2px;
}

.prov-field label .requerido,
.prov-field-full label .requerido,
.prov-field-dos label .requerido {
    color: var(--danger);
    margin-left: 1px;
}

.prov-field input,
.prov-field select,
.prov-field-full input,
.prov-field-full select,
.prov-field-dos input,
.prov-field-dos select {
    padding: 11px 14px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--gris-800);
    outline: none;
    transition: all 0.2s ease;
    background: var(--blanco);
    width: 100%;
    text-transform: uppercase;
}

.prov-field select,
.prov-field-full select,
.prov-field-dos select {
    text-transform: none;
}

.prov-field input::placeholder,
.prov-field-full input::placeholder,
.prov-field-dos input::placeholder {
    text-transform: none;
}

.prov-field select,
.prov-field-full select,
.prov-field-dos select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.prov-field select option,
.prov-field-full select option,
.prov-field-dos select option {
    padding: 8px;
}

.prov-field input:focus,
.prov-field select:focus,
.prov-field-full input:focus,
.prov-field-full select:focus,
.prov-field-dos input:focus,
.prov-field-dos select:focus {
    border-color: var(--azul-400);
    box-shadow: 0 0 0 3px rgba(37,99,160,0.12);
}

.prov-field input.error,
.prov-field select.error,
.prov-field-full input.error,
.prov-field-full select.error,
.prov-field-dos input.error,
.prov-field-dos select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}

.prov-error-text {
    font-size: 0.65rem;
    color: var(--danger);
    display: none;
    margin-top: 2px;
    font-weight: 500;
}

.prov-error-text.visible {
    display: block;
}

/* Inputs y selects del formulario */
.prov-input {
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    color: #334155;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}
.prov-input:focus {
    border-color: var(--azul-400);
}

/* Grupo input + botón SUNAT */
.prov-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-prov-sunat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    min-width: 34px;
    border: 1.5px solid var(--azul-400);
    border-radius: 8px;
    background: var(--azul-400);
    color: var(--blanco);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-prov-sunat:hover {
    background: var(--azul-500);
    border-color: var(--azul-500);
}

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

.btn-prov-sunat.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Botones del formulario */
.prov-form-botones {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--gris-200);
}

.btn-prov-cancelar {
    padding: 10px 24px;
    background: var(--blanco);
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    color: var(--gris-600);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-prov-cancelar:hover {
    background: var(--gris-50);
    border-color: var(--gris-300);
    color: var(--gris-800);
}

.btn-prov-guardar {
    padding: 10px 28px;
    background: var(--azul-400);
    border: none;
    border-radius: 8px;
    color: var(--blanco);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(37,99,160,0.25);
}

.btn-prov-guardar:hover {
    background: var(--azul-500);
    box-shadow: 0 4px 16px rgba(37,99,160,0.35);
    transform: translateY(-1px);
}

.btn-prov-guardar:active {
    transform: translateY(0);
}

.btn-prov-guardar.loading {
    pointer-events: none;
    opacity: 0.65;
}

/* Ubigeo typeahead search */
.prov-ubigeo-search {
    position: relative;
}

.prov-ubigeo-search input {
    padding: 10px 12px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--gris-800);
    outline: none;
    transition: all 0.2s ease;
    background: var(--blanco);
    width: 100%;
    text-transform: uppercase;
}

.prov-ubigeo-search input:focus {
    border-color: var(--azul-400);
    box-shadow: 0 0 0 3px rgba(37,99,160,0.12);
}

.prov-ubigeo-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--blanco);
    border: 1.5px solid var(--gris-200);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.prov-ubigeo-dropdown.visible {
    display: block;
}

.prov-ubigeo-dd-item {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    transition: background 0.1s ease;
    border-bottom: 1px solid var(--gris-100);
}

.prov-ubigeo-dd-item:last-child {
    border-bottom: none;
}

.prov-autocomplete-item {
    font-size: 0.7rem;
}

.prov-ubigeo-dd-item:hover,
.prov-ubigeo-dd-item.hover {
    background: var(--gris-50);
}

.prov-ubigeo-dd-cod {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--azul-500);
    font-weight: 700;
    flex-shrink: 0;
}

.prov-ubigeo-dd-nombre {
    font-size: 0.82rem;
    color: var(--gris-700);
}

.prov-ubigeo-dd-empty {
    padding: 14px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--gris-400);
}

/* Ubigeo en fila — los 3 en línea (legacy) */
.prov-ubigeo-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Toggle switch para campos tributarios */
.prov-toggle-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.prov-toggle-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    background: var(--blanco);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.prov-toggle-item:hover {
    border-color: var(--azul-300);
    background: var(--azul-50);
}

.prov-toggle-item.activo {
    border-color: var(--azul-400);
    background: rgba(37,99,160,0.06);
}

.prov-toggle-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gris-700);
    cursor: pointer;
    white-space: nowrap;
}

/* Switch personalizado */
.prov-switch {
    position: relative;
    width: 30px;
    height: 17px;
    flex-shrink: 0;
}

.prov-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.prov-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gris-300);
    border-radius: 17px;
    transition: all 0.25s ease;
}

.prov-switch .slider::before {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    left: 2px;
    bottom: 2px;
    background: var(--blanco);
    border-radius: 50%;
    transition: all 0.25s ease;
}

.prov-switch input:checked + .slider {
    background: var(--azul-400);
}

.prov-switch input:checked + .slider::before {
    transform: translateX(13px);
}

/* Textarea */
.prov-field textarea,
.prov-field-full textarea,
.prov-field-dos textarea {
    padding: 11px 14px;
    border: 1.5px solid var(--gris-200);
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    color: var(--gris-800);
    outline: none;
    transition: all 0.2s ease;
    background: var(--blanco);
    width: 100%;
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

.prov-field textarea:focus,
.prov-field-full textarea:focus,
.prov-field-dos textarea:focus {
    border-color: var(--azul-400);
    box-shadow: 0 0 0 3px rgba(37,99,160,0.12);
}

/* Separador visual en formulario */
.prov-separador {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 2px 0;
}

.prov-separador::before,
.prov-separador::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gris-200);
}

.prov-separador span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gris-400);
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .prov-tabla .col-contacto {
        display: none;
    }
}

@media (max-width: 768px) {
    .prov-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .prov-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .prov-toolbar-left {
        flex-direction: column;
    }

    .prov-buscador {
        max-width: 100%;
    }

    .prov-toolbar-right {
        justify-content: space-between;
    }

    .prov-form {
        grid-template-columns: 1fr;
    }

    .prov-ubigeo-row {
        grid-template-columns: 1fr;
    }

    .prov-tabla-wrap {
        overflow-x: auto;
    }

    .prov-paginacion {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

/* ============================================
   FILTRO TIPO EXCEL (DROPDOWN)
   ============================================ */
.prov-filter-dd {
    position: absolute;
    z-index: 500;
    background: var(--blanco);
    border: 1px solid var(--gris-300);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    min-width: 260px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    animation: provFadeIn 0.12s ease;
    overflow: hidden;
}

.prov-filter-dd-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gris-200);
    background: var(--gris-50);
}

.prov-filter-dd-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--gris-200);
    border-radius: 6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.prov-filter-dd-search:focus {
    border-color: var(--azul-400);
}

.prov-filter-dd-selectall {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gris-100);
    background: var(--gris-50);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--azul-400);
}

.prov-filter-dd-body {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
}

.prov-filter-dd-body::-webkit-scrollbar {
    width: 5px;
}

.prov-filter-dd-body::-webkit-scrollbar-thumb {
    background: var(--gris-300);
    border-radius: 5px;
}

.prov-filter-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 0.78rem;
    color: var(--gris-700);
}

.prov-filter-dd-item:hover {
    background: var(--azul-50);
}

.prov-filter-dd-item input[type="checkbox"] {
    accent-color: var(--azul-400);
    flex-shrink: 0;
}

.prov-filter-dd-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prov-filter-dd-empty,
.prov-filter-dd-loading {
    padding: 20px 16px;
    text-align: center;
    color: var(--gris-400);
    font-size: 0.75rem;
}

.prov-filter-dd-footer {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--gris-200);
    background: var(--gris-50);
}

.prov-filter-dd-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--gris-200);
    border-radius: 6px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.prov-filter-dd-ok {
    background: var(--azul-400);
    color: var(--blanco);
    border-color: var(--azul-400);
}

.prov-filter-dd-ok:hover {
    background: var(--azul-500);
}

.prov-filter-dd-clear {
    background: var(--blanco);
    color: var(--gris-600);
}

.prov-filter-dd-clear:hover {
    background: var(--gris-100);
    border-color: var(--gris-300);
}

/* Filtro de rango numérico */
.prov-filter-range {
    padding: 12px;
}
.prov-filter-range-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gris-600);
    margin-bottom: 4px;
}
.prov-filter-range .prov-input {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.8rem;
}

/* Badge de filtros activos en toolbar */
.prov-badge-filtros {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--azul-400);
    color: var(--blanco);
    border: none;
    border-radius: 20px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-prov-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--gris-200);
    border-radius: 8px;
    background: var(--blanco);
    color: var(--gris-500);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-prov-icono:hover {
    border-color: var(--azul-300);
    color: var(--azul-500);
    background: rgba(37,99,160,0.04);
}

/* Export dropdown */
.prov-export-wrap {
    position: relative;
}

.prov-export-dd {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--blanco);
    border: 1px solid var(--gris-200);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
    min-width: 150px;
    z-index: 300;
    display: none;
    overflow: hidden;
}

.prov-export-dd.visible {
    display: block;
}

.prov-export-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: var(--blanco);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    color: var(--gris-700);
    cursor: pointer;
    transition: background 0.1s ease;
    text-align: left;
}

.prov-export-dd-item:hover {
    background: var(--azul-50);
}

.prov-export-dd-item .fa-file-excel { color: #1D6F42; }
.prov-export-dd-item .fa-file-csv { color: #217346; }
.prov-export-dd-item .fa-file-pdf { color: #D32F2F; }
.prov-export-dd-item .fa-file-lines { color: #475569; }

.prov-badge-filtros:hover {
    background: var(--azul-500);
    box-shadow: 0 2px 8px rgba(37,99,160,0.3);
}

.prov-badge-filtros .fa-times {
    font-size: 0.65rem;
    opacity: 0.7;
}

.prov-badge-filtros:hover .fa-times {
    opacity: 1;
}

/* Botón limpiar en vista vacía */
.btn-prov-limpiar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid var(--azul-400);
    border-radius: 8px;
    background: var(--blanco);
    color: var(--azul-400);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 12px;
}

.btn-prov-limpiar:hover {
    background: var(--azul-50);
    border-color: var(--azul-500);
    color: var(--azul-500);
}

.prov-vacio .fa-filter-circle-xmark {
    font-size: 3rem;
    color: var(--warning);
    display: block;
    margin-bottom: 16px;
}

/* ============================================
   VISTA DETALLE (doble clic)
   ============================================ */
.prov-detalle {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prov-detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
}

.prov-detalle-campo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prov-detalle-campo-full {
    grid-column: 1 / -1;
}

.prov-detalle-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--gris-100);
}

.prov-detalle-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gris-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 160px;
    flex-shrink: 0;
    padding-top: 2px;
}

.prov-detalle-valor {
    font-size: 0.85rem;
    color: var(--gris-800);
    font-weight: 500;
}

.prov-detalle-separador {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 0;
}

.prov-detalle-separador span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--azul-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.prov-detalle-separador::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gris-200);
}

/* ---- Formulario Artículos: Secciones ---- */
@media (prefers-reduced-motion: reduce) {
    #pageProveedores,
    #pageBancos,
    #pageCategorias,
    #pageCondicionesPago {
        animation: none;
    }
}

#pageProveedores .prov-tabla thead tr th:first-child { border-radius: 6px 0 0 0; }
#pageProveedores .prov-tabla thead tr th:last-child { border-radius: 0 6px 0 0; }

