* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #eef3f8;
    color: #182230
}

.topbar {
    height: 70px;
    background: #0b57d0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: 0 8px 22px rgba(18, 38, 63, .15)
}

.topbar strong {
    display: block;
    font-size: 18px
}

.topbar span {
    font-size: 12px;
    opacity: .85
}

.topbar nav {
    display: flex;
    gap: 12px
}

.topbar a {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, .15);
    padding: 10px 14px;
    border-radius: 12px
}

.container {
    padding: 26px;
    max-width: 1400px;
    margin: auto
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fff, #e6f0ff);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 22px;
    border: 1px solid #dbe7f5
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #0b57d0;
    font-weight: 800;
    font-size: 12px;
    margin: 0 0 8px
}

.hero h1,
.package-info h1 {
    font-size: 34px;
    margin: 0 0 8px
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    background: #e8edf5;
    color: #182230;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    display: inline-block
}

.btn.primary {
    background: #0b57d0;
    color: #fff
}

.btn.warning {
    background: #ffb020;
    color: #1f2937
}

.btn.full {
    width: 100%;
    margin-top: 12px
}

.cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 22px
}

.card,
.panel,
.scan-card,
.package-info,
.product-scan,
.pos-side {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #dde7f2;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06)
}

.panel{
    margin: 20px 0;
}
.card span {
    font-size: 13px;
    color: #607086
}

.card strong {
    display: block;
    font-size: 28px;
    margin-top: 10px
}

.card.warning {
    background: #fff8e8
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

table {
    width: 100%;
    border-collapse: collapse
}

th,
td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid #edf2f7
}

th {
    font-size: 12px;
    text-transform: uppercase;
    color: #607086
}

.badge {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800
}

.badge.pendiente {
    background: #edf2f7
}

.badge.validando {
    background: #dbeafe;
    color: #1d4ed8
}

.badge.completo {
    background: #dcfce7;
    color: #166534
}

.badge.parcial {
    background: #fef3c7;
    color: #92400e
}

.mini-progress,
.progress {
    height: 10px;
    background: #e5eaf1;
    border-radius: 999px;
    overflow: hidden
}

.mini-progress span,
.progress span {
    height: 100%;
    display: block;
    background: #0b57d0;
    border-radius: 999px
}

.narrow {
    max-width: 720px;
    margin: auto
}

.upload-box {
    border: 2px dashed #b8c7dc;
    border-radius: 20px;
    padding: 30px;
    background: #f8fbff;
    display: grid;
    gap: 16px
}

.alert {
    padding: 14px;
    border-radius: 14px;
    margin: 14px 0;
    font-weight: 700
}

.alert.ok {
    background: #dcfce7;
    color: #166534
}

.alert.error {
    background: #fee2e2;
    color: #991b1b
}

.scanner-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px
}

.pos-main {
    display: grid;
    gap: 16px
}

.scan-card label,
.product-scan label {
    display: block;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 10px
}

.scan-input {
    width: 100%;
    font-size: 24px;
    padding: 20px;
    border: 2px solid #c8d6e6;
    border-radius: 18px;
    outline: none
}

.scan-input:focus {
    border-color: #0b57d0;
    box-shadow: 0 0 0 4px rgba(11, 87, 208, .12)
}

.package-info.empty {
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #64748b
}

.package-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.package-meta span {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 10px 12px
}

.products-list {
    display: grid;
    gap: 10px
}

.product-row {
    display: grid;
    grid-template-columns: 46px 1fr auto;
    gap: 12px;
    align-items: center;
    background: #fff;
    border: 1px solid #e3ebf5;
    border-radius: 18px;
    padding: 16px;
    transition: .2s
}

.product-row .check {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900
}

.product-row span {
    display: block;
    color: #607086;
    margin-top: 4px
}

.product-row small {
    font-weight: 800;
    color: #64748b
}

.product-row.done {
    background: #eafff1;
    border-color: #86efac
}

.product-row.done .check {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e
}

.progress-card span {
    display: block;
    color: #607086;
    font-weight: 800
}

.progress-card strong {
    font-size: 54px
}

.progress {
    height: 18px;
    margin-top: 12px
}

.message {
    margin-top: 18px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: 16px;
    font-weight: 800
}

.message.ok {
    background: #dcfce7;
    color: #166534
}

.message.error {
    background: #fee2e2;
    color: #991b1b
}

