/* Variables configurables desde Ajustes Seyolca */
.jj-access-wrap {
    --jj-bg: #fbf2df;
    --jj-surface: #fff8eb;
    --jj-input-bg: #fffaf1;
    --jj-border: #ead5b7;
    --jj-input-border: #d4b996;
    --jj-text: #3a2218;
    --jj-primary: #5a241c;
    --jj-secondary: #7a3328;
    --jj-muted: #f1dfc5;
    --jj-danger: #7a1f14;
    --jj-button-text: #ffffff;
}

.jj-access-wrap {
    max-width: 1100px;
    margin: 0 auto 28px;
    font-family: inherit;
    color: var(--jj-text);
}

.jj-card {
    background: var(--jj-bg);
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: 0 10px 28px rgba(90, 36, 28, .10);
}

.jj-card h2,
.jj-card h3,
.jj-card h4 {
    margin-top: 0;
    color: var(--jj-text);
}

.jj-small-card {
    padding: 18px 22px;
}

.jj-form {
    display: grid;
    gap: 16px;
}

.jj-grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.jj-form label {
    display: grid;
    gap: 7px;
    font-weight: 600;
}

.jj-form input,
.jj-form textarea,
.jj-form select {
    width: 100%;
    border: 1px solid var(--jj-input-border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: var(--jj-input-bg);
    color: var(--jj-text);
}

.jj-form textarea {
    resize: vertical;
}

.jj-form small {
    color: var(--jj-secondary);
    font-weight: 600;
}

.jj-form .jj-full {
    grid-column: 1 / -1;
}

.jj-check {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px !important;
}

.jj-check input {
    width: auto;
}

.jj-button,
.jj-tabs a,
.jj-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: var(--jj-primary);
    color: var(--jj-button-text) !important;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    line-height: 1.2;
}

.jj-button:hover,
.jj-tabs a:hover,
.jj-logout:hover {
    opacity: .92;
}

.jj-secondary {
    background: var(--jj-secondary);
}

.jj-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.jj-eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--jj-secondary);
}

.jj-logout {
    background: var(--jj-danger);
    white-space: nowrap;
}

.jj-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0;
}

.jj-tabs a {
    background: var(--jj-muted);
    color: var(--jj-primary) !important;
}

.jj-tabs a.active {
    background: var(--jj-primary);
    color: var(--jj-button-text) !important;
}

.jj-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.jj-action-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.jj-product-grid,
.jj-product-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 18px;
}

.jj-product-card {
    overflow: hidden;
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    background: var(--jj-surface);
    box-shadow: 0 8px 20px rgba(90, 36, 28, .08);
}

.jj-product-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    align-items: stretch;
    min-height: 96px;
}

.jj-product-image {
    width: 96px;
    min-height: 96px;
    background: var(--jj-muted);
    overflow: hidden;
}

.jj-product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.jj-product-placeholder {
    height: 100%;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jj-secondary);
    font-weight: 800;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.jj-product-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 16px;
}

.jj-product-list-selectable .jj-product-content {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
    align-items: end;
}

.jj-product-copy h4 {
    margin: 0 0 6px;
}

.jj-product-copy p,
.jj-product-content p {
    margin-bottom: 0;
}

