﻿/* ==========================================================================
   PowerERP Design System â€” EstÃ¡ndar visual oficial (UI_DESIGN_STANDARD.md)
   ==========================================================================
   Base: Bootstrap 5.3 + Font Awesome 6 local.
   Principios: blanco predominante, verde institucional PowerSoft sobrio,
   grises suaves, mucho espacio en blanco, sin degradados, sin sombras
   exageradas, sin animaciones innecesarias.
   ========================================================================== */

:root {
/* --- Paleta institucional PowerSoft --- */
    --pe-primary: #1a6b47;          /* verde institucional sobrio */
    --pe-primary-600: #175f40;
    --pe-primary-700: #115233;
    --pe-primary-tint: #eaf3ee;     /* fondo suave del color institucional */
    --pe-primary-tint-2: #f3f8f5;
    /* THEAD de tablas: fondo verde pastel + texto verde oscuro (legible) */
    --pe-table-head-bg: #e8f4ea;
    --pe-table-head-text: var(--pe-primary-700);

    /* Neutrales */
    --pe-bg: #f4f6f5;
    --pe-surface: #ffffff;
    --pe-surface-soft: #fafbfa;
    --pe-border: #e3e8e5;
    --pe-border-strong: #d3dad6;
    --pe-text: #20242b;
    --pe-text-muted: #6b7280;
    --pe-text-softer: #9aa3ac;

    /* SemÃ¡nticos (estados/mensajes) */
    --pe-success: #17854e;
    --pe-success-bg: #e6f5ed;
    --pe-warning: #b2791b;
    --pe-warning-bg: #fbf3e3;
    --pe-danger: #c94a3e;
    --pe-danger-bg: #fbecea;
    --pe-info: #2060a6;
    --pe-info-bg: #e8f1fb;

    /* TipografÃ­a */
    --pe-font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Forma y elevaciÃ³n (sobrias) */
    --pe-radius: 10px;
    --pe-radius-sm: 7px;
    --pe-shadow-sm: 0 1px 2px rgba(18, 40, 28, .05);
    --pe-shadow: 0 1px 3px rgba(18, 40, 28, .06), 0 10px 28px -18px rgba(18, 40, 28, .16);

--bs-primary: var(--pe-primary);
    --bs-body-bg: var(--pe-bg);

    /* Sidebar de navegaciÃ³n (secciÃ³n 18)
       PRUEBA VISUAL 2026-08 (2): fondo verde-negro, texto gris muy claro,
       activo en verde PowerERP y hover = verde oscuro aclarado. Paleta
       pendiente de revisiÃ³n; se fija tras validaciÃ³n. */
    --pe-sidebar-bg: #17221E;
    --pe-sidebar-text: rgba(255, 255, 255, .85);
    --pe-sidebar-text-soft: rgba(255, 255, 255, .6);
    --pe-sidebar-border: rgba(255, 255, 255, .08);
    --pe-sidebar-hover-bg: #2D7A55;
    --pe-sidebar-active-bg: var(--pe-primary);
    --pe-sidebar-w: 250px;           /* expandido (escritorio) y off-canvas (mÃ³vil) */
    --pe-sidebar-w-collapsed: 64px;  /* contraÃ­do (solo iconos, escritorio) */
}

/* ==========================================================================
   1. TipografÃ­a
   ========================================================================== */
body {
    font-family: var(--pe-font);
    background-color: var(--pe-bg);
    color: var(--pe-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.01em; color: var(--pe-text); }

.text-soft { color: var(--pe-text-softer); }
.text-strong { color: var(--pe-text); }

/* ==========================================================================
   2. Topbar y navegaciÃ³n superior
   ========================================================================== */
.pe-topbar {
    background: var(--pe-surface);
    border-bottom: 1px solid var(--pe-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.pe-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 62px;
}

.pe-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    color: var(--pe-text);
}
.pe-brand:hover { color: var(--pe-text); }

.pe-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--pe-radius-sm);
    background: var(--pe-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8rem;
}
.pe-brand-name { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; line-height: 1; }
.pe-brand-sub { color: var(--pe-text-softer); font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; }

.pe-nav { display: flex; align-items: center; gap: .25rem; }
.pe-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    border-radius: var(--pe-radius-sm);
    color: var(--pe-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    border: 1px solid transparent;
}
.pe-nav-link i { font-size: .85em; opacity: .85; }
.pe-nav-link:hover { color: var(--pe-primary); background: var(--pe-primary-tint); }
.pe-nav-link.active { color: var(--pe-primary); background: var(--pe-primary-tint); font-weight: 600; }

.pe-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--pe-text);
}
.pe-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
    display: grid; place-items: center;
    font-weight: 600; font-size: .8rem;
    border: 1px solid var(--pe-border);
}
.pe-user-name { font-size: .85rem; font-weight: 600; line-height: 1.1; }
.pe-user-meta { font-size: .7rem; color: var(--pe-text-softer); }

/* Dropdown de usuario */
.pe-dropdown .dropdown-toggle { color: var(--pe-text-muted); padding: .35rem .5rem; border-radius: var(--pe-radius-sm); }
.pe-dropdown .dropdown-toggle:hover { background: var(--pe-primary-tint); color: var(--pe-primary); }
.pe-dropdown .dropdown-menu, .pe-dropdown-menu {
    border: 1px solid var(--pe-border);
    box-shadow: var(--pe-shadow);
    border-radius: var(--pe-radius-sm);
    min-width: 215px;
    padding: .35rem .4rem;
}
/* Menú de acciones de fila [⋮] (patrón compartido de Cotizaciones, Guías y
   Ventas): fondo BLANCO explícito y borde ligeramente más grueso, con la
   sombra discreta existente. Solo los menús de acciones de fila (no afecta
   otros dropdowns del ERP). */
.pe-draft-menu .dropdown-menu {
    background: #ffffff;
    border: 1.5px solid var(--pe-border);
    box-shadow: var(--pe-shadow);
}
.pe-dropdown-menu .dropdown-item {
    border-radius: var(--pe-radius-sm);
    font-size: .87rem;
    padding: .45rem .7rem;
}
.pe-dropdown-menu .dropdown-item:hover { background: var(--pe-primary-tint); color: var(--pe-primary); }
.pe-dropdown-menu .dropdown-item-text { padding: .35rem .7rem; line-height: 1.45; font-size: .8rem; }
.pe-dropdown-menu .dropdown-divider { margin: .35rem 0; opacity: 1; border-color: var(--pe-border); }

.pe-user-menu-btn {
    background: none;
    border: 1px solid var(--pe-border);
    border-radius: 50%;
    padding: 2px;
    line-height: 0;
    cursor: pointer;
}
.pe-user-menu-btn:focus-visible {
    outline: 2px solid var(--pe-primary);
    outline-offset: 2px;
}
.pe-user-menu-btn:focus, .pe-user-menu-btn:hover { border-color: var(--pe-primary); }

/* ==========================================================================
   3. Layout de contenido
   ========================================================================== */
.pe-main { flex: 1; padding: 1.5rem 0 3rem; }
.pe-content { max-width: 1320px; }
.pe-narrow-col { max-width: 760px; }

/* ==========================================================================
   3b. Footer
   ========================================================================== */
.pe-footer {
    border-top: 1px solid var(--pe-border);
    background: var(--pe-surface);
    color: var(--pe-text-softer);
    font-size: .78rem;
    padding: .9rem 0;
}
.pe-version { font-size: .72rem; letter-spacing: .03em; }

/* ==========================================================================
   3c. Pantallas de autenticaciÃ³n (login)
   ========================================================================== */
.pe-auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(1000px 500px at 85% -10%, var(--pe-primary-tint) 0%, transparent 60%),
        var(--pe-bg);
}
.pe-auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.2rem 2.2rem 2rem;
}
.pe-auth-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    justify-content: center;
    margin-bottom: 1.75rem;
}
.pe-auth-title { font-size: 1.2rem; text-align: center; }
.pe-auth-sub { text-align: center; margin-bottom: 1.5rem; }

/* ==========================================================================
   3c-bis. Login rediseñado (pe-login) — dos paneles: imagen + formulario.
   Pantalla completa; se elimina el padding de .pe-main SOLO en esta página
   (sin tocar el layout ni otras pantallas). Estética alineada con la pantalla
   Welcome (misma familia verde corporativa).
   ========================================================================== */
main.pe-main:has(.pe-login) { padding: 0; }
.pe-login {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
/* Panel izquierdo: imagen corporativa (object-fit cover, sin bordes). */
.pe-login-visual {
    flex: 1 1 56%;
    max-width: 56%;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: var(--pe-primary-700);
}
.pe-login-visual-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Por defecto (escritorio) se usa la imagen login-panel.png; la de tablet
   queda oculta. */
.pe-login-visual-img-tablet { display: none; }
/* Tablet horizontal / tamaños intermedios (992-1365px): se usa la pieza
   específica login-panel-tablet.png (diseñada para esa proporción), con
   object-fit: cover para llenar el panel sin franjas ni espacios vacíos.
   La imagen no se deforma. En escritorio ≥1366px se conserva login-panel.png
   y en <992px el panel se oculta. */
@media (min-width: 992px) and (max-width: 1365.98px) {
    .pe-login-visual-img-desktop { display: none; }
    .pe-login-visual-img-tablet { display: block; }
}
/* Panel derecho: degradado verde/mint suave (familia Welcome), visible pero
   discreto, con buena legibilidad para el formulario. */
.pe-login-form-side {
    flex: 1 1 44%;
    max-width: 44%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background:
        radial-gradient(1100px 520px at 115% -5%, var(--pe-primary-tint) 0%, transparent 55%),
        linear-gradient(160deg, #e4f2e9 0%, #ffffff 50%, #d6eadf 100%);
}
.pe-login-form-wrap { width: 100%; max-width: 400px; }
.pe-login-head { text-align: center; margin-bottom: 1.5rem; }
.pe-login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    margin-bottom: 1.1rem;
}
.pe-login-title { font-size: 1.3rem; margin-bottom: .25rem; }
.pe-login-sub {
    color: var(--pe-text-muted);
    font-size: .85rem;
    margin: 0 0 1.25rem;
}
/* Tarjeta limpia del formulario. */
.pe-login-card {
    background: #ffffff;
    border: 1px solid var(--pe-border);
    border-radius: 1rem;
    box-shadow: var(--pe-shadow);
    padding: 1.75rem 1.5rem;
}
.pe-login-card .form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--pe-text);
    margin-bottom: .3rem;
}
.pe-login-card .form-control,
.pe-login-card .form-select {
    border-radius: .55rem;
    padding-top: .55rem;
    padding-bottom: .55rem;
    font-size: .9rem;
}
.pe-login-card .form-control:focus,
.pe-login-card .form-select:focus {
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 .2rem rgba(26, 107, 71, .14);
}
.pe-login-submit {
    width: 100%;
    border-radius: .55rem;
    padding: .62rem 1rem;
    font-weight: 600;
    background: var(--pe-primary);
    border-color: var(--pe-primary);
}
.pe-login-submit:hover {
    background: var(--pe-primary-600);
    border-color: var(--pe-primary-600);
}
.pe-login-meta {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .74rem;
    color: var(--pe-text-softer);
    line-height: 1.5;
}

/* < 992px: se oculta el panel de imagen y el formulario ocupa el 100%. */
@media (max-width: 991.98px) {
    .pe-login-visual { display: none; }
    .pe-login-form-side { flex-basis: 100%; max-width: 100%; }
}
@media (max-width: 575.98px) {
    .pe-login-form-side { padding: 1.25rem 1rem; }
    .pe-login-form-wrap { max-width: 100%; }
    .pe-login-card { padding: 1.5rem 1.1rem; }
}

/* ==========================================================================
   3d. PÃ¡ginas de error (403/404/500)
   ========================================================================== */
.pe-error-wrap {
    min-height: calc(100vh - 80px);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}
.pe-error-card {
    max-width: 520px;
    width: 100%;
    text-align: center;
    padding: 3rem 2.5rem;
}
.pe-error-icon {
    width: 68px; height: 68px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
    display: grid; place-items: center;
    font-size: 1.7rem;
}
.pe-error-icon-danger { background: var(--pe-danger-bg); color: var(--pe-danger); }
/* Estilo de advertencia para la página de acceso denegado (sin mostrar el
   código 403 ni identificadores internos). */
.pe-error-icon-warning { background: var(--pe-warning-bg); color: var(--pe-warning); }
.pe-error-warning-title { color: var(--pe-warning); }
.pe-error-code {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--pe-text);
    font-family: var(--pe-font);
    line-height: 1;
    margin-bottom: .35rem;
}
.pe-error-title { font-size: 1.15rem; text-align: center; }
.pe-error-text { text-align: center; max-width: 400px; margin: .35rem auto 0; }

/* ==========================================================================
   4. Encabezados de pÃ¡gina, breadcrumbs y acciones
   ========================================================================== */
.pe-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.pe-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.pe-subtitle { color: var(--pe-text-muted); font-size: .85rem; margin: .15rem 0 0; }

.pe-breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--pe-text-softer);
    margin: 0 0 .5rem;
    list-style: none; padding: 0;
}
.pe-breadcrumb a { color: var(--pe-text-muted); text-decoration: none; }
.pe-breadcrumb a:hover { color: var(--pe-primary); }
.pe-breadcrumb .sep { color: var(--pe-text-softer); opacity: .6; }
.pe-breadcrumb .current { color: var(--pe-text); font-weight: 600; }

/* ==========================================================================
   5. Tarjetas (cards)
   ========================================================================== */
.pe-card {
    background: var(--pe-surface);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius);
    box-shadow: var(--pe-shadow-sm);
}
.pe-card-header {
    border-bottom: 1px solid var(--pe-border);
    padding: .9rem 1.25rem;
    background: var(--pe-surface-soft);
    border-radius: var(--pe-radius) var(--pe-radius) 0 0;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.pe-card-title { font-size: .95rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .5rem; }
.pe-card-title i { color: var(--pe-primary); }
.pe-card-body { padding: 1.25rem; }
.pe-card-footer {
    border-top: 1px solid var(--pe-border);
    padding: .85rem 1.25rem;
    background: var(--pe-surface-soft);
    border-radius: 0 0 var(--pe-radius) var(--pe-radius);
}

/* Tarjeta de secciÃ³n con divisiÃ³n interna (formularios) */
.pe-form-section + .pe-form-section { border-top: 1px solid var(--pe-border); margin-top: 1.5rem; padding-top: 1.5rem; }
.pe-form-section-title {
    display: flex; align-items: center; gap: .55rem;
    font-size: .8rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--pe-primary);
    margin: 0 0 1rem;
}
.pe-form-section-title i { opacity: .85; }
.pe-form-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--pe-border);
}

/* ==========================================================================
   LAYOUT DE FRAMES — PRUEBA VISUAL TEMPORAL (solo /sales/new-preview)
   Rediseño aislado: la pantalla de producción /sales/new NO usa estas reglas.
   Fondo de página gris muy claro; cada grupo (DOCUMENTO, CLIENTE+FORMA DE
   PAGO, PRODUCTOS) es un frame blanco independiente. NO existe un frame
   general que englobe las secciones.
   ========================================================================== */
.pe-frames-layout {
    --pe-frame-bg: #ffffff;
    --pe-frame-border: #e4e8ec;
    --pe-frame-radius: .5rem;
    /* Separación vertical uniforme entre TODOS los frames: 0.25rem exactos en
       ambos espacios (DOCUMENTO→CLIENTE/FORMA DE PAGO y CLIENTE/FORMA DE
       PAGO→PRODUCTOS). */
    --pe-frame-gap: .25rem;
}
/* El contenedor de tarjeta NO es un frame: se anula fondo/borde/sombra para
   que la página muestre solo el fondo gris general. El padding lateral se
   elimina para que los frames ocupen TODO el ancho del .pe-content (1320px),
   igual que el frame principal de /sales/new. */
.pe-frames-layout .pe-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.pe-frames-layout .pe-card-body {
    background: transparent;
    /* Sin padding superior: recupera la densidad vertical original
       (breadcrumb → frame DOCUMENTO igual que en /sales/new). */
    padding: 0 0 .75rem;
}
/* Cada grupo (DOCUMENTO, CLIENTE+FORMA DE PAGO, PRODUCTOS) = frame blanco.
   margin-bottom uniforme = --pe-frame-gap (0.25rem) para todos. */
.pe-frames-layout .pe-form-section {
    background: var(--pe-frame-bg);
    border: 1px solid var(--pe-frame-border);
    border-radius: var(--pe-frame-radius);
    padding: .9rem 1rem;
    margin-bottom: var(--pe-frame-gap);
}
/* DOCUMENTO (primer frame): sin margin-bottom. El espacio visual hacia el frame
   CLIENTE/FORMA DE PAGO lo aporta el gutter interno del .row (0.25rem), por lo
   que el gap total queda idéntico al de CLIENTE/FORMA DE PAGO → PRODUCTOS. */
.pe-frames-layout .pe-form-section.pe-section-slim:first-of-type {
    margin-bottom: 0;
}
.pe-frames-layout .pe-form-section.pe-section-slim + .pe-form-section.pe-section-slim {
    border-top: 1px solid var(--pe-frame-border);
    margin-top: 0;
    padding-top: .9rem;
}
/* GRE (Nueva Guía de Remisión): el primer frame "Datos del documento" es un
   frame independiente (no va en fila con otro), por lo que conserva el mismo
   gap vertical que el resto de frames (la regla :first-of-type de Ventas,
   pensada para DOCUMENTO+CLIENTE en fila, no aplica aquí). */
.pe-dispatch-form.pe-frames-layout .pe-form-section.pe-section-slim:first-of-type {
    margin-bottom: var(--pe-frame-gap);
}
/* GRE: asegura el borde de todas las celdas de la tabla de productos (incluye
   Código y Marca aunque su contenido esté vacío). */
.pe-dispatch-form .pe-table tbody td {
    border: 1px solid var(--pe-border);
}
/* GRE: separación vertical sutil entre el bloque CLIENTE y el bloque DOCUMENTO
   ORIGINAL dentro de "Datos del documento". Línea discreta, sin nueva tarjeta. */
.pe-dispatch-form .pe-dispatch-origin-sep {
    border-left: 1px solid var(--pe-border);
    padding-left: 1rem;
}
/* GRE: botones Nuevo/Editar con clase is-disabled (sin documento original o sin
   cliente seleccionado): apariencia de botón deshabilitado, sin efectos hover/
   focus/active y cursor not-allowed. No afecta a otros botones del sistema. */
.pe-dispatch-form .btn.is-disabled,
.pe-dispatch-form .btn.is-disabled:hover,
.pe-dispatch-form .btn.is-disabled:focus,
.pe-dispatch-form .btn.is-disabled:active {
    opacity: .65;
    cursor: not-allowed;
}
.pe-dispatch-form .btn.is-disabled:hover,
.pe-dispatch-form .btn.is-disabled:focus,
.pe-dispatch-form .btn.is-disabled:active {
    color: var(--bs-secondary-color);
    background-color: transparent;
    border-color: #6c757d;
}
/* Ventas: botones Nuevo/Editar con clase is-disabled (sin cliente seleccionado):
   apariencia de botón deshabilitado, sin efectos hover/focus/active y cursor
   not-allowed. Mismo estándar que GRE; no afecta a otros botones del sistema. */
.pe-sales-form .btn.is-disabled,
.pe-sales-form .btn.is-disabled:hover,
.pe-sales-form .btn.is-disabled:focus,
.pe-sales-form .btn.is-disabled:active {
    opacity: .65;
    cursor: not-allowed;
}
.pe-sales-form .btn.is-disabled:hover,
.pe-sales-form .btn.is-disabled:focus,
.pe-sales-form .btn.is-disabled:active {
    color: var(--bs-secondary-color);
    background-color: transparent;
    border-color: #6c757d;
}
/* Importación: botones Nuevo/Editar con clase is-disabled (sin proveedor
   seleccionado): apariencia de botón deshabilitado, sin efectos hover/focus/
   active y cursor not-allowed. Mismo estándar que Ventas/GRE. */
.pe-imports-form .btn.is-disabled,
.pe-imports-form .btn.is-disabled:hover,
.pe-imports-form .btn.is-disabled:focus,
.pe-imports-form .btn.is-disabled:active {
    opacity: .65;
    cursor: not-allowed;
}
.pe-imports-form .btn.is-disabled:hover,
.pe-imports-form .btn.is-disabled:focus,
.pe-imports-form .btn.is-disabled:active {
    color: var(--bs-secondary-color);
    background-color: transparent;
    border-color: #6c757d;
}
.pe-frames-layout .pe-form-section-title {
    margin-bottom: .7rem;
}
/* Separador vertical CLIENTE / FORMA DE PAGO (patrón transferencias) */
        .pe-sales-form .pe-sales-sep {
            border-left: 1px solid var(--pe-frame-border);
            padding-left: 1rem;
        }
        /* Espacio a la izquierda del separador (columna CLIENTE) */
        .pe-sales-form .pe-sales-sep-start {
            padding-right: 1rem;
        }
/* Labels de datos del cliente (Documento, Razón Social, Dirección, Teléfono):
   capitalización normal (primera letra en mayúscula), sin text-transform.
   Los valores usan el estándar de controles del formulario (12.8px/.8rem). */
.pe-frames-layout .pe-frames-cliente .pe-detail-label {
    text-transform: none;
    letter-spacing: .02em;
}
/* Primera fila de CLIENTE (frames): RUC/DNI ancho fijo a la izquierda,
   "Buscar cliente" absorbe el espacio disponible y los botones se desplazan
   al extremo derecho manteniendo su tamaño. */