.message.warn {
    background: #fef3c7;
    color: #92400e
}

@media(max-width:1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr)
    }

    .scanner-layout {
        grid-template-columns: 1fr
    }

    .topbar {
        height: auto;
        gap: 12px;
        align-items: flex-start;
        flex-direction: column;
        padding: 18px
    }

    .topbar nav {
        flex-wrap: wrap
    }

    .container {
        padding: 16px
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px
    }

    .scan-input {
        font-size: 18px
    }

    .product-row {
        grid-template-columns: 42px 1fr
    }

    .product-row small {
        grid-column: 2
    }
}

select,
input {
    /*width: 100%;*/
    padding: 13px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    font-size: 15px;
    background: #fff
}

.hidden {
    display: none
}

.small {
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 12px
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 15px 0
}

.travel-grid {
    display: grid;
    gap: 12px
}

.travel-card {
    position: relative;
    display: grid;
    gap: 8px;
    text-decoration: none;
    color: #182230;
    background: #f8fbff;
    border: 1px solid #dbe7f5;
    border-radius: 18px;
    padding: 17px 255px 17px 18px;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease
}

.travel-card-main {
    display: grid;
    justify-items: start;
    gap: 8px;
    min-width: 0
}

.travel-status-row {
    display: inline-flex;
    align-items: center;
    gap: 7px
}

.star {
    display: inline-block;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
    animation: pulso-validando 1.6s ease-in-out infinite
}

@keyframes pulso-validando {
    0%, 100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: .38;
        transform: scale(.82)
    }
}

@media (prefers-reduced-motion: reduce) {
    .star {
        animation: none
    }
}

.recepcion-pt-estado {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 215px;
    padding: 10px 13px;
    border-radius: 12px;
    text-align: right
}

.recepcion-pt-estado > span {
    display: grid;
    gap: 3px
}

.recepcion-pt-texto {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25
}

.recepcion-pt-estado small {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em
}

.recepcion-pt-estado.pendiente {
    color: #536579;
    background: #f1f5f9;
    border: 1px solid #dce5ee
}

.recepcion-pt-estado.completa {
    color: #197044;
    background: #edf9f1;
    border: 1px solid #b9e4c8
}

.recepcion-pt-icono {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    background: #1f9d55;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(31, 157, 85, .18)
}

@media (max-width: 700px) {
    .travel-card {
        padding: 17px 18px
    }

    .recepcion-pt-estado {
        position: static;
        transform: none;
        justify-content: flex-start;
        min-width: 0;
        width: fit-content;
        max-width: 100%;
        margin-top: 4px;
        text-align: left
    }
}

.travel-card:hover {
    border-color: #0b57d0;
    box-shadow: 0 10px 22px rgba(11, 87, 208, .12);
    transform: translateY(-1px)
}

.active-trip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px
}

.active-trip h2 {
    margin: 0;
    font-size: 24px
}

.pill {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 12px
}

.pill.caja {
    background: #dbeafe;
    color: #1d4ed8
}

.pill.amarre {
    background: #fef3c7;
    color: #92400e
}

.badge.cerrado {
    background: #e5e7eb;
    color: #374151
}

@media(max-width:720px) {
    .cards {
        grid-template-columns: 1fr
    }

    .active-trip {
        align-items: flex-start;
        flex-direction: column
    }

    .hero h1,
    .package-info h1 {
        font-size: 26px
    }
}

.product-row.partial {
    background: #fff8db;
    border-color: #f3d777;
}

.product-row.partial .check {
    background: #f3c233;
    color: #3b3000;
    font-size: .75rem;
    font-weight: 900;
}

.product-row.done .check {
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    margin: 12px 0 16px;
    padding: 15px 18px;
    border: 2px solid #d6e0ec;
    border-radius: 16px;
    font-size: 16px;
    outline: none;
    background: #f8fbff
}

.search-input:focus {
    border-color: #0b57d0;
    box-shadow: 0 0 0 4px rgba(11, 87, 208, .10)
}

.btn.small {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px
}

.pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef2ff;
    font-weight: 800;
    font-size: 12px
}

.pill.amarre {
    background: #fff7ed
}

.pill.caja {
    background: #ecfeff
}

.scan-error-alert::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(220, 38, 38, .88);
    z-index: 9998;
    pointer-events: none;
    animation: alertaRoja 2s ease forwards
}