.jj-product-category {
    margin: 0 0 6px !important;
    color: var(--jj-secondary);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.jj-product-qty {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 10px !important;
    min-width: 190px;
    margin: 0;
    font-weight: 800;
    white-space: nowrap;
}

.jj-product-qty input {
    width: 96px;
    min-width: 96px;
    text-align: center;
    border: 1px solid var(--jj-input-border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font: inherit;
    font-weight: 800;
}

.jj-client-data-note {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin: 14px 0 18px;
    padding: 14px 16px;
    border: 1px dashed #caa47b;
    border-radius: 16px;
    background: var(--jj-surface);
}

.jj-delivery-date-field {
    max-width: 360px;
}

.jj-empty-products {
    border: 1px dashed #caa47b;
    border-radius: 16px;
    padding: 18px;
    background: var(--jj-surface);
}

.jj-order-list {
    display: grid;
    gap: 14px;
}

.jj-order-item {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    padding: 16px;
    background: var(--jj-surface);
}

.jj-order-products {
    margin: 10px 0;
    padding-left: 18px;
}

.jj-status {
    height: fit-content;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 800;
    background: var(--jj-muted);
    white-space: nowrap;
}

.jj-status-recibido { background: #e6d8c2; }
.jj-status-en_produccion { background: #f7d99b; }
.jj-status-en_reparto { background: #ead1c7; }
.jj-status-entregado { background: #d8e8c8; }
.jj-status-cancelado { background: #f0c2b8; }

.jj-notice {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-weight: 700;
}

.jj-success {
    background: #d8e8c8;
    color: #2d5a24;
}

.jj-error {
    background: #f0c2b8;
    color: var(--jj-danger);
}

.jj-big-number {
    font-size: 44px;
    font-weight: 900;
    margin: 0;
}

/* Menu flotante Seyolca */
.jj-floating-menu {
    position: sticky;
    top: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 20px;
    padding: 10px 16px;
    background: var(--jj-bg);
    border: 1px solid var(--jj-border);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 10px 28px rgba(90, 36, 28, .16);
}

.jj-floating-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--jj-primary) !important;
    text-decoration: none !important;
}

.jj-floating-logo img {
    width: auto;
    height: 46px;
    max-width: 110px;
    object-fit: contain;
    display: block;
}

.jj-logo-text {
    color: var(--jj-primary);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.jj-menu-details {
    position: relative;
    margin-left: auto;
}

.jj-menu-details summary {
    list-style: none;
}

.jj-menu-details summary::-webkit-details-marker {
    display: none;
}

.jj-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 999px;
    padding: 12px 18px;
    background: var(--jj-primary);
    color: var(--jj-button-text);
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 8px 18px rgba(90, 36, 28, .22);
}

.jj-menu-icon {
    font-size: 20px;
    line-height: 1;
}

.jj-menu-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 245px;
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--jj-surface);
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(90, 36, 28, .20);
}

.jj-menu-dropdown a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 14px;
    padding: 12px 14px;
    background: var(--jj-bg);
    color: var(--jj-text) !important;
    font-weight: 800;
    text-decoration: none !important;
}

.jj-menu-dropdown a:hover,
.jj-menu-dropdown a.active {
    background: var(--jj-primary);
    color: var(--jj-button-text) !important;
}

.jj-menu-dropdown a.jj-menu-logout {
    background: var(--jj-danger);
    color: var(--jj-button-text) !important;
}

.jj-client-floating-menu + .jj-panel-header,
.jj-employee-floating-menu + .jj-panel-header {
    margin-top: 0;
}

@media (max-width: 980px) {
    .jj-panel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .jj-grid-form,
    .jj-panel-grid {
        grid-template-columns: 1fr;
    }

    .jj-panel-header,
    .jj-order-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .jj-floating-menu {
        padding: 9px 12px;
    }

    .jj-floating-logo img {
        height: 38px;
        max-width: 86px;
    }

    .jj-logo-text {
        font-size: 20px;
    }

    .jj-menu-toggle {
        padding: 11px 14px;
    }

    .jj-menu-toggle span:last-child {
        display: none;
    }

    .jj-menu-dropdown {
        right: -2px;
        min-width: min(260px, calc(100vw - 40px));
    }

    .jj-product-row,
    .jj-product-list-selectable .jj-product-row {
        grid-template-columns: 84px 1fr;
    }

    .jj-product-image {
        width: 84px;
        min-height: 84px;
    }

    .jj-product-placeholder {
        min-height: 84px;
    }

    .jj-product-list-selectable .jj-product-content {
        grid-template-columns: 1fr;
    }

    .jj-product-qty {
        justify-content: flex-start;
        max-width: 220px;
    }
}

/* Ajustes 1.3.2: aviso temporal, zoom móvil y fotos completas */
.jj-access-wrap,
.jj-access-wrap * {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}

.jj-access-wrap input,
.jj-access-wrap select,
.jj-access-wrap textarea,
.jj-access-wrap button,
.jj-menu-toggle {
    font-size: 16px !important;
    touch-action: manipulation;
}

.jj-notice.jj-success {
    transition: opacity .45s ease, transform .45s ease, max-height .45s ease, margin .45s ease, padding .45s ease;
    overflow: hidden;
    max-height: 120px;
}

.jj-notice.jj-success.jj-notice-hide {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.jj-product-row,
.jj-product-list-selectable .jj-product-row {
    grid-template-columns: 84px 1fr;
    align-items: center;
    min-height: 84px;
}

.jj-product-image {
    width: 66px;
    height: 66px;
    min-height: 0;
    margin-left: 12px;
    border-radius: 14px;
    background: var(--jj-input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.jj-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
}

.jj-product-placeholder {
    width: 66px;
    height: 66px;
    min-height: 0;
}

.jj-product-qty {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end;
    gap: 10px !important;
    white-space: nowrap;
}

.jj-product-qty input {
    font-size: 16px !important;
}

@media (max-width: 760px) {
    .jj-product-row,
    .jj-product-list-selectable .jj-product-row {
        grid-template-columns: 74px 1fr;
        min-height: 76px;
    }

    .jj-product-image,
    .jj-product-placeholder {
        width: 58px;
        height: 58px;
    }

    .jj-product-qty {
        justify-content: flex-start;
        max-width: none;
    }

    .jj-product-qty input {
        width: 88px;
        min-width: 88px;
    }
}

/* Ajustes 1.3.4: tabla de producción */
.jj-production-filter {
    grid-template-columns: minmax(220px, 320px) auto;
    align-items: end;
    margin: 18px 0;
}

.jj-production-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.jj-production-stats div {
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    padding: 16px;
    background: var(--jj-surface);
}

.jj-production-stats strong {
    display: block;
    color: var(--jj-primary);
    font-size: 30px;
    line-height: 1;
}

.jj-production-stats span {
    display: block;
    margin-top: 6px;
    font-weight: 800;
    color: var(--jj-secondary);
}

.jj-production-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    background: var(--jj-surface);
}

.jj-production-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.jj-production-table th,
.jj-production-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--jj-border);
    text-align: left;
    color: var(--jj-text);
}

.jj-production-table th {
    background: var(--jj-muted);
    color: var(--jj-primary);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.jj-production-table tbody tr:last-child td {
    border-bottom: 0;
}

.jj-production-table td:nth-child(3),
.jj-production-table td:nth-child(4) {
    font-size: 18px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .jj-production-filter,
    .jj-production-stats {
        grid-template-columns: 1fr;
    }

    .jj-production-table {
        min-width: 0;
    }

    .jj-production-table thead {
        display: none;
    }

    .jj-production-table,
    .jj-production-table tbody,
    .jj-production-table tr,
    .jj-production-table td {
        display: block;
        width: 100%;
    }

    .jj-production-table tr {
        border-bottom: 1px solid var(--jj-border);
        padding: 12px 0;
    }

    .jj-production-table tbody tr:last-child {
        border-bottom: 0;
    }

    .jj-production-table td {
        border-bottom: 0;
        padding: 7px 14px;
    }

    .jj-production-table td::before {
        content: attr(data-label) ': ';
        font-weight: 900;
        color: var(--jj-secondary);
    }
}


/* Ajustes 1.3.5: avisos bajo el menú y repetir pedido */
.jj-floating-menu + .jj-notice {
    margin-top: 0;
}

.jj-repeat-banner {
    margin: 12px 0 18px;
    padding: 12px 14px;
    border: 1px dashed #caa47b;
    border-radius: 14px;
    background: var(--jj-surface);
    color: var(--jj-primary);
    font-weight: 800;
}

.jj-order-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    min-width: 150px;
}

.jj-repeat-order-button {
    padding: 10px 14px;
    font-size: 14px !important;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .jj-order-side {
        align-items: flex-start;
        width: 100%;
    }
}

/* Ajustes 1.3.7: barra elegante de estados y producción */
.jj-order-item-progress {
    align-items: stretch;
}

.jj-order-main {
    flex: 1 1 auto;
    min-width: 0;
}

.jj-order-main h4 {
    margin-bottom: 10px;
}

.jj-order-progress {
    position: relative;
    margin-top: 16px;
    padding: 18px 14px 12px;
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    background: var(--jj-input-bg);
    overflow: hidden;
}

.jj-order-progress ol {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jj-progress-line {
    position: absolute;
    left: 36px;
    right: 36px;
    top: 31px;
    height: 5px;
    border-radius: 999px;
    background: var(--jj-border);
    overflow: hidden;
}

.jj-progress-line span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--jj-secondary), #9d563f, #4f7d3a);
}

