:root {
    --navy: #0d1b3d;
    --blue: #1d4ed8;
    --blue-soft: #e8efff;
    --ink: #172033;
    --muted: #667085;
    --line: #e5e7eb;
    --surface: #ffffff;
    --background: #f4f6fa;
}

html { font-size: 15px; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, Segoe UI, Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-header { position: sticky; top: 0; z-index: 1030; min-height: 68px; padding: 12px 18px; background: var(--navy); color: #fff; box-shadow: 0 4px 18px rgba(13,27,61,.18); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; color: var(--navy); font-weight: 800; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand small { margin-top: 4px; color: #c7d2fe; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.user-name { color: #dbe4ff; }
.app-shell { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 68px); }
.app-sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px 14px; }
.app-sidebar .nav-link { margin-bottom: 6px; padding: 10px 12px; border-radius: 10px; color: #344054; font-weight: 600; }
.app-sidebar .nav-link:hover { background: var(--blue-soft); color: var(--blue); text-decoration: none; }
.app-content { min-width: 0; padding: 30px; }
.public-content { min-height: calc(100vh - 68px); display: grid; place-items: start center; padding: 52px 20px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0 0 6px; font-size: 1.8rem; font-weight: 760; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .75rem; font-weight: 800; letter-spacing: .13em; }
.content-card, .metric-card, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(16,24,40,.05); }
.content-card { padding: 22px; }
.auth-card { width: min(100%, 450px); padding: 32px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card > p { color: var(--muted); }
.company-selector-page { width: 100%; min-height: calc(100vh - 172px); display: grid; place-items: center; }
.form-card { max-width: 760px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 16px; }
.metric-card { padding: 20px; }
.metric-card span { display: block; color: var(--muted); font-size: .88rem; }
.metric-card strong { display: block; margin-top: 6px; font-size: 2rem; }
.table { margin: 0; }
.table thead th { color: #475467; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom-width: 1px; }
.actions a { margin-left: 12px; }
.form-control, .form-select { border-radius: 10px; border-color: #d0d5dd; min-height: 42px; }
.btn { border-radius: 10px; font-weight: 650; }
.btn-primary { background: var(--blue); border-color: var(--blue); }
.alert { border-radius: 12px; }
code { color: #b42318; background: #fff1f0; padding: 2px 5px; border-radius: 5px; }

@media (max-width: 1000px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 780px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
    .app-sidebar .nav { flex-direction: row !important; flex-wrap: wrap; }
    .app-content { padding: 20px 14px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .user-name { display: none; }
}

/* Empresas / perfil del emisor DTE */
.form-card { max-width: 1180px; }
.form-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.form-section:first-of-type { padding-top: 0; }
.form-section:last-of-type { border-bottom: 0; }
.form-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.form-section-heading h2 { margin: 2px 0 0; font-size: 1.22rem; font-weight: 760; }
.form-section-heading p { max-width: 520px; margin: 3px 0 0; color: var(--muted); font-size: .92rem; }
.section-kicker { color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .12em; }
.form-section-security { margin: 22px -22px -22px; padding: 24px 22px; border-radius: 0 0 16px 16px; background: #f8faff; }
.form-actions { display: flex; gap: 10px; padding-top: 24px; }
.credential-status { float: right; margin-top: 2px; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: #166534; font-size: .72rem; font-weight: 750; }

.catalog-autocomplete { position: relative; }
.catalog-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 8px; }
.catalog-input-row-wide-code { grid-template-columns: minmax(0, 1fr) 122px; }
.catalog-search-wrap { position: relative; min-width: 0; }
.catalog-code-input { color: #344054; background: #f2f4f7 !important; font-weight: 700; text-align: center; }
.catalog-results { position: absolute; z-index: 1080; top: calc(100% + 5px); left: 0; right: 0; display: none; max-height: 310px; overflow-y: auto; padding: 6px; border: 1px solid #d0d5dd; border-radius: 12px; background: #fff; box-shadow: 0 14px 38px rgba(16,24,40,.16); }
.catalog-results.show { display: block; }
.catalog-option { display: grid; grid-template-columns: 82px minmax(0, 1fr); width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }
.catalog-option:hover, .catalog-option.active { background: var(--blue-soft); }
.catalog-option-code { color: var(--blue); font-size: .83rem; font-weight: 800; }
.catalog-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-empty { padding: 12px; color: var(--muted); font-size: .9rem; }

/* CAT-019 transversal: la descripción de actividad económica debe verse completa en todos los formularios. */
.economic-activity-autocomplete .catalog-results {
    right: auto;
    width: min(900px, calc(100vw - 3rem));
    min-width: 100%;
}
.economic-activity-autocomplete .catalog-option-name {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.economic-activity-autocomplete .catalog-option {
    align-items: start;
}
.catalog-selected-description {
    margin-top: 6px;
    padding: 7px 10px;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
    font-size: .82rem;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}
.catalog-selected-description::before {
    content: "Descripción completa: ";
    color: #667085;
    font-weight: 700;
}
.catalog-selected-description-warning {
    border-color: #f5c2c7;
    background: #fff8f8;
    color: #842029;
}
.catalog-selected-description-warning::before {
    content: "Aviso: ";
    color: #842029;
}

/* CHG-UX-TERRITORY-0001: CAT-012/CAT-013/CAT-008 siempre muestran la descripción completa. */
.territorial-fulltext-autocomplete .catalog-results {
    right: auto;
    width: min(760px, calc(100vw - 3rem));
    min-width: 100%;
}
.territorial-fulltext-autocomplete .catalog-option {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
}
.territorial-fulltext-autocomplete .catalog-option-name {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.catalog-territorial-selected-description {
    min-height: 34px;
}

/* Compras > proveedor rápido: mostrar completo el nombre del municipio al buscar. */
.municipality-fulltext-autocomplete .catalog-results {
    right: auto;
    width: min(620px, calc(100vw - 2rem));
    min-width: 100%;
}
.municipality-fulltext-autocomplete .catalog-option {
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: start;
}
.municipality-fulltext-autocomplete .catalog-option-name {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

@media (max-width: 780px) {
    .form-section-heading { flex-direction: column; gap: 6px; }
    .catalog-input-row, .catalog-input-row-wide-code { grid-template-columns: minmax(0, 1fr) 76px; }
}

/* Logo de empresa */
.company-logo-editor { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: center; padding: 16px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #f8fafc; }
.company-logo-preview { display: grid; place-items: center; width: 150px; height: 100px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-weight: 700; }
.company-logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.company-logo-controls { min-width: 0; }
.company-logo-table { display: grid; place-items: center; width: 54px; height: 42px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.company-logo-table-empty { color: var(--navy); background: var(--blue-soft); font-size: .78rem; font-weight: 800; }

@media (max-width: 620px) {
    .company-logo-editor { grid-template-columns: 1fr; }
}


/* Fase 2: filtros, paginación y navegación */
.nav-section-title { margin: 18px 12px 7px; color: #98a2b3; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.filter-bar { display: grid; grid-template-columns: minmax(180px, 280px) minmax(240px, 1fr) auto; gap: 10px; margin-bottom: 18px; }
.filter-bar > .form-control:only-of-type { grid-column: 1 / 3; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 18px; }
.pager span { color: var(--muted); font-size: .9rem; }
.badge { border-radius: 999px; }
.table small { color: var(--muted); }
@media (max-width: 780px) {
    .filter-bar { grid-template-columns: 1fr; }
    .filter-bar > .form-control:only-of-type { grid-column: auto; }
}

/* Validación uniforme de formularios */
.required-field-marker {
    color: #dc3545;
    font-weight: 800;
    margin-left: .2rem;
}

.required-field-control[aria-invalid="true"],
.input-validation-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .12);
}

.field-validation-valid {
    display: none;
}

.field-validation-error {
    display: block;
    font-size: .875rem;
    margin-top: .25rem;
}

.validation-summary-valid {
    display: none;
}

.auto-validation-summary.validation-summary-errors {
    display: block;
    margin-bottom: 1rem;
}

.auto-validation-summary ul {
    margin: .5rem 0 0;
    padding-left: 1.25rem;
}

/* Panel principal: administración de usuarios */
.quick-action-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.quick-action-heading h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 760; }
.quick-action-heading p { margin: 0; color: var(--muted); }
.quick-action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.quick-action-item { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8faff; }
.quick-action-item strong, .quick-action-item span { display: block; }
.quick-action-item span { margin-top: 5px; color: var(--muted); font-size: .9rem; }
@media (max-width: 780px) {
    .quick-action-heading { align-items: flex-start; flex-direction: column; }
    .quick-action-grid { grid-template-columns: 1fr; }
}


/* Menú de configuración */
.sidebar-menu,
.sidebar-submenu {
    margin-bottom: 6px;
}

.sidebar-menu > summary,
.sidebar-submenu > summary {
    position: relative;
    cursor: pointer;
    list-style: none;
    border-radius: 10px;
    color: #344054;
    font-weight: 750;
}

.sidebar-menu > summary {
    padding: 10px 34px 10px 12px;
    background: #f8faff;
}

.sidebar-submenu > summary {
    margin: 2px 0;
    padding: 8px 32px 8px 22px;
    font-size: .92rem;
}

.sidebar-menu > summary::-webkit-details-marker,
.sidebar-submenu > summary::-webkit-details-marker {
    display: none;
}

.sidebar-menu > summary::after,
.sidebar-submenu > summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%) rotate(90deg);
    transition: transform .15s ease;
}

.sidebar-menu:not([open]) > summary::after,
.sidebar-submenu:not([open]) > summary::after {
    transform: translateY(-50%);
}

.sidebar-menu > summary:hover,
.sidebar-submenu > summary:hover {
    background: var(--blue-soft);
    color: var(--blue);
}

.sidebar-menu-body {
    padding: 4px 0 2px;
}

.sidebar-submenu-body {
    padding-left: 8px;
}

.app-sidebar .sidebar-link-level-1 {
    margin-left: 10px;
}

.app-sidebar .sidebar-link-level-2 {
    margin-left: 20px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: .9rem;
    font-weight: 600;
}

.event-ready-row:target {
    background-color: #fff3cd !important;
    box-shadow: inset 4px 0 0 #198754;
    scroll-margin-top: 1rem;
}

/* Panel principal: accesos de configuración */
.configuration-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.configuration-card,
.configuration-group {
    min-height: 150px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8faff;
}

.configuration-card {
    display: block;
    color: var(--ink);
}

.configuration-card:hover {
    border-color: #b9c8f7;
    background: var(--blue-soft);
    text-decoration: none;
}

.configuration-card strong,
.configuration-card span {
    display: block;
}

.configuration-card span {
    margin-top: 8px;
    color: var(--muted);
}

.configuration-group h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 760;
}

.configuration-group a {
    display: block;
    margin-top: 8px;
    font-weight: 650;
}

@media (max-width: 1000px) {
    .configuration-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .app-sidebar .sidebar-menu {
        width: 100%;
    }

    .app-sidebar .sidebar-link-level-1,
    .app-sidebar .sidebar-link-level-2 {
        margin-left: 0;
    }
}

/* Fase 3: documentos, inventario y kardex */
.app-sidebar .nav-link-primary {
    font-weight: 800;
    border: 1px solid var(--line);
    background: var(--blue-soft);
    color: var(--blue);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: .28rem .58rem;
    border-radius: 999px;
    background: #eef2f7;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}

.section-title {
    margin: 0 0 .35rem;
    font-size: 1.05rem;
    font-weight: 800;
}

.json-preview {
    max-height: 420px;
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7f8fb;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .82rem;
}

#purchase-lines-table input,
#purchase-lines-table select {
    min-width: 115px;
}

#purchase-lines-table .product-select {
    min-width: 300px;
}

/* Fase 4: buscadores tipo Google para clientes y productos */
.google-search {
    position: relative;
}

.google-search-input {
    padding-right: 2.3rem;
    background-image: none;
}

.google-search::after {
    content: "⌕";
    position: absolute;
    top: .45rem;
    right: .75rem;
    z-index: 2;
    color: var(--muted);
    pointer-events: none;
    font-size: 1.15rem;
}

.google-search-results {
    position: absolute;
    z-index: 1080;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 330px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(16, 24, 40, .16);
}

.google-search-option {
    display: block;
    width: 100%;
    padding: .65rem .8rem;
    border: 0;
    border-bottom: 1px solid #eef1f5;
    background: transparent;
    color: var(--ink);
    text-align: left;
}

.google-search-option:last-child {
    border-bottom: 0;
}

.google-search-option:hover,
.google-search-option.active {
    background: var(--blue-soft);
}

.google-search-option-title,
.google-search-option-secondary {
    display: block;
}

.google-search-option-title {
    font-weight: 700;
}

.google-search-option-secondary {
    margin-top: .15rem;
    color: var(--muted);
    font-size: .79rem;
}

.google-search-empty {
    padding: .75rem .85rem;
    color: var(--muted);
    font-size: .9rem;
}

#lines-table .product-search-box {
    min-width: 330px;
}

/* V61.9.59: el precio sin IVA debe mostrar cómodamente su base real con 4 decimales. */
#lines-table th.price-without-tax-col,
#lines-table td.price-without-tax-col {
    min-width: 132px;
    width: 132px;
}

#lines-table td.price-without-tax-col .unit-price,
#lines-table td.price-without-tax-col .unit-price-without-tax {
    min-width: 116px;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

/* CHG-SALES-DUAL-PRICE-0001: CCF 03 / NCE 05 permiten capturar también el precio final con IVA. */
#lines-table th.price-with-tax-col,
#lines-table td.price-with-tax-col {
    min-width: 132px;
    width: 132px;
}

#lines-table td.price-with-tax-col .unit-price-with-tax {
    min-width: 116px;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

/* Permite que el panel tipo Google salga fuera de la tabla sin quedar recortado. */
.sale-lines-responsive {
    overflow: visible;
}
@media (max-width: 900px) {
    .sale-lines-responsive {
        overflow-x: auto;
        overflow-y: visible;
    }
}

/* CHG-INV-0001 R4 FIX3: búsqueda de productos en envíos.
   El desplegable debe poder salir de la tabla y mostrar descripciones largas completas. */
.transfer-lines-responsive {
    overflow: visible;
}

#transferDetailCard .product-search-box {
    min-width: 340px;
}

#transferDetailCard .product-search-results {
    right: auto;
    width: clamp(520px, 46vw, 760px);
    max-width: min(760px, calc(100vw - 72px));
    max-height: 390px;
    padding: 6px;
    border-radius: 12px;
    overflow-x: hidden;
}

#transferDetailCard .product-search-results .google-search-option {
    padding: .72rem .8rem;
    border-bottom: 0;
    border-radius: 9px;
}

#transferDetailCard .product-search-results .google-search-option + .google-search-option {
    margin-top: 3px;
}

