/* ══════════════════════════════════════════════════════════════
   Distribución — Envíos: Create Modal + Button Styles
   ══════════════════════════════════════════════════════════════ */

/* ── "Nuevo Envío" toolbar button ── */
.ho-btn-create {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'DM Sans', 'Inter', sans-serif;
    letter-spacing: 0.2px;
}
.ho-btn-create:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

/* ══════════════════════════════════════════════════════════════
   Modal Overlay
   ══════════════════════════════════════════════════════════════ */
.de-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: de-fade-in 0.25s ease;
    padding: 20px;
}

@keyframes de-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   Modal Container
   ══════════════════════════════════════════════════════════════ */
.de-modal-container {
    width: 860px;
    max-width: 95vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, #141b2d, #111827);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(99, 102, 241, 0.08);
    animation: de-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: visible;
    transition: width 0.3s ease;
}

@keyframes de-slide-up {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.de-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.de-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #e2e8f0;
    font-family: 'DM Sans', 'Inter', sans-serif;
}

.de-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    font-size: 1.3rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.de-modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ── Body ── */
.de-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* allow flex shrinking for proper overflow */
}

/* ── Form Grid ── */
.de-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.de-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#ce-ml-full-field[hidden] { display: none; }

.de-modal-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'DM Sans', 'Inter', sans-serif;
}

.de-required {
    color: #f43f5e;
}

.de-modal-field input,
.de-modal-field select {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.88rem;
    font-family: 'DM Sans', 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
}
.de-modal-field input:focus,
.de-modal-field select:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.06);
}

.de-modal-field input::placeholder {
    color: #475569;
}

.de-modal-field select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* ══════════════════════════════════════════════════════════════
   Products Section
   ══════════════════════════════════════════════════════════════ */
.de-products-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: visible;
}

.de-products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.de-products-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    font-family: 'DM Sans', 'Inter', sans-serif;
}

.de-btn-add-product {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.25);
    color: #a78bfa;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', 'Inter', sans-serif;
}
.de-btn-add-product:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.4);
}

.de-products-table-wrap {
    min-height: 80px;
    overflow: visible;
    padding-bottom: 160px;
}