.jj-progress-step {
    display: grid;
    justify-items: center;
    gap: 8px;
    text-align: center;
    color: #8b6d57;
    font-size: 12px;
    font-weight: 800;
}

.jj-progress-dot {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 4px solid var(--jj-border);
    background: var(--jj-input-bg);
    box-shadow: 0 0 0 4px var(--jj-input-bg);
}

.jj-progress-step.is-complete .jj-progress-dot,
.jj-progress-step.is-current .jj-progress-dot {
    border-color: var(--jj-secondary);
    background: var(--jj-secondary);
}

.jj-progress-step.is-current .jj-progress-dot {
    box-shadow: 0 0 0 4px var(--jj-muted), 0 0 0 7px rgba(122, 51, 40, .18);
}

.jj-progress-step.is-complete,
.jj-progress-step.is-current {
    color: var(--jj-primary);
}

.jj-order-current-status {
    margin: 12px 0 0;
    color: var(--jj-primary);
    font-weight: 800;
}

.jj-order-progress-cancelled {
    border-color: #f0c2b8;
    background: #fff2ee;
}

.jj-production-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: -4px 0 18px;
}

.jj-production-actions small {
    color: var(--jj-secondary);
    font-weight: 700;
}

@media (max-width: 760px) {
    .jj-order-item-progress {
        flex-direction: column;
    }

    .jj-order-progress {
        padding: 14px 12px;
    }

    .jj-order-progress ol {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .jj-progress-line {
        display: none;
    }

    .jj-progress-step {
        display: flex;
        justify-content: flex-start;
        text-align: left;
    }

    .jj-progress-dot {
        width: 20px;
        height: 20px;
        border-width: 3px;
        box-shadow: none;
        flex: 0 0 auto;
    }
}

/* Ajustes 1.3.8: avance dinámico de producción */
.jj-button:disabled,
.jj-button.jj-disabled {
    opacity: .58;
    cursor: not-allowed;
    box-shadow: none;
}

.jj-production-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -4px 0 18px;
}

