/* Shared styles for the three freezer-rearrange screens. Tile/shelf/bench visual
   language ported from the approved prototypes; harmonised with the app theme
   (styles.css) for the accent so it doesn't clash with the Home link or TEST banner.
   Per-screen layout (tabs, columns, board mode) lives with each screen. */

:root {
  --fg-accent: var(--accent-text, #1f6fb2);
  --fg-empty: #e6ecf0;
  --fg-reserved: #8a6bb8;
  --fg-freezer: #8fa0ad;
  --fg-shelf: #a9b7c2;
  --fg-shelf-sg: #7fc4ad;
  --fg-line: var(--border, #d3dbe1);
  --fg-bench-line: #d9c49a;
  /* Storage position check (Freezer board) */
  --fg-ok: #2e9e5b;
  --fg-warn: #e08a00;
  --fg-warn-bg: #fff2d6;
  --fg-warn-ink: #7a4a00;
  --fg-bad: #c73a3a;
  --fg-bad-bg: #fde3e3;
  --fg-bad-ink: #8a1f1f;
}

.fg-app { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; }
.fg-head h1 { font-size: 19px; margin: 0; font-weight: 650; }
.fg-sub { font-size: 12.5px; color: var(--text-secondary, #6b7a86); margin-top: 2px; }

/* --- header controls: labelled segmented switches (Names, Position check, …) --- */
.fg-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary, #6b7a86); white-space: nowrap; }
.fg-seg { display: inline-flex; background: #dde4ea; border-radius: 9px; padding: 3px; gap: 3px; }
.fg-seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font: inherit; font-size: 12.5px; color: var(--text-primary, #1d2a33); white-space: nowrap; cursor: pointer; }
.fg-seg button.on { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* --- freezer area + shelves --- */
.fg-freezer { background: var(--fg-freezer); border-radius: 12px; padding: 8px 8px 6px; }
.fg-shelf { display: grid; grid-template-columns: 22px 1fr; gap: 4px; background: var(--fg-shelf); border-radius: 8px; padding: 4px; margin-bottom: 6px; }
.fg-shelf.sg { background: var(--fg-shelf-sg); }
.fg-slabel { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10.5px; color: #fff; font-weight: 600; line-height: 1.1; text-align: center; }
.fg-slabel small { font-weight: 400; font-size: 9px; opacity: .9; }
.fg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }

/* --- one tile --- */
.fg-cell {
  position: relative; height: 46px; border-radius: 6px; overflow: hidden; background: var(--fg-empty);
  border: 1.5px solid rgba(0, 0, 0, .08); padding: 3px 5px 6px; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; transition: transform .12s;
}
.fg-cell.back { height: 40px; }          /* back row a touch shorter than the front */
.fg-cell.empty { background: repeating-linear-gradient(135deg, #e9eef2 0 6px, #e1e8ed 6px 12px); cursor: pointer; }
.fg-top { display: flex; align-items: center; gap: 4px; font-size: 9.5px; line-height: 1; position: relative; z-index: 1; min-width: 0; }
.fg-pos { font-weight: 700; opacity: .8; white-space: nowrap; overflow: hidden; }
.fg-pct { opacity: .85; white-space: nowrap; margin-left: auto; }
.fg-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; position: relative; z-index: 1; }
.fg-hint { font-size: 9.5px; color: #7d8b96; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fg-hint.res { color: var(--fg-reserved); font-weight: 600; }
.fg-hint.wait { color: var(--fg-warn-ink); font-weight: 600; white-space: normal; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fg-lvl { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .28); }
.fg-lvl i { display: block; height: 100%; background: rgba(255, 255, 255, .85); }

.fg-cell.sel { border-color: var(--fg-accent); box-shadow: 0 0 0 2px var(--fg-accent); transform: translateY(-2px); }
.picking .fg-cell:not(.sel):not(.fg-off) { border-style: dashed; border-color: color-mix(in srgb, var(--fg-accent) 45%, transparent); }
.fg-cell.flash { animation: fg-flash .7s; }
@keyframes fg-flash { 0% { box-shadow: 0 0 0 3px #f2b705; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* --- Storage position check: ✓ in place, amber = out of place, red = slot has no default --- */
.fg-ok { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; border-radius: 50%; background: var(--fg-ok); color: #fff; font-size: 8.5px; font-weight: 700; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }
.fg-mark { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--fg-warn-bg); color: var(--fg-warn-ink); border-radius: 4px; padding: 1px 4px; font-size: 9.5px; font-weight: 700; }
.fg-mark.bad { background: var(--fg-bad-bg); color: var(--fg-bad-ink); }
.fg-mark.fg-chipgo { cursor: pointer; }
.fg-mark.fg-chipgo:hover, .fg-mark.fg-chipgo:focus-visible { text-decoration: underline; text-underline-offset: 2px; }
.fg-cell.misplaced { box-shadow: inset 0 0 0 3px var(--fg-warn); }
.fg-cell.nodef { box-shadow: inset 0 0 0 3px var(--fg-bad); }
.fg-problems .fg-cell.inplace { opacity: .28; filter: saturate(.3); }
.fg-problems .fg-cell.empty.chk:not(.waiting) { opacity: .5; } /* plain empty slots in a checked freezer */
/* home-slot pulse: where the held tray's group lives in Storage */
.fg-cell.home { outline: 3px dashed var(--fg-accent); outline-offset: 1px; animation: fg-pulse 1.2s ease-in-out infinite; z-index: 2; }
@keyframes fg-pulse { 50% { outline-color: color-mix(in srgb, var(--fg-accent) 25%, transparent); } }

/* --- group colours (board: Show Group / group finder) ---
   A tray tile: a 6px strip down its left edge in its group's colour; the tile fill stays the gelato
   colour. An empty Storage/Working slot: the hatching tinted with its default group's colour and the
   group name darker. Padding only — tile size is unchanged. */
.fg-gc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--gc); z-index: 1; }
.fg-cell.fg-gc, .fg-chip.fg-gc { padding-left: 11px; }
.fg-cell.empty.fg-gt { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--gc) 38%, #eef1f4) 0 6px, color-mix(in srgb, var(--gc) 24%, #e4e8ec) 6px 12px); }
.fg-cell.empty.fg-gt .fg-hint { color: #3b4148; font-weight: 700; }

/* Board shelf-5 alias: a tray drawn in the same physical slot as its record (WF 24+k = SG k) —
   marked quietly with a dashed edge, no new colour. */
.fg-cell.fg-alias:not(.sel) { border-style: dashed; border-color: rgba(0, 0, 0, .35); }

/* faded, not tappable (board: Working off, or Staging shelf while cabinet on) */
.fg-off, .fg-shelf.fg-off { opacity: .38; filter: grayscale(.85); pointer-events: none; }

.fg-basenote { font-size: 10px; color: var(--text-muted, #8a9089); text-align: center; padding: 2px 0 4px; }

/* --- dock: status + bench, pinned above the freezer in stacking order --- */
.fg-dock { position: sticky; bottom: 0; z-index: 20; background: var(--surface-2, #fff); border-top: 1px solid var(--fg-line); padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); margin-top: 10px; box-shadow: 0 -4px 12px rgba(0, 0, 0, .06); }
.fg-status { padding: 0 14px 7px; font-size: 13px; min-height: 22px; display: flex; align-items: center; gap: 8px; }
.fg-status b { font-weight: 650; }
.fg-status .fg-idle { color: var(--text-secondary, #6b7a86); }
.fg-status .fg-err { color: var(--danger-text, #8a241d); }
.fg-status button { margin-left: auto; border: 1px solid var(--fg-line); background: var(--surface-2, #fff); border-radius: 7px; padding: 4px 10px; font: inherit; font-size: 12.5px; color: var(--fg-accent); cursor: pointer; }
.fg-benchhead { padding: 0 14px 5px; font-size: 12px; color: var(--text-secondary, #6b7a86); }
.fg-benchhead strong { color: var(--text-primary, #1d2a33); font-size: 13px; }
.fg-bench { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; padding: 2px 14px; max-height: 116px; overflow-y: auto; }
/* board: the bench as one horizontal scrolling row with ‹ › arrows */
.fg-bench.fg-benchrow { display: flex; align-items: stretch; gap: 6px; max-height: none; overflow: visible; }
.fg-strip { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 3px 2px; }
.fg-strip::-webkit-scrollbar { display: none; }
.fg-strip .fg-chip { flex: 0 0 140px; }
.fg-strip .fg-chip.drop { flex-basis: 110px; }
.fg-arrow { flex: 0 0 30px; border: 1px solid var(--fg-line); background: var(--surface-2, #fff); border-radius: 8px; font: inherit; font-size: 18px; color: var(--text-secondary, #6b7a86); cursor: pointer; }
.fg-arrow[hidden] { display: none; }
.fg-chip { height: 48px; border-radius: 7px; position: relative; overflow: hidden; border: 1.5px solid rgba(0, 0, 0, .1); padding: 3px 6px 6px; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.fg-chip.sel { border-color: var(--fg-accent); box-shadow: 0 0 0 2px var(--fg-accent); }
.fg-chip.drop { background: var(--surface-2, #fff); border: 1.5px dashed var(--fg-bench-line); color: #8b7340; font-size: 12px; align-items: center; justify-content: center; text-align: center; font-weight: 600; }
.fg-chip.drop.live { border-color: var(--fg-accent); color: var(--fg-accent); }
.fg-legend { font-size: 11px; color: var(--text-secondary, #6b7a86); padding: 6px 14px 0; }