.transfer-product-result-main {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .6rem;
    align-items: start;
}

.transfer-product-result-code {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: .16rem .45rem;
    border: 1px solid #d9ddff;
    border-radius: 7px;
    background: #f3f4ff;
    color: #4038c8;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.transfer-product-result-description {
    min-width: 0;
    color: var(--ink);
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
}

.transfer-product-result-secondary {
    margin-top: .36rem;
    padding-left: .05rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
}

@media (max-width: 900px) {
    .transfer-lines-responsive {
        overflow-x: auto;
        overflow-y: visible;
    }

    #transferDetailCard .product-search-results {
        width: min(620px, calc(100vw - 48px));
        max-width: min(620px, calc(100vw - 48px));
    }
}

@media (max-width: 600px) {
    #transferDetailCard .product-search-results {
        width: min(92vw, 520px);
        max-width: min(92vw, 520px);
    }

    .transfer-product-result-main {
        grid-template-columns: 1fr;
        gap: .32rem;
    }

    .transfer-product-result-code {
        width: fit-content;
    }
}


/* V13.2: descuento global compacto y alineado con el resumen de ventas. */
#global-discount-box .global-discount-row {
    min-height: 31px;
}

#global-discount-box .global-discount-control {
    width: 118px;
    flex: 0 0 118px;
}

#global-discount-box .global-discount-control .form-control,
#global-discount-box .global-discount-control .input-group-text {
    min-height: 31px;
}

@media (max-width: 575.98px) {
    #global-discount-box .global-discount-control {
        width: 112px;
        flex-basis: 112px;
    }
}

/* V47.2 - Inicio de sesión moderno con identidad LeviSoftware */
.public-content:has(.login-page) {
    padding: 0;
    display: block;
    overflow: hidden;
}

.login-page {
    position: relative;
    isolation: isolate;
    min-height: calc(100vh - 68px);
    display: grid;
    place-items: center;
    padding: 52px 22px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 16%, rgba(255,255,255,.96) 0 20%, rgba(245,248,255,.86) 52%, rgba(239,244,255,.96) 100%),
        linear-gradient(135deg, #f8faff 0%, #eef3ff 100%);
}

.login-page::before {
    content: "";
    position: absolute;
    z-index: -3;
    inset: 0;
    background:
        linear-gradient(115deg, transparent 0 48%, rgba(64,88,255,.035) 48% 49%, transparent 49% 100%),
        linear-gradient(295deg, transparent 0 64%, rgba(64,88,255,.025) 64% 65%, transparent 65% 100%);
}

.login-decoration {
    position: absolute;
    z-index: -2;
    pointer-events: none;
}

.login-decoration-left {
    left: -230px;
    bottom: -250px;
    width: 650px;
    height: 650px;
    border-radius: 50%;
    border: 84px solid rgba(43,74,226,.035);
    box-shadow: 0 0 0 1px rgba(43,74,226,.018);
}

.login-decoration-right {
    right: -190px;
    top: 130px;
    width: 410px;
    height: 410px;
    border-radius: 50%;
    border: 72px solid rgba(43,74,226,.03);
}

.login-dots {
    position: absolute;
    z-index: -1;
    left: 12%;
    top: 30%;
    width: 130px;
    height: 92px;
    opacity: .38;
    background-image: radial-gradient(circle, rgba(52,82,236,.22) 2px, transparent 2.4px);
    background-size: 20px 20px;
}

.auth-card.login-card {
    position: relative;
    width: min(100%, 520px);
    padding: 34px 42px 28px;
    border: 1px solid rgba(216,224,240,.9);
    border-radius: 24px;
    background: rgba(255,255,255,.96);
    box-shadow:
        0 28px 80px rgba(18,33,73,.12),
        0 8px 22px rgba(18,33,73,.06);
    backdrop-filter: blur(10px);
}

.login-owner-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 104px;
    margin: -4px 0 15px;
}

.login-owner-logo {
    display: block;
    width: min(100%, 258px);
    max-height: 118px;
    object-fit: contain;
    object-position: center;
    mix-blend-mode: multiply;
}

.login-heading {
    text-align: left;
    margin-bottom: 24px;
}

.login-heading .eyebrow {
    margin-bottom: 7px;
    color: #3a4cff;
    font-size: .72rem;
    letter-spacing: .18em;
}

.login-heading h1 {
    margin: 0;
    color: #0d1b3d;
    font-size: clamp(2rem, 4vw, 2.55rem);
    font-weight: 800;
    letter-spacing: -.035em;
}