.jj-production-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--jj-surface);
    border: 1px solid var(--jj-border);
    color: var(--jj-primary);
    font-size: 13px;
    font-weight: 800;
}

.jj-production-status-pill strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--jj-primary);
    color: var(--jj-button-text);
    font-size: 12px;
}

.jj-production-status-en_produccion {
    background: #fff1d0;
}

.jj-production-status-preparando {
    background: #f7e2d8;
}

.jj-production-status-en_reparto {
    background: #e8f1fb;
}

.jj-production-status-entregado {
    background: #edf7e7;
}


/* Ajustes 1.3.9: resumen y filtro de pedidos del cliente */
.jj-orders-summary-head,
.jj-orders-tools {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.jj-orders-summary-head p,
.jj-orders-tools p {
    margin-bottom: 0;
}

.jj-client-order-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.jj-client-order-summary-card {
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    padding: 14px 12px;
    background: var(--jj-surface);
    text-align: center;
}

.jj-client-order-summary-card strong {
    display: block;
    color: var(--jj-primary);
    font-size: 30px;
    line-height: 1;
}

.jj-client-order-summary-card span {
    display: block;
    margin-top: 7px;
    color: var(--jj-secondary);
    font-size: 13px;
    font-weight: 900;
}

.jj-client-order-summary-total {
    background: var(--jj-muted);
}

.jj-client-order-summary-en_produccion {
    background: #fff1d0;
}

.jj-client-order-summary-preparando {
    background: #f7e2d8;
}

.jj-client-order-summary-en_reparto {
    background: #e8f1fb;
}

.jj-client-order-summary-entregado {
    background: #edf7e7;
}

.jj-order-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 280px) auto;
    align-items: end;
    gap: 12px;
    min-width: min(100%, 440px);
}