.de-products-table {
    width: 100%;
    border-collapse: collapse;
}
.de-products-table th {
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: #141b2d;
    z-index: 1;
}
.de-products-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.de-products-table input {
    width: 100%;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.83rem;
    font-family: 'DM Sans', 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.de-products-table input:focus {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.de-products-table input[type="number"] {
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}
.de-products-table input[type="number"]::-webkit-inner-spin-button,
.de-products-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.de-btn-remove-row {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(239, 68, 68, 0.08);
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}
.de-btn-remove-row:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.de-products-empty {
    padding: 30px 20px;
    text-align: center;
    color: #475569;
    font-size: 0.85rem;
    font-family: 'DM Sans', 'Inter', sans-serif;
}

/* ── Readonly auto-filled fields ── */
.ce-readonly-field {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
    color: #94a3b8 !important;
    cursor: default !important;
    font-style: italic;
}

/* ── Stock / Caducidad cell ── */
.ce-stock-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ce-expiry-input {
    min-height: 34px;
    color-scheme: dark;
    color: var(--pv-text-primary, #e2e8f0) !important;
    background: var(--pv-card-surface-solid, #121828) !important;
    border-color: var(--pv-card-border, rgba(56, 73, 107, 0.25)) !important;
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace) !important;
    font-size: var(--pv-text-xs, 0.68rem) !important;
    font-style: normal !important;
    cursor: pointer;
}

.ce-expiry-input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--pv-accent-cyan, #22d3ee) 46%, transparent);
    outline-offset: 2px;
    border-color: var(--pv-accent, #3b82f6) !important;
}

.ce-expiry-input.ce-expiry-manual {
    color: var(--pv-amber-text, #fbbf24) !important;
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 9%, var(--pv-card-surface-solid, #121828)) !important;
    border-color: color-mix(in srgb, var(--pv-amber, #f59e0b) 42%, transparent) !important;
}

.ce-stock-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'DM Sans', monospace;
    white-space: nowrap;
}

.ce-stock-available {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.ce-stock-depleted {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.25);
}

/* ── Lot expiry conflict resolution ── */
.swal2-popup.ce-expiry-resolution-popup {
    box-sizing: border-box;
    max-height: calc(100dvh - 32px);
    color: var(--pv-text-primary, #e2e8f0) !important;
    background: var(--pv-card-surface-solid, #121828) !important;
    border: 1px solid var(--pv-card-border, rgba(56, 73, 107, 0.25));
    border-radius: var(--pv-card-radius, 16px) !important;
    box-shadow: var(--pv-elevation, 0 18px 48px rgba(0, 0, 0, 0.45));
    font-family: var(--pv-font-ui, 'Inter', sans-serif);
}

.ce-expiry-resolution-popup .swal2-title {
    color: var(--pv-text-primary, #e2e8f0) !important;
    font-family: var(--pv-font-ui, 'Inter', sans-serif);
}

.ce-expiry-resolution-popup .swal2-html-container {
    max-height: min(56vh, 560px);
    color: var(--pv-text-primary, #e2e8f0) !important;
    overflow-x: hidden;
    overflow-y: auto;
    text-align: left;
}

.ce-expiry-resolution-popup .swal2-actions {
    gap: 8px;
}

.ce-expiry-resolution-popup .swal2-styled {
    min-height: 42px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: var(--pv-input-radius, 10px);
    font-family: var(--pv-font-ui, 'Inter', sans-serif);
    font-size: var(--pv-text-base, 0.88rem);
    font-weight: 700;
    box-shadow: none;
}

.ce-expiry-resolution-popup .ce-expiry-resolution-confirm {
    color: #fff !important;
    background: var(--pv-accent, #3b82f6) !important;
    border-color: var(--pv-accent, #3b82f6) !important;
}

.ce-expiry-resolution-popup .ce-expiry-resolution-deny {
    color: var(--pv-amber-text, #fbbf24) !important;
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 13%, transparent) !important;
    border-color: color-mix(in srgb, var(--pv-amber, #f59e0b) 34%, transparent) !important;
}

.ce-expiry-resolution-popup .ce-expiry-resolution-cancel {
    color: var(--pv-text-secondary, #8091a7) !important;
    background: color-mix(in srgb, var(--pv-text-secondary, #8091a7) 11%, transparent) !important;
    border-color: var(--pv-card-border, rgba(56, 73, 107, 0.25)) !important;
}

.ce-expiry-resolution-popup .swal2-styled:focus-visible {
    outline: 3px solid var(--pv-accent-cyan, #22d3ee);
    outline-offset: 3px;
}

.ce-expiry-resolution,
.ce-expiry-impact {
    color: var(--pv-text-primary, #e2e8f0);
    font-family: var(--pv-font-ui, 'Inter', sans-serif);
}

.ce-expiry-resolution-copy,
.ce-expiry-resolution-note,
.ce-expiry-impact > p {
    color: var(--pv-text-secondary, #8091a7);
    font-size: var(--pv-text-base, 0.88rem);
    line-height: 1.5;
}

.ce-expiry-resolution-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.ce-expiry-resolution-meta > div,
.ce-expiry-impact-metric {
    padding: 9px 11px;
    background: color-mix(in srgb, var(--pv-bg-base, #0a0e1a) 74%, transparent);
    border: 1px solid var(--pv-card-border, rgba(56, 73, 107, 0.25));
    border-radius: var(--pv-input-radius, 10px);
}

.ce-expiry-resolution-meta dt {
    color: var(--pv-text-muted, #9fb0c4);
    font-size: var(--pv-text-xs, 0.68rem);
    font-weight: 700;
    text-transform: uppercase;
}

.ce-expiry-resolution-meta dd {
    margin: 4px 0 0;
    color: var(--pv-text-primary, #e2e8f0);
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace);
}

.ce-expiry-resolution-reason {
    padding: 9px 11px;
    color: var(--pv-amber-text, #fbbf24);
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--pv-amber, #f59e0b) 25%, transparent);
    border-radius: var(--pv-input-radius, 10px);
    font-size: var(--pv-text-sm, 0.78rem);
}

.ce-expiry-resolution-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.ce-expiry-date-badge {
    padding: 4px 8px;
    color: var(--pv-amber-text, #fbbf24);
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--pv-amber, #f59e0b) 28%, transparent);
    border-radius: 999px;
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace);
    font-size: var(--pv-text-xs, 0.68rem);
}

.ce-expiry-date-badge--empty {
    color: var(--pv-text-muted, #9fb0c4);
    background: transparent;
    border-color: var(--pv-card-border, rgba(56, 73, 107, 0.25));
}

.ce-expiry-resolution-label {
    display: block;
    margin: 12px 0 6px;
    color: var(--pv-text-secondary, #8091a7);
    font-size: var(--pv-text-sm, 0.78rem);
    font-weight: 700;
}

.ce-expiry-resolution-input {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    padding: 8px 11px;
    color: var(--pv-text-primary, #e2e8f0);
    color-scheme: dark;
    background: var(--pv-bg-base, #0a0e1a);
    border: 1px solid var(--pv-card-border, rgba(56, 73, 107, 0.25));
    border-radius: var(--pv-input-radius, 10px);
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace);
}

.ce-expiry-resolution-input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--pv-accent-cyan, #22d3ee) 45%, transparent);
    outline-offset: 2px;
    border-color: var(--pv-accent, #3b82f6);
}

.ce-expiry-impact-dates {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 14px 0;
    padding: 10px;
    color: var(--pv-text-secondary, #8091a7);
    background: var(--pv-bg-base, #0a0e1a);
    border: 1px solid var(--pv-card-border, rgba(56, 73, 107, 0.25));
    border-radius: var(--pv-input-radius, 10px);
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace);
}

.ce-expiry-impact-dates strong {
    color: var(--pv-green-text, #4ade80);
}

.ce-expiry-impact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ce-expiry-impact-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--pv-text-secondary, #8091a7);
    font-size: var(--pv-text-sm, 0.78rem);
}

.ce-expiry-impact-metric strong {
    color: var(--pv-accent-cyan, #22d3ee);
    font-family: var(--pv-font-mono, 'JetBrains Mono', monospace);
    font-size: var(--pv-text-lg, 1.05rem);
}

@media (max-width: 640px) {
    .swal2-popup.ce-expiry-resolution-popup {
        width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 24px);
    }

    .ce-expiry-resolution-meta,
    .ce-expiry-impact-grid {
        grid-template-columns: 1fr;
    }

    .ce-expiry-resolution-popup .swal2-actions {
        width: 100%;
    }

    .ce-expiry-resolution-popup .swal2-styled {
        flex: 1;
        min-width: 0;
        padding-inline: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ce-expiry-input,
    .ce-expiry-resolution-popup .swal2-styled {
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════════════
   SKU Autocomplete
   ══════════════════════════════════════════════════════════════ */
.de-sku-cell {
    position: relative;
    overflow: visible !important;
}

.de-sku-wrapper {
    position: relative;
}

.de-sku-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 380px;
    z-index: 9999;
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(99, 102, 241, 0.1);
    display: none;
    margin-top: 4px;
}

.de-sku-suggestions.active {
    display: block;
    animation: de-dropdown-in 0.15s ease;
}

@keyframes de-dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.de-sku-option {
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.82rem;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.de-sku-option:last-child {
    border-bottom: none;
}
.de-sku-option:hover,
.de-sku-option.active {
    background: rgba(99, 102, 241, 0.12);
}
.de-sku-option .sku-code {
    font-weight: 700;
    color: #818cf8;
    min-width: 80px;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}
.de-sku-option .sku-name {
    color: #cbd5e1;
    font-size: 0.8rem;
    white-space: normal;
    line-height: 1.3;
}

/* ══════════════════════════════════════════════════════════════
   Modal Footer
   ══════════════════════════════════════════════════════════════ */
.de-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.de-btn-print-envio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', 'Inter', sans-serif;
}
.de-btn-print-envio:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}
/* Push cancel/submit to the right after the last print-style button */
.de-btn-print-envio + .de-btn-cancel {
    margin-left: auto;
}

.de-btn-cancel {
    padding: 9px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', 'Inter', sans-serif;
}
.de-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.de-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 22px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    border: none;
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', 'Inter', sans-serif;
}
.de-btn-submit:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}
.de-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ══════════════════════════════════════════════════════════════
   Distribución — Compact Layout Overrides (~90% density)
   Scoped to #section-distribucion so other modules are unaffected
   ══════════════════════════════════════════════════════════════ */

/* ── KPIs ── */
#section-distribucion .ho-kpi-row {
    gap: 10px;
    margin-bottom: 12px;
}
#section-distribucion .ho-kpi-card {
    padding: 12px 14px;
}
#section-distribucion .ho-kpi-label {
    font-size: 0.62rem;
    margin-bottom: 3px;
}
#section-distribucion .ho-kpi-value {
    font-size: 1.3rem;
}
#section-distribucion .ho-kpi-sub {
    font-size: 0.62rem;
    margin-top: 2px;
}

/* ── Toolbar ── */
#section-distribucion .ho-toolbar {
    padding: 7px 10px;
    margin-bottom: 8px;
    gap: 6px;
}
#section-distribucion .ho-toolbar-left {
    flex-wrap: wrap;
}
#section-distribucion .ho-toolbar-title {
    font-size: 0.88rem;
}
#section-distribucion .ho-count-pill {
    font-size: 0.68rem;
    padding: 1px 8px;
}
#section-distribucion .ho-lote-pending-pill {
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
#section-distribucion .ho-lote-pending-pill:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.45);
}
#section-distribucion .ho-search-input {
    padding: 5px 10px 5px 30px;
    font-size: 0.74rem;
    min-width: 220px;
    background-size: 13px;
    background-position: 8px center;
}
#section-distribucion .ho-select-filter {
    padding: 4px 8px;
    font-size: 0.68rem;
}
#section-distribucion .ho-btn-create {
    padding: 5px 12px;
    font-size: 0.74rem;
    gap: 4px;
    border-radius: 6px;
}

/* ── Table ── */
#section-distribucion .ho-table-container {
    max-height: 74vh;
}
#section-distribucion .ho-table-container table {
    font-size: 0.74rem;
}
#section-distribucion .ho-th {
    padding: 7px 10px;
    font-size: 0.6rem;
}
#section-distribucion .ho-td {
    padding: 5px 10px;
    font-size: 0.72rem;
}
#section-distribucion .ho-td-date {
    font-size: 0.7rem;
}
#section-distribucion .ho-td-prov {
    font-size: 0.7rem;
}
#section-distribucion .ho-td-money {
    font-size: 0.7rem;
}
#section-distribucion .ho-td-qty {
    font-size: 0.7rem;
}
#section-distribucion .ho-status {
    padding: 2px 8px;
    font-size: 0.6rem;
    min-width: 60px;
}
#section-distribucion .ho-row-sin-lote {
    background: rgba(245, 158, 11, 0.035);
}
#section-distribucion .ho-lote-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 96px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 0.62rem;
    font-weight: 800;
    font-family: 'DM Sans', 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
}
#section-distribucion .ho-lote-badge small {
    font-size: 0.55rem;
    font-weight: 700;
    opacity: 0.82;
}
#section-distribucion .ho-lote-badge--pending {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}
#section-distribucion .ho-lote-badge--pending:hover {
    background: rgba(245, 158, 11, 0.22);
}
#section-distribucion .ho-lote-badge--verified {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    color: #86efac;
}
#section-distribucion .ho-lote-badge--verified:hover {
    background: rgba(34, 197, 94, 0.2);
}
#section-distribucion .ho-lote-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}
#section-distribucion .ho-lote-muted {
    color: #475569;
    font-size: 0.72rem;
}

