:root {
  color-scheme: light;
  --ink: #192337;
  --muted: #647087;
  --line: #e0e6ee;
  --blue: #255de3;
  --blue-hover: #174dcd;
  --surface: #fff;
  --background: #f7f8fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; color: var(--ink); background: var(--background); }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app { max-width: 540px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 21px calc(24px + env(safe-area-inset-bottom)); }
.app-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; flex: none; width: 35px; height: 43px; border: 2px solid #b7c8ef; padding: 4px; border-radius: 5px; background: white; }
.brand-mark span { border-radius: 1px; background: #8caaf0; }
.brand-mark span:nth-child(2) { background: #b7d0e9; }
.brand-mark span:nth-child(3) { background: #b4baf0; }
.brand-mark span:nth-child(4) { background: #d5deed; }
h1 { font-size: 22px; font-weight: 740; letter-spacing: -0.6px; margin: 0 0 4px; }
.subtitle { font-size: 12.5px; color: var(--muted); margin: 0; }
.workspace { display: flex; flex-direction: column; align-items: center; }
.preview-heading { width: min(100%, 348px); display: flex; justify-content: space-between; font-size: 10px; font-weight: 720; color: var(--muted); letter-spacing: 1px; margin: 0 0 10px; }
.sheet { position: relative; aspect-ratio: 8.5 / 11; width: min(100%, 348px); overflow: hidden; background: #fff; border: 1px solid #e1e4eb; border-radius: 2px; box-shadow: 0 8px 26px #17233c14; }
.empty-grid { position: absolute; left: 2.35294118%; top: 1.06060606%; width: 95.29411765%; height: 97.87878788%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); column-gap: 1.23456790%; row-gap: .92879257%; }
.empty-cell { display: grid; place-items: center; color: #a9b4c6; font-size: 20px; background: #fafbfe; border: 1px dashed #d9e0ea; }
.sheet-preview { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: fill; -webkit-user-select: auto; user-select: auto; -webkit-touch-callout: default; }
.sheet-caption { margin: 13px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.controls { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin: 23px auto 0; max-width: 348px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.button { min-height: 50px; padding: 13px 15px; border: 1px solid transparent; border-radius: 12px; font-size: 15px; font-weight: 650; cursor: pointer; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:active { background: var(--blue-hover); }
.button-secondary { color: var(--blue); background: #fff; border-color: #cdd9f2; }
.button:disabled { opacity: .56; cursor: default; }
.button:focus-visible, a:focus-visible, .clear-button:focus-visible { outline: 3px solid #8eb0ff; outline-offset: 3px; }
.status { text-align: center; font-size: 12px; color: var(--muted); min-height: 16px; line-height: 1.4; margin: 2px 0 0; }
.status.error { color: #a42828; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.save-help { font-size: 12px; line-height: 1.55; color: #58657a; margin: 2px 1px; }
.save-help a { color: var(--blue); text-underline-offset: 2px; }
.clear-button { align-self: center; border: 0; background: none; padding: 8px 16px; color: #5b657a; font-size: 13px; cursor: pointer; }
footer { max-width: 370px; margin: 27px auto 0; border-top: 1px solid var(--line); padding-top: 15px; text-align: center; }
footer p { font-size: 11px; line-height: 1.6; color: #8490a2; margin: 3px 0; }
.print-only { display: none; }
@media (min-width: 600px) { .app { padding-top: 42px; } }
@media (max-height: 710px) { .app-header { margin-bottom: 16px; } .sheet { width: min(100%, 285px); } .preview-heading { max-width: 285px; } .controls { margin-top: 14px; } footer { margin-top: 16px; } }
@media print {
  @page { size: letter portrait; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; width: 8.5in !important; height: 11in !important; min-height: 0; background: #fff !important; }
  .app { display: none !important; }
  .print-only { display: block !important; position: absolute; top: 0; left: 0; width: 8.5in; height: 11in; margin: 0; padding: 0; }
  .print-only img { display: block; width: 8.5in; height: 11in; margin: 0; padding: 0; object-fit: fill; }
}
/* Session-only page browsing; the save/print controls always act on this page. */
.page-navigation { width: min(100%, 348px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; margin: 14px 0 0; }
.page-button { color: var(--blue); background: #fff; border: 1px solid #d7dfec; border-radius: 10px; min-height: 42px; padding: 9px 7px; font-size: 12px; font-weight: 650; cursor: pointer; }
.page-button:disabled { opacity: .35; cursor: default; }
.page-button:focus-visible { outline: 3px solid #8eb0ff; outline-offset: 3px; }
.page-count { display: flex; flex-direction: column; align-items: center; gap: 3px; white-space: nowrap; }
.page-count strong { font-size: 13px; font-weight: 750; }
.page-count span { font-size: 10px; color: var(--muted); }