.jj-order-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--jj-primary);
    font-weight: 900;
}

.jj-order-filter-form input[type="date"] {
    width: 100%;
    border: 1px solid var(--jj-input-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font: inherit;
}

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

.jj-empty-orders-box {
    margin-top: 18px;
    border: 1px dashed #caa47b;
    border-radius: 16px;
    padding: 16px;
    background: var(--jj-surface);
}

.jj-order-list-current {
    margin-top: 18px;
}

.jj-order-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.jj-order-title-row h4 {
    margin: 0;
}

.jj-order-state-mini {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--jj-border);
    border-radius: 999px;
    padding: 7px 11px;
    background: var(--jj-muted);
    color: var(--jj-primary);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .jj-client-order-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .jj-orders-summary-head,
    .jj-orders-tools {
        flex-direction: column;
    }

    .jj-client-order-summary-grid,
    .jj-order-filter-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .jj-order-filter-actions,
    .jj-order-filter-actions .jj-button {
        width: 100%;
    }
}

/* Ajustes 1.4.1: Ver pedidos limpio, filtro dinámico y barra inferior de contacto */
.jj-access-wrap {
    padding-bottom: 86px;
}

.jj-orders-clean-card .jj-orders-tools {
    align-items: center;
    border-bottom: 1px solid var(--jj-border);
    padding-bottom: 14px;
}

.jj-orders-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--jj-border);
}

.jj-orders-summary-strip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--jj-border);
    border-radius: 999px;
    padding: 7px 10px;
    background: var(--jj-surface);
    color: var(--jj-primary);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.jj-orders-summary-strip strong {
    font-size: 15px;
}

.jj-order-filter-form-auto {
    grid-template-columns: minmax(145px, 165px) auto;
    min-width: 0;
    width: auto;
}

.jj-order-filter-form-auto label {
    font-size: 13px;
}

.jj-order-filter-form-auto input[type="date"] {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px !important;
}

.jj-order-list-clean {
    gap: 0;
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--jj-input-bg);
}

.jj-order-list-clean .jj-order-item-clean {
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--jj-border);
    background: transparent;
    box-shadow: none;
    margin: 0;
}

.jj-order-list-clean .jj-order-item-clean:last-child {
    border-bottom: 0;
}

.jj-order-total {
    margin: 8px 0 0;
    color: var(--jj-primary);
    font-weight: 800;
}

.jj-product-price {
    margin: 6px 0 0 !important;
    color: var(--jj-primary);
    font-size: 14px;
    font-weight: 900;
}

.jj-bottom-contact-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--jj-bg);
    border-top: 1px solid var(--jj-border);
    box-shadow: 0 -10px 28px rgba(90, 36, 28, .16);
}

.jj-bottom-contact-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    border-radius: 999px;
    padding: 11px 16px;
    background: var(--jj-primary);
    color: var(--jj-button-text) !important;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-decoration: none !important;
}

.jj-bottom-contact-link:hover {
    opacity: .94;
}

.jj-whatsapp-link {
    background: var(--jj-primary);
}

.jj-contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: transparent;
    color: var(--jj-button-text);
    line-height: 1;
}

.jj-contact-svg {
    width: 21px;
    height: 21px;
    display: block;
    color: var(--jj-button-text);
}

.jj-contact-disabled {
    opacity: .55;
    pointer-events: none;
}

