/* Journal Entries Practice: a day book on a clerk's desk. Warm stone paper, carbon-black ink, a burnt-orange accent,
   teal double rules under the column heads and down the Dr / Cr fold, figures in a mono face, condensed grotesque
   headings. The hero carries a drawn T: one debit, one credit. On paper: black rules on white, each problem kept whole. */
:root {
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --ink: #1d1b18;
  --muted: #57524a;
  --line: #ddd5c7;
  --edge: #857d6f;
  --accent: #a3441a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3d6;
  --rule: #2b6870;
  --given: #f3efe6;
  --info: #2b6870;
  --ok: #1f6a3a;
  --ok-soft: #dcefe2;
  --bad: #a3271f;
  --bad-soft: #f8e1dd;
  --warn: #7a5300;
  --warn-soft: #f6ead0;
  --focus: #1b5fd0;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cond: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 2px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --paper: #202124;
    --ink: #ece8e1;
    --muted: #b1aba0;
    --line: #34353a;
    --edge: #7d786f;
    --accent: #f29a62;
    --accent-ink: #2a1206;
    --accent-soft: #3a2518;
    --rule: #79c0c8;
    --given: #26272b;
    --info: #79c0c8;
    --ok: #8fd8a3;
    --ok-soft: #15301d;
    --bad: #ff9c8f;
    --bad-soft: #3a1c18;
    --warn: #f0c56b;
    --warn-soft: #352a12;
    --focus: #8ab8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 0 12px; border-bottom: 1px solid var(--edge); }
.hero > div:first-child { max-width: 800px; }
h1 { font: 700 clamp(1.8rem, 4.8vw, 2.75rem)/1.05 var(--cond); margin: 0 0 8px; letter-spacing: -0.01em; font-stretch: condensed; }
.lede { margin: 0 0 4px; color: var(--muted); max-width: 64ch; }
h2 { font: 700 1.35rem/1.2 var(--cond); margin: 0 0 10px; font-stretch: condensed; }
/* a drawn T-account: debit on the left, credit on the right */
.tglyph { flex: none; width: 150px; font: 600 0.8rem var(--mono); color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; border-top: 4px solid var(--accent); padding-top: 4px; }
.tglyph span { padding: 2px 8px; }
.tglyph span:nth-child(odd) { border-right: 4px solid var(--accent); text-align: right; }
.tglyph b { display: block; color: var(--ink); font-weight: 700; }
@media (max-width: 640px) { .tglyph { display: none; } }

/* layout: settings, then the sheet at full width */
.setup { margin: 14px 0 4px; }
.work-area { min-width: 0; }
@media (min-width: 1000px) {
  .setup { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 4px 22px; align-items: end; }
  .setup .setrow { grid-column: 1 / -1; }
}
fieldset { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; max-width: 440px; }
.sg, .lg { position: relative; display: block; cursor: pointer; }
.sg + .sg { border-left: 1px solid var(--edge); }
.sg input, .lg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sg > span { display: flex; align-items: center; justify-content: center; min-height: 44px; height: 100%; padding: 4px 6px; text-align: center; font-size: 0.95rem; font-weight: 650; background: var(--paper); }
.sg input:checked + span { background: var(--ink); color: var(--bg); }
.lseg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
@media (min-width: 700px) { .lseg { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.lg > span { display: flex; flex-direction: column; justify-content: center; min-height: 50px; height: 100%; padding: 4px 8px; background: var(--paper); font-size: 0.9rem; font-weight: 600; line-height: 1.15; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lg b { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.lg input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18); }
.lg input:checked + span b { color: inherit; opacity: 0.85; }
.sg input:focus-visible + span, .lg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.setrow { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { max-width: 100%; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.95); }
.link { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.rules { margin: 12px 0 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); font-size: 1rem; }
.rules > summary { cursor: pointer; font-weight: 650; padding: 10px 12px; min-height: 44px; }
.rules ul { margin: 0; padding: 0 12px 10px 30px; color: var(--muted); max-width: 82ch; }
.rules li { margin: 0 0 6px; }
.note { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--warn); background: var(--warn-soft); overflow-wrap: anywhere; border-radius: var(--r); }
.note.info { border-color: var(--info); background: var(--paper); }
.note .link { min-height: 0; padding: 0; font-weight: 600; }

/* the sheet */
.sheet { margin: 12px 0 0; }
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 1.25rem; }
.code { font-family: var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.lvname { font: 500 0.9rem var(--sans); color: var(--muted); margin-left: 4px; }
.score { margin: 0; font-size: 0.95rem; color: var(--muted); }
.practice { margin: 6px 0 0; font-size: 0.9rem; color: var(--muted); }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-bottom: 1px solid var(--line); padding: 22px 0 10px; }
.q h3 { font: 700 1.2rem/1.2 var(--cond); margin: 0 0 4px; font-stretch: condensed; }
.q h3 .qn { color: var(--accent); margin-right: 6px; font-family: var(--mono); font-size: 1rem; }
.q .scen { margin: 0 0 6px; max-width: 76ch; }
.qhint { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); max-width: 76ch; }
.fig { margin: 0 0 14px; min-width: 0; }

