/* ============================================================
   Combo de seleccion multiple
   ============================================================ */

.multi-select {
    position: relative;
}

.multi-select-input {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 8px;
    color: #172033;
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    min-height: 36px;
    overflow: hidden;
    padding: 7px 28px 7px 10px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.multi-select-input.is-empty {
    color: #94a3b8;
}

.multi-select-input:focus {
    border-color: #1d4ed8;
    outline: none;
}

.multi-select-backdrop {
    inset: 0;
    position: fixed;
    z-index: 40;
}

.multi-select-list {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 34, 62, 0.18);
    left: 0;
    margin-top: 4px;
    max-height: 300px;
    min-width: 100%;
    overflow-y: auto;
    padding: 4px;
    position: absolute;
    top: 100%;
    width: max-content;
    z-index: 41;
}

.multi-select-tools {
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 14px;
    margin-bottom: 4px;
    padding: 4px 9px 7px;
}

.multi-select-tools button {
    background: none;
    border: 0;
    color: #1d4ed8;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0;
}

.multi-select-option {
    align-items: center;
    border-radius: 5px;
    color: #1f2f47;
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 8px;
    padding: 7px 9px;
}

.multi-select-option:hover {
    background: #eaf2ff;
}

/* ============================================================
   Consulta Stock 3D
   ============================================================ */

.s3d-body {
    display: grid;
    gap: 12px;
    grid-template-columns: 340px minmax(0, 1fr);
    min-height: 560px;
}

@media (min-width: 981px) {
    .s3d-body {
        flex: 1 1 auto;
        min-height: 0;
    }
}

@media (max-width: 980px) {
    .s3d-body {
        grid-template-columns: 1fr;
    }

    .s3d-stage {
        min-height: 60vh;
    }
}

.s3d-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
}

.s3d-card {
    background: #ffffff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    padding: 12px;
}

.s3d-card h3 {
    color: #1f2f47;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.s3d-search {
    display: flex;
    gap: 6px;
}

.s3d-search input {
    border: 1px solid #c3d0e0;
    border-radius: 8px;
    flex: 1;
    font: inherit;
    font-size: 0.88rem;
    min-width: 0;
    padding: 7px 10px;
}

.s3d-search input:focus {
    border-color: #1d4ed8;
    outline: none;
}

.s3d-check {
    align-items: center;
    color: #334155;
    display: flex;
    font-size: 0.84rem;
    font-weight: 600;
    gap: 7px;
    margin-top: 10px;
}

.s3d-legend {
    display: grid;
    gap: 6px;
}

.s3d-legend div {
    align-items: center;
    color: #334155;
    display: flex;
    font-size: 0.84rem;
    gap: 8px;
}

.s3d-legend strong {
    margin-left: auto;
}

.s3d-swatch {
    border-radius: 3px;
    flex: none;
    height: 14px;
    width: 14px;
}

