/* Shelves (0173): every rack drawn as a rack. Layout / Place / Count share one drawing. */

.sh-sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 14px; }
.sh-modes { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sh-mode { background: none; border: 0; border-radius: 0; color: var(--text-secondary); font-size: 15px; padding: 12px 16px;
  border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: 44px; }
.sh-mode:hover { background: none; color: var(--text-primary); }
.sh-mode[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent-text); font-weight: 600; }

.sh-locs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sh-loc { border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: 14px; color: var(--text-secondary); }
.sh-loc[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent-text); color: var(--accent-text); font-weight: 600; }
.sh-loc .n { opacity: .6; margin-left: 5px; font-size: 12px; }

.sh-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.sh-bar .grow { flex: 1 1 auto; }
.sh-progress { font-size: 15px; font-weight: 600; }
.sh-note { font-size: 13px; color: var(--text-secondary); margin: 6px 0 12px; }
.sh-warn { font-size: 13px; color: var(--warning-text); background: var(--warning-bg); border-radius: var(--radius); padding: 8px 10px; margin: 0 0 12px; }
.sh-err { font-size: 13px; color: var(--danger-text); background: var(--danger-bg); border-radius: var(--radius); padding: 8px 10px; margin: 0 0 12px; }
.sh-ok { font-size: 13px; color: var(--accent-text); background: var(--accent-bg); border-radius: var(--radius); padding: 8px 10px; margin: 0 0 12px; }
.sh-moving { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--text-primary); color: #fff; border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.sh-moving button { min-height: 40px; }

/* ---- the rack ---- */
.rack { border: 2px solid var(--border-strong); border-radius: 10px; padding: 6px; background: var(--surface-1, #f4f4f2); }
.shelf { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; padding: 6px 0; border-bottom: 3px solid var(--border-strong); }
.shelf:last-child { border-bottom: 0; }
.shelf-label { flex: 0 0 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 2px; min-height: 56px; border-radius: 6px; background: none; border: 1px solid transparent; color: var(--text-secondary); }
.shelf-label .w { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.shelf-label .k { font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.shelf-label .c { font-size: 10px; color: var(--text-muted); }
.mode-layout .shelf-label { border-color: var(--border-strong); background: var(--surface-2); cursor: pointer; }
.shelf-label.picked { background: var(--accent-text); color: #fff; border-color: var(--accent-text); }
.shelf-label.picked .k, .shelf-label.picked .c { color: #fff; }

.slots { flex: 1 1 calc(100% - 50px); min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
/* Boxes share the width; below 44px they wrap onto another line instead of shrinking (the rack scrolls down, never sideways). */
.slot { flex: 1 1 calc((100% - (var(--n) - 1) * 4px) / var(--n)); min-width: 44px; min-height: 60px; max-width: 100%;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2px;
  padding: 5px 6px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: #fff; color: var(--text-primary);
  text-align: left; overflow: hidden; position: relative; font-size: 12.5px; line-height: 1.2; }
.slot:hover { background: #fff; border-color: var(--text-secondary); }
.slot .no { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.slot .what { width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.slot .many { font-weight: 700; }
/* Tape colour (0175): the swatch AND its name, next to the position number. The swatch's 1px neutral border keeps white
   visible on a white box and black on a counted (dark) box. */
.slot .no { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; width: 100%; }
.slot .tape { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: var(--text-primary); }
.slot .tape i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid; flex: 0 0 auto; }
.slot.counted .tape { color: #fff; }
.tape-h { font-size: 14px; margin: 16px 0 2px; }
.tape-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tape-pos { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2, #fff); font-size: 13.5px; color: var(--text-primary); }
.tape-pos .pn { font-weight: 700; min-width: 1.2ch; }
.tape-pos .none { color: var(--text-muted); font-size: 12.5px; }
button.tape-pos[aria-pressed="true"] { border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }
.tape-pos.ro { cursor: default; }
.tape-choice { font-size: 14px; }
.tape-choice[aria-pressed="true"] .pos-colour { color: #fff; }
.slot.empty .what { color: var(--text-muted); font-size: 16px; }
.slot.whole { flex-basis: 100%; }
.mode-layout .slot { cursor: default; }
.slot.target { border-style: dashed; border-color: var(--text-primary); }
/* Counted: a tick AND a dark fill (lightness, not hue alone). */
.slot.counted { background: var(--accent-text); border-color: var(--accent-text); color: #fff; }
.slot.counted .no { color: rgba(255, 255, 255, .85); }
.slot.counted .tick { position: absolute; top: 3px; right: 5px; font-size: 15px; font-weight: 700; line-height: 1; }

.shelf-extra { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding-left: 50px; }
.chip-btn { align-self: flex-start; font-size: 12.5px; padding: 6px 10px; min-height: 36px; border-radius: 999px; border: 1px dashed var(--warning-text);
  background: var(--warning-bg); color: var(--warning-text); }

/* zero-shelf locations: a list, not a rack */
.flat-list { border: 1px solid var(--border); border-radius: var(--radius); }
.flat-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.flat-row:last-child { border-bottom: 0; }
.flat-row .grow { flex: 1 1 auto; min-width: 0; }

/* ---- layout tools ---- */
.blocks { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.block { display: flex; gap: 6px; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 8px; background: #fff; }
.block b { font-size: 14px; }
.block .s { font-size: 12px; color: var(--text-muted); }
.block button { padding: 6px 10px; font-size: 13px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { min-width: 44px; min-height: 44px; font-size: 18px; padding: 0; }
.stepper .v { min-width: 28px; text-align: center; font-weight: 700; font-size: 16px; }
.sh-h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 18px 0 6px; }

/* ---- the sheet ---- */
.sheet-back { position: fixed; inset: 0; background: rgba(27, 36, 32, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface-2, #fff); width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; border-radius: 14px 14px 0 0;
  padding: 16px 16px 24px; box-shadow: 0 -4px 20px rgba(0, 0, 0, .15); }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 14px; } }
.sheet h2 { font-size: 18px; margin: 0 0 2px; }
.sheet .sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.sheet-actions button { min-height: 44px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.choice { min-width: 44px; min-height: 44px; padding: 6px 10px; font-size: 15px; }
.choice[aria-pressed="true"] { background: var(--accent-text); color: #fff; border-color: var(--accent-text); font-weight: 700; }

.tub-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tub-line:last-child { border-bottom: 0; }
.tub-line .nm { font-weight: 600; font-size: 15px; }
.tub-line .meta { font-size: 12.5px; color: var(--text-secondary); }
.tub-line .state { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border-strong); margin-left: 4px; }
.tub-line .state.reserve { background: var(--surface-1, #f4f4f2); }
.tub-line button { min-height: 44px; }
.weigh { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.weigh input { width: 130px; font-size: 18px; padding: 10px; }
.weigh .tare input { width: 110px; font-size: 16px; }
.weigh .out { font-size: 14px; }
.weigh .out.err { color: var(--danger-text); }
.weigh .out.need { color: var(--warning-text); }
.weigh .done { color: var(--accent-text); font-weight: 600; }
.find input { margin: 6px 0 8px; font-size: 16px; }
.find h3 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 10px 0 2px; }
.pick { display: flex; width: 100%; justify-content: space-between; gap: 8px; text-align: left; margin: 4px 0; min-height: 44px; }
.pick .where { font-size: 12px; color: var(--text-muted); }