/* ── Inline Add Row Button ── */
.ce-add-row-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 0;
    background: transparent;
    border: 1px dashed rgba(148, 163, 184, 0.15);
    border-top: none;
    border-radius: 0 0 8px 8px;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ce-add-row-btn:hover {
    background: rgba(99, 102, 241, 0.06);
    color: #a78bfa;
    border-color: rgba(99, 102, 241, 0.25);
}
.ce-add-row-btn:hover svg {
    stroke: #a78bfa;
}


/* ══════════════════════════════════════════════════════════════
   Product Actions — Checkboxes, Confirmed State, Action Bar
   ══════════════════════════════════════════════════════════════ */

/* ── Custom Checkbox ── */
.ce-checkbox-cell {
    width: 36px !important;
    text-align: center !important;
    padding: 0 4px !important;
}

.ce-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    width: 18px;
    height: 18px;
}

.ce-checkbox-wrap input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ce-checkbox-mark {
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.5);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ce-checkbox-wrap input:checked + .ce-checkbox-mark {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    border-color: #6366f1;
}

.ce-checkbox-wrap input:checked + .ce-checkbox-mark::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-0.5px, -0.5px);
}

.ce-checkbox-wrap input:indeterminate + .ce-checkbox-mark {
    background: rgba(99, 102, 241, 0.4);
    border-color: #6366f1;
}

