/* Paper-QR studio — /paper-qr + /spread/<id>/paper-qr (v=paperqr2).
   Brand CMYK+W: pink rgb(255,40,127), cyan rgb(0,204,255), yellow
   rgb(255,215,0), void rgb(22,22,22). The neon glow lives on the preview
   frame; the QR itself stays high-contrast on white for scannability. */

.pq-hero .flyerpage-hero__promo { color: #00ccff; font-style: italic; }

.pq-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-block: 1rem;
}
@media (max-width: 780px) {
  .pq-grid { grid-template-columns: 1fr; }
}

.pq-controls__title { margin: 0 0 .6rem; font-size: 1.05rem; }

.pq-field { display: block; margin-bottom: .7rem; }
.pq-field > span {
  display: block; font-size: .8rem; color: #9aa; margin-bottom: .25rem;
}
.pq-field input, .pq-field textarea {
  width: 100%; box-sizing: border-box;
  background: #1e1e1e; color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  padding: .5rem .6rem; font: inherit;
  overflow-wrap: break-word;
}
.pq-field textarea { resize: vertical; font-family: inherit; }
.pq-field input:focus, .pq-field textarea:focus {
  outline: none; border-color: #00ccff;
}

.pq-set {
  border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  padding: .6rem .7rem .4rem; margin: 0 0 .8rem;
}
.pq-set legend { font-size: .8rem; color: #9aa; padding: 0 .3rem; }
.pq-choice {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .35rem 0; cursor: pointer;
}
.pq-choice--inline { display: inline-flex; margin-right: 1rem; }
.pq-choice input { margin-top: .2rem; accent-color: #ff287f; }
.pq-choice span b { display: block; font-size: .92rem; }
.pq-choice span small { display: block; color: #9aa; font-size: .76rem; }

.pq-stage { position: sticky; top: .75rem; }
@media (max-width: 780px) { .pq-stage { position: static; } }

.pq-preview {
  background: #fff; border-radius: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  min-height: 240px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 0 22px rgba(0,204,255,.25);
}
.pq-preview svg { width: min(100%, 300px); height: auto; display: block; }
.pq-preview { flex-direction: column; }
.pq-note {
  margin: .5rem 0 0; font-size: .72rem; color: #555; font-style: italic;
  text-align: center; max-width: 300px; overflow-wrap: break-word;
}
.pq-field__hint { display: block; margin-top: .2rem; font-size: .7rem; color: #778; }
.pq-over { color: #b8005c; font-weight: 700; text-align: center; padding: 1rem; }

.pq-meta {
  margin: .5rem 0 0; font-size: .78rem; color: #9aa;
  font-family: ui-monospace, monospace; text-align: center;
}

.pq-budget {
  display: flex; align-items: center; gap: .6rem; margin: .7rem 0 .9rem;
}
.pq-budget__track {
  flex: 1; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.pq-budget__bar {
  height: 100%; width: 0; border-radius: 4px;
  background: #00cc88; transition: width .15s ease;
}
.pq-budget__bar[data-state="amber"] { background: #ffd700; }
.pq-budget__bar[data-state="red"] { background: #ff5c33; }
.pq-budget__bar[data-state="over"] { background: #ff287f; }
.pq-budget__count {
  font-family: ui-monospace, monospace; font-size: .78rem; color: #9aa;
  white-space: nowrap;
}
.pq-budget__count[data-state="amber"] { color: #ffd700; }
.pq-budget__count[data-state="red"] { color: #ff5c33; }
.pq-budget__count[data-state="over"] { color: #ff287f; }

.pq-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.pq-actions .btn-cyan, .pq-actions .btn-ghost, .pq-actions .btn-yellow {
  overflow-wrap: break-word;
}
.pq-print-hint { font-size: .78rem; margin-top: .6rem; }

/* Inline error when the sheet-PNG export fails outright (Task #283). */
.pq-sheet-err {
  margin: .6rem 0 0; font-size: .85rem; font-weight: 600;
  color: #ff2887; text-align: center;
}
.pq-related { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

/* ── Print-sheet format picker + layout assistant (Task #251) ───── */
.pq-printsetup {
  border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  padding: .6rem .7rem .2rem; margin: 0 0 .8rem;
}
.pq-printsetup select {
  width: 100%; box-sizing: border-box;
  background: #1e1e1e; color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  padding: .45rem .6rem; font: inherit;
}
.pq-printsetup select:focus { outline: none; border-color: #00ccff; }
.pq-printsetup [hidden] { display: none !important; }
.pq-assistant {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: .5rem; margin-top: .2rem;
}
.pq-assistant__title { margin: .1rem 0 .4rem; font-size: .95rem; }
.pq-assistant__text {
  margin: .2rem 0 .5rem; font-size: .85rem; color: #ccd;
  overflow-wrap: break-word;
}
.pq-assistant__warn { color: #ffd700; font-size: .8rem; margin: .2rem 0 .5rem; }
.pq-assistant .btn-cyan { overflow-wrap: break-word; }
.pq-printsetup__tip {
  margin: .1rem 0 .4rem; font-size: .76rem; color: #9ab;
  overflow-wrap: break-word;
}
.pq-cutmarks { margin: .3rem 0 .5rem; }
.pq-checklist {
  margin-top: .6rem; border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: .5rem .7rem; font-size: .85rem;
}
.pq-checklist summary {
  cursor: pointer; font-weight: 700; color: #cde;
  overflow-wrap: break-word;
}
.pq-checklist ul { margin: .45rem 0 .2rem; padding-inline-start: 1.2rem; }
.pq-checklist li {
  margin: .25rem 0; color: #aab; overflow-wrap: break-word;
}

.pq-history { margin-block: 1rem 2rem; }
.pq-history__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; flex-wrap: wrap;
}
.pq-history__clear { font-size: .8rem; padding: .25rem .7rem; }
.pq-history__list {
  list-style: none; margin: .5rem 0 0; padding: 0;
  max-height: 220px; overflow-y: auto;
}
.pq-history__list li {
  padding: .35rem 0; border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: .85rem; overflow-wrap: break-word;
}
.pq-history__list li span { color: #9aa; font-size: .76rem; }
.pq-history__empty { color: #9aa; }

/* ── Print sheet: A4, 1 large (8cm) + 6 small (3cm) ─────────────── */
.pq-print { display: none; }

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  /* .pq-print sits inside <main> (the content block), NOT as a direct body
     child — so reveal it via the visibility pattern, which works through
     arbitrary nesting, and take it out of the flow with absolute positioning
     so the hidden app leaves no phantom pages. */
  body * { visibility: hidden !important; }
  .pq-print, .pq-print * { visibility: visible !important; }
  .pq-print {
    display: block !important; color: #161616;
    position: absolute; top: 0; left: 0; width: 100%;
    font-family: sans-serif;
  }
  /* Classic-sheet figures only: the new .pq-cell sheets (Task #251) size
     their SVG via .pq-cell__qr and their caption via .pq-cell__cap in the
     injected pageCss — these legacy rules (8pt + 2mm caption margin) would
     otherwise leak in and push the caption out of its 4mm band, clipping
     into the QR. */
  .pq-print .pq-print__big svg, .pq-print .pq-print__small svg {
    display: block; width: 100%; height: auto;
  }
  .pq-print figure { margin: 0; text-align: center; page-break-inside: avoid; }
  .pq-print .pq-print__big figcaption,
  .pq-print .pq-print__small figcaption {
    font-size: 8pt; margin-top: 2mm; overflow-wrap: break-word;
  }
  .pq-print .pq-note-line {
    display: block; font-size: 6pt; font-style: italic; color: #555;
    margin-top: .5mm;
  }
  .pq-print__big { width: 8cm; margin: 0 auto 8mm; }
  .pq-print__grid {
    display: grid; grid-template-columns: repeat(3, 3cm);
    gap: 6mm; justify-content: center;
  }
  .pq-print__small { width: 3cm; }
  .pq-print__mantra {
    margin-top: 8mm; font-size: 7.5pt; text-align: center; color: #444;
  }
}