/* the journal on screen: one block per transaction */
.jents { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 860px; }
.jent { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px 10px; min-width: 0; }
.jtx { margin: 0 0 6px; }
.jd { font: 700 0.85rem var(--mono); color: var(--accent); margin-right: 4px; white-space: nowrap; }
.jgrid { display: grid; gap: 4px; }
.jhead, .jl { display: grid; grid-template-columns: minmax(0, 1fr) 9.5em 9.5em; gap: 6px; align-items: center; }
.jhead { font-size: 0.78rem; font-weight: 650; color: var(--muted); border-bottom: 3px double var(--rule); padding-bottom: 2px; }
.jhead span:not(:first-child) { text-align: right; padding-right: 4px; }
.jc { display: block; min-width: 0; }
.jcl { display: none; }
.jl select.cell { width: 100%; }
.jl input.cell { width: 100%; }
.jn input.cell { width: 100%; font-style: italic; text-align: left; font-family: var(--sans); }
.qparts.in-entry { margin: 8px 0 4px; }
@media (max-width: 560px) {
  .jhead { display: none; }
  .jl { grid-template-columns: 1fr 1fr; padding-top: 6px; border-top: 1px solid var(--line); }
  .jl:first-of-type { border-top: 0; }
  .jl select.cell { grid-column: 1 / -1; }
  .jc { display: flex; align-items: center; gap: 6px; }
  .jcl { display: block; font-size: 0.8rem; font-weight: 650; color: var(--muted); min-width: 2.2em; }
  .jent { padding: 8px 8px 10px; }
}
@media (max-width: 420px) {
  .jc { flex-direction: column; align-items: stretch; gap: 1px; }
  .jcl { min-width: 0; font-size: 0.75rem; }
}