.ce-checkbox-wrap input:indeterminate + .ce-checkbox-mark::after {
    content: '';
    display: block;
    width: 8px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.ce-checkbox-wrap:hover .ce-checkbox-mark {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.1);
}

/* ── Selected Row Highlight ── */
.ce-row-selected {
    background: rgba(99, 102, 241, 0.08) !important;
}

.ce-row-selected td {
    border-color: rgba(99, 102, 241, 0.15) !important;
}

/* ── Confirmed Quantity (green) ── */
.ce-confirmed {
    background: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
    color: #4ade80 !important;
    font-weight: 700 !important;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.2);
}

/* ── Sticky Toolbar Row (search + actions + stats) ── */
.ce-sticky-toolbar-row td {
    position: sticky;
    top: 33px; /* below the column header row */
    background: #141b2d;
    z-index: 1;
    padding: 0 !important;
    border-bottom: 1px solid rgba(99, 102, 241, 0.12) !important;
}

.ce-sticky-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
}

.ce-sticky-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Confirmation status filter */
.ce-conf-filter {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 2px;
}
.ce-conf-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #64748b;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.ce-conf-btn:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
}
.ce-conf-btn--active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}
.ce-conf-btn--active:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #c4b5fd;
}

.ce-sticky-toolbar-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.ce-sticky-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 3px 8px;
    min-width: 160px;
    max-width: 220px;
    transition: border-color 0.2s;
}
.ce-sticky-search-wrap:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(255, 255, 255, 0.06);
}