@media (max-width: 760px) {
    .jj-orders-clean-card .jj-orders-tools {
        align-items: stretch;
    }

    .jj-order-filter-form-auto {
        grid-template-columns: minmax(145px, 165px) auto;
        width: 100%;
    }

    .jj-order-filter-actions .jj-button {
        width: auto;
    }

    .jj-bottom-contact-bar {
        gap: 8px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .jj-bottom-contact-link {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 10px;
        padding-right: 10px;
    }
}


/* Ajustes 1.4.3: fechas por defecto y selector compacto en Realizar pedido */
.jj-delivery-date-field {
    width: 165px;
    max-width: 165px;
}

.jj-delivery-date-field input[type="date"] {
    width: 165px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px !important;
}

.jj-delivery-date-field small {
    width: min(280px, calc(100vw - 48px));
    max-width: 280px;
    line-height: 1.35;
}

@media (max-width: 760px) {
    .jj-delivery-date-field,
    .jj-delivery-date-field input[type="date"] {
        width: 165px;
        max-width: 165px;
    }
}


/* Ajustes 1.4.5: panel limpio, fecha compacta y carrusel */
.jj-form .jj-delivery-date-field,
.jj-form .jj-compact-date-field {
    width: 165px !important;
    max-width: 165px !important;
    min-width: 0 !important;
}

.jj-form .jj-delivery-date-field input[type="date"],
.jj-form .jj-compact-date-field input[type="date"],
.jj-delivery-date-input {
    width: 165px !important;
    max-width: 165px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px !important;
}

.jj-form .jj-delivery-date-field small,
.jj-form .jj-compact-date-field small {
    width: min(280px, calc(100vw - 48px));
    max-width: 280px;
}

.jj-client-home-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.jj-client-home-summary-box {
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    padding: 16px;
    background: var(--jj-surface);
}

.jj-client-home-summary-box .jj-summary-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--jj-primary);
    color: var(--jj-button-text);
    font-weight: 900;
    font-size: 18px;
}

.jj-client-home-summary-box strong,
.jj-client-home-summary-box small {
    display: block;
}

.jj-client-home-summary-box small {
    color: var(--jj-secondary);
    font-weight: 800;
    margin-top: 4px;
}

.jj-client-home-summary-box ul {
    margin: 10px 0 0;
    padding-left: 18px;
}

.jj-latest-products-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 240px);
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    padding: 4px 2px 10px;
}

.jj-latest-product-slide {
    position: relative;
    min-height: 150px;
    overflow: hidden;
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    background: var(--jj-muted);
    scroll-snap-align: start;
}

.jj-latest-product-img,
.jj-latest-product-placeholder {
    width: 100%;
    height: 170px;
    display: block;
}

.jj-latest-product-img {
    object-fit: cover;
}

.jj-latest-product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jj-secondary);
    font-weight: 900;
}

.jj-latest-product-slide h4 {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 28px 12px 12px;
    background: linear-gradient(to top, rgba(58,34,24,.86), rgba(58,34,24,0));
    color: #fff;
    font-size: 15px;
    line-height: 1.25;
}

@media (max-width: 760px) {
    .jj-client-home-summary-grid {
        grid-template-columns: 1fr;
    }

    .jj-latest-products-carousel {
        grid-auto-columns: minmax(160px, 78vw);
    }
}

/* Ajustes 1.4.6: historial de pedidos y boton Volver Hoy */
.jj-history-tools {
    align-items: center;
}

.jj-history-filter-form {
    display: grid;
    grid-template-columns: minmax(170px, 210px) auto;
    align-items: end;
    gap: 12px;
    min-width: min(100%, 560px);
}

.jj-history-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--jj-primary);
    font-weight: 900;
    font-size: 13px;
}

.jj-history-filter-form select,
.jj-history-filter-form input[type="date"] {
    width: 100%;
    border: 1px solid var(--jj-input-border);
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 40px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font: inherit;
    font-size: 16px !important;
    box-sizing: border-box;
}

.jj-history-custom-dates {
    display: none;
    grid-template-columns: repeat(2, minmax(130px, 150px)) auto;
    gap: 10px;
    align-items: end;
}

.jj-history-custom-dates.is-active {
    display: grid;
}

.jj-history-date,
.jj-history-total {
    margin: 8px 0;
    color: var(--jj-secondary);
    font-weight: 700;
}

