/* The box grid (grid.js): Your turn, and read-only in Watch, Result and Kaizen team.
   Colors follow Kirsten's slides: grinding blue, an inspection while the grinder runs green, an
   inspection while the grinder waits yellow and hatched. Icons and words carry the meaning in grayscale. */
.sg { --sg-row: 30px; --sg-gap: 6px; --sg-grind: #2F6FB3; --sg-busy: #3F8F3A; --sg-idle: #F2B53A; --sg-idle-line: rgba(113, 63, 18, 0.28);
  font-family: var(--font-sans, Inter, system-ui, sans-serif); color: var(--navy-ink); user-select: none; -webkit-user-select: none; }
.sg-head, .sg-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.62fr) minmax(0, 0.62fr); column-gap: var(--sg-gap); }
.sg-head { margin-bottom: 4px; align-items: end; }
.sg-h { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; color: var(--navy);
  padding: 4px 2px; border-radius: 6px; cursor: grab; touch-action: none; line-height: 1.15; text-align: center; }
.sg-h:hover { background: var(--paper); }
.sg-h .sg-grip { display: inline-flex; width: 12px; height: 12px; color: var(--faint); }
.sg-h .sg-grip svg { width: 12px; height: 12px; }
.sg-h.ghost { color: var(--muted); font-weight: 600; }
.sg-h .sg-sub { flex-basis: 100%; font-size: 11px; font-weight: 600; color: var(--faint); }
.sg-body { position: relative; row-gap: 0; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.sg-line { grid-column: 1 / -1; border-top: 1px solid #F1EFE9; }
.sg-line:first-child { border-top: 0; }
.sg-box { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin: 2px 0; padding: 0 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; cursor: grab; touch-action: none;
  box-shadow: 0 1px 2px rgba(12, 23, 68, 0.12); transition: box-shadow 0.12s ease; }
.sg-box .sg-ic { flex: none; display: inline-flex; width: 15px; height: 15px; }
.sg-box .sg-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sg-box .sg-t { overflow: hidden; text-overflow: ellipsis; }
.sg-box .sg-short { display: none; }
.sg-box.grind { background: var(--sg-grind); color: #FFFFFF; }
.sg-box.inspect.busy { background: var(--sg-busy); color: #FFFFFF; }
.sg-box.inspect.idle { color: #422006; background: repeating-linear-gradient(135deg, var(--sg-idle) 0 6px, #E9A825 6px 8px); }
.sg-box.ghost { opacity: 0.42; box-shadow: none; padding: 0 5px; gap: 4px; font-size: 11.5px; }
.sg-box:hover { box-shadow: 0 0 0 2px var(--navy); }
.sg-box:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.sg-box.bad { box-shadow: 0 0 0 3px var(--red, #B91C1C); opacity: 1; }
.sg-box.now { box-shadow: 0 0 0 3px var(--accent); }
.sg-wait { margin: 1px 4px; border: 1.5px dashed var(--faint); border-radius: 6px; display: flex; align-items: center; justify-content: center; min-height: 0; }
.sg-wait span { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sg-wait.ghost { opacity: 0.45; }
.sg.dragging, .sg.dragging .sg-box, .sg.dragging .sg-h { cursor: grabbing; }
.sg-legend { display: flex; flex-wrap: wrap; gap: 3px 12px; list-style: none; margin: 6px 0 0; padding: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.sg-legend li { display: inline-flex; align-items: center; gap: 5px; }
.sg-sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.sg-sw.grind { background: var(--sg-grind); }
.sg-sw.busy { background: var(--sg-busy); }
.sg-sw.idle { background: repeating-linear-gradient(135deg, var(--sg-idle) 0 3px, #E9A825 3px 4px); }
.sg-sw.wait { border: 1.5px dashed var(--faint); box-sizing: border-box; }
.sg-tools { margin-top: 6px; }
.sg-reset { font: 600 12.5px/1 var(--font-sans, Inter, system-ui, sans-serif); color: var(--accent-strong); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sg-reset:hover { color: var(--navy); }
/* read-only grids: no grab cursors; compact rows in the Watch, Result and Kaizen team panels */
.sg-ro .sg-box, .sg-ro .sg-h { cursor: default; touch-action: auto; }
.sg-ro .sg-box:hover { box-shadow: 0 1px 2px rgba(12, 23, 68, 0.12); }
.sg-ro .sg-h:hover { background: none; }
.sg-compact { --sg-row: 19px; --sg-gap: 4px; }
.sg-two .sg-head, .sg-two .sg-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sg-compact .sg-h { font-size: 11px; padding: 0 2px 2px; }
.sg-compact .sg-body { padding: 2px 3px; border-radius: 8px; }
.sg-compact .sg-box { margin: 1px 0; padding: 0 5px; gap: 4px; font-size: 10.5px; border-radius: 4px; }
.sg-compact .sg-box .sg-ic, .sg-compact .sg-box .sg-ic svg { width: 11px; height: 11px; }
.sg-compact .sg-box.now { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 480px) {
  .sg { --sg-row: 28px; --sg-gap: 4px; }
  .sg-box { font-size: 11.5px; padding: 0 5px; gap: 4px; }
  .sg-box .sg-ic, .sg-box .sg-ic svg { width: 13px; height: 13px; }
  .sg-box.ghost .sg-ic { display: none; }
  .sg-box .sg-full { display: none; }
  .sg-box .sg-short { display: inline; }
  .sg-compact { --sg-row: 18px; }
}
