/* New-document presets share the shell palette; previews retain true ratios. */
#newDialog:has(.qp-document-presets) { width: min(600px, calc(100vw - 30px)); }
.qp-document-presets { margin: 2px 0 18px; color: var(--ink, #e3e5e9); }
.qp-document-presets .qp-preset-heading { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--muted, #b4bac4); }
.qp-preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qp-document-presets button { font: inherit; }
.qp-preset-card { min-width: 0; padding: 7px 6px 10px; border: 1px solid var(--line, #484c54); border-radius: 7px; background: #303237; color: var(--ink, #e3e5e9); text-align: center; }
.qp-preset-card:hover, .qp-paper-preview:hover { border-color: #a7d55e; background: #373d30; }
.qp-preset-card.is-selected { border-color: var(--blue, #c7f36b); background: var(--soft, #3b4c29); }
.qp-document-presets .qp-preset-art { display: block; width: 100%; height: 64px; margin: 0; overflow: visible; }
.qp-document-presets .qp-preset-outline { fill: #c7f36b0d; stroke: #a0b38a; stroke-width: 1.5; stroke-linejoin: miter; }
.qp-document-presets .is-selected .qp-preset-outline { fill: #c7f36b20; stroke: var(--blue, #c7f36b); }
.qp-document-presets .qp-preset-ratio { fill: currentColor; stroke: none; font-size: 10px; font-weight: 500; text-anchor: middle; dominant-baseline: central; }
.qp-preset-name { display: block; margin: 4px 0 2px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.qp-preset-size { display: block; color: var(--muted, #b4bac4); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qp-preset-paper { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line, #484c54); border-radius: 7px; background: #27292d; }
.qp-preset-paper.is-selected { border-color: var(--blue, #c7f36b); }
.qp-paper-preview { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 2px; min-height: 99px; border: 1px solid transparent; border-radius: 4px; color: var(--ink, #e3e5e9); background: transparent; }
.qp-paper-preview .qp-preset-art { height: 75px; }
.qp-paper-name { font-size: 11px; font-weight: 500; }
.qp-paper-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.qp-document-presets .qp-paper-title-row .qp-preset-heading { margin: 0; }
.qp-document-presets .qp-paper-apply { padding: 1px 0; border: 0; background: transparent; color: var(--blue, #c7f36b); font-size: 11px; }
.qp-paper-apply:hover { text-decoration: underline; }
.qp-paper-fields { display: grid; grid-template-columns: minmax(92px, 1.2fr) minmax(64px, .8fr) minmax(82px, 1fr); gap: 8px; }
.qp-preset-field { min-width: 0; font-size: 11px; color: var(--muted, #b4bac4); }
.qp-preset-field select { display: block; width: 100%; height: 32px; margin-top: 4px; padding: 0 6px; border: 1px solid #59606b; border-radius: 4px; background: var(--field, #202226); color: var(--ink, #e3e5e9); font-size: 12px; appearance: auto; color-scheme: dark; }
.qp-paper-meta { margin: 8px 0 0; font-size: 11px; color: var(--muted, #b4bac4); font-variant-numeric: tabular-nums; }
.qp-preset-current { display: flex; align-items: center; gap: 8px; padding-top: 10px; min-height: 43px; }
.qp-document-presets .qp-preset-current-art { width: 48px; height: 32px; flex: 0 0 48px; }
.qp-preset-current-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.qp-preset-current-title { font-size: 12px; font-weight: 500; }
.qp-preset-current-size { font-size: 11px; color: var(--muted, #b4bac4); font-variant-numeric: tabular-nums; }
.qp-document-presets button:focus-visible, .qp-document-presets select:focus-visible { outline: 2px solid var(--blue, #c7f36b); outline-offset: 2px; }
@media (max-width: 520px) {
  .qp-preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qp-preset-card { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: center; column-gap: 4px; padding: 7px 6px; text-align: left; }
  .qp-preset-card .qp-preset-art { grid-row: 1 / 3; height: 49px; }
  .qp-preset-name { align-self: end; margin: 0; font-size: 11px; }
  .qp-preset-size { align-self: start; margin-top: 2px; font-size: 11px; line-height: 1.35; white-space: normal; }
  .qp-preset-paper { grid-template-columns: 57px minmax(0, 1fr); gap: 7px; padding: 10px 8px; }
  .qp-paper-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qp-paper-fields .qp-preset-field:first-child { grid-column: 1 / -1; }
  .qp-paper-preview .qp-preset-art { height: 80px; }
  .qp-paper-meta { line-height: 1.6; }
}
