.sheet-heading { margin-block: 8px 14px; }
.sheet-heading h1 { font-size: clamp(28px, 5vw, 42px); margin-bottom: 4px; }
.sheet-heading p, .sheet-editor > p, #source-status { color: var(--muted); }
.sheet-workspace {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(0, 1.65fr);
  gap: 16px;
  align-items: start;
}
.sheet-workspace > .panel { min-width: 0; margin-top: 8px; }
.sheet-library .book-covers {
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 8px;
  margin-block: 10px 14px;
}
.sheet-library .book-cover {
  min-height: 90px;
  padding: 6px 7px;
  gap: 3px;
}
.sheet-library .book-cover strong { font-size: 14px; }
.sheet-library .book-illustration { scale: .68; margin: -9px -7px -11px; }
.sheet-library .book-cover span { font-size: 12px; }
.sheet-library .book-cover progress { display: none; }
#source-status:not(:empty) {
  margin-bottom: 6px;
}
.sheet-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}
.sheet-source {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #edf2e1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.sheet-source:hover { background: #dceccd; }
.sheet-source:active { cursor: grabbing; }
.sheet-source img, .sheet-placement img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sheet-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 12px; }
.sheet-tools output { min-width: 3ch; font-variant-numeric: tabular-nums; }
.print-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; padding: 0; border: 0; }
.print-choices legend { padding: 0; margin-bottom: 5px; font-weight: bold; }
.print-choices label { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: white; }
.print-choices label:has(input:checked) { border-color: var(--green-dark); background: var(--leaf); }
.print-choices input { accent-color: var(--green-dark); margin: 0; }
.print-choices span { display: grid; }
.print-choices small { font-size: 13px; color: var(--muted); }
.sheet-print { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.sheet-quote { background: #f3f6eb; border-radius: 10px; padding: 12px 14px; }
.sheet-quote p { margin: 0; }
#quote-selection { font-weight: 700; }
#quote-status { color: var(--muted); }
.sheet-quote dl { margin: 8px 0 0; }
.sheet-quote dl div { display: flex; justify-content: space-between; gap: 12px; }
.sheet-quote dl div:last-child { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 700; }
.sheet-quote dd { margin: 0; font-variant-numeric: tabular-nums; }
.sheet-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 18px; }
.sheet-save p { color: var(--muted); margin: 0; }
.sheet-orders { grid-column: 1 / -1; }
.sheet-orders ul { list-style: none; padding: 0; margin: 0; }
.sheet-orders li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.sheet-orders li:last-child { border-bottom: 0; }
#print-order-dialog { box-sizing: border-box; width: min(460px, calc(100% - 24px)); max-height: 90dvh; overflow: auto; padding: 20px; border: 2px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); }
#print-order-dialog::backdrop { background: #18221bc2; }
#print-order-form { display: grid; gap: 7px; }
#print-order-form p { margin: 0 0 6px; }
#order-review { padding: 10px 12px; background: var(--leaf); border-radius: 8px; font-weight: bold; }
#print-order-form > label { font-weight: bold; }
#print-order-form > input { width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; border-radius: 8px; border: 1px solid var(--line); }
#print-order-form .order-agreement { display: flex; align-items: flex-start; gap: 8px; margin-top: 9px; font-size: 14px; font-weight: normal; }
.order-agreement input { flex: none; margin-top: 5px; }
.order-actions { display: flex; justify-content: flex-end; gap: 8px; }
#order-message { color: #923527; }
.sheet-tools .button { padding-inline: 12px; margin-inline-start: auto; font-size: 15px; }
.sheet-paper {
  position: relative;
  isolation: isolate;
  width: min(100%, 540px);
  margin-inline: auto;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  background: white;
  outline: 1px solid #bac6b2;
  box-shadow: 3px 4px 0 #dce3d1;
}
#empty-sheet { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); pointer-events: none; }
.sheet-paper.is-drop-target { outline: 3px dashed #54845c; background: #f2f9eb; }
.sheet-drag-preview {
  position: fixed;
  z-index: 30;
  translate: -50% -50%;
  aspect-ratio: 1;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px #36452e55);
}
.sheet-placement {
  position: absolute;
  translate: -50% -50%;
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.sheet-placement img { position: absolute; inset: 0; }
.sheet-placement[aria-pressed="true"] { outline: 2px dashed #52855d; outline-offset: -2px; }
.sheet-placement[aria-pressed="true"] { z-index: 1; }
.resize-handle {
  display: none;
  position: absolute;
  translate: -50% -50%;
  width: 24px;
  height: 24px;
  touch-action: none;
}
.sheet-placement[aria-pressed="true"] .resize-handle { display: grid; place-items: center; }
.resize-handle::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #38674b;
  box-shadow: 0 0 0 1px #38674b;
}
.resize-handle[data-x="-1"] { left: 0; }
.resize-handle[data-x="1"] { left: 100%; }
.resize-handle[data-y="-1"] { top: 0; }
.resize-handle[data-y="1"] { top: 100%; }
.resize-handle { cursor: nwse-resize; }
.resize-handle[data-x="-1"][data-y="1"], .resize-handle[data-x="1"][data-y="-1"] { cursor: nesw-resize; }
.sheet-placement:focus-visible { outline: 2px solid #264b2e; }
.sheet-placement:active { cursor: grabbing; }
@media (max-width: 670px) {
  .sheet-workspace { grid-template-columns: 1fr; }
  .sheet-library .book-covers { grid-auto-flow: column; grid-auto-columns: 106px; grid-template-columns: none; overflow-x: auto; padding: 4px 4px 8px; }
  .sheet-sources { max-height: 158px; overflow-y: auto; }
}