.s3d-swatch.is-empty { background: rgba(107, 134, 166, 0.35); border: 1px solid #6b86a6; }
.s3d-swatch.is-stock { background: #2ea043; }
.s3d-swatch.is-blocked { background: #e5534b; }
.s3d-swatch.is-hit { background: #ffc933; }

.s3d-note {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 8px 0 0;
}

.s3d-results {
    max-height: 260px;
    overflow: auto;
}

.s3d-results table,
.s3d-detail table {
    border-collapse: collapse;
    font-size: 0.78rem;
    width: 100%;
}

.s3d-results th,
.s3d-detail th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 5px 6px;
    position: sticky;
    text-align: left;
    top: 0;
}

.s3d-results td,
.s3d-detail td {
    border-top: 1px solid #e8eef6;
    padding: 5px 6px;
}

.s3d-results tbody tr {
    cursor: pointer;
}

.s3d-results tbody tr:hover {
    background: #eaf2ff;
}

.s3d-results td.num,
.s3d-detail td.num {
    text-align: right;
}

.s3d-stage {
    background: #0f1720;
    border: 1px solid #1f2d3f;
    border-radius: 10px;
    min-height: 420px;
    overflow: hidden;
    position: relative;
}

.s3d-canvas {
    height: 100%;
    inset: 0;
    position: absolute;
    width: 100%;
}

.s3d-canvas canvas {
    display: block;
}

.s3d-stage .loading-overlay {
    z-index: 6;
}

.s3d-tools {
    display: flex;
    gap: 6px;
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 5;
}

.s3d-tools .tool-button {
    background: rgba(15, 23, 32, 0.78);
    border-color: #35475e;
    color: #e2e8f0;
}

.s3d-help {
    background: rgba(15, 23, 32, 0.78);
    border-radius: 6px;
    bottom: 10px;
    color: #94a3b8;
    font-size: 0.74rem;
    left: 10px;
    padding: 5px 9px;
    position: absolute;
    z-index: 5;
}

.s3d-empty {
    color: #94a3b8;
    left: 50%;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
}

.s3d-tip {
    background: rgba(15, 23, 32, 0.94);
    border: 1px solid #35475e;
    border-radius: 6px;
    color: #e2e8f0;
    display: grid;
    font-size: 0.78rem;
    gap: 2px;
    padding: 6px 9px;
    pointer-events: none;
    position: absolute;
    z-index: 7;
}

.s3d-tip[hidden] {
    display: none;
}

.s3d-tip strong {
    color: #ffffff;
}

/* Los estilos globales de input estiran las casillas: aqui se dejan de tamaño natural. */
.multi-select-option input,
.s3d-check input {
    flex: none;
    height: 16px;
    margin: 0;
    min-height: 0;
    padding: 0;
    width: 16px;
}

/* ---------- Filtro en una sola linea ---------- */

.s3d-inline-actions {
    align-self: flex-end;
    margin: 0;
    padding: 0;
}

/* ---------- Ocupacion ---------- */

.s3d-occ-total {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.s3d-occ-total strong {
    color: #0f172a;
    font-size: 1.7rem;
    line-height: 1;
}

.s3d-occ-total span {
    color: #64748b;
    font-size: 0.78rem;
}

.s3d-bar {
    background: #e2e8f0;
    border-radius: 999px;
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
}

.s3d-bar > div {
    background: linear-gradient(90deg, #2ea043, #facc15, #e5534b);
    background-size: 100vw 100%;
    border-radius: 999px;
    height: 100%;
}

.s3d-bar.is-small {
    height: 5px;
    margin-top: 3px;
}

.s3d-blocks {
    border-top: 1px solid #e8eef6;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
}

.s3d-blocks > div {
    align-items: baseline;
    display: grid;
    gap: 0 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.s3d-blocks span {
    color: #334155;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.s3d-blocks strong {
    font-size: 0.8rem;
}

.s3d-blocks .s3d-bar {
    grid-column: 1 / -1;
}

/* ---------- Mapa de calor ---------- */

.s3d-heat-bar {
    background: linear-gradient(90deg, hsl(119, 80%, 50%), hsl(60, 80%, 50%), hsl(0, 80%, 50%));
    border-radius: 4px;
    height: 12px;
}

.s3d-heat-scale {
    color: #64748b;
    display: flex;
    font-size: 0.74rem;
    justify-content: space-between;
    margin-top: 3px;
}

/* ---------- Selectores de vista sobre el 3D ---------- */

.s3d-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
    left: 10px;
    max-width: calc(100% - 20px);
}

.s3d-seg {
    background: rgba(15, 23, 32, 0.82);
    border: 1px solid #35475e;
    border-radius: 8px;
    display: flex;
    overflow: hidden;
}

.s3d-seg-btn {
    background: none;
    border: 0;
    border-right: 1px solid #35475e;
    color: #cbd5e1;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 11px;
}

.s3d-seg-btn:last-child {
    border-right: 0;
}

.s3d-seg-btn:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.18);
}

.s3d-seg-btn.is-active {
    background: #1d4ed8;
    color: #ffffff;
}

.s3d-seg-btn:disabled {
    cursor: default;
    opacity: 0.45;
}

/* ---------- Modo caminar ---------- */

.s3d-walkhud {
    bottom: 38px;
    display: flex;
    gap: 6px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    z-index: 5;
}

.s3d-walkhud[hidden] {
    display: none;
}

.s3d-walkhud button {
    background: rgba(15, 23, 32, 0.82);
    border: 1px solid #35475e;
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 7px 12px;
}

.s3d-walkhud button:hover {
    background: #1d4ed8;
}

/* Mira central, para apuntar a una ubicacion al caminar. */
.s3d-stage.is-walking::after {
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    content: "";
    height: 8px;
    left: 50%;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    z-index: 4;
}

/* ============================================================
   Consulta Flujo Picking 3D
   ============================================================ */

.pf-waves {
    max-height: 230px;
}

.pf-waves small {
    color: #64748b;
    font-size: 0.7rem;
}

.pf-waves tr.is-picked td,
.pf-steps tr.is-picked td {
    background: #eaf2ff;
}

.pf-steps {
    max-height: 340px;
}

.pf-steps tr.is-current td {
    background: #fff4cc;
}

.pf-steps small,
.pf-method small {
    color: #64748b;
    font-size: 0.72rem;
}

.pf-trace {
    margin-top: 8px;
    width: 100%;
}

.pf-num {
    background: #ffc933;
    border-radius: 999px;
    color: #0f1720;
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    min-width: 24px;
    padding: 2px 6px;
    text-align: center;
}

.pf-num.is-done {
    background: #34d399;
}

.pf-methods {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pf-method {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    color: #1f2f47;
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 8px;
    justify-content: space-between;
    padding: 7px 9px;
    text-align: left;
}

.pf-method:hover {
    background: #eef4fc;
}

.pf-method.is-active {
    background: #eaf2ff;
    border-color: #1d4ed8;
    box-shadow: inset 3px 0 0 #1d4ed8;
}

.pf-method strong {
    display: block;
    font-size: 0.82rem;
}

.pf-method-res {
    flex: none;
    text-align: right;
}

.pf-method-res b {
    display: block;
    font-size: 0.82rem;
}

.pf-kpis {
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 8px;
}

.pf-kpis > div {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 7px 10px;
}

.pf-kpis > div.is-wide {
    background: #eaf2ff;
    grid-column: 1 / -1;
}

.pf-kpis span {
    color: #64748b;
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.pf-kpis strong {
    color: #1f2f47;
    font-size: 1.05rem;
}

.pf-kpis .is-wide strong {
    font-size: 1.3rem;
}

.pf-summary {
    border-collapse: collapse;
    font-size: 0.8rem;
    width: 100%;
}

.pf-summary td {
    border-top: 1px solid #e8eef6;
    padding: 4px 2px;
}

.pf-summary td:last-child {
    font-weight: 700;
    text-align: right;
}

.pf-params {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}

.pf-params label {
    color: #475569;
    display: flex;
    flex-direction: column;
    font-size: 0.72rem;
    gap: 3px;
}

.pf-params input {
    border: 1px solid #c3d0e0;
    border-radius: 6px;
    font: inherit;
    font-size: 0.85rem;
    padding: 5px 7px;
}

.pf-warn {
    color: #b45309;
}

.pf-ops {
    max-height: 200px;
}

.pf-ops tr.is-picked td {
    background: #eaf2ff;
}

.pf-ops small {
    color: #64748b;
    font-size: 0.7rem;
}

/* Panel en vivo del operario durante el recorrido animado */
.pf-hud {
    background: rgba(15, 23, 32, 0.82);
    border: 1px solid #35475e;
    border-left: 4px solid #ff7a00;
    border-radius: 8px;
    bottom: 44px;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    gap: 3px;
    left: 10px;
    max-width: 300px;
    padding: 8px 12px;
    position: absolute;
    z-index: 5;
}

.pf-hud-name {
    color: #ffd21f;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pf-hud strong {
    font-size: 0.86rem;
}

.pf-hud span {
    color: #94a3b8;
}

.pf-hud b {
    color: #ffffff;
}

.pf-hud-bar {
    background: #2a3a4f;
    border-radius: 3px;
    height: 5px;
    margin: 3px 0;
    overflow: hidden;
}

.pf-hud-bar > div {
    background: #34d399;
    height: 100%;
    transition: width 0.3s;
}

/* ============================================================
   Disenador de Bodega
   ============================================================ */

.ld-stage {
    background: #0f1720;
}

.ld-host {
    inset: 0;
    position: absolute;
}

.ld-canvas {
    display: block;
    touch-action: none;
}

.ld-coords {
    background: rgba(15, 23, 32, 0.8);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.74rem;
    padding: 3px 8px;
    pointer-events: none;
    position: absolute;
    right: 10px;
    top: 10px;
}

.ld-coords:empty {
    display: none;
}

.ld-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ld-info {
    background: #e8f7ee;
    border: 1px solid #b7e4c7;
    border-radius: 8px;
    color: #1b5e3a;
    font-size: 0.85rem;
    margin-bottom: 8px;
    padding: 8px 12px;
}

.ld-list {
    font-size: 0.76rem;
    margin-top: 4px;
    max-height: 140px;
    overflow: auto;
}

.ld-fixes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* Calidad del plano 3D (v2.20.0): chip abajo a la izquierda; avisa si Automatico bajo de nivel. */
.s3d-quality {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 3;
    display: grid;
    gap: 2px;
    max-width: min(340px, calc(100% - 20px));
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(11, 17, 26, 0.72);
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}
.s3d-quality[data-q="ALTA"] { border-color: rgba(167, 139, 250, 0.7); }
.s3d-quality[data-q="ESTANDAR"] { border-color: rgba(96, 165, 250, 0.7); }
.s3d-quality small {
    font-weight: 500;
    color: #fde68a;
    white-space: normal;
}
.s3d-quality:has(small) { border-radius: 10px; }