.login-heading p:not(.eyebrow) {
    margin: 8px 0 0;
    color: #667085;
    font-size: .99rem;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-field .form-label {
    margin: 0;
    color: #162248;
    font-weight: 700;
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    z-index: 2;
    left: 16px;
    top: 50%;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    color: #4355ff;
    pointer-events: none;
}

.login-input-icon svg,
.login-submit-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-control.login-control {
    min-height: 58px;
    padding: 12px 16px 12px 52px;
    border: 1px solid #cbd5eb;
    border-radius: 14px;
    background: #f8faff;
    color: #111936;
    font-size: 1rem;
    box-shadow: inset 0 1px 2px rgba(16,24,40,.015);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.form-control.login-control::placeholder {
    color: #98a2b3;
}

.form-control.login-control:hover {
    border-color: #b2bfdd;
}

.form-control.login-control:focus {
    border-color: #5364ff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(71,87,255,.11);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 24px;
    margin-top: -2px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #475467;
}

.login-remember .form-check-input {
    width: 20px;
    height: 20px;
    margin: 0;
    border-color: #c7d0e5;
    border-radius: 6px;
}

.login-remember .form-check-input:checked {
    border-color: #4053f4;
    background-color: #4053f4;
}

.login-submit {
    min-height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-top: 2px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #4055ff 0%, #342fe1 100%);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(60,62,231,.22);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.login-submit:hover,
.login-submit:focus {
    background: linear-gradient(135deg, #364cff 0%, #2e29d6 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 17px 32px rgba(60,62,231,.28);
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit-icon {
    width: 22px;
    height: 22px;
}

.login-help {
    margin-top: 22px;
    text-align: center;
}

.login-help a {
    color: #3e4cff;
    font-weight: 650;
}

.login-product-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #edf0f6;
    color: #7a849a;
    font-size: .79rem;
    text-align: center;
}

.login-product-badge strong {
    color: #526078;
}

.login-product-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #36a853;
    box-shadow: 0 0 0 4px rgba(54,168,83,.10);
}

.login-alert {
    margin-bottom: 20px;
}

.login-validation:empty,
.login-validation.validation-summary-valid {
    display: none;
}

@media (max-width: 620px) {
    .login-page {
        place-items: start center;
        padding: 28px 14px 36px;
    }

    .auth-card.login-card {
        padding: 26px 22px 24px;
        border-radius: 20px;
    }

    .login-owner-brand {
        min-height: 88px;
        margin-bottom: 10px;
    }

    .login-owner-logo {
        width: min(100%, 220px);
        max-height: 100px;
    }

    .login-heading h1 {
        font-size: 2rem;
    }

    .login-heading p:not(.eyebrow) {
        font-size: .93rem;
    }

    .login-dots,
    .login-decoration-right {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-submit,
    .form-control.login-control {
        transition: none;
    }
}

/* ========================================================================== */
/* V48 - EXPERIENCIA VISUAL GLOBAL / LEVISOFTWARE                             */
/* Cambios exclusivamente de presentación salvo los componentes funcionales   */
/* solicitados de contingencia e imagen de producto.                           */
/* ========================================================================== */

:root {
    --navy: #0b1738;
    --navy-2: #121f4d;
    --blue: #3c50e0;
    --blue-strong: #3041ce;
    --blue-soft: #eef2ff;
    --ink: #17213a;
    --muted: #667085;
    --line: #e4e9f2;
    --surface: #ffffff;
    --background: #f5f7fb;
    --success-soft: #ecfdf3;
    --danger-soft: #fff1f2;
    --shadow-sm: 0 5px 18px rgba(23, 34, 66, .055);
    --shadow-md: 0 14px 36px rgba(23, 34, 66, .08);
}

body {
    background:
        radial-gradient(circle at 78% 0%, rgba(76, 91, 230, .055), transparent 26rem),
        linear-gradient(180deg, #f8faff 0%, var(--background) 420px);
}

.app-header {
    min-height: 70px;
    padding: 12px 20px;
    background: linear-gradient(115deg, #091533 0%, #111f4c 58%, #182b67 100%);
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 28px rgba(11, 23, 56, .18);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    box-shadow: 0 7px 18px rgba(0,0,0,.13);
}

.brand strong {
    font-size: 1.08rem;
    letter-spacing: -.015em;
}

.app-shell {
    grid-template-columns: 246px minmax(0, 1fr);
    min-height: calc(100vh - 70px);
}

.app-sidebar {
    position: sticky;
    top: 70px;
    align-self: start;
    height: calc(100vh - 70px);
    overflow-y: auto;
    padding: 22px 13px 32px;
    border-right: 1px solid rgba(219, 226, 239, .9);
    background: rgba(255,255,255,.94);
    box-shadow: 7px 0 28px rgba(23,34,66,.025);
    backdrop-filter: blur(12px);
}

.app-sidebar::-webkit-scrollbar { width: 7px; }
.app-sidebar::-webkit-scrollbar-thumb { background: #dce3f1; border-radius: 99px; }

.app-sidebar .nav-link,
.sidebar-menu > summary,
.sidebar-submenu > summary {
    transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.app-sidebar .nav-link:hover,
.sidebar-menu > summary:hover,
.sidebar-submenu > summary:hover {
    transform: translateX(2px);
    background: linear-gradient(90deg, #eef2ff, #f6f8ff);
    color: var(--blue-strong);
    text-decoration: none;
}

.sidebar-menu[open] > summary {
    background: linear-gradient(90deg, #eef2ff, #f8f9ff);
    color: #2939bb;
    box-shadow: inset 3px 0 0 #4c5ce7;
}

.nav-section-title {
    margin-top: 20px;
    color: #98a2b3;
    letter-spacing: .14em;
}

.app-content {
    padding: 28px clamp(18px, 2.4vw, 38px) 44px;
}

.page-heading,
.app-content > h1:first-child,
.app-content > .h3:first-child {
    letter-spacing: -.025em;
}

.page-heading h1,
.app-content > h1:first-child,
.app-content > .h3:first-child {
    color: #101b38;
    font-weight: 790;
}

.content-card,
.metric-card,
.card {
    border-color: rgba(220, 226, 238, .92);
    box-shadow: var(--shadow-sm);
}

.content-card,
.metric-card {
    border-radius: 18px;
}

.card {
    overflow: visible;
    border-radius: 16px;
    background: rgba(255,255,255,.97);
}

.card-header {
    padding: .85rem 1rem;
    border-bottom-color: #edf0f6;
    border-radius: 16px 16px 0 0 !important;
    background: linear-gradient(180deg, #fbfcff, #f7f9fd);
    color: #17213a;
}

.card-body { padding: 1rem; }

.metric-card {
    position: relative;
    overflow: hidden;
    border: 1px solid #e6eaf3;
    background: linear-gradient(145deg, #fff 0%, #fbfcff 100%);
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -42px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(60,80,224,.045);
}

.form-label {
    margin-bottom: .35rem;
    color: #344054;
    font-size: .88rem;
    font-weight: 680;
}

.form-control,
.form-select {
    border-color: #cfd7e6;
    background-color: #fbfcff;
    box-shadow: inset 0 1px 2px rgba(16,24,40,.015);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.form-control:hover,
.form-select:hover { border-color: #b9c5db; }

.form-control:focus,
.form-select:focus {
    border-color: #6573e8;
    background: #fff;
    box-shadow: 0 0 0 .22rem rgba(76,92,231,.12);
}

.form-control[readonly] { background: #f4f6fb; color: #475467; }

.btn {
    border-radius: 11px;
    padding: .5rem .85rem;
    box-shadow: none;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
    border-color: #3c50e0;
    background: linear-gradient(135deg, #485cef 0%, #3547d1 100%);
    box-shadow: 0 8px 16px rgba(60,80,224,.16);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: #3446cf;
    background: linear-gradient(135deg, #4054e7 0%, #2f40c5 100%);
    box-shadow: 0 10px 21px rgba(60,80,224,.22);
}

.btn-outline-primary { border-color: #a8b2ed; color: #3547ce; }
.btn-outline-secondary { border-color: #d0d7e5; color: #475467; }

.alert {
    border-width: 1px;
    box-shadow: 0 5px 16px rgba(23,34,66,.035);
}

.table-responsive {
    border-radius: 13px;
}

.table > :not(caption) > * > * {
    padding: .72rem .7rem;
    border-bottom-color: #edf0f5;
}

.table thead th {
    padding-top: .68rem;
    padding-bottom: .68rem;
    background: #f7f9fc;
    color: #58647a;
    font-size: .72rem;
    font-weight: 760;
}

.table tbody tr { transition: background .13s ease; }
.table tbody tr:hover { background: #fafbff; }

.badge,
.status-pill { box-shadow: inset 0 0 0 1px rgba(16,24,40,.035); }

.filter-bar {
    align-items: center;
    padding: 12px;
    border: 1px solid #e8ecf4;
    border-radius: 14px;
    background: #fafbfe;
}

/* Bloqueo fiscal preventivo cuando una contingencia cerrada sigue pendiente. */
.contingency-billing-lock {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    margin-bottom: 18px;
    padding: 15px 16px;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc3545;
    border-radius: 15px;
    background: linear-gradient(105deg, #fff5f5 0%, #fff 72%);
    box-shadow: 0 9px 24px rgba(190, 24, 43, .07);
}

.contingency-billing-lock-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #dc3545;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 900;
}

.contingency-billing-lock strong { display: block; color: #9f1239; font-size: .98rem; }
.contingency-billing-lock p { margin: 4px 0 9px; color: #6b3340; font-size: .88rem; line-height: 1.45; }

/* Formularios de venta: más información visible sin cambiar ningún dato ni cálculo. */
.sale-compact-form .form-control,
.sale-compact-form .form-select {
    min-height: 38px;
    padding: .38rem .62rem;
    border-radius: 9px;
    font-size: .9rem;
}

.sale-compact-form textarea.form-control { min-height: auto; }
.sale-compact-form .form-label { margin-bottom: .24rem; font-size: .8rem; }
.sale-compact-form .form-text { margin-top: .2rem; font-size: .72rem; line-height: 1.25; }
.sale-compact-form .card-header { padding: .66rem .8rem; }
.sale-compact-form .card-body { padding: .82rem; }
.sale-compact-form .table > :not(caption) > * > * { padding: .5rem .48rem; }
.sale-compact-form hr { margin-top: .7rem !important; margin-bottom: .7rem !important; }

.sale-collapse-card {
    overflow: visible;
    border: 1px solid #dde4f0;
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.sale-collapse-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
    border-radius: 15px;
    background: linear-gradient(110deg, #f8faff 0%, #fff 75%);
    user-select: none;
}

.sale-collapse-summary::-webkit-details-marker { display: none; }
.sale-collapse-card[open] > .sale-collapse-summary { border-radius: 15px 15px 0 0; border-bottom: 1px solid #edf0f6; }
.sale-collapse-summary:hover { background: linear-gradient(110deg, #f1f4ff 0%, #fff 75%); }

.sale-collapse-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sale-collapse-title-wrap > span:last-child { min-width: 0; }
.sale-collapse-title-wrap strong { display: block; color: #17213a; font-size: .92rem; }
.sale-collapse-title-wrap small {
    display: block;
    max-width: min(58vw, 680px);
    margin-top: 2px;
    overflow: hidden;
    color: #7b8498;
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sale-collapse-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: #e9edff;
    color: #3547d1;
    font-size: .78rem;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(53,71,209,.08);
}

.sale-collapse-action {
    position: relative;
    min-width: 86px;
    padding-right: 19px;
    color: #5f6b82;
    font-size: .74rem;
    font-weight: 700;
    text-align: right;
}

.sale-collapse-action::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #4557db;
    font-size: 1rem;
}

.sale-collapse-card:not([open]) .sale-collapse-action {
    font-size: 0;
}
.sale-collapse-card:not([open]) .sale-collapse-action::before {
    content: "Expandir";
    font-size: .74rem;
}
.sale-collapse-card:not([open]) .sale-collapse-action::after { content: ""; }

.sale-collapse-body { padding: .78rem .82rem .88rem; }
.sale-section-note {
    margin: 0 0 .65rem;
    padding: .48rem .62rem;
    border-radius: 9px;
    background: #f7f8fc;
    color: #667085;
    font-size: .72rem;
    line-height: 1.35;
}

/* Imagen de producto: persistente y discreta en inventario. */
.product-image-editor {
    display: grid;
    grid-template-columns: 165px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 15px;
    border: 1px dashed #cfd8e8;
    border-radius: 15px;
    background: linear-gradient(120deg, #f8faff 0%, #fff 70%);
}

.product-image-preview {
    display: grid;
    place-items: center;
    width: 165px;
    height: 125px;
    overflow: hidden;
    border: 1px solid #e1e6ef;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(23,34,66,.05);
}

.product-image-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.product-image-empty { display: grid; place-items: center; gap: 2px; color: #8b95a8; text-align: center; }
.product-image-empty-icon { color: #5365df; font-size: 1.55rem; }
.product-image-empty strong { color: #667085; font-size: .8rem; }
.product-image-empty small { font-size: .68rem; }
.product-image-controls { min-width: 0; }
.product-image-column { width: 72px; text-align: center; }
.product-table-image {
    display: inline-grid;
    place-items: center;
    width: 50px;
    height: 50px;
    object-fit: contain;
    padding: 3px;
    border: 1px solid #e3e7ef;
    border-radius: 10px;
    background: #fff;
}
.product-table-image-empty { color: #9aa4b6; background: #f7f9fc; font-size: 1.1rem; }

@media (max-width: 1000px) {
    .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 780px) {
    .app-header { position: sticky; }
    .app-shell { display: block; }
    .app-sidebar {
        position: static;
        width: 100%;
        height: auto;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .app-sidebar .nav { display: block; }
    .app-content { padding: 18px 12px 34px; }
    .product-image-editor { grid-template-columns: 1fr; }
    .product-image-preview { width: min(100%, 220px); }
    .sale-collapse-title-wrap small { max-width: 58vw; }
    .sale-collapse-action { min-width: 24px; font-size: 0; }
    .sale-collapse-card:not([open]) .sale-collapse-action::before { content: ""; }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .app-sidebar .nav-link,
    .sidebar-menu > summary,
    .sidebar-submenu > summary,
    .form-control,
    .form-select { transition: none; }
}

/* Dashboard gerencial para dueño/administrador */
.dashboard-owner-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    border: 1px solid rgba(29, 78, 216, .10);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(29,78,216,.14), transparent 26%),
        linear-gradient(135deg, #0d1b3d 0%, #132d66 58%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 18px 42px rgba(13, 27, 61, .20);
}

.dashboard-owner-hero h1 {
    margin: 0 0 8px;
    font-size: 2.2rem;
    font-weight: 800;
}

.dashboard-owner-hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255,255,255,.86);
}

.dashboard-owner-hero .eyebrow {
    color: #c7d2fe;
}

.dashboard-owner-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dashboard-owner-hero-actions .btn-outline-primary {
    border-color: rgba(255,255,255,.55);
    color: #fff;
}

.dashboard-owner-hero-actions .btn-outline-primary:hover {
    background: rgba(255,255,255,.16);
    color: #fff;
}

.owner-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.owner-kpi-card,
.owner-mini-stat,
.owner-alert-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(16,24,40,.06);
}

.owner-kpi-card {
    min-height: 165px;
    padding: 20px;
}

.owner-kpi-card::after,
.owner-mini-stat::after {
    content: "";
    position: absolute;
    right: -22px;
    bottom: -22px;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: rgba(29,78,216,.06);
}

.owner-kpi-highlight {
    background: linear-gradient(135deg, #eff4ff 0%, #ffffff 100%);
    border-color: #c7d7ff;
}

.owner-kpi-label {
    display: block;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 700;
}

.owner-kpi-card strong {
    display: block;
    margin-top: 12px;
    font-size: 2rem;
    line-height: 1.08;
}

.owner-kpi-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: .88rem;
}

.owner-kpi-trend,
.owner-inline-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: .84rem;
    font-weight: 750;
}

.owner-kpi-trend.up,
.owner-inline-change.up {
    color: #067647;
}

.owner-kpi-trend.down,
.owner-inline-change.down {
    color: #b42318;
}

.owner-kpi-trend.neutral,
.owner-inline-change.neutral {
    color: #475467;
}

.owner-mini-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.owner-mini-stat {
    min-height: 118px;
    padding: 18px;
}

.owner-mini-stat span {
    display: block;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
}

.owner-mini-stat strong {
    display: block;
    margin-top: 10px;
    font-size: 1.65rem;
    line-height: 1.1;
}

.owner-mini-stat small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.owner-mini-stat-warning {
    background: linear-gradient(135deg, #fff8ec 0%, #fff 100%);
    border-color: #fde3ad;
}

.owner-dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}

.owner-panel {
    padding: 22px;
}

.owner-panel-wide {
    grid-column: 1 / -1;
}

.owner-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.owner-panel-header h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 800;
}

.owner-panel-header p {
    margin: 0;
    color: var(--muted);
}

.sales-trend-chart {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.sales-trend-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 230px;
}

.sales-trend-value {
    color: var(--ink);
    font-size: .82rem;
    font-weight: 750;
}

.sales-trend-bar-wrap {
    display: flex;
    align-items: end;
    flex: 1;
    min-height: 170px;
    padding: 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 100%);
}

.sales-trend-bar {
    width: 100%;
    min-height: 12px;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, #4f7dff 0%, #1d4ed8 100%);
    box-shadow: 0 12px 24px rgba(29,78,216,.22);
}

.sales-trend-item small {
    color: var(--muted);
    font-weight: 700;
    text-transform: capitalize;
}

.progress-list {
    display: grid;
    gap: 14px;
}

.progress-list-item {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8faff;
}

.progress-list-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.progress-list-header strong {
    font-size: .98rem;
}

.progress-list-header span,
.progress-list-item small {
    color: var(--muted);
}

.progress-track {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5ecff;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1d4ed8 0%, #6ea8fe 100%);
}

.owner-list {
    display: grid;
    gap: 12px;
}

.owner-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8faff;
}

.owner-list-row strong,
.owner-list-row small,
.owner-list-row span {
    display: block;
}

.owner-list-row small {
    margin-top: 4px;
    color: var(--muted);
}

.owner-list-row span {
    font-weight: 800;
    white-space: nowrap;
}

.owner-alert-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.owner-alert-card {
    min-height: 160px;
    padding: 18px;
}

.owner-alert-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}

.owner-alert-card p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: .92rem;
}

.owner-alert-card a {
    font-weight: 750;
}

.owner-alert-success {
    background: linear-gradient(135deg, #ecfdf3 0%, #fff 100%);
    border-color: #abefc6;
}

.owner-alert-warning {
    background: linear-gradient(135deg, #fff8eb 0%, #fff 100%);
    border-color: #fedf89;
}

.owner-alert-danger {
    background: linear-gradient(135deg, #fef3f2 0%, #fff 100%);
    border-color: #fecdca;
}

.owner-alert-info {
    background: linear-gradient(135deg, #eff8ff 0%, #fff 100%);
    border-color: #b2ddff;
}

.owner-quick-grid .configuration-card {
    min-height: 132px;
}

@media (max-width: 1280px) {
    .owner-kpi-grid,
    .owner-mini-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .owner-alert-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .dashboard-owner-hero,
    .owner-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .owner-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sales-trend-chart {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .owner-kpi-grid,
    .owner-mini-stats-grid,
    .owner-alert-grid,
    .sales-trend-chart {
        grid-template-columns: 1fr;
    }

    .owner-list-row,
    .progress-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-owner-hero {
        padding: 22px 20px;
    }

    .dashboard-owner-hero h1 {
        font-size: 1.8rem;
    }
}

.owner-mini-stats-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.owner-chart-panel {
    min-height: 430px;
}

.owner-chart-wrap {
    position: relative;
    min-height: 320px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
}

.owner-chart-wrap-pie {
    min-height: 320px;
}

.owner-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 780px) {
    .owner-mini-stats-grid-compact {
        grid-template-columns: 1fr;
    }

    .owner-chart-panel {
        min-height: auto;
    }

    .owner-chart-wrap,
    .owner-chart-wrap-pie {
        min-height: 280px;
    }
}

/* ============================================================
   V61.1 - Facturación Tiquete / POS compacto no electrónico
   ============================================================ */
.ticket-pos-shell { max-width: 1600px; margin: 0 auto; }
.ticket-pos-shell .pos-page-heading { line-height: 1.15; }
.ticket-pos-shell .card-header { line-height: 1.2; }
.ticket-pos-shell .pos-scan-card { box-shadow: 0 0.2rem .75rem rgba(25, 135, 84, .10); }
.ticket-pos-shell .pos-barcode-input { font-size: 1.15rem; font-weight: 650; letter-spacing: .015em; }
.ticket-pos-shell .pos-barcode-group .form-control,
.ticket-pos-shell .pos-barcode-group .input-group-text,
.ticket-pos-shell .pos-barcode-group .btn { min-height: 42px; }
.ticket-pos-shell .pos-search-field { z-index: 5; }
.ticket-pos-shell .pos-search-results { position: absolute; left: .75rem; right: .75rem; top: calc(100% - .1rem); z-index: 1080; max-height: 280px; overflow-y: auto; box-shadow: 0 .65rem 1.25rem rgba(0,0,0,.16); }
.ticket-pos-shell .pos-cart-card { min-height: 0; overflow: hidden; }
.ticket-pos-shell .pos-cart-scroll { height: calc(100vh - 310px); min-height: 300px; max-height: 525px; overflow-y: auto; }
.ticket-pos-shell .pos-cart-scroll thead th { position: sticky; top: 0; z-index: 4; background: var(--bs-body-bg); box-shadow: inset 0 -1px 0 var(--bs-border-color); }
.ticket-pos-shell .pos-total-card { border-width: 2px; }
.ticket-pos-shell .pos-total-card #grand-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ticket-pos-shell .table td, .ticket-pos-shell .table th { vertical-align: middle; padding-top: .38rem; padding-bottom: .38rem; }
.ticket-pos-shell .pos-product-line { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; line-height: 1.15; }
.ticket-pos-shell .pos-product-line .badge { font-size: .65rem; }
.ticket-pos-shell .pos-trace { max-width: 280px; }
.ticket-pos-shell .pos-cash-input { font-size: 1rem; font-weight: 650; }
.ticket-pos-shell .pos-limit-note { line-height: 1.15; }
.ticket-pos-shell .pos-summary-column > .card:last-of-type { margin-bottom: .5rem; }
.ticket-pos-shell .form-label { line-height: 1.1; }

@media (min-width: 992px) {
    .ticket-pos-shell .pos-summary-column { position: sticky; top: .5rem; }
}

@media (max-width: 991.98px) {
    .ticket-pos-shell .pos-cart-scroll { height: auto; min-height: 260px; max-height: 430px; }
    .ticket-pos-shell .pos-summary-column { margin-top: .15rem; }
}

@media (max-height: 760px) and (min-width: 992px) {
    .ticket-pos-shell .pos-cart-scroll { height: calc(100vh - 285px); min-height: 270px; }
    .ticket-pos-shell .pos-scan-help { display: none; }
    .ticket-pos-shell .card-body { padding-top: .45rem !important; padding-bottom: .45rem !important; }
    .ticket-pos-shell .card-header { padding-top: .4rem !important; padding-bottom: .4rem !important; }
}

/* V61.3 Compra rápida: usa la densidad visual del POS y añade controles de lote/serie compactos. */
.quick-purchase-shell .quick-purchase-scroll { height: calc(100vh - 310px); min-height: 300px; max-height: 525px; }
.quick-purchase-shell .quick-tracking-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: .3rem; }
.quick-purchase-shell .quick-tracking-grid textarea { min-height: 34px; resize: vertical; }
.quick-purchase-shell #quick-grand-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 991.98px) {
    .quick-purchase-shell .quick-tracking-grid { grid-template-columns: 1fr; }
    .quick-purchase-shell .quick-purchase-scroll { height: auto; min-height: 260px; max-height: 430px; }
}
@media (min-width: 992px) and (max-height: 820px) {
    .quick-purchase-shell .quick-purchase-scroll { height: calc(100vh - 285px); min-height: 270px; }
}

/* V61.9.34 · Galería de dos imágenes y ficha PDF de productos. */
.product-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.product-media-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #dde4ef;
    border-radius: 15px;
    background: linear-gradient(145deg, #fbfcff 0%, #fff 72%);
}
.product-media-card-heading strong,
.product-media-card-heading small { display: block; }
.product-media-card-heading strong { color: #1f2a44; }
.product-media-card-heading small { margin-top: 2px; color: #7a8497; font-size: .75rem; }
.product-media-card .product-image-preview { width: 100%; height: 180px; }
.product-media-card .product-image-zoom { align-self: flex-start; }
.product-document-preview {
    display: flex;
    flex: 1;
    min-height: 180px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 18px;
    border: 1px dashed #d7deeb;
    border-radius: 13px;
    background: #fff;
}
.product-document-preview strong,
.product-document-preview small { display: block; }
.product-document-preview small { color: #7a8497; margin-top: 4px; }
.product-document-icon {
    display: inline-grid;
    place-items: center;
    min-width: 46px;
    height: 46px;
    margin-bottom: 10px;
    padding: 0 9px;
    border-radius: 10px;
    background: #fff0f0;
    color: #b42318;
    border: 1px solid #f4c7c7;
    font-weight: 800;
    font-size: .72rem;
    letter-spacing: .03em;
}
.product-images-column { width: 118px; text-align: center; }
.product-table-images { display: flex; justify-content: center; gap: 5px; }
.product-table-images .product-table-image { cursor: zoom-in; }
.product-pdf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid #f0b8b8;
    background: #fff5f5;
    color: #a61b1b;
    font-size: .7rem;
    font-weight: 800;
    text-decoration: none;
}
.product-pdf-badge:hover { color: #7d1111; background: #ffeaea; }
.product-image-dialog {
    width: min(94vw, 1100px);
    max-width: 1100px;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: transparent;
}
.product-image-dialog::backdrop { background: rgba(10, 18, 36, .78); }
.product-image-dialog-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: min(82vh, 760px);
    padding: 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.product-image-dialog-shell img {
    display: block;
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
}
.product-image-dialog-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #eef1f6;
    color: #24304a;
    font-size: 1.5rem;
    line-height: 1;
}
.product-details-layout {
    display: grid;
    grid-template-columns: minmax(330px, .85fr) minmax(0, 1.4fr);
    gap: 18px;
    align-items: start;
}
.product-details-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.product-details-image-button {
    display: grid;
    grid-template-rows: 220px auto;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    border: 1px solid #dfe5ef;
    border-radius: 14px;
    background: #fff;
    cursor: zoom-in;
    text-align: left;
}
.product-details-image-button img { width: 100%; height: 220px; object-fit: contain; }
.product-details-image-button span { color: #667085; font-size: .78rem; }
.product-details-no-media {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 220px;
    border: 1px dashed #d9e0eb;
    border-radius: 14px;
    color: #8b95a8;
}
.product-details-no-media span { font-size: 2rem; }
.product-details-pdf {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid #e0e6ef;
    border-radius: 14px;
    background: #fbfcfe;
}
.product-details-pdf > div:first-child { display: flex; align-items: center; gap: 12px; }
.product-details-pdf .product-document-icon { margin-bottom: 0; }
.product-details-pdf strong,
.product-details-pdf small { display: block; }
.product-details-pdf small { color: #7a8497; }
.product-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border: 1px solid #e2e7ef;
    border-radius: 14px;
    overflow: hidden;
}
.product-details-grid > div {
    min-width: 0;
    padding: 12px 14px;
    border-bottom: 1px solid #e8ecf3;
}
.product-details-grid > div:nth-child(odd) { border-right: 1px solid #e8ecf3; }
.product-details-grid .product-details-wide { grid-column: 1 / -1; border-right: 0; }
.product-details-grid dt { margin-bottom: 3px; color: #7b8496; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.product-details-grid dd { margin: 0; color: #182230; font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 1050px) {
    .product-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-document-card { grid-column: 1 / -1; }
    .product-details-layout { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
    .product-media-grid,
    .product-details-gallery,
    .product-details-grid { grid-template-columns: 1fr; }
    .product-document-card,
    .product-details-grid .product-details-wide { grid-column: auto; }
    .product-details-grid > div:nth-child(odd) { border-right: 0; }
    .product-details-pdf { align-items: flex-start; flex-direction: column; }
}

/* V61.9.35 · Catálogo de productos moderno con existencia visible. */
.product-catalog-heading {
    align-items: end;
    margin-bottom: 18px;
}
.product-catalog-kicker {
    display: inline-flex;
    margin-bottom: 5px;
    color: #5260d6;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.product-catalog-new { display: inline-flex; align-items: center; gap: 6px; }
.product-catalog-new > span { font-size: 1.1rem; line-height: 1; }
.product-catalog-shell {
    padding: 18px 20px 16px;
    background:
        radial-gradient(circle at top right, rgba(82,96,214,.055), transparent 28%),
        #fff;
}
.product-catalog-search {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    padding: 11px;
    border: 1px solid #e1e6f0;
    border-radius: 16px;
    background: linear-gradient(180deg, #fafbff 0%, #f7f9fd 100%);
}
.product-catalog-searchbox {
    position: relative;
    flex: 1 1 auto;
    min-width: 220px;
}
.product-catalog-searchbox .form-control {
    height: 44px;
    padding-left: 42px;
    border-color: transparent;
    background: #fff;
    box-shadow: 0 3px 12px rgba(31,42,68,.045);
}
.product-catalog-searchicon {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 2;
    transform: translateY(-52%);
    color: #7b86a1;
    font-size: 1.1rem;
    pointer-events: none;
}
.product-catalog-table-wrap {
    padding: 0 2px;
    border-radius: 16px;
}
.product-catalog-table {
    margin-bottom: 8px;
    border-collapse: separate;
    border-spacing: 0 7px;
}
.product-catalog-table thead th {
    border: 0;
    background: transparent;
    color: #667085;
    font-size: .67rem;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}
.product-catalog-table tbody td {
    padding-top: .68rem;
    padding-bottom: .68rem;
    border-top: 1px solid #e8ecf3;
    border-bottom: 1px solid #e8ecf3;
    background: #fff;
    vertical-align: middle;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.product-catalog-table tbody td:first-child {
    border-left: 1px solid #e8ecf3;
    border-radius: 13px 0 0 13px;
}
.product-catalog-table tbody td:last-child {
    border-right: 1px solid #e8ecf3;
    border-radius: 0 13px 13px 0;
}
.product-catalog-table tbody tr:hover td {
    border-top-color: #cfd7f2;
    border-bottom-color: #cfd7f2;
    background: #fbfcff;
    box-shadow: 0 8px 18px rgba(35,48,86,.035);
}
.product-catalog-table tbody tr:hover td:first-child { border-left-color: #cfd7f2; }
.product-catalog-table tbody tr:hover td:last-child { border-right-color: #cfd7f2; }
.product-table-images-modern {
    position: relative;
    justify-content: flex-start;
    width: 78px;
    min-height: 52px;
    margin-inline: auto;
}
.product-table-images-modern .product-table-image {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    box-shadow: 0 4px 12px rgba(31,42,68,.055);
}
.product-table-images-modern .product-table-image-secondary {
    position: absolute;
    right: 0;
    bottom: -4px;
    width: 34px;
    height: 34px;
    border: 2px solid #fff;
    border-radius: 10px;
}
.product-code-block strong,
.product-code-block small { display: block; }
.product-code-block strong {
    color: #101828;
    font-size: .86rem;
    letter-spacing: .015em;
}
.product-code-block small {
    max-width: 125px;
    margin-top: 3px;
    overflow: hidden;
    color: #98a2b3;
    font-size: .69rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-catalog-description { min-width: 235px; max-width: 520px; }
.product-catalog-description > strong {
    display: block;
    color: #172033;
    font-size: .89rem;
    line-height: 1.32;
}
.product-catalog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}
.product-catalog-tags span,
.product-category-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid #e5e9f2;
    border-radius: 99px;
    background: #f8f9fc;
    color: #667085;
    font-size: .66rem;
    line-height: 1.2;
}
.product-category-chip {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-stock {
    display: inline-flex;
    min-width: 112px;
    flex-direction: column;
    gap: 1px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 11px;
}
.product-stock strong { font-size: .88rem; font-variant-numeric: tabular-nums; }
.product-stock small { font-size: .62rem; white-space: nowrap; }
.product-stock-ok { border-color: #c9ead9; background: #f3fbf7; color: #18794e; }
.product-stock-low { border-color: #f1d9a8; background: #fff9ec; color: #9a6500; }
.product-stock-zero { border-color: #f0c7c7; background: #fff5f5; color: #b42318; }
.product-stock-na { border-color: #e4e8ef; background: #f8f9fb; color: #7b8496; }
.product-money { color: #344054; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product-price-primary { color: #2437c8; font-weight: 760; }
.product-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
}
.product-status-pill > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.product-status-pill.is-active { background: #eefbf4; color: #18794e; }
.product-status-pill.is-active > span { background: #23a36d; box-shadow: 0 0 0 3px rgba(35,163,109,.12); }
.product-status-pill.is-inactive { background: #f4f5f7; color: #667085; }
.product-status-pill.is-inactive > span { background: #98a2b3; }
.product-row-actions {
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.product-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid #dde3ef;
    border-radius: 9px;
    background: #fff;
    color: #475467;
    font-size: .7rem;
    font-weight: 700;
    text-decoration: none;
}
.product-action-link:hover { border-color: #b7c0e9; background: #f6f7ff; color: #3446cf; text-decoration: none; }
.product-action-view { border-color: #cfd6ff; color: #3547ce; }
.product-action-pdf { border-color: #f0c8c8; color: #a61b1b; }
.product-action-pdf:hover { border-color: #e2a8a8; background: #fff4f4; color: #861616; }
.product-catalog-empty {
    padding: 42px 20px !important;
    border: 1px dashed #d7deea !important;
    border-radius: 14px !important;
    background: #fafbfe !important;
    text-align: center;
}
.product-catalog-empty-icon { margin-bottom: 7px; color: #8b96b5; font-size: 1.6rem; }
.product-catalog-empty strong,
.product-catalog-empty small { display: block; }
.product-catalog-empty strong { color: #344054; }
.product-catalog-empty small { margin-top: 4px; color: #98a2b3; }

@media (max-width: 900px) {
    .product-catalog-search { align-items: stretch; flex-wrap: wrap; }
    .product-catalog-searchbox { flex-basis: 100%; }
    .product-catalog-search .btn { flex: 1 1 120px; }
}


/* V61.9.36 · Crear categoría sin salir de Crear/Editar producto */
.product-category-add-button {
    white-space: nowrap;
    border-radius: 999px;
    padding-inline: .75rem;
    font-weight: 700;
}
.product-category-dialog {
    width: min(94vw, 560px);
    max-width: 560px;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
}
.product-category-dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.product-category-dialog-shell {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
}
.product-category-dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem .95rem;
    background: linear-gradient(135deg, #f8faff 0%, #eef4ff 100%);
    border-bottom: 1px solid #e6ebf3;
}
.product-category-dialog-heading h3 { margin: .1rem 0 .2rem; font-size: 1.15rem; }
.product-category-dialog-heading p { margin: 0; color: #667085; font-size: .84rem; }
.product-category-dialog-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.84);
    color: #344054;
    font-size: 1.4rem;
    line-height: 1;
}
.product-category-dialog-body { display: grid; gap: 1rem; padding: 1.15rem 1.35rem; }
.product-category-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding: .95rem 1.35rem 1.2rem;
    border-top: 1px solid #eef1f5;
}

/* V61.9.37 · Descarga de imágenes del producto. */
.product-image-action-row { align-items: center; }
.product-image-dialog-download {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 3;
    box-shadow: 0 8px 20px rgba(20, 45, 110, .18);
}
.product-details-image-entry {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}
.product-details-image-entry .product-details-image-button { width: 100%; }
.product-details-download { align-self: flex-start; }
@media (max-width: 575.98px) {
    .product-image-dialog-download { left: 16px; right: 16px; text-align: center; }
}

/* V61.9.40 · Empresas: editor compacto y panel técnico de base independiente */
.company-page-heading {
    margin-bottom: 14px;
}
.company-page-heading .eyebrow {
    margin-bottom: 4px;
}
.company-form-card {
    max-width: 1240px;
    padding: 14px;
    overflow: visible;
}
.company-form-modern {
    display: block;
}
.company-form-nav {
    position: sticky;
    top: 78px;
    z-index: 1010;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin: -2px 0 12px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 7px 20px rgba(16,24,40,.06);
    scrollbar-width: thin;
}
.company-form-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 9px;
    color: #475467;
    font-size: .78rem;
    font-weight: 720;
    text-decoration: none;
    white-space: nowrap;
}
.company-form-nav a:hover {
    background: var(--blue-soft);
    color: var(--blue);
    text-decoration: none;
}
.company-form-nav a span {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: 7px;
    background: #f2f4f7;
    color: #667085;
    font-size: .67rem;
    font-weight: 850;
}
.company-form-modern .company-form-section {
    --company-section-accent: #1d4ed8;
    position: relative;
    scroll-margin-top: 150px;
    margin: 0 0 12px;
    padding: 16px 17px 17px;
    border: 1px solid #e4e7ec;
    border-left: 4px solid var(--company-section-accent);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(16,24,40,.035);
}
.company-form-modern .company-form-section:nth-of-type(2) { --company-section-accent: #7c3aed; }
.company-form-modern .company-form-section:nth-of-type(3) { --company-section-accent: #0891b2; }
.company-form-modern .company-form-section:nth-of-type(4) { --company-section-accent: #0f766e; }
.company-form-modern .company-form-section:nth-of-type(5) { --company-section-accent: #b45309; }
.company-form-modern .company-form-section:nth-of-type(6) { --company-section-accent: #2563eb; }
.company-form-modern .company-form-section:nth-of-type(7) { --company-section-accent: #9333ea; }
.company-form-modern .company-form-section:nth-of-type(8) { --company-section-accent: #be123c; }
.company-form-modern .company-form-section:nth-of-type(9) { --company-section-accent: #047857; }
.company-form-modern .company-form-section::before {
    content: attr(data-step);
    position: absolute;
    top: 14px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 25px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--company-section-accent);
    font-size: .7rem;
    font-weight: 850;
}
.company-form-modern .form-section-heading {
    align-items: center;
    gap: 12px;
    margin: 0 42px 12px 0;
    padding: 0;
}
.company-form-modern .form-section-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}
.company-form-modern .form-section-heading p {
    max-width: 500px;
    margin: 0;
    font-size: .82rem;
    line-height: 1.35;
}
.company-form-modern .section-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--company-section-accent);
    font-size: .62rem;
    letter-spacing: .1em;
}
.company-form-modern .row.g-3 {
    --bs-gutter-x: .9rem;
    --bs-gutter-y: .72rem;
}
.company-form-modern .form-label {
    margin-bottom: 4px;
    color: #344054;
    font-size: .81rem;
    font-weight: 700;
}
.company-form-modern .form-control,
.company-form-modern .form-select {
    min-height: 38px;
    border-radius: 9px;
    font-size: .9rem;
}
.company-form-modern textarea.form-control {
    min-height: 62px;
}
.company-form-modern .form-text,
.company-form-modern .text-danger {
    font-size: .76rem;
    line-height: 1.3;
}
.company-form-modern .form-section-security {
    margin: 0 0 12px;
    padding: 16px 17px 17px;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #fbfcff);
}

.company-form-modern .company-module-settings {
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    background: #f8fafc;
}
.company-form-modern .company-module-settings-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}
.company-form-modern .company-module-settings-heading h3,
.company-form-modern .company-secondary-settings-heading h3 {
    margin: 1px 0 0;
    color: #1d2939;
    font-size: .95rem;
    font-weight: 760;
}
.company-form-modern .company-module-settings-heading p {
    max-width: 430px;
    margin: 0;
    color: #667085;
    font-size: .78rem;
    line-height: 1.35;
}
.company-form-modern .company-module-settings-kicker {
    display: block;
    color: #667085;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .08em;
}
.company-form-modern .company-module-card {
    height: 100%;
    padding: 12px 13px;
    border: 1px solid #e4e7ec;
    border-radius: 11px;
    background: #fff;
}
.company-form-modern .company-module-card .form-check {
    min-height: 1.5rem;
    margin-bottom: 5px;
}
.company-form-modern .company-module-card .form-check-label {
    color: #344054;
    font-size: .86rem;
}
.company-form-modern .company-module-card .form-text {
    margin-top: 0;
    color: #667085;
}
.company-form-modern .company-secondary-settings {
    padding-top: 1px;
}
.company-form-modern .company-secondary-settings-heading {
    margin-bottom: 8px;
}
.company-form-modern .company-module-card-secondary {
    background: #fcfcfd;
}
.company-form-modern .company-logo-editor {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
    padding: 11px;
    border-radius: 12px;
}
.company-form-modern .company-logo-preview {
    width: 118px;
    height: 76px;
    border-radius: 10px;
}
.company-form-modern .form-check.border {
    border-color: #e4e7ec !important;
    background: #f9fafb;
}
.company-form-modern .credential-status {
    margin-top: 0;
}
.company-form-modern .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 1000;
    justify-content: flex-end;
    margin: 4px -14px -14px;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 15px 15px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 -8px 22px rgba(16,24,40,.05);
}
.sidebar-link-last {
    margin-top: 7px;
    border-top: 1px solid #eef2f6;
    padding-top: 11px !important;
}

.tenant-database-card {
    max-width: 1240px;
    padding: 18px;
    border-color: #f1d7a8;
    background: linear-gradient(180deg, #fffdf8 0%, #fff 100%);
}
.tenant-database-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.tenant-database-heading h2 {
    margin: 5px 0 4px;
    font-size: 1.12rem;
}
.tenant-database-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: .86rem;
}
.tenant-database-badge,
.tenant-routing-state {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 850;
    letter-spacing: .06em;
}
.tenant-database-badge {
    padding: 4px 8px;
    background: #fff4e5;
    color: #9a5b00;
}
.tenant-routing-state {
    flex: 0 0 auto;
    padding: 6px 10px;
    letter-spacing: 0;
}
.tenant-routing-state.is-active {
    background: #ecfdf3;
    color: #027a48;
}
.tenant-routing-state.is-shared {
    background: #f2f4f7;
    color: #475467;
}
.tenant-database-explainer,
.tenant-database-status-grid {
    display: grid;
    gap: 10px;
}
.tenant-database-explainer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
}
.tenant-database-explainer > div {
    padding: 11px 12px;
    border: 1px solid #eaecf0;
    border-radius: 11px;
    background: #fff;
}
.tenant-database-explainer strong,
.tenant-database-explainer span,
.tenant-database-status-grid span,
.tenant-database-status-grid strong {
    display: block;
}
.tenant-database-explainer strong {
    margin-bottom: 3px;
    font-size: .8rem;
}
.tenant-database-explainer span {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.35;
}
.tenant-database-status-grid {
    grid-template-columns: 1.4fr 1fr .8fr;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #eaecf0;
    border-radius: 11px;
    background: #f8fafc;
}
.tenant-database-status-grid span {
    margin-bottom: 2px;
    color: #667085;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tenant-database-status-grid strong {
    overflow-wrap: anywhere;
    font-size: .82rem;
}
.tenant-database-warning {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 3px solid #d97706;
    border-radius: 8px;
    background: #fff8eb;
    font-size: .8rem;
}
.tenant-database-warning span {
    color: #6b5a42;
}
.tenant-database-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .company-form-nav { top: 72px; }
    .tenant-database-explainer,
    .tenant-database-status-grid { grid-template-columns: 1fr; }
    .tenant-database-heading { flex-direction: column; }
}

@media (max-width: 620px) {
    .company-form-card { padding: 9px; }
    .company-form-modern .company-form-section { padding: 13px 12px 14px; }
    .company-form-modern .form-section-heading { align-items: flex-start; margin-right: 34px; }
    .company-form-modern .company-logo-editor { grid-template-columns: 1fr; }
    .company-form-modern .company-logo-preview { width: 100%; height: 92px; }
    .company-form-modern .form-actions { margin: 4px -9px -9px; }
    .tenant-database-card { padding: 14px; }
    .tenant-database-warning { flex-direction: column; }
}

.tenant-tools-disclosure {
    max-width: 1240px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.tenant-tools-disclosure > summary {
    position: relative;
    cursor: pointer;
    list-style: none;
    padding: 10px 40px 10px 14px;
    color: #667085;
    font-size: .8rem;
    font-weight: 750;
}
.tenant-tools-disclosure > summary::-webkit-details-marker { display: none; }
.tenant-tools-disclosure > summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%) rotate(90deg);
}
.tenant-tools-disclosure:not([open]) > summary::after {
    transform: translateY(-50%);
}
.tenant-tools-disclosure > summary:hover {
    background: #f8fafc;
    color: #344054;
}
.tenant-tools-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-top: 1px solid #eaecf0;
    background: #fffdf8;
}
.tenant-tools-body strong { font-size: .86rem; }
.tenant-tools-body p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .78rem;
}
@media (max-width: 780px) {
    .tenant-tools-body { align-items: flex-start; flex-direction: column; }
}

/* V61.9.41 · Clientes y proveedores: formularios compactos y modernos */
.partner-page-heading {
    margin-bottom: 14px;
}
.partner-page-heading .eyebrow {
    margin-bottom: 4px;
}
.partner-page-heading p {
    max-width: 760px;
}
.partner-form-card {
    max-width: 1240px;
    padding: 14px;
    overflow: visible;
}
.partner-form-modern {
    display: block;
}
.partner-validation-summary:empty {
    display: none;
}
.partner-form-nav {
    position: sticky;
    top: 78px;
    z-index: 1010;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin: -2px 0 12px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 7px 20px rgba(16,24,40,.06);
    scrollbar-width: thin;
}
.partner-form-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 9px;
    color: #475467;
    font-size: .78rem;
    font-weight: 720;
    text-decoration: none;
    white-space: nowrap;
}
.partner-form-nav a:hover {
    background: var(--blue-soft);
    color: var(--blue);
    text-decoration: none;
}
.partner-form-nav a span {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: 7px;
    background: #f2f4f7;
    color: #667085;
    font-size: .67rem;
    font-weight: 850;
}
.partner-form-modern .partner-form-section {
    --partner-section-accent: #1d4ed8;
    position: relative;
    scroll-margin-top: 150px;
    margin: 0 0 12px;
    padding: 16px 17px 17px;
    border: 1px solid #e4e7ec;
    border-left: 4px solid var(--partner-section-accent);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(16,24,40,.035);
}
.partner-form-modern .partner-section-identity { --partner-section-accent: #2563eb; }
.partner-form-modern .partner-section-activity { --partner-section-accent: #7c3aed; }
.partner-form-modern .partner-section-location { --partner-section-accent: #0891b2; }
.partner-form-modern .partner-section-export { --partner-section-accent: #b45309; background: linear-gradient(180deg, #fffdfa 0%, #fff 100%); }
.partner-form-modern .partner-section-contact { --partner-section-accent: #047857; }
.partner-form-modern .partner-form-section::before {
    content: attr(data-step);
    position: absolute;
    top: 14px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 25px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--partner-section-accent);
    font-size: .7rem;
    font-weight: 850;
}
.partner-form-modern .form-section-heading {
    align-items: center;
    gap: 12px;
    margin: 0 42px 12px 0;
    padding: 0;
}
.partner-form-modern .form-section-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
}
.partner-form-modern .form-section-heading p {
    max-width: 510px;
    margin: 0;
    font-size: .82rem;
    line-height: 1.35;
}
.partner-form-modern .section-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--partner-section-accent);
    font-size: .62rem;
    letter-spacing: .1em;
}
.partner-form-modern .row.g-3 {
    --bs-gutter-x: .9rem;
    --bs-gutter-y: .72rem;
}
.partner-form-modern .form-label {
    margin-bottom: 4px;
    color: #344054;
    font-size: .81rem;
    font-weight: 700;
}
.partner-form-modern .form-control,
.partner-form-modern .form-select {
    min-height: 38px;
    border-radius: 9px;
    font-size: .9rem;
}
.partner-form-modern textarea.form-control {
    min-height: 58px;
    resize: vertical;
}
.partner-form-modern .form-text,
.partner-form-modern .text-danger {
    font-size: .75rem;
    line-height: 1.3;
}
.partner-form-modern .catalog-input-row {
    gap: 7px;
}
.partner-form-modern .catalog-code-input {
    min-width: 88px;
}
.partner-highlight-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 11px;
    background: #f9fafb;
}
.partner-highlight-switch .form-check-label {
    color: #344054;
    font-size: .84rem;
    font-weight: 720;
}
.partner-highlight-switch > span {
    max-width: 620px;
    color: #667085;
    font-size: .76rem;
    line-height: 1.3;
    text-align: right;
}
.export-customer-switch {
    border-color: #f1d7a8;
    background: #fffaf0;
}
.partner-status-switch {
    border-color: #d7ebe3;
    background: #f7fcfa;
}
.partner-section-note {
    margin: -1px 0 12px;
    padding: 9px 11px;
    border-left: 3px solid var(--partner-section-accent);
    border-radius: 8px;
    background: #fff8eb;
    color: #6b5a42;
    font-size: .78rem;
    line-height: 1.35;
}
.partner-form-modern .partner-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 1000;
    justify-content: flex-end;
    margin: 4px -14px -14px;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 15px 15px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 -8px 22px rgba(16,24,40,.05);
}
.customer-page-heading .eyebrow { color: #2563eb; }
.supplier-page-heading .eyebrow { color: #047857; }
.supplier-form-modern .partner-section-identity { --partner-section-accent: #047857; }
.supplier-form-modern .partner-section-activity { --partner-section-accent: #2563eb; }
.supplier-form-modern .partner-section-location { --partner-section-accent: #0891b2; }
.supplier-form-modern .partner-section-contact { --partner-section-accent: #7c3aed; }

@media (max-width: 900px) {
    .partner-form-nav { top: 72px; }
    .partner-highlight-switch {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
    .partner-highlight-switch > span { text-align: left; }
}

@media (max-width: 620px) {
    .partner-form-card { padding: 9px; }
    .partner-form-modern .partner-form-section { padding: 13px 12px 14px; }
    .partner-form-modern .form-section-heading { align-items: flex-start; margin-right: 34px; }
    .partner-form-modern .partner-form-actions { margin: 4px -9px -9px; }
    .partner-page-heading .btn { width: 100%; }
}

/* V61.9.70: detalle de productos más compacto verticalmente, sin reducir anchos ni alterar controles. */
.sale-compact-form .sale-detail-card {
    margin-bottom: .75rem !important;
}

.sale-compact-form .sale-detail-card > .card-header {
    padding-top: .44rem;
    padding-bottom: .44rem;
}

.sale-compact-form .sale-detail-card > .card-header strong {
    font-size: .88rem;
    line-height: 1.1;
}

.sale-compact-form .sale-detail-card > .card-header .btn {
    padding-top: .24rem;
    padding-bottom: .24rem;
    line-height: 1.15;
}

/* Se mantiene intacto el ancho de columnas/campos; solo se reduce altura y espacio vertical. */
.sale-compact-form #lines-table > thead > tr > th {
    padding-top: .32rem;
    padding-bottom: .32rem;
    vertical-align: middle;
    font-size: .72rem;
    line-height: 1.12;
    white-space: nowrap;
}

.sale-compact-form #lines-table > tbody > tr > td {
    padding-top: .23rem;
    padding-bottom: .23rem;
    vertical-align: middle;
}

.sale-compact-form #lines-table .form-control,
.sale-compact-form #lines-table .form-select {
    min-height: 31px;
    height: 31px;
    padding-top: .18rem;
    padding-bottom: .18rem;
    border-radius: 7px;
    font-size: .82rem;
    line-height: 1.15;
}

.sale-compact-form #lines-table input[type="number"].form-control {
    font-variant-numeric: tabular-nums;
}

.sale-compact-form #lines-table td > small,
.sale-compact-form #lines-table .text-muted.small,
.sale-compact-form #lines-table .small.text-muted {
    margin-top: .08rem !important;
    margin-bottom: 0 !important;
    font-size: .64rem;
    line-height: 1.08;
}

.sale-compact-form #lines-table .line-price-with-tax,
.sale-compact-form #lines-table .line-subtotal {
    font-size: .82rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sale-compact-form #lines-table .remove-line {
    min-width: 30px;
    width: 30px;
    min-height: 30px;
    height: 30px;
    padding: 0;
    line-height: 28px;
}

.sale-compact-form .sale-detail-card > .card-body.border-top {
    padding-top: .52rem;
    padding-bottom: .52rem;
}

.sale-compact-form .sale-detail-card > .card-body.border-top .d-flex {
    line-height: 1.25;
}

/* V61.9.71: ajuste fino de anchos del detalle fiscal para mantener Subtotal dentro del ancho visual del resumen. */
.sale-compact-form #lines-table th.sale-detail-discount-col,
.sale-compact-form #lines-table td.sale-detail-discount-col {
    min-width: 116px;
    width: 116px;
}

.sale-compact-form #lines-table th.sale-detail-other-col,
.sale-compact-form #lines-table td.sale-detail-other-col {
    min-width: 148px;
    width: 148px;
}

.sale-compact-form #lines-table th.sale-detail-nosubject-col,
.sale-compact-form #lines-table td.sale-detail-nosubject-col {
    min-width: 128px;
    width: 128px;
}

.sale-compact-form #lines-table th.sale-detail-exempt-col,
.sale-compact-form #lines-table td.sale-detail-exempt-col {
    min-width: 120px;
    width: 120px;
}

.sale-compact-form #lines-table th.sale-detail-subtotal-col,
.sale-compact-form #lines-table td.sale-detail-subtotal-col {
    min-width: 88px;
    width: 88px;
}

/* Estos cuatro encabezados pueden ocupar dos líneas; los demás conservan el comportamiento de V61.9.70. */
.sale-compact-form #lines-table > thead > tr > th.sale-detail-discount-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-other-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-nosubject-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-exempt-col {
    white-space: normal;
    line-height: 1.03;
}

/* El campo conserva el ancho útil de su celda, sin tocar nombres, IDs, clases funcionales ni eventos JS. */
.sale-compact-form #lines-table td.sale-detail-discount-col .form-control,
.sale-compact-form #lines-table td.sale-detail-other-col .form-control,
.sale-compact-form #lines-table td.sale-detail-nosubject-col .form-control,
.sale-compact-form #lines-table td.sale-detail-exempt-col .form-control {
    min-width: 0;
    width: 100%;
}

/* V61.9.74 - Catálogo de productos dentro de Facturación */
.billing-product-catalog-modal .modal-content {
    border: 0;
    border-radius: 1.15rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, .2);
}

.billing-product-catalog-modal .modal-header {
    padding: 1rem 1.2rem .85rem;
    border-bottom: 1px solid rgba(148, 163, 184, .2);
    background: linear-gradient(135deg, rgba(248, 250, 252, .98), rgba(241, 245, 249, .9));
}

.billing-product-catalog-modal .modal-body {
    padding: 1rem 1.2rem 1.15rem;
    background: #f8fafc;
}

.billing-product-catalog-modal .modal-footer {
    border-top: 1px solid rgba(148, 163, 184, .2);
    padding: .8rem 1.2rem;
    background: #fff;
}

.billing-product-catalog-kicker {
    margin-bottom: .15rem;
    color: #0d6efd;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.billing-product-catalog-searchbar {
    display: flex;
    gap: .65rem;
    align-items: stretch;
}

.billing-product-catalog-searchbox {
    position: relative;
    flex: 1 1 auto;
}

.billing-product-catalog-searchbox > span {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    z-index: 2;
}

.billing-product-catalog-searchbox .form-control {
    min-height: 2.65rem;
    padding-left: 2.25rem;
    border-radius: .85rem;
    background: #fff;
}

.billing-product-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(355px, 1fr));
    gap: .85rem;
    min-height: 9rem;
    transition: opacity .15s ease;
}

.billing-product-catalog-grid.is-loading {
    opacity: .55;
}

.billing-product-card {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    min-height: 188px;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 1rem;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 .35rem 1rem rgba(15, 23, 42, .045);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.billing-product-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 110, 253, .24);
    box-shadow: 0 .8rem 1.8rem rgba(15, 23, 42, .085);
}

.billing-product-card-media {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: .3rem;
    padding: .55rem;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.billing-product-image-shell {
    display: grid;
    place-items: center;
    min-height: 74px;
    border-radius: .75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, .2);
}

.billing-product-image-shell a,
.billing-product-image-shell img {
    width: 100%;
    height: 100%;
    display: block;
}

.billing-product-image-shell img {
    object-fit: contain;
    transition: transform .18s ease;
}

.billing-product-image-shell a:hover img {
    transform: scale(1.04);
}

.billing-product-image-empty {
    color: #94a3b8;
    font-size: 1.7rem;
}

.billing-product-card-body {
    min-width: 0;
    padding: .8rem .85rem .75rem;
}

.billing-product-card-top {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: flex-start;
}

.billing-product-card-title-wrap {
    min-width: 0;
}

.billing-product-code {
    display: inline-block;
    margin-bottom: .15rem;
    color: #0d6efd;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .035em;
}

.billing-product-title {
    margin: 0;
    font-size: .92rem;
    line-height: 1.25;
    color: #172033;
}

.billing-product-stock-pill {
    flex: 0 0 auto;
    max-width: 145px;
    padding: .28rem .45rem;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.billing-product-stock-pill.is-ok {
    color: #0f5132;
    background: #dff7ea;
}

.billing-product-stock-pill.is-zero {
    color: #842029;
    background: #fde7ea;
}

.billing-product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .45rem;
}

.billing-product-tags span {
    padding: .17rem .42rem;
    border-radius: 999px;
    color: #475569;
    background: #f1f5f9;
    font-size: .66rem;
    line-height: 1.25;
}

.billing-product-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .42rem;
    margin-top: .6rem;
}

.billing-product-meta-item {
    min-width: 0;
    padding: .42rem .48rem;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: .65rem;
    background: #fbfdff;
}

.billing-product-meta-label {
    display: block;
    color: #64748b;
    font-size: .62rem;
    line-height: 1.15;
}

.billing-product-meta-value {
    display: block;
    margin-top: .08rem;
    color: #1e293b;
    font-size: .74rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.billing-product-meta-value.is-emphasized {
    color: #0d6efd;
    font-size: .82rem;
}

.billing-product-dte-description {
    margin-top: .55rem;
    padding: .45rem .55rem;
    border-radius: .65rem;
    background: #f8fafc;
    font-size: .72rem;
}

.billing-product-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .65rem;
}

.billing-product-catalog-empty {
    grid-column: 1 / -1;
    min-height: 10rem;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .25rem;
    border: 1px dashed rgba(148, 163, 184, .45);
    border-radius: 1rem;
    background: #fff;
    text-align: center;
}

.billing-product-catalog-empty-icon {
    color: #94a3b8;
    font-size: 2rem;
}

@media (max-width: 767.98px) {
    .billing-product-catalog-searchbar {
        flex-direction: column;
    }

    .billing-product-catalog-grid {
        grid-template-columns: 1fr;
    }

    .billing-product-card {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .billing-product-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* V61.9.76 - Consulta protegida de productos: todo el detalle permanece dentro de la factura */
.billing-product-catalog-modal .modal-content {
    position: relative;
}

.billing-product-image-button {
    width: 100%;
    height: 100%;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.billing-product-image-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    transition: transform .18s ease;
}

.billing-product-image-button:hover img,
.billing-product-image-button:focus-visible img {
    transform: scale(1.04);
}

.billing-product-protected-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f8fafc;
}

.billing-product-protected-overlay.d-none {
    display: none !important;
}

.billing-product-protected-header,
.billing-product-protected-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: #fff;
}

.billing-product-protected-header {
    border-bottom: 1px solid rgba(148, 163, 184, .22);
    background: linear-gradient(135deg, rgba(248,250,252,.99), rgba(239,246,255,.94));
}

.billing-product-protected-footer {
    border-top: 1px solid rgba(148, 163, 184, .22);
}

.billing-product-protected-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.2rem 1.2rem;
}

.billing-product-detail-layout {
    display: grid;
    grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.45fr);
    gap: 1rem;
}

.billing-product-detail-section {
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, .23);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 .4rem 1rem rgba(15,23,42,.035);
}

.billing-product-detail-section-title {
    margin-bottom: .8rem;
    color: #172033;
    font-weight: 750;
}

.billing-product-detail-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.billing-product-detail-image-entry {
    min-width: 0;
    display: grid;
    gap: .5rem;
}

.billing-product-detail-image-button {
    display: grid;
    gap: .35rem;
    width: 100%;
    padding: .55rem;
    border: 1px solid rgba(148,163,184,.25);
    border-radius: .9rem;
    background: #f8fafc;
    cursor: zoom-in;
    text-align: center;
}

.billing-product-detail-image-button img {
    width: 100%;
    height: 185px;
    object-fit: contain;
    border-radius: .65rem;
    background: #fff;
}

.billing-product-detail-image-button span {
    color: #475569;
    font-size: .72rem;
    font-weight: 650;
}

.billing-product-detail-no-image {
    grid-column: 1 / -1;
    min-height: 210px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .4rem;
    border: 1px dashed rgba(148,163,184,.45);
    border-radius: .9rem;
    background: #f8fafc;
}

.billing-product-detail-docs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .8rem;
}

.billing-product-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
}

.billing-product-detail-field {
    min-width: 0;
    padding: .65rem .7rem;
    border: 1px solid rgba(148,163,184,.18);
    border-radius: .75rem;
    background: #fbfdff;
}

.billing-product-detail-value {
    display: block;
    margin-top: .12rem;
    color: #172033;
    font-size: .82rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.billing-product-detail-value.is-emphasized {
    color: #0d6efd;
    font-size: .9rem;
}

.billing-product-detail-description {
    margin-top: .75rem;
    padding: .75rem;
    border-radius: .8rem;
    background: #f8fafc;
}

.billing-product-image-preview-overlay {
    z-index: 35;
    background: rgba(248,250,252,.99);
}

.billing-product-image-preview-body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 1rem 1.2rem;
    background: radial-gradient(circle at center, #fff 0%, #f1f5f9 75%);
}

.billing-product-image-preview-body img {
    display: block;
    max-width: min(100%, 1050px);
    max-height: 68vh;
    object-fit: contain;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1rem 2.5rem rgba(15,23,42,.14);
}

@media (max-width: 991.98px) {
    .billing-product-detail-layout {
        grid-template-columns: 1fr;
    }

    .billing-product-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .billing-product-detail-gallery,
    .billing-product-detail-grid {
        grid-template-columns: 1fr;
    }

    .billing-product-protected-header,
    .billing-product-protected-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* V61.9.91: Cuentas por cobrar - filtros sin superposición y reportes */
.accounts-receivable-filter {
    grid-template-columns: minmax(260px, 1fr) max-content auto;
}
.accounts-receivable-filter > .form-control:only-of-type {
    grid-column: auto;
}
.ar-filter-switch {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: max-content;
    padding-left: 0 !important;
    margin: 0;
    white-space: nowrap;
}
.ar-filter-switch .form-check-input {
    float: none;
    position: static;
    margin: 0 !important;
    flex: 0 0 auto;
}
.ar-report-form .form-label { margin-bottom: .35rem; }
.ar-report-actions { border-top: 1px solid #edf0f5; padding-top: 1rem; }
.ar-report-heading { border-bottom: 1px solid #edf0f5; padding-bottom: .8rem; }
#aplicar-pago { scroll-margin-top: 1.25rem; }

@media (max-width: 780px) {
    .accounts-receivable-filter {
        grid-template-columns: 1fr;
    }
    .accounts-receivable-filter > .form-control:only-of-type {
        grid-column: auto;
    }
    .accounts-receivable-filter .btn {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .company-form-modern .company-module-settings-heading {
        flex-direction: column;
        gap: 5px;
    }
    .company-form-modern .company-module-settings-heading p {
        max-width: none;
    }
}

/* CHG-INV-0001 R5: formulario compacto de envíos de productos. */
.inventory-transfer-form .card {
    border-radius: 12px;
}

.inventory-transfer-form .card-header {
    padding: .52rem .75rem;
    border-radius: 12px 12px 0 0 !important;
    font-size: .88rem;
}

.inventory-transfer-form .card-body {
    padding: .62rem .75rem;
}

.inventory-transfer-form .form-label {
    margin-bottom: .16rem;
    font-size: .78rem;
    line-height: 1.2;
}

.inventory-transfer-form .form-control,
.inventory-transfer-form .form-select {
    min-height: 34px;
    padding: .34rem .5rem;
    border-radius: 9px;
    font-size: .86rem;
}

.inventory-transfer-form .transfer-notes {
    min-height: 38px;
    resize: vertical;
}

.inventory-transfer-form .form-text,
.inventory-transfer-form .text-danger,
.inventory-transfer-form .small {
    font-size: .72rem;
    line-height: 1.25;
}

.inventory-transfer-form #transferDetailCard .card-header {
    padding-top: .45rem;
    padding-bottom: .45rem;
}

.inventory-transfer-form #transferLinesTable > :not(caption) > * > * {
    padding: .42rem .5rem;
}

.inventory-transfer-form #transferLinesTable thead th {
    padding-top: .42rem;
    padding-bottom: .42rem;
    font-size: .72rem;
    letter-spacing: .015em;
}

.inventory-transfer-form #transferLinesTable .product-description,
.inventory-transfer-form #transferLinesTable .product-search,
.inventory-transfer-form #transferLinesTable .quantity-input {
    min-height: 32px;
    padding-top: .28rem;
    padding-bottom: .28rem;
}

.inventory-transfer-form #transferLinesTable .availability-value {
    font-size: .86rem;
}

.inventory-transfer-form #transferLinesTable .identity-fields .form-control {
    min-height: 31px;
    padding: .26rem .42rem;
}

.inventory-transfer-form .remove-line {
    width: 34px;
    height: 32px;
    padding: 0;
    border-radius: 9px;
}

.inventory-transfer-form > .d-flex:last-child .btn {
    padding: .42rem .72rem;
    font-size: .86rem;
}

/* R5: encabezado identificable en el formato/pantalla de envío. */
.transfer-document-header {
    min-height: 68px;
    padding: .65rem .85rem;
}

.transfer-company-logo {
    width: auto;
    max-width: 82px;
    height: 46px;
    object-fit: contain;
}

.transfer-company-name {
    color: #111827;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.15;
}

.transfer-document-label {
    margin-top: .12rem;
    color: #667085;
    font-size: .78rem;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .inventory-transfer-form .card-body {
        padding: .58rem .65rem;
    }

    .transfer-document-header {
        align-items: flex-start !important;
    }

    .transfer-company-logo {
        max-width: 68px;
        height: 40px;
    }
}

@media print {
    .transfer-document-card {
        border: 0 !important;
    }

    .transfer-document-header {
        padding: 0 0 10px !important;
        border-bottom: 1px solid #d9dee8 !important;
        background: #fff !important;
    }

    .transfer-company-name {
        font-size: 16pt;
    }

    .transfer-company-logo {
        max-width: 92px;
        height: 54px;
    }
}

/* CHG-DTE-SIGNER-0001 R2: selección visible del firmador por empresa. */
.company-form-modern .company-signer-settings {
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    background: #f8fafc;
}
.company-form-modern .company-signer-card {
    display: block;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.company-form-modern .company-signer-card:hover {
    border-color: #98a2b3;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
    transform: translateY(-1px);
}
.company-form-modern .company-signer-card .form-check-input {
    margin-top: .15rem;
}

/* CHG-SALES-PRICE-RECOVERY-0001: selector P1/P2/P3 compacto. */
.sale-price-toolbar {
    display: flex;
    align-items: end;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .65rem .75rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.sale-default-price-selector {
    width: 150px;
}

.sale-price-toolbar-help {
    flex: 1 1 320px;
    margin-bottom: .25rem;
}

#lines-table .line-price-type {
    min-width: 72px;
    width: 72px;
    padding-left: .4rem;
    padding-right: 1.7rem;
}

#lines-table th.price-with-tax-col,
#lines-table td.price-with-tax-col {
    min-width: 150px;
    width: 150px;
}

#lines-table td.price-with-tax-col .unit-price-with-tax,
#lines-table td.price-with-tax-col .unit-price {
    min-width: 122px;
    width: 100%;
    font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   CHG-SALES-DETAIL-SINGLE-ROW-0001
   REGLA PROTEGIDA: cada detalle de Facturación mantiene selector de precio,
   precio y campos fiscales compactos en UNA MISMA FILA visual.
   No ampliar estas columnas ni volver a apilar selector/precio.
   ========================================================================== */
.sale-compact-form #lines-table > tbody > tr.sale-line > td {
    vertical-align: middle;
    padding-left: .22rem;
    padding-right: .22rem;
}

.sale-compact-form #lines-table th.sale-detail-product-col,
.sale-compact-form #lines-table td.sale-detail-product-col {
    min-width: 220px;
    width: 220px;
}

.sale-compact-form #lines-table th.sale-detail-description-col,
.sale-compact-form #lines-table td.sale-detail-description-col {
    min-width: 190px;
    width: 190px;
}

.sale-compact-form #lines-table th.sale-detail-qty-col,
.sale-compact-form #lines-table td.sale-detail-qty-col {
    min-width: 70px;
    width: 70px;
}

.sale-compact-form #lines-table .product-search-box {
    min-width: 0;
    width: 100%;
}

.sale-compact-form #lines-table td:first-child > small.text-muted {
    display: none;
}

.sale-compact-form #lines-table .sale-price-inline {
    display: flex;
    align-items: center;
    gap: .22rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.sale-compact-form #lines-table .sale-price-inline .line-price-type {
    flex: 0 0 62px;
    min-width: 62px;
    width: 62px;
    margin: 0 !important;
    padding-left: .32rem;
    padding-right: 1.35rem;
}

.sale-compact-form #lines-table .sale-price-inline .unit-price,
.sale-compact-form #lines-table .sale-price-inline .unit-price-with-tax {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
}

.sale-compact-form #lines-table .sale-price-inline .line-price-with-tax {
    flex: 1 1 0;
    min-width: 72px;
    text-align: right;
}

.sale-compact-form #lines-table th.price-without-tax-col,
.sale-compact-form #lines-table td.price-without-tax-col {
    min-width: 104px;
    width: 104px;
}

.sale-compact-form #lines-table th.price-with-tax-col,
.sale-compact-form #lines-table td.price-with-tax-col {
    min-width: 176px;
    width: 176px;
}

.sale-compact-form #lines-table th.sale-detail-discount-col,
.sale-compact-form #lines-table td.sale-detail-discount-col {
    min-width: 86px;
    width: 86px;
}

.sale-compact-form #lines-table th.sale-detail-other-col,
.sale-compact-form #lines-table td.sale-detail-other-col {
    min-width: 104px;
    width: 104px;
}

.sale-compact-form #lines-table th.sale-detail-nosubject-col,
.sale-compact-form #lines-table td.sale-detail-nosubject-col {
    min-width: 102px;
    width: 102px;
}

.sale-compact-form #lines-table th.sale-detail-exempt-col,
.sale-compact-form #lines-table td.sale-detail-exempt-col {
    min-width: 96px;
    width: 96px;
}

.sale-compact-form #lines-table th.sale-detail-subtotal-col,
.sale-compact-form #lines-table td.sale-detail-subtotal-col {
    min-width: 80px;
    width: 80px;
}

.sale-compact-form #lines-table > thead > tr > th.sale-detail-discount-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-other-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-nosubject-col,
.sale-compact-form #lines-table > thead > tr > th.sale-detail-exempt-col {
    white-space: nowrap;
    line-height: 1.05;
    font-size: .68rem;
}

.sale-compact-form #lines-table .sale-fiscal-inline {
    display: flex;
    align-items: center;
    gap: .12rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.sale-compact-form #lines-table .sale-fiscal-inline .form-control {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    padding-left: .28rem;
    padding-right: .28rem;
}

.sale-compact-form #lines-table .sale-fiscal-inline small {
    flex: 0 0 auto;
    margin: 0 !important;
    font-size: .58rem;
    line-height: 1;
    white-space: nowrap;
}

.sale-compact-form #lines-table > thead > tr > th {
    vertical-align: middle;
}

/* Si el viewport no permite contener todo, se conserva UNA fila y se usa
   desplazamiento horizontal; nunca se apilan selector y precio. */
.sale-compact-form .sale-lines-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

/* CHG-SALES-SEARCH-LAYOUT-0001-R2-START */
/*
   REGLA RESPONSIVE PROTEGIDA:
   PC: buscador 330 / descripcion 280
   Tablet: buscador 280 / descripcion 240
   Telefono: controles usables con ancho limitado al viewport.
   Selector P1/P2/P3 + precio mantiene nowrap.
*/
.sale-compact-form .sale-lines-responsive {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.sale-compact-form #lines-table th.sale-detail-product-col,
.sale-compact-form #lines-table td.sale-detail-product-col {
    min-width: 330px;
    width: 330px;
}

.sale-compact-form #lines-table th.sale-detail-description-col,
.sale-compact-form #lines-table td.sale-detail-description-col {
    min-width: 280px;
    width: 280px;
}

.sale-compact-form #lines-table .product-search-box {
    min-width: 330px;
    width: 100%;
}

.sale-compact-form #lines-table .line-description {
    min-width: 260px;
    width: 100%;
}

.sale-compact-form #lines-table .sale-price-inline {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .35rem;
    min-width: 150px;
}

