/* =========================================================
   工場マップ（原料棚 / 仕込みエリア / 仮置きステージ）
   ========================================================= */
.map-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.map-main { flex: 1 1 640px; min-width: 0; }
.map-side { flex: 0 0 280px; }

/* ---------- 棚 ---------- */
.shelf { margin-bottom: 16px; }
.shelf-hd {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 13px; margin-bottom: 5px;
}
.shelf-hd .shelf-sum { font-weight: 400; font-size: 11px; color: var(--ink-sub); }

.shelf-grid { display: grid; gap: 4px; }
.cell {
    position: relative;
    background: #fff;
    border: 1px solid var(--line-dark);
    border-radius: 5px;
    min-height: 62px;
    padding: 3px 4px 4px;
    cursor: pointer;
    user-select: none;
    display: flex; flex-direction: column; gap: 1px;
    transition: box-shadow .12s, transform .12s;
}
.cell:hover { box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.cell.is-empty { background: #f7f7f3; border-style: dashed; color: #b5b5ae; }
.cell.dragging { opacity: .45; }
.cell.drag-over { border-color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.cell.pick-target { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.cell.is-busy { opacity: .5; pointer-events: none; }

.cell-loc { font-size: 9.5px; color: var(--ink-sub); letter-spacing: .02em; }
.cell-short { font-size: 12px; font-weight: 700; line-height: 1.25; word-break: break-all; }
.cell-qty { font-size: 11px; font-variant-numeric: tabular-nums; margin-top: auto; }
.cell-lot { font-size: 9.5px; color: var(--ink-sub); }
.cell-mix-flag {
    position: absolute; right: 3px; top: 3px;
    font-size: 9px; padding: 0 3px; border-radius: 3px;
    background: rgba(108,52,131,.14); color: var(--purple);
}
.cell-kind-tag {
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    border-radius: 5px 0 0 5px;
}
.cell-lock { position: absolute; right: 3px; bottom: 3px; font-size: 10px; }

/* 仕込みエリア（製造場） */
.fac-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cell-fac { background: #f4f7f4; border-color: #b9ccb9; }
.cell-fac.is-empty { background: #f2f5f2; }

/* 仮置きゾーン */
.stage-grid { display: grid; grid-template-columns: repeat(11, minmax(0,1fr)); gap: 4px; }
.stage-grid .cell { min-height: 54px; background: var(--tint-blue); }
.stage-grid .cell.is-empty { background: #f3f6fa; }

/* ---------- サイド ---------- */
.side-box {
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    padding: 10px; margin-bottom: 12px;
}
.side-box h4 { margin: 0 0 7px; font-size: 12px; }
.hist-list { max-height: 260px; overflow: auto; }
.hist-row { border-bottom: 1px dotted var(--line); padding: 4px 0; font-size: 11.5px; }
.hist-row:last-child { border-bottom: 0; }
.hist-row b { font-weight: 700; }
.hist-at { color: var(--ink-sub); font-size: 10.5px; }
.hist-qty.plus  { color: var(--green); }
.hist-qty.minus { color: var(--red); }

/* ---------- 明細モーダル ---------- */
.lot-row {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 7px 10px; margin-bottom: 7px;
}
.lot-row .lot-main { flex: 1; min-width: 0; }
.lot-row .lot-name { font-weight: 700; }
.lot-row .lot-meta { font-size: 11px; color: var(--ink-sub); }
.lot-row .lot-qty { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

.op-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- 資材行（一覧表示） ---------- */
.mat-row {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--line); border-radius: 6px;
    padding: 8px 12px; margin-bottom: 6px; cursor: pointer;
}
.mat-row:hover { background: var(--tint-blue); }
.mat-row .mr-name { flex: 1; font-weight: 700; }
.mat-row .mr-kind { font-size: 11px; color: var(--ink-sub); }
.mat-row .mr-qty { font-variant-numeric: tabular-nums; font-weight: 700; }
.mat-row .mr-locs { font-size: 11px; color: var(--ink-sub); }

@media (max-width: 900px) {
    .map-side { flex: 1 1 100%; }
}