.scan-error-alert::after {
    content: attr(data-alerta);
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    color: #fff;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: .08em;
    text-align: center;
    text-shadow: 0 3px 18px rgba(0, 0, 0, .35);
    pointer-events: none;
    animation: alertaTexto 2s ease forwards
}

@keyframes alertaRoja {

    0%,
    70% {
        opacity: 1
    }

    100% {
        opacity: 0
    }
}

@keyframes alertaTexto {

    0%,
    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1)
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.96)
    }
}

@media(max-width:720px) {
    .scan-error-alert::after {
        font-size: 28px;
        width: 90%
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 18px
}

.modal-overlay.show {
    display: flex
}

.modal-card {
    position: relative;
    width: min(720px, 96vw);
    max-height: 86vh;
    overflow: auto;
    background: #fff;
    border-radius: 24px;
    padding: 26px;
    box-shadow: 0 26px 80px rgba(2, 6, 23, .35)
}

.modal-close {
    position: absolute;
    right: 18px;
    top: 14px;
    border: 0;
    background: #eef2f7;
    color: #182230;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer
}

.faltantes-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 18px
}

.faltantes-meta span {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px
}

.faltantes-list {
    display: grid;
    gap: 10px
}

.faltante-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #e2e8f0;
    background: #f8fbff;
    border-radius: 16px;
    padding: 14px
}

.faltante-item strong {
    display: block;
    font-size: 16px
}

.faltante-item span {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-top: 3px
}

.faltante-cantidad {
    font-weight: 900;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 14px;
    padding: 10px 12px;
    text-align: center;
    min-width: 95px
}

.faltante-cantidad small {
    display: block;
    color: #64748b;
    margin-top: 2px
}

.loading-box {
    padding: 18px;
    border-radius: 14px;
    background: #f1f5f9;
    font-weight: 800
}

.btn-eye {
    white-space: nowrap
}

@media(max-width:720px) {
    .faltante-item {
        align-items: flex-start;
        flex-direction: column
    }

    .faltante-cantidad {
        text-align: left;
        width: 100%
    }
}

.product-row {
    grid-template-columns: 42px 116px 1fr auto
}

.product-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #dbe7f5;
    background: #f8fafc
}

.product-row strong em {
    font-style: normal;
    color: #334155;
    font-weight: 700
}

.product-row.done .product-thumb {
    border-color: #86efac
}

@media(max-width:720px) {
    .product-row {
        grid-template-columns: 42px 64px 1fr
    }

    .product-row small {
        grid-column: 3
    }

    .product-thumb {
        width: 64px;
        height: 64px
    }
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px
}

.catalog-card {
    background: #f8fbff;
    border: 1px solid #dbe7f5;
    border-radius: 18px;
    padding: 14px;
    display: grid;
    gap: 10px
}

.catalog-card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 14px;
    background: #eef2f7
}

.catalog-card small {
    color: #64748b
}

.inline-form {
    display: grid;
    gap: 8px
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px
}

@media(max-width:900px) {
    .form-grid {
        grid-template-columns: 1fr
    }
}

.faltante-img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #dbe7f5;
    background: #f8fafc;
    flex: 0 0 auto
}

.faltante-item {
    justify-content: flex-start
}

.faltante-item>div:nth-child(2) {
    flex: 1
}

/* === Administración / operación === */
.topbar nav .admin-link {
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    padding: .45rem .8rem
}

.hero-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end
}

.admin-hero {
    background: linear-gradient(135deg, #111827, #1f2937)
}
.admin-hero h1{
    color: #fff;
}
.admin-hero p{
    color: #fff;
}

.operator-hero {
    background: linear-gradient(135deg, #0f172a, #334155)
}
.operator-hero p {
    color: #fff;
}
.operator-hero h1 {
    color: #fff;
}

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem
}

.client-card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 1.15rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
    overflow: hidden
}

.client-card h3 {
    margin: .2rem 0 .8rem;
    font-size: 1.25rem
}

.client-count {
    position: absolute;
    top: .9rem;
    right: .9rem;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #111827;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.15rem
}

.operator-card .client-count {
    background: #2563eb
}

.client-stats {
    display: grid;
    gap: .4rem;
    margin: .6rem 0
}

.client-stats span {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 10px;
    padding: .45rem .6rem;
    color: #475569
}

.client-stats strong {
    color: #111827
}

