/* BOX Blazor — Dashkit responsive + dark/light + sidebar compact */

:root {
    /* Reserva legacy (modales PDF) */
    --box-viewport-chrome: 4.25rem;
    --box-viewport-chrome-mobile: 7rem;
    /* Marco gris uniforme alrededor del panel blanco de datos (no aplica al menú lateral) */
    --box-page-margin: 0.5rem;
}

html, body {
    height: 100%;
    margin: 0;
}

#app {
    min-height: 100vh;
}

.box-boot {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #fff;
}

.box-boot-logo {
    width: min(900px, 90vw);
    height: auto;
}

html[data-box-theme="dark"] .box-boot {
    background: #12263f;
}

.box-boot-spinner-host {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
}
.box-inline-sf-spinner .e-spinner-label,
.box-boot-sf-spinner .e-spinner-label {
    display: none !important;
}
.box-inline-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
}
.box-archivo-digital-loading {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
}
.box-pdf-viewer {
    position: relative;
}
.box-pdf-viewer-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(82, 86, 89, 0.55);
}
.box-boot-spinner {
    width: 3rem;
    height: 3rem;
    border: 0.25rem solid rgba(149, 170, 201, 0.35);
    border-top-color: #2c7be5;
    border-radius: 50%;
    animation: box-boot-spin 0.75s linear infinite;
}
html[data-box-theme="dark"] .box-boot-spinner {
    border-color: rgba(149, 170, 201, 0.25);
    border-top-color: #5b9cf5;
}
@keyframes box-boot-spin {
    to {
        transform: rotate(360deg);
    }
}
.box-boot-text {
    color: #95aac9;
    font-size: 0.95rem;
    max-width: min(900px, 90vw);
    text-align: center;
}
.box-boot-text--hidden:not(:empty) {
    display: block;
    margin-top: 0.5rem;
}
.box-boot-text--hidden:empty {
    display: none;
}

/* Login */
.box-login-page {
    min-height: 100vh;
    background: #fff;
}

html[data-box-theme="dark"] .box-login-page {
    background: #12263f;
}

.box-login-card {
    background-color: #fff;
    box-shadow: 0 0 20px 10px rgba(33, 133, 255, 0.1);
}

html[data-box-theme="dark"] .box-login-card {
    background-color: #1b2a4e;
    box-shadow: 0 0 24px 8px rgba(0, 0, 0, 0.35);
    color: #fff;
}

.box-login-error {
    color: #e63757;
    font-size: 0.9rem;
}

.box-login-captcha {
    display: flex;
    justify-content: center;
}

.box-logo-preview {
    min-height: 8rem;
    border: 1px dashed #d2ddec;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: #fff;
}

.box-logo-preview img {
    max-width: 100%;
    max-height: 10rem;
    object-fit: contain;
}

/* Miniatura en grid de firmas */
.box-firma-logo-col {
    width: 3.25rem;
    min-width: 3.25rem;
    max-width: 3.25rem;
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
}

.box-firma-logo-thumb {
    display: block;
    width: 48px;
    height: 19px;
    object-fit: fill;
    background: #111;
    border-radius: 2px;
}

.box-firma-logo-thumb-empty {
    background: #e3ebf6;
    border: 1px dashed #d2ddec;
}

html[data-box-theme="dark"] .box-firma-logo-thumb-empty {
    background: #1c222f;
    border-color: #3b4559;
}

/* Logotipo firma: lienzo fijo 256×100 (BoxEvo) */
.box-alta-info {
    font-weight: 400;
    line-height: 1.3;
}

.box-alta-info .fe {
    opacity: 0.75;
    margin-right: 0.75rem !important;
}

.box-flag-group {
    border: 1px solid rgba(45, 55, 72, 0.14);
    border-radius: 0.4rem;
    background: #fff;
    padding: 0.75rem 1rem 0.85rem;
}

/* Carta de porte detalle: cabecera compacta para dejar alto al grid. */
.box-cpd-cab {
    --box-control-compact-height: calc(1.35em + 0.35rem + 2px);
}
.box-cpd-cab .box-flag-group {
    padding: 0.4rem 0.55rem 0.45rem;
}
.box-cpd-cab .box-flag-group-title {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}
.box-cpd-cab .form-label.small {
    font-size: 0.7rem;
    margin-bottom: 0.12rem !important;
}
.box-cpd-cab .box-rx-cab-body {
    padding-top: 0.35rem;
}
.box-cpd-qr {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 1px solid #d2ddec;
    border-radius: 0.25rem;
    background: #fff;
    display: block;
}
.box-cpd-qr--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}
.box-cpd-obs {
    min-height: 4.25rem;
    height: auto !important;
    max-height: none !important;
    white-space: pre-wrap;
}
.box-cpd-cab :is(input.form-control, select.form-select, .box-field-display) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.box-cpd-cab textarea,
.box-cpd-cab .box-field-display--multiline {
    white-space: pre-wrap;
    text-overflow: clip;
    overflow-y: auto;
}
.box-cpd-cab .box-cpd-datetime {
    min-width: 0;
    font-size: 0.8125rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}
.box-cpd-cab .box-cpd-col-narrow {
    max-width: 7.5rem;
}

.box-flag-group-title {
    color: #ff8000;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.55rem;
}

.box-flag-group-title .box-alta-info {
    font-weight: 400;
    font-size: 0.8rem;
    color: #6c757d !important;
    margin: 0;
}

.box-flag-group .form-check {
    margin-bottom: 0.35rem;
}

/* El tema no trae .gap-*. Sin estas reglas, d-flex gap-2 no separa y los controles quedan pegados. */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 0.75rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* Casilla y su texto. form-check + gap sin la clase de arriba deja la casilla pegada al texto. */
.box-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0;
    min-height: 0;
}
.box-check .form-check-input {
    float: none;
    position: static;
    margin: 0;
    flex: 0 0 auto;
}
.box-check .form-check-label {
    margin: 0;
    padding: 0;
}

/* Modal tarifas: casillas de facturación centradas y separadas de la barra de botones */
.modal.fade.show.d-block > .modal-dialog.box-tarifas-modal-dialog {
    max-width: min(96vw, 1400px);
    width: min(96vw, 1400px);
    margin: 0.75rem auto;
}
.box-tarifas-modal-content {
    max-height: calc(100svh - 1.5rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.box-tarifas-modal-body {
    gap: 0.85rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.box-tarifas-modal-grid {
    flex: 1 1 auto;
    min-height: 18rem;
    max-height: none;
    height: min(72vh, calc(100svh - 13rem));
}

.modal.fade.show.d-block > .modal-dialog.box-pedido-notas-dialog {
    max-height: calc(100svh - 1.5rem);
}
.box-pedido-notas-grid {
    flex: 1 1 auto;
    min-height: 16rem;
    max-height: min(72vh, calc(100svh - 12rem));
}
.modal.fade.show.d-block > .modal-dialog.box-pedido-pool-dialog {
    max-width: min(52rem, 96vw);
    width: min(52rem, 96vw);
}
.box-pedido-pool-grid {
    flex: 1 1 auto;
    min-height: 14rem;
    max-height: min(70vh, calc(100svh - 14rem));
}

/* Editor de línea: por encima del listado de tarifas (1100). */
.modal.fade.show.d-block.box-tarifas-edit-modal {
    z-index: 1120;
}
.modal.fade.show.d-block > .modal-dialog.box-tarifas-edit-dialog {
    max-width: min(42rem, 96vw);
    width: min(42rem, 96vw);
    max-height: calc(100svh - 2rem);
    margin: 1rem auto;
}
.box-tarifas-edit-dialog .modal-content {
    max-height: calc(100svh - 2rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.box-tarifas-edit-dialog .modal-body {
    overflow-y: auto;
    min-height: 0;
}

.box-tarifas-flags {
    gap: 1.25rem 2.5rem;
    padding: 0.85rem 1rem 1.1rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid #d2ddec;
    background: #f5f8fc;
    border-radius: 0.35rem;
}
.box-tarifas-flags .box-check {
    font-size: 0.9rem;
    font-weight: 500;
    color: #344050;
}
.box-tarifas-flags .box-check .form-check-input {
    width: 1.15em;
    height: 1.15em;
    border-width: 1.5px;
}
html[data-box-theme="dark"] .box-tarifas-flags {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}
html[data-box-theme="dark"] .box-tarifas-flags .box-check {
    color: #d8e2ef;
}

html[data-box-theme="dark"] .box-flag-group {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-box-theme="dark"] .box-flag-group-title {
    color: #ff9a33;
}

.box-firma-logo {
    width: 256px;
    height: 100px;
    min-height: 100px;
    padding: 0;
    overflow: hidden;
    background: #111;
}

.box-firma-logo img {
    width: 256px;
    height: 100px;
    max-width: 256px;
    max-height: 100px;
    object-fit: fill;
}

.box-firma-logo .text-muted {
    color: #adb5bd !important;
    font-size: 0.8rem;
    padding: 0.5rem;
    text-align: center;
}

/* Fondo marca (como Box.Web inicio) */
.main-content {
    position: relative;
    min-height: calc(100vh - 0.5rem);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-content::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../img/edibox/boxDarkVertical.svg") center 42% / min(58vw, 640px) no-repeat;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

html[data-box-theme="dark"] .main-content::before {
    filter: invert(1) brightness(1.35);
    opacity: 0.07;
}

/* En inicio el hero ya muestra el logo: sin marca de agua duplicada */
.main-content:has(.box-home-hero)::before {
    display: none;
}

.main-content:has(.box-home-hero) {
    overflow: auto;
}

.main-content > .container-fluid {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding: var(--box-page-margin);
}

.main-content > .container-fluid > .box-main-row {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    align-self: stretch;
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    margin-left: 0;
    margin-right: 0;
}

.main-content > .container-fluid > .box-main-row > .col-12,
.main-content > .container-fluid > .box-main-row > .col-12.box-main-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
}
.main-content > .container-fluid > .box-main-row > .box-main-col {
    position: relative;
}

.main-content > .container-fluid > .box-main-row > .col-12 > .box-page-fill,
.main-content > .container-fluid > .box-main-row > .col-12 > .box-prep-ui {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

.box-prep-ui > .card.box-page-fill {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
}

.box-home-hero {
    min-height: calc(100vh - 9rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.box-home-hero-img {
    max-width: min(90vw, 960px);
    max-height: min(75vh, 75dvh, 100%);
    width: auto;
    height: auto;
    opacity: 0.1;
    object-fit: contain;
    display: block;
}

html[data-box-theme="dark"] .box-home-hero-img {
    filter: invert(1) brightness(1.35);
    opacity: 0.12;
}

/* Cards de contenido */
.box-welcome-card,
.box-placeholder {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
    padding: 1.5rem;
}

html[data-box-theme="dark"] .box-welcome-card,
html[data-box-theme="dark"] .box-placeholder {
    background: #1b2a4e;
    box-shadow: none;
    color: #fff;
}

.box-placeholder h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.box-placeholder p {
    color: #95aac9;
    margin: 0;
}

.box-icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Acciones: híbrido C — iconos en grid; icono+texto en cabeceras/formularios */
.box-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.box-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Cabecera de pantalla dentro del panel. Ver Shared/BoxScreenHeader.razor */
.box-screen-header {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.85rem 1.5rem 0.75rem;
    background: transparent;
}

.box-screen-header--title-only {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #edf2f9;
}

.box-screen-header__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
}

.box-screen-header__title--with-center {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
}

.box-screen-header__title--with-center > .box-screen-header__lead {
    grid-column: 1;
    justify-self: start;
    min-width: 0;
}

.box-screen-header__title-center {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: min(100%, 52rem);
    min-width: 0;
}

/* Navegación anterior/siguiente en detalle (centrada en la cabecera). */
.box-detalle-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.box-detalle-nav__btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    min-width: 2rem;
}
.box-detalle-nav__pos {
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #39506b;
    min-width: 3.25rem;
    text-align: center;
}
html[data-box-theme="dark"] .box-detalle-nav__pos {
    color: #95aac9;
}

.box-screen-header__title--with-center > .box-screen-header__alta,
.box-screen-header__title--with-center > .box-screen-header__trailing {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
}

@media (max-width: 991.98px) {
    .box-screen-header__title--with-center {
        grid-template-columns: minmax(0, 1fr);
    }

    .box-screen-header__title--with-center > .box-screen-header__lead,
    .box-screen-header__title--with-center > .box-screen-header__title-center,
    .box-screen-header__title--with-center > .box-screen-header__alta,
    .box-screen-header__title--with-center > .box-screen-header__trailing {
        grid-column: 1;
        justify-self: stretch;
    }

    .box-screen-header__title-center {
        justify-content: center;
    }

    .box-screen-header__title--with-center > .box-screen-header__trailing,
    .box-screen-header__title--with-center > .box-screen-header__alta {
        justify-self: start;
    }
}

.box-screen-header__lead,
.box-screen-header__extra,
.box-screen-header__alta,
.box-screen-header__left,
.box-screen-header__right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.box-screen-header__lead {
    flex: 1 1 auto;
}

.box-screen-header__extra {
    flex: 1 1 auto;
    overflow: hidden;
    font-size: 1.125rem;
    font-weight: 600;
    color: #12263f;
    letter-spacing: -0.015em;
}

.box-screen-header__title-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
    flex: 0 0 auto;
}

.box-screen-header__subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    color: #6c757d;
    white-space: nowrap;
}

.box-screen-header__action {
    flex: 0 0 auto;
    font-size: 1.125rem;
    font-weight: 600;
    color: #12263f;
    letter-spacing: -0.015em;
    line-height: 1.35;
    white-space: nowrap;
}

.box-screen-header__nombre {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.125rem;
    font-weight: 600;
    color: #12263f;
    letter-spacing: -0.015em;
    line-height: 1.35;
}

.box-screen-header__lead {
    overflow: hidden;
}

.box-screen-header__alta {
    flex: 0 0 auto;
    margin-left: auto;
    min-width: max-content;
    overflow: visible;
}

.box-screen-header__trailing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
    min-width: 0;
}

.box-screen-header__title:not(:has(.box-screen-header__alta)) > .box-screen-header__trailing {
    margin-left: auto;
}

.box-screen-header__alta + .box-screen-header__trailing {
    margin-left: 0.75rem;
}

.box-screen-header__title-end,
.box-screen-header__excel,
.box-screen-header__back {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
}

.box-screen-header__name {
    font-weight: 600;
    white-space: nowrap;
}

.box-screen-header__alta .box-alta-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 0 0 auto;
    min-width: max-content;
    margin-top: 0;
    overflow: visible;
    white-space: nowrap;
}

.box-screen-header__rule {
    height: 0;
    margin: 0.7rem -1.5rem 0;
    border: 0;
    border-top: 1px solid #edf2f9;
}

.box-screen-header__bar {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.4rem;
    max-width: 100%;
}

/* Sin hueco extra entre la fila de botones y los filtros del cuerpo. */
.card.box-page-fill > .box-screen-header:not(.box-screen-header--title-only) {
    padding-bottom: 0;
}

.card.box-page-fill > .box-screen-header:not(.box-screen-header--title-only) + .card-body {
    padding-top: 0.15rem;
}

.box-screen-header__left {
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.box-screen-header__right {
    flex: 0 0 auto;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

html[data-box-theme="dark"] .box-screen-header--title-only,
html[data-box-theme="dark"] .box-screen-header__rule {
    border-top-color: #1e3a5c;
    border-bottom-color: #1e3a5c;
}

html[data-box-theme="dark"] .box-screen-header__action,
html[data-box-theme="dark"] .box-screen-header__nombre,
html[data-box-theme="dark"] .box-screen-header__extra {
    color: #fff;
}

html[data-box-theme="dark"] .box-screen-header__subtitle {
    color: #95aac9;
}

/* Cabecera de pantalla: título arriba, barra de botones debajo (siempre separados). */
.box-page-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
}

.box-page-header-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.box-page-header-top .card-header-title,
.box-page-header-top .box-page-title {
    flex: 1 1 auto;
    min-width: 0;
}

/* Título de pantalla (menú): icono + tipografía destacada. Ver Shared/BoxPageTitle.razor */
.box-page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.box-page-title__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    background: rgba(44, 123, 229, 0.12);
    color: #2c7be5;
    font-size: 1.125rem;
    line-height: 1;
}

.box-page-title__icon--logo {
    width: auto;
    min-width: 2.25rem;
    max-width: 3.25rem;
    padding: 0.2rem 0.35rem;
    background: #111;
}

html[data-box-theme="dark"] .box-page-title__icon--logo {
    background: #0d1117;
}

.box-page-title__logo {
    display: block;
    width: 48px;
    height: 19px;
    object-fit: fill;
}

.box-page-title__body {
    flex: 1 1 auto;
    min-width: 0;
}

.box-prep-pedido-tipo {
    flex-shrink: 0;
    font-weight: 600;
    color: #2c7be5;
    white-space: nowrap;
}

.box-prep-pedido-num {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-page-title__text.text-truncate .box-prep-pedido-num {
    flex: 1 1 auto;
}

.box-page-title__text {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    min-width: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #12263f;
    letter-spacing: -0.015em;
    line-height: 1.35;
}

.card-header > .box-page-title:only-child {
    width: 100%;
}

/* Título: meta (fecha, usuario, ID) + Volver a la derecha, con hueco entre meta y botón. */
.box-page-header-trailing {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-left: auto;
    gap: 2rem;
    max-width: min(100%, 52rem);
}

.box-page-header-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem 1.25rem;
    min-width: 0;
}

.box-page-back {
    flex: 0 0 auto;
}

.box-page-header-actions {
    width: 100%;
}

/* Toolbar bajo el borde del card-header (detalle recepción, etc.) */
.box-page-body-toolbar {
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 0.75rem;
}

.box-page-header-top .box-page-title__text.text-truncate {
    display: block;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-header > .row.align-items-center:has(.box-toolbar-actions) {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.625rem;
    margin-left: 0;
    margin-right: 0;
}

.card-header > .row.align-items-center:has(.box-toolbar-actions) > [class*="col"] {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.box-action-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-radius: 0.375rem;
    border: 1px solid #d2ddec;
    background: #fff;
    color: #617798;
    line-height: 1;
}

.box-action-btn:hover:not(:disabled) {
    background: #f9fbfd;
    color: #12263f;
    border-color: #95aac9;
}

.box-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.box-action-btn i {
    font-size: 0.95rem;
}

.box-action-btn.box-action-danger {
    color: #e63757;
    border-color: #f1aeb5;
}

.box-action-btn.box-action-danger:hover:not(:disabled) {
    background: #e63757;
    color: #fff;
    border-color: #e63757;
}

.box-action-btn.box-action-primary {
    color: #2c7be5;
    border-color: #a8c7f0;
}

.box-action-btn.box-action-primary:hover:not(:disabled) {
    background: #2c7be5;
    color: #fff;
    border-color: #2c7be5;
}

.box-action-btn.box-action-success {
    color: #00d97e;
    border-color: #9aebc6;
}

.box-action-btn.box-action-warn {
    color: #e67e22;
    border-color: #f5c896;
}

.box-action-btn.box-action-warn:hover:not(:disabled) {
    background: #e67e22;
    color: #fff;
    border-color: #e67e22;
}

.box-action-btn.box-action-success:hover:not(:disabled) {
    background: #00d97e;
    color: #fff;
    border-color: #00d97e;
}

html[data-box-theme="dark"] .box-action-btn {
    background: #1b2a4e;
    border-color: #2a3f66;
    color: #95aac9;
}

html[data-box-theme="dark"] .box-action-btn:hover:not(:disabled) {
    background: #243660;
    color: #fff;
    border-color: #95aac9;
}

html[data-box-theme="dark"] .box-action-btn.box-action-danger {
    color: #f66d9b;
    border-color: #6b3044;
}

html[data-box-theme="dark"] .box-action-btn.box-action-danger:hover:not(:disabled) {
    background: #e63757;
    color: #fff;
    border-color: #e63757;
}

html[data-box-theme="dark"] .box-action-btn.box-action-success {
    color: #39da8a;
    border-color: #1f5c3f;
}

html[data-box-theme="dark"] .box-action-btn.box-action-success:hover:not(:disabled) {
    background: #00d97e;
    color: #fff;
    border-color: #00d97e;
}

html[data-box-theme="dark"] .box-action-btn.box-action-warn {
    color: #ffb74d;
    border-color: #6b4a22;
}

html[data-box-theme="dark"] .box-action-btn.box-action-warn:hover:not(:disabled) {
    background: #e67e22;
    color: #fff;
    border-color: #e67e22;
}

/* Icono + texto: nunca pegados (Hacer foto, Buscar, Nuevo, …) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.btn > i,
.btn > .fe,
.btn > [class^="fe-"],
.btn > [class*=" fe-"] {
    flex: 0 0 auto;
    line-height: 1;
    margin: 0;
}

.box-btn-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.box-btn-toolbar > i {
    font-size: 0.95rem;
    line-height: 1;
    margin: 0;
}

/* Botones de acción masiva (carta de porte): colores pastel. */
.btn.box-btn-pastel {
    font-weight: 600;
}
.btn.box-btn-pastel-add {
    background: #d6e8ff;
    color: #1a5bb8;
    border-color: #b3d4fc;
}
.btn.box-btn-pastel-add:hover:not(:disabled) {
    background: #bfd9fb;
    color: #154a96;
    border-color: #9bc4f5;
}
.btn.box-btn-pastel-quitar {
    background: #ffe0e6;
    color: #c62828;
    border-color: #f5b5c0;
}
.btn.box-btn-pastel-quitar:hover:not(:disabled) {
    background: #ffd0d9;
    color: #a61e2e;
    border-color: #ef9aa8;
}
.btn.box-btn-pastel-rechazar {
    background: #ffe8cc;
    color: #c05600;
    border-color: #ffd199;
}
.btn.box-btn-pastel-rechazar:hover:not(:disabled) {
    background: #ffd9a8;
    color: #9a4500;
    border-color: #f0bc6e;
}
.btn.box-btn-pastel-cancelar {
    background: #eceff1;
    color: #455a64;
    border-color: #cfd8dc;
}
.btn.box-btn-pastel-cancelar:hover:not(:disabled) {
    background: #dde3e6;
    color: #37474f;
    border-color: #b0bec5;
}
.btn.box-btn-pastel-mover {
    background: #e8e0ff;
    color: #5e35b1;
    border-color: #d1c4e9;
}
.btn.box-btn-pastel-mover:hover:not(:disabled) {
    background: #d9ccfa;
    color: #4527a0;
    border-color: #b39ddb;
}
.btn.box-btn-pastel-confirmar {
    background: #d4f5e4;
    color: #1b7a4a;
    border-color: #a8e6c5;
}
.btn.box-btn-pastel-confirmar:hover:not(:disabled) {
    background: #bfeecf;
    color: #15633c;
    border-color: #8fd9b0;
}

/* Icono código de barras (GS1-128); Feather no trae barcode */
.box-icon-barcode {
    display: inline-block;
    width: 0.95rem;
    height: 0.95rem;
    flex: 0 0 auto;
    vertical-align: -0.1em;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M2 4h2v16H2V4zm3 0h1v16H5V4zm2 0h3v16H7V4zm4 0h1v16h-1V4zm2 0h2v16h-2V4zm3 0h1v16h-1V4zm2 0h1v16h-1V4zm2 0h2v16h-2V4z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M2 4h2v16H2V4zm3 0h1v16H5V4zm2 0h3v16H7V4zm4 0h1v16h-1V4zm2 0h2v16h-2V4zm3 0h1v16h-1V4zm2 0h1v16h-1V4zm2 0h2v16h-2V4z'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.box-action-btn .box-icon-barcode {
    width: 0.95rem;
    height: 0.95rem;
}

.box-icon-excel {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
    display: block;
    object-fit: contain;
}

.btn > .box-icon-excel,
.box-btn-toolbar > .box-icon-excel {
    flex: 0 0 auto;
}

.box-action-btn .box-icon-excel {
    width: 1.15rem;
    height: 1.15rem;
}

html[data-box-theme="dark"] .box-action-btn .box-icon-excel {
    filter: invert(1);
}

/* Nunca pegar botones de acción (Excel, Nuevo, Guardar, …) */
.box-btn-toolbar + .box-btn-toolbar,
.btn.box-btn-toolbar + .btn,
.btn + .btn.box-btn-toolbar {
    margin-inline-start: 0.75rem;
}

.box-toolbar-actions > .box-btn-toolbar + .box-btn-toolbar,
.box-toolbar-actions > .btn + .btn {
    margin-inline-start: 0; /* el gap del flex ya separa */
}

/* Navegación por secciones (sustituye nav-tabs en fichas) */
.box-section-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.25rem 0;
}

.box-section-nav-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    color: #617798;
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.box-section-nav-item:hover:not(:disabled) {
    background: #f9fbfd;
    color: #12263f;
    border-color: #e3ebf6;
}

.box-section-nav-item.active {
    background: #e9f1fc;
    color: #2c7be5;
    border-color: #c5d9f5;
}

.box-section-nav-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.box-section-nav-item > i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

html[data-box-theme="dark"] .box-section-nav-item {
    color: #95aac9;
}

html[data-box-theme="dark"] .box-section-nav-item:hover:not(:disabled) {
    background: #1b2a4e;
    color: #fff;
    border-color: #2a3f66;
}

html[data-box-theme="dark"] .box-section-nav-item.active {
    background: #243660;
    color: #6ea8fe;
    border-color: #2c7be5;
}

.box-section-panel {
    min-height: 12rem;
}

/* Validación NIF: rojo = faltante/erróneo; naranja = no identificado en Hacienda */
.box-field-invalid {
    background-color: #fde8ec !important;
    border-color: #e63757 !important;
}

.box-field-warn {
    background-color: #fff3e0 !important;
    border-color: #f6c343 !important;
}

.box-field-ok {
    background-color: #e8f7ef !important;
    border-color: #00d97e !important;
}

html[data-box-theme="dark"] .box-field-invalid {
    background-color: rgba(230, 55, 87, 0.22) !important;
    border-color: #e63757 !important;
    color: #fff;
}

html[data-box-theme="dark"] .box-field-warn {
    background-color: rgba(246, 195, 67, 0.18) !important;
    border-color: #f6c343 !important;
    color: #fff;
}

html[data-box-theme="dark"] .box-field-ok {
    background-color: rgba(0, 217, 126, 0.18) !important;
    border-color: #00d97e !important;
    color: #fff;
}

.box-suggest-open {
    z-index: 40;
}

.box-suggest {
    position: absolute;
    z-index: 41;
    left: 0;
    top: calc(100% + 2px);
    min-width: 100%;
    width: max-content;
    max-width: 28rem;
    max-height: 220px;
    overflow: auto;
    margin: 0;
    padding: 0.2rem 0;
    background: #fff;
    border: 1px solid #d2ddec;
    border-radius: 0.35rem;
    box-shadow: 0 0.5rem 1.25rem rgba(18, 38, 63, 0.18);
}

.box-suggest button {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    color: #12263f;
    text-align: left;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    white-space: nowrap;
}

.box-suggest button:hover,
.box-suggest button.active {
    background: #2c7be5;
    color: #fff;
}

html[data-box-theme="dark"] .box-suggest {
    background: #152e4d;
    border-color: #2c3a4f;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45);
}

html[data-box-theme="dark"] .box-suggest button {
    background: #152e4d;
    color: #e3ebf6;
}

html[data-box-theme="dark"] .box-suggest button:hover,
html[data-box-theme="dark"] .box-suggest button.active {
    background: #2c7be5;
    color: #fff;
}

.box-dropdown-end {
    display: block;
    position: absolute;
    right: 0;
    left: auto;
    min-width: 14rem;
    z-index: 1050;
}

.nav-link-text {
    margin-left: 0.5rem;
}

#sidebar .nav-link.btn {
    color: inherit;
    text-decoration: none;
    box-shadow: none;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
}

#sidebar .nav-link.active {
    color: #2c7be5;
}