/* given tables and the trial balance */
.twrap { overflow-x: auto; max-width: 100%; background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); }
.twrap:focus-visible { outline-offset: -3px; }
.tcap { margin: 0; padding: 7px 10px 5px; font: 700 0.95rem var(--cond); color: var(--rule); border-bottom: 1px solid var(--line); }
.dt { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.dt th, .dt td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.dt thead th { font-size: 0.78rem; color: var(--muted); font-weight: 650; border-bottom: 3px double var(--rule); vertical-align: bottom; }
.dt .num { text-align: right; white-space: nowrap; }
.dt td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dt tbody th { font-weight: 500; }
.dt tfoot th, .dt tfoot td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.dt td.in { padding: 3px 4px; }
.fig > .twrap { max-width: 760px; }
.tb.scr input.cell { width: 100%; max-width: 9.5em; }
.tb.scr td.num { width: 9.5em; }
.txns td.c-d, .txns th.c-d { white-space: nowrap; width: 5.5em; }
.bals td.num { width: 8em; }
/* the journal on paper and in the key */
.jt td.c-x { width: 55%; }
.jt td.c-f, .jt th.c-f { width: 3.4em; text-align: center; }
.jt .jacc { display: inline; }
.jt .jacc.ind { padding-left: 1.8em; }
.jt .jdr { float: right; padding-left: 8px; }
.jt tr.jnarr td { border-bottom: 1px solid var(--edge); }
.jt .narr { font-style: italic; color: var(--muted); font-size: 0.88rem; }
.jt tr.jline td { border-bottom-color: transparent; }
.jt tr.jline:first-child td { border-top: 0; }
.jt td.c-d { white-space: nowrap; width: 5.5em; color: var(--muted); font-size: 0.86rem; }

/* ledger accounts: Dr on the left, Cr on the right, the fold ruled in teal */
.accts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 900px; }
.accts.tgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-items: start; max-width: none; }
.ledger-doc { background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); max-width: 100%; min-width: 0; }
.lhead { padding: 6px 10px 4px; border-bottom: 1px solid var(--line); }
.ltitle { margin: 0; font: 700 1.02rem var(--cond); text-align: center; font-stretch: condensed; }
.lwrap { overflow-x: auto; max-width: 100%; }
.lwrap:focus-visible { outline-offset: -3px; }
table.ledger { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.ledger th, .ledger td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.ledger thead th { font-size: 0.78rem; font-weight: 650; color: var(--muted); text-align: left; vertical-align: bottom; }
.ledger thead th.num { text-align: right; }
.ledger thead th.grp { color: var(--ink); font-size: 0.85rem; border-bottom: 1px solid var(--line); text-align: center; }
.ledger thead tr:last-child th { border-bottom: 3px double var(--rule); }
.ledger .gs:not(:first-child), .ledger thead th.grp + th.grp { border-left: 3px double var(--rule); }
.ledger td.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.ledger td.txt { font-size: 0.88rem; }
.ledger td.c-dd, .ledger td.c-cd { color: var(--muted); font-size: 0.85rem; }
.ledger td.c-k { color: var(--muted); font-size: 0.85rem; width: 2.6em; }
.ledger td.in { padding: 3px 3px; }
.ledger tr.r-tot td.num { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.ledger tr.r-bal td { border-top: 1px solid var(--ink); font-weight: 650; }
.ledger.key td, .key .ledger td { vertical-align: top; }
.acct.scr td.c-dx, .acct.scr td.c-cx { width: 60%; }
input.cell { font-family: var(--mono); text-align: right; padding: 5px 6px; min-height: 40px; width: 8.6em; }
select.cell { min-height: 40px; padding: 5px 4px; width: 100%; min-width: 9em; font-size: 16px; }
.acct.scr input.cell { width: 100%; min-width: 6.5em; }
.acct.scr:not(.tacct) input.cell { min-width: calc(11ch + 14px); }
input.cell.is-right, select.cell.is-right { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); background: var(--ok-soft); }
input.cell.is-wrong, input.cell.is-unread, select.cell.is-wrong, select.cell.is-unread { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); background: var(--bad-soft); }
.cellfb { max-width: 76ch; margin: -4px 0 10px; }

/* narrow screens: each account's debit side above its credit side (draw.js split) */
.split .ledger-doc { border: 0; border-radius: 0; }
.split .ledger-doc + .ledger-doc { border-top: 2px solid var(--rule); }
.split .lhead { border-bottom: 0; }
.split .ledger thead th.grp { text-align: left; font-size: 0.82rem; color: var(--rule); }
.split .ledger thead th.grp + th.grp { border-left: 0; }
.split .ledger .gs:not(:first-child) { border-left: 0; }
.split table.ledger { table-layout: auto; }
.split .ledger td.c-dx, .split .ledger td.c-cx { width: 100%; white-space: normal; }
.split .ledger td.c-da, .split .ledger td.c-ca { width: calc(11ch + 20px); }
.split input.cell { min-width: calc(11ch + 14px); }