.pe-frames-layout .pe-frames-cliente-fila1 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem .5rem;
}
.pe-frames-layout .pe-frames-cliente-ruc {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 9rem;
}
.pe-frames-layout .pe-frames-cliente-search {
    flex: 1 1 0;
    min-width: 0;
}
.pe-frames-layout .pe-frames-cliente-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    margin-left: auto;
}
/* Datos del cliente (frames): contenedor general y segunda fila alineada con
   la primera (Documento = mismo ancho que RUC/DNI; Razón Social = comienza
   donde comienza Buscar cliente y crece hasta el extremo derecho del frame). */
.pe-frames-layout .pe-frames-cliente-datos {
    margin-top: .5rem;
}
.pe-frames-layout .pe-frames-cliente-fila2 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem .5rem;
}
.pe-frames-layout .pe-frames-cliente-doc {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 9rem;
}
.pe-frames-layout .pe-frames-cliente-name {
    flex: 1 1 0;
    min-width: 0;
}

/* TOTALES: viven DENTRO del mismo frame de PRODUCTOS (parte inferior). No es
   un frame ni una sección independiente: solo una línea separadora discreta
   los distingue de la tabla. Sin tarjetas ni cajas individuales. */
.pe-frames-layout .pe-frames-totals {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--pe-frame-border);
}
.pe-frames-layout .pe-frames-totals .pe-totals-title {
    display: none;
}
.pe-frames-layout .pe-frames-totals .pe-totals-box {
    background: transparent;
    border: none;
    padding: 0;
}
/* Fila de conceptos tributarios: los 5 conceptos forman un BLOQUE compacto
   agrupado hacia la DERECHA (no distribuido por todo el ancho). Cada concepto
   ocupa su espacio natural, con separación uniforme y sin cajas ni fondos. */
.pe-frames-layout .pe-totals-row.pe-totals-tributarios {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
}
.pe-frames-layout .pe-totals-tributarios .pe-total-box {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
    padding: 0;
    gap: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* TOTAL: debajo de los conceptos, alineado a la derecha, con una línea
   horizontal sutil encima. Mayor jerarquía visual (verde PowerERP). */
.pe-frames-layout .pe-totals-grand-total {
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--pe-frame-border);
    display: flex;
    justify-content: flex-end;
}
.pe-frames-layout .pe-totals-grand-total .pe-total-box-main {
    border: none;
    background: transparent;
    padding: 0;
}
.pe-frames-layout .pe-total-box-main .pe-total-label {
    font-size: 12.5px;
    font-weight: 700;
    text-align: right;
}
.pe-frames-layout .pe-total-label {
    font-size: .7rem;
    text-align: right;
    color: var(--pe-text-muted);
}
.pe-frames-layout .pe-total-value {
    font-size: 1.05rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.pe-frames-layout .pe-total-value-main {
    /* Importes subtotales: 1.05rem (16.8px). TOTAL: 1.30rem (aprox. 20.8px),
       con jerarquía clara sobre los subtotales. */
    font-size: 1.30rem;
    font-weight: 700;
    color: var(--pe-success, #198754);
}
/* ==========================================================================
   NOTA DE CRÉDITO — Pantalla específica (views/sales/credit_note.php).
   Reutiliza el estándar de frames de Ventas; estructura propia y compacta.
   ========================================================================== */
.pe-credit-note .pe-detail-static {
    min-height: calc(1.5em + .5rem + 2px); /* misma altura que form-control-sm */
}
/* Información del cliente en modo menú (buscador): se muestra bajo el campo de
   búsqueda una vez seleccionado el cliente (documento RUC/DNI y teléfono). */
.pe-credit-note .pe-cn-customer-info {
    font-size: .72rem;
    margin-top: .2rem;
    min-height: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Alineación del frame CLIENTE en modo menú (sin documento aún): el info del
   cliente (RUC/teléfono) se posiciona de forma ABSOLUTA bajo el buscador para
   NO sumar altura a la fila; así Cliente, Documento original y el botón
   "Seleccionar factura" quedan alineados por la base (igual que tras
   seleccionar un documento). */
.pe-credit-note .pe-cn-cliente-col {
    position: relative;
}
.pe-credit-note .pe-cn-cliente-col .pe-cn-customer-info {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    min-height: 0;
    margin-top: .1rem;
}
.pe-credit-note .pe-cn-doc-col,
.pe-credit-note .pe-cn-btn-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
/* Nota: la separación vertical del primer frame (DOCUMENTO) se iguala a la de
   los demás frames mediante un margin-bottom inline en la vista (credit_note.php),
   que vence a la regla general `:first-of-type { margin-bottom: 0 }` sin
   depender de especificidad ni cache. */
.pe-credit-note #cnItemsTable th,
.pe-credit-note #cnItemsTable td {
    padding-left: .3rem;
    padding-right: .3rem;
}
/* La tabla "Líneas a acreditar" termina sin borde inferior: el separador que
   ya existe antes de la sección de totales cumple esa función, por lo que el
   borde inferior de la última fila (regla global .pe-table tbody tr:last-child)
   resultaría redundante. Se elimina solo aquí, sin agregar ningún separador. */
.pe-credit-note #cnItemsTable tbody tr:last-child td {
    border-bottom: none;
}
.pe-credit-note .cn-code,
.pe-credit-note .cn-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.pe-credit-note .cn-empty {
    padding: 1.5rem 1rem;
    color: var(--pe-text-softer, #98a2b3);
    font-size: .85rem;
}
/* Bloque de totales de la NC: VALOR DE VENTA / IGV / TOTAL alineados a la
   derecha, dentro del mismo frame de líneas, con separador sutil. */
.pe-credit-note .pe-cn-totals {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--pe-frame-border);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .2rem;
}
.pe-credit-note .pe-cn-total-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.pe-credit-note .pe-cn-total-row .pe-total-label {
    font-size: .7rem;
    color: var(--pe-text-muted);
}
.pe-credit-note .pe-cn-total-row .pe-total-value {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    min-width: 6rem;
    text-align: right;
}
.pe-credit-note .pe-cn-grand {
    margin-top: .35rem;
    padding-top: .35rem;
    border-top: 1px solid var(--pe-frame-border);
}
.pe-credit-note .pe-cn-grand .pe-total-label-main {
    font-size: 12.5px;
    font-weight: 700;
}
.pe-credit-note .pe-cn-grand .pe-total-value-main {
    font-size: 1.30rem;
    font-weight: 700;
    color: var(--pe-success, #198754);
}
/* Badge de naturaleza tributaria por línea (Nota de Crédito): misma clasificación
   que GreenterDocumentBuilder (GRAVADO/EXONERADO/INAFECTO/GRATUITO). */
.pe-cn-afect {
    display: inline-block;
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: .15rem .45rem;
    border-radius: .35rem;
    line-height: 1.2;
    white-space: nowrap;
}
.pe-cn-afect-gravado { background: #e7f4ea; color: #17854e; border: 1px solid #bfe3c9; }
.pe-cn-afect-inafecto { background: #eef0f2; color: #5a6b7b; border: 1px solid #d5dade; }
.pe-cn-afect-exonerado { background: #fff3df; color: #b36b00; border: 1px solid #f2d9a8; }
.pe-cn-afect-gratuito { background: #e8f1fb; color: #1d5e9e; border: 1px solid #c3daf1; }
/* FORMA DE PAGO dentro del frame CLIENTE+FORMA DE PAGO: Tipo 100%, luego
   Días y Vencimiento 50/50 (las clases col-md-12/col-md-6 ya se aplican en
   la vista cuando $framesLayout). */
.pe-frames-layout #payment_type,
.pe-frames-layout #credit_days,
.pe-frames-layout #due_date {
    width: 100%;
}
/* Botones inferiores: sin separador superior, sobre el fondo gris. */
.pe-frames-layout .pe-form-actions {
    background: transparent;
    border-top: none;
    padding-top: .25rem;
    margin-top: .25rem;
}
/* Encabezado del formulario sobre el fondo gris. */
.pe-frames-layout .pe-form-header {
    margin-bottom: .75rem;
}

/* Botones de acción de líneas ANTES de la tabla (frames): color uva
   institucional y texto blanco (btn-grape), mismo estilo del sistema. */
.pe-frames-layout .pe-frames-item-actions {
    align-items: center;
}
/* Búsqueda rápida por SKU/código de barras (Nueva Venta): ~380 px en escritorio
   y flexible (crece/encoge) para adaptarse al ancho disponible; mismas reglas
   visuales (form-control-sm) del resto de controles de la pantalla. */
.pe-frames-layout #skuQuickAdd {
    flex: 1 1 380px;
    max-width: 380px;
    min-width: 180px;
}
/* Mensaje de tabla de líneas vacía (nueva venta en frames y nueva importación):
   estado centrado con icono de cubo, título e indicación. Mismo patrón visual
   en ambos formularios. */
.pe-frames-layout .pe-frames-empty-row td,
.pe-imports-form .pe-frames-empty-row td {
    border-bottom: none;
}
.pe-frames-layout .pe-frames-empty-items,
.pe-imports-form .pe-frames-empty-items {
    padding: 1.6rem 1rem;
}
.pe-frames-layout .pe-frames-empty-box,
.pe-imports-form .pe-frames-empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
}
.pe-frames-layout .pe-frames-empty-icon,
.pe-imports-form .pe-frames-empty-icon {
    font-size: 1.9rem;
    color: var(--pe-primary);
    margin-bottom: .35rem;
}
.pe-frames-layout .pe-frames-empty-title,
.pe-imports-form .pe-frames-empty-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--pe-text-muted, #667085);
}
.pe-frames-layout .pe-frames-empty-hint,
.pe-imports-form .pe-frames-empty-hint {
    font-size: .78rem;
    color: var(--pe-text-softer, #98a2b3);
}
/* Sin borde inferior en la tabla de líneas (frames): el separador visual ya
   existe debajo (límite del frame PRODUCTOS / línea de totales). */
.pe-frames-layout #salesItemsTable tbody tr:last-child td {
    border-bottom: none;
}

/* Menú "+ Agregar Línea" (frames): compacto, con icono + nombre + descripción.
   Solo UI: las opciones Ítem libre / Observación no tienen acción todavía. */
.pe-line-menu {
    min-width: 15rem;
    padding: .35rem;
    border: 1px solid var(--pe-border, #dee2e6);
    border-radius: .5rem;
    box-shadow: 0 .25rem .6rem rgba(16, 24, 40, .12);
}
.pe-line-menu-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: .35rem;
}
.pe-line-menu-item:hover {
    background: #f4f6fb;
}
.pe-line-menu-icon {
    color: var(--pe-primary, #17854e);
    font-size: .95rem;
    margin-top: .15rem;
    width: 1.1rem;
    text-align: center;
}
.pe-line-menu-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.pe-line-menu-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--pe-text, #20242b);
}
.pe-line-menu-desc {
    font-size: .72rem;
    color: var(--pe-text-muted, #667085);
}

/* Líneas especiales en Ventas (FREE_ITEM / NOTE): descripción editable en la
   celda Producto, reutilizando el mismo contenedor pe-search-control para
   mantener la altura y el radio estándar de los controles. NOTE se distingue
   de forma discreta (fondo muy suave + icono de comentario). */
.pe-frames-layout .pe-item-desc-wrap .pe-item-desc {
    padding-right: 1.75rem;
}
.pe-frames-layout .pe-item-desc-icon {
    color: #17854e;
}
.pe-frames-layout tr[data-line-type="NOTE"] td {
    background: #fafbfd;
}
.pe-frames-layout tr[data-line-type="NOTE"] td:first-child {
    border-left: 3px solid #cfd8e3;
}

/* ==========================================================================
   ESTÁNDAR GLOBAL DE FORMULARIOS (referencia: Ventas aprobado)
   Controles con fondo BLANCO, borde gris claro y apariencia activa; botón
   Cancelar (blanco + rojo); acciones uva (+ Nuevo, + Agregar línea) y
   guardado temporal (blanco + azul). Se aplica a los formularios CRUD
   vía el contenedor .pe-card-body (los controles reales disabled conservan
   su aspecto diferenciado).
   ========================================================================== */
.pe-card-body input:not([type="checkbox"]):not([type="radio"]),
.pe-card-body textarea {
    background: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
/* Los select usan background-color (no el shorthand background) para NO
   pisar el background-image de Bootstrap (.form-select) que dibuja la
   flecha de selección a la derecha. */
.pe-card-body select {
    background-color: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-card-body input:disabled,
.pe-card-body select:disabled,
.pe-card-body textarea:disabled {
    background: #f2f3f5;
    color: #9aa3ac;
}
/* ESTÁNDAR TIPOGRÁFICO GLOBAL (aprobado en Ventas): en formularios de
   creación/edición (form method="post" dentro de .pe-card-body) inputs/selects/
   textareas usan .8rem (12.8px), igual que los labels. Los filtros de los
   listados (method="get") conservan su tamaño aprobado (form-control-sm, 14px). */
.pe-card-body form[method="post"] input:not([type="checkbox"]):not([type="radio"]),
.pe-card-body form[method="post"] select,
.pe-card-body form[method="post"] textarea {
    font-size: .8rem;
}
/* Botón Cancelar en formularios: blanco + rojo (único enlace outline de
   .pe-form-actions en los formularios CRUD). */
.pe-form-actions a.btn-outline-secondary {
    background: #ffffff;
    border-color: #cbd2d8;
    color: #c94a3e;
}
.pe-form-actions a.btn-outline-secondary i {
    color: #c94a3e;
}
.pe-form-actions a.btn-outline-secondary:hover {
    background: #fbecea;
    border-color: #c94a3e;
}
/* Acciones uva (acciones de trabajo dentro de formularios): + Nuevo,
   + Agregar línea, etc. */
.btn-grape {
    background: #875A7B;
    border-color: #875A7B;
    color: #ffffff;
}
.btn-grape:hover {
    background: #704A67;
    border-color: #704A67;
    color: #ffffff;
}
.btn-grape i {
    color: #ffffff;
}
/* Guardado temporal (Guardar como borrador): blanco + azul noche. */
.btn-draft {
    background: #ffffff;
    border-color: #cbd2d8;
    color: #1e2a5a;
}
.btn-draft i {
    color: #1e2a5a;
}
.btn-draft:hover {
    background: #f2f4fb;
    border-color: #1e2a5a;
}

/* Detalle en modo lectura (UC-02): etiqueta + valor en celdas informativas */
.pe-detail-label {
    font-size: .74rem;
    font-weight: 600;
    /*text-transform: uppercase;*/
    letter-spacing: .04em;
    color: var(--pe-text-muted);
    margin-bottom: .3rem;
}
.pe-detail-value {
    font-size: .95rem;
    color: var(--pe-text);
    line-height: 1.4;
    min-height: 1.4rem;
}
.pe-detail-value .pe-badge { margin-top: .1rem; }

/* Formulario de Ventas — datos informativos del cliente (Documento, Razón
   Social, Dirección, Teléfono): se igualan al estándar visual de los inputs
   del formulario (font-size .8rem = 12.8px y misma altura que form-control-sm).
   Solo lectura, sin cambiar su lógica ni contenido. */
.pe-sales-form .pe-customer-data {
    font-size: .8rem;
    padding: .25rem .5rem;
    min-height: calc(1.5em + .5rem + 2px);
    line-height: 1.5;
    border: 1px solid #d3d9de;
    background: #f8f9fa;
    color: #20242b;
}
.pe-sales-form .pe-detail-label {
    font-size: .8rem;
    font-weight: 600;
    /*text-transform: uppercase;*/
    letter-spacing: .04em;
    color: var(--pe-text-muted);
    margin-bottom: .15rem;
}

/* Ventas — Fila de datos del cliente (Documento | Razón | Dirección | Teléfono).
   Distribución a TODO el ancho del formulario, con "Documento" igualando el
   ancho del campo RUC/DNI superior (col-md-3 de col-md-7 ≈ 14.58% del form) y
   "Teléfono" similar a col-md-2 (≈16.67%). Razón y Dirección reparten el resto.
   Los labels usan capitalización normal (no uppercase). */
.pe-sales-form .pe-customer-info-row {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
}
.pe-sales-form .pe-customer-info-row > div {
    flex: 1 1 0;
    min-width: 0;
}
.pe-sales-form .pe-customer-info-row .pe-customer-doc {
    flex: 0 0 14.5833%;
}
.pe-sales-form .pe-customer-info-row .pe-customer-phone {
    flex: 0 0 16.6667%;
}
.pe-sales-form .pe-customer-info-row .pe-detail-label {
    text-transform: none;
    letter-spacing: .02em;
}
.pe-sales-form .pe-customer-info-row .pe-customer-data {
    height: 100%;
}

/* Datos del cliente en Ventas: área visual delimitada (borde sutil, no editable). */
.pe-customer-data {
    border: 1px solid var(--pe-border, #dee2e6);
    border-radius: .25rem;
    background: var(--pe-surface-soft, #f8f9fa);
    padding: .35rem .6rem;
    min-height: 2.15rem;
    font-size: .85rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nueva Compra — datos informativos del proveedor (Documento, Razón Social,
   Dirección, Teléfono): mismo fondo gris claro que los campos equivalentes de
   Nueva Venta (#f8f9fa). Selector limitado al formulario de Nueva Compra
   (#supplierCard) para no afectar otros módulos. Con ID vence a
   .form-control[readonly] (Bootstrap) y a .pe-sales-form .pe-customer-data. */
#supplierCard .pe-customer-data {
    background-color: #f8f9fa;
}

/* Mini-formulario de cambio de estado en filas del listado (Paso 6) */
.pe-state-form { display: inline-flex; }

/* Alternador "MÃ¡s filtros" (colapsable del listado): chevron que rota al abrir */
.pe-filters-toggle .fa-chevron-down { transition: transform .2s ease; }
.pe-filters-toggle[aria-expanded="true"] .fa-chevron-down { transform: rotate(180deg); }

/* ==========================================================================
   6. Tablas
   ========================================================================== */
.pe-table-wrap { overflow-x: auto; }
/* Densidad estándar de listados: filas 12px y compactas (~28px de alto),
   con el MISMO criterio de altura que Cuentas por Cobrar (padding vertical
   .35rem). El padding horizontal se mantiene amplio (1rem) para no apretar
   columnas de texto; la altura de fila depende solo del padding vertical.
   Transversal: todas las tablas `.pe-table` heredan estos valores. */
.pe-table { margin: 0; border-color: var(--pe-border); font-size: 12px; line-height: 1.4; }
.pe-table thead th {
    background: var(--pe-table-head-bg);
    color: var(--pe-table-head-text);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #cfe2d3;
    padding: .7rem 1rem;
    white-space: nowrap;
}
.pe-table tbody td {
    padding: .35rem 1rem;
    vertical-align: middle;
    border-color: var(--pe-border);
    background: #ffffff; /* filas blancas (estándar aprobado) */
}
.pe-table tbody tr:last-child td {
    border-bottom: 1px solid var(--pe-border); /* separación sutil de la última fila */
}
.pe-table tbody tr:hover {
    background: #eef7f1; /* verde MUY suave (estándar aprobado) */
}
.pe-table tbody tr:hover td {
    background: #eef7f1; /* el hover resalta toda la fila, no solo celdas sueltas */
}

/* Nueva Guía de Remisión: eliminar bordes verticales internos de la tabla de productos */
#itemsTable th,
#itemsTable td {
    border-left: 0;
    border-right: 0;
}
#itemsTable thead th {
    border-right: 0;
    border-left: 0;
}
#itemsTable thead th:first-child {
    border-left: 1px solid var(--pe-border);
}
#itemsTable thead th:last-child {
    border-right: 1px solid var(--pe-border);
}
#itemsTable tbody td {
    border-left: 0;
    border-right: 0;
}
#itemsTable tbody td:first-child {
    border-left: 1px solid var(--pe-border);
}
#itemsTable tbody td:last-child {
    border-right: 1px solid var(--pe-border);
}
#itemsTable tbody tr:last-child td {
    border-bottom: 1px solid var(--pe-border);
    border-left: 0;
    border-right: 0;
}
#itemsTable tbody tr:last-child td:first-child {
    border-left: 1px solid var(--pe-border);
}
#itemsTable tbody tr:last-child td:last-child {
    border-right: 1px solid var(--pe-border);
}

.pe-cell-strong { font-weight: 600; color: var(--pe-text); }
.pe-cell-muted { color: var(--pe-text-muted); }
.pe-cell-empty { color: var(--pe-text-softer); }

/* ==========================================================================
   7. Badges de estado
   ========================================================================== */
.pe-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .28rem .6rem;
    border-radius: 999px;
    font-size: .72rem; font-weight: 600;
    line-height: 1;
}
.pe-badge i { font-size: .6rem; }