.ce-sticky-search {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 0.72rem !important;
    color: #e2e8f0 !important;
    outline: none !important;
    width: 100% !important;
    font-family: 'DM Sans', sans-serif !important;
}
.ce-sticky-search::placeholder {
    color: #475569;
}

.ce-search-clear-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s;
}
.ce-search-clear-btn:hover { color: #f87171; }

.ce-sticky-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.ce-sticky-divider {
    color: #334155;
}

.ce-sticky-sel-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    font-size: 0.66rem;
    font-weight: 700;
    color: #a78bfa;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.ce-sticky-action {
    padding: 3px 8px !important;
    font-size: 0.68rem !important;
    gap: 3px !important;
    border-radius: 5px !important;
}

/* ── Floating Action Bar ── */
.ce-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    margin-top: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    animation: ce-action-bar-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ce-action-bar-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ce-action-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #c7d2fe;
    font-family: 'DM Sans', sans-serif;
}

.ce-action-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ce-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ce-action-confirm {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.25);
}
.ce-action-confirm:hover {
    background: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.4);
}

.ce-action-unconfirm {
    background: rgba(239, 68, 68, 0.10);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.22);
}
.ce-action-unconfirm:hover {
    background: rgba(239, 68, 68, 0.20);
    border-color: rgba(239, 68, 68, 0.4);
}

