/* Workpaper binder: stacked ledger-paper sheets, ink figures, red-pencil tick marks and cross-references. */

:root {
  --desk: #dfe6df;
  --paper: #f7faf5;
  --paper-alt: #eef4ec;
  --rule: #d3e1d2;
  --rule-strong: #8fb59a;
  --ink: #1d2b38;
  --ink-soft: #566872;
  --pencil: #c2362b;
  --target: #fbecd0;
  --shadow: 0 1px 0 rgba(29, 43, 56, .06), 0 10px 28px -14px rgba(29, 43, 56, .3);
  --hand: 'Caveat', 'Segoe Print', cursive;
  --sans: 'Public Sans', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #101714;
    --paper: #18211d;
    --paper-alt: #1c2722;
    --rule: #26342d;
    --rule-strong: #3f6150;
    --ink: #dbe5de;
    --ink-soft: #92a59b;
    --pencil: #ef6a5c;
    --target: #3a3220;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --desk: #101714;
  --paper: #18211d;
  --paper-alt: #1c2722;
  --rule: #26342d;
  --rule-strong: #3f6150;
  --ink: #dbe5de;
  --ink-soft: #92a59b;
  --pencil: #ef6a5c;
  --target: #3a3220;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  padding: 32px 24px 48px;
}

h2, h3, p { margin: 0; }
a { color: inherit; }

::selection { background: color-mix(in srgb, var(--pencil) 22%, transparent); color: var(--ink); }
a:focus-visible { outline: 2px solid var(--pencil); outline-offset: 3px; border-radius: 2px; }

.binder { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }

.sheet {
  background: var(--paper);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 30px 40px 34px;
}

/* Heading block with the workpaper index box in the corner. */
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 3px double var(--rule-strong);
}
.client { font-size: 13px; color: var(--ink-soft); }
.sheet-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; line-height: 1.2; }
.cover .sheet-head h2 { font-size: 34px; }
.asof { color: var(--ink-soft); margin-top: 2px; }

.wpbox {
  flex-shrink: 0;
  align-self: flex-start;
  border: 1.5px solid var(--pencil);
  border-radius: 4px;
  padding: 6px 12px 8px;
  text-align: right;
  color: var(--pencil);
  font-family: var(--hand);
  line-height: 1.05;
  min-width: 112px;
}
.wpbox .wp { display: block; font-size: 30px; }
.wpbox .initials { display: block; font-size: 17px; }

h3 { font-size: 15px; font-weight: 700; margin: 22px 0 6px; }
.cover-grid h3:first-child { margin-top: 0; }
.lead { color: var(--ink-soft); margin-bottom: 14px; max-width: 72ch; }
.note { font-size: 14px; color: var(--ink-soft); margin-top: 14px; max-width: 76ch; }
.muted { color: var(--ink-soft); }

/* Cover */
.cover-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; }
.cover-grid p { max-width: 62ch; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.signoff { margin: 0; display: grid; gap: 6px; }
.signoff div { display: grid; grid-template-columns: 96px 1fr; }
.signoff dt { color: var(--ink-soft); }
.signoff dd { margin: 0; }
.index, .legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 3px; }
.index li { display: grid; grid-template-columns: 64px 1fr; align-items: baseline; }
.legend li { display: grid; grid-template-columns: 48px 1fr; align-items: baseline; font-size: 13.5px; color: var(--ink-soft); }

/* Red-pencil marks and references. */
.tick, .xref, .ref {
  font-family: var(--hand);
  font-weight: 600;
  color: var(--pencil);
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
}
.tick sub { font-size: 14px; vertical-align: -2px; margin-left: 1px; }
.xref, .ref { text-decoration: none; border-bottom: 1px solid transparent; }
.xref:hover, .ref:hover { border-bottom-color: currentColor; }
.ref { font-size: 17px; }
.src { font-size: 13px; color: var(--ink-soft); text-underline-offset: 2px; }
.src:hover { color: var(--ink); }

/* Reconciliation summary: the classic statement form. */
.rec { width: 100%; max-width: 720px; border-collapse: collapse; font-size: 16px; }
.rec td { padding: 7px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.rec .in { padding-left: 24px; }
.rec .n { text-align: right; font-weight: 600; width: 150px; padding-right: 4px; }
.rec .tk { width: 72px; text-align: center; }
.rec tr.total td { border-top: 1.5px solid var(--ink); font-weight: 700; }
.rec tr.gap td { border: 0; padding: 6px 0; }
.rec tr.grand td { font-size: 19px; font-weight: 700; border-bottom: 0; }
.rec tr.grand .n { text-decoration: underline double; text-underline-offset: 6px; }

/* Schedules */
.scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { white-space: nowrap; }
.grid th.grow { width: 100%; }
.grid th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 10px 6px 0;
  border-bottom: 1.5px solid var(--rule-strong);
  white-space: nowrap;
}
.grid td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.grid tbody tr:nth-child(even) td { background: var(--paper-alt); }
.grid .n { text-align: right; white-space: nowrap; font-weight: 600; padding-right: 12px; }
.grid td.n { border-left: 2px solid var(--rule-strong); padding-left: 16px; }
.grid .tk { width: 52px; text-align: center; }
.grid .caps { font-size: 13px; letter-spacing: .01em; }
.grid .in { padding-left: 24px; }
.grid small { color: var(--ink-soft); font-size: 12px; }
.grid tr.total td { border-top: 1.5px solid var(--ink); border-bottom: 0; font-weight: 700; background: transparent; }
.grid tr.sub td { color: var(--ink-soft); }
.grid.compact { max-width: 620px; }
.grid.je tbody tr td { background: transparent; }
.grid.je td[rowspan] { vertical-align: top; }
.grid tr:target td { background: var(--target); }

.source {
  max-width: 1040px;
  margin: 28px auto 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.source p { max-width: 82ch; }
.source .xref { font-size: 16px; }

@media (max-width: 820px) {
  body { padding: 16px 12px 32px; }
  .sheet { padding: 22px 18px 26px; }
  .sheet-head { gap: 12px; }
  .sheet-head h2, .cover .sheet-head h2 { font-size: 22px; }
  .wpbox { min-width: 0; padding: 4px 8px 6px; }
  .wpbox .wp { font-size: 24px; }
  .wpbox .initials { font-size: 14px; }
  .cover-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .rec { font-size: 14.5px; }
  .rec .in { padding-left: 12px; }
  .rec .n { width: auto; white-space: nowrap; padding-left: 8px; }
  .rec .tk { width: 40px; }
  .rec .tk:last-child { width: 20px; }
}

@media print {
  body { background: #fff; padding: 0; }
  .binder { gap: 0; max-width: none; }
  .sheet { box-shadow: none; break-after: page; padding: 0 0 24px; }
  .grid tbody tr:nth-child(even) td { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