#sidebar .navbar-brand-img {
    max-height: 2.75rem;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

#sidebar .box-sidebar-logo-bottom {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}
#sidebar .box-sidebar-logo-bottom .navbar-brand-img {
    max-height: 4.75rem;
    max-width: 248px;
    width: 100%;
}

#sidebar.navbar-vertical-sm .navbar-brand-img {
    max-height: 1.75rem;
    max-width: 1.75rem;
}

.header-title {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

.box-login-card img,
.box-login-logo {
    max-height: 110px;
    width: auto;
    max-width: min(320px, 100%);
    height: auto;
    object-fit: contain;
}

/* Compact: solo iconos (Dashkit navbar-vertical-sm) */
#sidebar.navbar-vertical-sm .nav-link-text,
#sidebar.navbar-vertical-sm .box-sidebar-user-meta,
#sidebar.navbar-vertical-sm .box-sidebar-footer-divider,
#sidebar.navbar-vertical-sm .box-sidebar-logo-bottom,
#sidebar.navbar-vertical-sm .collapse .nav,
#sidebar.navbar-vertical-sm hr.navbar-divider {
    display: none !important;
}

#sidebar.navbar-vertical-sm .nav-link {
    justify-content: center;
}

#sidebar.navbar-vertical-sm .nav-link-text {
    margin-left: 0;
}

#sidebar.navbar-vertical-sm .box-sidebar-footer {
    justify-content: center !important;
}

/* Collapse controlado por Blazor */
#sidebar .navbar-collapse.collapse:not(.show) {
    display: none;
}

@media (min-width: 768px) {
    #sidebar .navbar-collapse.collapse {
        display: flex !important;
        flex-direction: column;
        flex-grow: 1;
    }

    #sidebar .navbar-toggler {
        display: none;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* Mobile drawer + overlay */
@media (max-width: 767.98px) {
    #sidebar.navbar-vertical.fixed-left {
        z-index: 1040;
    }

    #wrapper.sidebar-open #sidebar .navbar-collapse {
        display: block !important;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(18, 38, 63, 0.45);
        z-index: 1035;
    }

    .main-content > .container-fluid {
        padding: max(2.5rem, var(--box-page-margin)) var(--box-page-margin) var(--box-page-margin);
    }

    .header-title {
        font-size: 1.15rem !important;
    }

    .box-welcome-card,
    .box-placeholder {
        padding: 1rem;
    }
}

/* Safe areas (iOS) */
@supports (padding: max(0px)) {
    .main-content > .container-fluid {
        padding-top: max(var(--box-page-margin), env(safe-area-inset-top));
        padding-right: max(var(--box-page-margin), env(safe-area-inset-right));
        padding-bottom: max(var(--box-page-margin), env(safe-area-inset-bottom));
        padding-left: max(var(--box-page-margin), env(safe-area-inset-left));
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1100;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #e63757;
    padding: 1rem 1.25rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error.";
}

/* Header: toolbar + campana + avatar */
.box-header-toolbar {
    gap: 0.85rem;
    flex-wrap: nowrap;
}

@media (min-width: 768px) {
    .box-header-toolbar {
        gap: 1.15rem;
    }
}

.box-bell-wrap {
    flex-shrink: 0;
    padding-inline: 0.15rem;
}

.box-bell-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6e84a3;
    text-decoration: none !important;
}

.box-bell-btn:hover {
    color: #2c7be5;
}

.box-bell-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.65rem;
    min-width: 1.1rem;
    padding: 0.15em 0.35em;
    line-height: 1;
}

.box-user-wrap {
    flex-shrink: 0;
    margin-left: 0.15rem;
}

.box-user-toggle {
    text-decoration: none !important;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    min-width: 3.25rem;
    max-width: 5.5rem;
    padding: 0.15rem 0.35rem 0.1rem;
    line-height: 1.15;
}

.box-user-toggle::after {
    display: none;
}

.box-user-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #12263f;
    text-align: center;
}

html[data-box-theme="dark"] .box-user-name {
    color: #fff;
}

.box-dropdown-notifications {
    display: block;
    position: absolute;
    right: 0;
    left: auto;
    width: min(22rem, calc(100vw - 1.5rem));
    padding: 0;
    z-index: 1050;
    overflow: hidden;
}

.box-notifications-body {
    max-height: 22rem;
    overflow-y: auto;
    padding: 0;
}

.box-notifications-body .list-group-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}

.box-notification-unread {
    background: rgba(44, 123, 229, 0.06);
}

html[data-box-theme="dark"] .box-notification-unread {
    background: rgba(44, 123, 229, 0.15);
}

.box-notif-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 38, 63, 0.45);
    z-index: 1080;
}

.box-notif-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(28rem, calc(100vw - 1.5rem));
    z-index: 1081;
    margin: 0;
}

.box-confirm-modal {
    width: min(24rem, calc(100vw - 1.5rem));
}

.box-camera-modal {
    width: min(32rem, calc(100vw - 1.5rem));
}

.box-accesos-modal {
    width: min(90rem, calc(100vw - 1.5rem));
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.box-accesos-head {
    flex: 0 0 auto;
    padding: 1rem 1.25rem 0;
}

.box-accesos-head__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    margin-bottom: 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.box-accesos-head__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #edf2f9;
}

.box-accesos-head__left,
.box-accesos-head__right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.box-accesos-head__left .form-control {
    width: auto;
}

html[data-box-theme="dark"] .box-accesos-head__controls {
    border-bottom-color: #1e3a5c;
}

.box-users-tabbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.75rem;
    margin-bottom: 0.5rem;
}

.box-users-tabbar__search,
.box-users-tabbar__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.box-users-tabbar__search .form-control {
    width: 16rem;
    max-width: 100%;
}

.box-users-check-grid .box-grid-table {
    width: max-content;
    min-width: 0;
}

.box-users-check-grid .box-grid-table th.box-grid-col-check,
.box-users-check-grid .box-grid-table td.box-grid-col-check {
    width: 1%;
    white-space: nowrap;
}

.box-users-check-grid .box-grid-table th.box-grid-col-name,
.box-users-check-grid .box-grid-table td.box-grid-col-name {
    width: auto;
    min-width: 8rem;
    max-width: 16rem;
}

.box-user-form {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.box-user-form .box-flag-group {
    padding: 0.45rem 0.7rem 0.55rem;
}

.box-user-form .box-flag-group-title {
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.box-user-form .form-label {
    margin-bottom: 0.15rem;
}

.box-user-avatar--sm {
    width: 3.25rem;
    height: 3.25rem;
}

.box-accesos-modal .card-body {
    min-height: 0;
    overflow: auto;
}

.box-accesos-table {
    max-height: min(28rem, 50vh);
    overflow: auto;
}

.box-camera-preview {
    background: #0b1526;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.box-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
}

html[data-box-theme="dark"] .box-notif-modal-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

/* Avatar sin máscaras Dashkit: círculo limpio + punto online */
.avatar {
    overflow: visible;
}

.avatar .avatar-img,
.avatar .avatar-title {
    border-radius: 50%;
}

.avatar .avatar-img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.box-user-avatar {
    width: 5rem;
    height: 5rem;
}

.avatar-online:before {
    z-index: 1;
    border: 2px solid #fff;
}

html[data-box-theme="dark"] .avatar-online:before {
    border-color: #1b2a4e;
}

.bg-primary-soft {
    background-color: rgba(44, 123, 229, 0.15) !important;
}

.text-primary {
    color: #2c7be5 !important;
}

@media (max-width: 575.98px) {
    .box-dropdown-notifications {
        position: fixed;
        top: 4rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

/* Selector de idioma (banderas Box.Web) */
.box-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.55rem;
}

.box-lang-btn::after {
    margin-left: 0;
}

.box-lang-menu {
    display: block;
    position: absolute;
    right: 0;
    left: auto;
    min-width: 9.5rem;
    z-index: 1050;
    padding: 0.35rem 0;
}

.box-lang-flag {
    flex-shrink: 0;
    margin-right: 0.55rem;
}

.box-lang-menu .dropdown-item.active {
    background: rgba(44, 123, 229, 0.1);
    color: #2c7be5;
}

.box-lang-dropdown {
    position: relative;
}

/* Menú en blanco: los logos de firma se leen sobre fondo claro. */
#sidebar.navbar-vertical {
    background-color: #fff;
    border-right: 1px solid #e3e8ef;
}

html[data-box-theme="dark"] #sidebar.navbar-vertical {
    background-color: #17324a;
    border-right-color: #23405e;
}

body,
.main-content {
    background-color: #e7eef5;
}

html[data-box-theme="dark"] body,
html[data-box-theme="dark"] .main-content {
    background-color: #12263f;
}

.box-main-row {
    margin-top: 0 !important;
}

.box-mobile-menu-btn {
    position: fixed;
    top: max(0.35rem, env(safe-area-inset-top));
    left: max(0.5rem, env(safe-area-inset-left));
    z-index: 1020;
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
    box-shadow: 0 0.15rem 0.5rem rgba(18, 38, 63, 0.12);
}

/* Sidebar: colapsar/expandir en el borde entre menú y contenido (desktop) */
.box-sidebar-toggle {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
    padding: 0;
}

@media (min-width: 768px) {
    .box-sidebar-edge-toggle {
        position: fixed;
        top: 0.65rem;
        z-index: 1055;
        transform: translateX(-50%);
        box-shadow: 0 0.15rem 0.5rem rgba(18, 38, 63, 0.14);
    }

    #sidebar.navbar-vertical.navbar-expand-md.fixed-left:not(.navbar-vertical-sm) ~ .box-sidebar-edge-toggle {
        left: 250px;
    }

    #sidebar.navbar-vertical.navbar-expand-md.fixed-left.navbar-vertical-sm ~ .box-sidebar-edge-toggle {
        left: 66px;
    }
}

.box-sidebar-brand-row {
    padding: 0.35rem 0.65rem 0.5rem;
    min-width: 0;
}

#sidebar .box-sidebar-dock {
    flex-shrink: 0;
    padding: 0.5rem 0.65rem 0.35rem;
    border-top: 1px solid #e3ebf6;
}

html[data-box-theme="dark"] #sidebar .box-sidebar-dock {
    border-top-color: #1e3a5c;
}

#sidebar .box-sidebar-dock .box-header-toolbar--sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    width: 100%;
}

#sidebar .box-sidebar-dock .box-header-toolbar__icons {
    gap: 0.65rem;
    flex-wrap: nowrap;
    width: 100%;
}

#sidebar .box-sidebar-dock .box-user-toggle--avatar {
    flex-direction: row;
    min-width: 2.25rem;
    max-width: 2.25rem;
    gap: 0;
    padding: 0.1rem;
}

#sidebar .box-sidebar-dock .box-sidebar-user-name {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: #12263f;
    text-align: center;
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[data-box-theme="dark"] #sidebar .box-sidebar-dock .box-sidebar-user-name {
    color: #e3ebf6;
}

#sidebar .box-sidebar-dock .box-sidebar-user-name:hover,
#sidebar .box-sidebar-dock .box-sidebar-user-name:focus {
    color: #2c7be5;
    text-decoration: none;
}

html[data-box-theme="dark"] #sidebar .box-sidebar-dock .box-sidebar-user-name:hover,
html[data-box-theme="dark"] #sidebar .box-sidebar-dock .box-sidebar-user-name:focus {
    color: #5b9cf5;
}

#sidebar .box-sidebar-dock .box-bell-btn {
    width: 2.25rem;
    height: 2.25rem;
}

#sidebar .box-sidebar-dock .box-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
}

#sidebar.navbar-vertical-sm .box-sidebar-dock .box-header-toolbar__icons {
    flex-direction: column;
    gap: 0.35rem;
}

#sidebar.navbar-vertical-sm .box-sidebar-dock .box-sidebar-user-name {
    display: none;
}

#sidebar.navbar-vertical-sm .box-sidebar-brand-row {
    display: flex !important;
    justify-content: center;
    padding: 0.35rem 0.25rem 0.35rem;
}

#sidebar .box-bell-wrap .box-dropdown-notifications.show,
#sidebar .box-user-wrap .box-dropdown-end.show {
    position: fixed;
    left: auto;
    right: 0.75rem;
    top: auto;
    bottom: 6.5rem;
    max-width: min(22rem, calc(100vw - 1.5rem));
}