.empty-state {
    padding: 1.5rem;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b
}

.login-shell {
    min-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center
}

.login-card {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 2rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, .12)
}

.form-grid.one {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem
}

.form-grid label {
    display: grid;
    gap: .35rem;
    font-weight: 700;
    color: #334155
}

.form-grid input {
    width: 100%;
    padding: .9rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem
}

.small-note {
    font-size: .9rem;
    margin-top: 1rem
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: .8rem;
    margin: .9rem 0
}

.muted {
    color: #64748b
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 800;
    font-size: .78rem;
    color: #f97316!important;
}

@media(max-width:720px) {
    .hero-actions {
        justify-content: flex-start
    }

    .client-count {
        position: static;
        margin-bottom: .8rem
    }

    .topbar nav {
        gap: .35rem
    }

    .topbar nav a {
        font-size: .82rem
    }
}

/* Recepción de almacén */
.inline-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap
}

.inline-form select {
    min-width: 320px;
    padding: 14px 16px;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #fff;
    font-size: 15px
}

.recepcion-layout {
    grid-template-columns: 380px 1fr
}

.recepcion-list {
    display: grid;
    gap: 10px;
    max-height: 560px;
    overflow: auto;
    padding-right: 4px
}

.recepcion-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 14px;
    border: 1px solid #e6edf4;
    border-radius: 16px;
    background: #fff
}

.recepcion-item.ok {
    background: #edfdf4;
    border-color: #b7f0cc
}

.recepcion-item strong {
    display: block;
    font-size: 16px;
    color: #172033
}

.recepcion-item span {
    display: block;
    color: #667085;
    font-size: 13px;
    margin-top: 3px
}

.recepcion-numeros {
    text-align: right
}

.recepcion-numeros b {
    display: block;
    font-size: 18px
}

.recepcion-numeros small {
    color: #667085
}

.recepcion-item .mini-progress {
    grid-column: 1/-1
}

.scan-message.ok {
    background: #e9f9ef;
    color: #137333;
    border-color: #b7f0cc
}

.scan-message.error {
    background: #ffe9e9;
    color: #b42318;
    border-color: #ffb4b4
}

.scan-ok-flash::before,
.scan-error-flash::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    animation: flashScreen 1.5s ease forwards
}

.scan-ok-flash::before {
    background: rgba(34, 197, 94, .20)
}

.scan-error-flash::before {
    background: rgba(239, 68, 68, .45)
}

@keyframes flashScreen {
    0% {
        opacity: 1
    }

    100% {
        opacity: 0
    }
}

.badge.listo {
    background: #d1fadf;
    color: #05603a
}

.badge.parcial {
    background: #fef0c7;
    color: #92400e
}

.badge.pendiente {
    background: #eef2f7;
    color: #344054
}

.surtido-celda {
    min-width: 155px
}

@media(max-width:900px) {
    .recepcion-layout {
        grid-template-columns: 1fr
    }

    .inline-form select {
        min-width: 100%;
        width: 100%
    }
}

/* Surtido de almacén por piezas */
.surtido-box {
    display: grid;
    gap: 6px;
    min-width: 175px
}

.surtido-box small {
    font-size: 12px;
    color: #667085;
    font-weight: 700
}

.surtido-progress {
    width: 100%;
    height: 7px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden
}

.surtido-progress span {
    display: block;
    height: 100%;
    background: #12b76a;
    border-radius: 999px
}

.badge.parcial+.surtido-progress span {
    background: #f79009
}

.badge.pendiente+.surtido-progress span {
    background: #98a2b3
}

/* Alerta roja fija: se cierra únicamente al tocar/clic en la pantalla */
.scan-error-alert {
    cursor: pointer
}

.scan-error-alert::before {
    animation: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    background: rgba(220, 38, 38, .92) !important
}

.scan-error-alert::after {
    animation: none !important;
    opacity: 1 !important;
    pointer-events: none !important;
    max-width: 92vw;
    line-height: 1.15
}

/* Disponibilidad de almacén al abrir una caja por RFID */
.product-row.available {
    background: #ecfdf5;
    border-color: #86efac;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, .08)
}

.product-row.available .check {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e
}

.product-row.available-partial {
    background: #fff7ed;
    border-color: #fdba74;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, .08)
}

.product-row.available-partial .check {
    background: #f97316;
    color: #fff;
    border-color: #f97316;
    font-size: .78rem
}

