.stock-template {
  width: min(1320px, 96vw);
  max-width: 96vw;
  height: min(890px, 94vh);
  max-height: 94vh;
  border: 1px solid #c2d4cb;
  border-radius: 12px;
  padding: 16px;
  color: #193b31;
  background: #f8fbf9;
}
.stock-template[open] { display: flex; flex-direction: column; gap: 8px; }
.stock-template h2 { margin: 0; font-size: 1.2rem; }
.stock-template-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 6px 10px; }
.stock-template-controls label { display: grid; gap: 3px; font-size: .78rem; }
.stock-template-controls input[type=number] { width: 7rem; }
.stock-template-controls textarea { min-height: 2rem; }
.stock-template-stage { flex: 1; min-height: 100px; overflow: auto; padding: 16px; background: #e1e8e4; border-radius: 7px; }
.stock-template-stage .stock-paper { margin-inline: auto; outline: 1px solid #9dacaa; }
.stock-template-stage .stock-paper-item { cursor: move; outline: 1px dotted #bac8c0; touch-action: none; }
.stock-template-stage .stock-paper-item.selected { z-index: 1; outline: 1px dashed #137453; }
.stock-template-status { min-height: 1.2em; margin: 0; font-size: .9rem; }
.stock-print-frame { position: fixed; left: -10000px; top: 0; width: 1000px; height: 1000px; border: 0; }
.stock-paper { position: relative; background: white; color: #111; overflow: hidden; box-sizing: border-box; }
.stock-paper * { box-sizing: border-box; }
.stock-paper-item { position: absolute; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.22; }
.stock-paper-item table { width: 100%; border-collapse: collapse; table-layout: fixed; font: inherit; }
.stock-paper-item th,.stock-paper-item td { padding: 1.2mm; border: 1px solid #777; vertical-align: top; }
.stock-paper-item img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.stock-paper-signatures { display: flex; gap: 3mm; flex-wrap: wrap; }
.stock-paper-signatures > div { flex: 1; min-width: 0; }
.stock-paper-signatures img { height: 11mm; }
.stock-print-document,.stock-print-document body { margin: 0; padding: 0; }
.stock-print-document .stock-paper { break-after: page; }
.stock-print-document .stock-paper:last-child { break-after: auto; }
