/* Group accounts practice: a consolidation working file. Bottle-green ink on cool grey-white paper, copper for what
   matters, the two companies' statements side by side with tabular figures, totals under a single rule and a double
   rule at the foot. */
:root {
  --bg: #eef1ee; --paper: #fbfcfa; --ink: #142420; --muted: #3c4d48; --line: #cfd8d3; --line2: #6f7f79; --rule: #173d33;
  --accent: #9a4417; --accent-ink: #fff; --hi: #e3ece7; --soft: #f2f6f3; --given: #eaf0ec;
  --right: #1d6b3a; --wrong: #a8231a; --close: #7a5300; --info: #173d33;
  --mk-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231d6b3a' stroke-width='2.4'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8'/%3E%3C/svg%3E");
  --mk-wrong: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a8231a' stroke-width='2.4'%3E%3Cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9'/%3E%3C/svg%3E");
  --mk-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237a5300' stroke-width='2.4'%3E%3Cpath d='M8 2.5v7M8 13v.5'/%3E%3C/svg%3E");
  --mk-empty: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a8231a' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3C/svg%3E");
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --head: "Charter", "Bitstream Charter", "Sitka Text", Cambria, "Noto Serif", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 3px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1715; --paper: #15221f; --ink: #e6efeb; --muted: #b5c6c0; --line: #2a3d38; --line2: #6a827a; --rule: #9fd1bf;
    --accent: #f0a77a; --accent-ink: #1d0e05; --hi: #1d2f2a; --soft: #182824; --given: #1a2a26;
    --right: #6fd394; --wrong: #ff8f80; --close: #f0c060; --info: #9fd1bf;
    --mk-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236fd394' stroke-width='2.4'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8'/%3E%3C/svg%3E");
    --mk-wrong: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ff8f80' stroke-width='2.4'%3E%3Cpath d='M3.5 3.5l9 9M12.5 3.5l-9 9'/%3E%3C/svg%3E");
    --mk-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f0c060' stroke-width='2.4'%3E%3Cpath d='M8 2.5v7M8 13v.5'/%3E%3C/svg%3E");
    --mk-empty: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ff8f80' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3C/svg%3E");
  }
}
* { 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); }
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 9; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.2; font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.hero { padding: 20px 0 4px; border-bottom: 2px solid var(--rule); margin-bottom: 12px; }
.hero h1 { font-size: clamp(1.5rem, 4.2vw, 2.2rem); margin: 0 0 6px; color: var(--rule); }
.lede { margin: 0 0 10px; max-width: 68ch; }

/* setup: the syllabus as tabs on a file, the level as numbered steps */
.setup { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: end; margin: 0 0 12px; }
fieldset { border: 0; margin: 0 0 6px; padding: 0; min-width: 0; }
legend { font-weight: 650; margin-bottom: 4px; }
.chips, .steps-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .step { position: relative; }
.chip input, .step input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span, .step span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 13px; border: 1px solid var(--line2); border-radius: var(--r); background: var(--paper); }
.step b { font-family: var(--mono); font-weight: 600; color: var(--accent); }
.chip input:checked + span, .step input:checked + span { background: var(--rule); color: var(--paper); border-color: var(--rule); }
.step input:checked + span b { color: var(--paper); }
.chip input:focus-visible + span, .step input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.setrow { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 6px; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line2); border-radius: var(--r); min-height: 44px; padding: 6px 8px; max-width: 100%; }
.btn { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1.5px solid var(--accent); background: var(--paper); color: var(--accent); cursor: pointer; display: inline-flex; align-items: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 6px 14px; }
.link { font: inherit; background: none; border: 0; padding: 8px 2px; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 44px; }
.note { padding: 10px 12px; background: var(--paper); border: 1px solid var(--wrong); border-radius: var(--r); margin: 8px 0; }
#store-note { overflow-wrap: anywhere; }
.note.info { border-color: var(--info); }