.product-row.not-received {
    background: #fff1f2;
    border-color: #fca5a5;
    opacity: .92
}

.product-row.not-received .check {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444
}

.product-row.not-received .check::before {
    content: '!';
    font-size: 22px;
    font-weight: 900
}

.product-row.not-received small {
    color: #991b1b
}

.product-row.available small {
    color: #166534
}

.product-row.available-partial small {
    color: #9a3412
}

.availability-note {
    font-weight: 800;
    margin-top: 8px !important;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569
}

.availability-note.ok {
    background: #dcfce7;
    color: #166534
}

.availability-note.danger {
    background: #fee2e2;
    color: #991b1b
}

/* Disponibilidad visual al abrir una caja por RFID */
.availability-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    padding: 12px 14px;
    border: 1px solid #dbe7f5;
    border-radius: 16px;
    background: #f8fafc;
    font-weight: 900;
    font-size: 13px
}

.availability-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px
}

.availability-legend .legend-ok {
    background: #dcfce7;
    color: #14532d
}

.availability-legend .legend-warn {
    background: #ffedd5;
    color: #9a3412
}

.availability-legend .legend-off {
    background: #e5e7eb;
    color: #374151
}

.product-row.available {
    background: linear-gradient(90deg, #bbf7d0, #f0fdf4);
    border: 2px solid #16a34a;
    box-shadow: 0 8px 20px rgba(22, 163, 74, .18)
}

.product-row.available .check {
    background: #15803d;
    color: #fff;
    border-color: #15803d
}

.product-row.available-partial {
    background: linear-gradient(90deg, #fed7aa, #fff7ed);
    border: 2px solid #f97316;
    box-shadow: 0 8px 20px rgba(249, 115, 22, .16)
}

.product-row.available-partial .check {
    background: #f97316;
    color: #fff;
    border-color: #f97316;
    font-size: .88rem
}

.product-row.not-received {
    background: #f1f5f9 !important;
    border: 2px dashed #94a3b8 !important;
    opacity: .62;
    filter: grayscale(.55)
}

.product-row.not-received .product-thumb {
    opacity: .48;
    filter: grayscale(1)
}

.product-row.not-received strong,
.product-row.not-received span {
    color: #64748b !important
}

.product-row.not-received .check {
    background: #64748b;
    color: #fff;
    border-color: #64748b
}

.product-row.not-received small {
    color: #475569 !important
}

.availability-note.ok {
    background: #bbf7d0;
    color: #14532d;
    border: 1px solid #86efac
}

.availability-note.danger {
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #cbd5e1
}

/* Botón de eliminar viajes */
.btn.danger {
    background: #dc2626;
    color: #fff;
}

.btn.danger:hover {
    background: #b91c1c;
}

.form-eliminar-viaje {
    display: inline-block;
    margin: 0;
}

/* Clientes chicos */
.cc-caja-row {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    gap: 10px;
    margin: 8px 0;
    align-items: center
}

.cc-caja-row input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d8dee9;
    border-radius: 12px
}

.pedido-card h3 {
    margin-top: 18px
}

.sticky-actions {
    position: sticky;
    bottom: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
    display: flex;
    gap: 10px;
    z-index: 10
}

@media(max-width:720px) {
    .cc-caja-row {
        grid-template-columns: 1fr
    }

    .sticky-actions {
        display: block
    }

    .sticky-actions .btn {
        width: 100%;
        margin: 4px 0
    }
}

body.app-layout {
    padding: 0;
    background: #f5f7fb
}

body.app-layout .container {
    max-width: none;
    margin: 0 0 0 270px;
    padding: 28px;
    min-height: 100vh
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 270px;
    background: #111827;
    color: #fff;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 18px;
    box-shadow: 8px 0 24px rgba(0, 0, 0, .12);
    overflow: auto;
}

.brand-box {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .12)
}

.brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #ff8000;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff
}

.brand-box strong {
    display: block;
    font-size: 18px
}

.brand-box span {
    display: block;
    color: #9ca3af;
    font-size: 13px;
    margin-top: 2px
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 20px;
    flex: 1
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d1d5db;
    text-decoration: none;
    padding: 12px;
    border-radius: 13px;
    font-weight: 700
}

.side-nav a:hover,
.side-nav a.active {
    background: #ff8000;
    color: #fff
}

.side-nav span {
    width: 24px;
    text-align: center
}