/* questions */
.qparts { max-width: 760px; min-width: 0; }
.part { margin: 0 0 12px; min-width: 0; }
.part > .prompt, .part legend { display: block; font-weight: 600; margin: 0 0 6px; }
.opts { display: grid; gap: 4px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.opt { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; }
.opt input { margin: 3px 0 0; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt .ot { min-width: 0; }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.part.is-right .opt:has(input:checked) { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.part.is-wrong .opt:has(input:checked) { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.ain { display: flex; align-items: center; gap: 4px; }
.ain .pre { font-family: var(--mono); color: var(--muted); }
.ain input { width: 10em; font-family: var(--mono); }
.qfoot { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.qfoot .fb { margin: 0; }
.fbwrap:empty { display: none; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--r); max-width: 76ch; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.fb.more { color: var(--muted); padding: 2px 10px; }
.part.is-right .ain input { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.part.is-wrong .ain input, .part.is-unread .ain input { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.work { margin-top: 4px; min-width: 0; }
.work > summary { cursor: pointer; color: var(--muted); font-size: 0.93rem; padding: 10px 0; min-height: 44px; display: flex; align-items: center; list-style: none; }
.work > summary::-webkit-details-marker { display: none; }
.work > summary::before { content: "+"; margin-right: 6px; font-weight: 700; font-family: var(--mono); }
.work[open] > summary::before { content: "−"; }
.keyfig { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0 0 10px; }
.keyfig > .twrap { max-width: 860px; }
.kans { max-width: 80ch; }
.ans { margin: 0 0 2px; }
.steps { list-style: disc; margin: 2px 0 10px; padding-left: 1.4em; font-size: 0.93rem; overflow-wrap: anywhere; max-width: 84ch; }
.sheet-foot { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 12px 0; }
.confirm { flex: 1 1 100%; margin: 0; padding: 10px 12px; border: 1px solid var(--warn); border-radius: var(--r); background: var(--warn-soft); }
.confirm[hidden] { display: none; }

.share { margin: 10px 0 8px; }
.print-row { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; }
.print-row label, .share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out input { width: 100%; }
.recent { margin-top: 12px; border-top: 1px solid var(--line); }
.recent summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 10px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* content */
.content { padding: 22px 0 8px; max-width: 800px; }
.content h2 { margin-top: 30px; }
.content p { max-width: 68ch; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.sources { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 22px; }

footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 16px 0 28px; color: var(--muted); font-size: 0.92rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

@media (max-width: 600px) {
  .hero { padding-top: 10px; }
  .q .scen { font-size: 0.97rem; }
  .ledger th, .ledger td, .dt th, .dt td { padding: 3px 4px; }
}
@media screen and (max-width: 360px) {
  .lg > span { padding: 4px 5px; font-size: 0.84rem; }
  .setrow { gap: 8px 10px; }
}

/* trial balance on phones: each account name on its own line, its debit and credit boxes side by side under it, so
   each box holds the longest figure ("₹34,86,200") at 320 px */
@media screen and (max-width: 480px) {
  .tb.scr, .tb.scr thead, .tb.scr tbody, .tb.scr tfoot { display: block; }
  .tb.scr tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; border-bottom: 1px solid var(--line); padding: 2px 0; }
  .tb.scr tr > :first-child { grid-column: 1 / -1; }
  .tb.scr th, .tb.scr td, .tb.scr tfoot th, .tb.scr tfoot td { border: 0; }
  .tb.scr tbody th { padding-bottom: 0; }
  .tb.scr thead tr { border-bottom: 3px double var(--rule); }
  .tb.scr thead tr > :first-child { display: none; }
  .tb.scr tfoot tr { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
  .tb.scr td.num { width: auto; }
  .tb.scr input.cell { max-width: none; width: 100%; }
}

/* print: worksheet and key only, black on white */
.print-root { display: none; }
@page { margin: 0.45in 0.45in; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #888; --paper: #fff; --edge: #444; --rule: #000; --given: #fff; --accent: #000; }
  body { background: #fff; color: #000; font: 10pt/1.36 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8pt var(--sans); color: #444; text-align: right; padding-bottom: 5pt !important; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2pt solid #000; margin-bottom: 6pt; }
  .ph h2 { font: 700 15pt var(--cond); margin: 0; }
  .ph p { margin: 0; font-size: 9pt; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 4pt 0 6pt; }
  .plabel { margin: 0 0 6pt; font-size: 8.2pt; font-style: italic; }
  .pq, .pk { list-style: none; margin: 0; padding: 0; }
  .pq > li, .pk > li { padding: 4pt 0 5pt; border-bottom: 0.75pt solid #999; }
  /* a problem may run onto the next page, but never inside a table, an account or a question; the heading stays with
     its first table */
  .pq > li.pq-tb, .pq > li.pq-tbe, .pq > li.pq-jnl, .pq > li.pq-adj, .pq > li.pq-err, .pk > li:not(.pk-post):not(.pk-cycle) { break-inside: avoid; page-break-inside: avoid; }
  .figrow { display: grid; grid-template-columns: 2fr 3fr; gap: 8pt; align-items: start; }
  .pq-tbe .figrow { grid-template-columns: 3fr 2fr; }
  .figrow.sus { display: flex; gap: 10pt; align-items: flex-start; break-inside: avoid; page-break-inside: avoid; }
  .figrow.sus > * { flex: 1 1 0; }
  .figrow.sus > .fig { flex: 3 1 0; }
  .figrow .accts.one > .ledger-doc { width: 100%; }
  .figrow .qparts { columns: 1; margin: 0; }
  .figrow .fig { margin: 0; }
  .pq-tbe ol.popts { columns: 2; column-gap: 16pt; }
  .pqh { break-after: avoid; page-break-after: avoid; break-inside: avoid; page-break-inside: avoid; }
  .pq h3, .pk h3 { font: 700 11.5pt var(--cond); margin: 0 0 2pt; break-after: avoid; page-break-after: avoid; }
  .pq .pscen { margin: 0 0 4pt; }
  .fig { margin: 0 0 5pt; }
  .twrap { overflow: visible; border: 0.9pt solid #000; border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
  .tcap { font-size: 9pt; color: #000; padding: 2pt 5pt; border-bottom: 0.6pt solid #000; }
  .dt { font-size: 8.8pt; }
  .dt th, .dt td { padding: 2pt 4pt; border: 0.5pt solid #777; }
  .dt thead th { color: #000; border-bottom: 2pt double #000; font-size: 7.8pt; }
  .dt tfoot th, .dt tfoot td { border-top: 0.9pt solid #000; border-bottom: 2.2pt double #000; }
  .pq .tb tbody td, .pq .tb tbody th, .pq .tb tfoot td { height: 13.5pt; }
  .pq .txns th, .pq .txns td { padding-top: 1.2pt; padding-bottom: 1.2pt; }
  .jt { table-layout: fixed; }
  .jt th.c-d { width: 11%; } .jt th.c-x { width: 51%; } .jt th.c-f { width: 7%; } .jt th.c-dr, .jt th.c-cr { width: 15%; }
  .pq .jt tbody td { height: 14pt; }
  .in-entry .pp { margin: 0 0 2pt; }
  .pitems > li > p { margin: 0 0 1pt; }
  .jt tr.jline td, .jt tr.jnarr td { border-top: 0; border-bottom: 0.5pt solid #bbb; }
  .jt tr.jnarr td { border-bottom: 0.6pt solid #555; }
  .jt .narr { color: #000; font-size: 8pt; }
  .jt td.c-d { color: #000; font-size: 8pt; }
  .jpaper tbody { break-inside: avoid; page-break-inside: avoid; }
  .ledger-doc { border: 0.9pt solid #000; border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
  .lhead { padding: 2pt 5pt; border-bottom: 0.6pt solid #000; }
  .ltitle { font-size: 9.5pt; }
  .lwrap { overflow: visible; }
  table.ledger { font-size: 8pt; table-layout: fixed; }
  .ledger th, .ledger td { padding: 1.5pt 3pt; border: 0.5pt solid #777; white-space: normal; overflow-wrap: anywhere; }
  .ledger thead th { font-size: 7.2pt; color: #000; }
  .ledger thead th.grp { font-size: 8.5pt; }
  .ledger td.txt { font-size: 7.6pt; }
  .ledger thead tr:last-child th { border-bottom: 2pt double #000; }
  .ledger .gs:not(:first-child), .ledger thead th.grp + th.grp { border-left: 2pt double #000; }
  .ledger td.c-dd, .ledger td.c-cd { color: #000; font-size: 7.2pt; }
  .ledger td.num { white-space: nowrap; }
  .ledger col.k-dd, .ledger col.k-cd { width: 12%; } .ledger col.k-dx, .ledger col.k-cx { width: 23%; } .ledger col.k-da, .ledger col.k-ca { width: 15%; }
  .acct.in col.k-dd, .acct.in col.k-cd { width: 10%; } .acct.in col.k-dx, .acct.in col.k-cx { width: 17%; } .acct.in col.k-dj, .acct.in col.k-cj { width: 5%; } .acct.in col.k-da, .acct.in col.k-ca { width: 18%; }
  .acct.in th.c-dj, .acct.in th.c-cj { padding-left: 0; padding-right: 0; text-align: center; }
  .acct.in td.num { font-size: 7.4pt; letter-spacing: -0.02em; }
  .acct.in thead th { overflow-wrap: normal; }
  .pk .keyfig { display: block; }
  .pk .keyfig > * + * { margin-top: 6pt; }
  .tacct col.k-dd, .tacct col.k-cd { width: 22%; } .tacct col.k-da, .tacct col.k-ca { width: 28%; }
  table.ledger tr { break-inside: avoid; page-break-inside: avoid; }
  .pq table.ledger tbody td { height: 14pt; }
  .ledger tr.r-tot td.num { border-top: 0.9pt solid #000; border-bottom: 2pt double #000; }
  /* accounts flow as inline blocks, not a grid: Chrome started whatever followed a grid split over two pages (the
     trial balance) on a fresh page, leaving it alone on the last page */
  .accts { display: block; max-width: none; font-size: 0; orphans: 1; widows: 1; }
  .accts > .ledger-doc { display: inline-block; vertical-align: top; width: calc(50% - 3pt); margin: 0 6pt 5pt 0; font-size: 10pt; }
  .accts > .ledger-doc:nth-child(2n) { margin-right: 0; }
  .accts.tgrid > .ledger-doc { width: calc((100% - 12pt) / 3); margin-right: 6pt; }
  .accts.tgrid > .ledger-doc:nth-child(2n) { margin-right: 6pt; }
  .accts.tgrid > .ledger-doc:nth-child(3n) { margin-right: 0; }
  .accts.one > .ledger-doc { width: 70%; }
  .accts > .tbslot { display: inline-block; vertical-align: top; width: calc(50% - 3pt); font-size: 10pt; }
  .accts.tgrid > .tbslot.g1 { width: calc((100% - 12pt) / 3); }
  .accts.tgrid > .tbslot.g2 { width: calc((100% - 12pt) / 3 * 2 + 6pt); }
  .tbslot .twrap { margin: 0; }
  .fig:has(> .accts) { break-inside: auto; page-break-inside: auto; }
  .pitems { margin: 0 0 6pt; padding-left: 0; list-style: none; }
  .pitems > li { margin: 0 0 3pt; break-inside: avoid; page-break-inside: avoid; }
  .pitems p { margin: 0 0 2pt; }
  .qparts { columns: 2; column-gap: 8mm; margin-top: 2pt; }
  .qparts.in-entry { columns: 1; }
  .pp { margin: 0 0 5pt; break-inside: avoid; page-break-inside: avoid; }
  .pp.long { column-span: all; }
  .pp p { margin: 0 0 1pt; }
  .in-entry .pp.long { display: flex; gap: 0 8pt; align-items: baseline; flex-wrap: wrap; }
  ol.popts { margin: 0; padding-left: 14pt; list-style: upper-alpha; font-size: 8.4pt; }
  /* markers inside, so each letter sits after a clear gap (fresh-eyes 2026-10-27: "agree B." ran together) */
  .in-entry ol.popts { display: flex; gap: 1pt 16pt; flex-wrap: wrap; list-style-position: inside; padding-left: 0; }
  .pp .pline { margin-top: 8pt !important; }
  .pkey { break-before: page; page-break-before: always; }
  .pk .keyfig { margin: 2pt 0 4pt; gap: 6pt; }
  .pk .ans { margin: 1pt 0 0; font-weight: 600; font-size: 9pt; }
  .pk .steps { margin: 0 0 2pt; padding-left: 13pt; font-size: 8.2pt; line-height: 1.28; }
  .pk .steps li { break-inside: avoid; page-break-inside: avoid; }
  .kans { break-inside: avoid; page-break-inside: avoid; }
}
@media screen and (max-width: 640px) {
  .jt .c-f { display: none; }
  /* fresh-eyes 2026-10-27: the given journal (ledger level) and the key fit the phone instead of hiding the amounts
     off to the right; the date wraps ("10 / Feb") and the details column takes what is left */
  .jt td.c-x, .jt th.c-x { width: auto; }
  .jt td.c-d { width: 2.6em; white-space: normal; padding-right: 2px; }
  .jt .jacc.ind { padding-left: 1em; }
  .jt .jdr { padding-left: 4px; }
  .jt thead th.num { white-space: normal; }
  .jt td.num { padding-left: 2px; padding-right: 3px; }
}
@media screen and (max-width: 380px) {
  .jt td.num { font-size: 0.8rem; }
  .jt { font-size: 0.88rem; }
}
.tacct.scr .ledger .c-da.gs { border-left: 0; }
@media print {
  /* errors level: every error now asks its type (seven choices), so the problem is packed to stay on one page */
  .pq-err .pq .jt tbody td, .pq-err .jt tbody td { height: 12.5pt; }
  .pq-err .pitems > li { margin: 0 0 1pt; }
  .pq-err .pitems p { margin: 0; }
  .pq-err .in-entry .pp { margin: 0; }
  .pq-err .in-entry ol.popts { font-size: 7.8pt; gap: 0 12pt; }
  .pq-err .pp p { margin: 0; }
}