/* the sheet */
.sheet { background: var(--paper); border: 1px solid var(--line2); border-top: 4px solid var(--rule); padding: 14px 18px; margin: 8px 0 18px; }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; border-bottom: 1px solid var(--line2); padding-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.code { font-family: var(--mono); letter-spacing: .06em; color: var(--accent); }
.lvname { font-family: var(--sans); font-weight: 400; font-size: 1rem; color: var(--muted); }
.score { margin: 0; color: var(--muted); }
.rules { margin: 6px 0; }
.rules summary, details.work summary, .recent summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
.rules ul { margin: 2px 0 8px; padding-left: 20px; max-width: 72ch; }
.qs { list-style: none; margin: 0; padding: 0; }
.q { padding: 12px 0 18px; border-bottom: 1px solid var(--line2); }
.q h3 { font-size: 1.2rem; margin: 4px 0 6px; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.q h3 .see { margin-left: auto; font: 600 1rem var(--sans); white-space: nowrap; padding: 10px 0; }
.qn { font-family: var(--mono); color: var(--accent); }
.qt { flex: 1 1 14rem; min-width: 0; }
.scen { margin: 0 0 8px; max-width: 72ch; font-weight: 600; }
.nh, .wk h4 { font-size: 1.08rem; margin: 12px 0 4px; }
.info { margin: 0 0 10px; padding-left: 24px; max-width: 78ch; }
.info li { margin: 3px 0; }
.wk { margin: 10px 0 6px; }

/* tables: the given statements, the consolidated statement */
.twrap { overflow-x: auto; max-width: 100%; margin: 0 0 10px; position: relative; }
table.st { border-collapse: collapse; width: 100%; }
.st caption { text-align: left; padding-bottom: 4px; }
.st-t { font-family: var(--head); font-weight: 700; font-size: 1.08rem; margin-right: 10px; }
.st-s { color: var(--muted); font-family: var(--mono); }
.st th, .st td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; vertical-align: middle; }
.st thead th { font-weight: 600; border-bottom: 1.5px solid var(--rule); vertical-align: bottom; }
.st .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st td.amt + td.amt, .st th.amt + th.amt { border-left: 1px solid var(--line); }
.st.given td { background: var(--given); }
.st tr.sec th { font-family: var(--head); font-weight: 700; padding-top: 10px; border-bottom: 1px solid var(--line2); color: var(--rule); }
.st tr.tot th, .st tr.tot td { border-top: 1.5px solid var(--rule); font-weight: 650; }
.st tr.end th, .st tr.end td { border-bottom: 3px double var(--rule); }
.facts { max-width: 46rem; }
.stmt { max-width: 40rem; }
.st.form th[scope="row"] { width: 100%; }