.pe-badge-success { background: var(--pe-success-bg); color: var(--pe-success); }
.pe-badge-warning { background: var(--pe-warning-bg); color: var(--pe-warning); }
.pe-badge-danger  { background: var(--pe-danger-bg);  color: var(--pe-danger); }
.pe-badge-info    { background: var(--pe-info-bg);    color: var(--pe-info); }
.pe-badge-neutral { background: #ecefec; color: var(--pe-text-muted); }
.pe-badge-dark    { background: #29332c; color: #fff; }
/* Badge verde SÓLIDO con texto blanco para estados "completos" (p. ej. la
   Atención "Facturada" de Cotizaciones). Complementa pe-badge-success (pastel). */
.pe-badge-success-solid { background: #17854e; color: #fff; }
/* Excepción SUNAT (0100–1999): ámbar, distinto de "Observado"/"Pendiente". */
.pe-badge-exception { background: #fdf0e1; color: #a15c07; }
/* Tooltips del ERP (container:body) con ancho suficiente para observaciones
   largas de SUNAT sin romper el layout. */
body > .tooltip .tooltip-inner {
    max-width: 360px;
    white-space: normal;
}

/* Etiqueta de tipo de documento (chip discreto) */
.pe-chip {
    display: inline-flex; align-items: center;
    border: 1px solid var(--pe-border-strong);
    background: var(--pe-surface-soft);
    color: var(--pe-text-muted);
    font-size: .7rem; font-weight: 600;
    padding: .15rem .5rem;
    border-radius: var(--pe-radius-sm);
}

/* ==========================================================================
   8. Botones â€” estÃ¡ndar
   ========================================================================== */
.btn { border-radius: var(--pe-radius-sm); font-weight: 500; }

/* Primario: verde institucional */
.btn-primary {
    --bs-btn-bg: var(--pe-primary);
    --bs-btn-border-color: var(--pe-primary);
    --bs-btn-hover-bg: var(--pe-primary-600);
    --bs-btn-hover-border-color: var(--pe-primary-600);
    --bs-btn-active-bg: var(--pe-primary-700);
    --bs-btn-active-border-color: var(--pe-primary-700);
    --bs-btn-disabled-bg: var(--pe-primary);
    --bs-btn-disabled-border-color: var(--pe-primary);
}
.btn-primary:hover { box-shadow: var(--pe-shadow-sm); }

/* Secundario: borde sutil, fondo blanco (acciones suaves: Buscar, Volver) */
.btn-secondary {
    --bs-btn-bg: var(--pe-surface);
    --bs-btn-border-color: var(--pe-border-strong);
    --bs-btn-color: var(--pe-text);
    --bs-btn-hover-bg: var(--pe-surface-soft);
    --bs-btn-hover-border-color: var(--pe-border-strong);
    --bs-btn-hover-color: var(--pe-primary);
    --bs-btn-active-bg: var(--pe-surface-soft);
    --bs-btn-active-border-color: var(--pe-primary);
    --bs-btn-active-color: var(--pe-primary);
}
.btn-outline-secondary { --bs-btn-color: var(--pe-text-muted); --bs-btn-hover-color: var(--pe-primary); --bs-btn-hover-border-color: var(--pe-primary); --bs-btn-hover-bg: var(--pe-primary-tint); }
.btn-outline-primary { --bs-btn-hover-bg: var(--pe-primary-tint); }

.btn i { margin-right: .35rem; }

/* Enlace con acciÃ³n (Volver al listado) */
.pe-link-back { color: var(--pe-text-muted); text-decoration: none; font-size: .87rem; display: inline-flex; align-items: center; gap: .4rem; }
.pe-link-back:hover { color: var(--pe-primary); }
.pe-link-back i { font-size: .8rem; }

/* ==========================================================================
   9. Formularios
   ========================================================================== */
.form-label { font-size: .8rem; font-weight: 600; color: var(--pe-text); margin-bottom: .3rem; }
.form-label .pe-req { color: var(--pe-danger); }

/* Las variantes -sm/-lg de Bootstrap conservan SU propio tamaÃ±o (regla base
   solo para el tamaÃ±o estÃ¡ndar; antes anulaba .form-control-sm porque app.css
   se carga despuÃ©s del CDN de Bootstrap con la misma especificidad).
   Especificidad 0,2,0 (un solo :not con lista): debe quedar POR DEBAJO de las
   reglas decorativas .pe-field-icon > .form-control y .pe-search > .form-control
   (0,2,0 pero declaradas despuÃ©s), para que el padding-left del icono no sea
   pisado por el padding del shorthand de esta regla (bug: el texto del login
   se solapaba con el icono de sobre/candado). */
.form-control:not(.form-control-sm, .form-control-lg),
.form-select:not(.form-select-sm, .form-select-lg) {
    border-color: var(--pe-border-strong);
    border-radius: var(--pe-radius-sm);
    font-size: .9rem;
    padding: .5rem .8rem;
    box-shadow: none;
}
.form-control:focus, .form-select:focus {
    border-color: var(--pe-primary);
    box-shadow: 0 0 0 3px rgba(26, 107, 71, .12);
}
.form-control::placeholder { color: var(--pe-text-softer); }

.pe-field-hint { font-size: .75rem; color: var(--pe-text-softer); margin-top: .25rem; }

/* Campos con icono a la izquierda (p. ej. login) */
.pe-field-icon { position: relative; }
.pe-field-icon > i {
    position: absolute;
    left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--pe-text-softer);
    font-size: .85rem;
    pointer-events: none;
    z-index: 2;
}
/* padding-left para dejar libre el paso de la primera letra bajo el icono.
   Selector con > para vencer a la regla base .form-control:not(-sm):not(-lg)
   (especificidad 0,3,0): sin Ã©l, el texto iniciarÃ­a debajo del icono. */
.pe-field-icon > .form-control { padding-left: 2.2rem; }
.pe-field-icon .form-control:focus ~ i, .pe-field-icon:focus-within > i { color: var(--pe-primary); }
/* Select en campo con icono (login): mismo margen izquierdo que los inputs y
   padding-right suficiente para que el texto no se solape con la flecha nativa. */
.pe-field-icon > .form-select {
    padding-left: 2.2rem;
    padding-right: 2.6rem;
}

/* Toggle mostrar/ocultar contraseña (solo visual). El botón de ojo se integra a
   la derecha del campo; el input reserva espacio a la derecha (padding-right).
   Combinable con .pe-field-icon (login: icono izquierdo + ojo derecho). */
.pe-password-toggle { position: relative; }
.pe-password-toggle > .form-control { padding-right: 2.6rem; }
.pe-password-toggle-btn {
    position: absolute;
    right: .15rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 1.6rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--pe-text-softer);
    font-size: .9rem;
    cursor: pointer;
    border-radius: var(--pe-radius-sm, .25rem);
}
.pe-password-toggle-btn:hover { color: var(--pe-primary); }
.pe-password-toggle-btn:focus-visible { outline: 2px solid var(--pe-primary); outline-offset: 1px; }

/* Selector de bÃºsqueda con icono */
.pe-search {
    position: relative;
}
.pe-search > i {
    position: absolute;
    left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--pe-text-softer);
    font-size: .85rem;
    pointer-events: none;
}
/* Mismo criterio que .pe-field-icon: habilita el padding del texto a la
   derecha del icono de bÃºsqueda aunque el input sea -sm. */
.pe-search > .form-control { padding-left: 2.2rem; }
.pe-search.is-focused > i { color: var(--pe-primary); }

/* ==========================================================================
   10. Mensajes y alertas
   ========================================================================== */
.alert { border-radius: var(--pe-radius-sm); font-size: .88rem; }
.alert-danger { background: var(--pe-danger-bg); border-color: #f2d3cf; color: var(--pe-danger); }
.alert-success { background: var(--pe-success-bg); border-color: #cdeadd; color: var(--pe-success); }
.alert-warning { background: var(--pe-warning-bg); border-color: #f0dfc1; color: var(--pe-warning); }
.alert-info { background: var(--pe-info-bg); border-color: #cfe0f2; color: var(--pe-info); }

/* Mensajes de error de campo con icono */
.invalid-feedback { font-size: .78rem; display: flex; align-items: center; gap: .3rem; }
.invalid-feedback.d-block::before { content: '\f05a'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }

/* ==========================================================================
   11. Estados vacÃ­os
   ========================================================================== */
.pe-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--pe-text-muted);
}
.pe-empty-icon {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
    display: grid; place-items: center;
    font-size: 1.6rem;
}
.pe-empty-title { font-weight: 600; font-size: 1rem; color: var(--pe-text); }
.pe-empty-text { font-size: .87rem; color: var(--pe-text-muted); max-width: 420px; margin: .35rem auto 1.1rem; }

/* ==========================================================================
   12. Documento monospace (n.Âº documento)
   ========================================================================== */
.pe-doc-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }

/* ==========================================================================
    12b. PestaÃ±as (tabs) â€” lenguaje visual Ãºnico en todo el ERP
    ========================================================================== */
/* Contenedor de pestaÃ±as desplazable SOLO en horizontal.
   Con overflow-x: auto y overflow-y sin declarar, CSS Overflow 3 computa el
   eje vertical como auto: surgen dos ejes de scroll y, al activarse la barra
   horizontal, su altura consume espacio del interior dejando ~1px de
   excedente vertical que dibuja una scrollbar vertical fantasma a la derecha
   de las pestaÃ±as. overflow-y: hidden elimina ese eje: la barra vertical deja
   de existir, el desplazamiento horizontal se conserva y ninguna pestaÃ±a
   queda inaccesible (el contenido vertical es natural, sin height fija). */
.pe-tabs-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.pe-tabs-scroll .nav-link { white-space: nowrap; }
.pe-tab-error-mark { color: #dc262a; margin-left: 6px; }

/* PestaÃ±as: verde institucional (NUNCA azul). La activa se diferencia con el
   verde mÃ¡s profundo, negrita y borde superior tintado; el hover usa la
   variante -600 del mismo verde con fondo suave (tokens PowerERP). */
.nav-tabs .nav-link {
    color: var(--pe-primary);
    border-color: transparent;
    border-bottom-color: var(--pe-border);
}
.nav-tabs .nav-link:hover {
    color: var(--pe-primary-600);
    background: var(--pe-primary-tint);
    border-color: var(--pe-primary-tint);
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--pe-primary-700);
    font-weight: 600;
    background: var(--pe-surface);
    border-color: var(--pe-primary) var(--pe-border) var(--pe-border);
}

/* ==========================================================================
    13. PaginaciÃ³n (estÃ¡ndar visual, respeta el componente)
    ========================================================================== */
.pagination .page-link { color: var(--pe-text-muted); border-color: var(--pe-border); border-radius: var(--pe-radius-sm); margin: 0 .12rem; font-size: .82rem; padding: .4rem .65rem; }
.pagination .page-link:hover { color: var(--pe-primary); background: var(--pe-primary-tint); border-color: var(--pe-primary); }
.pagination .active > .page-link, .pagination .page-item.active .page-link { background: var(--pe-primary); border-color: var(--pe-primary); color: #fff; }
.pagination .disabled .page-link { color: var(--pe-text-softer); background: var(--pe-surface-soft); }

.pe-page-summary { font-size: .82rem; color: var(--pe-text-muted); }
.pe-perpage .btn-outline-secondary { font-size: .78rem; padding: .15rem .5rem; border-radius: var(--pe-radius-sm); }
.pe-perpage .btn-outline-secondary.active { background: var(--pe-primary); border-color: var(--pe-primary); color: #fff; }

/* ==========================================================================
   14. Acciones de fila
   ========================================================================== */
.pe-row-actions { display: inline-flex; gap: .35rem; }
.pe-icon-btn {
    width: 30px; height: 30px;
    display: inline-grid; place-items: center;
    border-radius: var(--pe-radius-sm);
    border: 1px solid var(--pe-border);
    background: var(--pe-surface);
    color: var(--pe-text-muted);
    font-size: .8rem;
    text-decoration: none;
}
.pe-icon-btn:hover { color: var(--pe-primary); border-color: var(--pe-primary); background: var(--pe-primary-tint); }

/* Variantes de acción (estándar de la columna Acciones de todo listado):
   colores funcionales suaves según la función de cada acción. */
/* Visualizar / consultar: azul suave. */
.pe-icon-btn-view { color: #6b7280; border-color: #e2e6ea; background: #f7f8fa; }
.pe-icon-btn-view:hover { color: #2060a6; border-color: #2060a6; background: #eef4fb; }
/* Editar: azul. */
.pe-icon-btn-edit { color: #2060a6; border-color: #d5e2f0; background: #eef4fb; }
.pe-icon-btn-edit:hover { color: #2060a6; border-color: #2060a6; background: #dbeaf8; }
/* Confirmar / acción positiva: verde suave. */
.pe-icon-btn-state { color: #17854e; border-color: #d2e8da; background: #eef7f1; }
.pe-icon-btn-state:hover { color: #17854e; border-color: #17854e; background: #dcf0e4; }
/* Eliminar / anular: rojo suave. */
.pe-icon-btn-danger { color: #c94a3e; border-color: #f0d5d2; background: #fbecea; }
.pe-icon-btn-danger:hover { color: #c94a3e; border-color: #c94a3e; background: #f7dedb; }
/* Botón de acción con el azul institucional sobrio (#16437B, patrón del botón
   "Agregar Grupo" / fila GROUP del módulo). Reutilizable. */
.pe-btn-blue-outline {
    color: #16437B;
    border-color: #16437B;
    background: #ffffff;
}
.pe-btn-blue-outline:hover,
.pe-btn-blue-outline:focus,
.pe-btn-blue-outline:active {
    color: #ffffff;
    border-color: #16437B;
    background: #16437B;
}
/* Botón "Anular" con el rojo sobrio del ERP (--pe-danger, patrón de Ventas y
   Guías de Remisión: pe-icon-btn-danger). Reutilizable. */
.pe-btn-danger-soft {
    color: var(--pe-danger);
    border-color: #f0d5d2;
    background: #ffffff;
}
.pe-btn-danger-soft:hover,
.pe-btn-danger-soft:focus,
.pe-btn-danger-soft:active {
    color: var(--pe-danger);
    border-color: var(--pe-danger);
    background: var(--pe-danger-bg);
}
/* Advertencia / pendiente: naranja/ámbar. */
.pe-icon-btn-warning { color: #b2791b; border-color: #eee2c8; background: #fbf3e3; }
.pe-icon-btn-warning:hover { color: #b2791b; border-color: #b2791b; background: #f5e7c9; }
/* Direcciones de despacho (pin/ubicación): rojo pastel suave con ícono rojo
   intenso, fácilmente reconocible como acción de ubicación. */
.pe-icon-btn-address { color: #dc3545; border-color: #f8d7da; background: #f8d7da; }
.pe-icon-btn-address:hover { color: #dc3545; border-color: #dc3545; background: #f5c6cb; }
/* Reenviar a SUNAT (excepción 0100–1999): ámbar, acción correctiva. */
.pe-icon-btn-resend { color: #a15c07; border-color: #eccf9f; background: #fdf0e1; }
.pe-icon-btn-resend:hover { color: #8a4d04; border-color: #a15c07; background: #f9e3c4; }
/* Imprimir PDF: verde institucional. */
.pe-icon-btn-print { color: var(--pe-primary); border-color: var(--pe-primary-tint); background: var(--pe-primary-tint); }
.pe-icon-btn-print:hover { color: var(--pe-primary); border-color: var(--pe-primary); background: var(--pe-primary-hover, #14532d); }
/* Mini-formulario inline para acciones por fila (p. ej. Reenviar a SUNAT). */
.pe-resend-form { display: inline-flex; margin: 0; padding: 0; }
/* Fila de documento afectado no disponible (NC/GR): comprobante no ACCEPTED. */
.pe-picker-row-disabled { opacity: .55; background: #fafafa; }
/* Paginación del modal de selección de documentos afectados (NC/GR). */
.pe-picker-pagination { margin-top: .4rem; }
/* Selector múltiple de "Tipo de documento" (Consulta de Ventas). */
.pe-multiselect-toggle { text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pe-multiselect-caret { float: right; margin-top: .25rem; }
.pe-multiselect-menu { min-width: 240px; }
.pe-multiselect-item { cursor: pointer; display: flex; align-items: center; }
.pe-multiselect-item:hover { background: var(--pe-primary-tint); color: var(--pe-primary); }

/* AcciÃ³n inhabilitada: visible pero no interactiva ("Disponible prÃ³ximamente") */
.pe-icon-btn.is-disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--pe-surface-soft);
}

/* ==========================================================================
   15. Responsive
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Sidebar off-canvas y accesorios: secciÃ³n 18 */
    .pe-user-name, .pe-user-meta { display: none; }
    .pe-page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 575.98px) {
    .pe-brand-subtitle { display: none; }
    .pe-main { padding: 1rem 0 2rem; }
    .pe-user-meta { display: none; }
}
/* ==========================================================================
   16. Control de ubigeo (autocompletado; Fase 9 - UBIGEOS_DESIGN.md)
   ========================================================================== */
.pe-ubigeo-wrap { position: relative; }
.pe-ubigeo-dropdown {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    z-index: 1060;
    max-height: 260px; overflow-y: auto;
    background: var(--pe-surface);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius-sm);
    box-shadow: var(--pe-shadow-sm, 0 8px 24px rgba(11, 27, 55, .12));
}
.pe-ubigeo-dropdown.is-open { display: block; }
.pe-ubigeo-option {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: .5rem .75rem;
    font-size: .875rem;
    color: var(--pe-text);
}
.pe-ubigeo-option:hover, .pe-ubigeo-option:focus {
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
}
.pe-ubigeo-hint {
    margin-top: .25rem;
    font-size: .8rem;
    color: var(--pe-primary);
    min-height: 1em;
}
.pe-icon-muted { color: var(--pe-text-muted); font-size: .85rem; }
.pe-detail-note { margin-top: .15rem; font-size: .75rem; color: var(--pe-text-muted); }

/* ==========================================================================
   17. Sistema transversal de Toast (Fase 10 - estÃ¡ndar oficial del ERP)
   ========================================================================== */
.pe-toast-stack {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .625rem;
    pointer-events: none; /* el contenedor no bloquea la interacciÃ³n */
}
.pe-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    width: max-content;
    max-width: min(480px, calc(100vw - 2rem));
    background: var(--pe-info);
    border-radius: var(--pe-radius);
    box-shadow: 0 6px 16px rgba(17, 24, 39, .22), 0 2px 6px rgba(17, 24, 39, .12);
    /* envolvente para pantallas muy anchas */
    padding: .75rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.45;
    color: #fff;
    /* entrada: animaciÃ³n CSS corre al renderizar (tambiÃ©n toasts servidos).
       SIN fill-mode forwards: al terminar, opacity lo entrega .is-visible;
       si quedara un valor animado retenido, bloquearÃ­a la transiciÃ³n de
       salida (la animaciÃ³n tendrÃ­a prioridad sobre .is-closing). */
    opacity: 0;
    transform: translateY(-10px);
    animation: pe-toast-in .34s ease-out;
}
@keyframes pe-toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pe-toast.is-visible { opacity: 1; transform: translateY(0); }
.pe-toast.is-closing {
    opacity: 0;
    transform: none;
    transition: opacity 2s linear !important;
}
.pe-toast-icon { font-size: 1.05rem; line-height: 1.4; color: #fff; }
.pe-toast-message { flex: 1; min-width: 0; padding-top: .0625rem; color: #fff; }
.pe-toast-close {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .85);
    font-size: .9375rem;
    line-height: 1;
    padding: .3125rem;
    border-radius: var(--pe-radius-sm);
    cursor: pointer;
}
.pe-toast-close:hover, .pe-toast-close:focus {
    color: #fff;
    background: rgba(255, 255, 255, .16);
}
/* Variantes semÃ¡nticas: fondos sÃ³lidos con texto blanco (contraste alto) */
.pe-toast-success { background: var(--pe-success); }
.pe-toast-error { background: var(--pe-danger); }
.pe-toast-warning { background: var(--pe-warning); }
.pe-toast-info { background: var(--pe-info); }
/* Responsive: centrado, mÃ¡rgenes laterales, ancho completo Ãºtil */
@media (max-width: 575.98px) {
    .pe-toast-stack {
        top: .75rem;
        left: 0;
        right: 0;
        transform: none;
        padding: 0 .75rem;
        width: 100%;
        align-items: stretch;
    }
    .pe-toast { width: 100%; max-width: none; }
}
/* Accesibilidad: sin animaciÃ³n si el usuario la desactiva */
@media (prefers-reduced-motion: reduce) {
    .pe-toast { opacity: 1; transform: none; animation: none; }
    .pe-toast.is-closing { opacity: 1; transition: none; }
}

/* ==========================================================================
   17b. PEToast (SweetAlert2 toast) — integración visual con PowerERP.
   El helper global PEToast (app.js) muestra notificaciones tipo toast con
   SweetAlert2; aquí se alinea su aspecto con la identidad del ERP usando las
   variables institucionales existentes.
   ========================================================================== */
.swal2-popup.swal2-toast {
    font-family: var(--pe-font);
    border-radius: var(--pe-radius-sm);
    box-shadow: var(--pe-shadow);
}
.swal2-popup.swal2-toast .swal2-title { font-size: .85rem; color: var(--pe-text); }
.swal2-popup.swal2-toast .swal2-html-container { font-size: .8rem; color: var(--pe-text-muted); }
/* Icono y barra de progreso con los colores institucionales. */
.swal2-popup.swal2-toast.swal2-toast-success .swal2-icon,
.swal2-popup.swal2-toast.swal2-toast-success .swal2-icon .swal2-icon-content {
    color: var(--pe-primary);
    border-color: var(--pe-primary);
}
.swal2-popup.swal2-toast.swal2-toast-success .swal2-timer-progress-bar { background: var(--pe-primary); }
.swal2-popup.swal2-toast.swal2-toast-warning .swal2-icon,
.swal2-popup.swal2-toast.swal2-toast-warning .swal2-icon .swal2-icon-content {
    color: var(--pe-warning);
    border-color: var(--pe-warning);
}
.swal2-popup.swal2-toast.swal2-toast-warning .swal2-timer-progress-bar { background: var(--pe-warning); }
.swal2-popup.swal2-toast.swal2-toast-error .swal2-icon,
.swal2-popup.swal2-toast.swal2-toast-error .swal2-icon .swal2-icon-content {
    color: var(--pe-danger);
    border-color: var(--pe-danger);
}
.swal2-popup.swal2-toast.swal2-toast-error .swal2-timer-progress-bar { background: var(--pe-danger); }
.swal2-popup.swal2-toast.swal2-toast-info .swal2-icon,
.swal2-popup.swal2-toast.swal2-toast-info .swal2-icon .swal2-icon-content {
    color: var(--pe-info);
    border-color: var(--pe-info);
}
.swal2-popup.swal2-toast.swal2-toast-info .swal2-timer-progress-bar { background: var(--pe-info); }
/* ==========================================================================
   18. Sidebar de navegaciÃ³n (Fase 11 - SIDEBAR_NAVIGATION_DESIGN.md, 2026-08)
   ========================================================================== */

/* Contenedor principal: sidebar fijo + columna de contenido con margen
   compensatorio. Estilos de estado aplicados en <html> (html.pe-sb-collapsed
   / html.pe-sb-open) por app.js para sobrevivir a navegaciones sin flash. */
.pe-app { min-height: 100vh; display: flex; }
.pe-app-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--pe-sidebar-w);
    transition: margin-left .22s ease;
}
html.pe-sb-collapsed .pe-app-body { margin-left: var(--pe-sidebar-w-collapsed); }

/* ----- Sidebar ----- */
.pe-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    width: var(--pe-sidebar-w);
    /* PRUEBA VISUAL (2): fondo verde-negro #17221E; texto/iconos en blanco y
       gris muy claro; activo verde PowerERP; hover verde oscuro aclarado. */
    background: var(--pe-sidebar-bg);
    border-right: 1px solid var(--pe-sidebar-border);
    transition: width .22s ease, transform .22s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, .18);
}
html.pe-sb-collapsed .pe-sidebar { width: var(--pe-sidebar-w-collapsed); }

/* Marca + control de contraer/expandir: cabecera del sidebar (el navbar
   superior fue eliminado; este control vive ahora dentro del sidebar). */
.pe-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .25rem;
    border-bottom: 1px solid var(--pe-sidebar-border);
}
.pe-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    min-height: 62px;
    padding: .8rem .9375rem;
    text-decoration: none;
    color: #fff;
}
.pe-sidebar-brand:hover { color: #fff; }
.pe-sidebar-brand .pe-brand-sub { color: var(--pe-sidebar-text-soft); }

/* Botón contraer/expandir (escritorio): junto a la marca. */
.pe-sb-collapse-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin-right: .6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--pe-radius-sm);
    border: 1px solid var(--pe-sidebar-border);
    background: transparent;
    color: var(--pe-sidebar-text);
    font-size: .82rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.pe-sb-collapse-btn:hover { background: var(--pe-sidebar-hover-bg); color: #fff; }
html.pe-sb-collapsed .pe-sidebar-header { flex-direction: column; gap: .35rem; padding: .55rem 0; }
html.pe-sb-collapsed .pe-sidebar-brand { justify-content: center; min-height: auto; padding: 0; }
html.pe-sb-collapsed .pe-sidebar-brand-text { display: none; }
html.pe-sb-collapsed .pe-sb-collapse-btn { margin-right: 0; }

/* NavegaciÃ³n: enlaces raÃ­z + grupos colapsables */
.pe-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .875rem .75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .125rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.pe-sidebar-link, .pe-sb-group-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .5625rem .6875rem;
    border-radius: var(--pe-radius-sm);
    border: 0;
    background: transparent;
    /* PRUEBA VISUAL (2): texto e iconos en gris muy claro */
    color: var(--pe-sidebar-text);
    font-size: .875rem;
    font-weight: 400;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
/* Grupos/módulos principales (Comercial, Ventas, Importaciones, Logística,
   Maestros, Administración) en negrita; las subopciones conservan peso normal. */
.pe-sb-group-toggle { font-weight: 700; }
.pe-sidebar-link:hover, .pe-sb-group-toggle:hover {
    color: #fff;
    /* verde oscuro aclarado, dentro de la familia institucional */
    background: var(--pe-sidebar-hover-bg);
}
.pe-sidebar-link.active {
    color: #fff;
    background: var(--pe-sidebar-active-bg); /* verde PowerERP */
    font-weight: 600;
}
.pe-sidebar-link-icon {
    width: 1.25rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 1rem;
}
.pe-sb-group-caret {
    margin-left: auto;
    font-size: .7rem;
    color: var(--pe-sidebar-text-soft);
    transition: transform .2s ease;
}
.pe-sb-group.is-open > .pe-sb-group-toggle .pe-sb-group-caret { transform: rotate(180deg); }
.pe-sb-group-body { 
    display: none; 
    margin: .0625rem 0 .25rem;
    padding-left: 2rem;
    position: relative;
}
.pe-sb-group.is-open > .pe-sb-group-body { display: block; }
.pe-sb-group-body::before {
    content: "";
    position: absolute;
    left: 1.5625rem;  /* ~11px left of previous position */
    top: .0625rem;
    bottom: .25rem;
    width: 2px;
    background: var(--pe-sidebar-border);
}
.pe-sidebar-link-child { 
    padding-left: 1rem;
    font-size: .8125rem;
    font-weight: 400;
}
/* Enlace de primer nivel no dependiente de un grupo (p. ej. "Inicio") en negrita. */
.pe-sidebar-link:not(.pe-sidebar-link-child) { font-weight: 700; }

/* Separador visual dentro de un grupo (p. ej. separa Operaciones comerciales
   de Guías de Remisión dentro del módulo Ventas). Discreto y coherente con el
   sidebar oscuro: línea fina con el mismo color de borde del resto del menú. */
.pe-sb-separator {
    height: 1px;
    margin: .375rem 2rem;
    background: var(--pe-sidebar-border);
    border: 0;
}

/* ----- Perfil de usuario en el pie del sidebar -----
   Sustituye al antiguo bloque de usuario del navbar. Permanece fijo abajo,
   separado del menú, con dropdown hacia arriba (dropup). */
.pe-sidebar-footer {
    border-top: 1px solid var(--pe-sidebar-border);
    padding: .6rem;
}
.pe-sb-user { width: 100%; }
.pe-sb-user-btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .45rem .5rem;
    border: 0;
    border-radius: var(--pe-radius-sm);
    background: transparent;
    color: var(--pe-sidebar-text);
    text-align: left;
    cursor: pointer;
    transition: background .15s ease;
}
.pe-sb-user-btn:hover { background: var(--pe-sidebar-hover-bg); }
.pe-sb-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.pe-sb-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pe-sb-user-meta {
    font-size: .68rem;
    color: var(--pe-sidebar-text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pe-sb-user-caret { margin-left: auto; font-size: .7rem; color: var(--pe-sidebar-text-soft); }
.pe-sb-user .pe-dropdown-menu { min-width: 215px; }

/* ContraÃ­do (escritorio): solo iconos; grupos e hijos se pliegan */
html.pe-sb-collapsed .pe-sb-label,
html.pe-sb-collapsed .pe-sb-group-caret,
html.pe-sb-collapsed .pe-sb-group-body { display: none; }
/* Fuerza ocultar grupos abiertos en estado colapsado (gana a .is-open) */
html.pe-sb-collapsed .pe-sb-group.is-open > .pe-sb-group-body {
    display: none !important;
}
html.pe-sb-collapsed .pe-sidebar-link,
html.pe-sb-collapsed .pe-sb-group-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
/* Perfil colapsado: solo avatar centrado (nombre/empresa/caret ocultos). */
html.pe-sb-collapsed .pe-sidebar-footer { padding: .6rem .35rem; }
html.pe-sb-collapsed .pe-sb-user-btn { justify-content: center; padding-left: 0; padding-right: 0; }
html.pe-sb-collapsed .pe-sb-user-info,
html.pe-sb-collapsed .pe-sb-user-caret { display: none; }

/* Botones de estado del sidebar en la topbar (legado; el navbar superior fue
   eliminado y el control vive ahora en .pe-sb-collapse-btn). */
.pe-topbar-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--pe-radius-sm);
    border: 1px solid var(--pe-border);
    background: var(--pe-surface);
    color: var(--pe-text-muted);
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.pe-topbar-btn:hover {
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
    border-color: transparent;
}
html.pe-sb-collapsed .pe-toggle-icon-collapse { display: none; }
html.pe-sb-collapsed .pe-toggle-icon-expand { display: inline-block !important; }

/* ==========================================================================
   SIDEBAR CONTRAÍDO + EXPANSIÓN FLOTANTE POR HOVER (solo escritorio).
   Cuando html.pe-sb-collapsed.pe-sb-hover (mouse sobre el sidebar contraído),
   el sidebar se expande VISUALMENTE por encima del contenido (overlay). El
   .pe-app-body NO cambia su margin-left (sigue 64px), por lo que el contenido
   no se desplaza ni cambia de ancho. Al retirar el mouse, vuelve a 64px.
   ========================================================================== */
@media (min-width: 992px) {
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar {
        width: var(--pe-sidebar-w);
    }
    /* Restaurar el contenido interno como en el estado fijado expandido. */
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar-header {
        flex-direction: row;
        gap: .25rem;
        padding: 0;
    }
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar-brand {
        justify-content: flex-start;
        min-height: 62px;
        padding: .8rem .9375rem;
    }
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar-brand-text { display: block; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-collapse-btn { margin-right: .6rem; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-label { display: inline; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-group-caret { display: inline-block; }
    /* Cuerpo de grupo: comportamiento normal del acordeón (solo visible si
       .is-open); gana a la regla contraída con !important. */
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-group-body { display: none; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-group.is-open > .pe-sb-group-body { display: block !important; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar-link,
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-group-toggle {
        justify-content: flex-start;
        padding-left: .6875rem;
        padding-right: .6875rem;
    }
    html.pe-sb-collapsed.pe-sb-hover .pe-sidebar-footer { padding: .6rem; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-user-btn {
        justify-content: flex-start;
        padding-left: .5rem;
        padding-right: .5rem;
    }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-user-info { display: flex; }
    html.pe-sb-collapsed.pe-sb-hover .pe-sb-user-caret { display: inline-block; }
}

/* Overlay mÃ³vil: solo existe en pantallas < 992px (oculto en escritorio) */
.pe-sidebar-overlay { display: none; }

/* Botón flotante para abrir el sidebar off-canvas en móvil/tablet. Reemplaza
   la hamburguesa del navbar eliminado sin ocupar una barra completa. */
.pe-menu-fab {
    position: fixed;
    top: .7rem;
    left: .7rem;
    z-index: 1044;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--pe-radius-sm);
    background: var(--pe-sidebar-bg);
    color: #fff;
    font-size: 1rem;
    box-shadow: var(--pe-shadow);
    cursor: pointer;
}
html.pe-sb-open .pe-menu-fab { display: none; }

/* ----- Responsive: < 992px (mÃ³vil/tablet) -----
   El sidebar pasa a off-canvas; el estado contraÃ­do de escritorio no aplica
   (siempre 250px cuando estÃ¡ abierto). La clase html.pe-sb-open activa el
   panel y el overlay. */
@media (max-width: 991.98px) {
    .pe-app-body, html.pe-sb-collapsed .pe-app-body { margin-left: 0; }
    /* Espacio superior para que el botón flotante no tape el encabezado. */
    .pe-app-body .pe-main { padding-top: 3.7rem; }
    .pe-sidebar, html.pe-sb-collapsed .pe-sidebar {
        width: var(--pe-sidebar-w);
        transform: translateX(-100%);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
    html.pe-sb-open .pe-sidebar { transform: translateX(0); box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
    .pe-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(11, 27, 55, .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
    }
    html.pe-sb-open .pe-sidebar-overlay { opacity: 1; pointer-events: auto; }
}

/* ==========================================================================
   18b. Pantalla de inicio — accesos directos (welcome)
   Grid responsivo: las columnas se adaptan solas al ancho disponible
   (auto-fill + minmax) sin scroll horizontal. El ancho mínimo (172px) deja
   ~6 tarjetas por fila en escritorio y permite que etiquetas largas como
   "Cuentas por cobrar" queden en una sola línea. Móvil ~2 columnas (minmax
   reducido), tablet 3-4, escritorio ~6. Las imágenes PNG (transparentes) son
   el elemento principal: sin fondo, borde ni recuadro adicional detrás.
   ========================================================================== */
.pe-home .pe-page-header { margin-bottom: 1rem; }
.pe-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: .9rem;
}
.pe-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    min-height: 128px;
    padding: 1.1rem .9rem;
    background: var(--pe-surface);
    border: 1px solid var(--pe-border);
    border-radius: var(--pe-radius);
    box-shadow: var(--pe-shadow-sm);
    text-align: center;
    text-decoration: none;
    color: var(--pe-text);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease,
                transform .15s ease, background .15s ease;
}
.pe-shortcut:hover {
    color: var(--pe-primary);
    background: var(--pe-primary-tint);
    border-color: var(--pe-primary);
    box-shadow: var(--pe-shadow);
    transform: translateY(-2px);
}
/* Contenedor del icono: neutro (sin fondo/recuadro) para no cubrir el PNG
   transparente. Solo centra la imagen. */
.pe-shortcut-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    line-height: 0;
}
/* Respaldo con icono Font Awesome (solo accesos del Super Admin Global, que
   no tienen PNG): conserva el círculo tintado del diseño anterior. */
.pe-shortcut-icon-fa {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--pe-primary-tint);
    color: var(--pe-primary);
    font-size: 1.35rem;
    transition: background .15s ease, color .15s ease;
}
.pe-shortcut:hover .pe-shortcut-icon-fa { background: var(--pe-primary); color: #fff; }
/* Imagen PNG del acceso: tamaño uniforme sin deformar (object-fit: contain). */
.pe-shortcut-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
}
.pe-shortcut-label {
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

/* ----- Fondo de la pantalla de inicio -----
   Degradado CSS (sin imagen), gris oscuro -> gris claro, inspirado en el
   concepto visual de Odoo (sin copiarlo). Se aplica al contenedor REAL de
   /welcome (.pe-content.pe-home), el elemento que controla el fondo visible
   del área principal; las tarjetas blancas se diferencian del degradado.
   .pe-home crece (flex:1) para que el degradado ocupe TODA la altura
   disponible del área principal (comportamiento footer sticky). */
.pe-content.pe-home {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    background: linear-gradient(135deg, #d9e2dc 0%, #f5f8f6 55%, #d0dbd4 100%);
}
/* .pe-main de /welcome pasa a columna flex sin padding propio: el degradado
   de .pe-home llena el área y empuja el footer al fondo de la ventana.
   El padding global de .pe-main (1.5rem/3rem) es la causa de las franjas
   grises superior/inferior si esta regla no se aplica; aquí se neutraliza
   SOLO para /welcome. */
body.pe-route-home .pe-main {
    display: flex;
    flex-direction: column;
    padding: 0;
}
/* Ancla estructural de /welcome: el área principal debe ocupar como mínimo
   todo el alto de la ventana (independiente de sidebar expandido/contraído).
   Sin esto, la altura depende de la cadena global .pe-app > .pe-app-body. */
body.pe-route-home .pe-app-body {
    min-height: 100vh;
}
/* Móvil/tablet: el espacio para el botón flotante del menú se traslada al
   .pe-home (el .pe-main de /welcome ya no tiene padding). */
@media (max-width: 991.98px) {
    .pe-content.pe-home { padding-top: 3.7rem; }
}

/* Footer específico de /welcome: variante de .pe-footer que SOLO se aplica en
   la ruta Inicio (clase pe-home-footer agregada por el layout cuando la ruta
   es /welcome). No afecta al footer de las demás pantallas. Fondo blanco,
   texto en el verde institucional, sin margin-top, sin position:fixed; ocupa
   el ancho del área principal respetando el sidebar. */
body.pe-route-home .pe-footer.pe-home-footer {
    color: var(--pe-primary);
    background: var(--pe-surface);
}

/* Pantallas pequeñas: tarjetas más compactas, PNG reducido proporcionalmente y
   un mínimo menor para conservar ~2 columnas sin desbordamiento. */
@media (max-width: 575.98px) {
    .pe-shortcuts { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
    .pe-shortcut { min-height: 110px; padding: .9rem .6rem; gap: .55rem; }
    .pe-shortcut-icon, .pe-shortcut-img { width: 52px; height: 52px; }
}

/* ============================ ProductPicker (§17) ============================ */
.pe-picker-form {
    background: var(--pe-bg-light, #f8fafc);
    padding: 1rem;
    border-radius: .5rem;
    border: 1px solid var(--pe-border, #e2e8f0);
}
/* ESTÁNDAR GLOBAL — controles dentro de los modales de búsqueda y de los
   formularios modal (cliente/producto): los input/select/textarea son
   BLANCOS con borde gris claro y tipografía .8rem, igual que el resto del
   ERP. Los modales viven en <body> (SweetAlert2), fuera de .pe-card-body,
   por lo que necesitan su propia regla; aquí se cubren todos. */
.pe-picker-form input:not([type="checkbox"]):not([type="radio"]),
.pe-picker-form select,
.pe-picker-form textarea,
.pe-customer-modal-form input:not([type="checkbox"]):not([type="radio"]),
.pe-customer-modal-form select,
.pe-customer-modal-form textarea {
    background-color: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
    font-size: .8rem;
    font-family: var(--pe-font, 'Inter', ui-sans-serif, system-ui, sans-serif);
}
.pe-picker-form label,
.pe-customer-modal-form label {
    font-size: .8rem;
    color: #20242b;
}
.pe-picker-form label {
    margin-bottom: .15rem;
    font-weight: 500;
}
.pe-picker-table-wrap {
    /* Contenedor de scroll de los resultados del picker. El tamaño NO se fija
       aquí: dentro del layout flex del modal (pe-picker-container) usa
       flex:1 + min-height:0 y el límite de altura lo impone el popup
       (max-height por viewport). overflow-y:auto activa el scroll vertical
       propio cuando hay muchos productos. */
    overflow-y: auto;
    overflow-x: auto;
}
.pe-picker-table-wrap .pe-table {
    margin-bottom: 0;
}
.pe-picker-table-wrap .pe-table thead th {
    padding: .4rem .5rem;
}
.pe-picker-table-wrap th,
.pe-picker-table-wrap td {
    vertical-align: middle;
    white-space: nowrap;
}
.pe-picker-col-sku {
    font-family: var(--pe-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: .8rem;
    min-width: 100px;
}
.pe-picker-col-name {
    min-width: 200px;
    max-width: 300px;
    text-align: left;
}
.pe-picker-col-family {
    min-width: 135px;
    color: var(--pe-text-muted, #64748b);
    text-align: left;
}
.pe-picker-col-brand {
    min-width: 95px;
    color: var(--pe-text-muted, #64748b);
}
.pe-picker-col-uom {
    min-width: 70px;
    text-align: center;
    font-family: var(--pe-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: .8rem;
}
.pe-picker-col-stock {
    min-width: 90px;
}
.pe-picker-col-economic {
    min-width: 95px;
    text-align: right;
    font-size: .8rem;
}
.pe-picker-result-row {
    cursor: default;
    transition: background .15s ease;
}
.pe-picker-result-row:hover {
    background: rgba(31, 122, 77, .08);
}
/* Fila enfocada con el teclado (↑/↓): resaltado distintivo sin confundirse
   con el hover del mouse. */
.pe-picker-result-row.pe-picker-active {
    background: rgba(31, 122, 77, .18);
    outline: 1px solid var(--pe-primary, #17854e);
    outline-offset: -1px;
}
.pe-picker-table-wrap .pe-table .pe-picker-result-row.pe-picker-active td:last-child {
    background: var(--pe-primary-tint-2);
}
.pe-picker-result-row td {
    padding: .32rem .55rem;
}
.pe-picker-select-btn {
    cursor: pointer;
    padding: .15rem .4rem;
    line-height: 1.1;
}
.pe-picker-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--pe-text-muted, #64748b);
}

/* Columna ACCIÓN fija a la derecha (respaldo ante scroll horizontal): la
   selección del registro queda siempre visible sin desplazarse. */
.pe-picker-table-wrap .pe-table thead th:last-child,
.pe-picker-table-wrap .pe-table tbody td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
}
.pe-picker-table-wrap .pe-table thead th:last-child {
    background: var(--pe-table-head-bg);
    box-shadow: -4px 0 8px -6px rgba(11, 27, 55, .3);
}
.pe-picker-table-wrap .pe-table tbody td:last-child {
    background: var(--pe-surface);
    box-shadow: -4px 0 8px -6px rgba(11, 27, 55, .3);
}
.pe-picker-table-wrap .pe-table .pe-picker-result-row:hover td:last-child {
    background: var(--pe-primary-tint-2);
}

/* Modal de SweetAlert2 del picker (clases propias, sin :has).
   Estructura DOM de SweetAlert2 v11:
     .swal2-popup.pe-picker-popup           (max-height por viewport; SweetAlert2
                                              le impone display:grid inline, que
                                              NO se puede cambiar por CSS)
       .swal2-header / .swal2-title         (encabezado, altura natural)
       .swal2-html-container.pe-picker-container  (flex column con !important:
                                              vence el display:block inline;
                                              max-height limita al viewport)
         #pe-picker-form                    (filtros, altura natural)
         .pe-picker-table-wrap              (RESULTADOS: único con overflow-y;
                                              flex:1 + min-height:0)
   El margen inferior es el PADDING del .pe-picker-container (fuera del área
   de overflow del table-wrap): queda SIEMPRE visible como espacio entre la
   última fila y el borde inferior del modal, incluso con scroll. */
.pe-picker-popup {
    /* El límite de altura del MODAL se fija aquí con max-height por viewport:
       el modal nunca desborda la pantalla. */
    max-height: calc(100vh - 4rem);
    max-width: calc(100vw - 2rem);
}
.pe-picker-container {
    /* Contenedor del contenido (html-container de SweetAlert2). Se convierte
       en flex column (venciendo el display:block inline con !important) para
       que el table-wrap ocupe EXACTAMENTE el espacio restante tras los
       filtros. max-height permite que el contenido crezca hasta el límite del
       popup (100vh - 4rem) dejando título y filtros arriba; el table-wrap
       con flex:1 absorbe el resto y scrollea. El padding inferior queda
       SIEMPRE visible como margen real entre la última fila y el borde
       inferior del modal. */
    display: flex !important;
    flex-direction: column !important;
    max-height: calc(100vh - 8rem);
    overflow: hidden !important;
    padding: 1em 1.6em 1.25rem !important;
}
.pe-picker-container .pe-picker-table-wrap {
    /* Único contenedor con scroll vertical: flex:1 + min-height:0 ocupan el
       espacio restante del container; overflow-y:auto activa el scroll cuando
       hay muchos productos. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

/* Modal de formulario de CLIENTE (desde Ventas): a diferencia del picker de
   productos, el contenido es un FORMULARIo completo (no una tabla con scroll
   interno). Se permite scroll vertical en todo el container para que queden
   visibles el título de sección, todos los campos y los botones Guardar/
   Cancelar, sin cortarse. Altura ajustada, no excesiva. */
.pe-customer-modal-popup {
    max-height: calc(100vh - 4rem);
    max-width: calc(100vw - 2rem);
}
.pe-customer-modal-container {
    display: block !important;
    max-height: calc(100vh - 8rem);
    overflow-y: auto !important;
    padding: 1em 1.4em 1.25rem !important;
}

/* Formulario de cliente en modal (Ventas): compactación vertical para que
   todo el formulario y los botones queden visibles sin scroll (captura rápida
   desde el punto de venta). Se elimina espacio desperdiciado sin reducir
   fuentes ni controles. */
.pe-customer-modal-form .pe-modal-section {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}
.pe-customer-modal-form .pe-modal-section + .pe-modal-section {
    margin-top: .7rem !important;
    padding-top: .7rem !important;
    border-top: 1px solid var(--pe-border, #dee2e6);
}
.pe-customer-modal-form .pe-form-section-title {
    margin-bottom: .35rem;
}
.pe-customer-modal-form .pe-form-section-title i {
    font-size: .75rem;
}
.pe-customer-modal-form .form-label {
    margin-bottom: .15rem;
}
.pe-customer-modal-form .row {
    --bs-gutter-y: .3rem;
}
.pe-customer-modal-form .form-control-sm,
.pe-customer-modal-form .form-select-sm {
    padding-top: .2rem;
    padding-bottom: .2rem;
}
.pe-customer-modal-form .pe-ubigeo-hint {
    font-size: .72rem;
    margin-top: .15rem;
}
.pe-customer-modal-form .pe-modal-actions {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--pe-border, #dee2e6);
}
.pe-customer-modal-form .invalid-feedback {
    margin-top: .1rem;
    margin-bottom: 0;
}

/* Formulario de proveedor en modal (Nueva Importación): compactación vertical
   con el MISMO estándar visual del modal de cliente en Ventas (patrón ERP
   aprobado). Sin estilos nuevos: secciones sin margen/padding interno,
   separadores uniformes .7rem, títulos .35rem, labels .15rem, filas con gutter
   .3rem, controles sm .2rem y acciones .85rem. Scope propio: no afecta al
   formulario de página completa (suppliers/form.php) ni a otros módulos. */
.pe-supplier-modal-form .pe-modal-section {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}
.pe-supplier-modal-form .pe-modal-section + .pe-modal-section {
    margin-top: .7rem !important;
    padding-top: .7rem !important;
    border-top: 1px solid var(--pe-border, #dee2e6);
}
.pe-supplier-modal-form .pe-form-section-title {
    margin-bottom: .35rem;
}
.pe-supplier-modal-form .pe-form-section-title i {
    font-size: .75rem;
}
.pe-supplier-modal-form .form-label {
    margin-bottom: .15rem;
}
.pe-supplier-modal-form .row {
    --bs-gutter-y: .3rem;
}
.pe-supplier-modal-form .form-control-sm,
.pe-supplier-modal-form .form-select-sm {
    padding-top: .2rem;
    padding-bottom: .2rem;
}
.pe-supplier-modal-form .pe-ubigeo-hint {
    font-size: .72rem;
    margin-top: .15rem;
}
.pe-supplier-modal-form .pe-modal-actions {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--pe-border, #dee2e6);
}
.pe-supplier-modal-form .invalid-feedback {
    margin-top: .1rem;
    margin-bottom: 0;
}
/* CONTROLES del modal de proveedor: mismo estándar visual que Nueva
   Importación (reglas .pe-card-body del ERP). El fragmento del modal no vive
   dentro de .pe-card-body, por eso los controles caían en el fondo gris de
   --bs-body-bg; se replican los mismos valores aprobados (fondo blanco,
   borde #d3d9de, texto #20242b, fuente .8rem). Los select usan background-color
   (no shorthand) para no pisar la flecha del .form-select de Bootstrap. */
.pe-supplier-modal-form input:not([type="checkbox"]):not([type="radio"]),
.pe-supplier-modal-form textarea {
    background: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-supplier-modal-form select {
    background-color: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-supplier-modal-form input:disabled,
.pe-supplier-modal-form select:disabled,
.pe-supplier-modal-form textarea:disabled {
    background: #f2f3f5;
    color: #9aa3ac;
}
.pe-supplier-modal-form form[method="post"] input:not([type="checkbox"]):not([type="radio"]),
.pe-supplier-modal-form form[method="post"] select,
.pe-supplier-modal-form form[method="post"] textarea {
    font-size: .8rem;
}

/* Clientes/Proveedores (página completa, customers/new y suppliers/new):
   secciones compactas SIN líneas separadoras y con menor espacio vertical.
   Mismos valores del estilo compacto aprobado en Ventas (.pe-section-slim):
   .9rem entre secciones y 1rem antes del bloque de acciones. Scope propio:
   no afecta a otros formularios ni al modal (pe-customer/supplier-modal-form). */
.pe-customers-form .pe-form-section + .pe-form-section,
.pe-suppliers-form .pe-form-section + .pe-form-section {
    border-top: none;
    margin-top: .9rem;
    padding-top: .9rem;
}
.pe-customers-form .pe-form-section + .pe-form-actions,
.pe-customers-form .pe-form-section ~ .pe-form-actions,
.pe-suppliers-form .pe-form-section + .pe-form-actions,
.pe-suppliers-form .pe-form-section ~ .pe-form-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: none;
}

/* ==========================================================================
   VENTAS — Pantalla compacta (SALES_MODULE_DESIGN)
   ========================================================================== */
/* Secciones del formulario de venta más compactas. */
.pe-section-slim { padding-bottom: .35rem; }
.pe-section-slim .pe-form-section-title { margin-bottom: .3rem; }
.pe-section-slim .form-label { margin-bottom: .12rem; }

/* Reducir el espacio vertical ENTRE secciones del form de venta y eliminar
   el separador horizontal (border-top): las secciones se diferencian por el
   título, el icono y el espacio vertical, sin líneas que sobrecarguen. */
.pe-form-section.pe-section-slim + .pe-form-section.pe-section-slim {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: none;
}
/* Menos espacio vertical entre filas de controles dentro de una sección. */
.pe-form-section.pe-section-slim .row { --bs-gutter-y: .25rem; }
.pe-form-section.pe-section-slim .pe-card-body .row.mt-1 { margin-top: .25rem !important; }
.pe-form-section.pe-section-slim .form-text { margin-top: .05rem; }

/* Acciones del form de venta: bloque de botones más próximo a los totales,
   sin separador horizontal (mismo criterio que las secciones). */
.pe-form-section.pe-section-slim + .pe-form-actions,
.pe-form-section.pe-section-slim ~ .pe-form-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: none;
}

/* Tabla de productos compacta. */
.pe-table-slim td, .pe-table-slim th { padding: .25rem .35rem; }
.pe-table-slim td { vertical-align: middle; }

/* Ventas — ocultar flechas/spinners de los inputs numéricos (solo visual;
   se conserva type="number", step, min/max y toda la funcionalidad). */
#salesItemsTable input[type="number"]::-webkit-outer-spin-button,
#salesItemsTable input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#salesItemsTable input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ==========================================================================
   VENTAS — Controles de búsqueda (cliente y producto)
   Los inputs de búsqueda usan la MISMA clase form-control-sm que el resto de
   controles del formulario, por lo que heredan exactamente su altura y
   tipografía estándar (sin sobrescribir font-size/line-height aquí).
   ========================================================================== */
/* Input del buscador de producto en la tabla: solo ocupa el ancho completo. */
.pe-form-section.pe-section-slim [data-picker-wrap] .pe-product-name {
    width: 100%;
}

/* ==========================================================================
   VENTAS — Distribución horizontal de la tabla de líneas
   ========================================================================== */
/* PRODUCTO es la columna principal: ocupa el ancho flexible restante.
   Las demás columnas conservan el espacio necesario (min-width en el HTML)
   y la tabla usa layout auto para que Producto absorba el ancho libre. */
#salesItemsTable {
    table-layout: fixed;
    width: 100%;
}
#salesItemsTable .pe-product-name {
    width: 100%;
    min-width: 0;
}
#salesItemsTable [data-picker-wrap] {
    width: 100%;
}
/* Columna Producto: flexible, absorbe el espacio no ocupado por las demás. */
#salesItemsTable td:nth-child(2) {
    width: auto;
    max-width: none;
}
/* PRODUCTO nunca debe colapsar a 0px en viewports pequeños. Con
   table-layout:fixed el algoritmo IGNORA min-width (los anchos salen del
   width de las celdas de la primera fila), así que en móvil se fija un width
   explícito SOLO < 992px: la tabla crece a ~1012px y .pe-table-wrap conserva
   el scroll horizontal; PRODUCTO queda con ~180px útiles y no se superpone
   con CANTIDAD. En escritorio la columna sigue siendo flexible (width:auto). */
@media (max-width: 991.98px) {
    #salesItemsTable th:nth-child(2),
    #salesItemsTable td:nth-child(2) {
        width: 180px;
    }
}
/* Compactar input-group para que la lupa quede pegada al input. */
#salesItemsTable .input-group {
    flex-wrap: nowrap;
}
/* PRECIO (col 6): ancho suficiente para 4 decimales sin truncar (34.2857).
   El input numérico no se comprime por el contenido de otras columnas. */
#salesItemsTable td:nth-child(6) {
    width: 5rem;
}
#salesItemsTable .item-price {
    min-width: 0;
    font-variant-numeric: tabular-nums;
}
/* Total (col 9): ancho estable para valores con 4 decimales. */
#salesItemsTable td:nth-child(9) {
    white-space: nowrap;
    width: 4.25rem;
}
/* CANTIDAD (col 3) con espacio cómodo para editar con decimales;
   DESCUENTO (col 8) igual que PRECIO. */
#salesItemsTable td:nth-child(3) {
    width: 4.75rem;
}
#salesItemsTable td:nth-child(8) {
    width: 4.25rem;
}
#salesItemsTable .item-qty,
#salesItemsTable .item-discount,
#salesItemsTable .item-discount-percent {
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

/* VENTAS — Compactar ligeramente el espacio horizontal de la tabla de líneas.
   Con table-layout: fixed los anchos se definen en los <th> (primera fila);
   PRODUCTO queda sin ancho explícito y absorbe el espacio sobrante. Aquí solo
   se reduce el padding lateral de celdas. No cambia orden, nombres, alturas
   ni funcionalidad. */
#salesItemsTable th,
#salesItemsTable td {
    padding-left: .25rem;
    padding-right: .25rem;
}
#salesItemsTable td:nth-child(1),
#salesItemsTable td:nth-child(4),
#salesItemsTable td:nth-child(5),
#salesItemsTable td:nth-child(9),
#salesItemsTable td:nth-child(11) {
    white-space: nowrap;
}
#salesItemsTable .item-qty,
#salesItemsTable .item-discount,
#salesItemsTable .item-discount-percent,
#salesItemsTable .item-price {
    width: 100%;
}

/* Campos informativos de la línea de producto (CÓDIGO, U.M., MARCA, TOTAL):
   área delimitada con el borde gris claro estándar del formulario, visible
   incluso cuando aún no hay producto seleccionado. Solo lectura (no inputs). */
#salesItemsTable .pe-info-cell {
    display: block;
    border: 1px solid #d3d9de;
    border-radius: .25rem;
    padding: .25rem .35rem;
    min-height: calc(1.5em + .5rem + 2px); /* misma altura que form-control-sm */
    background: #ffffff;
    color: #20242b;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#salesItemsTable .pe-info-cell:empty::before {
    content: '\00a0'; /* conserva el área aunque esté vacío */
}

/* CÓDIGO (col 1, 114px fija): optimización visual SOLO del código de barras.
   Quita la negrita (pe-cell-strong), fija 12px, reduce el padding horizontal y
   elimina el borde (no es editable) para que códigos de 11-13 caracteres entren
   sin truncar, SIN cambiar el ancho de la columna ni afectar a las demás celdas
   informativas (U.M., MARCA, TOTAL) que comparten .pe-info-cell. Se conserva el
   ellipsis como respaldo si el contenido no cabe. */
#salesItemsTable .item-code {
    font-weight: 400;
    font-size: 12px;
    padding: .25rem .15rem;
    border: none;
}

/* Totales: encabezado sobrio (fondo gris muy claro, título e icono en verde
   institucional) y cajas con borde. Mismo lenguaje visual que las demás
   secciones del formulario, sin el peso del fondo verde sólido. */
.pe-totals-title {
    background: #f8f9fa;
    color: var(--pe-success, #198754);
    border: 1px solid var(--pe-border, #dee2e6);
    border-bottom: none;
    border-radius: .25rem .25rem 0 0;
    padding: .35rem .6rem;
    margin-bottom: 0;
}
/* Vence a .pe-section-slim .pe-form-section-title (margin-bottom .3rem) para
   que el encabezado gris y el contenedor de totales formen un único bloque
   sin franja blanca entre ambos. */
.pe-section-slim .pe-totals-title,
.pe-totals-title.pe-form-section-title {
    margin-bottom: 0;
}
.pe-totals-title i { color: var(--pe-success, #198754); }

.pe-totals-box {
    border: 1px solid var(--pe-border, #dee2e6);
    border-top: none;
    border-radius: 0 0 .25rem .25rem;
    background: #f8f9fa;
    padding: .45rem .6rem;
}
.pe-totals-row { margin: 0; }
.pe-total-box {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    background: #fff;
    border: 1px solid var(--pe-border, #ced4da);
    border-radius: .3rem;
    padding: .3rem .5rem;
    height: 100%;
    min-height: 3.2rem;
    justify-content: center;
}
.pe-total-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--pe-muted, #6c757d);
}
.pe-total-value {
    font-size: 1rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--pe-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}
.pe-total-box-main {
    border: 2px solid var(--pe-success, #198754);
    background: var(--pe-success-bg, #f2fbf4);
}
.pe-total-value-main {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--pe-success, #198754);
}
/* Detalle de venta — totales compactos: los bloques usan las cajas estándar
   del ERP (pe-total-box) y quedan como continuación natural de la tabla. */
.pe-detail-totals .pe-total-box {
    min-height: 2.6rem;
    padding: .3rem .6rem;
}

/* ==========================================================================
   VENTAS / FORMULARIOS — Encabezado compacto estándar (form_header)
   ========================================================================== */
.pe-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--pe-border, #dee2e6);
}
.pe-form-header .pe-breadcrumb-inline {
    margin: 0;
    font-size: .82rem;
}
.pe-form-header .pe-breadcrumb-inline .current {
    font-size: .95rem;
    font-weight: 700;
    color: var(--pe-text, #212529);
}
/* Formulario de Ventas: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-sales-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Unidades de Medida: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-units-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Impuestos: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-taxes-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Impuestos: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-taxes-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Grupos de Clientes: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-customer-groups-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Condiciones de Pago: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-payment-terms-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Formas de Pago: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-payment-methods-form .pe-form-header {
    border-bottom: none;
}

/* Configuración de Facturación Electrónica: se elimina la línea inferior del
   encabezado (debajo del breadcrumb), sin afectar otros formularios. El
   espaciado se conserva (patrón de Ventas/Unidades/Impuestos). */
.pe-electronic-config .pe-form-header {
    border-bottom: none;
}

/* Configuración de Empresa (company): se elimina la línea inferior del
   encabezado (debajo del breadcrumb), sin afectar otros formularios. El
   espaciado se conserva (mismo patrón de Ventas/FE/Unidades/Impuestos). */
.pe-company-settings .pe-form-header {
    border-bottom: none;
}

/* Formulario de Cajas: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-cash-registers-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Conceptos de Caja: se elimina la línea inferior del encabezado
   (debajo del breadcrumb), sin afectar otros formularios. El espaciado se
   conserva (misma regla visual que Nueva Forma de Pago). */
.pe-cash-movement-categories-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Locales: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-branches-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Almacenes: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-warehouses-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Series de Documento: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-document-series-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Proveedores: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-suppliers-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Tipos de Cambio: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-exchange-rates-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Transportistas: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-transportistas-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Choferes: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-choferes-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Vehículos: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-vehiculos-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Clientes: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-customers-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Vendedores: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-vendors-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Marcas: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-brands-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Categorías: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-categories-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Productos: se elimina la línea inferior del encabezado (debajo
   del breadcrumb), sin afectar otros formularios. El espaciado se conserva. */
.pe-products-form .pe-form-header {
    border-bottom: none;
}

/* Formulario de Usuarios (alta/edición/contraseña/restauración): se elimina la
   línea inferior del encabezado (debajo del breadcrumb), sin afectar otros
   formularios. El espaciado se conserva (misma regla visual que Nueva Forma de
   Pago). */
.pe-users-form .pe-form-header {
    border-bottom: none;
}

/* ==========================================================================
   PILOTO VISUAL — LISTADO DE VENTAS (SALES_MODULE_DESIGN)
   Aislado al módulo Ventas (pe-sales-index). Estándar futuro de listados:
   compacto pero cómodo. NO afecta otros módulos.
   ========================================================================== */
.pe-sales-index {
    /* Contenido ocupa el ancho disponible; sin reducir el layout general. */
    max-width: 1320px;
    /* Subir el encabezado hacia el navbar superior (compensa parte del
       padding superior de .pe-main, que es 1.5rem). Solo en este listado. */
    margin-top: -.9rem;
}

/* ==========================================================================
   ENCABEZADO ESTÁNDAR DE LISTADOS CRUD (pe-index-head)
   Patrón aprobado en Ventas, reutilizable por todos los módulos:
   [Título] [Descripción] [+ Acción] en UNA sola línea, sin breadcrumb.
   ========================================================================== */
.pe-index-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}
.pe-index-head .pe-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    white-space: nowrap;
}
.pe-index-head .pe-subtitle {
    margin: 0;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pe-index-new-btn {
    margin-left: auto;
    font-size: .8rem;
}

/* Página de listado estándar (módulos CRUD): encabezado próximo al navbar y
   tarjeta compacta, replicando el patrón aprobado de Ventas. */
.pe-index-page {
    margin-top: -.9rem;
}
.pe-index-page .pe-card-body {
    padding: .9rem 1rem;
}
/* Encabezado: título + descripción + botón en UNA sola línea, centrados
   verticalmente. Sin breadcrumb ("Inicio /" eliminado). */
.pe-sales-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}
.pe-sales-head .pe-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    white-space: nowrap;
}
.pe-sales-head .pe-subtitle {
    margin: 0;
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Botones de acción del encabezado de Ventas (a la derecha, centrados
   verticalmente, altura estándar). Ambos con el MISMO ancho. */
.pe-sales-new-btn {
    margin-left: auto;
    font-size: .8rem;
    width: 220px;
    text-align: center;
    white-space: nowrap;
}
/* Botón "Nueva Nota de Crédito": se agrupa a la derecha de "+ Nueva Venta"
   con una separación horizontal pequeña (anula el margin-left:auto que
   empujaba ambos botones a los extremos). */
.pe-sales-new-btn-nc {
    margin-left: .5rem;
}
/* Tarjeta principal: padding más compacto. */
.pe-sales-index .pe-card-body {
    padding: .9rem 1rem;
}
/* Filtros: controles próximos, menos espacio vacío. */
.pe-sales-filters {
    --bs-gutter-x: .5rem;
}
.pe-sales-filters .form-label {
    margin-bottom: .12rem;
}
/* Filtros del listado de Productos: mismo patrón compacto de Ventas y
   tipografía estándar .8rem (12.8px) en los controles de filtro. */
.pe-products-filters {
    --bs-gutter-x: .5rem;
}
.pe-products-filters .form-label {
    margin-bottom: .12rem;
    font-size: .8rem;
}
.pe-products-filters .form-control-sm,
.pe-products-filters .form-select-sm {
    font-size: .8rem;
}
/* Texto secundario dentro de una celda (p. ej. código interno en SKU, o la
   línea "Marca · U.M" bajo el nombre del producto): más pequeño y discreto. */
.pe-cell-sub {
    margin-top: .15rem;
    font-size: .82em;
    color: var(--pe-text-muted);
}

/* ==========================================================================
   PILOTO — TABLA ADAPTATIVA CONSULTA DE PRODUCTOS (solo esta tabla).
   Mismo criterio validado en las demás consultas: table-layout fixed +
   porcentajes, compactación por ancho real (container queries), Marca y U.M.
   integradas dentro de NOMBRE, acciones [Ver][Editar][⋮]. Sin sticky, sin
   ocultar columnas adicionales.
   ========================================================================== */
.pe-products-index .pe-products-table-container {
    container-type: inline-size;
}
.pe-products-index .pe-products-table-container .pe-table {
    table-layout: fixed;
    width: 100%;
}
/* Distribución (9 columnas; se eliminaron visualmente Marca y Unidad).
   Prioridad: SKU, Nombre, Stock, Estado y Acciones. */
.pe-products-index .pe-products-table-container .pe-table th:nth-child(1),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(1) { width: 12%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(2),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(2) { width: 10%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(3),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(3) { width: 24%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(4),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(4) { width: 6%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(5),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(5) { width: 8%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(6),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(6) { width: 8%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(7),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(7) { width: 11%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(8),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(8) { width: 9%; }
.pe-products-index .pe-products-table-container .pe-table th:nth-child(9),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(9) { width: 12%; }
/* SKU, Moneda, Precios, Stock y Estado: una línea (contenido corto). */
.pe-products-index .pe-products-table-container .pe-table td:nth-child(1),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(4),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(5),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(6),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(7),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(8) {
    white-space: nowrap;
}
/* Categoría: ellipsis si el ancho no alcanza (title/tooltip conserva el
   contenido). */
.pe-products-index .pe-products-table-container .pe-table td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* NOMBRE: la primera línea (nombre) puede ocupar dos líneas; la segunda
   (Marca · U.M) es secundaria y también puede envolver. Sin ellipsis. */
.pe-products-index .pe-products-table-container .pe-table td:nth-child(3) {
    white-space: normal;
    overflow-wrap: break-word;
}
/* Compactación progresiva por ancho del CONTENEDOR. */
@container (max-width: 1250px) {
    .pe-products-index .pe-products-table-container .pe-table th,
    .pe-products-index .pe-products-table-container .pe-table td {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}
@container (max-width: 1050px) {
    .pe-products-index .pe-products-table-container .pe-table th,
    .pe-products-index .pe-products-table-container .pe-table td {
        padding-left: .4rem;
        padding-right: .4rem;
        font-size: 11.5px;
    }
}
@container (max-width: 850px) {
    .pe-products-index .pe-products-table-container .pe-table th,
    .pe-products-index .pe-products-table-container .pe-table td {
        padding-left: .3rem;
        padding-right: .3rem;
    }
}
/* Acciones: padding ajustado (sin reducir el tamaño de los botones). */
.pe-products-index .pe-products-table-container .pe-table th:nth-child(9),
.pe-products-index .pe-products-table-container .pe-table td:nth-child(9) {
    padding-left: .35rem;
    padding-right: .35rem;
}
/* Separación vertical entre la fila de botones ("Más filtros") y la tabla de
   resultados: misma densidad visual que el listado de Ventas. */
.pe-products-index .pe-table-wrap {
    margin-top: .9rem;
}
/* Tabla: celdas con padding moderado (sin apretar) para aprovechar el ancho.
   Separación pequeña y equilibrada respecto a la fila de filtros.
   Padding vertical de FILA alineado al estándar global compacto (.35rem,
   mismo criterio que Cuentas por Cobrar); el encabezado conserva su altura. */
.pe-sales-index .pe-table td {
    padding: .35rem .6rem;
}
.pe-sales-index .pe-table th {
    padding: .5rem .6rem;
}

/* ==========================================================================
   PILOTO — TABLA ADAPTATIVA (SOLO Consulta de Cotizaciones).
   La tabla ocupa el ancho REAL del contenedor y se compacta progresivamente.
   Con table-layout: fixed los anchos/porcentajes SÍ se respetan: en auto
   layout el contenido DRAFT nowrap fuerza el ancho de la columna e ignora
   width/max-width. NO oculta columnas, NO usa sticky; el scroll horizontal
   de .pe-table-wrap queda SOLO como último recurso.
   ========================================================================== */
.pe-quotes-index .pe-quotes-table-container {
    container-type: inline-size;
}
.pe-quotes-index .pe-quotes-table-container .pe-table {
    table-layout: fixed;
    width: 100%;
}
/* Distribución proporcional de columnas (9 columnas; Vendedor integrado en
   Cliente). N.º al 12% (el espacio adicional se obtiene de VIGENCIA 6%; ATENCIÓN
   conserva 10%) para que los números definitivos (C001-...) NUNCA se trunquen;
   los DRAFT se muestran ya en formato corto (DRAFT-{sufijo}). */
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(1),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(1) { width: 12%; min-width: 0; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(2),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(2) { width: 8%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(3),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(3) { width: 23%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(4),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(4) { width: 16%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(5),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(5) { width: 9%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(6),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(6) { width: 6%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(7),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(7) { width: 9%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(8),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(8) { width: 10%; }
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(9),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(9) { width: 7%; }
/* N.º: UNA sola línea, NUNCA truncado (los números definitivos y los DRAFT
   cortos caben completos; sin ellipsis). */
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(1) {
    white-space: nowrap;
}
/* Asunto: ellipsis cuando el ancho no alcanza; el title/tooltip conserva el
   contenido. */
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(4) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* CLIENTE: NUNCA ellipsis ni nowrap; el nombre puede ocupar varias líneas
   (wrapping normal). Solo se corta una palabra extremadamente larga si es
   imprescindible (overflow-wrap: break-word), sin break-all general. */
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(3) {
    white-space: normal;
    overflow-wrap: break-word;
}
/* Vendedor integrado dentro de la celda Cliente: línea secundaria, más
   pequeña y discreta que el nombre del cliente. */
.pe-quotes-index .pe-quotes-table-container .pe-cell-vendor {
    margin-top: .15rem;
    font-size: .82em;
    color: var(--pe-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Compactación progresiva según el ancho del CONTENEDOR. */
@container (max-width: 1200px) {
    .pe-quotes-index .pe-quotes-table-container .pe-table th,
    .pe-quotes-index .pe-quotes-table-container .pe-table td {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}
@container (max-width: 1000px) {
    .pe-quotes-index .pe-quotes-table-container .pe-table th,
    .pe-quotes-index .pe-quotes-table-container .pe-table td {
        padding-left: .4rem;
        padding-right: .4rem;
        font-size: 11.5px;
    }
}
@container (max-width: 820px) {
    .pe-quotes-index .pe-quotes-table-container .pe-table th,
    .pe-quotes-index .pe-quotes-table-container .pe-table td {
        padding-left: .3rem;
        padding-right: .3rem;
    }
}
/* Ajuste fino: reducir el espacio sobrante alrededor de los badges de ATENCIÓN
   y de los botones de ACCIONES (sin cambiar su tamaño). Se declara al final
   para vencer al padding genérico de los container queries. */
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(8),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(8),
.pe-quotes-index .pe-quotes-table-container .pe-table th:nth-child(9),
.pe-quotes-index .pe-quotes-table-container .pe-table td:nth-child(9) {
    padding-left: .35rem;
    padding-right: .35rem;
}
.pe-sales-index .pe-table-wrap {
    margin-top: .9rem;
}

/* ==========================================================================
   PILOTO — TABLA ADAPTATIVA CONSULTA DE GUÍAS DE REMISIÓN (solo esta tabla).
   Mismo criterio validado en Cotizaciones: table-layout fixed + porcentajes,
   compactación por ancho real del contenedor (container queries), DRAFT corto,
   acciones [Ver][⋮], DESTINO con prioridad de ancho y wrapping. Sin sticky,
   sin ocultar columnas, sin reducir controles.
   ========================================================================== */
.pe-guides-index .pe-guides-table-container {
    container-type: inline-size;
}
.pe-guides-index .pe-guides-table-container .pe-table {
    table-layout: fixed;
    width: 100%;
}
/* Distribución de columnas de Guías (10 columnas; prioridad: N.º de guía,
   DESTINO, Factura/Boleta y estados). DESTINO (20%) es la de mayor prioridad. */
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(1),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(1) { width: 4%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(2),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(2) { width: 13%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(3),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(3) { width: 12%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(4),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(4) { width: 8%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(5),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(5) { width: 20%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(6),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(6) { width: 8%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(7),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(7) { width: 7%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(8),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(8) { width: 10%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(9),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(9) { width: 10%; }
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(10),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(10) { width: 8%; }
/* N.º de guía y Factura/Boleta: UNA línea, sin truncar (los definitivos caben;
   los DRAFT ya se muestran cortos). */
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(2),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(3) {
    white-space: nowrap;
}
/* Local y Motivo: ellipsis cuando el ancho no alcanza (title/tooltip conserva
   el contenido). */
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(6),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(7) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* DESTINO: prioridad de ancho, NUNCA ellipsis; puede ocupar varias líneas. */
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(5) {
    white-space: normal;
    overflow-wrap: break-word;
}
/* Fecha, Estado y Estado SUNAT: una línea (badges intactos). */
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(4),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(8),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(9) {
    white-space: nowrap;
}
/* Compactación progresiva por ancho del CONTENEDOR. */
@container (max-width: 1250px) {
    .pe-guides-index .pe-guides-table-container .pe-table th,
    .pe-guides-index .pe-guides-table-container .pe-table td {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}
@container (max-width: 1050px) {
    .pe-guides-index .pe-guides-table-container .pe-table th,
    .pe-guides-index .pe-guides-table-container .pe-table td {
        padding-left: .4rem;
        padding-right: .4rem;
        font-size: 11.5px;
    }
}
@container (max-width: 850px) {
    .pe-guides-index .pe-guides-table-container .pe-table th,
    .pe-guides-index .pe-guides-table-container .pe-table td {
        padding-left: .3rem;
        padding-right: .3rem;
    }
}
/* Acciones: padding ajustado (sin reducir los botones Ver/⋮). */
.pe-guides-index .pe-guides-table-container .pe-table th:nth-child(10),
.pe-guides-index .pe-guides-table-container .pe-table td:nth-child(10) {
    padding-left: .35rem;
    padding-right: .35rem;
}
/* PRUEBA VISUAL — tabla de Ventas (estilo de tablas del ERP):
   - Filas de datos con fondo BLANCO (limpio, ligero).
   - Encabezado verde (se conserva el aprobado).
   - Hover con verde MUY SUAVE relacionado al encabezado.
   - Botones de acción diferenciados por función con tonos suaves. */
.pe-sales-index .pe-table tbody td {
    background: #ffffff;
    border-color: var(--pe-border, #e3e8e5);
}
.pe-sales-index .pe-table tbody tr:hover td,
.pe-sales-index .pe-table tbody tr:hover {
    background: #eef7f1; /* verde muy suave (relacionado al encabezado verde) */
}
.pe-sales-index .pe-table tbody tr:last-child td {
    border-bottom: 1px solid var(--pe-border, #e3e8e5);
}
/* Botones de acción: tonos suaves y funcionales (referencia imagen). */
.pe-sales-index .pe-row-actions .pe-icon-btn {
    color: #2060a6;              /* tono azul suave (Editar) */
    border-color: #d5e2f0;
    background: #eef4fb;
}
.pe-sales-index .pe-row-actions .pe-icon-btn:hover {
    background: #dbeaf8;
    border-color: #2060a6;
}
/* Visualizar: tono neutro/azul muy claro (distinto de Editar). */
.pe-sales-index .pe-row-actions .pe-icon-btn-view {
    color: #6b7280;              /* tono neutro */
    border-color: #e2e6ea;
    background: #f7f8fa;
}
.pe-sales-index .pe-row-actions .pe-icon-btn-view:hover {
    background: #edf1f4;
    border-color: #6b7280;
}
/* Confirmar: verde suave. */
.pe-sales-index .pe-row-actions .pe-icon-btn-state {
    color: #17854e;
    border-color: #d2e8da;
    background: #eef7f1;
}
.pe-sales-index .pe-row-actions .pe-icon-btn-state:hover {
    background: #dcf0e4;
    border-color: #17854e;
}
/* Pie: paginación con menos separación vertical. */
.pe-sales-index .pagination {
    margin-top: .75rem;
    margin-bottom: .25rem;
}

/* Tabla de Cuentas por Cobrar: compacta y sin scroll horizontal.
   Reduce el padding de celdas (encabezado y filas) y fija el ancho de la
   columna de Acciones para que sus botones siempre queden visibles a la
   derecha sin necesidad de desplazarse. No cambia la información. */
.pe-receivables-index .pe-table td,
.pe-receivables-index .pe-table th {
    padding: .35rem .4rem;
    white-space: nowrap;
}
.pe-receivables-index .pe-receivables-table-wrap {
    overflow-x: auto;
    margin-top: .75rem;
}
.pe-receivables-index .pe-receivables-table th.pe-receivables-actions-col,
.pe-receivables-index .pe-receivables-table td.pe-receivables-actions-col {
    width: 96px;
    min-width: 96px;
    text-align: left;
    white-space: nowrap;
}
.pe-receivables-index .pe-receivables-table .pe-row-actions {
    display: inline-flex;
    gap: .3rem;
    justify-content: flex-start;
    white-space: nowrap;
}
.pe-receivables-index .pe-receivables-table .pe-cell-mono {
    font-variant-numeric: tabular-nums;
}
/* CxC / CxP — columna TIPO compacta (100px en la vista): permite WRAPPING
   natural del texto ("Boleta de / venta", "Nota de crédito de / boleta").
   No se fija un ancho grande para forzar una sola línea; el badge conserva
   su diseño (tamaño, colores, padding). */
.pe-receivables-index .pe-receivables-table th:first-child,
.pe-receivables-index .pe-receivables-table td:first-child {
    white-space: normal;
    overflow-wrap: break-word;
}
/* CxC / CxP — CLIENTE (y Proveedor en CxP): nombre COMPLETO en hasta dos
   líneas, sin ellipsis ni nowrap. Reemplaza el truncado de
   .pe-consult-cell-trunc-wrap dentro de esta tabla. */
.pe-receivables-index .pe-receivables-table td:nth-child(3) {
    white-space: normal;
    overflow-wrap: break-word;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}
/* Texto del cliente: truncado con ellipsis para no ensanchar la tabla. */
.pe-receivables-index .pe-consult-cell-trunc-wrap {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Tarjetas de estado del encabezado de la consulta (por cobrar / NC). */
.pe-receivables-index .pe-receivables-status .pe-badge {
    font-size: 12px;
    padding: .3rem .55rem;
    white-space: nowrap;
}
/* Cobranza multi-pago: lista de pagos agregados. */
.pe-receivables-pay-item {
    border: 1px solid var(--pe-border, #e3e8e0);
    border-radius: 8px;
    padding: .3rem .55rem;
    background: #ffffff;
    margin-bottom: .35rem;
    gap: .75rem;
}
.pe-receivables-pay-summary {
    border-top: 1px solid var(--pe-border, #e3e8e0);
    padding-top: .5rem;
    font-size: 13px;
}
.pe-receivables-balance-label {
    font-size: 13px;
    color: var(--pe-text, #1d2733);
}
.pe-receivables-apply-customer {
    font-size: 13px;
    color: var(--pe-text, #1d2733);
}

/* Detalle de cuenta por cobrar: resumen compacto en cuadrícula, con la
   etiqueta en la primera línea y el valor debajo de cada una.
   Fila 1: Documento y Cliente (mitad de ancho cada uno).
   Fila 2: Moneda, Monto, Pagado y Saldo (cuarto de ancho cada uno). */
.pe-receivables-detail-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem .75rem;
    padding: .6rem;
    border: 1px solid var(--pe-border, #e3e8e0);
    border-radius: 8px;
    background: #f7f9f7;
}
.pe-receivables-detail-item {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}
.pe-receivables-detail-row .pe-receivables-detail-item:nth-child(1),
.pe-receivables-detail-row .pe-receivables-detail-item:nth-child(2) {
    grid-column: span 2;
}
.pe-receivables-detail-label {
    font-size: .72rem;
    color: var(--pe-text-muted, #6c757d);
    font-weight: 600;
}
.pe-receivables-detail-value {
    font-size: .82rem;
    font-weight: 600;
    color: #20242b;
    overflow-wrap: anywhere;
}

/* Resumen de totales del listado de Ventas (pe-list-totals): muestra la
   sumatoria y el desglose por tipo de documento, respetando el signo de cada
   documento (las NC son negativas) y los filtros de la consulta. Los totales
   se agrupan POR MONEDA: se muestra un bloque por moneda (PEN/USD) y nunca se
   mezclan ni convierten monedas en un mismo total. */
.pe-sales-index .pe-totals-summary,
.pe-receivables-index .pe-totals-summary {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}
.pe-sales-index .pe-totals-summary-inner,
.pe-receivables-index .pe-totals-summary-inner {
    min-width: 340px;
    border: 1px solid var(--pe-border, #e3e8e0);
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
}
.pe-sales-index .pe-totals-currency,
.pe-receivables-index .pe-totals-currency {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--pe-border, #e3e8e0);
    background: #f7f9f7;
}
.pe-sales-index .pe-totals-currency-label,
.pe-receivables-index .pe-totals-currency-label {
    font-size: .85rem;
    font-weight: 700;
    color: #20242b;
    letter-spacing: .02em;
}
.pe-sales-index .pe-totals-currency-name,
.pe-receivables-index .pe-totals-currency-name {
    font-size: .72rem;
    color: var(--pe-text-muted, #6c757d);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.pe-sales-index .pe-totals-grid,
.pe-receivables-index .pe-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--pe-border, #e3e8e0);
}
.pe-sales-index .pe-totals-cell,
.pe-receivables-index .pe-totals-cell {
    padding: .5rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    border-right: 1px solid var(--pe-border, #e3e8e0);
}
.pe-sales-index .pe-totals-cell:last-child,
.pe-receivables-index .pe-totals-cell:last-child { border-right: none; }
.pe-sales-index .pe-totals-label,
.pe-receivables-index .pe-totals-label {
    font-size: .72rem;
    color: var(--pe-text-muted, #6c757d);
    font-weight: 600;
}
.pe-sales-index .pe-totals-value,
.pe-receivables-index .pe-totals-value {
    font-family: var(--pe-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: .85rem;
    color: #20242b;
    font-weight: 600;
}
.pe-sales-index .pe-totals-total,
.pe-receivables-index .pe-totals-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .75rem;
}
.pe-sales-index .pe-totals-total .pe-totals-label,
.pe-receivables-index .pe-totals-total .pe-totals-label {
    font-size: .8rem;
    font-weight: 700;
}
.pe-sales-index .pe-totals-total-value,
.pe-receivables-index .pe-totals-total-value {
    font-size: 1rem;
    color: var(--pe-success, #198754);
}


/* ==========================================================================
   PRUEBA DE COLORES — FORMULARIO DE VENTAS (pe-sales-form)
   Aislado a Ventas. Estandariza colores de controles y botones:
   - Inputs/selects: fondo blanco, borde gris claro, texto oscuro.
   - Botones internos (NUEVO/EDITAR/Agregar línea): uva/morado sobrio.
   - Lupas/búsqueda: gris muy claro + verde institucional.
   - Guardar/Emitir: verde (se mantiene).
   - Guardar como borrador: blanco + azul noche.
   - Cancelar: blanco + rojo.
   ========================================================================== */
.pe-sales-form input,
.pe-sales-form textarea {
    background: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-sales-form select {
    background-color: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-sales-form input:disabled,
.pe-sales-form select:disabled,
.pe-sales-form textarea:disabled {
    background: #f2f3f5;   /* deshabilitado real: se diferencia del habilitado */
    color: #9aa3ac;
}
/* PRUEBA TIPOGRÁFICA (solo Ventas): inputs/selects/textareas a .8rem (12.8px),
   igual que los labels, para una apariencia más compacta y uniforme. Se
   conserva font-family Inter y los valores de line-height/padding/altura. */
.pe-sales-form input,
.pe-sales-form select,
.pe-sales-form textarea {
    font-size: .8rem;
}
.pe-sales-form .pe-search-control > i {
    font-size: .8rem;
}
.pe-sales-form .pe-search > i {
    color: #17854e;        /* icono de búsqueda en verde institucional */
}

/* Botones internos de operación: púrpura Odoo sobrio (#875A7B) para las
   acciones de trabajo (+ NUEVO, + Agregar línea). EDITAR permanece en
   blanco (outline) para no generar dos botones uva juntos. */
.pe-sales-form #btnNewCustomer,
.pe-sales-form #addItemBtn,
.pe-sales-form .btn-grape {
    background: #875A7B;
    border-color: #875A7B;
    color: #ffffff;
}
.pe-sales-form #btnNewCustomer:hover,
.pe-sales-form #addItemBtn:hover,
.pe-sales-form .btn-grape:hover {
    background: #704A67;
    border-color: #704A67;
    color: #ffffff;
}
.pe-sales-form #btnNewCustomer i,
.pe-sales-form #addItemBtn i,
.pe-sales-form .btn-grape i {
    color: #ffffff;
}

/* Lupas de búsqueda (Buscar cliente / Buscar producto): icono integrado en
   el input, con fondo transparente (el fondo blanco lo da el input) y color
   verde institucional. Ya no son botones: el fondo blanco es uniforme. */
.pe-sales-form #btnPickCustomer,
.pe-sales-form [data-pick-product] {
    background: transparent;
    color: #17854e;
}
.pe-sales-form #btnPickCustomer:hover,
.pe-sales-form [data-pick-product]:hover {
    background: transparent;
    color: #0f6b3a;
}

/* ==========================================================================
   COMPONENTE REUTILIZABLE — CONTROL DE BÚSQUEDA INTEGRADO (pe-search-control)
   Un único input con el icono de lupa integrado a la derecha (estilo Odoo).
   El input usa la MISMA clase form-control-sm del resto de controles del ERP
   (no se fuerza font-size/line-height), por lo que hereda exactamente su
   altura y tipografía estándar. El fondo es BLANCO en toda la superficie; el
   icono no tiene zona gris y no sobresale del input.
   Uso:
     <div class="pe-search-control">
       <input type="text" class="form-control form-control-sm" ...>
       <i class="fa-solid fa-magnifying-glass" data-... role="button" tabindex="0"></i>
     </div>
   ========================================================================== */
.pe-search-control {
    position: relative;
    display: block;
}
.pe-search-control > .form-control {
    padding-right: 1.75rem;       /* espacio para el icono integrado */
}
.pe-search-control > i {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #17854e;               /* verde institucional */
    font-size: .8rem;
    cursor: pointer;
    z-index: 2;
    background: transparent;      /* sin zona gris detrás del icono */
}
.pe-search-control > i:hover {
    color: #0f6b3a;
}

/* Botón "Buscar" dentro de modales de búsqueda: gris claro + verde.
   Se define a nivel global porque los modales SweetAlert2 viven en body. */
.btn-search {
    background: #f3f4f6;
    border-color: #cbd2d8;
    color: #17854e;
}
.btn-search i {
    color: #17854e;
}
.btn-search:hover {
    background: #e9edf0;
    border-color: #17854e;
}
.pe-sales-form .btn-search {
    background: #f3f4f6;
    border-color: #cbd2d8;
    color: #17854e;
}
.pe-sales-form .btn-search:hover {
    background: #e9edf0;
    border-color: #17854e;
}

/* Guardar como borrador: blanco + azul noche. */
.pe-sales-form button[name="action"][value="draft"] {
    background: #ffffff;
    border-color: #cbd2d8;
    color: #1e2a5a;            /* azul noche */
}
.pe-sales-form button[name="action"][value="draft"] i {
    color: #1e2a5a;
}
.pe-sales-form button[name="action"][value="draft"]:hover {
    background: #f2f4fb;
    border-color: #1e2a5a;
}

/* Cancelar: blanco + rojo. */
.pe-sales-form .pe-form-actions a.btn-outline-secondary {
    background: #ffffff;
    border-color: #cbd2d8;
    color: #c94a3e;
}
.pe-sales-form .pe-form-actions a.btn-outline-secondary i {
    color: #c94a3e;
}
.pe-sales-form .pe-form-actions a.btn-outline-secondary:hover {
    background: #fbecea;
    border-color: #c94a3e;
}

/* ==========================================================================
   IMPORTACIONES — FORMULARIO (Nueva importación)
   Alineado al estándar visual aprobado de Ventas. Aislado al módulo
   Importaciones (pe-imports-form) hasta su aprobación visual.
   ========================================================================== */
/* Tipografía: inputs/selects/textareas a .8rem (12.8px), igual que labels.
   La regla global (.pe-card-body form[method="post"]) ya lo cubre; aquí se
   refuerza dentro del scope del formulario de importaciones. */
.pe-imports-form input:not([type="checkbox"]):not([type="radio"]),
.pe-imports-form select,
.pe-imports-form textarea {
    font-size: .8rem;
}
/* Selects: fondo blanco SIN pisar la flecha nativa de Bootstrap. */
.pe-imports-form select {
    background-color: #ffffff;
    border-color: #d3d9de;
    color: #20242b;
}
.pe-imports-form select:disabled {
    background-color: #f2f3f5;
    color: #9aa3ac;
}
/* Inputs number: se elimina el spinner nativo (estándar ERP). El control
   sigue siendo type="number" y acepta valores decimales. */
.pe-imports-form input[type="number"]::-webkit-inner-spin-button,
.pe-imports-form input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pe-imports-form input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
/* Campos informativos de la línea (UNIDAD, AD-VALOREM, TOTAL): área con
   borde visible aunque estén vacíos o sean de solo lectura (patrón Ventas). */
.pe-imports-form .pe-info-cell {
    display: block;
    border: 1px solid #d3d9de;
    border-radius: .25rem;
    padding: .25rem .5rem;
    min-height: calc(1.5em + .5rem + 2px);
    background: #ffffff;
    color: #20242b;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pe-imports-form .pe-info-cell:empty::before {
    content: '\00a0';
}
/* Icono de lupa del picker de producto integrado en el input (verde). */
.pe-imports-form .pe-search-control > i {
    font-size: .8rem;
}
/* Botones uva (+ Agregar línea / + Agregar gasto). */
.pe-imports-form .btn-grape {
    background: #875A7B;
    border-color: #875A7B;
    color: #ffffff;
}
.pe-imports-form .btn-grape:hover {
    background: #704A67;
    border-color: #704A67;
    color: #ffffff;
}
.pe-imports-form .btn-grape i {
    color: #ffffff;
}
/* Proveedor seleccionado en Nueva Importación (informativo, patrón
   cliente de Ventas/GRE): misma altura y proporciones que los controles
   form-control-sm del formulario. pe-customer-data aporta el borde/fondo
   no editable; aquí solo se iguala el tamaño (padding, fuente, altura).
   Font-size .8rem = regla ERP .pe-card-body form[method="post"] que aplica
   a los demás inputs del formulario. */
.pe-imports-form #supplierCard {
    font-size: .8rem;
    line-height: 1.5;
    padding: .25rem .5rem;
    min-height: calc(1.5em + .5rem + 2px);
}
/* Mismo criterio visual que Nueva venta (aprobado): se eliminan los
   separadores horizontales entre secciones y la línea inferior del
   encabezado (breadcrumb), conservando el espaciado .9rem. */
.pe-imports-form .pe-form-section + .pe-form-section {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: none;
}
.pe-imports-form .pe-form-header {
    border-bottom: none;
}

/* Filtros del listado de Importaciones: mismo patrón compacto de Ventas y
   tipografía estándar .8rem (12.8px) en los controles de filtro. */
.pe-imports-filters {
    --bs-gutter-x: .5rem;
}
.pe-imports-filters .form-label {
    margin-bottom: .12rem;
    font-size: .8rem;
}
.pe-imports-filters .form-control-sm,
.pe-imports-filters .form-select-sm {
    font-size: .8rem;
}
/* Separación vertical entre la fila de botones ("Más filtros") y la tabla de
   resultados: misma densidad visual que el listado de Ventas. */
.pe-imports-index .pe-table-wrap {
    margin-top: .9rem;
}

/* Nueva Compra — ocultar flechas nativas (spinners) de los inputs numéricos de
   la tabla de productos. Siguen siendo type="number" (funcionalidad intacta);
   solo se elimina el control visual de aumentar/disminuir. */
#purchaseItemsTable input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
#purchaseItemsTable input[type="number"]::-webkit-outer-spin-button,
#purchaseItemsTable input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Nueva Compra — corregir el exceso de espacio horizontal en la tabla de
   productos: las reglas globales .pe-table thead th / .pe-table tbody td usan
   padding 1rem lateral y superan en especificidad a .pe-table-slim, dejando las
   celdas demasiado anchas. Aquí se reduce el padding lateral SOLO para la tabla
   de Nueva Compra, liberando espacio para PRODUCTO / COSTO UNI. / LOTE. */
#purchaseItemsTable thead th,
#purchaseItemsTable tbody td {
    padding-left: .35rem;
    padding-right: .35rem;
}

/* Nueva Compra — permitir que el encabezado VENCIMIENTO (columna 11) quede
   compacto: sin white-space:nowrap (regla global) el ancho de la columna puede
   reducirse al mínimo razonable para el campo de fecha. */
#purchaseItemsTable th:nth-child(11) {
    white-space: normal;
    line-height: 1.2;
}

/* Nueva Compra — acción [Lote] (icono) de la fila: abre el modal de edición de
   lote/vencimiento. Reutiliza el patrón pe-icon-btn de PowerERP.
   - Producto CON control de lote: celeste/azul suave (disponible).
   - Producto SIN control de lote: gris deshabilitado (no abre el modal).
   - Con lote/vencimiento cargados: punto verde indicador. */
#purchaseItemsTable .pe-lot-btn {
    width: 30px;
    height: 30px;
    position: relative;
    color: #2060a6;
    border-color: #d5e2f0;
    background: #eef4fb;
}
#purchaseItemsTable .pe-lot-btn:hover {
    color: #2060a6;
    border-color: #2060a6;
    background: #dbeaf8;
}
#purchaseItemsTable .pe-lot-btn:disabled,
#purchaseItemsTable .pe-lot-btn[disabled] {
    color: #9aa3ac;
    border-color: #e2e6ea;
    background: #f0f2f3;
    cursor: not-allowed;
}
#purchaseItemsTable .pe-lot-btn.pe-lot-has-data::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #17854e;
}

/* Nueva Compra — sin borde inferior en la tabla de líneas (mismo patrón que
   Nueva Venta): el separador visual ya existe debajo (totales). */
.pe-frames-layout #purchaseItemsTable tbody tr:last-child td {
    border-bottom: none;
}
#purchaseItemsTable {
    border-bottom: none;
}

/* Nueva Compra — distribución correcta de la tabla de productos.
   Causa raíz: con table-layout:auto los inputs imponían su ancho intrínseco a
   las columnas (VENCIMIENTO ~150px por el input date) y los width de los TH no
   se respetaban, dejando a PRODUCTO sin espacio. Mismo patrón que Nueva Venta
   (#salesItemsTable): table-layout fixed + min-width:0 en los inputs +
   PRODUCTO como columna flexible que absorbe el espacio restante. */
#purchaseItemsTable {
    table-layout: fixed;
    width: 100%;
}

#purchaseItemsTable input[type="number"],
#purchaseItemsTable input[type="text"],
#purchaseItemsTable input[type="date"] {
    min-width: 0;
    width: 100%;
}

#purchaseItemsTable [data-picker-wrap] {
    width: 100%;
}

#purchaseItemsTable .pe-product-name {
    width: 100%;
    min-width: 0;
}

/* PRODUCTO: columna flexible que absorbe el espacio liberado por las columnas
   compactas (VENCIMIENTO, COSTO U., etc.). */
#purchaseItemsTable td:nth-child(2) {
    width: auto;
    max-width: none;
}

/* ==========================================================================
   POS V1 (pantalla de venta rápida). Estilos scoped bajo .pe-pos.
   Filosofía: BUSCAR → AGREGAR → COBRAR → EMITIR. Dos zonas: productos
   (izquierda) y venta/cobro (derecha, siempre visible).
   ========================================================================== */
.pe-pos { width: 100%; max-width: 100vw; height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: #ffffff; }
.pe-pos-body-lock { overflow: hidden; }
.pe-main-fullscreen { min-height: 100vh; height: 100vh; padding: 0; margin: 0; display: flex; background: #ffffff; }
.pe-pos-body-lock { background: #ffffff; }
.pe-pos .card { border-color: var(--pe-border, #e2e6ea); border-radius: .6rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); background: #ffffff; }
/* Fondo blanco del área de trabajo del POS (variante visual). */
.pe-pos .pe-pos-body { background: #ffffff; }
.pe-pos .pe-pos-products, .pe-pos .pe-pos-cart { background: #ffffff; }
.pe-pos .pe-pos-card-products, .pe-pos .pe-pos-card-cart { background: #ffffff; }
.pe-pos .pe-pos-card-products .card-body, .pe-pos .pe-pos-card-cart .card-body { background: #ffffff; }
.pe-pos .pe-pos-cart-wrap { background: #ffffff; }
.pe-pos .pe-pos-table { background: #ffffff; }
.pe-pos .pe-pos-totals { background: #ffffff; }
.pe-pos .pe-pos-cobro { background: #ffffff; }

.pe-pos .pe-pos-header { margin-bottom: 0; border-radius: 0; background: var(--pe-sidebar-bg, #17221E); border-color: var(--pe-sidebar-bg, #17221E); border-left: 0; border-right: 0; border-top: 0; }
.pe-pos-header-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; flex-wrap: wrap; }
.pe-pos-brand { font-weight: 700; font-size: 1rem; color: #ffffff; display: flex; align-items: center; gap: .5rem; }
.pe-pos-brand i { font-size: 1.15rem; }
.pe-pos-header-info { display: flex; align-items: center; gap: .6rem; flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; }
.pe-pos-hi-item { font-size: .8rem; color: rgba(255, 255, 255, .85); display: inline-flex; align-items: center; gap: .3rem; }
.pe-pos-hi-item i { font-size: .7rem; }
.pe-pos-status-open { color: #5eead4; font-weight: 700; }
.pe-pos-status-closed { color: #fda4af; font-weight: 700; }
.pe-pos-doc, .pe-pos-vendor { width: auto; min-width: 8rem; }
.pe-pos-datetime { color: rgba(255, 255, 255, .6); }
.pe-pos-no-session { border-radius: 0 0 .6rem .6rem; }
.pe-pos-header .btn-outline-secondary { color: rgba(255, 255, 255, .85); border-color: rgba(255, 255, 255, .35); }
.pe-pos-header .btn-outline-secondary:hover { background: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .5); color: #fff; }
.pe-pos-header .btn-grape { color: #fff; }
.pe-pos-header .form-select, .pe-pos-header .form-select-sm { background-color: #ffffff; color: #20242b; }

.pe-pos-body { flex: 1 1 auto; min-height: 0; align-items: stretch; overflow: hidden; }
.pe-pos-products, .pe-pos-cart { min-width: 0; display: flex; flex-direction: column; height: 100%; }
@media (min-width: 992px) {
    /* Distribución aprobada: izquierda ~55% / derecha ~45%. */
    .pe-pos .pe-pos-products { flex: 0 0 55%; max-width: 55%; }
    .pe-pos .pe-pos-cart { flex: 0 0 45%; max-width: 45%; }
}
.pe-pos-card { flex: 1 1 auto; min-height: 0; height: auto; }
.pe-pos-card-products .card-body, .pe-pos-card-cart .card-body { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.pe-pos-card-products .card-body { padding-bottom: .5rem; }

.pe-pos-search-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.pe-pos-search { height: 46px; font-size: 1.05rem; border-radius: .5rem; width: 100%; padding-right: 48px; box-sizing: border-box; }
.pe-pos-search-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--pe-text-muted); font-size: 1.1rem; pointer-events: none; }
/* Fila buscador + botones de vista + ítem libre (misma línea). */
.pe-pos-search-row { display: flex; align-items: stretch; gap: .4rem; flex: 0 0 auto; }
.pe-pos-view-btns { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.pe-pos-view-btn { height: 46px; width: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pe-pos-view-btn.active { background: #e2f0e8; border-color: #17854e; color: #17854e; }
.pe-pos-free-item-btn { height: 46px; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
/* Categorías (filtro del modo tarjetas). */
.pe-pos-categories { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; flex: 0 0 auto; }
.pe-pos-cat-btn { border: 1px solid var(--pe-border, #e2e6ea); background: #fff; border-radius: 2rem; padding: .25rem .7rem; font-size: .75rem; color: var(--pe-text, #20242b); cursor: pointer; }
.pe-pos-cat-btn:hover { border-color: #cfe6d8; background: #f0f7f3; }
.pe-pos-cat-btn.active { background: #17854e; border-color: #17854e; color: #fff; }
/* Modo tarjetas: rejilla de tarjetas de producto. */
.pe-pos-results.pe-pos-card-results { display: block; }
.pe-pos-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.pe-pos-card { border: 1px solid var(--pe-border, #e2e6ea); border-radius: .5rem; overflow: hidden; background: #fff; cursor: pointer; display: flex; flex-direction: column; transition: border-color .12s ease, box-shadow .12s ease; }
.pe-pos-card:hover { border-color: #17854e; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.pe-pos-card-img { height: 70px; display: flex; align-items: center; justify-content: center; background: #f6f8f9; overflow: hidden; }
.pe-pos-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pe-pos-card-img-placeholder { color: var(--pe-text-muted); font-size: 1.4rem; }
.pe-pos-card-body { padding: .4rem .5rem; display: flex; flex-direction: column; gap: .15rem; min-height: 0; }
.pe-pos-card-name { font-weight: 600; font-size: .72rem; line-height: 1.15; min-height: 1.7em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pe-pos-card-meta { font-size: .62rem; color: var(--pe-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-pos-card-price { font-weight: 700; font-size: .85rem; color: var(--pe-primary, #17854e); display: flex; align-items: baseline; justify-content: space-between; gap: .35rem; }
.pe-pos-card-stock { font-size: .68rem; color: #875A7B; font-weight: 600; white-space: nowrap; }
.pe-pos-results { flex: 1 1 0%; min-height: 0; overflow-y: auto; margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.pe-pos-results-empty, .pe-pos-results-none { text-align: center; color: var(--pe-text-muted); padding: 2rem .5rem; font-size: .85rem; }
.pe-pos-results-empty i { font-size: 1.6rem; margin-bottom: .4rem; display: block; }
.pe-pos-result { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--pe-border, #e2e6ea); border-radius: .45rem; padding: .45rem .6rem; cursor: pointer; background: #fff; transition: background .12s ease, border-color .12s ease; }
.pe-pos-result:hover { background: #f0f7f3; border-color: #cfe6d8; }
.pe-pos-result-active { background: #e2f0e8; border-color: #17854e; box-shadow: 0 0 0 1px #17854e; }
.pe-pos-result-name { font-weight: 600; font-size: .85rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-pos-result-meta { font-size: .72rem; color: var(--pe-text-muted); }
.pe-pos-result-price { font-size: .9rem; font-weight: 700; color: var(--pe-primary, #17854e); white-space: nowrap; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.pe-pos-result-stock { font-size: .68rem; color: #875A7B; font-weight: 600; white-space: nowrap; }

.pe-pos-cart-body { gap: .5rem; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.pe-pos-cart-title-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex: 0 0 auto; }
.pe-pos-cart-title { font-weight: 700; font-size: .9rem; color: var(--pe-text, #20242b); }
.pe-pos-cart-title-controls { display: flex; align-items: center; gap: .4rem; }
.pe-pos-cart-title-controls .form-select { width: auto; min-width: 7rem; }
.pe-pos-cart-wrap { flex: 1 1 0%; min-height: 0; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--pe-border, #e2e6ea); border-radius: .5rem; }
.pe-pos-table { margin: 0; width: 100%; table-layout: fixed; }
.pe-pos-table th { white-space: nowrap; }
.pe-pos-table th, .pe-pos-table td { padding: .3rem .35rem; }
.pe-pos-cell-name { font-weight: 600; font-size: .78rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-pos-cell-sku { font-size: .68rem; color: var(--pe-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-pos-qty, .pe-pos-price {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
    overflow: hidden;
    text-overflow: clip;
    padding-right: .25rem;
    padding-left: .25rem;
}
.pe-pos-qty::-webkit-outer-spin-button,
.pe-pos-qty::-webkit-inner-spin-button,
.pe-pos-price::-webkit-outer-spin-button,
.pe-pos-price::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pe-pos-line-total { font-weight: 700; white-space: nowrap; }
.pe-pos-actions { white-space: nowrap; width: 84px; padding-right: .25rem; }
.pe-pos-actions .pe-icon-btn { margin-left: .2rem; }
.pe-pos-more { background: #f3f4f6; border: 1px solid #ced4da; }
.pe-pos-lot-active { background: #e8f3ec; border-color: #17854e; color: #17854e; }
.pe-pos-cart-empty { color: var(--pe-text-muted); padding: 1rem; }

.pe-pos-totals { border-top: 1px solid var(--pe-border, #e2e6ea); padding-top: .4rem; flex: 0 0 auto; }
.pe-pos-total-single { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pe-pos-total-discount { font-size: .8rem; color: var(--pe-text-muted, #6c757d); display: inline-flex; align-items: baseline; gap: .35rem; }
.pe-pos-total-discount .pe-pos-money { font-weight: 600; color: var(--pe-text-muted, #6c757d); }
.pe-pos-total-lines { font-size: .8rem; color: var(--pe-text-muted, #6c757d); }
.pe-pos-total-lines .pe-pos-money { font-weight: 600; color: var(--pe-text-muted, #6c757d); }
.pe-pos-total-sep { color: var(--pe-text-muted, #6c757d); }
.pe-pos-money { font-variant-numeric: tabular-nums; }
.pe-pos-total-main { font-size: 1.25rem; font-weight: 800; color: var(--pe-primary, #17854e); white-space: nowrap; }
.pe-pos-total-main .pe-pos-money { font-weight: 800; color: var(--pe-primary, #17854e); }

.pe-pos-block-label { font-size: .72rem; font-weight: 700; color: var(--pe-text-muted); letter-spacing: .03em; margin-bottom: .3rem; }
/* Cliente + Forma de pago en una sola sección horizontal con separador. */
.pe-pos-cobro { display: flex; gap: .75rem; border-top: 1px solid var(--pe-border, #e2e6ea); padding-top: .45rem; flex: 0 0 auto; min-height: 0; }
.pe-pos-cobro-client { flex: 1 1 50%; min-width: 0; border-right: 1px solid var(--pe-border, #e2e6ea); padding-right: .75rem; }
.pe-pos-cobro-pay { flex: 1 1 50%; min-width: 0; padding-left: .25rem; }
.pe-pos-client-row { display: flex; gap: .4rem; min-width: 0; }
.pe-pos-client-row .form-control { flex: 1 1 auto; min-width: 0; }
.pe-pos-client-row .btn { flex: 0 0 auto; white-space: nowrap; }
/* Lupa y Nuevo cliente: MISMO tamaño (ancho/alto/icono), alineados. */
.pe-pos-client-doc .btn { width: 2rem; height: calc(1.5em + .5rem + 2px); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.pe-pos-client-doc .btn i { font-size: .85rem; }
.pe-pos-cobro-client .form-label { display: block; margin-bottom: .15rem; font-size: .72rem; font-weight: 600; color: var(--pe-text-muted); }
.pe-pos-cobro-client .pe-pos-client-row { margin-bottom: .3rem; }
.pe-pos-client-row .pe-customer-data { background-color: #f8f9fa; }
.pe-pos-pay-method { margin-bottom: .5rem; }
.pe-pos-pay-method .form-select { width: 100%; }
.pe-pos-pay-row { display: flex; gap: .5rem; align-items: flex-end; }
.pe-pos-pay-received, .pe-pos-pay-change { flex: 1 1 50%; min-width: 0; }
.pe-pos-pay-change { display: flex; flex-direction: column; }
.pe-pos-pay-change .form-label { display: block; }

.pe-pos-pay { }
.pe-pos-received { font-size: 1.1rem; font-weight: 700; text-align: center; }
/* El vuelto debe tener EXACTAMENTE la misma altura que el input de Importe
   recibido (form-control-sm con font-size 1.1rem). Se alinea por la base
   (flex-end) para que ambos cierren a la misma línea inferior. */
.pe-pos-change { display: flex; align-items: center; justify-content: center; padding: .25rem .6rem; background: #eaf6ee; border: 1px solid #cfe6d8; border-radius: .45rem; box-sizing: border-box; min-height: calc(1.65rem + .5rem + 2px); overflow: hidden; }
.pe-pos-change-value { font-size: 1.2rem; font-weight: 700; color: #17854e; white-space: nowrap; text-align: center; }
.pe-pos-error { margin-top: .4rem; font-size: .78rem; color: #dc3545; background: #fdecec; border: 1px solid #f5c6cb; border-radius: .4rem; padding: .4rem .5rem; }

.pe-pos-emit-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.pe-pos-emit-row .btn { flex: 1 1 0; min-width: 0; font-weight: 700; border-radius: .5rem; display: flex; align-items: center; justify-content: center; min-height: 3rem; padding: .55rem .75rem; white-space: nowrap; }
/* GUARDAR BORRADOR: color institucional UVA (btn-grape) + texto blanco. */
.pe-pos-draft { font-size: .95rem; }
/* Grupo de borradores: GUARDAR y RECUPERAR comparten exactamente el área que
   antes ocupaba un único botón GUARDAR BORRADOR (flex 1:1 con EMITIR VENTA),
   sin aumentar la altura de la sección (mismo min-height 3rem). */
.pe-pos-draft-group { display: flex; flex: 1 1 0; min-width: 0; gap: .4rem; }
.pe-pos-draft-group .btn { font-size: .68rem; padding: .4rem .3rem; white-space: normal; line-height: 1.2; }
/* RECUPERAR BORRADOR: fondo blanco (secundario). */
.pe-pos-draft-recover { background-color: #fff; border-color: #cbd2d8; color: #1e2a5a; }
.pe-pos-draft-recover:hover { background-color: #f4f6f9; border-color: #b7bfc9; color: #1e2a5a; }
/* Modal "Recuperar borrador": ~1 cm (38px) más ancho que el modal-lg estándar
   para que la columna Acción (botón Recuperar) se vea completa. */
.pe-pos-drafts-dialog { --bs-modal-width: 876px; }
/* EMITIR VENTA: verde, acción principal. */
.pe-pos-emit { font-size: 1.1rem; background-color: #198754; border-color: #198754; color: #fff; }
.pe-pos-emit:hover { background-color: #157347; border-color: #157347; }
.pe-pos-open-btn { font-size: .9rem; font-weight: 700; }

.pe-pos-lot-rows { display: flex; flex-direction: column; gap: .4rem; }
.pe-pos-line-title { font-weight: 700; font-size: .9rem; margin-bottom: .8rem; color: var(--pe-primary, #17854e); }
.pe-pos-lot-row { display: flex; flex-direction: column; text-align: left; border: 1px solid var(--pe-border, #e2e6ea); border-radius: .45rem; padding: .45rem .6rem; background: #fff; }
.pe-pos-lot-row:hover { border-color: #17854e; }
.pe-pos-lot-row-active { background: #eaf6ee; border-color: #17854e; }
.pe-pos-lot-num { font-weight: 700; font-size: .85rem; }
.pe-pos-lot-meta { font-size: .75rem; color: var(--pe-text-muted); }

.pe-pos-arqueo { background: #f8f9fa; border: 1px solid var(--pe-border, #e2e6ea); border-radius: .45rem; padding: .4rem .6rem; }
.pe-pos-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1.25rem; }
.pe-pos-total-row > span:first-child { white-space: nowrap; color: var(--pe-text, #212529); }
.pe-pos-total-row .pe-pos-money { margin-left: auto; text-align: right; white-space: nowrap; }

/* Modal recuperar borrador: scroll interno, tabla compacta. */
.pe-pos-draft-table-wrap { max-height: 50vh; overflow-y: auto; border: 1px solid var(--pe-border, #e2e6ea); border-radius: .45rem; }
.pe-pos-draft-table-wrap table { margin: 0; }
.pe-pos-draft-table-wrap th, .pe-pos-draft-table-wrap td { padding: .4rem .25rem; }
.pe-pos-draft-table-wrap .pe-pos-cell-name { max-width: 220px; }

/* ==========================================================================
   CONSULTA DE CAJA — encabezado de estado, tabla y tarjetas de totales.
   Sigue el estándar visual de consultas del ERP (colores funcionales suaves).
   ========================================================================== */
.pe-consult-status { font-size: .9rem; font-weight: 600; }
.pe-consult-status .pe-consult-open { color: var(--pe-success, #17854e); }
.pe-consult-status .pe-consult-closed { color: var(--pe-text-muted, #6c757d); }
.pe-consult-table td, .pe-consult-table th { vertical-align: middle; }
/* Tabla más compacta: menos padding horizontal/vertical entre columnas. */
.pe-consult-table { --pe-consult-pad-x: .45rem; }
.pe-consult-table th, .pe-consult-table td { padding: .35rem .45rem; white-space: nowrap; }
/* Referencia y observación: ancho máximo + truncamiento con tooltip (el título
   HTML conserva el contenido completo). */
.pe-consult-cell-trunc { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Botón de anulación "disponible próximamente": apariencia deshabilitada. */
.pe-icon-btn-disabled { color: var(--pe-text-muted, #adb5bd); border-color: var(--pe-border, #e2e6ea); background: #f4f4f6; cursor: not-allowed; }
.pe-icon-btn-disabled:hover { color: var(--pe-text-muted, #adb5bd); border-color: var(--pe-border, #e2e6ea); background: #f4f4f6; }
.pe-cell-nowrap { white-space: nowrap; }
/* Tarjetas de totales: contenido centrado (título y valor) en eje X e Y. */
.pe-consult-total { padding: .6rem .8rem; border-radius: .45rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 64px; }
.pe-consult-total-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--pe-text, #212529); font-weight: 700; margin-bottom: .15rem; }
.pe-consult-total-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pe-consult-total-in { background: #eef7f1; border: 1px solid #d2e8da; }
.pe-consult-total-in .pe-consult-total-value { color: #17854e; }
.pe-consult-total-out { background: #fbf3e3; border: 1px solid #eee2c8; }
.pe-consult-total-out .pe-consult-total-value { color: #b2791b; }
.pe-consult-total-balance { background: #eef4fb; border: 1px solid #d5e2f0; }
.pe-consult-total-balance .pe-consult-total-value { color: #2060a6; }
.pe-consult-total-count { background: #f6f6f9; border: 1px solid #e3e3ea; }
.pe-consult-total-count .pe-consult-total-value { color: #5b5b73; }
.pe-consult-subtitle { font-size: .85rem; font-weight: 700; margin-bottom: .4rem; color: var(--pe-text, #212529); }
.pe-consult-by-method .pe-badge { font-size: .8rem; color: var(--pe-text, #212529); font-weight: 600; }
/* Fila de APERTURA de la Consulta de Caja: discreta, sin número de movimiento
   y sin acciones. La apertura vive en cash_sessions (no es un payment). */
.pe-consult-opening { background: var(--pe-primary-tint, #eef7f1); }
.pe-consult-opening td { border-top-color: #d2e8da; }
.pe-consult-opening .pe-cell-strong { text-transform: uppercase; letter-spacing: .04em; }
.pe-consult-opening-meta { color: var(--pe-text-muted, #6c757d); font-size: .82rem; }

@media (max-width: 991.98px) {
    .pe-pos { height: auto; min-height: 100vh; overflow: visible; }
    .pe-pos-body { overflow: visible; }
    .pe-pos-cart-wrap { max-height: none; overflow-y: visible; flex: none; }
    .pe-pos-cart-body { min-height: 0; }
    /* POS en móvil: una sola página vertical (PRODUCTOS → CARRITO → TOTALES →
       COBRO → EMITIR). Se elimina el scroll interno de la lista de productos
       y del carrito (que atrapaban el gesto táctil); los paneles usan altura
       natural y la página completa es la que hace scroll. Solo < 992px. */
    .pe-pos-products,
    .pe-pos-cart {
        height: auto;
    }
    .pe-pos-results {
        overflow-y: visible;
        max-height: none;
    }
    .pe-pos-card-products {
        overflow: visible;
    }
    /* El carrito también deja de tener scroll vertical interno en móvil:
       la tabla crece en flujo normal y el documento es el único que hace
       scroll. Escritorio (≥992px) no aplica estas reglas. */
    .pe-pos-card-cart {
        overflow: visible;
    }
    /* CAUSA RAÍZ del scroll táctil bloqueado en móvil: pos.js agrega la clase
       pe-pos-body-lock al <body> con overflow:hidden, lo que desactiva el
       scroll táctil de toda la página. En móvil se rehabilita el eje vertical
       (manteniendo oculto el horizontal) para que el POS sea una sola página
       desplazable. Escritorio (≥992px) conserva overflow:hidden. */
    body.pe-pos-body-lock {
        overflow-y: auto;
        overflow-x: hidden;
    }
}


/* ============================================================================
   Galería de imágenes de producto (pestaña Imágenes del CRUD de productos)
   ========================================================================== */
.pe-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .75rem;
}
.pe-image-item {
    position: relative;
    border: 1px solid var(--pe-border, #dee2e6);
    border-radius: var(--pe-radius-sm, .25rem);
    overflow: hidden;
    background: #fff;
}
.pe-image-item.is-primary {
    border-color: var(--pe-primary, #198754);
    box-shadow: 0 0 0 1px var(--pe-primary, #198754);
}
.pe-image-thumb {
    aspect-ratio: 1 / 1;
    width: 100%;
}
.pe-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pe-image-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .15rem;
    padding: .35rem;
}
.pe-image-btn {
    border: 1px solid transparent;
    border-radius: var(--pe-radius-sm, .25rem);
    background: transparent;
    color: var(--pe-text-muted, #6c757d);
    line-height: 1;
    padding: .3rem .45rem;
}
.pe-image-btn:hover:not(:disabled) { color: var(--pe-primary, #198754); background: rgba(25, 135, 84, .08); }
.pe-image-btn:disabled { opacity: .35; cursor: not-allowed; }
.pe-image-btn-danger:hover:not(:disabled) { color: #b02a37; background: rgba(220, 53, 69, .08); }
.pe-image-primary-badge {
    position: absolute;
    top: .3rem;
    left: .3rem;
    background: var(--pe-primary, #198754);
    color: #fff;
    font-size: .68rem;
    padding: .1rem .4rem;
    border-radius: .2rem;
    pointer-events: none;
}

/* ==========================================================================
   MIGRADO DESDE pos-test.css — POS aprobado (antes experimental).
   Reglas scoped a .pe-pos-test / #posTestConfirmModal; no afectan otras
   pantallas. pos-test.css se conserva para /pos-test (respaldo).
   ========================================================================== */
/* ==========================================================================
   POS EXPERIMENTAL (pos-test) — estilos aislados.
   Se apoya en la base .pe-pos de app.css (solo lectura, no modifica /pos).
   Aquí SOLO viven los ajustes propios de la nueva distribución.
   ========================================================================== */

/* Modal de confirmación/emisión: ancho cómodo (800-1000px) en escritorio,
   adaptándose a pantallas menores mediante Bootstrap. */
.pos-test-confirm-dialog { max-width: 900px; }

/* Al no existir Cliente/Forma de pago en la pantalla principal, la canasta
   crece verticalmente: se garantiza un área amplia incluso con pocos ítems
   (solo escritorio/tablet ≥992px; en móvil se conserva el comportamiento
   de scroll de página existente). */
@media (min-width: 992px) {
    .pe-pos-test .pe-pos-cart-wrap { min-height: 260px; }
}

@media (max-width: 991.98px) {
    .pos-test-confirm-dialog { max-width: calc(100vw - 2rem); }
}

/* ==========================================================================
   Modal de emisión — estructura compacta (sin scroll en uso normal).
   ========================================================================== */
.pos-test-confirm-body { padding: 1rem 1.1rem; }
.pe-pos-modal-section { margin-bottom: 1.1rem; }
.pe-pos-modal-section:last-child { margin-bottom: .25rem; }
.pe-pos-modal-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--pe-primary, #1a6b47);
    margin-bottom: .5rem;
}
.pe-pos-modal-title i { font-size: .85em; }

/* Botones rápidos de forma de pago: grandes, táctiles y con IMAGEN uniforme.
   La imagen se adapta proporcionalmente (object-fit: contain) sin que sus
   dimensiones originales determinen el tamaño del botón. */
.pe-pay-quick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    flex: 1 1 auto;
    min-width: 9.5rem;
    min-height: 58px;
    padding: .5rem .7rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--pe-primary-700, #115233);
    background: var(--pe-primary-tint, #eaf3ee);
    border: 1px solid #cfe6d8;
    border-radius: .6rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease;
}
.pe-pay-quick-btn img {
    height: 36px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    pointer-events: none;
}
.pe-pay-quick-btn span { white-space: nowrap; }
.pe-pay-quick-btn:hover {
    background: #dcefe4;
    border-color: var(--pe-primary, #1a6b47);
}
.pe-pay-quick-btn:active {
    background: var(--pe-primary, #1a6b47);
    color: #fff;
    border-color: var(--pe-primary, #1a6b47);
    transform: translateY(1px);
}
/* Estado activo (seleccionado): fondo verde + texto blanco. La imagen/icono
   conserva SIEMPRE sus colores originales (sin filtros ni inversiones). */
.pe-pay-quick-btn.is-active {
    background: var(--pe-primary, #1a6b47);
    color: #fff;
    border-color: var(--pe-primary, #1a6b47);
}

/* ==========================================================================
   Cliente (modal): RUC/DNI ~40% + botones grandes a la derecha; nombre ancho.
   ========================================================================== */
.pe-pos-customer-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: flex-end;
}
.pe-pos-customer-doc-col { flex: 1 1 42%; min-width: 220px; }
.pe-pos-customer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    flex: 1 1 auto;
    justify-content: flex-start;
}
.pe-pos-cust-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .6rem .8rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--pe-primary-700, #115233);
    background: #fff;
    border: 1px solid var(--pe-border-strong, #d3dad6);
    border-radius: .55rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.pe-pos-cust-btn:hover { background: var(--pe-primary-tint, #eaf3ee); border-color: var(--pe-primary, #1a6b47); }
.pe-pos-cust-btn:active { background: var(--pe-primary, #1a6b47); color: #fff; }
.pe-pos-cust-btn i { font-size: .9rem; }
/* Botón SUNAT (estructural; la consulta se implementará posteriormente). */
.pe-pos-cust-btn-sunat {
    color: var(--pe-info, #2060a6);
    border-color: #c3d7ef;
}
.pe-pos-cust-btn-sunat:hover {
    background: var(--pe-info-bg, #e8f1fb);
    border-color: var(--pe-info, #2060a6);
    color: var(--pe-info, #2060a6);
}

/* En pantallas pequeñas los cuatro botones se adaptan (2x2) sin scroll
   horizontal; el contenedor ya usa flex-wrap. */
@media (max-width: 575.98px) {
    .pe-pay-quick-btn { min-width: calc(50% - .4rem); }
    .pe-pos-customer-doc-col { min-width: 100%; }
}

/* Etiquetas del modal: legibles. */
#posTestConfirmModal .form-label { font-size: .82rem; font-weight: 600; }

/* ==========================================================================
   Ajustes finales (fase 4) — /pos-test.
   ========================================================================== */

/* 1) Línea separadora de Líneas/Descuentos/TOTAL: se mueve de ARRIBA a ABAJO
   (misma altura total: se intercambian border-top/padding-top por
   border-bottom/padding-bottom). Los botones inferiores no se desplazan. */
.pe-pos-test .pe-pos-totals {
    border-top: 0;
    padding-top: 0;
    border-bottom: 1px solid var(--pe-border, #e2e6ea);
    padding-bottom: .4rem;
}

/* 2) Controles EDITABLES del modal en fondo blanco (apariencia habilitada).
   El Vuelto (calculado, .pe-pos-change) y los textos no se tocan. */
#posTestConfirmModal select.form-select,
#posTestConfirmModal input.form-control {
    background-color: #ffffff;
}
/* ==========================================================================
   Ajuste visual — sección "Documento y vendedor" del modal de emisión.
   Los dos controles (Tipo de comprobante y Vendedor) ocupan ~45% cada uno en
   la misma fila, con espacio entre ambos, y los selects llenan su columna.
   No modifica la altura de la sección ni el resto del modal.
   ========================================================================== */
#posTestConfirmModal .pe-pos-modal-section:first-child .row {
    justify-content: space-between;
}
#posTestConfirmModal .pe-pos-modal-section:first-child .col-md-6 {
    flex: 0 0 45%;
    max-width: 45%;
}
#posTestConfirmModal .pe-pos-modal-section:first-child .form-select {
    width: 100%;
}
/* ==========================================================================
   Módulo Cotizaciones (homologado con el estándar PowerERP).
   Único CSS específico de Cotizaciones: presentación de GROUP (encabezado de
   grupo, líneas hijas y observaciones) y feedback del drag & drop. El resto de
   la pantalla reutiliza los componentes y clases existentes del ERP.
   ========================================================================== */

/* Fila GROUP: sección con el AZUL INSTITUCIONAL de PowerERP (el mismo usado en
   views/customers/form.php, #16437B). Sin bordes verticales internos (una sola
   franja) y SIN hover: el azul se conserva siempre (también en :hover y en
   cualquier interacción), con texto blanco. */
tr.pe-row-group > td,
tr.pe-row-group:hover > td {
    background: #16437B !important;
    color: #ffffff;
    font-weight: 600;
    border: 0 !important;
    box-shadow: none !important;
}
tr.pe-row-group > td:first-child {
    border-left: 3px solid #0f2f56 !important;
}

/* Resaltado temporal del GROUP vacío al intentar guardar (feedback visible). */
tr.pe-row-group.pe-group-empty > td {
    outline: 2px solid var(--pe-danger);
    outline-offset: -2px;
}

/* Botón "+ Agregar Grupo": fondo blanco, texto y borde en el MISMO azul del
   fondo de la fila GROUP (#16437B, valor de tr.pe-row-group > td). Se reutiliza
   el color institucional existente; no se crea un azul nuevo. Mantiene el
   tamaño/padding estándar (btn btn-outline-secondary btn-sm) de los demás
   botones de Líneas. */
#btnAddGroup,
#btnAddGroup:hover,
#btnAddGroup:focus,
#btnAddGroup:active {
    border-color: #16437B;
    color: #16437B;
    background: #ffffff;
}

/* Etiqueta "GRUPO:" de la fila GROUP (identificación inmediata). */
.pe-group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #ffffff;
    opacity: .85;
    white-space: nowrap;
}

/* Importe del GROUP en la columna TOTAL (celda qi-line-total). */
tr.pe-row-group > td.qi-line-total {
    font-weight: 700;
    color: #ffffff;
}

/* Importe del GROUP (pantalla Convertir a venta): el fondo de la fila es azul
   (#16437B) y el texto debe permanecer BLANCO. .pe-cell-strong fuerza un color
   oscuro (--pe-text); se neutraliza también en hover para garantizar contraste. */
tr.pe-row-group .pe-cell-strong,
tr.pe-row-group strong,
tr.pe-row-group:hover .pe-cell-strong,
tr.pe-row-group:hover strong {
    color: #ffffff !important;
}

/* Líneas hijas dentro de un GROUP: indentación de la columna Descripción. */
tr.pe-row-child > td:nth-child(2) {
    padding-left: 2rem;
}

/* Línea NOTE (observación): texto en cursiva y atenuado. */
tr.pe-row-note > td {
    font-style: italic;
    color: var(--pe-text-muted);
}

/* Tabla de líneas de Cotizaciones: densidad horizontal del mismo patrón de
   Nueva Compra (#purchaseItemsTable): las reglas globales .pe-table thead th /
   .pe-table tbody td usan padding 1rem lateral y superan en especificidad a
   .pe-table-slim. Aquí se reduce el padding SOLO para esta tabla, liberando
   espacio para la columna U.M. */
#quoteLinesTable thead th,
#quoteLinesTable tbody td {
    padding-left: .35rem;
    padding-right: .35rem;
}
#quoteLinesTable .form-select.form-select-sm,
#quoteLinesTable .form-control.form-control-sm {
    font-size: 12px;
    padding: .2rem .35rem;
}

/* Handle de arrastre: cursor grab y color atenuado (sin selección de texto). */
.pe-drag-handle {
    cursor: grab;
    color: var(--pe-text-muted);
    -webkit-user-select: none;
    user-select: none;
}
.pe-drag-handle:hover { color: var(--pe-primary); }

/* Fila arrastrada y zona de inserción (HTML5 Drag & Drop). */
tr.pe-dragging { opacity: .45; }
tr.pe-drop-before > td { box-shadow: inset 0 2px 0 var(--pe-primary); }
tr.pe-drop-after  > td { box-shadow: inset 0 -2px 0 var(--pe-primary); }