@media (min-width: 768px) {
    #sidebar:not(.navbar-vertical-sm) .box-bell-wrap .box-dropdown-notifications.show,
    #sidebar:not(.navbar-vertical-sm) .box-user-wrap .box-dropdown-end.show {
        left: 15.85rem;
        right: auto;
        bottom: 5.75rem;
    }

    #sidebar.navbar-vertical-sm .box-bell-wrap .box-dropdown-notifications.show,
    #sidebar.navbar-vertical-sm .box-user-wrap .box-dropdown-end.show {
        left: 4.85rem;
        right: auto;
        bottom: 5.75rem;
    }
}

.box-grid-count {
    display: inline-block;
    padding: 0.35rem 0;
}

.box-grid-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Separación entre el bloque (conteo/Excel) y el botón Nuevo u otros hermanos */
.box-grid-toolbar:has(+ .btn),
.box-grid-toolbar:has(+ .box-btn-toolbar) {
    margin-inline-end: 1rem;
}

.form-label,
.col-form-label {
    color: #6e84a3;
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

.form-control,
.form-select,
.form-control:disabled,
.form-select:disabled {
    color: #12263f;
}

/* Solo lectura: no mismo aspecto que editable (p. ej. medidas artículo en línea recepción) */
.form-control[readonly],
.form-control:read-only,
textarea.form-control[readonly] {
    background-color: #edf2f9;
    border-color: #d2ddec;
    color: #6e84a3;
    cursor: default;
    opacity: 1;
}

.form-control[readonly]:focus,
.form-control:read-only:focus,
textarea.form-control[readonly]:focus {
    background-color: #edf2f9;
    border-color: #c8d4e3;
    box-shadow: none;
}

html[data-box-theme="dark"] .form-control[readonly],
html[data-box-theme="dark"] .form-control:read-only,
html[data-box-theme="dark"] textarea.form-control[readonly] {
    background-color: #1b2a4e;
    border-color: #2c3a4f;
    color: #95aac9;
}

html[data-box-theme="dark"] .form-control[readonly]:focus,
html[data-box-theme="dark"] .form-control:read-only:focus,
html[data-box-theme="dark"] textarea.form-control[readonly]:focus {
    background-color: #1b2a4e;
    border-color: #364a6b;
}

html[data-box-theme="dark"] .form-label,
html[data-box-theme="dark"] .col-form-label {
    color: #7c93b5;
}

html[data-box-theme="dark"] .form-control,
html[data-box-theme="dark"] .form-select,
html[data-box-theme="dark"] .form-control:disabled,
html[data-box-theme="dark"] .form-select:disabled {
    color: #e3ebf6;
}

/* Bottom nav móvil */
.box-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    background: #fff;
    border-top: 1px solid #e3ebf6;
    padding: 0.35rem 0.25rem max(0.35rem, env(safe-area-inset-bottom));
}

html[data-box-theme="dark"] .box-bottom-nav {
    background: #152238;
    border-top-color: #1e3a5c;
}

.box-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.2rem;
    font-size: 0.65rem;
    color: #95aac9;
    text-decoration: none !important;
}

.box-bottom-nav-item .fe {
    font-size: 1.15rem;
}

.box-bottom-nav-item.active {
    color: #2c7be5;
}

@media (max-width: 767.98px) {
    .main-content {
        padding-bottom: 4.5rem;
    }
}

/* Panel de datos: marco gris arriba/abajo/izda/dcha; scroll interno; esquinas redondeadas */
.card.box-page-fill {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    max-height: calc(100vh - (2 * var(--box-page-margin)));
    max-height: calc(100svh - (2 * var(--box-page-margin)));
    overflow: hidden;
    border-radius: var(--bs-border-radius, 0.5rem);
}

.card.box-page-fill > .card-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 5;
    background-color: var(--bs-card-cap-bg, var(--bs-card-bg, #fff));
}

.card.box-page-fill > .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    z-index: 1;
    isolation: isolate;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Listados (sin pestañas): solo el grid hace scroll */
.card.box-page-fill:has(.box-grid-fill):not(:has(.box-detail-tab-body)) > .card-body {
    overflow-y: hidden;
}

/* Detalle con pestañas: scroll en .box-detail-tab-body */
.card.box-page-fill:has(.box-detail-tab-body) > .card-body {
    overflow-y: hidden;
}

.card.box-page-fill > .card-body > .box-rx-cab:first-child {
    position: relative;
    z-index: 0;
}

.box-page-fill-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    overflow-y: inherit;
}

/* El aviso no puede encogerse: el grid ya cede el alto y, si no, el texto queda en una franja roja. */
.box-page-fill-body > .alert {
    flex: 0 0 auto;
}

/* El listado no puede crecer con la tabla. Si lo hace, el overflow:hidden del
   padre recorta las columnas y Firefox pierde la barra horizontal en el segundo layout. */
.box-page-fill-body > .box-busy-host {
    flex: 1 1 auto;
    min-height: 0;
}

.box-page-fill-body > .box-grid-fill {
    flex: 1 1 auto;
    min-height: 0;
}

.box-page-fill-body > .box-grid-pager {
    flex: 0 0 auto;
}

.box-page-fill-body > .box-grid-search,
.box-page-fill-body > .box-rx-list-toolbar,
.box-page-fill-body > .row {
    flex: 0 0 auto;
}

