/*
 * Fabricación · Nuevo pedido v2 — composición compacta exclusiva para tablet.
 * Escritorio y móvil conservan sus interfaces actuales.
 */
@media (min-width: 681px) and (max-width: 1024px),
       (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (min-height: 500px) {
    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-head {
        display: block !important;
        width: 100% !important;
        margin: 0 0 10px !important;
    }

    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-head .pv-pedidos-head-main,
    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-head .pv-pedidos-head-tabs {
        box-sizing: border-box !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* El mismo escáner ya vive dentro de la cabecera de Fabricación. */
    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-head .pv-pedidos-head-action {
        display: none !important;
    }

    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-subtabs {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 8px !important;
        border-bottom: 1px solid #E5E1EF !important;
    }

    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-subtabs .pv-subtab {
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 6px !important;
        border: 0 !important;
        border-bottom: 3px solid transparent !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #667085 !important;
        font-size: 10.5px !important;
        font-weight: 800 !important;
        box-shadow: none !important;
    }

    html body #pvf-shell:has(#pv-fab-form) .pv-fabricacion-subtabs .pv-subtab.active {
        border-bottom-color: #D9147F !important;
        color: #6D39E9 !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview {
        position: relative !important;
        box-sizing: border-box !important;
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        margin: 0 0 10px !important;
        padding: 15px 16px !important;
        overflow: hidden !important;
        border: 1px solid transparent !important;
        border-top-width: 3px !important;
        border-radius: 18px !important;
        background:
            linear-gradient(112deg, #FFFFFF 0%, #FCFAFF 58%, #FFF6FB 100%) padding-box,
            linear-gradient(90deg, #6D39E9 0%, #9638D7 54%, #D41483 100%) border-box !important;
        box-shadow: 0 10px 28px rgba(44, 33, 77, .07) !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview::after {
        content: "" !important;
        position: absolute !important;
        top: -52px !important;
        right: -36px !important;
        width: 150px !important;
        height: 150px !important;
        border-radius: 50% !important;
        background: radial-gradient(circle, rgba(212, 20, 131, .08), rgba(109, 57, 233, 0) 68%) !important;
        pointer-events: none !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading {
        position: relative !important;
        z-index: 1 !important;
        display: grid !important;
        grid-template-columns: minmax(190px, 1fr) auto !important;
        align-items: center !important;
        gap: 16px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading > div:first-child {
        display: flex !important;
        min-width: 0 !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading > div:first-child::before {
        content: "CONTROL DE PRODUCCIÓN" !important;
        display: block !important;
        margin: 0 0 4px !important;
        color: #7042E8 !important;
        font-size: 8.5px !important;
        font-weight: 900 !important;
        line-height: 1 !important;
        letter-spacing: .1em !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading h1 {
        margin: 0 !important;
        color: #171A2B !important;
        font-size: 23px !important;
        font-weight: 900 !important;
        line-height: 1.05 !important;
        letter-spacing: -.035em !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading p {
        margin: 4px 0 0 !important;
        color: #7A8498 !important;
        font-size: 10.5px !important;
        font-weight: 650 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-actions {
        display: grid !important;
        grid-template-columns: 124px 142px !important;
        align-items: stretch !important;
        justify-content: end !important;
        gap: 8px !important;
        width: auto !important;
        min-width: 0 !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-actions > * {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        margin: 0 !important;
        padding: 0 12px !important;
        border-radius: 11px !important;
        font-size: 10.5px !important;
        font-weight: 850 !important;
        line-height: 1 !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        box-shadow: none !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-scan {
        gap: 8px !important;
        border: 1px solid #D9CDF8 !important;
        background: #F8F5FF !important;
        color: #6535DC !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-scan .pv-pedido-scan-launch-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 27px !important;
        width: 27px !important;
        height: 27px !important;
        border-radius: 8px !important;
        background: linear-gradient(145deg, #6D39E9, #D41483) !important;
        color: #FFFFFF !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-scan .pv-pedido-scan-launch-icon svg {
        width: 14px !important;
        height: 14px !important;
        color: #FFFFFF !important;
        stroke: #FFFFFF !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-new {
        gap: 6px !important;
        border: 0 !important;
        background: linear-gradient(100deg, #6D39E9 0%, #8E35DB 54%, #D41483 100%) !important;
        color: #FFFFFF !important;
        box-shadow: 0 8px 18px rgba(112, 55, 221, .18) !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-new > span {
        color: #FFFFFF !important;
        font-size: 16px !important;
        font-weight: 500 !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics {
        position: relative !important;
        z-index: 1 !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 9px !important;
        width: 100% !important;
        margin: 12px 0 0 !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics article {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 9px !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
        min-height: 58px !important;
        padding: 9px 11px !important;
        border: 1px solid #E6E3EE !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, .82) !important;
        box-shadow: 0 5px 14px rgba(39, 30, 68, .035) !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metric-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 34px !important;
        height: 34px !important;
        border-radius: 10px !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metric-icon svg {
        width: 17px !important;
        height: 17px !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics article > span:last-child {
        display: flex !important;
        min-width: 0 !important;
        flex-direction: column !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics small {
        overflow: hidden !important;
        color: #7B8598 !important;
        font-size: 8.5px !important;
        font-weight: 800 !important;
        line-height: 1.15 !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics strong {
        margin-top: 3px !important;
        color: #171A2B !important;
        font-size: 14px !important;
        font-weight: 900 !important;
        line-height: 1 !important;
        font-variant-numeric: tabular-nums !important;
        white-space: nowrap !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-metrics strong em {
        color: #7042E8 !important;
        font-size: 7.5px !important;
        font-style: normal !important;
        font-weight: 900 !important;
    }
}

@media (min-width: 681px) and (max-width: 760px) {
    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-heading {
        grid-template-columns: minmax(170px, 1fr) auto !important;
        gap: 12px !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-actions {
        grid-template-columns: 116px 132px !important;
        gap: 7px !important;
    }

    html body #pvf-shell .pv-fab-mobile-overview .pv-ped-mobile-actions > * {
        padding: 0 9px !important;
        font-size: 9.5px !important;
    }
}

/*
 * La aplicación imprime reglas responsivas al final del documento. Este
 * bloque más específico mantiene la composición tablet por encima de ellas.
 */
@media (min-width: 681px) and (max-width: 1024px),
       (min-width: 1025px) and (max-width: 1366px) and (pointer: coarse) and (min-height: 500px) {
    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fabricacion-head .pv-pedidos-head-main,
    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fabricacion-head .pv-pedidos-head-tabs {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fabricacion-head .pv-fabricacion-subtabs {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 8px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-heading {
        display: grid !important;
        grid-template-columns: minmax(190px, 1fr) 266px !important;
        align-items: center !important;
        gap: 16px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-actions {
        display: grid !important;
        grid-template-columns: 124px 134px !important;
        gap: 8px !important;
        width: 266px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-actions > * {
        width: 100% !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 10px !important;
        border-radius: 11px !important;
        font-size: 10px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-scan .pv-pedido-scan-launch-icon {
        flex-basis: 27px !important;
        width: 27px !important;
        height: 27px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-metrics {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 9px !important;
        margin-top: 12px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-metrics article {
        grid-template-columns: 34px minmax(0, 1fr) !important;
        gap: 9px !important;
        height: 58px !important;
        min-height: 58px !important;
        max-height: 58px !important;
        padding: 9px 11px !important;
        border-radius: 12px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-metric-icon {
        width: 34px !important;
        height: 34px !important;
    }
}

@media (min-width: 681px) and (max-width: 760px) {
    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-heading {
        grid-template-columns: minmax(170px, 1fr) 248px !important;
        gap: 12px !important;
    }

    html body #pvf-shell#pvf-shell .pvf-main-body.pvf-view-fabricacion_nuevo .pv-fab-mobile-overview .pv-ped-mobile-actions {
        grid-template-columns: 116px 125px !important;
        gap: 7px !important;
        width: 248px !important;
    }
}