/* answer boxes: one width for every amount */
.cell { font-variant-numeric: tabular-nums; text-align: right; padding: 6px 6px; width: 10.5rem; }
.answers { display: grid; gap: 6px; margin: 4px 0; max-width: 44rem; }
.arow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.kv { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.arow .kv { text-align: right; }
.cell.is-right { border-color: var(--right); box-shadow: inset 0 0 0 1px var(--right); }
.cell.is-wrong, .cell.is-unread, .cell.is-empty { border-color: var(--wrong); box-shadow: inset 0 0 0 1px var(--wrong); }
.cell.is-empty { border-style: dashed; }
.cell.is-close, .cell.is-own { border-color: var(--close); box-shadow: inset 0 0 0 1px var(--close); border-style: dashed; }
.cell:is(.is-right, .is-wrong, .is-unread, .is-close, .is-own, .is-empty) { background-repeat: no-repeat; background-position: 5px center; background-size: 15px; padding-left: 24px; }
.cell.is-right { background-image: var(--mk-right); }
.cell.is-wrong, .cell.is-unread { background-image: var(--mk-wrong); }
.cell.is-close, .cell.is-own { background-image: var(--mk-close); }
.cell.is-empty { background-image: var(--mk-empty); }

/* tables that do not fit (fit.js): each row a block, each value on its own line with its column name */
.twrap.rows table, .twrap.rows tbody, .twrap.rows thead, .twrap.rows tfoot, .twrap.rows tr, .twrap.rows caption { display: block; width: 100%; }
.twrap.rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.twrap.rows tr { border-bottom: 1.5px solid var(--line2); padding: 4px 0 6px; }
.twrap.rows th[scope="row"], .twrap.rows tr.sec th { display: block; border: 0; padding: 2px 0; font-weight: 650; white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.twrap.rows tr.sec { border-bottom: 0; padding-top: 10px; }
.twrap.rows td { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; padding: 2px 0; background: none; text-align: right; }
.twrap.rows td::before { content: attr(data-l); text-align: left; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.twrap.rows td.nil { display: none; }
.twrap.rows tr.given td, .twrap.rows tr.given { background: var(--given); }
.twrap.rows tfoot tr, .twrap.rows tr.tot { background: var(--hi); border-top: 1.5px solid var(--rule); border-bottom: 3px double var(--rule); }
.twrap.rows tfoot th, .twrap.rows tfoot td, .twrap.rows tr.tot th, .twrap.rows tr.tot td { border: 0; background: none; }
.twrap.rows .cell { flex: none; }
.twrap.rows td > .kv, .twrap.rows td > input.cell { margin-left: auto; text-align: right; }
.twrap.rows td > select.cell { margin-left: auto; }
.twrap.rows td.amt + td.amt { border-left: 0; }
.twrap.rows .bas-s { display: inline; margin-left: 6px; }
.twrap.rows td.cm { flex-wrap: wrap; }
.twrap.rows td.cm::before { flex-basis: 100%; }
.twrap.rows td.cm > select.cell { width: 100%; margin-left: 0; }

/* feedback */
.fbwrap { margin: 8px 0 0; max-width: 74ch; }
.fb { margin: 4px 0; padding: 6px 10px; border: 1px solid var(--line2); border-radius: var(--r); background: var(--soft); }
.fb.right { border-color: var(--right); }
.fb.sum, .fb.wrong, .fb.unread, .fb.empty { border-color: var(--wrong); }
.fb.close, .fb.own { border-color: var(--close); }
.fblist { margin: 6px 0 0; padding-left: 1.8em; }
.fblist li.fb { margin: 4px 0; }
.qfoot { margin-top: 8px; }

/* the key */
details.work { margin-top: 8px; }
.keyfig { margin: 4px 0; }
.steps { margin: 6px 0 8px; padding-left: 20px; max-width: 80ch; }
.steps li { margin: 2px 0; font-variant-numeric: tabular-nums; }

.sheet-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 12px; }
.confirm { flex-basis: 100%; margin: 0; padding: 8px 10px; background: var(--soft); border: 1px solid var(--close); border-radius: var(--r); }
.save-hint { flex-basis: 100%; margin: 0; color: var(--muted); }
.share { margin: 0 0 22px; }
.print-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.print-row label, .share-out label { display: grid; gap: 2px; }
.share-out input { width: 100%; font-family: var(--mono); }
.recent ul { list-style: none; padding: 0; margin: 4px 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); font-size: 1rem; }
.hint { color: var(--muted); margin: 6px 0; }

/* content below the tool */
.content { max-width: 72ch; padding-bottom: 20px; }
.content h2 { font-size: 1.4rem; margin: 26px 0 8px; color: var(--rule); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 10px 0; font-weight: 600; min-height: 44px; }
.faq p { margin: 0 0 12px; }
.sources { color: var(--muted); overflow-wrap: anywhere; }

footer { border-top: 1px solid var(--line2); padding: 16px 0 28px; color: var(--muted); font-size: 1rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%); max-width: min(92vw, 520px); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); transition: transform .2s; z-index: 10; pointer-events: none; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.print-root { display: none; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .sheet { padding: 10px 8px; }
  .hero { padding-top: 14px; }
  .hero h1 { font-size: 1.4rem; }
  .lede { display: none; }
  .chip span, .step span { padding: 6px 10px; }
  .steps-row { display: grid; grid-template-columns: 1fr 1fr; }
  .step span { width: 100%; height: 100%; }
  .arow { grid-template-columns: minmax(0, 1fr); }
  .arow > .cell, .arow .kv { justify-self: end; }
  .st th, .st td { padding: 4px 4px; }
  .info { padding-left: 20px; }
}