.sale-compact-form #lines-table .sale-price-inline .line-price-type {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
}

.sale-compact-form #lines-table .sale-price-inline .unit-price,
.sale-compact-form #lines-table .sale-price-inline .unit-price-with-tax {
    flex: 1 1 0;
    min-width: 78px;
}

.sale-compact-form #lines-table .product-search-results.typeahead-floating-panel {
    position: fixed !important;
    right: auto !important;
    z-index: 2200;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Tablet */
@media (max-width: 991.98px) {
    .sale-compact-form #lines-table th.sale-detail-product-col,
    .sale-compact-form #lines-table td.sale-detail-product-col {
        min-width: 280px;
        width: 280px;
    }

    .sale-compact-form #lines-table th.sale-detail-description-col,
    .sale-compact-form #lines-table td.sale-detail-description-col {
        min-width: 240px;
        width: 240px;
    }

    .sale-compact-form #lines-table .product-search-box {
        min-width: 280px;
    }

    .sale-compact-form #lines-table .line-description {
        min-width: 220px;
    }
}

/* Telefono */
@media (max-width: 575.98px) {
    .sale-compact-form .sale-lines-responsive {
        width: 100%;
        max-width: 100vw;
    }

    .sale-compact-form #lines-table th.sale-detail-product-col,
    .sale-compact-form #lines-table td.sale-detail-product-col {
        min-width: min(82vw, 280px);
        width: min(82vw, 280px);
    }

    .sale-compact-form #lines-table th.sale-detail-description-col,
    .sale-compact-form #lines-table td.sale-detail-description-col {
        min-width: min(78vw, 250px);
        width: min(78vw, 250px);
    }

    .sale-compact-form #lines-table .product-search-box {
        min-width: min(82vw, 280px);
    }

    .sale-compact-form #lines-table .line-description {
        min-width: min(74vw, 230px);
    }

    .sale-compact-form #lines-table .sale-price-inline {
        min-width: 148px;
    }
}
/* CHG-SALES-SEARCH-LAYOUT-0001-R2-END */