.sidebar-user {
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding-top: 14px;
    display: grid;
    gap: 5px
}

.sidebar-user small {
    color: #9ca3af
}

.sidebar-user a {
    color: #ffb366;
    font-weight: 800;
    text-decoration: none
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 80;
    border: 0;
    background: #ff8000;
    color: white;
    border-radius: 12px;
    padding: 10px 13px;
    font-size: 20px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .18)
}

.mobile-backdrop {
    display: none
}

.login-layout .container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px
}

.login-layout .topbar {
    display: none !important
}

.role-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center
}

.cc-lote-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px
}

.cc-lote-card .meta {
    color: #6b7280;
    font-size: 14px
}

.cc-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 800;
    font-size: 12px
}

@media(max-width:900px) {
    body.app-layout .container {
        margin-left: 0;
        padding: 76px 16px 18px
    }

    .sidebar {
        transform: translateX(-105%);
        transition: .22s ease
    }

    .sidebar-toggle {
        display: block
    }

    body.sidebar-open .sidebar {
        transform: translateX(0)
    }

    body.sidebar-open .mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .38);
        z-index: 40
    }

    .cc-lote-card {
        display: block
    }

    .cc-lote-card .role-actions {
        margin-top: 14px
    }

    .table-wrap {
        overflow-x: auto
    }
}

/* Flujo bloqueado de distribución */
.inline-action {
    display: inline-block;
    margin: 0
}

.btn.warning {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b
}

.btn.warning:hover {
    background: #d97706
}

.btn.disabled {
    background: #e5e7eb !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none
}

.cc-pill.locked {
    background: #e2e8f0;
    color: #475569
}

.cc-pill.editing {
    background: #fef3c7;
    color: #92400e
}

/* Login moderno */
.login-layout {
    background: radial-gradient(circle at top left, rgba(249, 115, 22, .18), transparent 34%), linear-gradient(135deg, #0f172a 0%, #172033 48%, #111827 100%);
    min-height: 100vh
}

.login-layout .container {
    max-width: 1180px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px
}

.login-premium-shell {
    width: 100%;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 35px 90px rgba(0, 0, 0, .36);
    backdrop-filter: blur(16px)
}

.login-visual {
    padding: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(249, 115, 22, .94), rgba(234, 88, 12, .88))
}

.login-visual:after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    right: -170px;
    bottom: -170px;
    background: rgba(255, 255, 255, .12)
}

.login-logo-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: #111827;
    color: #fff;
    font-weight: 900;
    font-size: 21px;
    box-shadow: 0 16px 35px rgba(15, 23, 42, .28);
    margin-bottom: 28px
}

.login-visual .eyebrow {
    color: #fff7ed
}

.login-visual h1 {
    font-size: clamp(2.25rem, 4vw, 4rem);
    line-height: 1.02;
    margin: .35rem 0 1.1rem;
    max-width: 650px
}

.login-visual>p:not(.eyebrow) {
    font-size: 1.08rem;
    line-height: 1.7;
    max-width: 580px;
    color: #fff7ed;
    margin-bottom: 28px
}

.login-feature {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    margin: 12px 0;
    position: relative;
    z-index: 1
}

.login-feature>span {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .2);
    display: grid;
    place-items: center;
    font-weight: 900
}

.login-feature strong,
.login-feature small {
    display: block
}

.login-feature small {
    color: #ffedd5;
    margin-top: 3px;
    line-height: 1.45
}

.login-card.premium {
    width: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 64px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.login-card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px
}

.login-mini-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: #fff7ed;
    color: #ea580c;
    display: grid;
    place-items: center;
    font-size: 23px;
    font-weight: 900
}

.login-card-heading h2 {
    margin: 2px 0 0;
    font-size: 2rem;
    color: #0f172a
}

.login-card-heading .eyebrow {
    margin: 0
}

.login-form {
    margin-top: 24px
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center
}

.login-input-wrap>span {
    position: absolute;
    left: 15px;
    z-index: 1;
    font-size: 16px
}

.form-grid .login-input-wrap input {
    padding: 1rem 48px 1rem 44px;
    border: 1px solid #dbe3ee;
    background: #f8fafc;
    transition: .2s
}

.form-grid .login-input-wrap input:focus {
    outline: 0;
    border-color: #f97316;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .12)
}

.password-eye {
    position: absolute;
    right: 10px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 18px
}