@media print {
  :root { --ink: #000; --muted: #222; --line: #888; --line2: #444; --rule: #000; --paper: #fff; --bg: #fff; --accent: #000; --hi: #fff; --given: #fff; --soft: #fff; }
  @page { margin: 10mm 12mm; }
  body { background: #fff; color: #000; font: 10pt/1.3 var(--sans); }
  main, footer, .skip, .toast { display: none !important; }
  .print-root { display: block; }
  .psheet, .pkey { break-after: page; }
  .pkey:last-child, .psheet:last-child { break-after: auto; }
  table.pt { width: 100%; border-collapse: collapse; }
  .pt > thead .prun { color: #222; font-size: 9.5pt; padding-bottom: 4px; border-bottom: 0.5pt solid #888; }
  .ph h2 { margin: 4px 0 4px; font-size: 15pt; }
  .ph p { margin: 0 0 4px; }
  .pmeta { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0; }
  .phrow { display: flex; align-items: baseline; gap: 12mm; margin: 0 0 4pt; }
  .phrow .pmeta { flex: 1; margin: 0; }
  .prules { margin: 0 0 6pt; padding-left: 14pt; }
  .prules li { break-inside: avoid; }
  .pt.pb { break-before: page; }
  .pqh { break-after: avoid; }
  .pqh h3, .pkey h3 { font-size: 12pt; margin: 2pt 0 2pt; break-after: avoid; }
  .scen { margin: 0 0 3pt; max-width: none; }
  .nh, .wk h4 { font-size: 11pt; margin: 4pt 0 2pt; break-after: avoid; }
  .info { margin: 0 0 3pt; padding-left: 14pt; max-width: none; }
  .info li { margin: 0 0 1.5pt; break-inside: avoid; }
  .twrap { overflow: visible; margin: 0 0 4pt; }
  .st { break-inside: avoid; width: calc(100% - 1pt); }
  .facts, .stmt { max-width: 150mm; }
  .st caption { padding-bottom: 2pt; }
  .st-t { font-size: 11pt; }
  .st-s { font-size: 9.5pt; }
  .st th, .st td { padding: 1pt 4pt; border-bottom: 0.5pt solid #999; }
  .st td.amt + td.amt, .st th.amt + th.amt { border-left: 0.5pt solid #999; }
  .st thead th { border-bottom: 1pt solid #000; }
  .st tr.tot th, .st tr.tot td { border-top: 1pt solid #000; }
  .st tr.end th, .st tr.end td { border-bottom: 2.5pt double #000; }
  .st tr.sec th { padding-top: 3pt; border-bottom: 0.5pt solid #444; }
  .st.given { table-layout: fixed; }
  .st.given thead td:first-child { width: 78mm; }
  .st.form { table-layout: fixed; }
  .st.form td { width: 42mm; }
  .psheet .st.form tbody td { border-left: 0.5pt solid #999; }
  .psheet .st.form tbody tr:not(.sec) th, .psheet .st.form tbody tr:not(.sec) td { height: 19pt; vertical-align: bottom; }
  .pblank { display: inline-block; width: 30mm; height: 15pt; }
  .st .pblank { display: block; width: auto; height: 0; }
  .wk { break-inside: avoid; margin: 4pt 0; }
  .answers { max-width: 160mm; gap: 0; margin: 2pt 0; }
  .arow { border-bottom: 0; padding: 0; grid-template-columns: minmax(0, 1fr) 42mm; max-width: 160mm; }
  .arow .al { align-self: end; padding-bottom: 1pt; }
  .psheet .arow .pblank { width: 42mm; height: 19pt; border-bottom: 0.75pt solid #000; }
  .pkey .arow { border-bottom: 0.5pt solid #bbb; grid-template-columns: minmax(0, 1fr) auto; }
  .steps { margin: 4pt 0; max-width: none; padding-left: 14pt; columns: 2; column-gap: 8mm; }
  .steps li { margin: 0 0 1pt; break-inside: avoid; }
  .steps li:nth-last-child(-n+2) { break-before: avoid; }
  .keyfig { margin: 2pt 0 4pt; }
  .pkey .st th, .pkey .st td { padding: 0.5pt 4pt; }
  .pkey .steps { font-size: 9.5pt; line-height: 1.25; }
  .pt > tbody > tr > td { padding: 0; }
  .pt > tbody > tr > td > :last-child, .pt > tbody > tr > td > :last-child > :last-child { margin-bottom: 0; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