.ce-action-move {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}
.ce-action-move:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.4);
}

.ce-action-deselect {
    background: rgba(148, 163, 184, 0.08);
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.2);
    padding: 5px 8px;
}
.ce-action-deselect:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
}


/* ══════════════════════════════════════════════════════════════
   Move to Draft Dialog
   ══════════════════════════════════════════════════════════════ */

.ce-move-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: de-fade-in 0.2s ease;
}

.ce-move-container {
    width: 440px;
    max-width: 92vw;
    max-height: 80vh;
    background: linear-gradient(165deg, #1e293b, #0f172a);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.08);
    overflow: hidden;
    animation: de-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ce-move-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.12);
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.ce-move-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #64748b;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}
.ce-move-close:hover { color: #f87171; }

.ce-move-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.ce-move-section-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.ce-move-borrador-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.ce-borrador-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'DM Sans', sans-serif;
}
.ce-borrador-option:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    border-left: 3px solid #818cf8;
}

.ce-borrador-code {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
}

.ce-borrador-meta {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

.ce-move-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
}
.ce-move-divider::before,
.ce-move-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.12);
}

.ce-move-new-form {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.ce-move-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.2s;
}
.ce-move-input:focus {
    border-color: rgba(99, 102, 241, 0.5);
}
.ce-move-input::placeholder {
    color: #475569;
}

.ce-move-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.ce-move-create-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#ce-smart-fill-execute[aria-busy="true"] {
    cursor: wait !important;
    opacity: 0.75;
}
#ce-smart-fill-execute .ce-move-spinner-icon {
    border-top-color: currentColor;
    margin-right: 0;
}

/* ── Move Spinner ── */
.ce-move-spinner-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: ce-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}
@keyframes ce-spin {
    to { transform: rotate(360deg); }
}

/* ── Autosave Status Indicator ── */
.ce-autosave-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #4ade80;
    font-family: 'DM Sans', sans-serif;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    user-select: none;
}
.ce-autosave-status:empty {
    display: none;
}
.ce-autosave-flash {
    animation: ce-autosave-pulse 0.6s ease;
}
@keyframes ce-autosave-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 0.7; }
}