/* CHG-SALES-LAYOUT-FULLWIDTH-0001-START */
/*
   R8.4 - Regla protegida:
   - El detalle usa el 100% del ancho disponible en PC.
   - Producto y Descripcion reciben prioridad visual.
   - P1/P2/P3 + precio permanecen en una misma fila.
   - Columnas fiscales permanecen compactas.
   - Tablet/telefono conservan scroll horizontal tactil.
*/
.sale-compact-form .sale-lines-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.sale-compact-form #lines-table {
    width: 100% !important;
    min-width: 1180px;
    table-layout: auto;
    margin-right: 0;
}

.sale-compact-form #lines-table th.sale-detail-product-col,
.sale-compact-form #lines-table td.sale-detail-product-col {
    width: 24%;
    min-width: 340px;
}

.sale-compact-form #lines-table th.sale-detail-description-col,
.sale-compact-form #lines-table td.sale-detail-description-col {
    width: 22%;
    min-width: 300px;
}

.sale-compact-form #lines-table .product-search-box,
.sale-compact-form #lines-table .product-search-box input,
.sale-compact-form #lines-table .line-description {
    width: 100%;
    max-width: none;
}

.sale-compact-form #lines-table .sale-price-inline {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    min-width: 160px;
    gap: .35rem;
}

