/* Staff paper generator. On screen: controls + a scaled preview. In print: only the sheets, sized in mm. */
.sgp-controls { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); align-items: end; }
.sgp-controls label { display: flex; flex-direction: column; gap: 4px; }
.sgp-controls select, .sgp-controls input[type="number"], .sgp-controls input[type="text"] { width: 100%; }
.sgp-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.sgp-controls .sgp-check { flex-direction: row; align-items: center; gap: 8px; min-height: 40px; color: var(--mtp-paper); font-size: 14px; }
.sgp-check input { width: 20px; height: 20px; flex: none; accent-color: var(--mtp-brass); }
.sgp-title-row { grid-column: 1 / -1; max-width: 420px; }
.sgp-title-row[hidden], .sgp-pager[hidden] { display: none; }
.sgp-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 6px; }
.sgp-hint { color: var(--mtp-muted); font-size: 13px; flex: 1 1 260px; }
.sgp-info { margin: 6px 0 12px; color: var(--mtp-muted); font-size: 14px; }
.sgp-pager { display: flex; gap: 12px; align-items: center; margin: 0 0 12px; }
.sgp-pager button:disabled { opacity: .4; cursor: default; }
.sgp-stage { background: var(--mtp-night); padding: clamp(10px, 2.5vw, 22px); border: 1px solid var(--mtp-line); display: flex; justify-content: center; overflow: hidden; }
.sgp-view { width: 100%; max-width: 560px; box-shadow: 0 2px 18px rgba(0, 0, 0, .55); background: #fff; line-height: 0; }
.sgp-view[data-orient="landscape"] { max-width: 780px; }
.sgp-view svg { width: 100%; height: auto; display: block; }
.sgp-print { display: none; }

@media print {
  html, body { background: #fff !important; color-scheme: light !important; margin: 0 !important; padding: 0 !important; }
  .mtp-topnav, .mtp-site-footer, .book-toc, .book-footer, .mtp-toc { display: none !important; }
  .mtp-shell, .mtp-page, .book-page, main { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; }
  .mtp-tool[data-tool="staff-paper-generator"] { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .mtp-tool[data-tool="staff-paper-generator"] > *:not(.sgp) { display: none !important; }
  .mtp-tool-panel.sgp { margin: 0 !important; padding: 0 !important; border: 0 !important; background: #fff !important; }
  .sgp > *:not(.sgp-print) { display: none !important; }
  .sgp-print { display: block !important; }
  .sgp-sheet { overflow: hidden; break-after: page; page-break-after: always; line-height: 0; }
  .sgp-sheet:last-child { break-after: auto; page-break-after: auto; }
  .sgp-sheet svg { display: block; }
}