.password-eye:hover {
    background: #ffedd5
}

.login-submit {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    margin-top: 5px;
    display: flex;
    gap: 12px;
    align-items: center
}

.login-help {
    text-align: center;
    color: #64748b;
    font-size: .86rem;
    margin: 22px 0 0;
    line-height: 1.5
}

@media(max-width:880px) {
    .login-layout .container {
        padding: 18px
    }

    .login-premium-shell {
        grid-template-columns: 1fr;
        max-width: 580px
    }

    .login-visual {
        padding: 34px
    }

    .login-visual h1 {
        font-size: 2.2rem
    }

    .login-feature {
        display: none
    }

    .login-card.premium {
        padding: 34px
    }

    .login-visual>p:not(.eyebrow) {
        margin-bottom: 0
    }

    .login-logo-mark {
        margin-bottom: 18px
    }
}

@media(max-width:520px) {
    .login-layout .container {
        padding: 0;
        align-items: stretch
    }

    .login-premium-shell {
        border-radius: 0;
        min-height: 100vh
    }

    .login-visual {
        padding: 28px 22px
    }

    .login-visual h1 {
        font-size: 1.85rem
    }

    .login-card.premium {
        padding: 32px 22px
    }
}

/* Transporte de clientes chicos */
.transport-highlight {
    display: inline-block;
    color: #0f172a;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 3px 8px;
    font-weight: 900
}

.transporte-row select,
.transporte-row input {
    width: 100%;
    min-width: 150px;
    padding: 10px;
    border: 1px solid #d8dee9;
    border-radius: 10px;
    background: #fff
}

.transporte-row td:nth-child(5) {
    font-weight: 900
}