/* ── Cache Restore Banner ── */
.ce-cache-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    margin-bottom: 12px;
    animation: ce-action-bar-in 0.3s ease;
}
.ce-cache-banner-text {
    flex: 1;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: #fbbf24;
}
.ce-cache-banner-text small {
    display: block;
    font-size: 0.68rem;
    color: #92751a;
    margin-top: 1px;
}
.ce-cache-restore-btn {
    padding: 4px 12px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.ce-cache-restore-btn:hover {
    background: rgba(245, 158, 11, 0.25);
}
.ce-cache-dismiss-btn {
    padding: 4px 6px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.ce-cache-dismiss-btn:hover { color: #f87171; }

/* Avisos de programación de envíos Mercado Libre Full */
#nav-distribucion-historico .nav-attention-alert { margin-left: 6px; vertical-align: middle; }
.de-programacion-banner {
    --de-alert-color: #fbbf24;
    --de-alert-line: rgba(245, 158, 11, .3);
    margin-bottom: 16px;
    padding: 14px 16px;
    background: rgba(245, 158, 11, .07);
    border: 1px solid var(--de-alert-line);
    border-radius: 10px;
    color: #e2e8f0;
}
.de-programacion-banner[hidden] { display: none; }
.de-programacion-banner.is-critical {
    --de-alert-color: #f87171;
    --de-alert-line: rgba(248, 113, 113, .35);
    background: rgba(239, 68, 68, .065);
}
.de-programacion-heading { display: flex; align-items: center; gap: 8px; color: var(--de-alert-color); font-size: .85rem; }
.de-programacion-heading > span {
    display: inline-grid; place-items: center; width: 19px; height: 19px;
    flex: 0 0 19px; border: 1px solid currentColor; border-radius: 50%; font-weight: 800;
}
.de-programacion-intro { margin: 7px 0 12px; color: #cbd5e1; font-size: .76rem; line-height: 1.5; }
.de-programacion-list { list-style: none; padding: 0; margin: 0; max-height: 290px; overflow-y: auto; }
.de-programacion-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 0; border-top: 1px solid rgba(148, 163, 184, .13); font-size: .76rem;
}
.de-programacion-item > div { min-width: 0; overflow-wrap: anywhere; }
.de-programacion-item strong { color: #fbbf24; font-family: 'JetBrains Mono', monospace; }
.de-programacion-item.is-critical strong { color: #f87171; }
.de-programacion-date { display: inline-block; margin-left: 12px; color: #94a3b8; }
.de-programacion-item p { margin: 4px 0 0; line-height: 1.5; }
.de-programacion-edit, .de-programacion-refresh-error button {
    border: 1px solid var(--de-alert-line); border-radius: 6px; background: rgba(15, 23, 42, .35);
    color: var(--de-alert-color); padding: 6px 10px; cursor: pointer; font: inherit; white-space: nowrap;
}
.de-programacion-edit:hover, .de-programacion-refresh-error button:hover { background: rgba(148, 163, 184, .12); }
.de-programacion-edit:focus-visible, .de-programacion-refresh-error button:focus-visible { outline: 2px solid var(--de-alert-color); outline-offset: 2px; }
.de-programacion-refresh-error { margin: 6px 0; color: #cbd5e1; font-size: .76rem; }
#section-distribucion .ho-programacion-badge {
    display: flex; align-items: center; gap: 4px; width: fit-content; margin-top: 4px;
    padding: 2px 5px; border-radius: 4px; background: rgba(245, 158, 11, .12); color: #fbbf24;
    font-size: .59rem; font-family: 'DM Sans', sans-serif; font-weight: 700; white-space: nowrap;
}
#section-distribucion .ho-programacion-badge.is-critical { color: #f87171; background: rgba(239, 68, 68, .12); }
#section-distribucion .ho-row-programacion { background: rgba(245, 158, 11, .035); }
#section-distribucion .ho-row-programacion.is-critical { background: rgba(239, 68, 68, .045); }
@media (max-width: 640px) {
    .de-programacion-banner { padding: 12px; }
    .de-programacion-item { align-items: flex-start; flex-direction: column; gap: 8px; }
    .de-programacion-date { display: block; margin: 4px 0 0; }
}


.ce-variant-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(129, 140, 248, 0.25);
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.07);
}
.ce-variant-bar[hidden] { display: none; }
.ce-variant-control { flex: 0 1 310px; min-width: 210px; }
.ce-variant-control label { display: block; margin-bottom: 7px; color: #a5b4fc; font-size: 0.75rem; font-weight: 700; }
.ce-variant-control select { width: 100%; padding: 9px 12px; border: 1px solid rgba(129, 140, 248, 0.3); border-radius: 8px; background: #151a2b; color: #e2e8f0; font: inherit; font-size: 0.85rem; }
.ce-variant-control select:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }
.ce-variant-control select:disabled { opacity: 0.65; }
#ce-variant-note { flex: 1; margin: 0; color: #94a3b8; font-size: 0.76rem; line-height: 1.5; }
@media (max-width: 700px) {
    .ce-variant-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .ce-variant-control { flex: auto; min-width: 0; }
}
