:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #202820;
  background: #f5f6f2;
  font-synthesis: none;
  --green: #244e3f;
  --green-hover: #193e30;
  --ink: #202820;
  --muted: #626d63;
  --line: #dce2da;
  --soft: #f0f3ed;
  --surface: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, select, .button { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid #457b5d;
  outline-offset: 3px;
}
.topbar { border-bottom: 1px solid var(--line); background: #fbfcf8; }
.topbar-inner { max-width: 1220px; padding: 0 32px; min-height: 67px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; gap: 12px; align-items: center; font-size: 16px; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; position: relative; background: var(--green); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 11px; height: 13px; border: 1.4px solid #fff; border-radius: 2px; }
.brand-mark::before { top: 7px; left: 11px; opacity: .55; }
.brand-mark::after { top: 10px; left: 8px; background: var(--green); }
.privacy { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.privacy-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #639574; }
main { max-width: 1220px; margin: auto; padding: 52px 32px 62px; }
.intro { margin-bottom: 30px; }
h1 { margin: 0; font-size: clamp(31px, 4vw, 51px); font-weight: 735; letter-spacing: -.065em; line-height: 1.08; }
.intro p { margin: 13px 0 0; color: var(--muted); font-size: 16px; line-height: 1.52; }
.workspace { display: grid; grid-template-columns: minmax(355px, .79fr) minmax(0, 1.21fr); align-items: start; gap: 20px; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; box-shadow: 0 3px 10px #26362405; }
.editor { padding: 22px; }
.section-title, .preview-heading { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
h2 { margin: 0; font-size: 19px; font-weight: 720; letter-spacing: -.032em; }
.muted { color: var(--muted); font-size: 12px; }
.drop-zone {
  margin-top: 15px; padding: 16px; display: flex; align-items: center; justify-content: center; gap: 9px;
  flex-direction: column; min-height: 105px; border: 1px dashed #bac8b7; border-radius: 11px; background: #f7f9f5;
}
.drop-zone.is-over { background: #e7f0e6; border-color: var(--green); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: 13px; text-decoration: none; white-space: nowrap; }
.add-button { border-color: #c9d4c8; color: var(--green); background: white; }
.add-button span { font-size: 18px; font-weight: 500; }
.add-button:hover:not(:disabled) { background: #eff5ee; border-color: #9bb3a0; }
.add-button:disabled { opacity: .65; }
.page-list { list-style: none; padding: 0; margin: 13px 0 0; display: grid; gap: 7px; max-height: 410px; overflow: auto; }
.page-list:empty { display: none; }
.page-row { min-width: 0; display: grid; grid-template-columns: 17px 35px minmax(0, 1fr) auto; align-items: center; gap: 7px; border-radius: 8px; border: 1px solid var(--line); padding: 6px; }
.page-row.is-target { outline: 2px solid #6c9c7a; outline-offset: -2px; }
.page-row[draggable="true"] .page-index { cursor: grab; }
.page-index { color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; font-size: 11px; }
.thumbnail { display: grid; place-items: center; width: 35px; height: 43px; border-radius: 4px; background: var(--soft); overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 700; }
.thumbnail img { max-width: 27px; max-height: 32px; object-fit: contain; }
.page-label { min-width: 0; }
.file-name { display: block; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.row-actions { display: flex; gap: 2px; }
.icon-button { display: inline-grid; place-items: center; width: 31px; height: 34px; padding: 0; line-height: 1; font-size: 18px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--green); }
.icon-button:hover:not(:disabled) { border-color: var(--line); background: var(--soft); }
.icon-button:disabled { color: #abb2a9; }
.build-form { margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--line); }
.limit-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.limit-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 8px; }
.limit-input { display: flex; align-items: stretch; height: 38px; border: 1px solid #cbd4c8; border-radius: 7px; }
.limit-input input { min-width: 0; width: 73px; padding: 0 8px; color: var(--ink); border: 0; background: transparent; border-radius: 7px 0 0 7px; font-weight: 650; }
.limit-input select { border: 0; border-left: 1px solid var(--line); background: #f7f9f5; padding: 0 4px; border-radius: 0 7px 7px 0; color: var(--ink); font-size: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; }
.presets button { color: var(--green); min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 0 6px; font-size: 11px; font-weight: 625; }
.presets button:hover:not(:disabled), .presets button[aria-pressed="true"] { background: #eaf1e8; border-color: #b8cbb9; }
.limit-detail { margin: 7px 0 16px; min-height: 17px; }
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--green-hover); }
.primary:disabled, .primary[aria-disabled="true"] { background: #e2e8df; color: #59675b; cursor: default; }
#build-pdf { width: 100%; justify-content: space-between; min-height: 45px; padding: 0 15px; text-align: left; }
.notice, .preview-error { margin: 9px 0 0; font-size: 12px; line-height: 1.48; color: var(--muted); overflow-wrap: anywhere; }
.notice.warning, .preview-error { color: #8c481d; }
.preview-heading { padding: 21px 22px 16px; }
.result-indicator { padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #235439; background: #e9f2e8; white-space: nowrap; }
.result-indicator.warning { background: #fff1e2; color: #8c481d; }
.preview-toolbar { padding: 0 22px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.navigation { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.navigation .icon-button { border-color: var(--line); font-size: 22px; }
#zoom { min-height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); font-size: 12px; }
.preview-stage { display: block; min-height: 390px; max-height: min(580px, 65vh); overflow: auto; position: relative; margin: 0 14px; border-radius: 9px; background: #edf0ea; border: 1px solid #e2e7df; }
.preview-empty { min-height: 389px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
.paper { width: 63px; height: 77px; background: white; border: 1px solid #d1dacd; border-radius: 5px; padding: 25px 11px 10px; position: relative; box-shadow: 0 3px 5px #333d3110; }
.paper::after { content: ""; top: -1px; right: -1px; position: absolute; width: 15px; height: 15px; border-radius: 0 4px 0 4px; border-left: 1px solid #d1dacd; border-bottom: 1px solid #d1dacd; background: #edf0ea; }
.paper span { display: block; height: 2px; margin: 0 0 8px; border-radius: 1px; background: #d0dacf; }
.paper span:last-child { width: 66%; }
.preview-document { width: max-content; min-width: 100%; padding: 14px; display: grid; justify-content: center; align-items: start; }
.preview-document canvas { display: block; background: white; box-shadow: 0 1px 5px #30373028; }
.preview-sheet { position: relative; --scale-round-x: 1px; --scale-round-y: 1px; }
/* PDF.js positions text in unrotated page coordinates and provides the run metrics. */
.preview-text {
  position: absolute; top: 0; left: 0; overflow: hidden;
  transform-origin: 0 0; line-height: 1; text-size-adjust: none;
  --min-font-size: 1;
}
.preview-text :is(span, br) {
  position: absolute; color: transparent; white-space: pre; cursor: text;
  transform-origin: 0 0;
}
.preview-text span {
  font-size: calc(var(--total-scale-factor) * var(--min-font-size) * var(--font-height));
  transform: rotate(var(--rotate, 0deg)) scaleX(var(--scale-x, 1)) scale(calc(1 / var(--min-font-size)));
}
.preview-text[data-main-rotation="90"] { transform: rotate(90deg) translateY(-100%); }
.preview-text[data-main-rotation="180"] { transform: rotate(180deg) translate(-100%, -100%); }
.preview-text[data-main-rotation="270"] { transform: rotate(270deg) translateX(-100%); }
.preview-text ::selection { color: transparent; background: #286aff55; }
.preview-error { margin: 20px; }
.preview-footer { min-height: 74px; padding: 13px 18px 15px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.result-detail { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.result-detail strong { display: block; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.download { padding-left: 12px; padding-right: 12px; }
@media (max-width: 750px) {
  .topbar-inner { min-height: 57px; padding: 0 18px; }
  main { padding: 31px 16px 34px; }
  .intro { margin-bottom: 22px; }
  .intro p { font-size: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .editor { padding: 16px; }
  .preview-heading { padding: 17px 16px 13px; }
  .preview-toolbar { padding: 0 15px 9px; }
  .preview-stage { min-height: 260px; margin: 0 10px; max-height: 490px; }
  .preview-empty { min-height: 258px; }
  .preview-footer { padding: 10px 13px 13px; }
  .icon-button { width: 33px; min-height: 36px; }
}
@media (max-width: 365px) {
  .privacy { font-size: 10px; }
  .brand { gap: 7px; font-size: 14px; }
  .page-row { grid-template-columns: 17px 35px minmax(0, 1fr); }
  .row-actions { grid-column: 2 / -1; justify-content: flex-end; }
  .icon-button { width: 28px; }
  .preview-footer { align-items: start; flex-direction: column; }
  .download { width: 100%; }
}
.brand { color: var(--ink); text-decoration: none; }
.tool-guidance { max-width: 700px; margin-top: 28px; }
.tool-guidance p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tool-nav { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.tool-nav ul { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; padding: 0; list-style: none; }
.tool-nav a { display: inline-block; padding: 4px 0; color: var(--green); font-size: 13px; text-underline-offset: 3px; }
.tool-nav a[aria-current="page"] { color: var(--ink); font-weight: 650; }