.jj-history-delivered-label {
    background: #edf7e7;
    color: #24551f;
}

@media (max-width: 760px) {
    .jj-history-filter-form,
    .jj-history-custom-dates {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .jj-history-custom-dates .jj-button {
        width: 100%;
    }
}


/* Ajustes 1.4.7: albaranes de empleados */
.jj-albaran-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-top: 16px;
}

.jj-albaran-filter label {
    display: grid;
    gap: 7px;
    color: var(--jj-primary);
    font-weight: 900;
    font-size: 13px;
}

.jj-albaran-filter input[type="date"] {
    width: 165px;
    max-width: 100%;
    border: 1px solid var(--jj-input-border);
    border-radius: 10px;
    padding: 8px 10px;
    min-height: 40px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font: inherit;
    font-size: 16px !important;
    box-sizing: border-box;
}

.jj-delivery-notes-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.jj-delivery-notes-stats > div {
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    background: var(--jj-surface);
    padding: 12px;
    text-align: center;
}

.jj-delivery-notes-stats strong {
    display: block;
    color: var(--jj-primary);
    font-size: 22px;
    line-height: 1.1;
}

.jj-delivery-notes-stats span {
    color: var(--jj-secondary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.jj-delivery-notes-list {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.jj-delivery-note {
    border: 1px solid var(--jj-border);
    border-radius: 20px;
    background: var(--jj-surface);
    padding: 16px;
    box-shadow: 0 10px 28px rgba(58, 34, 24, .08);
}

.jj-delivery-note-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    border-bottom: 1px solid var(--jj-border);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.jj-delivery-note-header h4 {
    margin: 0;
    color: var(--jj-primary);
    font-size: 22px;
}

.jj-delivery-note-meta {
    display: grid;
    gap: 5px;
    text-align: right;
    color: var(--jj-text);
    font-size: 13px;
}

.jj-delivery-note-client {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.jj-delivery-note-client > div {
    border: 1px solid var(--jj-border);
    border-radius: 14px;
    padding: 10px;
    background: var(--jj-bg);
}

.jj-delivery-note-client span {
    display: block;
    color: var(--jj-secondary);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.jj-delivery-note-client strong {
    color: var(--jj-text);
    font-size: 14px;
    line-height: 1.35;
}

.jj-delivery-note-address {
    grid-column: span 2;
}

.jj-delivery-note-total {
    text-align: right;
    color: var(--jj-primary);
    font-size: 16px;
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .jj-delivery-notes-stats,
    .jj-delivery-note-client {
        grid-template-columns: 1fr;
    }

    .jj-delivery-note-address {
        grid-column: auto;
    }

    .jj-delivery-note-header {
        display: grid;
    }

    .jj-delivery-note-meta {
        text-align: left;
    }

    .jj-albaran-filter .jj-button {
        width: 100%;
    }
}

@media print {
    .jj-floating-menu,
    .jj-bottom-contact-bar,
    .jj-albaran-filter,
    .jj-panel-header,
    .jj-notice {
        display: none !important;
    }

    .jj-access-wrap {
        padding: 0 !important;
        background: #fff !important;
    }

    .jj-card,
    .jj-delivery-note {
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
}


/* Ajustes 1.4.8: gestión de empleados desde el sitio */
.jj-employee-date-filter-auto input[type="date"],
.jj-production-filter input[type="date"],
.jj-albaran-filter input[type="date"] {
    width: 165px !important;
    max-width: 165px !important;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px !important;
    box-sizing: border-box;
}

.jj-production-filter,
.jj-albaran-filter,
.jj-employee-date-filter-auto {
    align-items: end;
}

.jj-employee-orders-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--jj-border);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.jj-employee-create-order {
    margin: 18px 0;
}

.jj-inline-details {
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    background: var(--jj-surface);
    overflow: hidden;
}

.jj-inline-details > summary {
    cursor: pointer;
    padding: 14px 16px;
    background: var(--jj-muted);
    color: var(--jj-primary);
    font-weight: 900;
    list-style: none;
}

.jj-inline-details > summary::-webkit-details-marker {
    display: none;
}

.jj-inline-details > summary::after {
    content: '+';
    float: right;
    font-weight: 900;
}

.jj-inline-details[open] > summary::after {
    content: '-';
}

.jj-employee-order-form {
    padding: 16px;
}

.jj-employee-order-top-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 180px;
    gap: 12px;
    align-items: start;
}

.jj-employee-order-form select,
.jj-employee-product-form select,
.jj-employee-product-form input[type="file"] {
    width: 100%;
    border: 1px solid var(--jj-input-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font: inherit;
    font-size: 16px;
}

.jj-employee-order-contact {
    display: grid;
    gap: 4px;
    margin: 8px 0;
    color: var(--jj-text);
}

.jj-employee-product-form {
    margin-top: 16px;
}

.jj-current-product-image {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--jj-primary);
    font-weight: 900;
}

.jj-current-product-image img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 1px solid var(--jj-border);
    border-radius: 12px;
    background: var(--jj-input-bg);
}

.jj-form-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.jj-employee-product-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.jj-employee-product-row {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--jj-border);
    border-radius: 16px;
    padding: 10px;
    background: var(--jj-surface);
}

.jj-employee-product-thumb {
    width: 68px;
    height: 68px;
    border: 1px solid var(--jj-border);
    border-radius: 14px;
    background: var(--jj-input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--jj-secondary);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.jj-employee-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.jj-employee-product-row h4 {
    margin: 0 0 4px;
    color: var(--jj-primary);
}

.jj-employee-product-row p {
    margin: 0;
}

@media (max-width: 760px) {
    .jj-employee-orders-head,
    .jj-employee-order-top-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .jj-employee-product-row {
        grid-template-columns: 58px 1fr;
    }

    .jj-employee-product-row .jj-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* Ajustes 1.5.0: foto de entrega y firma digital de albaranes */
.jj-delivery-proof-box,
.jj-delivery-proof-summary {
    margin-top: 16px;
    border: 1px solid var(--jj-border);
    border-radius: 18px;
    background: var(--jj-surface);
    overflow: hidden;
}

.jj-delivery-proof-box > summary {
    cursor: pointer;
    padding: 14px 16px;
    background: var(--jj-muted);
    color: var(--jj-primary);
    font-weight: 900;
    list-style: none;
}

.jj-delivery-proof-box > summary::-webkit-details-marker {
    display: none;
}

.jj-delivery-proof-box > summary::after {
    content: '+';
    float: right;
    font-weight: 900;
}

.jj-delivery-proof-box[open] > summary::after {
    content: '-';
}

.jj-delivery-proof-form {
    padding: 16px;
}

.jj-delivery-proof-grid {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
    gap: 16px;
    align-items: start;
}

.jj-delivery-proof-form input[type="file"] {
    width: 100%;
    border: 1px dashed var(--jj-input-border);
    border-radius: 14px;
    padding: 14px;
    background: var(--jj-input-bg);
    color: var(--jj-text);
    font-size: 16px;
    box-sizing: border-box;
}

.jj-photo-status {
    display: block;
    margin-top: 8px;
    color: var(--jj-secondary);
    font-weight: 800;
}

.jj-signature-label {
    gap: 8px;
}

.jj-signature-canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 180px;
    border: 2px solid var(--jj-input-border);
    border-radius: 16px;
    background: #fff;
    touch-action: none;
    box-sizing: border-box;
}

.jj-clear-signature {
    margin-top: 8px;
    align-self: flex-start;
}

.jj-delivery-proof-summary {
    padding: 16px;
    background: #eef8ee;
}

.jj-delivery-proof-summary h5 {
    margin: 0 0 6px;
    color: #21612f;
    font-size: 18px;
}

.jj-delivery-proof-summary p {
    margin: 6px 0;
}

.jj-delivery-proof-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 760px) {
    .jj-delivery-proof-grid {
        grid-template-columns: 1fr;
    }

    .jj-signature-canvas {
        height: 170px;
    }
}

@media print {
    .jj-delivery-proof-box {
        display: none !important;
    }
}
