/* ══ 20261027c · EXISTENCIAS (MICROSIP) y ALMACÉN 3D ↔ MICROSIP ══════════
   Usa las variables de css/app.css. Prefijos .ms- (hoja de existencias) y
   .alm- (barra y panel de asignaciones del Almacén 3D).                   */

/* ── Hoja «Existencias (Microsip)» (Inventario › Microsip) ── */
.ms { display: flex; flex-direction: column; gap: .7rem; }
.ms-cab { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; }
.ms-cab .spacer { flex: 1; }
.ms-tit { margin: 0; font-size: 1.15rem; }
.ms-cab p { margin: .1rem 0 0; }
.ms-chip-ok { background: var(--verde-suave); color: var(--bien-texto); border-color: color-mix(in srgb, var(--verde) 30%, transparent); }
.ms-chip-mal { background: color-mix(in srgb, var(--critico) 12%, transparent); color: var(--critico); border-color: color-mix(in srgb, var(--critico) 40%, transparent); font-weight: 700; }
.ms-banda { padding: .6rem .85rem; border-radius: 10px; font-size: .92rem; line-height: 1.4; }
.ms-banda.mal { background: color-mix(in srgb, var(--critico) 10%, var(--superficie, #fff)); color: var(--critico); border: 1px solid color-mix(in srgb, var(--critico) 45%, transparent); }
.ms-filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem; }
.ms-filtros input[type="search"] { flex: 2 1 220px; min-width: 0; }
.ms-filtros select { flex: 1 1 170px; min-width: 0; }
.ms-chk { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; font-size: .92rem; cursor: pointer; }
.ms-chk input { width: auto; margin: 0; }
.ms-totales { display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: space-between; font-size: .9rem; color: var(--ink-2); padding: 0 .2rem .35rem; }
.ms-tot-unidades { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; min-width: 0; }
.ms-tot-u { white-space: nowrap; }
.ms-scroll { max-height: calc(100vh - var(--barra-h, 56px) - var(--volver-h, 0px) - 19rem); min-height: 260px; overflow: auto; }
.ms-tabla thead th { position: sticky; top: 0; z-index: 1; background: var(--superficie-2, #f3f6f5); }
.ms-tabla td, .ms-tabla th { white-space: nowrap; }
.ms-tabla td:nth-child(2) { white-space: normal; min-width: 200px; }
.ms-ord { font: inherit; font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.ms-clave { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.ms-sub, .ms-sub-u { display: none; }
.ms-pie { margin: 0; }
.ms-estado h2 { margin-top: 0; }
.ms-sin-acceso { border-left: 4px solid var(--critico); }
.ms-entrar { max-width: 460px; display: flex; flex-direction: column; gap: .6rem; }
.ms-entrar h2 { margin: 0; }
.ms-entrar label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .92rem; }
.ms-error { color: var(--critico); font-size: .9rem; min-height: 1.1em; }
@media (max-width: 700px) {
  .ms-c-lin, .ms-c-alm, .ms-c-und { display: none; }
  .ms-sub { display: block; font-size: .78rem; color: var(--ink-mudo); font-weight: 400; }
  .ms-sub-u { display: inline; font-size: .78rem; color: var(--ink-mudo); }
  .ms-tabla td:nth-child(2) { min-width: 0; }
  .ms-tabla { font-size: .88rem; }
  .ms-filtros { padding: .5rem; }
  .ms-filtros select { flex: 1 1 45%; }
  .ms-scroll { max-height: none; }
}

/* ── Planta 3D: el marco y el panel de asignaciones van lado a lado ── */
.p3d-cuerpo { flex: 1 1 auto; display: flex; gap: .5rem; min-height: 0; position: relative; }
.p3d-cuerpo .p3d-marco { flex: 1 1 auto; height: auto; }
.alm-barra { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.alm-chip { max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alm-chip.alm-ok { background: var(--verde-suave); color: var(--bien-texto); }
.alm-chip.alm-viejo, .alm-chip.alm-sin-acceso, .alm-chip.alm-error { background: color-mix(in srgb, var(--critico) 12%, transparent); color: var(--critico); font-weight: 700; }
.alm-chip.alm-sin-pase, .alm-chip.alm-sin-nube, .alm-chip.alm-no-activado { background: color-mix(in srgb, var(--alerta) 18%, transparent); color: #6b4a00; }
.alm-asig { flex: 0 0 380px; overflow: auto; background: var(--superficie, #fff); border: 1px solid var(--linea); border-radius: 10px; padding: .75rem .85rem; position: relative; }
.alm-asig[hidden] { display: none; }
.alm-cerrar { position: absolute; top: .3rem; right: .5rem; border: 0; background: none; font-size: 1.5rem; cursor: pointer; color: var(--ink-mudo); }
.alm-tit { margin: 0 0 .2rem; }
.alm-asig .campo { display: flex; flex-direction: column; gap: .2rem; margin: .4rem 0; font-size: .9rem; }
.alm-buscar { width: 100%; margin: .3rem 0 .5rem; }
.alm-lista { display: flex; flex-direction: column; border-top: 1px solid var(--linea); }
.alm-fila { display: grid; grid-template-columns: .8rem 5.2rem 1fr auto; grid-template-areas: "p id art btn" "p id ex btn"; gap: .05rem .45rem; align-items: center; padding: .4rem .1rem; border-bottom: 1px solid var(--linea); font-size: .88rem; }
.alm-fila.editando { background: color-mix(in srgb, var(--azul) 7%, transparent); grid-template-areas: "p id art btn" "p id ex btn" "ed ed ed ed"; }
.alm-punto { grid-area: p; width: .7rem; height: .7rem; border-radius: 3px; }
.alm-id { grid-area: id; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.alm-art { grid-area: art; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alm-ex { grid-area: ex; font-size: .82rem; color: var(--ink-2); }
.alm-fila > .btn { grid-area: btn; }
.alm-editor { grid-area: ed; padding: .3rem 0 .2rem; }
.alm-editor input { width: 100%; }
.alm-verde { background: #1f9d55; } .alm-ambar { background: #e0a800; } .alm-rojo { background: #d03b3b; }
.alm-sindato { background: #6aa5e0; } .alm-gris { background: #b8c0c8; }
.alm-hist { margin-top: .6rem; font-size: .85rem; }
.alm-hist ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.alm-hist li { margin: .15rem 0; }
@media (max-width: 900px) {
  .alm-asig { position: absolute; left: 0; right: 0; bottom: 0; max-height: 62%; flex: none; z-index: 5; box-shadow: 0 -6px 20px rgba(0,0,0,.18); }
}
@media (max-width: 700px) {
  .alm-barra { flex-wrap: nowrap; overflow-x: auto; }
  .alm-chip { max-width: 11rem; }
  .p3d-cabeza { flex-wrap: wrap; }
}