.sale-compact-form #lines-table .sale-price-inline .line-price-type {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
}

.sale-compact-form #lines-table .sale-price-inline .unit-price,
.sale-compact-form #lines-table .sale-price-inline .unit-price-with-tax {
    flex: 1 1 auto;
    min-width: 82px;
}

.sale-compact-form #lines-table th.sale-detail-discount-col,
.sale-compact-form #lines-table td.sale-detail-discount-col,
.sale-compact-form #lines-table th.sale-detail-other-col,
.sale-compact-form #lines-table td.sale-detail-other-col,
.sale-compact-form #lines-table th.sale-detail-nosubject-col,
.sale-compact-form #lines-table td.sale-detail-nosubject-col,
.sale-compact-form #lines-table th.sale-detail-exempt-col,
.sale-compact-form #lines-table td.sale-detail-exempt-col {
    width: 7%;
    white-space: nowrap;
}

.sale-compact-form #lines-table .product-search-box::after {
    content: none !important;
}

/* PC grande: ocupar todo el espacio disponible, no dejar hueco a la derecha. */
@media (min-width: 1200px) {
    .sale-compact-form #lines-table {
        min-width: 100%;
    }
}

/* Tablet y telefono: mantener la fila completa y permitir desplazamiento tactil. */
@media (max-width: 1199.98px) {
    .sale-compact-form #lines-table {
        min-width: 1180px;
    }
}
/* CHG-SALES-LAYOUT-FULLWIDTH-0001-END */




 /* CHG-SALES-DETAIL-INLINE-INVARIANT-0001-START */ /* CHG-SALES-DETAIL-INLINE-INVARIANT-0001-END */ /* CHG-SALES-DETAIL-INLINE-INVARIANT-0001-START */