.box-page-fill-body > .table-responsive,
.box-page-fill-body .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.box-page-fill-body > .box-busy-host,
.box-busy-host {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.box-grid-fill {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow: auto;
    contain: inline-size;
}

/* Detalle con pestañas: barra fija + cuerpo con scroll (preparación, etc.) */
.box-page-fill-body > .box-busy-host.d-flex.flex-column {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.box-page-fill-body > .box-busy-host.d-flex.flex-column > .box-rx-grid-bar,
.box-page-fill-body > .box-busy-host.d-flex.flex-column > .box-rx-cab-bar {
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
}

.box-detail-tab-body,
.box-prep-tab-body {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.box-detail-tab-body > .box-grid-fill,
.box-prep-tab-body > .box-grid-fill {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

/* Sin scroll horizontal en el marco de la app */
.main-content {
    overflow-x: clip;
}

.main-content > .container-fluid > .box-main-row > .col-12 {
    min-width: 0;
    max-width: 100%;
}

/* Móvil, tablet y viewports bajos (zoom 200%, ventana corta): scroll de página, paneles sin recorte */
@media (max-width: 991.98px), (max-height: 700px) {
    .main-content {
        overflow-x: clip;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-content > .container-fluid {
        overflow-x: clip;
        overflow-y: visible;
        min-height: min-content;
    }

    .card.box-page-fill,
    .box-prep-ui > .card.box-page-fill {
        max-height: none;
        height: auto;
        overflow: visible;
        flex: 0 1 auto;
    }

    .card.box-page-fill > .card-body,
    .card.box-page-fill > .card-body.box-page-fill-body,
    .box-page-fill-body,
    .box-prep-ui > .card.box-page-fill > .card-body.box-prep-page-body {
        overflow-x: clip;
        overflow-y: visible;
        flex: 0 1 auto;
        min-height: 0;
    }

    .box-page-fill-body > .box-busy-host,
    .box-page-fill-body > .box-busy-host.d-flex.flex-column {
        overflow: visible;
        flex: 0 1 auto;
        min-height: 0;
    }

    .box-detail-tab-body,
    .box-prep-tab-body {
        overflow: visible;
        flex: 0 1 auto;
        min-height: 0;
    }

    .card.box-page-fill .box-grid-fill {
        flex: 0 1 auto;
        max-height: min(62svh, 36rem);
        min-height: 10rem;
    }

    .box-rx-grid-bar,
    .box-rx-cab-bar {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .box-screen-header,
    .box-screen-header__title,
    .box-screen-header__lead {
        max-width: 100%;
    }
}

/* Incidencias: tres bloques en fila, como BoxEvo. */
.box-inc-page.card.box-page-fill {
    overflow: hidden;
}

.box-inc-row.box-busy-host {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.box-inc-block {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color, #e3ebf6);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.box-inc-block > .box-grid-fill {
    flex: 1 1 auto;
    min-height: 0;
}

.box-inc-head {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.box-inc-head-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.box-inc-block > .d-flex.align-items-center {
    width: 100%;
}

.box-inc-block > .d-flex.align-items-center > .d-flex {
    margin-left: auto;
}

@media (max-width: 991.98px) {
    .box-inc-row.box-busy-host {
        flex-direction: column;
        overflow: auto;
    }

    .box-inc-block {
        flex: 0 0 auto;
        min-height: 16rem;
    }
}

/* Trazabilidad: alto acotado. El grid es el scrollport (barras horizontal y vertical). */
.box-tz-page.card.box-page-fill {
    overflow: hidden;
}

.box-tz-grid-host {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.box-tz-grid-host > .box-grid-fill {
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: auto;
}

/* Overlay de carga (SfSpinner) sobre listados */
.box-busy-host {
    position: relative;
    min-height: 10rem;
}
.box-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(1px);
}
html[data-box-theme="dark"] .box-busy-overlay {
    background: rgba(15, 23, 42, 0.65);
}
.box-busy-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: transparent;
    box-shadow: none;
}
.box-busy-panel .box-busy-progress {
    min-width: 14rem;
    max-width: 22rem;
    width: 100%;
    margin-bottom: 0;
}
html[data-box-theme="dark"] .box-busy-panel {
    background: transparent;
    box-shadow: none;
}
.box-busy-dim {
    pointer-events: none;
    opacity: 0.45;
}

/* Overlay visible: no pulsar botones ni filtros de esa pantalla. */
.box-page-fill:has(.box-busy-overlay) .box-screen-header button,
.box-page-fill:has(.box-busy-overlay) .box-page-fill-body button,
.box-page-fill:has(.box-busy-overlay) .box-page-fill-body select,
.box-page-fill:has(.box-busy-overlay) .box-page-fill-body input,
.box-page-fill:has(.box-busy-overlay) .box-page-fill-body textarea {
    pointer-events: none;
}

.box-alert-pre {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 40vh;
    overflow: auto;
    font-size: 0.875rem;
}

/* Cabecera fija al hacer scroll vertical en el grid */
.box-grid-fill .box-grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: var(--bs-body-bg, #fff);
    box-shadow: inset 0 -1px 0 var(--bs-border-color, #e3ebf6);
}

.box-grid-fill .box-grid-table thead th.box-grid-col-actions {
    z-index: 4; /* esquina: sticky vertical + horizontal */
}

html[data-box-theme="dark"] .box-grid-fill .box-grid-table thead th {
    background-color: #1e3a5f;
    box-shadow: inset 0 -1px 0 #2a4a6f;
}

/* Pool: + Proveedor y + Tipo de pool encima de su columna, y siguen fijos al hacer scroll. */
.box-pp-table--add thead tr.box-pp-add-row th {
    top: 0;
    z-index: 5;
    height: 2.6rem;
    box-shadow: none;
    vertical-align: middle;
    text-align: left;
}

.box-pp-table--add thead tr:not(.box-pp-add-row) th {
    top: 2.6rem;
}

/* Barra de búsqueda: query (txt+Buscar) a la izq.; resto de controles a la dcha., nunca pegados */
.box-grid-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex: 0 0 auto;
    width: 100%;
    gap: 1.25rem 1.5rem;
    margin-bottom: 0.5rem;
}

/* Recepción / LI / entradas: filtros compactos + buscador debajo, grid pegado al toolbar */
.box-rx-list-toolbar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.box-rx-filter-field--buscar {
    flex: 0 0 auto;
    min-width: max-content;
}

/* Stock: filtros al ancho de su contenido; envuelven solo si no caben */
.box-stock-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.65rem;
    width: 100%;
    min-width: 0;
}

.box-stock-filters-row {
    flex: 1 1 auto;
    width: auto;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
    min-width: 0;
}

.box-stock-search-cluster {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.box-stock-toolbar-export {
    flex: 0 0 auto;
    margin-left: auto;
}

.box-stock-filters-row .box-stock-grid-filter-field {
    flex: 0 0 auto;
    width: auto;
}

.box-stock-filters-row .box-stock-grid-filter-field .box-grid-search {
    width: max-content;
    max-width: 100%;
    margin-bottom: 0;
    padding-top: 0;
    border-top: none;
    gap: 0;
}

.box-stock-filters-row .box-stock-grid-filter-field .box-grid-search-query {
    gap: 0;
}

.box-stock-codigo-input {
    width: 12rem;
    min-width: 10rem;
    max-width: 16rem;
}

.box-tz-acciones {
    margin-left: auto;
}

.box-tz-codigo {
    position: relative;
}

.box-tz-codigo-desc {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.2rem;
    max-width: 18rem;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--bs-secondary-color, #6c757d);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.box-rx-list-toolbar:has(.box-tz-codigo-desc) {
    margin-bottom: 1.15rem;
}

.box-stock-firma-logo {
    display: block;
    height: 2rem;
    width: auto;
    max-width: 8rem;
    object-fit: contain;
    margin-bottom: 0.25rem;
}

.box-ubi-col-codigo {
    width: 8rem;
    min-width: 6.5rem;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Movimientos stock: Excel/Volver en cabecera; en pantallas estrechas pasan a la fila de descripción */
.box-stock-mv-desc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.35rem;
    min-width: 0;
}

.box-stock-mv-desc-text {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

.box-stock-mv-totals-row th {
    font-weight: inherit;
    vertical-align: bottom;
    padding-bottom: 0.2rem;
    border-bottom: none;
    box-shadow: none;
}

.box-stock-mv-total-entrada,
.box-stock-mv-col-entrada,
.box-stock-mv-col-entrada .box-grid-sort-btn {
    color: #2c7be5 !important;
}

.box-stock-mv-total-salida,
.box-stock-mv-col-salida,
.box-stock-mv-col-salida .box-grid-sort-btn {
    color: #e63757 !important;
}

.box-stock-mv-col-entrada.is-sorted .box-grid-sort-btn .fe {
    color: #2c7be5 !important;
}

.box-stock-mv-col-salida.is-sorted .box-grid-sort-btn .fe {
    color: #e63757 !important;
}

.box-grid-fill .box-grid-table.box-stock-mv-table--totals thead tr.box-stock-mv-totals-row th {
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: var(--bs-body-bg, #fff);
}

.box-grid-fill .box-grid-table.box-stock-mv-table--totals thead tr.box-stock-mv-head-row th {
    top: 2.125rem;
}

html[data-box-theme="dark"] .box-grid-fill .box-grid-table.box-stock-mv-table--totals thead tr.box-stock-mv-totals-row th {
    background-color: #1e3a5f;
}

.box-grid-fill .box-grid-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 4;
    font-weight: 600;
    background-color: var(--bs-body-bg, #fff);
    box-shadow: 0 -1px 0 #e3ebf6;
}

html[data-box-theme="dark"] .box-grid-fill .box-grid-table tfoot td {
    background-color: #1e3a5f;
    box-shadow: 0 -1px 0 #1e3a5c;
}

.box-stock-mv-head-row th {
    padding-top: 0.15rem;
}

.box-stock-mv-desc-label {
    display: inline-block;
    margin-bottom: 0;
    flex-shrink: 0;
}

.box-stock-mv-desc-actions {
    display: none;
    flex: 0 0 auto;
    margin-left: auto;
}

@media (max-width: 991.98px) {
    .box-stock-mv-page:has(.box-stock-mv-desc-row) .box-stock-mv-header-actions {
        display: none !important;
    }

    .box-stock-mv-page:has(.box-stock-mv-desc-row) .box-stock-mv-desc-actions {
        display: flex;
    }
}

@media (min-width: 992px) {
    .box-stock-mv-page .box-stock-mv-desc-actions {
        display: none !important;
    }
}

.box-stock-filters-row .box-stock-grid-filter-field .box-grid-search-input,
.box-stock-filters-row .box-stock-grid-filter-field .box-grid-search-input--md {
    width: 9rem;
    min-width: 7rem;
    max-width: 11rem;
}

.box-stock-grid-tfoot td {
    border-top: 2px solid var(--bs-border-color, #e3ebf6);
    background-color: var(--bs-body-bg, #fff);
    vertical-align: middle;
}

html[data-box-theme="dark"] .box-stock-grid-tfoot td {
    background-color: #1e3a5f;
    border-top-color: #2a4a6f;
}

.box-rx-list-toolbar .box-grid-search {
    margin-bottom: 0;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--bs-border-color, #e3ebf6);
}

/* Buscador en la misma fila de filtros: sin raya superior (solo aplica si va en fila propia). */
.box-rx-list-toolbar .box-rx-filters .box-grid-search {
    border-top: none;
    padding-top: 0;
}

.box-rx-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 1rem;
    width: auto;
    max-width: 100%;
    min-width: 0;
}

.box-rx-filters--primary {
    row-gap: 0.65rem;
    width: 100%;
}
.box-rx-filters--primary > .box-rx-filter-field--buscar {
    margin-left: auto;
}

.box-notas-list-toolbar {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #d2ddec;
    gap: 0;
}

.box-notas-grid-host {
    margin-top: 0.35rem;
}

.box-notas-filters {
    width: 100%;
    flex: 1 1 auto;
}

.box-notas-filters-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.box-notas-filters .box-rx-filter-field--buscar {
    align-self: flex-end;
}

.box-notas-estados-filter.box-rx-filter-field--multiselect .box-multiselect {
    min-width: 14rem;
    max-width: 22rem;
}
.box-notas-estados-filter .box-sf-multiselect.e-popup .e-list-item,
.box-notas-estados-filter .e-ddl.e-popup .e-list-item {
    white-space: nowrap;
}

.box-rx-filter-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--bs-secondary-color, #6c757d);
}

.box-rx-filter-select {
    min-width: 7.25rem;
    max-width: 13rem;
    width: auto;
}

.box-rx-filter-select--wide {
    min-width: 8rem;
    max-width: 14rem;
}

.box-rx-filter-field {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
}

.box-abc-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    margin-bottom: 0.5rem;
}

.box-abc-filters .box-rx-filter-select {
    min-width: 5.25rem;
    max-width: 8rem;
}

.box-abc-filters .box-abc-filter-input {
    width: 5.5rem;
    min-width: 4.25rem;
    max-width: 6.5rem;
}

.box-abc-filters .box-abc-filter-with-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.box-abc-filters .box-abc-filter-with-btn .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.box-abc-filters .box-rx-filter-field--date .form-control {
    width: 8.35rem;
    min-width: 8rem;
    max-width: 8.5rem;
}

.box-abc-filters .box-rx-filter-field--buscar .btn {
    white-space: nowrap;
}

.box-ubi-coord {
    width: 3.1rem;
}

.box-ubi-coord .form-control {
    width: 3.1rem;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
}

.box-ubi-col-ubic {
    width: 8rem;
    min-width: 6.5rem;
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-ubi-table th.box-ubi-col-ubic.box-grid-sort-th,
.box-ubi-table td.box-ubi-col-ubic {
    padding-left: 0.35rem;
}

.box-ubi-table th.box-ubi-col-coord,
.box-ubi-table td.box-ubi-col-coord {
    width: 2.65rem;
    min-width: 2.5rem;
    max-width: 3.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    font-size: 0.8125rem;
}

.box-ubi-table th.box-ubi-col-coord .box-grid-sort-btn {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    gap: 0.05rem;
}

.box-ubi-table th.box-ubi-col-coord:not(.is-sorted) .box-grid-sort-btn .fe {
    display: none;
}

.box-ubi-table th.box-ubi-col-picking,
.box-ubi-table td.box-ubi-col-picking {
    width: 2.1rem;
    min-width: 2rem;
    max-width: 2.35rem;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    text-align: center;
    overflow: hidden;
    font-size: 0.8125rem;
}

.box-ubi-table th.box-ubi-col-picking .box-grid-sort-btn {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    justify-content: center;
    gap: 0.05rem;
}

.box-ubi-table th.box-ubi-col-picking:not(.is-sorted) .box-grid-sort-btn .fe {
    display: none;
}

.box-ubi-col-firma {
    width: 10rem;
    min-width: 8rem;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-ubi-table th.box-ubi-col-desc,
.box-ubi-table td.box-ubi-col-desc {
    width: 11rem;
    min-width: 8rem;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-ubi-table th.box-ubi-col-estado,
.box-ubi-table td.box-ubi-col-estado {
    width: 2.25rem;
    min-width: 2rem;
    max-width: 2.5rem;
    padding-left: 0.2rem;
    padding-right: 0.15rem;
    text-align: center;
}

.box-ubi-header .box-page-title {
    flex: 0 1 auto;
}

.box-ubi-header .box-ubi-totales {
    flex: 1 1 auto;
    min-width: 0;
}

.box-page-header-top.box-ubi-header--tot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
}

.box-page-header-top.box-ubi-header--tot .box-page-title {
    justify-self: start;
}

.box-page-header-top.box-ubi-header--tot .box-ubi-totales {
    justify-self: center;
}

.box-page-header-top.box-ubi-header--tot .box-page-header-trailing {
    justify-self: end;
}

.box-ubi-tipo {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    background: #6c757d;
}

.box-ubi-tipo-pkf { background: #2c7be5; }
.box-ubi-tipo-pkd { background: #0d9488; }
.box-ubi-tipo-alm { background: #64748b; }
.box-ubi-tipo-exc { background: #e67e22; }
.box-ubi-tipo-rec { background: #1a9f5c; }
.box-ubi-tipo-exp { background: #6f42c1; }
.box-ubi-tipo-cd { background: #b45309; }
.box-ubi-tipo-otro { background: #6c757d; }

.box-ubi-icon-corto {
    color: #e67e22;
}

.box-ubi-icon-qc {
    color: #c9a227;
}

.box-ubi-icon-me {
    color: #6f42c1;
}

.box-ubi-icon-cad {
    color: #dc3545;
}

.box-ubi-cad-caducado {
    color: #dc3545;
    font-weight: 600;
}

.box-ubi-cad-corto {
    color: #e67e22;
    font-weight: 600;
}

.box-tz-tipo {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
}

.box-tz-tipo-ent { background: #198754; }
.box-tz-tipo-sal { background: #dc3545; }
.box-tz-tipo-tra { background: #0d6efd; }
.box-tz-tipo-rep { background: #0d9488; }
.box-tz-tipo-aju { background: #e67e22; }
.box-tz-tipo-con { background: #6f42c1; }
.box-tz-tipo-ub { background: #2c7be5; }
.box-tz-tipo-pre { background: #d63384; }
.box-tz-tipo-rec { background: #20c997; }
.box-tz-tipo-inv { background: #495057; }
.box-tz-tipo-otro { background: #6c757d; }

.box-ubi-totales {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.box-ubi-totales > span,
.box-ubi-tot-btn {
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
}

.box-ubi-tot-btn {
    border: 0;
    background: transparent;
    padding: 0 0.15rem;
    cursor: pointer;
}

.box-ubi-tot-btn.is-on {
    border-radius: 0.25rem;
    background: rgba(0, 0, 0, 0.06);
}

.box-ubi-tot-lbl {
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8rem;
}

.box-ubi-tot-val {
    color: var(--bs-primary, #2c7be5);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.box-ubi-tot-btn .box-ubi-cad-caducado {
    color: #dc3545;
}

.box-ubi-tot-btn .box-ubi-cad-corto {
    color: #e67e22;
}

.box-rx-filter-field--date-opcional .box-rx-filter-label {
    opacity: 0.72;
}

.box-rx-filter-field--date .form-control {
    width: 8.25rem;
    max-width: 100%;
}

.box-rx-filter-field--multiselect .box-multiselect {
    min-width: 8rem;
    max-width: 12rem;
}

.box-prep-centro-filter .box-rx-filter-select {
    min-width: 5.5rem;
    max-width: 8.5rem;
}

.box-prep-ruta-filter .box-rx-filter-select {
    min-width: 5.5rem;
    max-width: 8.5rem;
}

.box-prep-ui .box-rx-filters .box-rx-filter-field--date .form-control {
    width: 7rem;
    max-width: 100%;
}

.box-prep-fecha-limite-filter {
    flex: 0 0 auto;
    min-width: 0;
}

.box-prep-fecha-limite-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 7rem;
    max-width: 100%;
    margin-bottom: 0.45rem;
}

.box-prep-fecha-limite-filter .form-control {
    width: 7rem;
    max-width: 100%;
}

.box-prep-estados-filter.box-rx-filter-field--multiselect .box-multiselect {
    min-width: 9rem;
    max-width: 12rem;
}
.box-prep-estados-filter .box-sf-multiselect.e-popup .e-list-item,
.box-prep-estados-filter .e-ddl.e-popup .e-list-item {
    white-space: nowrap;
}

.box-rx-filter-field--ir {
    flex: 0 0 auto;
}

.box-rx-filter-field--search .box-grid-search {
    border-top: none;
    padding-top: 0;
    margin-bottom: 0;
    align-items: flex-end;
    gap: 0.35rem 0.5rem;
}

.box-rx-filter-field--search .box-grid-search-input,
.box-rx-filter-field--search .box-grid-search-input--md {
    min-width: 9rem;
    max-width: 14rem;
}

.box-rx-prep-fechas-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.box-rx-ir-pedido {
    width: 10.5rem;
    max-width: 100%;
}

.box-rx-list-toolbar .box-grid-search-leading {
    align-items: flex-end;
    gap: 0.65rem;
}

.box-rx-list-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.25rem 0 0.4rem;
    margin-bottom: 0.25rem;
}

.box-rx-list-summary > .box-grid-search,
.box-rx-list-summary .box-grid-search {
    width: auto;
    flex: 0 1 auto;
    max-width: 28rem;
    min-width: 12rem;
    margin-bottom: 0;
    align-items: center;
    gap: 0.5rem;
}

.box-rx-list-summary-end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-inline-start: auto;
}

.box-rx-list-summary-end > .box-grid-toolbar {
    margin-bottom: 0;
}

.box-rx-list-header {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.box-rx-list-grid-host {
    flex: 1 1 auto;
    min-height: 0;
}

.box-rx-list-grid-host.box-busy-host {
    min-height: 6rem;
}

.box-grid-search-leading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
    min-width: 0;
}

.box-grid-search-query {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 0 1 auto;
    min-width: 0;
}

.box-grid-search-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 0;
}

/* Excel + Nuevo (y demás acciones) siempre a la derecha de la barra */
.box-grid-search-actions > .box-toolbar-actions,
.box-grid-search > .box-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-inline-start: auto;
}

/* Nunca pegar botones dentro de la barra de buscar */
.box-grid-search .btn + .btn,
.box-grid-search .box-btn-toolbar + .box-btn-toolbar,
.box-grid-search .box-grid-toolbar + .btn,
.box-grid-search .box-grid-toolbar + .box-btn-toolbar {
    margin-inline-start: 0; /* el gap del flex ya separa */
}

.box-grid-search-input {
    flex: 0 1 auto;
    min-width: 12rem;
    max-width: 18rem;
}

.box-grid-search-input--md {
    flex: 0 1 auto;
    min-width: 12rem;
    max-width: 22rem;
}

/* Grids: una sola línea; 1ª columna flexible con tope + ellipsis; resto al contenido.
   border-collapse:separate es necesario para que position:sticky en th/td funcione en Firefox.
   table.table… gana a Bootstrap .table{width:100%} para no comprimir columnas bajo el sticky. */
.box-grid-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

table.table.box-grid-table {
    width: max-content !important;
}

.box-grid-table th,
.box-grid-table td {
    white-space: nowrap;
    vertical-align: middle;
}

/* Números e importes: alineación a la derecha; min-width evita que Firefox las aplaste bajo el sticky */
.box-grid-table th.box-grid-num,
.box-grid-table td.box-grid-num,
.box-grid-table th.box-grid-money,
.box-grid-table td.box-grid-money {
    text-align: right;
    padding-right: 0.85rem;
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
}

input.form-control.box-grid-num {
    text-align: right;
}

.box-grid-table th.box-grid-num .box-grid-sort-btn,
.box-grid-table th.box-grid-money .box-grid-sort-btn,
th.text-end .box-grid-sort-btn {
    justify-content: flex-end;
    width: 100%;
}

.box-grid-table td.box-grid-money {
    font-variant-numeric: tabular-nums;
}

.box-grid-table th.box-grid-col-main,
.box-grid-table td.box-grid-col-main {
    width: 22rem;
    min-width: 12rem;
    max-width: 22rem;
    overflow: hidden;
}

.box-grid-table th.box-grid-col-fecha,
.box-grid-table td.box-grid-col-fecha {
    width: 10rem;
    min-width: 10rem;
    max-width: 10rem;
}

.box-grid-table th.box-grid-col-codigo,
.box-grid-table td.box-grid-col-codigo {
    width: 6.5rem;
    min-width: 5.25rem;
    max-width: 7.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-grid-table th.box-grid-col-porte,
.box-grid-table td.box-grid-col-porte {
    width: 4.5rem;
    min-width: 3.75rem;
    max-width: 5rem;
    white-space: nowrap;
}

.box-grid-table .box-grid-main-cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    max-width: 22rem;
}

.box-grid-table .box-grid-main-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
}

.box-grid-table .box-grid-main-cell .badge {
    flex-shrink: 0;
}

/* Texto largo secundario (mail, etc.): ellipsis, no empujar acciones fuera */
.box-grid-table th.box-grid-col-clip,
.box-grid-table td.box-grid-col-clip {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.box-articulo-picking-grid th.box-grid-col-centro,
.box-articulo-picking-grid td.box-grid-col-centro {
    width: 7rem;
    min-width: 5rem;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ordenación por cabecera */
.box-grid-table th.box-grid-sort-th {
    padding: 0;
    user-select: none;
}

.box-grid-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.5rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.box-grid-sort-btn:hover {
    color: var(--bs-primary, #2c7be5);
}

.box-grid-sort-btn .fe {
    opacity: 0.35;
    font-size: 0.85em;
}

.box-grid-table th.box-grid-sort-th.is-sorted .box-grid-sort-btn .fe {
    opacity: 1;
    color: var(--bs-primary, #2c7be5);
}

/* Fila con editar/ver, o con doble clic propio. */
.box-grid-table tbody tr[data-box-dbl] > td,
.box-grid-table tbody tr:has(td.box-grid-col-actions .fe-edit-2) > td,
.box-grid-table tbody tr:has(td.box-grid-col-actions .fe-folder) > td,
.box-grid-table tbody tr:has(td.box-grid-col-actions .fe-external-link) > td {
    cursor: pointer;
}

.box-grid-table tbody td :is(input, textarea, select) {
    cursor: text;
}

/* Altura compacta unificada: input editable, solo lectura (box-field-display) y celdas de grid. */
.box-form-ui,
.box-prep-ui {
    --box-control-compact-height: calc(1.5em + 0.5rem + 2px);
}

.box-form-ui .box-flag-group :is(input.form-control, select.form-select):not([type="checkbox"]):not([type="radio"]):not(textarea),
.box-form-ui .box-rx-cab :is(input.form-control, select.form-select):not([type="checkbox"]):not([type="radio"]):not(textarea),
.box-form-ui .box-medida-input > :is(input.form-control, select.form-select),
.box-prep-ui .box-flag-group :is(input.form-control, select.form-select):not([type="checkbox"]):not([type="radio"]):not(textarea),
.box-prep-ui .box-rx-cab :is(input.form-control, select.form-select):not([type="checkbox"]):not([type="radio"]):not(textarea),
.box-prep-ui .box-medida-input > :is(input.form-control, select.form-select),
.box-grid-table tbody td :is(input.form-control, select.form-select):not([type="checkbox"]):not([type="radio"]):not(textarea),
.box-grid-search :is(input.form-control, select.form-select),
input.form-control.box-rx-grid-search {
    height: var(--box-control-compact-height);
    min-height: var(--box-control-compact-height);
    max-height: var(--box-control-compact-height);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.box-form-ui .box-flag-group .box-field-display:not(.box-field-display--multiline),
.box-form-ui .box-rx-cab .box-field-display:not(.box-field-display--multiline),
.box-prep-ui .box-flag-group .box-field-display:not(.box-field-display--multiline),
.box-prep-ui .box-rx-cab .box-field-display:not(.box-field-display--multiline),
.box-prep-ui .box-medida-input > .box-field-display,
.box-form-ui .box-medida-input > .box-field-display {
    height: var(--box-control-compact-height);
    min-height: var(--box-control-compact-height);
    max-height: var(--box-control-compact-height);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    box-sizing: border-box;
}

.box-grid-table tbody td textarea.form-control,
.box-form-ui textarea.form-control-sm,
.box-prep-ui textarea.form-control-sm {
    height: auto;
    min-height: calc(2.5em + 0.5rem + 2px);
    max-height: none;
}

/* Acciones siempre visibles al hacer scroll horizontal (Chrome y Firefox).
   No usar display:flex en el td; el flex va en .box-row-actions. */
.box-grid-table th.box-grid-col-actions,
.box-grid-table td.box-grid-col-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background-color: var(--bs-body-bg, #fff);
    box-shadow: -6px 0 8px -6px rgba(18, 38, 63, 0.18);
    padding-left: 0.65rem;
    padding-right: 0.5rem;
    width: auto;
    min-width: 3.25rem;
    box-sizing: border-box;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.box-grid-table td.box-grid-col-actions .box-row-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.box-grid-table tbody tr:hover > td.box-grid-col-actions {
    background-color: var(--bs-table-hover-bg, #f9fbfd);
}

html[data-box-theme="dark"] .box-grid-table th.box-grid-col-actions,
html[data-box-theme="dark"] .box-grid-table td.box-grid-col-actions {
    background-color: #1e3a5f;
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.45);
}

html[data-box-theme="dark"] .box-grid-table tbody tr:hover > td.box-grid-col-actions {
    background-color: #24466f;
}

/* Ubicaciones: selección en azul claro. El velo de Bootstrap se anula para que el fondo se vea. */
.box-ubi-table tbody tr.table-active > td {
    --bs-table-accent-bg: #d4e6fb;
    --bs-table-bg-state: #d4e6fb;
    --bs-table-active-bg: #d4e6fb;
    background-color: #d4e6fb !important;
    box-shadow: none;
    color: #12263f;
}
.box-ubi-table tbody tr.table-active:hover > td {
    --bs-table-accent-bg: #c5daf8;
    --bs-table-bg-state: #c5daf8;
    background-color: #c5daf8 !important;
    color: #12263f;
}
html[data-box-theme="dark"] .box-ubi-table tbody tr.table-active > td,
html[data-box-theme="dark"] .box-ubi-table tbody tr.table-active:hover > td {
    --bs-table-accent-bg: #2a4570;
    --bs-table-bg-state: #2a4570;
    background-color: #2a4570 !important;
    box-shadow: none;
    color: #e3ebf6;
}

.box-grid-title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6e84a3;
}

html[data-box-theme="dark"] .box-grid-title {
    color: #95aac9;
}

.box-grid-pager .btn i.fe {
    font-size: 0.85rem;
}

.box-grid-pager .btn .fe-chevron-left {
    margin-right: 0.15rem;
}

.box-grid-pager .btn .fe-chevron-right {
    margin-left: 0.15rem;
}

/* Layout Usuarios: roles (izq) | pestañas+contenido (der) */
.box-busy-host:has(> .box-users-layout) {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.box-page-fill-body > .box-busy-host > .box-users-layout,
.box-users-layout {
    display: flex;
    gap: 1rem;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    align-items: stretch;
}

.box-users-roles {
    width: 19rem;
    flex: 0 0 19rem;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid #e3ebf6;
    padding-right: 1rem;
    margin-right: 0.15rem;
}

html[data-box-theme="dark"] .box-users-roles {
    border-right-color: #1e3a5c;
}

.box-users-roles-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.box-users-roles .box-row-actions {
    padding-right: 0.15rem;
}

.box-users-roles td:last-child {
    width: 4.5rem;
    min-width: 4.5rem;
}

/* Rol seleccionado: fondo azul (sin barras entre columnas) */
.box-users-roles tr.box-row-selected > td {
    background-color: #d6e6fb !important;
    color: #12263f;
}

.box-users-roles tr.box-row-selected:hover > td {
    background-color: #c5d9f5 !important;
}

html[data-box-theme="dark"] .box-users-roles tr.box-row-selected > td {
    background-color: #243660 !important;
    color: #e3ebf6;
}

html[data-box-theme="dark"] .box-users-roles tr.box-row-selected:hover > td {
    background-color: #2c4470 !important;
}

.box-users-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-left: 0.25rem;
}

.box-users-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.box-users-panel > .box-grid-fill {
    flex: 1 1 auto;
    min-height: 8rem;
}

/* Pestañas horizontales (Usuarios y similares) */
.box-section-nav--inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
    border-bottom: 1px solid #e3ebf6;
    margin-bottom: 0.5rem !important;
}

html[data-box-theme="dark"] .box-section-nav--inline {
    border-bottom-color: #1e3a5c;
}

.box-section-nav--inline .box-section-nav-item {
    width: auto;
    padding: 0.4rem 0.7rem;
    border-radius: 0.4rem 0.4rem 0 0;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
}

.box-section-nav--inline .box-section-nav-item:hover:not(:disabled) {
    background: #f0f4fa;
    border-color: transparent;
}

.box-section-nav--inline .box-section-nav-item.active {
    background: transparent;
    color: #2c7be5;
    border-bottom-color: #2c7be5;
}

html[data-box-theme="dark"] .box-section-nav--inline .box-section-nav-item:hover:not(:disabled) {
    background: #1b2a4e;
}

html[data-box-theme="dark"] .box-section-nav--inline .box-section-nav-item.active {
    background: transparent;
    color: #6ea8fe;
    border-bottom-color: #6ea8fe;
}

/* Piloto Preparación: pestañas tipo pastilla (más contraste que subrayado) */
.box-prep-ui .box-section-nav--chips {
    gap: 0.35rem;
    padding: 0.2rem;
    background: #edf2f9;
    border: 1px solid #e3ebf6;
    border-radius: 0.45rem;
    margin-bottom: 0 !important;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item {
    border-radius: 0.35rem;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: #5c6f87;
    font-weight: 500;
    padding: 0.4rem 0.65rem;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item > i {
    color: #95aac9;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item:hover:not(:disabled) {
    background: #e3eaf3;
    border-color: #d2ddec;
    color: #12263f;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.active {
    background: #fff;
    border-color: #c5d9f5;
    color: #2c7be5;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(18, 38, 63, 0.07);
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.active > i {
    color: #2c7be5;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.box-section-nav-item--danger {
    color: #e63757;
    background: transparent;
    border-color: transparent;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.box-section-nav-item--danger > i {
    color: #e63757;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.box-section-nav-item--danger:hover:not(:disabled) {
    color: #c81e40;
    background: #e3eaf3;
    border-color: #d2ddec;
}

.box-prep-ui .box-section-nav--chips .box-section-nav-item.box-section-nav-item--danger:hover:not(:disabled) > i {
    color: #c81e40;
}

html[data-box-theme="dark"] .box-prep-ui .box-section-nav--chips {
    background: #1a2b4a;
    border-color: #2c3a4f;
}

html[data-box-theme="dark"] .box-prep-ui .box-section-nav--chips .box-section-nav-item {
    color: #95aac9;
}

html[data-box-theme="dark"] .box-prep-ui .box-section-nav--chips .box-section-nav-item:hover:not(:disabled) {
    background: #243552;
    border-color: #3d5a80;
    color: #e3ebf6;
}

html[data-box-theme="dark"] .box-prep-ui .box-section-nav--chips .box-section-nav-item.active {
    background: #152238;
    border-color: #3d5a80;
    color: #6ea8fe;
}

@media (max-width: 991.98px) {
    .box-users-layout {
        flex-direction: column;
    }

    .box-users-roles {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e3ebf6;
        padding-right: 0;
        padding-bottom: 0.75rem;
        max-height: 16rem;
    }

    html[data-box-theme="dark"] .box-users-roles {
        border-bottom-color: #1e3a5c;
    }
}

/* Dashboard KPIs */
.box-home-hero-compact {
    min-height: 7rem;
    max-height: 9rem;
}
.box-home-hero-compact .box-home-hero-img {
    max-height: 5.5rem;
}
.box-dash-section {
    border: 1px solid #e3ebf6;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    background: #fff;
    height: 100%;
}
html[data-box-theme="dark"] .box-dash-section {
    background: #152e4d;
    border-color: #1e3a5c;
}
.box-dash-section-title {
    font-weight: 600;
    margin-bottom: 0.65rem;
}
.box-dash-kpi {
    background: #f5f8fc;
    border-radius: 0.4rem;
    padding: 0.55rem 0.65rem;
}
html[data-box-theme="dark"] .box-dash-kpi {
    background: #1b2a4e;
}
.box-dash-kpi-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}
.box-dash-kpi-label {
    font-size: 0.72rem;
    color: #95aac9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-dash-chart-title {
    font-size: 0.8rem;
    color: #95aac9;
    margin-bottom: 0.35rem;
}
.box-dash-bar-row {
    display: grid;
    grid-template-columns: minmax(4.5rem, 8rem) 1fr 3.2rem;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.28rem;
}
.box-dash-bar-label {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-dash-bar-track {
    height: 0.55rem;
    background: #e3ebf6;
    border-radius: 999px;
    overflow: hidden;
}
html[data-box-theme="dark"] .box-dash-bar-track {
    background: #1e3a5c;
}
.box-dash-bar-fill {
    height: 100%;
    background: #2c7be5;
}
.box-dash-bar-val {
    font-size: 0.75rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Recepción: indicador de estado en primera columna */
.box-rx-estado {
    display: inline-block;
    flex-shrink: 0;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.box-rx-estado--pendiente { background: #f6c343; }
.box-rx-estado--ubicado { background: #39afd1; }
.box-rx-estado--validado { background: #00d97e; }
.box-rx-estado--vacio { background: #95aac9; }
.box-rx-estado--anulada { background: #fd7e14; }
.box-rx-badge-anulada {
    background-color: #fd7e14;
    color: #fff;
}
html[data-box-theme="dark"] .box-rx-estado {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Recepción detalle: cabecera en pestañas plegables; los grids ocupan el resto */
.box-rx-cab {
    flex: 0 0 auto;
    border: 1px solid #e3ebf6;
    border-radius: 0.5rem;
    background: #f9fbfd;
}
.box-rx-cab-bar,
.box-rx-grid-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    min-width: 0;
}
.box-rx-cab-bar {
    padding: 0 0.5rem;
}
.box-rx-cab-bar--page-header {
    width: 100%;
    padding-top: 0.35rem;
    margin-top: 0.125rem;
    border-top: 1px solid #e3ebf6;
}
html[data-box-theme="dark"] .box-rx-cab-bar--page-header {
    border-top-color: #1e3a5c;
}
.box-rx-cab--solo-cuerpo {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}
.box-rx-cab-bar > .box-section-nav--inline,
.box-rx-grid-bar > .box-section-nav--inline {
    border-bottom: 0;
    margin-bottom: 0 !important;
}
.box-rx-cab-bar > div {
    padding-bottom: 0.25rem;
    min-width: 0;
}
.box-unit {
    min-width: 2.75rem;
    justify-content: center;
    background: #e8f1fd;
    border-color: #c9dcf7;
    color: #2c7be5;
    font-weight: 600;
}
/* Valor y unidad en piezas distintas. Bootstrap input-group los pega (margen negativo y radio 0). */
.input-group:has(> .input-group-text) {
    gap: 0.5rem;
}
.input-group:has(> .input-group-text) > .form-control,
.input-group:has(> .input-group-text) > .form-select,
.input-group:has(> .input-group-text) > .input-group-text {
    margin-left: 0 !important;
    border-radius: 0.2rem !important;
}
.box-unit-value {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
/* Legacy: mismo aspecto que box-field-unidad */
.box-unit-tag {
    display: inline-block;
    flex: 0 0 auto;
    padding: 0 0.45rem;
    border: 1px solid #c9dcf7;
    border-radius: 0.25rem;
    background: #e8f1fd;
    color: #2c7be5;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: calc(1.5em + 0.5rem + 2px);
    white-space: nowrap;
}
.box-input-num {
    text-align: right;
}
html[data-box-theme="dark"] .box-unit,
html[data-box-theme="dark"] .box-unit-tag {
    background: #1e3a5c;
    border-color: #2c3a4f;
    color: #8bb8f5;
}
.box-rx-cab .box-flag-group {
    padding: 0.5rem 0.75rem 0.6rem;
}
.box-rx-cab .box-flag-group-title {
    margin-bottom: 0.35rem;
}
.box-rx-totales-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding-top: 0.25rem;
    border-top: 1px dashed #e3ebf6;
}
html[data-box-theme="dark"] .box-rx-totales-counts {
    border-top-color: #2c3a4f;
}
.box-grid-row-click {
    cursor: pointer;
}
.box-rx-grid-search {
    width: 14rem;
}
.box-grid-col-check {
    width: 2rem;
    white-space: nowrap;
}
.box-rx-ubic-col {
    width: 8rem;
    max-width: 8rem;
}
.box-rx-ubic-input {
    width: 7.25rem;
    max-width: 7.25rem;
    min-width: 0;
    background-color: #fff;
}
.box-svc-estado {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.box-svc-estado .fe {
    font-size: 1rem;
    flex: 0 0 auto;
}
.box-svc-estado--proc { color: #0d6efd; }
.box-svc-estado--plan { color: #6c757d; }
.box-svc-estado--total { color: #198754; }
.box-svc-estado--parc { color: #f6a623; }
.box-svc-estado--canc { color: #fd7e14; }
.box-svc-estado--rech { color: #dc3545; }
.box-svc-estado--nd { color: #95aac9; }

.box-rx-estado-dot {
    display: inline-block;
    width: .75rem;
    height: .75rem;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
    flex: 0 0 auto;
}
.box-rx-cant-dif {
    color: #e63757;
    font-weight: 600;
}
.box-rx-cab-meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}
.box-rx-cab-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.box-rx-cab-meta-item > i {
    flex-shrink: 0;
}
.box-rx-cab-meta > span + span {
    padding-left: 1.25rem;
    border-left: 1px solid #d2ddec;
}
.box-rx-cab-meta > .box-action-btn {
    margin-left: 0.5rem;
}
html[data-box-theme="dark"] .box-rx-cab-meta > span + span {
    border-left-color: #2c3a4f;
}
.box-rx-cab-body {
    margin: 0;
    padding: 0.5rem 0.65rem 0.6rem;
    border-top: 1px solid #e3ebf6;
}
.box-rx-cab-body.box-rx-totales {
    border: 0;
    border-top: 1px solid #e3ebf6;
    border-radius: 0 0 0.5rem 0.5rem;
}
.box-rx-grid-bar {
    flex: 0 0 auto;
    border-bottom: 1px solid #e3ebf6;
    margin-bottom: 0.5rem;
}
.box-rx-grid-bar > .box-toolbar-actions {
    padding-bottom: 0.3rem;
}
.box-rx-progreso {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 9rem;
    max-width: 16rem;
    min-width: 8rem;
    margin-bottom: 0.35rem;
}
.box-rx-progreso-track {
    flex: 1 1 auto;
    height: 0.45rem;
    border-radius: 999px;
    background: #e3ebf6;
    overflow: hidden;
}
.box-rx-progreso-fill {
    height: 100%;
    border-radius: inherit;
    background: #2c7be5;
    transition: width 0.25s ease;
}
.box-rx-progreso-fill.is-done {
    background: #00d97e;
}
.box-rx-progreso-label {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: #6e84a3;
    white-space: nowrap;
}
.box-rx-progreso-cell {
    flex: 0 0 auto;
    max-width: 8.5rem;
    min-width: 6.5rem;
    margin-bottom: 0;
}
.box-prep-estado {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.badge.box-prep-est-badge--conf-parcial {
    background: #fd7e14;
    color: #212529;
}
.badge.box-prep-est-badge--anul {
    background: #dc3545;
    color: #fff;
}
.box-prep-dest {
    min-width: 3.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.box-prep-dest--ven { background: #0d6efd; color: #fff; }
.box-prep-dest--tras { background: #e67e22; color: #fff; }
.box-prep-dest--fab { background: #6f42c1; color: #fff; }
.box-prep-dest--semi { background: #0f766e; color: #fff; }
.box-prep-dest--otro { background: #6c757d; color: #fff; }
.box-plan-tipo {
    min-width: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.box-plan-tipo--alb { background: #2c7be5; color: #fff; }
.box-plan-tipo--dis { background: #0f766e; color: #fff; }
.box-plan-tipo--rec { background: #e67e22; color: #fff; }
.box-plan-tipo--dev { background: #6f42c1; color: #fff; }
.box-plan-tipo--rs { background: #6c757d; color: #fff; }
.box-plan-sel {
    align-self: center;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
}
.box-plan-total-pedidos--header {
    background: #34495e;
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.65rem;
}
.box-screen-header__title-center .box-plan-totales {
    gap: 0.5rem;
}
.box-plan-est {
    min-width: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.box-plan-est--pex { background: #f6c343; color: #212529; }
.box-plan-est--exp { background: #2c7be5; color: #fff; }
.box-plan-est--app { background: #95a5a6; color: #fff; }
.box-plan-est--app-total { background: #00a65a; color: #fff; }
.box-plan-est--app-par { background: #6f42c1; color: #fff; }
.box-plan-est--app-can { background: #e67e22; color: #fff; }
.box-plan-est--app-rech { background: #dc3545; color: #fff; }
.box-plan-est--fin { background: #198754; color: #fff; }
.box-plan-est--tot { background: #198754; color: #fff; }
.box-plan-est--parc { background: #fd7e14; color: #212529; }
.box-plan-est--anul { background: #dc3545; color: #fff; }
.box-plan-est--nul { background: #6c757d; color: #fff; }
.box-plan-est--ret-pen { background: #dc3545; color: #fff; }
.box-plan-est--ret-ok { background: #00a65a; color: #fff; }
.box-doc-icon-col {
    width: 1.5rem;
    max-width: 1.75rem;
    min-width: 1.5rem;
    text-align: center;
    padding-left: 0.2rem !important;
    padding-right: 0.2rem !important;
    white-space: nowrap;
}
.box-doc-icon--scan { color: #dc3545; font-size: 0.95rem; }
.box-doc-icon--firma { color: #198754; font-size: 0.95rem; }
.box-plan-prep--sin { color: #dc3545; }
.box-plan-prep--en { color: #e67e22; }
.box-plan-prep--ok { color: #00a65a; }
.box-plan-doc--pend { color: #6c757d; }
.box-plan-doc--scan { color: #2c7be5; }
.box-plan-doc--firmado { color: #00a65a; }
.box-plan-doc--sin-firma { color: #e67e22; }
.box-plan-icon-col {
    width: 2rem;
    max-width: 2rem;
    text-align: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}
.box-plan-estados-filter .box-multiselect-host {
    min-width: 14rem;
    max-width: 20rem;
}

.box-nota-est {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.box-nota-est--pex { background: #f6c343; color: #212529; }
.box-nota-est--exp { background: #2c7be5; color: #fff; }
.box-nota-est--pcon { background: #6f42c1; color: #fff; }
.box-nota-est--conf { background: #198754; color: #fff; }
.box-nota-est--anul { background: #dc3545; color: #fff; }
.box-nota-est--par { background: #fd7e14; color: #212529; }
.box-nota-est--rex { background: #0dcaf0; color: #212529; }
.box-nota-est--pesc { background: #ffc107; color: #212529; }
.box-nota-est--pfir { background: #d63384; color: #fff; }
.box-nota-est--otro { background: #adb5bd; color: #212529; }
.box-notas-grid tr.box-notas-row--sel > td:not(.box-grid-col-actions),
.box-notas-grid tr.box-notas-row--sel:hover > td:not(.box-grid-col-actions) {
    background-color: rgba(44, 123, 229, 0.14);
}
.box-notas-grid tr.box-notas-row--sel > td.box-nota-col-firma {
    box-shadow: inset 3px 0 0 #2c7be5;
}
.box-notas-grid .box-nota-col-firma {
    max-width: 9rem;
    min-width: 5.5rem;
}
.box-notas-grid th.box-nota-col-dest,
.box-notas-grid td.box-nota-col-dest {
    width: 12rem;
    min-width: 8rem;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-notas-grid .box-nota-col-sec {
    max-width: 7rem;
    font-size: 0.8125rem;
}
.box-notas-grid .box-nota-col-dir {
    max-width: 11rem;
}
.box-notas-grid .box-nota-col-ruta {
    max-width: 9rem;
}
.box-notas-grid .box-nota-col-reemb {
    width: 2.25rem;
    max-width: 2.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.box-readonly-panel input:not([type=hidden]),
.box-readonly-panel select,
.box-readonly-panel textarea {
    pointer-events: none;
    background-color: var(--bs-secondary-bg);
}
.box-plan-rex {
    background: #b02a37;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.box-plan-resumen-etiq {
    font-weight: 600;
}
.box-prep-progreso-detalle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e3ebf6;
    border-radius: 0.4rem;
    background: #f9fbfd;
}
.box-prep-progreso-detalle .box-rx-progreso-track {
    flex: 1 1 auto;
    height: 1.1rem;
    min-width: 8rem;
}
.box-prep-progreso-detalle-titulo {
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 0.875rem;
}
.box-prep-progreso-detalle-label {
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    color: #12263f;
}
html[data-box-theme="dark"] .box-prep-progreso-detalle {
    border-color: #2c3a4f;
    background: #1b2433;
}
html[data-box-theme="dark"] .box-prep-progreso-detalle-label {
    color: #e3ebf6;
}
html[data-box-theme="dark"] .box-rx-progreso-track {
    background: #2c3a4f;
}
html[data-box-theme="dark"] .box-rx-progreso-label {
    color: #95aac9;
}
html[data-box-theme="dark"] .box-rx-cab {
    border-color: #2c3a4f;
    background: #1b2433;
}
html[data-box-theme="dark"] .box-rx-list-toolbar .box-grid-search {
    border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-box-theme="dark"] .box-rx-cab-body,
html[data-box-theme="dark"] .box-rx-grid-bar {
    border-color: #2c3a4f;
}

/* Preparación: listado y detalle */
.box-prep-sel-count {
    align-self: center;
    white-space: nowrap;
}
.box-prep-stock {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
}
.box-prep-stock--ok { background: #00d97e; }
.box-prep-stock--parcial { background: #f6c343; }
.box-prep-stock--rotura { background: #e63757; }
.box-prep-stock--nd { background: #95aac9; }
.box-prep-rotura-icon {
    color: #dc3545;
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
}
.box-prep-cantidad-alerta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}
.box-prep-icon {
    font-size: 1rem;
    vertical-align: middle;
}
.box-prep-icon--total { color: #00d97e; }
.box-prep-icon--parcial { color: #e63757; }
.box-prep-icon--cond { color: #f6a623; }
.box-prep-icon--cond-pedido { color: #e63757; }
.box-prep-cond-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
html[data-box-theme="dark"] .box-prep-stock {
    border-color: rgba(255, 255, 255, 0.2);
}
.box-prep-list .box-prep-list-row {
    cursor: pointer;
    user-select: none;
}
.box-prep-list tr.box-prep-list-row--sel > td:not(.box-grid-col-actions),
.box-prep-list tr.box-prep-list-row--sel:hover > td:not(.box-grid-col-actions) {
    background-color: rgba(44, 123, 229, 0.14);
}
.box-prep-list .box-prep-list-row--sel > td.box-prep-col-firma {
    box-shadow: inset 3px 0 0 #2c7be5;
}
.box-prep-list th.box-prep-col-firma,
.box-prep-list td.box-prep-col-firma {
    width: 7.5rem;
    min-width: 5.5rem;
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-prep-list th.box-prep-col-razon,
.box-prep-list td.box-prep-col-razon {
    width: 10rem;
    min-width: 7rem;
    max-width: 12rem;
    overflow: hidden;
}
.box-prep-list .box-prep-col-razon-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-plan-grid .box-plan-pedido-row {
    cursor: default;
    user-select: none;
}
.box-plan-grid tr.box-plan-pedido-row--sel > td:not(.box-grid-col-actions),
.box-plan-grid tr.box-plan-pedido-row--sel:hover > td:not(.box-grid-col-actions) {
    background-color: rgba(44, 123, 229, 0.14);
}
.box-plan-grid tr.box-plan-pedido-row--sel > td.box-grid-col-main {
    box-shadow: inset 3px 0 0 #2c7be5;
}
.box-plan-page.box-busy-host {
    position: relative;
    min-height: 12rem;
}
.box-plan-page .box-busy-overlay {
    z-index: 40;
}
.box-plan-page .box-busy-panel .e-spinner-pane {
    transform: scale(1.35);
}
.box-plan-filtros-dual {
    position: relative;
    padding: 0.2rem 2.25rem 0.25rem 0.5rem;
}
.box-plan-filtros-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.25rem;
}
.box-plan-filtros-rows--pedidos {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    min-width: 0;
}
/* Planificación pedidos: fila 1 (criterios) + fila 2 (toolbar); alineado a la izquierda */
.box-plan-filtros-pedidos-flow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}
.box-plan-filtros-plan-row--f1,
.box-plan-filtros-plan-row--f2 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.35rem 0.5rem;
    width: 100%;
    min-width: 0;
}
.box-plan-filtros-plan-row--f2 {
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: 0.35rem 0.5rem;
}
.box-plan-filtros-f1-line2-break,
.box-plan-filtros-f1-buscar-spacer {
    display: none;
}
.box-plan-filtros-plan-row--f1 .box-plan-filtros-field--buscar {
    margin-left: auto;
}
@media (min-width: 1400px) {
    .box-plan-filtros-plan-row--f1 {
        flex-wrap: nowrap;
        align-items: flex-end;
    }
    .box-plan-filtros-f1-buscar-spacer {
        display: block;
        flex: 1 1 auto;
        min-width: 0.5rem;
        align-self: flex-end;
        max-height: 0;
        margin: 0;
        padding: 0;
    }
    .box-plan-filtros-plan-row--f1 .box-plan-filtros-field--buscar {
        margin-left: 0;
        flex-shrink: 0;
    }
}
@media (max-width: 1399.98px) {
    .box-plan-filtros-f1-line2-break {
        display: block;
        flex-basis: 100%;
        width: 0;
        height: 0;
        margin: 0;
        padding: 0;
    }
}
@media (max-width: 991.98px) {
    .box-plan-filtros-plan-row--f1 .box-plan-filtros-field--scope {
        flex: 1 1 calc(50% - 0.35rem);
        max-width: calc(50% - 0.35rem);
    }
}
.box-plan-filtros-cols {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem 0.5rem;
}
.box-plan-filtros-cols--linea1 {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.35rem 0.65rem;
}
.box-plan-filtros-cols--plan-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem 0.65rem;
    width: 100%;
    min-width: 0;
}
.box-plan-filtros-rows--pedidos .box-plan-filtros-field {
    gap: 0.1rem;
}
.box-plan-filtros-rows--pedidos .box-rx-filter-label {
    line-height: 1.15;
    margin-bottom: 0;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope {
    flex: 0 1 auto;
    min-width: 4.5rem;
    max-width: 8.5rem;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--firma {
    min-width: 7.5rem;
    max-width: 11rem;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--ruta {
    min-width: 7rem;
    max-width: 10.5rem;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--temp {
    min-width: 6.5rem;
    max-width: 9.5rem;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-rx-filter-field--multiselect .box-multiselect-host,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-rx-filter-field--multiselect .box-multiselect {
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-rx-filter-field--multiselect .e-multi-select-wrapper,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-rx-filter-field--multiselect .e-delim-view,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-rx-filter-field--multiselect .e-delim-values {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos {
    flex: 0 0 auto;
    min-width: 10.5rem;
    max-width: 12.5rem;
    margin-right: 0;
    overflow: visible;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .box-rx-filter-label {
    white-space: nowrap;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .box-multiselect-host,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .box-multiselect {
    min-width: 10.5rem !important;
    max-width: 12.5rem !important;
    width: 100%;
    overflow: visible;
}
/* Texto del valor (p. ej. «Nota recogida»): ellipsis sin recortar el borde del control */
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .e-multi-select-wrapper,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .e-delim-view,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--tipos .e-delim-values {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.box-plan-filtros-tipos-estado-gap {
    flex: 0 0 1rem;
    width: 1rem;
    min-width: 1rem;
    max-width: 1rem;
    align-self: stretch;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--estados {
    flex: 0 0 auto;
    min-width: 9rem;
    max-width: 11rem;
    margin-left: 0 !important;
}
.box-plan-filtros-pedidos-flow .box-plan-estados-filter .box-multiselect-host {
    min-width: 9rem !important;
    max-width: 11rem !important;
    width: 100%;
}
.box-plan-filtros-plan-row--f1 .box-plan-filtros-f1-line2 + .box-plan-filtros-f1-line2 {
    margin-left: 0;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--vista {
    flex: 0 1 5.25rem;
    min-width: 4.85rem;
    max-width: 6.75rem;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--vista .box-plan-filtros-vista,
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--vista .box-rx-filter-select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.box-plan-filtros-pedidos-flow .box-plan-filtros-field--buscar {
    flex: 0 0 auto;
    align-self: flex-end;
}
.box-plan-totales--filtros {
    flex: 0 1 auto;
    min-width: 0;
}
.box-plan-filtros-pedidos-flow .box-rx-filter-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.box-plan-filtros-fila2-toolbar {
    flex-wrap: nowrap;
}
.box-plan-filtros-fila2-izq {
    gap: 0.35rem;
    min-width: 0;
    justify-content: flex-start;
    flex: 0 1 auto;
    align-items: flex-end;
}
.box-plan-filtros-fila2-centro {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 0.25rem;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--vista {
    flex: 0 0 auto;
    min-width: 5.25rem;
    max-width: 6.5rem;
    width: auto;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--vista .box-plan-filtros-vista,
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--vista .box-rx-filter-select {
    width: 100%;
    min-width: 5.25rem;
    max-width: 6.5rem;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--q {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 6.5rem;
    width: 6.5rem;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--q .box-grid-search {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 0;
    gap: 0;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--q .box-grid-search-input,
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--q .box-grid-search-input--md {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    flex: 1 1 auto;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-field--ir {
    flex: 0 0 auto;
}
.box-plan-filtros-field--ir .box-plan-filtros-ir-pedido,
.box-plan-filtros-field--ir .box-rx-ir-pedido {
    width: 8.25rem;
    max-width: 100%;
}
.box-plan-filtros-fila2-badges {
    align-items: flex-end;
    min-height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
}
.box-plan-filtros-field--sin-label {
    gap: 0;
    justify-content: center;
}
.box-plan-filtros-fila2-izq .box-plan-filtros-field--q.box-plan-filtros-field--sin-label {
    justify-content: flex-end;
    align-self: flex-end;
}
.box-plan-filtros-fila2-izq .box-plan-filtros-field--q .box-grid-search {
    margin-bottom: 0;
    align-items: flex-end;
    gap: 0;
}
.box-plan-filtros-field--q .box-grid-search,
.box-plan-filtros-field--q .box-grid-search-query {
    width: 100%;
    min-width: 0;
}
.box-plan-filtros-field--q .box-grid-search-query input.form-control {
    width: 100%;
    min-width: 0;
}
.box-plan-filtros-fila2-izq > .box-plan-filtros-ctl--date {
    flex: 0 0 auto;
    min-width: 6.85rem;
    max-width: 7.75rem;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    width: auto;
    align-self: flex-end;
}
.box-plan-filtros-fila2-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-end;
    margin-left: auto;
    gap: 0.35rem;
}
.box-plan-filtros-fila2-actions.box-plan-filtros-fila2-actions--tight > .btn {
    margin: 0;
}
.box-plan-filtros-fila2-actions.box-plan-filtros-fila2-actions--tight {
    gap: 0.25rem;
}
@media (max-width: 991.98px) {
    .box-plan-filtros-fila2-toolbar {
        flex-wrap: wrap;
        align-items: flex-end;
    }
    .box-plan-filtros-fila2-centro {
        flex: 1 1 100%;
        order: 2;
        justify-content: center;
    }
    .box-plan-filtros-fila2-actions {
        margin-left: auto;
        flex: 0 1 auto;
    }
}
@media (min-width: 1200px) {
    .box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--firma {
        max-width: 12rem;
    }
    .box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--ruta {
        max-width: 11.5rem;
    }
    .box-plan-filtros-pedidos-flow .box-plan-filtros-field--scope.box-plan-filtros-field--temp {
        max-width: 10rem;
    }
    .box-plan-filtros-fila2-izq > .box-plan-filtros-field--q {
        max-width: 7rem;
        width: 7rem;
    }
}
.box-plan-filtros-plan-row--f1 .box-plan-filtros-field--buscar {
    padding-right: 0.15rem;
}
.box-plan-split--solo-pedidos .box-plan-grid-bar-search {
    flex: 1 1 12rem;
    max-width: none;
}
.box-plan-split--solo-pedidos .box-plan-grid-bar .box-grid-search {
    max-width: none;
}
.box-plan-filtros-grupo--criterio {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1.25rem;
}
.box-plan-filtros-cols--criterio {
    gap: 0.5rem 1.25rem;
}
.box-plan-filtros-field {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    flex: 0 0 auto;
    min-width: 0;
}
.box-plan-filtros-field .box-rx-filter-select {
    min-width: 5rem;
    max-width: 7.5rem;
}
.box-plan-filtros-field--firma .box-rx-filter-select {
    min-width: 7.5rem;
    max-width: 11rem;
}
.box-plan-filtros-field--temp.box-rx-filter-field--multiselect {
    overflow: visible;
}
.box-plan-filtros-field--estados {
    min-width: 7.5rem;
    max-width: 10rem;
}
.box-plan-filtros-field--buscar .box-btn-toolbar {
    white-space: nowrap;
}
.box-plan-filtros-field--estados .box-multiselect-host,
.box-plan-filtros-field--estados .box-multiselect,
.box-plan-filtros-field--tipos .box-multiselect-host,
.box-plan-filtros-field--tipos .box-multiselect {
    width: 100%;
}
.box-plan-filtros-field--buscar {
    align-self: flex-end;
}
.box-plan-filtros-label-invisible {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    line-height: 0;
}
.box-plan-filtros-field--fecha-hoja {
    flex: 0 0 auto;
}
.box-plan-filtros-line--hojas {
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.box-plan-grid-bar-search {
    flex: 1 1 10rem;
    min-width: 8rem;
    max-width: 22rem;
}
.box-plan-grid-bar-search .box-grid-search {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
}
.box-plan-reembolso-mark {
    color: #dc3545;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
}
.box-plan-filtros-panel--split {
    min-height: 3.85rem;
}
.box-plan-split-pedidos .box-plan-filtros-panel--split {
    min-height: 0;
}
.box-plan-split-hojas .box-plan-filtros-panel--split {
    min-height: 0;
}
.box-plan-filtros-corner {
    position: absolute;
    top: 0.3rem;
    right: 0.35rem;
    z-index: 2;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}
.box-plan-filtros-line {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem 0.5rem;
    padding-right: 0.25rem;
}
.box-plan-filtros-line--labels {
    min-height: 1rem;
    margin-bottom: 0.1rem;
    align-items: flex-end;
}
.box-plan-filtros-line--labels .box-rx-filter-label {
    margin-bottom: 0;
    line-height: 1.1;
    white-space: nowrap;
}
.box-plan-filtros-line--controls {
    align-items: flex-end;
}
.box-plan-filtros-ctl {
    flex: 0 0 auto;
}
.box-plan-filtros-ctl--firma .box-rx-filter-select,
select.box-plan-filtros-ctl--firma {
    min-width: 7.5rem;
    max-width: 11rem;
}
.box-plan-filtros-ctl .box-rx-filter-select,
select.box-plan-filtros-ctl {
    min-width: 5rem;
    max-width: 7.5rem;
}
.box-plan-filtros-ctl--date {
    width: auto;
    min-width: 8.5rem;
}
.box-plan-filtros-ctl--search {
    flex: 1 1 8rem;
    min-width: 6rem;
    max-width: 14rem;
}
.box-plan-filtros-ctl--search .box-grid-search {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
}
.box-plan-filtros-ctl--btn {
    align-self: flex-end;
}
.box-plan-filtros-line--labels .box-plan-estados-filter {
    min-width: 7rem;
}
.box-plan-filtros-ctl.box-plan-estados-filter {
    min-width: 7rem;
    max-width: 9rem;
}
.box-plan-filtros-label-spacer {
    flex: 1 1 6rem;
    min-width: 4rem;
    visibility: hidden;
}
.box-plan-filtros-label-action {
    width: 4.5rem;
    flex-shrink: 0;
}
.box-plan-filtros-panel {
    position: relative;
    background: #f4f7fb;
    border: 1px solid #e3ebf6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}
.box-plan-filtros-panel--split {
    flex-shrink: 0;
}
.box-plan-filtros-panel .box-rx-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.15rem;
}
.box-plan-filtros-panel .box-rx-filter-field {
    flex: 0 0 auto;
    min-width: 0;
}
.box-plan-filtros-panel .box-rx-filter-select {
    min-width: 5.5rem;
    max-width: 8rem;
}
.box-plan-filtros-panel .box-plan-firma-filter .box-rx-filter-select {
    min-width: 8rem;
    max-width: 12rem;
}
.box-plan-filtros-panel .box-plan-estados-filter .box-multiselect-host {
    min-width: 9rem !important;
    max-width: 11rem !important;
}
.box-plan-estados-filter .box-sf-multiselect.e-popup .e-list-item,
.box-plan-estados-filter .e-ddl.e-popup .e-list-item {
    white-space: nowrap;
}
.box-plan-estados-filter .box-sf-multiselect.e-popup .e-list-group-item,
.box-plan-estados-filter .e-ddl.e-popup .e-list-group-item {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: #5c6f87;
    background: #edf2f9;
    border-top: 1px solid #d2ddec;
    padding-top: 0.45rem;
    padding-bottom: 0.25rem;
    pointer-events: none;
}
.box-plan-filtros-panel .box-rx-filter-field--multiselect:not(.box-plan-estados-filter) .box-multiselect-host {
    min-width: 7.5rem !important;
    max-width: 9.5rem !important;
}
.box-plan-filtros-panel .box-rx-filter-field--date-fpactada input[type="date"] {
    min-width: 8.5rem;
    max-width: 9rem;
}
.box-plan-grid-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    width: 100%;
    min-width: 0;
}
.box-plan-grid-bar-main {
    align-items: center;
}
.box-plan-grid-bar-enrutar {
    margin-left: auto;
}
.box-plan-vista-inline .form-select {
    width: auto;
}
.box-plan-vista-label {
    white-space: nowrap;
    line-height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
}
.box-plan-totales,
.box-plan-sel {
    align-self: center;
}
.box-plan-filter-collapse .box-rx-filter-label {
    min-height: 0;
}
.box-plan-grid-bar .box-grid-search {
    flex: 0 1 auto;
    min-width: 12rem;
    max-width: 22rem;
}
.box-plan-col-narrow {
    max-width: 6.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-plan-col-firma {
    max-width: 8rem;
}
.box-plan-col-firma-ped {
    max-width: 11rem;
    min-width: 7.5rem;
}
.box-plan-col-dest-pob {
    max-width: 13rem;
    min-width: 7.5rem;
}
.box-plan-col-peso {
    min-width: 3.25rem;
}
.box-plan-col-prop {
    max-width: 7rem;
    min-width: 4.5rem;
}
.box-plan-col-dir {
    max-width: 12rem;
    min-width: 6.5rem;
}
.box-plan-col-dest {
    max-width: 9rem;
}
.box-plan-hoja-2l {
    vertical-align: middle;
}
.box-plan-split-hojas .box-plan-grid .box-grid-table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}
.box-plan-split-hojas .box-plan-grid .box-grid-table thead th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-plan-split-hojas .box-plan-hoja-col-ruta {
    min-width: 8.5rem;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-plan-split-hojas .box-plan-hoja-col-agencia {
    min-width: 7.5rem;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-plan-split-hojas .box-plan-hoja-col-ruta.box-plan-hoja-2l,
.box-plan-split-hojas td.box-plan-hoja-col-ruta {
    max-width: 12rem;
}
.box-plan-split-hojas .box-plan-hoja-col-agencia.box-plan-hoja-2l,
.box-plan-split-hojas td.box-plan-hoja-col-agencia {
    max-width: 11rem;
}
.box-plan-split-hojas .box-plan-hoja-col-ped {
    min-width: 3.25rem;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}
.box-plan-split-hojas .box-plan-hoja-col-num {
    min-width: 4.25rem;
    padding-left: 0.25rem;
    padding-right: 0.35rem;
}
.box-plan-split-hojas .box-plan-hoja-col-euro {
    min-width: 6.75rem;
    padding-left: 0.35rem;
    padding-right: 0.5rem;
}
.box-plan-split-hojas .box-plan-hoja-col-actions {
    min-width: 2rem;
    width: 2.25rem;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
}
.box-plan-split-hojas .box-plan-hoja-col-actions .box-action-btn {
    padding: 0.05rem 0.1rem;
}
.box-plan-hoja-col-ruta {
    min-width: 7.5rem;
    max-width: 11rem;
}
.box-plan-hoja-col-agencia {
    min-width: 7rem;
    max-width: 10.5rem;
}
.box-plan-hoja-ruta-icons {
    width: 1.35rem;
    line-height: 1;
}
.box-plan-hoja-expedida {
    color: #2c7be5;
    font-size: 0.85rem;
}
.box-plan-col-tipo {
    width: 3.25rem;
    max-width: 3.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}
.box-plan-col-estado {
    width: 3rem;
    max-width: 3.5rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}
.box-plan-col-actions {
    width: 2.5rem;
    max-width: 3.25rem;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
}
.box-plan-col-actions .box-row-actions {
    gap: 0.1rem;
}
.box-plan-col-actions .box-action-btn {
    padding: 0.08rem 0.15rem;
}
.box-plan-grid--pedidos .box-grid-table {
    min-width: 2300px;
}
.box-plan-grid--pedidos .box-grid-table th.box-grid-money,
.box-plan-grid--pedidos .box-grid-table td.box-grid-money {
    min-width: 6.75rem;
}
.box-plan-grid--rutas .box-grid-table,
.box-plan-rutas-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}
.box-plan-grid--rutas .box-grid-col-main,
.box-plan-rutas-table .box-grid-col-main {
    width: auto;
    min-width: 0;
}
.box-plan-grid--rutas th.box-grid-num,
.box-plan-grid--rutas td.box-grid-num,
.box-plan-rutas-table th.box-grid-num,
.box-plan-rutas-table td.box-grid-num {
    min-width: 4.5rem;
    width: auto;
    max-width: none;
    padding-left: 0.25rem;
    padding-right: 0.4rem;
}
.box-plan-grid--rutas th:first-child,
.box-plan-grid--rutas td:first-child,
.box-plan-rutas-table th:first-child,
.box-plan-rutas-table td:first-child {
    width: 4.25rem;
    max-width: 4.75rem;
}
.box-plan-col-cod-dest {
    max-width: 4.25rem;
    min-width: 3rem;
}
.box-plan-col-prov {
    max-width: 7rem;
    min-width: 4.25rem;
}
.box-plan-col-horario {
    max-width: 5.5rem;
    min-width: 3.5rem;
}
.box-plan-col-obs {
    max-width: 18rem;
    min-width: 9rem;
}
.box-plan-asignar-dialog {
    max-width: min(1140px, calc(100vw - 1.5rem));
}
.box-plan-asignar-dialog .modal-body {
    max-height: min(82vh, 720px);
}
.box-plan-asignar-grid {
    max-height: min(42vh, 380px);
}
.box-plan-th-sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: #95aac9;
    line-height: 1.1;
}
.box-plan-col-ruta {
    max-width: 8.5rem;
    min-width: 5.5rem;
}
.box-plan-col-ruta-inner {
    max-width: 8.25rem;
    vertical-align: bottom;
}
.box-plan-col-pob {
    max-width: 7rem;
}
.box-plan-col-temp,
.box-grid-col-temp {
    max-width: 4.25rem;
    text-align: center;
}
.box-temp-cell,
.box-plan-temp-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.box-temp-pill {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    line-height: 1.2;
    border: none;
}
.box-temp--1 { color: #1B5E20; }
.box-temp-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 0.25rem;
    line-height: 1;
}
.box-temp-icon-badge .fe {
    font-size: 1.1rem;
}
.box-temp-icon-badge.box-temp--1 {
    color: #1B5E20;
    background: #C8E6C9;
}
.box-temp-icon-badge.box-temp--3 {
    color: #0277BD;
    background: #E3F2FD;
}
.box-temp--2 {
    color: #fff;
    background: linear-gradient(90deg, #2E7D32 0%, #0277BD 100%);
}
.box-temp--3 { color: #0277BD; }
.box-temp--4 {
    color: #0277BD;
}
.box-temp-snowflake {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}
.box-temp-snowflake.box-temp--4 {
    color: #01579B;
    background: #B3E5FC;
}
.box-temp-snowflake.box-temp--4::before {
    content: "\2744";
}
.box-temp--5 {
    color: #fff;
    background: #e67e22;
}
.box-temp--mid { color: #6e84a3; }
.box-temp--na { color: #95aac9; }
/* legacy planificación (código): sustituir por box-temp--* */
.box-plan-temp--cold { color: #0dcaf0; }
.box-plan-temp--cool { color: #2c7be5; }
.box-plan-temp--warm { color: #e67e22; }
.box-plan-temp--mid { color: #6e84a3; }
.box-plan-temp--na { color: #95aac9; }
.box-plan-result--pos { color: #00a65a; font-weight: 600; }
.box-plan-result--neg { color: #e63757; font-weight: 600; }
.box-plan-split-host {
    min-height: 0;
    flex: 1 1 auto;
}
.box-plan-split {
    display: flex;
    gap: 0;
    min-height: 0;
    flex: 1 1 auto;
}
.box-plan-split-gutter {
    flex: 0 0 10px;
    background: #e3ebf6;
    align-self: stretch;
    border-radius: 0;
}
.box-plan-split-pedidos {
    flex: 7 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #ffffff;
    border: 1px solid #e3ebf6;
    border-radius: 0.375rem;
    padding: 0.35rem 0.5rem;
}
.box-plan-split--solo-pedidos .box-plan-split-pedidos {
    flex: 1 1 auto;
}
.box-plan-split--solo-hojas .box-plan-split-hojas {
    flex: 1 1 auto;
}
.box-plan-split-hojas {
    flex: 3 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #ffffff;
    border: 1px solid #e3ebf6;
    border-radius: 0.375rem;
    padding: 0.35rem 0.5rem;
}
.box-plan-split-hojas .box-grid-fill,
.box-plan-split-hojas .box-plan-grid {
    background: #ffffff;
}
.box-plan-split--solo-hojas .box-plan-split-gutter,
.box-plan-split--solo-pedidos .box-plan-split-gutter {
    display: none;
}
.box-plan-hoja-row--drop > td {
    background-color: rgba(44, 123, 229, 0.18) !important;
}
.box-plan-pedido-row[draggable="true"] {
    cursor: grab;
}
.box-prep-cell-text {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-prep-modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.box-prep-resumen,
.box-prep-flags-ro,
.box-prep-leyenda {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Consulta = recuadro gris; edición = blanco (.box-form-ui en MainLayout; ver campos-vista-edicion.mdc) */
.box-form-ui .box-field-caption,
.box-form-ui .box-flag-group .text-muted,
.box-form-ui .box-rx-cab .text-muted,
.box-prep-ui .box-field-caption,
.box-prep-ui .box-flag-group .text-muted,
.box-rx-cab .text-muted {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #95aac9;
    margin-bottom: 0.25rem;
}

.box-field-display {
    display: block;
    width: 100%;
    min-height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #5c6f87;
    background-color: #edf2f9;
    border: 1px solid #d2ddec;
    border-radius: 0.2rem;
    box-sizing: border-box;
}

.box-field-display--multiline {
    white-space: pre-wrap;
    min-height: calc(1.5em + 0.5rem + 2px);
    max-height: 6rem;
    overflow: auto;
}

.box-medida-input > .box-field-display.box-input-num,
.box-prep-medida-input > .box-field-display.box-input-num {
    text-align: right;
}

/* Vista: valor en div tras la etiqueta (sin control editable dentro).
   No aplicar al contenedor box-medida-input: la unidad va fuera del recuadro del valor. */
.box-form-ui .box-flag-group [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)),
.box-form-ui .box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)),
.box-form-ui .box-flag-group [class*="col-"] > .text-muted + input:disabled.form-control,
.box-form-ui .box-rx-cab [class*="col-"] > .text-muted + input:disabled.form-control,
.box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)),
.box-rx-cab [class*="col-"] > .text-muted + input:disabled.form-control {
    display: block;
    width: 100%;
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #5c6f87;
    background-color: #edf2f9;
    border: 1px solid #d2ddec;
    border-radius: 0.2rem;
}

.box-form-ui .box-flag-group [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)) .text-truncate,
.box-form-ui .box-flag-group [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)),
.box-form-ui .box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)) .text-truncate,
.box-form-ui .box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.d-flex):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)),
.box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)) .text-truncate,
.box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)) {
    color: #5c6f87;
}

.box-form-ui .box-flag-group [class*="col-"] > .text-muted + .box-medida-input,
.box-form-ui .box-rx-cab [class*="col-"] > .text-muted + .box-medida-input,
.box-prep-ui .box-flag-group [class*="col-"] > .text-muted + .box-medida-input,
.box-prep-ui .box-flag-group [class*="col-"] > .box-field-caption + .box-medida-input,
.box-rx-cab [class*="col-"] > .text-muted + .box-medida-input,
.box-form-ui .box-flag-group [class*="col-"] > .text-muted + .box-prep-medida-input,
.box-prep-ui .box-flag-group [class*="col-"] > .text-muted + .box-prep-medida-input,
.box-rx-cab [class*="col-"] > .text-muted + .box-prep-medida-input {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0 !important;
    margin: 0;
    border: none !important;
    background: transparent !important;
    min-height: 0 !important;
    box-shadow: none;
}

/* Edición: controles activos en blanco */
.box-form-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
.box-form-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
.box-form-ui select.form-select:not(:disabled),
.box-prep-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
.box-prep-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
.box-prep-ui select.form-select:not(:disabled),
.box-rx-cab input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
.box-rx-cab textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
.box-rx-cab select.form-select:not(:disabled) {
    background-color: #fff !important;
    border: 1px solid #b8c5d6 !important;
    color: #12263f;
}

.box-form-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled):focus,
.box-form-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled):focus,
.box-form-ui select.form-select:not(:disabled):focus,
.box-prep-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled):focus,
.box-prep-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled):focus,
.box-prep-ui select.form-select:not(:disabled):focus,
.box-rx-cab input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled):focus,
.box-rx-cab textarea.form-control:not([readonly]):not([read-only]):not(:disabled):focus,
.box-rx-cab select.form-select:not(:disabled):focus {
    border-color: #2c7be5 !important;
    box-shadow: 0 0 0 0.2rem rgba(44, 123, 229, 0.14);
}

.box-form-ui .form-control[readonly],
.box-form-ui .form-control:read-only,
.box-form-ui textarea.form-control[readonly],
.box-form-ui .form-control:disabled:not([type="checkbox"]):not([type="radio"]),
.box-form-ui .form-select:disabled,
.box-prep-ui .form-control[readonly],
.box-prep-ui .form-control:read-only,
.box-prep-ui textarea.form-control[readonly] {
    background-color: #edf2f9 !important;
    border: 1px solid #d2ddec !important;
    color: #5c6f87 !important;
    cursor: default;
    opacity: 1;
}

html[data-box-theme="dark"] .box-field-display,
html[data-box-theme="dark"] .box-rx-cab [class*="col-"] > .text-muted + div:not(.input-group):not(.row):not(.box-medida-input):not(.box-prep-medida-input):not(:has(.form-control)):not(:has(.form-select)) {
    background-color: #1a2b4a;
    border-color: #2c3a4f;
    color: #95aac9;
}

html[data-box-theme="dark"] .box-form-ui .box-field-caption,
html[data-box-theme="dark"] .box-form-ui .box-flag-group .text-muted,
html[data-box-theme="dark"] .box-prep-ui .box-field-caption,
html[data-box-theme="dark"] .box-prep-ui .box-flag-group .text-muted,
html[data-box-theme="dark"] .box-rx-cab .text-muted {
    color: #7c93b5;
}

html[data-box-theme="dark"] .box-form-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-form-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-form-ui select.form-select:not(:disabled),
html[data-box-theme="dark"] .box-prep-ui input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-prep-ui textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-prep-ui select.form-select:not(:disabled),
html[data-box-theme="dark"] .box-rx-cab input.form-control:not([type="checkbox"]):not([type="radio"]):not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-rx-cab textarea.form-control:not([readonly]):not([read-only]):not(:disabled),
html[data-box-theme="dark"] .box-rx-cab select.form-select:not(:disabled) {
    background-color: #152238 !important;
    border-color: #3d5a80 !important;
    color: #e3ebf6;
}

html[data-box-theme="dark"] .box-form-ui .form-control[readonly],
html[data-box-theme="dark"] .box-form-ui .form-control:read-only,
html[data-box-theme="dark"] .box-form-ui textarea.form-control[readonly],
html[data-box-theme="dark"] .box-form-ui .form-control:disabled:not([type="checkbox"]):not([type="radio"]),
html[data-box-theme="dark"] .box-form-ui .form-select:disabled,
html[data-box-theme="dark"] .box-prep-ui .form-control[readonly],
html[data-box-theme="dark"] .box-prep-ui .form-control:read-only,
html[data-box-theme="dark"] .box-prep-ui textarea.form-control[readonly] {
    background-color: #1a2b4a !important;
    border-color: #2c3a4f !important;
    color: #95aac9 !important;
}
.box-prep-detalle-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Preparación detalle: ver :has(.box-detail-tab-body) en card-body y .box-detail-tab-body */
.box-prep-ui > .card.box-page-fill > .card-body.box-prep-page-body {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

.box-prep-ui .box-rx-grid-bar {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-items: flex-start;
    margin-top: 0.25rem;
}

.box-prep-ui .box-rx-grid-bar > .box-prep-section-nav {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.box-prep-ui .box-rx-grid-bar > .box-toolbar-actions {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 0.5rem;
}

/* Pestañas: scroll horizontal si no caben (p. ej. zoom 200%), sin ensanchar la página */
.box-prep-ui .box-section-nav--chips.box-prep-section-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.box-prep-ui .box-section-nav--chips.box-prep-section-nav .box-section-nav-item {
    flex: 0 0 auto;
}

/* Cuerpo de pestaña: ver .box-detail-tab-body junto a .box-grid-fill */

/* Pestaña Pedido: panel cabecera */
.box-prep-pedido-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.box-prep-pedido-panel .row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
}

.box-prep-ui .box-screen-header {
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
}

.box-prep-ui .box-screen-header__title {
    flex-wrap: wrap;
    max-width: 100%;
}

.box-prep-ui .box-screen-header__bar .box-screen-header__left,
.box-prep-ui .box-screen-header__bar .box-screen-header__right {
    flex-wrap: wrap;
    max-width: 100%;
}

.box-prep-pedido-panel .box-flag-group {
    height: auto;
}

.box-prep-pedido-panel .row.align-items-start > [class*="col-"] {
    margin-bottom: 0;
}

.box-prep-ui .box-medida-input {
    max-width: 100%;
}

.box-prep-ui .box-medida-input > .form-control,
.box-prep-ui .box-medida-input > .box-field-display {
    flex: 1 1 auto;
    min-width: 3.5rem;
    max-width: 100%;
}

.box-prep-ui .box-field-unidad {
    flex: 0 0 auto;
    white-space: nowrap;
}

.box-field-display--multiline:not(:empty) {
    min-height: 3.25rem;
}
.box-medida-input,
.box-prep-medida-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
}
.box-medida-input > .form-control,
.box-medida-input > .box-field-display,
.box-prep-medida-input > .form-control,
.box-prep-medida-input > .box-field-display {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}
.box-form-ui label.form-label + .box-medida-input,
.box-prep-ui label.form-label + .box-medida-input,
.box-form-ui label.form-label + .box-prep-medida-input,
.box-prep-ui label.form-label + .box-prep-medida-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.box-prep-obs {
    white-space: pre-wrap;
    max-height: 6rem;
    overflow: auto;
}
.box-prep-medida {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}
.box-field-unidad,
.box-prep-unidad {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    min-height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    max-height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    padding: 0 0.45rem;
    border: 1px solid #c9dcf7;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2c7be5;
    background: #e8f1fd;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
}

html[data-box-theme="dark"] .box-field-unidad,
html[data-box-theme="dark"] .box-prep-unidad {
    background: #1e3a5c;
    border-color: #2c3a4f;
    color: #8bb8f5;
}
.box-prep-res--error > td { background: rgba(220, 53, 69, 0.08); }
.box-prep-res-motivo {
    max-width: 32rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-prep-linea--rotura > td:not(.box-grid-col-actions) { background: rgba(220, 53, 69, 0.07); }
/* Código de colores de tareas de preparación */
.box-prep-tarea--pendiente { --box-prep-tarea: #6c757d; }
.box-prep-tarea--iniciada { --box-prep-tarea: #f6a623; }
.box-prep-tarea--reposicion { --box-prep-tarea: #0d6efd; }
.box-prep-tarea--leida { --box-prep-tarea: #198754; }
.box-prep-tarea--finalizada { --box-prep-tarea: #20c997; }
.box-prep-tarea--anulada { --box-prep-tarea: #fd7e14; }
.box-prep-tarea--rotura { --box-prep-tarea: #dc3545; }
.box-prep-tarea--condiciones { --box-prep-tarea: #6f42c1; }
.box-prep-tarea-row > td:first-child { box-shadow: inset 4px 0 0 var(--box-prep-tarea); }
.box-prep-tarea-row.box-prep-tarea--anulada > td:not(.box-grid-col-actions) { background: rgba(253, 126, 20, 0.08); }
.box-prep-tarea-row.box-prep-tarea--rotura > td:not(.box-grid-col-actions) { background: rgba(220, 53, 69, 0.08); }
.box-prep-tarea-row.box-prep-tarea--condiciones > td:not(.box-grid-col-actions) { background: rgba(111, 66, 193, 0.08); }
.box-prep-tarea-row.box-prep-tarea--leida > td:not(.box-grid-col-actions) { background: rgba(25, 135, 84, 0.06); }
.box-prep-tarea-row.box-prep-tarea--anulada > td:not(:nth-child(2)):not(.box-grid-col-actions) { text-decoration: line-through; opacity: 0.75; }
.box-prep-tarea-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--box-prep-tarea);
}
.box-prep-tarea-icon {
    color: var(--box-prep-tarea);
    font-size: 1rem;
}
.box-prep-tarea-estado,
.box-prep-leyenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.box-prep-leyenda-item {
    margin-right: 0.5rem;
}
.box-prep-tarea-row.box-prep-tarea--iniciada > td:not(.box-grid-col-actions) { background: rgba(246, 166, 35, 0.08); }
/* Ubicación de picking (fijo o dinámico) junto al nombre */
.box-prep-ubic {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.box-prep-icon--picking { color: #0d6efd; font-size: 0.9rem; }
/* Modal ver ubicaciones / contenedores: ubicación corta; SSCC y lote visibles */
.box-prep-ubicaciones-table {
    table-layout: fixed;
    width: 100%;
    min-width: 42rem;
}
.box-prep-ubicaciones-table th.box-grid-col-ubic,
.box-prep-ubicaciones-table td.box-grid-col-ubic {
    width: 7rem;
    min-width: 5rem;
    max-width: 8rem;
    overflow: hidden;
}
.box-prep-ubicaciones-table th.box-grid-col-sscc,
.box-prep-ubicaciones-table td.box-grid-col-sscc {
    width: 11rem;
    min-width: 9rem;
    overflow: hidden;
}
.box-prep-ubicaciones-table th.box-grid-col-lote,
.box-prep-ubicaciones-table td.box-grid-col-lote {
    width: 6.5rem;
    min-width: 5rem;
    overflow: hidden;
}
.box-prep-ubicaciones-table th.box-grid-col-pos,
.box-prep-ubicaciones-table td.box-grid-col-pos {
    width: 5rem;
    min-width: 4rem;
    overflow: hidden;
}
.box-prep-ubicaciones-table th.box-grid-num,
.box-prep-ubicaciones-table td.box-grid-num {
    width: 5.5rem;
    min-width: 4.5rem;
}
.box-prep-ubicaciones-table .box-grid-main-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-prep-ubicado {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}
/* Packing list: palets a la izquierda, tareas a la derecha (arrastrar tareas a un palet) */
.box-prep-packing {
    display: flex;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
}
.box-prep-packing-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 50%;
    min-width: 0;
    min-height: 0;
}
.box-prep-packing-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}
@media (max-width: 991.98px) {
    .box-prep-packing { flex-direction: column; }
}
.box-prep-packing tr[data-box-drag] { cursor: grab; }
.box-prep-packing tr.box-prep-drop > td { background: rgba(13, 110, 253, 0.16) !important; }
.box-prep-packing tr.box-prep-palet--sel > td:not(.box-grid-col-actions) { background: rgba(44, 123, 229, 0.10); }
.box-prep-palet-num {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.box-prep-palet-num > span {
    min-width: 1.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.box-prep-control-flags {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.35rem 1rem;
}

/* Recepción detalle: totales */
.box-rx-totales {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #e3ebf6;
    border-radius: 0.5rem;
    background: #fff;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}
.box-rx-tot .lbl {
    color: #95aac9;
    margin-right: 0.25rem;
    font-weight: 500;
}
html[data-box-theme="dark"] .box-rx-totales {
    border-color: #2c3a4f;
    background: #1b2433;
}

/* Recepción: estado de tarea (RF / BoxVoice) */
.box-rx-tarea-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.box-rx-tarea-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
}
.box-rx-tarea-pill > i {
    font-size: 0.85rem;
}
.box-rx-tarea--pendiente {
    background: #fff3cd;
    color: #856404;
    border-color: #ffe69c;
}
.box-rx-tarea--parcial {
    background: #ffe5d0;
    color: #9a3412;
    border-color: #fdba74;
}
.box-rx-tarea--finalizada {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}
.box-rx-tarea--rf {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.box-rx-tarea--anulada {
    background: #e5e7eb;
    color: #4b5563;
    border-color: #d1d5db;
    text-decoration: line-through;
}
.box-rx-tarea--error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}
.box-rx-tarea-row--ok td { background: rgba(16, 185, 129, 0.04); }
.box-rx-tarea-row--parcial td { background: rgba(249, 115, 22, 0.05); }
.box-rx-tarea-row--anulada td { background: rgba(107, 114, 128, 0.06); color: #6b7280; }
.box-rx-tarea-row--error td { background: rgba(239, 68, 68, 0.06); }
html[data-box-theme="dark"] .box-rx-tarea--pendiente {
    background: rgba(246, 195, 67, 0.18);
    color: #f6c343;
    border-color: rgba(246, 195, 67, 0.35);
}
html[data-box-theme="dark"] .box-rx-tarea--parcial {
    background: rgba(249, 115, 22, 0.18);
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.35);
}
html[data-box-theme="dark"] .box-rx-tarea--finalizada {
    background: rgba(0, 217, 126, 0.15);
    color: #34d399;
    border-color: rgba(0, 217, 126, 0.35);
}
html[data-box-theme="dark"] .box-rx-tarea--rf {
    background: rgba(57, 175, 209, 0.18);
    color: #7dd3fc;
    border-color: rgba(57, 175, 209, 0.35);
}
html[data-box-theme="dark"] .box-rx-tarea--anulada {
    background: rgba(149, 170, 201, 0.12);
    color: #95aac9;
    border-color: rgba(149, 170, 201, 0.25);
}
html[data-box-theme="dark"] .box-rx-tarea--error {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
}

/* Aviso de publicación / mantenimiento (deploy-status.json) */
.box-deploy-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(11, 26, 51, 0.72);
}
.box-deploy-card {
    width: min(28rem, 100%);
    padding: 1.5rem 1.35rem;
    border-radius: 0.5rem;
    background: #fff;
    border: 1px solid #d2ddec;
    box-shadow: 0 1rem 2rem rgba(33, 50, 91, 0.25);
    text-align: center;
}
.box-deploy-title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: #12263f;
}
.box-deploy-msg {
    margin: 0 0 1.15rem;
    color: #5c6f87;
    line-height: 1.45;
}
.box-deploy-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}
html[data-box-theme="dark"] .box-deploy-card {
    background: #132744;
    border-color: #2c446e;
}
html[data-box-theme="dark"] .box-deploy-title {
    color: #e9eef7;
}
html[data-box-theme="dark"] .box-deploy-msg {
    color: #b7c6de;
}

/* MultiSelect filtros (host Syncfusion / legacy panel) */
.box-multiselect,
.box-multiselect-host {
    position: relative;
    min-width: 11rem;
    max-width: 100%;
}
.box-multiselect-control {
    flex-wrap: nowrap;
}
.box-multiselect-control.disabled {
    opacity: 0.65;
    pointer-events: none;
}
.box-multiselect-toggle {
    display: flex;
    align-items: center;
    min-width: 0;
    height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    background: #fff;
    cursor: pointer;
}
.box-multiselect-toggle-text {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-multiselect-clear,
.box-multiselect-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--box-control-compact-height, calc(1.5em + 0.5rem + 2px));
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}
.box-multiselect-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: transparent;
}
.box-multiselect-panel {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    min-width: 100%;
    max-width: min(28rem, 92vw);
    overflow: hidden;
    background: #fff;
    border: 1px solid #d2ddec;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(33, 50, 91, 0.12);
}
.box-multiselect-panel-toolbar {
    flex-shrink: 0;
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid #edf2f9;
}
.box-multiselect-link {
    font-size: 0.8rem;
    text-decoration: none;
}
.box-multiselect-filter {
    min-width: 6rem;
}
.box-multiselect-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.25rem 0;
}
.box-multiselect-group {
    padding: 0.35rem 0.65rem 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #5c6f87;
    text-transform: uppercase;
}
.box-multiselect-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.28rem 0.65rem;
    cursor: pointer;
    user-select: none;
}
.box-multiselect-item:hover {
    background: #f5f8fc;
}
.box-multiselect-item-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}
html[data-box-theme="dark"] .box-multiselect-toggle {
    background: transparent;
}
html[data-box-theme="dark"] .box-multiselect-panel {
    background: #1b2a4e;
    border-color: #2c3a58;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.35);
}
html[data-box-theme="dark"] .box-multiselect-panel-toolbar {
    border-bottom-color: #2c3a58;
}
html[data-box-theme="dark"] .box-multiselect-item:hover {
    background: #243458;
}
html[data-box-theme="dark"] .box-multiselect-group {
    color: #95aac9;
}

/* Cierre modales: botón explícito (ModalCloseButton), alineado a la derecha del header */
.modal-header .modal-title {
    flex: 1 1 auto;
    min-width: 0;
    color: #e67e22;
    font-weight: 600;
}
.modal-header .box-modal-close {
    flex-shrink: 0;
}

/* Referencia copiable de pantalla / modal (ruta no visible en la barra del navegador) */
.box-screen-ref {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 9px;
    line-height: 1.25;
    color: #5c6f87;
    opacity: 0.55;
    user-select: all;
    -webkit-user-select: all;
    pointer-events: auto;
    padding: 0 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-screen-ref:hover {
    opacity: 0.95;
    overflow: visible;
    white-space: normal;
    word-break: break-all;
    z-index: 6;
}
html[data-box-theme="dark"] .box-screen-ref {
    color: #9aabbf;
}
/* Página: esquina del panel blanco (card), no del viewport */
.box-screen-ref--page {
    position: absolute;
    left: 0.35rem;
    bottom: 0.3rem;
    z-index: 4;
    max-width: min(42%, 22rem);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 0.12rem;
}
html[data-box-theme="dark"] .box-screen-ref--page {
    background: rgba(18, 38, 63, 0.88);
}
.modal-content {
    position: relative;
}
.box-screen-ref--modal {
    position: absolute;
    left: 0.45rem;
    bottom: 0.3rem;
    z-index: 5;
    max-width: calc(100% - 0.9rem);
    font-size: 10px;
}

/* Nº serie por contenedor: columnas compactas sin scroll horizontal */
.box-contenedor-series-modal .modal-dialog {
    max-width: min(52rem, 96vw);
}
.box-contenedor-series-table {
    table-layout: fixed;
    width: 100%;
    font-size: 0.8125rem;
}
.box-contenedor-series-table th,
.box-contenedor-series-table td {
    padding: 0.2rem 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.box-contenedor-series-table .box-col-serie {
    width: 7.25rem;
    max-width: 7.25rem;
}
.box-contenedor-series-table th:nth-child(2),
.box-contenedor-series-table td:nth-child(2),
.box-contenedor-series-table th:nth-child(4),
.box-contenedor-series-table td:nth-child(4) {
    width: 6.5rem;
}
.box-contenedor-series-table th:nth-child(3),
.box-contenedor-series-table td:nth-child(3),
.box-contenedor-series-table th:nth-child(5),
.box-contenedor-series-table td:nth-child(5) {
    width: 5.5rem;
}
.box-contenedor-series-table .box-grid-col-actions {
    width: 4.75rem;
}

/* Visor PDF (BoxPdfViewer): PDF.js + barra propia (guardar, imprimir, girar 90°) */
.box-pdf-viewer-rotator {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    border: 1px solid #ddd;
    background: #525659;
}
.box-pdf-js-shell {
    background: #525659;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.box-pdf-js-pages {
    width: 100%;
    min-height: 0;
}
.box-pdf-js-scroll-host {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    overflow-anchor: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: safe center;
    justify-content: flex-start;
}
.box-pdf-js-rotator {
    display: block;
    box-sizing: border-box;
    width: max-content;
    max-width: none;
    margin: 0;
    padding: 0.5rem 0.75rem 1rem;
    transform-origin: top center;
    flex-shrink: 0;
}
.box-pdf-js-rotator .box-pdf-js-page-wrap + .box-pdf-js-page-wrap {
    margin-top: 0.75rem;
}
.box-pdf-js-page-wrap {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.box-pdf-js-page {
    display: block;
    max-width: 100%;
    height: auto;
}
.box-pdf-viewer-iframe {
    width: 100%;
    border: 0;
    background: #fff;
}
.box-pdf-native-shell {
    background: #525659;
}
.box-pdf-native-transform {
    width: 100%;
    min-height: 100%;
}
.box-pdf-native-shell .box-pdf-viewer-iframe {
    display: block;
    width: 100%;
    min-height: calc(100vh - 12rem);
    background: #fff;
}

/* Archivo digital: panel en el área de contenido (menú lateral visible) */
.box-archivo-digital-modal.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    z-index: 1025;
    background: rgba(18, 38, 63, 0.35);
    overflow: hidden;
}
@media (min-width: 768px) {
    #sidebar.navbar-vertical-sm ~ .main-content .box-archivo-digital-modal {
        left: 66px;
    }
    #sidebar.navbar-vertical:not(.navbar-vertical-sm) ~ .main-content .box-archivo-digital-modal {
        left: 250px;
    }
}
@media (max-width: 767.98px) {
    .box-archivo-digital-modal.modal {
        left: 0;
        z-index: 1045;
    }
}
.box-archivo-digital-modal .modal-dialog.box-archivo-digital-dialog {
    margin: 0;
    max-width: none;
    width: 100%;
    height: 100%;
}
.box-mail-dialog-modal.modal {
    position: fixed;
    inset: 0;
    z-index: 1120;
}
.box-archivo-digital-modal .modal-content.box-archivo-digital {
    display: flex;
    flex-direction: column;
    background: #d6e5f3;
    border: 0;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}
.box-archivo-digital-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid #b8cfe4;
}
.box-archivo-digital-meta-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 0 1 auto;
}
.box-archivo-digital-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
}
.box-archivo-btn {
    min-width: 2.25rem;
}
.box-archivo-zoom-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    min-width: 2.5rem;
}
.box-archivo-zoom-btn .box-archivo-zoom-icon {
    font-size: 0.85rem;
    opacity: 0.85;
}
.box-archivo-digital-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0.35rem 0.75rem 0.25rem;
    min-height: 0;
    overflow: hidden;
}
.box-archivo-digital-body .box-archivo-pdf-viewer {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.box-archivo-digital-body .box-archivo-pdf-viewer .box-pdf-viewer-rotator {
    flex: 1 1 auto;
    min-height: 0;
    height: 100% !important;
    overflow: hidden;
    border-color: #9eb8cc;
}
.box-archivo-digital-body .box-archivo-pdf-viewer .box-pdf-js-shell {
    background: #525659;
    height: 100%;
    min-height: 0;
}
.box-archivo-digital-body .box-archivo-pdf-viewer .box-pdf-js-scroll-host {
    height: 100%;
}
.box-archivo-digital-body .box-archivo-pdf-viewer .box-pdf-js-page {
    max-width: none;
    width: auto;
    height: auto;
}
.box-archivo-digital-footer {
    flex-shrink: 0;
    padding: 0 0.75rem 0.35rem;
}
.box-archivo-digital-footer--oculto {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.box-archivo-digital-footer:not(.box-archivo-digital-footer--oculto):not(:has(.alert)) {
    display: none;
    padding: 0;
}

/* Modales Bootstrap (show d-block): centrados en viewport, capa sobre menú lateral */
.modal.fade.show.d-block:not(.box-archivo-digital-modal) {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}
.modal.fade.show.d-block:not(.box-archivo-digital-modal) > .modal-dialog {
    margin: auto;
    flex: 0 0 auto;
    width: 100%;
    max-height: min(100dvh, 100vh);
}
@media (max-width: 767.98px) {
    .modal.fade.show.d-block:not(.box-archivo-digital-modal) {
        z-index: 1045;
    }
}
.box-pdf-viewer-modal.modal,
.box-overlay-modal.modal {
    background: rgba(18, 38, 63, 0.35);
}
.box-mail-dialog-modal.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}
.box-pdf-viewer-modal-dialog {
    max-width: min(1140px, calc(100% - 1.5rem));
}
.box-pdf-viewer-modal-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.box-pdf-viewer-modal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}
.box-pdf-viewer-modal-actions {
    margin-left: auto;
}
.box-pdf-viewer-modal-embed.box-pdf-viewer {
    min-height: 70vh;
}

.box-fotos-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #f4f7fb;
    border: 0;
    overflow: hidden;
    position: relative;
}
.box-fotos-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.65rem 0.9rem;
    background: #fff;
    border-bottom: 1px solid #d5deea;
}
.box-fotos-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
}
.box-fotos-vacio {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
}
.box-fotos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}
.box-fotos-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #d5deea;
    border-radius: 0.4rem;
}
.box-fotos-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 10rem;
    padding: 0;
    border: 0;
    border-radius: 0.25rem;
    background: #eef2f6;
    overflow: hidden;
}
.box-fotos-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.box-fotos-thumb--vacio {
    padding: 0.75rem;
    color: #6c757d;
    font-size: 0.85rem;
    text-align: center;
}
.box-fotos-ampliada {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(15, 23, 36, 0.92);
}
.box-fotos-ampliada-bar {
    flex-shrink: 0;
    justify-content: flex-end;
}
.box-fotos-ampliada img {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    object-fit: contain;
}
.box-fotos-ampliada-texto {
    flex-shrink: 0;
    color: #fff;
    text-align: center;
}
html[data-box-theme="dark"] .box-fotos-panel {
    background: #0f1724;
}
html[data-box-theme="dark"] .box-fotos-top,
html[data-box-theme="dark"] .box-fotos-card {
    background: #1a2332;
    border-color: rgba(255, 255, 255, 0.12);
}
html[data-box-theme="dark"] .box-fotos-thumb {
    background: #121a27;
}

/* Tipo de usuario: franja y fondo por IDTipoUsuario. */
.box-grid-table tbody tr.box-tipo-1 > td { background-color: #e7f1ff; }
.box-grid-table tbody tr.box-tipo-2 > td { background-color: #fff4e0; }
.box-grid-table tbody tr.box-tipo-3 > td { background-color: #e7f7ee; }
.box-grid-table tbody tr.box-tipo-4 > td { background-color: #f3e8ff; }
.box-grid-table tbody tr.box-tipo-5 > td { background-color: #ffe8e8; }
.box-grid-table tbody tr.box-tipo-6 > td { background-color: #e6f7f7; }
.box-grid-table tbody tr.box-tipo-0 > td { background-color: #eef1f6; }
.box-grid-table tbody tr.box-tipo-1 > td:first-child { box-shadow: inset 4px 0 0 #2c7be5; }
.box-grid-table tbody tr.box-tipo-2 > td:first-child { box-shadow: inset 4px 0 0 #f6c343; }
.box-grid-table tbody tr.box-tipo-3 > td:first-child { box-shadow: inset 4px 0 0 #00d97e; }
.box-grid-table tbody tr.box-tipo-4 > td:first-child { box-shadow: inset 4px 0 0 #6f42c1; }
.box-grid-table tbody tr.box-tipo-5 > td:first-child { box-shadow: inset 4px 0 0 #e63757; }
.box-grid-table tbody tr.box-tipo-6 > td:first-child { box-shadow: inset 4px 0 0 #39afd1; }
.box-grid-table tbody tr.box-tipo-0 > td:first-child { box-shadow: inset 4px 0 0 #95aac9; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-1 > td { background-color: #1a2c4a; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-2 > td { background-color: #3a3018; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-3 > td { background-color: #163528; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-4 > td { background-color: #2c2140; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-5 > td { background-color: #3d1c24; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-6 > td { background-color: #16343c; }
html[data-box-theme="dark"] .box-grid-table tbody tr.box-tipo-0 > td { background-color: #1c2838; }



/* Cartas de porte: anchos fijos (min=max) para que Agencia no se coma a Conductor. */
.box-grid-table th.box-grid-col-cp-ruta,
.box-grid-table td.box-grid-col-cp-ruta,
.box-grid-table th.box-grid-col-cp-agencia,
.box-grid-table td.box-grid-col-cp-agencia,
.box-grid-table th.box-grid-col-cp-conductor,
.box-grid-table td.box-grid-col-cp-conductor,
.box-grid-table th.box-grid-col-cp-matricula,
.box-grid-table td.box-grid-col-cp-matricula {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-grid-table th.box-grid-col-cp-ruta,
.box-grid-table td.box-grid-col-cp-ruta {
    width: 10rem;
    min-width: 10rem;
    max-width: 10rem;
}
.box-grid-table th.box-grid-col-cp-agencia,
.box-grid-table td.box-grid-col-cp-agencia {
    width: 11.5rem;
    min-width: 11.5rem;
    max-width: 11.5rem;
}
.box-grid-table th.box-grid-col-cp-conductor,
.box-grid-table td.box-grid-col-cp-conductor {
    width: 12rem;
    min-width: 12rem;
    max-width: 12rem;
}
.box-grid-table th.box-grid-col-cp-matricula,
.box-grid-table td.box-grid-col-cp-matricula {
    width: 7.5rem;
    min-width: 7.5rem;
    max-width: 7.5rem;
}
.card.box-page-fill > .box-screen-header--title-only + .card-body.box-page-fill-body {
    padding-top: 0.35rem;
}
.box-grid-table th.box-grid-col-cp-firma,
.box-grid-table td.box-grid-col-cp-firma {
    width: 8.5rem;
    min-width: 8.5rem;
    max-width: 8.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-grid-table th.box-grid-col-cp-numero,
.box-grid-table td.box-grid-col-cp-numero {
    min-width: 6.75rem;
    width: 7.25rem;
    white-space: nowrap;
}
.box-grid-table th.box-grid-col-cp-cliente,
.box-grid-table td.box-grid-col-cp-cliente {
    width: 12rem;
    min-width: 12rem;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.box-cp-est {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 2.1rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.12rem 0.35rem;
    border-radius: 0.25rem;
    line-height: 1.2;
    color: #fff;
}
.box-cp-est--ruta { background: #0277BD; }
.box-cp-est--total, .box-cp-est--conf-tot, .box-cp-est--esc-tot { background: #2E7D32; }
.box-cp-est--parcial, .box-cp-est--conf-par, .box-cp-est--esc-par { background: #EF6C00; }
.box-cp-est--canc, .box-cp-est--anul, .box-cp-est--rech { background: #C62828; }
.box-cp-est--prep { background: #6A1B9A; }
.box-cp-est--firmar { background: #AD1457; }
.box-cp-est--esc, .box-cp-est--conf { background: #1565C0; }
.box-cp-est--otro { background: #78909C; }
.box-cp-est-text-danger { color: #C62828 !important; font-weight: 600; }
.box-cp-totales {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    align-items: center;
    font-size: 0.8125rem;
    color: #5c6f87;
}
.box-cp-totales strong { color: #12263f; font-weight: 600; }
.box-cp-totales--pills .box-cp-pill {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.28rem 0.55rem;
    border-radius: 0.35rem;
    line-height: 1.25;
    color: #39506b;
    background: #e8f1fd;
    border: 1px solid #c5d7f0;
}
.box-cp-totales--pills .box-cp-pill strong {
    color: #12263f;
    font-weight: 700;
    margin-left: 0.2rem;
}


/* Agencias (distribucion/agencias): paneles diferenciados + fila seleccionada */
.box-agencias-page .box-ag-panel {
    border: 1px solid #d2ddec;
    border-radius: 0.375rem;
    padding: 0.5rem 0.6rem;
    min-height: 0;
    overflow: hidden;
}
.box-agencias-page .box-ag-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
    width: 100%;
    min-width: 0;
}
.box-agencias-page .box-ag-panel-head > .box-btn-toolbar {
    margin-inline-start: auto;
}
.box-agencias-page .box-ag-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #12263f;
}
.box-agencias-page .box-ag-panel-title .fe {
    font-size: 0.95rem;
}
.box-agencias-page .box-ag-panel--agencias {
    background: #f4f7fb;
    border-color: #b8c5d6;
    border-left: 4px solid #2c7be5;
}
.box-agencias-page .box-ag-panel--conductores {
    background: #f3f8ff;
    border-color: #c5d9f5;
    border-left: 4px solid #0277BD;
    flex: 1.15 1 0;
    min-height: 9rem;
}
.box-agencias-page .box-ag-panel--vehiculos {
    background: #f3faf5;
    border-color: #c8e6c9;
    border-left: 4px solid #2E7D32;
    flex: 1.05 1 0;
    min-height: 9rem;
}
.box-agencias-page .box-ag-panel--remolques {
    background: #fff8f0;
    border-color: #ffe0b2;
    border-left: 4px solid #e67e22;
    flex: 0.95 1 0;
    min-height: 8rem;
}
.box-agencias-page .box-ag-hijos {
    overflow: hidden;
}
.box-agencias-page .box-grid-table tbody tr.box-row-selected > td {
    background-color: #9ec5f0 !important;
    color: #0b1f33;
    box-shadow: inset 0 0 0 1px #5b9bd5;
}
.box-agencias-page .box-grid-table tbody tr.box-row-selected:hover > td {
    background-color: #8bb8e8 !important;
}
html[data-box-theme="dark"] .box-agencias-page .box-ag-panel--agencias { background: #1a2332; border-color: #2c3a4f; }
html[data-box-theme="dark"] .box-agencias-page .box-ag-panel--conductores { background: #152033; border-color: #243660; }
html[data-box-theme="dark"] .box-agencias-page .box-ag-panel--vehiculos { background: #15261c; border-color: #1e3a28; }
html[data-box-theme="dark"] .box-agencias-page .box-ag-panel--remolques { background: #2a2118; border-color: #3d2e1c; }
html[data-box-theme="dark"] .box-agencias-page .box-grid-table tbody tr.box-row-selected > td {
    background-color: #2c4470 !important;
    color: #e3ebf6;
    box-shadow: inset 0 0 0 1px #4a6fa5;
}

/* Rutas (distribucion/rutas): paneles diferenciados */
.box-rutas-page .box-ru-panel {
    border: 1px solid #d2ddec;
    border-radius: 0.375rem;
    padding: 0.5rem 0.6rem;
    min-height: 0;
    overflow: hidden;
}
.box-rutas-page .box-ru-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
    width: 100%;
    min-width: 0;
}
.box-rutas-page .box-ru-panel-head > .box-btn-toolbar {
    margin-inline-start: auto;
}
.box-rutas-page .box-ru-panel-title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: #12263f;
}
.box-rutas-page .box-ru-panel-title .fe {
    font-size: 0.95rem;
}
.box-rutas-page .box-ru-panel--rutas {
    background: #f4f7fb;
    border-color: #b8c5d6;
    border-left: 4px solid #2c7be5;
}
.box-rutas-page .box-ru-panel--cp {
    background: #f3f8ff;
    border-color: #c5d9f5;
    border-left: 4px solid #0277BD;
    flex: 1.1 1 0;
    min-height: 8rem;
}
.box-rutas-page .box-ru-panel--vecinas {
    background: #f3faf5;
    border-color: #c8e6c9;
    border-left: 4px solid #2E7D32;
    flex: 1 1 0;
    min-height: 7rem;
}
.box-rutas-page .box-ru-panel--conductores {
    background: #fff8f0;
    border-color: #ffe0b2;
    border-left: 4px solid #e67e22;
    flex: 1 1 0;
    min-height: 7rem;
}
.box-rutas-page .box-ru-panel--tdi {
    background: #faf5ff;
    border-color: #e0d4f5;
    border-left: 4px solid #7b1fa2;
    flex: 0.9 1 0;
    min-height: 7rem;
}
.box-rutas-page .box-ru-hijos {
    overflow: auto;
}
.box-rutas-page .box-ru-prioridad {
    background: #fff !important;
    max-width: 4.5rem;
    margin-left: auto;
}
.box-rutas-page .box-grid-table tbody tr.box-row-selected > td {
    background-color: #9ec5f0 !important;
    color: #0b1f33;
    box-shadow: inset 0 0 0 1px #5b9bd5;
}
.box-rutas-page .box-grid-table tbody tr.box-row-selected:hover > td {
    background-color: #8bb8e8 !important;
}
html[data-box-theme="dark"] .box-rutas-page .box-ru-panel--rutas { background: #1a2332; border-color: #2c3a4f; }
html[data-box-theme="dark"] .box-rutas-page .box-ru-panel--cp { background: #152033; border-color: #243660; }
html[data-box-theme="dark"] .box-rutas-page .box-ru-panel--vecinas { background: #15261c; border-color: #1e3a28; }
html[data-box-theme="dark"] .box-rutas-page .box-ru-panel--conductores { background: #2a2118; border-color: #3d2e1c; }
html[data-box-theme="dark"] .box-rutas-page .box-ru-panel--tdi { background: #241a2e; border-color: #3a2a4a; }
html[data-box-theme="dark"] .box-rutas-page .box-ru-prioridad { background: #1a2332 !important; }
html[data-box-theme="dark"] .box-rutas-page .box-grid-table tbody tr.box-row-selected > td {
    background-color: #2c4470 !important;
    color: #e3ebf6;
    box-shadow: inset 0 0 0 1px #4a6fa5;
}
