/* The form and on-screen preview. */
.tool-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-left: 2ch; }
.tool-form label { display: block; color: var(--muted); font-size: 13px; }
.tool-form .wide { grid-column: 1 / -1; }
.tool-form .check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 40px; font-size: 14px; color: var(--fg); cursor: pointer; }
.tool-form .check input { flex: none; width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.tool-form .check:has(input:disabled) { color: var(--muted); opacity: .55; cursor: default; }
.tool-form .check input:disabled { cursor: default; }
.tool-form input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 14px;
  color: var(--fg); background: transparent; border: 1px solid var(--border); border-radius: 4px;
}
.tool-form input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  min-height: 38px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer;
  color: var(--green); background: transparent; border: 1px solid currentColor; border-radius: 4px;
}
.btn:disabled { color: var(--muted); cursor: default; }
.tool-status { min-height: 1.7em; margin: 12px 0 0 2ch; color: var(--muted); }
.tool-status.error { color: var(--amber); }
.tool-actions[hidden] { display: none; }
.preview { position: relative; box-shadow: 0 0 0 1px var(--border); }
.zoom-bar {
  position: absolute; top: 8px; right: 8px; z-index: 1; display: flex; align-items: center; gap: 6px;
  padding: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
.zoom-bar .btn { min-width: 34px; min-height: 34px; padding: 2px 8px; }
.zoom-level { min-width: 5ch; text-align: center; color: var(--muted); font-size: 13px; }
.stage { position: relative; }
.stage:active { cursor: grabbing !important; }
.pages { position: absolute; top: 0; width: 8.5in; transform-origin: top left; }
/* Several pages sit side by side, two to a row. */
.pages.multi { display: grid; grid-template-columns: 8.5in 8.5in; gap: 16px; width: calc(17in + 16px); }

@media screen and (max-width: 720px) {
  .tool-form { grid-template-columns: 1fr; margin-left: 0; }
  .tool-form input { font-size: 16px; } /* Stops iOS zooming in on focus. */
  .tool-form .check { min-height: 44px; }
  .tool-status { margin-left: 0; }
  .btn { min-height: 44px; }
  .zoom-bar .btn { min-width: 44px; min-height: 44px; }
}

/* The sheet: US Letter, always black on white. Sizes are in em so it can shrink to fit one page. */
@page { size: letter; margin: 0; }
.sheet {
  width: 8.5in; height: 11in; overflow: hidden;
  /* 0.9in left gutter clears a three-hole punch. */
  padding: .55in .6in .5in .9in; display: flex; flex-direction: column;
  background: #fff; color: #000; font: 9.5pt/1.45 "JetBrains Mono", ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.sheet .top { display: flex; gap: 2em; }
.sheet .cover { width: 18.95em; height: 18.95em; object-fit: cover; flex: none; border: .5pt solid #999; display: block; }
.sheet .head { flex: 1; min-width: 0; }
.sheet .artist { font-size: 1.16em; margin: 0; }
.sheet h1 { font-size: 2.1em; line-height: 1.15; margin: .1em 0 .5em; font-weight: 700; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: .1em 1.26em; margin: 0; font-size: .95em; }
.sheet dt { color: #555; }
.sheet dd { margin: 0; }
.sheet section { margin-top: 1.5em; }
.sheet h2 { font-size: .95em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 .55em; padding-bottom: .33em; border-bottom: 1pt solid #000; }
.sheet .sides { display: grid; grid-template-columns: 1fr 1fr; gap: 1em 2.27em; }
.sheet .sides.single { display: block; columns: 2; column-gap: 2.27em; }
.sheet .side h3 { font-size: 1em; margin: 0 0 .33em; display: flex; justify-content: space-between; }
.sheet .side h3 span, .sheet .t .p, .sheet .t .d, .sheet .total, .sheet .sub { font-weight: 400; color: #555; }
.sheet .t { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 0 .42em; break-inside: avoid; }
.sheet .sub { break-inside: avoid; margin-top: .2em; }
.sheet .total { text-align: right; margin-top: .42em; }
.sheet .c { display: grid; grid-template-columns: 18em minmax(0, 1fr); gap: 0 .63em; margin-bottom: .32em; line-height: 1.3; font-size: var(--credit-size, .9em); }
.sheet .c b { font-weight: 400; color: #555; }
.sheet .more { margin-top: .4em; font-size: var(--credit-size, .9em); color: #555; }
.sheet .notes { margin-top: auto; padding-top: 1.5em; }
.sheet .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3em 2.27em; margin-top: .75em; }
.sheet .f { display: flex; align-items: baseline; gap: 1.2em; font-size: .9em; color: #000; white-space: nowrap; }
.sheet .f i { flex: 1; min-width: 0; height: 1.5em; overflow: hidden; border-bottom: .5pt solid #777; font-style: normal; line-height: 1.4; }
.sheet .f i.filled { border-bottom: 0; }
/* The footer stays at the bottom of the page, with its rule above it. */
.sheet footer { margin-top: auto; padding-top: .8em; border-top: .5pt solid #777; font-size: .74em; color: #555; display: flex; justify-content: space-between; }
.sheet .notes + footer { margin-top: 0; }
.sheet section:has(+ footer) { margin-bottom: 1.5em; }

@media print {
  .tool-ui, .zoom-bar { display: none; }
  .preview { height: auto !important; overflow: visible !important; box-shadow: none; }
  .stage { width: auto !important; height: auto !important; transform: none !important; }
  .pages, .pages.multi { display: block; position: static; width: auto; transform: none !important; }
  .pages .sheet + .sheet { break-before: page; }
}
