/* Экраны: редактор склада, сценарий, прогон, сравнение, «как проверено». */

/* Образцы цветов (легенда, инструменты) */
.sw { display: inline-block; width: 18px; height: 18px; border: 1.5px solid var(--ink); vertical-align: -4px; flex: none; }
.sw-dry-aisle { background: var(--dry-aisle); }
.sw-cold-aisle { background: var(--cold-aisle); }
.sw-freeze-aisle { background: var(--freeze-aisle); }
.sw-dry-rack { background: var(--dry-rack); }
.sw-cold-rack { background: var(--cold-rack); }
.sw-freeze-rack { background: var(--freeze-rack); }
.sw-wall { background: repeating-linear-gradient(135deg, var(--wall) 0 3px, #4a5360 3px 4px); }
.sw-station { background: var(--station); }
.sw-entry { background: var(--entry); }
.sw-eraser { background: var(--paper); border-style: dashed; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend .lg { display: inline-flex; gap: 6px; align-items: center; }
.legend.actions { margin-top: 6px; }
.glyph { flex: none; }
.glyph .g-paper { fill: #fffdf7; stroke: var(--ink); stroke-width: 1.2; }
.glyph .g-red { fill: var(--red); stroke: var(--ink); stroke-width: 1.2; }
.glyph .g-ink { fill: var(--ink); }
.glyph .g-white { fill: #fff; }
.glyph .g-stroke { fill: none; stroke: var(--ink); stroke-width: 1.6; }

/* Редактор */
.ed { display: grid; grid-template-columns: 188px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.ed-tools { position: sticky; top: 8px; }
.tools { display: flex; flex-direction: column; gap: 4px; }
.tool {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 7px; min-height: 36px; background: var(--paper);
  border: 1.5px solid var(--line); cursor: pointer; text-align: left; font-size: 13.5px; border-radius: 2px;
}
.tool:hover { border-color: var(--ink); background: var(--paper-2); }
.tool[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--line); }
.tool[aria-pressed=true] .sw { border-color: var(--paper); }
.tool-name { flex: 1; min-width: 0; line-height: 1.15; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid currentColor; padding: 0 5px; border-radius: 3px; opacity: 0.85; }
.board-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.cursor-out { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); min-height: 18px; }
.board {
  position: relative; height: clamp(360px, 66vh, 760px); border: 1.5px solid var(--ink); background: var(--paper-2); overflow: hidden;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 16px 16px;
}
.board canvas { display: block; position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.board canvas:focus-visible { outline-offset: -3px; }
.ro-note { display: none; }
.ed-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ed-side .field + .field { margin-top: 0; }
.new-map { margin-top: 10px; align-items: flex-end; }
.new-map .fld { width: 86px; }
.gen { padding-top: 10px; }
.gen > summary { cursor: pointer; font-weight: 700; font-size: 14px; padding: 2px 0; }
.gen-grid { display: grid; gap: 10px; margin-top: 10px; }
.gen-grid .fld > label { font-size: 13px; }
.val-status { font-weight: 600; font-size: 14px; padding: 6px 8px; border-left: 4px solid var(--line); background: var(--paper-2); }
.val-status.ok { border-color: var(--green); background: var(--green-soft); color: #1d4a28; }
.val-status.bad { border-color: var(--red); background: var(--red-soft); color: #7a1b13; }
.val-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.issue { width: 100%; text-align: left; border: 1.5px solid var(--red); background: #fffdf7; padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.issue:hover:not(:disabled) { background: var(--red-soft); }
.issue:disabled { cursor: default; }
.issue .where { font-family: var(--mono); font-size: 12px; color: var(--red); font-weight: 700; }

/* Сценарий */
.two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two > div > .field + .field { margin-top: 18px; }
.presets { margin-bottom: 6px; }
.fld.flow { grid-column: 1 / -1; }

/* Прогон */
.run { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.run-ctl { display: flex; flex-direction: column; gap: 12px; }
.run-side > .field + .field { margin-top: 16px; }
.run-msg { font-size: 14px; min-height: 20px; }
.run-msg.bad { color: var(--red); font-weight: 600; }
.run-msg.ok { color: var(--green); font-weight: 600; }
.clock-row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-bottom: 8px; }
.clock { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: 0.02em; }
.clock-row label { margin-left: auto; }
.board-run { height: clamp(340px, 58vh, 680px); }
.board-run canvas { cursor: grab; }
.transport { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.transport input[type=range] { flex: 1; min-width: 0; accent-color: var(--ink); height: 28px; }
.transport .speed { width: 92px; flex: none; }
.live { font-size: 13.5px; margin-top: 8px; min-height: 40px; font-variant-numeric: tabular-nums; }
.heat-box { margin-top: 10px; max-width: 520px; }
.heat-legend { width: 100%; max-width: 100%; height: 22px; border: 1.5px solid var(--ink); display: block; }
.heat-scale { display: flex; justify-content: space-between; margin-top: 3px; }

/* Сравнение */
.var-table select { min-width: 150px; }
.var-table .n-in, .n-in { width: 84px; min-width: 0; }
.var-table .vname { font-weight: 600; min-width: 160px; }
.cmp-act { margin-top: 12px; gap: 14px; }
.cmp-act .inline { gap: 8px; }
#cmp-out { margin-top: 18px; }
#cmp-out > .field + .two { margin-top: 18px; }
#cmp-xlsx { text-decoration: none; color: var(--ink); }
#cmp-table td:first-child { min-width: 170px; }
.bar-note { font-size: 13px; }

/* Как проверено */
.check { margin-top: 22px; position: relative; padding-top: 4px; }
.check:first-of-type { margin-top: 16px; }
.check h3 { font-size: 16px; display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.check .vid { font-family: var(--mono); font-size: 13px; background: var(--ink); color: var(--paper); padding: 1px 8px; border-radius: 2px; }
.check .banner { margin: 8px 0; max-width: 90ch; }
.check .banner p { margin-top: 6px; }
.check .banner .tbl-wrap { margin-top: 8px; }
.check td .note { margin-top: 2px; }
.tally { font-weight: 700; margin-bottom: 4px; }

@media (max-width: 1180px) {
  .ed { grid-template-columns: 170px minmax(0, 1fr); }
  .ed-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .run { grid-template-columns: 260px minmax(0, 1fr); }
  .run-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
  .run-side > .field + .field { margin-top: 0; }
  .two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .ed, .run { grid-template-columns: minmax(0, 1fr); }
  .ed-tools { display: none; }
  .ro-note { display: block; }
  #ed-note { display: none; }
  .ed-side, .run-side { grid-template-columns: minmax(0, 1fr); }
  .board, .board-run { height: 56vh; min-height: 300px; }
  .clock { font-size: 24px; }
  .transport { flex-wrap: wrap; }
  .transport input[type=range] { flex: 1 1 100%; order: 3; }
  .clock-row label { margin-left: 0; }
  .cursor-out { display: none; }
  .check h3 { flex-wrap: wrap; }
  .check thead { display: none; }
  .check table, .check tbody, .check tr, .check td { display: block; width: 100%; }
  .check tr { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
  .check td { border: 0; padding: 2px 10px; text-align: left; white-space: normal; }
  .check td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-2); }
}
