:root {
  --red: #c92e25;
  --ink: #172337;
  --muted: #526175;
  --line: #dce2e9;
  --paper: #f5f6f8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    16px/1.55 system-ui,
    -apple-system,
    sans-serif;
}
a {
  color: #a4251d;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 16px;
  text-decoration: none;
  font-weight: 650;
  display: inline-block;
}
button.primary,
.button {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  filter: brightness(0.95);
}
:focus-visible {
  outline: 3px solid #2265c9;
  outline-offset: 3px;
}
header {
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav {
  max-width: 1180px;
  margin: auto;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}
.nav img {
  width: 160px;
  height: auto;
}
.nav a {
  font-weight: 650;
}
main {
  max-width: 1180px;
  margin: auto;
  padding: 28px 20px 64px;
}
.intro {
  max-width: 750px;
}
h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}
h2 {
  margin-top: 0;
  font-size: 25px;
}
h3 {
  font-size: 19px;
}
p {
  color: var(--muted);
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}
.tabs [aria-selected="true"] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.tool {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 4vw, 32px);
  scroll-margin-top: 90px;
}
.tool[hidden],
[hidden] {
  display: none !important;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.fields {
  display: grid;
  gap: 15px;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
label {
  display: block;
  font-weight: 600;
  font-size: 14px;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
textarea,
select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #b9c3cf;
  border-radius: 8px;
  margin-top: 5px;
  background: white;
  color: var(--ink);
}
input[type="color"] {
  display: block;
  width: 80px;
  height: 38px;
  margin-top: 5px;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0;
}
.status {
  padding: 12px;
  border-radius: 8px;
  background: #eef4ff;
  color: #164c92;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.status:empty {
  display: none;
}
.status.error {
  background: #fff0ee;
  color: #9d1e16;
}
.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 290px;
  background: #f6f7f9;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  padding: 20px;
}
.preview canvas,
.preview img {
  max-width: 100%;
  height: auto;
}
.checker {
  background: repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50%/20px 20px;
}
.drop {
  border: 2px dashed #9aa9bc;
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  background: #fafbfc;
}
.drop.drag {
  border-color: var(--red);
  background: #fff1ef;
}
.drop input {
  max-width: 100%;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.metrics {
  padding: 12px 0;
  font-variant-numeric: tabular-nums;
}
.page-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow: auto;
}
.page-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-list span {
  flex: 1;
  overflow-wrap: anywhere;
}
.page-list button {
  padding: 6px 10px;
}
.destination {
  overflow-wrap: anywhere;
  background: white;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.short-preview {
  max-width: 650px;
  padding-top: 60px;
}
.tag {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}
.small-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
footer {
  background: var(--ink);
  color: white;
  padding: 24px;
  text-align: center;
}
footer a {
  color: white;
  margin: 0 8px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 20px;
  top: 10px;
  z-index: 20;
  background: white;
  padding: 8px;
}
.sr-only {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#qr-preview canvas,
#qr-preview svg {
  width: 280px !important;
  height: 280px !important;
  max-width: 100%;
}
#bg-output {
  max-height: 600px;
}
.pill {
  background: #eef0f4;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 13px;
}
.notice {
  border-left: 3px solid var(--red);
  padding: 0 15px;
  margin: 24px 0;
}
.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .nav {
    gap: 12px;
    flex-wrap: wrap;
  }
  .nav img {
    width: 135px;
  }
  .tool {
    padding: 18px;
  }
  .preview {
    min-height: 200px;
  }
  .small-grid {
    grid-template-columns: 1fr;
  }
  button {
    min-height: 42px;
  }
  main {
    padding: 20px 14px 40px;
  }
  .tabs {
    gap: 6px;
  }
  .tabs button {
    font-size: 14px;
    padding: 8px 12px;
  }
}
/* Shared SK Printers brand: warm paper, red accents, Inter and Lora. */
:root {
  --paper: #faf9f6;
  --line: #e2e8f0;
  --gold: #96681f;
}
body {
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 80% 0%, #fff0e6 0, transparent 42%), var(--paper);
}
header {
  background: rgba(250, 249, 246, 0.95);
  backdrop-filter: blur(12px);
}
.nav,
main {
  max-width: 1280px;
}
.nav {
  padding: 16px clamp(16px, 3.5vw, 40px);
}
.nav .row a {
  text-decoration: none;
  font-size: 14px;
}
.nav .row a:hover {
  color: var(--red);
}
main {
  padding: 44px clamp(16px, 3.5vw, 40px) 72px;
}
.intro {
  max-width: 870px;
  padding-bottom: 8px;
}
h1 {
  font-size: clamp(34px, 4.5vw, 56px);
  line-height: 1.12;
  font-weight: 800;
  margin: 18px 0;
}
h1 em {
  font-family: Lora, Georgia, serif;
  font-weight: 500;
  color: var(--red);
}
h2 {
  font-size: clamp(24px, 3vw, 30px);
  letter-spacing: -0.03em;
}
h3 {
  letter-spacing: -0.02em;
}
.intro p {
  max-width: 760px;
  line-height: 1.75;
}
.tabs {
  padding: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 20px;
  gap: 8px;
}
.tabs button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  font-size: 14px;
}
.tabs [aria-selected="true"] {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 4px 12px #c92e2520;
}
.tabs [aria-selected="true"] .pill {
  color: var(--red);
  background: white;
}
.tool {
  border-radius: 24px;
  box-shadow:
    0 10px 25px -5px #0000000a,
    0 8px 10px -6px #0000000a;
}
button,
.button {
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
button.primary,
.button {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
button:disabled {
  opacity: 0.6;
}
input,
select,
textarea {
  accent-color: var(--red);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
select,
textarea {
  border-color: #cbd5e1;
  border-radius: 10px;
}
input[type="range"] {
  padding: 0 !important;
}
.drop {
  border-color: #d9b0a7;
  background: #fffaf7;
}
.status {
  background: #f8f4e9;
  color: #715115;
}
.preview {
  border-radius: 18px;
  background-color: #faf8f5;
}
.pill {
  color: var(--gold);
  background: #f8f0dd;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
}
.export-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.download-slot:empty {
  display: none;
}
summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--red);
}
#bg-brush {
  display: block;
  max-width: 100%;
  max-height: 600px;
  object-fit: contain;
  touch-action: none;
  cursor: crosshair;
}
#bg-refine {
  margin-top: 18px;
}
#sheet-crop-preview {
  max-height: 340px;
}
.paper-preview canvas {
  max-height: 580px;
  object-fit: contain;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 14px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  background: #faf8f5;
}
td.good {
  color: #166534;
  font-weight: 600;
}
td.fair {
  color: #8b5c08;
  font-weight: 600;
}
td.low {
  color: #a4251d;
  font-weight: 600;
}
footer {
  background: #faf7f6;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer a {
  color: var(--muted);
  font-size: 14px;
}
@media (max-width: 720px) {
  main {
    padding-top: 28px;
  }
  .tabs {
    padding: 8px;
  }
  .tabs button {
    flex: 1 1 42%;
    text-align: left;
    padding: 10px;
  }
  .nav .row {
    gap: 12px;
  }
  .nav .row a {
    font-size: 12px;
  }
  .tool {
    border-radius: 18px;
  }
  .actions .export-action {
    flex: 1 1 100%;
  }
  .actions .export-action button {
    width: 100%;
  }
  th,
  td {
    padding: 10px 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.metrics {
  white-space: pre-line;
}
/* Eight equal tool categories: two rows on desktop. */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tabs button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 10px 8px;
}
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: white;
  color: var(--red);
  border-color: #d9a49d;
  white-space: nowrap;
  min-height: 42px;
}
.download-button::before {
  content: "↓";
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}
.download-button[aria-disabled="true"] {
  background: #f5f3f0;
  border-color: #ddd8d2;
  color: #77716a;
  cursor: not-allowed;
  pointer-events: none;
}
.download-button[aria-disabled="false"]:hover {
  background: #fff3ef;
  border-color: var(--red);
}
.download-slot {
  display: flex;
  align-items: center;
}
.export-action {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}
.section-heading p {
  margin-bottom: 0;
}
.pdf-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  background: #f5f2ed;
  border-radius: 14px;
  margin: 24px 0;
  width: fit-content;
}
.pdf-tabs button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.pdf-tabs [aria-selected="true"] {
  background: white;
  color: var(--red);
  border-color: #eaded9;
  box-shadow: 0 2px 6px #00000008;
}
.pdf-layout,
.pdf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.pdf-source {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fcfbf8;
  gap: 12px;
}
.pdf-source h3,
.pdf-options > h3 {
  margin: 0 0 8px;
}
.pdf-source .drop {
  padding: 20px 14px;
}
.pdf-options {
  display: grid;
  gap: 14px;
}
.pdf-action {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  display: grid;
  gap: 14px;
}
.pdf-action h4 {
  font-size: 16px;
  margin: 0 0 4px;
}
.pdf-action p {
  font-size: 13px;
  margin: 0;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.pdf-action .status {
  font-size: 13px;
  padding: 9px 12px;
}
.pdf-source .page-list {
  margin: 0;
  max-height: 440px;
}
.page-list:empty {
  min-height: 140px;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d8d0c6;
  border-radius: 12px;
}
.page-list:empty::before {
  content: "Your pages will appear here";
  color: var(--muted);
  font-size: 14px;
  padding: 24px;
}
.pdf-note {
  padding: 28px;
  background: #faf6ef;
  border-radius: 18px;
  border: 1px solid #eee4d7;
}
.pdf-note h3 {
  margin: 10px 0;
}
.pdf-note p {
  font-size: 14px;
}
.pdf-workspace > .fields {
  gap: 18px;
}
.pdf-workspace h3 {
  margin: 0;
}
.pdf-workspace .fields > p {
  margin: 0;
}
#pdf-suite .pdf-panel {
  scroll-margin-top: 100px;
}
@media (max-width: 900px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pdf-layout,
  .pdf-workspace {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .pdf-note {
    padding: 20px;
  }
}
@media (max-width: 720px) {
  .tabs button {
    flex: none;
    min-height: 56px;
    font-size: 13px;
    text-align: center;
  }
  .pdf-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
  }
  .pdf-tabs button {
    font-size: 12px;
    padding: 10px 6px;
  }
  .pdf-source,
  .pdf-action {
    padding: 16px;
  }
  .action-row {
    gap: 8px;
  }
  .action-row > button,
  .action-row > .download-slot {
    flex: 1 1 42%;
  }
  .action-row .download-button {
    width: 100%;
  }
  .export-action button {
    width: auto;
  }
}

.tool-footer nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.tool-footer a {
  margin: 0;
  padding: 6px 0;
}