.sale-compact-form .sale-price-inline {
    flex-wrap: nowrap !important;
}

.sale-compact-form #lines-table th.sale-detail-product-col,
.sale-compact-form #lines-table td.sale-detail-product-col {
    min-width: 340px;
}

.sale-compact-form #lines-table th.sale-detail-description-col,
.sale-compact-form #lines-table td.sale-detail-description-col {
    min-width: 300px;
}
/* CHG-SALES-DETAIL-INLINE-INVARIANT-0001-END */

/* CHG-SUMMARY-COMPACT-RIGHT-INVARIANT-0001-START */
/*
   REGLA INVIOLABLE R8.10
   ----------------------
   TODO resumen explicitamente identificado:
   - se mantiene despues del detalle;
   - es una sola columna vertical;
   - es compacto;
   - en escritorio queda pegado a la derecha;
   - NUNCA usa todo el ancho del formulario;
   - en telefono puede usar 100% por falta de espacio lateral.

   Nunca aplicar esta clase a cards generales, sidebar, encabezado,
   datos del emisor/receptor, detalle o pagos.
*/
:root {
    --control-dte-summary-compact-width: 410px;
}

.sale-compact-form .summary-compact-right-invariant,
.purchase-compact-form .summary-compact-right-invariant,
form .summary-compact-right-invariant,
[data-summary-panel="compact-right"].summary-compact-right-invariant {
    display: block !important;
    width: clamp(340px, 28vw, var(--control-dte-summary-compact-width)) !important;
    max-width: var(--control-dte-summary-compact-width) !important;
    min-width: 340px !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
    text-align: initial !important;
}