/* Mejoras clientes chicos e imágenes de producto */
.cc-box-reminder{margin-top:16px;padding:16px 18px;border:2px solid #f59e0b;background:#fffbeb;border-radius:14px;font-size:1.05rem;line-height:1.5;color:#78350f}
.product-zoomable{cursor:zoom-in;transition:transform .2s ease,box-shadow .2s ease}
.product-zoomable:hover{transform:scale(1.05);box-shadow:0 8px 24px rgba(15,23,42,.18)}
.product-image-modal{position:fixed;inset:0;background:rgba(2,6,23,.86);z-index:99999;display:none;align-items:center;justify-content:center;padding:28px}
.product-image-modal.open{display:flex}
.product-image-modal img{max-width:min(92vw,1100px);max-height:88vh;object-fit:contain;background:#fff;border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.45)}
.product-image-modal button{position:fixed;right:24px;top:18px;width:52px;height:52px;border:0;border-radius:50%;font-size:34px;line-height:1;background:#fff;color:#0f172a;cursor:pointer}
.pagination{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:center;margin-top:24px}.pagination a,.pagination span{padding:9px 13px;border:1px solid #d8dee9;border-radius:9px;text-decoration:none}.pagination .active{background:#ff8000;color:#fff;border-color:#ff8000;font-weight:800}

/* Distribución de clientes chicos */
.distribution-header{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:22px 0 14px;flex-wrap:wrap}
.switch-option{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid #f0b36a;border-radius:14px;background:#fff8ef;cursor:pointer;max-width:430px}
.switch-option input{position:absolute;opacity:0;pointer-events:none}
.switch-slider{width:48px;height:26px;border-radius:999px;background:#c8c8c8;position:relative;flex:0 0 auto;transition:.2s}
.switch-slider:after{content:"";width:20px;height:20px;border-radius:50%;background:#fff;position:absolute;top:3px;left:3px;box-shadow:0 2px 5px rgba(0,0,0,.2);transition:.2s}
.switch-option input:checked + .switch-slider{background:#f28c28}
.switch-option input:checked + .switch-slider:after{transform:translateX(22px)}
.switch-option span:last-child{display:flex;flex-direction:column}.switch-option small{margin-top:2px;color:#6b7280}
.cajas-capture{padding:16px;border:1px solid #e6e8ec;border-radius:14px;transition:.2s}.cajas-capture.is-disabled{opacity:.45;background:#f7f7f7}

/* Catálogo de imágenes por clave */
.key-input-list{display:grid;gap:10px}.key-input-row{display:flex;gap:10px}.key-input-row input{flex:1}
.catalog-search-form{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:18px 0}.catalog-search-form .search-input{flex:1;min-width:260px}
.product-group-list{display:grid;gap:22px}.product-group-card{border:1px solid #e6e8ec;border-radius:16px;overflow:hidden;background:#fff}
.product-group-head{display:flex;gap:16px;padding:18px;background:#fafafa;border-bottom:1px solid #e6e8ec}.product-group-head>img{width:110px;height:110px;object-fit:contain;border-radius:12px;background:#fff}
.product-key-grid{display:grid;gap:12px;padding:16px}.product-key-card{display:grid;grid-template-columns:92px minmax(220px,1fr) minmax(260px,auto);gap:16px;align-items:center;padding:12px;border:1px solid #eceef1;border-radius:12px}
.product-key-card>img{width:82px;height:82px;object-fit:contain;border-radius:10px;background:#f7f7f7}.product-key-info{display:flex;flex-direction:column;gap:4px}.individual-image-form{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.individual-image-form input[type=file]{max-width:220px}
@media(max-width:800px){.product-key-card{grid-template-columns:72px 1fr}.product-key-card>img{width:64px;height:64px}.individual-image-form{grid-column:1/-1}.distribution-header{align-items:stretch}.switch-option{max-width:none;width:100%}}
.checkbox-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-top:12px}.check-card{display:flex!important;gap:10px;align-items:center;border:1px solid #ddd;border-radius:12px;padding:14px;background:#fff}.check-card input{width:auto}.check-card span{display:flex;flex-direction:column}.package-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:16px}.package-card{border:1px solid #ddd;border-radius:14px;padding:16px;break-inside:avoid}.package-card header{display:flex;justify-content:space-between;gap:12px;margin-bottom:10px}.package-card header div{display:flex;flex-direction:column}.occupancy{height:9px;background:#eee;border-radius:10px;overflow:hidden;margin:8px 0}.occupancy span{display:block;height:100%;background:#ff8000}.package-card table{width:100%;margin-top:12px}.package-card td,.package-card th{padding:7px;border-bottom:1px solid #eee;text-align:left}@media print{.sidebar,.sidebar-toggle,.no-print,.mobile-backdrop{display:none!important}.container{margin:0!important;max-width:none!important}.card{box-shadow:none!important;border:0!important;padding:8px!important}.package-grid{grid-template-columns:repeat(2,1fr)}body{background:#fff!important}}


/* Instalación PWA */
.pwa-install-btn{width:100%;margin:0 0 12px;padding:10px 12px;border:0;border-radius:10px;background:#f58220;color:#fff;font:inherit;font-weight:700;cursor:pointer;text-align:center}
.pwa-install-btn:hover{filter:brightness(.95)}
.pwa-install-btn[hidden]{display:none!important}
.pwa-standalone .pwa-install-btn{display:none!important}


/* =====================================================
   Campo de escaneo de producto fijo
   ===================================================== */

.product-scan.sticky-product-scan {
    position: sticky;
    top: 15px;
    z-index: 45;

    background: #ffffff;
    border: 2px solid #ff8000;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .18);

    transition:
        box-shadow .2s ease,
        border-color .2s ease;
}

.product-scan.sticky-product-scan label {
    color: #182230;
    font-weight: 900;
}

.product-scan.sticky-product-scan .scan-input {
    background: #ffffff;
}

.product-scan.sticky-product-scan .scan-input:focus {
    border-color: #ff8000;
    box-shadow: 0 0 0 4px rgba(255, 128, 0, .16);
}

@media (max-width: 900px) {
    .product-scan.sticky-product-scan {
        top: 12px;
        z-index: 35;
    }
}


/* =====================================================
   Tarjeta de hora de finalización del viaje
   ===================================================== */

.finalization-card {
    position: relative;
}

.finalization-card small {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
}

.finalization-card.finished {
    background: linear-gradient(135deg, #ecfdf5, #dcfce7);
    border-color: #86efac;
}

.finalization-card.finished span,
.finalization-card.finished small {
    color: #166534;
}

.finalization-card.finished strong {
    color: #15803d;
    font-size: 26px;
}

.finalization-card.waiting {
    background: linear-gradient(135deg, #f8fafc, #eef2f7);
    border-color: #cbd5e1;
}

.finalization-card.waiting span,
.finalization-card.waiting small {
    color: #64748b;
}

.finalization-card.waiting strong {
    color: #475569;
    font-size: 22px;
}