/* Mantener el layout interno ORIGINAL. Etiqueta e importe pueden compartir
   fila, pero el conjunto completo del resumen es UNA sola columna vertical. */
.summary-compact-right-invariant > * {
    max-width: 100% !important;
}

.summary-compact-right-invariant .summary-removed-legend,
.summary-compact-right-invariant .summary-hidden-hint {
    display: none !important;
}

/* No permitir que Bootstrap/grid vuelva a estirar el PANEL completo. */
.summary-compact-right-invariant.col,
.summary-compact-right-invariant[class*="col-"] {
    flex: 0 0 auto !important;
}

/* Telefono: el panel ocupa el ancho util porque no existe espacio lateral.
   Tablet/PC conservan el panel compacto a la derecha. */
@media (max-width: 767.98px) {
    .sale-compact-form .summary-compact-right-invariant,
    .purchase-compact-form .summary-compact-right-invariant,
    form .summary-compact-right-invariant,
    [data-summary-panel="compact-right"].summary-compact-right-invariant {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
/* CHG-SUMMARY-COMPACT-RIGHT-INVARIANT-0001-END */

/* CHG-SALES-FISCAL-INLINE-HELPERS-0001-START */
.sale-compact-form td[data-fiscal-inline-clean="true"] .sales-fiscal-inline-helper,
.sale-compact-form td[data-fiscal-inline-clean="true"] .fiscal-inline-preview,
.sale-compact-form td[data-fiscal-inline-clean="true"] .detail-inline-total,
.sale-compact-form td[data-fiscal-inline-clean="true"] .inline-money-hint,
.sale-compact-form td[data-fiscal-inline-clean="true"] .line-zero-helper,
.sale-compact-form td[data-fiscal-inline-clean="true"] [data-inline-total],
.sale-compact-form td[data-fiscal-inline-clean="true"] [data-fiscal-preview] {
    display: none !important;
}
/* CHG-SALES-FISCAL-INLINE-HELPERS-0001-END */
