/* ============================================================
   MASTER POA DESIGN SYSTEM
   EXAM PAPER layer  (ep-)

   MOE / Cambridge O-Level–style exam paper chrome.
   Layout and typography faithfully reproduce the Singapore
   national exam format. Master POA brand identity appears
   only in clearly-marked cover zones (★ BRAND TOUCH ★).

   Load AFTER colors_and_type.css — consumes brand tokens
   but adds no new colours beyond the existing palette.
   Page model: A4 portrait (794 × 1123 px @ 96 dpi).
   Body font: Times New Roman — system serif, no import needed.
   ============================================================ */

:root {
  --ep-font:      Arial, 'Helvetica Neue', Helvetica, sans-serif;
  --ep-sz:        14.7px;  /* 11 pt — MOE/Cambridge body (measured from gold) */
  --ep-sz-sm:     10.7px;  /* 8 pt  — footer copyright / paper code / page count */
  /* 13 pt leading on 11 pt body — tight house leading */
  --ep-lh:        1.18; /* @kind other */
  --ep-ml:        66px;    /* 49.6 pt left margin (gold) */
  --ep-mr:        66px;    /* matching right margin */
  --ep-mt:        52px;    /* top margin */
  --ep-mb:        44px;    /* bottom margin */
  --ep-marks-w:   52px;    /* right-gutter for marks */
  --ep-step:      30px;    /* indent step (22.7 pt) — grid: 66/96/126/156 */
  --ep-row:       34.67px; /* answer-line pitch (26 pt) — 2 baselines */
}

/* ============================================================
   CANVAS  (viewer chrome — not printed)
   ============================================================ */
html, body { margin: 0; padding: 0; }
.ep-canvas {
  background: #b8b8b8;
  padding: 48px 0 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  min-height: 100vh;
}

/* ============================================================
   A4 SHEET
   ============================================================ */
.ep-sheet {
  position: relative;
  width: 794px;
  min-height: 1123px;
  background: #fff;
  box-shadow: 0 6px 36px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  line-height: var(--ep-lh);
  color: #000;
  overflow: hidden; /* hard-clip: nothing escapes the 794px A4 boundary */
}

/* ============================================================
   COVER PAGE
   ============================================================ */
.ep-cov {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--ep-mt) var(--ep-mr) var(--ep-mb) var(--ep-ml);
  gap: 0;
}

/* ---- Top row: logo left, paper code right ---- */
.ep-cov__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

/* ★ BRAND TOUCH 1 — Master POA logo replaces MOE / SEAB seal */
.ep-cov__logo {
  display: flex;
  align-items: center;
  gap: 9px;
}
.ep-cov__logo img {
  height: 30px;
  width: auto;
  display: block;
}
.ep-cov__logo-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 8.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--red);
  line-height: 1.45;
}

/* Paper code block — top right, authentic MOE position */
.ep-cov__code {
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  line-height: 1.75;
  color: #000;
  text-align: right;
}
/* ★ BRAND TOUCH 2 — tiny "LOOKALIKE SERIES" label in code block */
.ep-cov__code-series {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-top: 1px;
}

/* ---- Subject name ---- */
.ep-cov__subject {
  font-family: var(--ep-font);
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
  color: #000;
  margin: 0 0 4px;
  line-height: 1.25;
  letter-spacing: 0;
}

/* ---- Paper number & type ---- */
.ep-cov__paper {
  font-family: var(--ep-font);
  font-size: 15px;
  font-weight: normal;
  text-align: center;
  color: #000;
  margin: 0 0 12px;
}

/* ★ BRAND TOUCH 3 — level chip (SEC 3 EOY · SET N OF 8) */
.ep-level-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  padding: 4px 11px 3px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  line-height: 1.4;
}
.ep-level-chip-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

/* ---- Date / time / session ---- */
.ep-cov__meta {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  text-align: center;
  color: #000;
  margin-bottom: 16px;
  line-height: 1.85;
}

/* ---- Italic notice ---- */
.ep-cov__note {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  text-align: center;
  font-style: italic;
  color: #000;
  margin-bottom: 20px;
}

/* ---- Candidate information box ---- */
.ep-cov__candidate {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.ep-cov__candidate td {
  border: 1.5px solid #000;
  padding: 8px 12px;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  vertical-align: middle;
}
.ep-cov__cand-label { font-weight: bold; white-space: nowrap; }
.ep-cov__cand-line {
  display: block;
  border-bottom: 1px solid #000;
  height: 20px;
  margin: 3px 0;
}

/* ---- READ THESE INSTRUCTIONS FIRST ---- */
.ep-cov__instructions {
  border: 1.5px solid #000;
  padding: 14px 18px 13px;
  margin-bottom: 20px;
}
.ep-cov__instr-head {
  font-family: var(--ep-font);
  font-size: 14px;
  font-weight: bold;
  text-decoration: underline;
  color: #000;
  margin: 0 0 10px;
  line-height: 1;
}
.ep-cov__instr-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}
.ep-cov__instr-list {
  margin: 0;
  padding: 0 0 0 18px;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  line-height: 1.68;
  color: #000;
}
.ep-cov__instr-list li { margin: 0 0 2px; }

/* ---- Bottom row: page count + marks box ---- */
.ep-cov__bottom {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid #000;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.ep-cov__pagecount {
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
  line-height: 1.65;
}
.ep-cov__marks-box {
  border: 1.5px solid #000;
  text-align: center;
  padding: 7px 22px 9px;
  flex: 0 0 auto;
}
.ep-cov__marks-label {
  display: block;
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
  margin-bottom: 2px;
}
.ep-cov__marks-n {
  display: block;
  font-family: var(--ep-font);
  font-size: 20px;
  font-weight: bold;
  color: #000;
  line-height: 1;
}

/* ============================================================
   COVER PAGE — MOE-ACCURATE REDESIGN
   New classes that match the 7087/02 specimen paper layout
   exactly. Old .ep-cov__* classes above are retained for
   backward compatibility but the Cover Page card now uses these.
   ============================================================ */

/* Org seal — top-left block (logo + institution text) */
.ep-cov__seal {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
}
.ep-cov__seal img {
  height: 50px;
  width: auto;
  display: block;
  margin-top: 2px;
  flex: 0 0 auto;
}
.ep-cov__seal-text {
  font-family: var(--ep-font);
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.55;
  color: #000;
}
.ep-cov__seal-text strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
  line-height: 1.3;
}
.ep-cov__seal-text em {
  font-style: italic;
  font-weight: 400;
}

/* Candidate info block
   Labels are plain bold text OUTSIDE the bordered boxes — not table cells.
   Name row: [label 90px] [full-width bordered box]
   Number row: [label 90px] [S+4 cells] [spacer] [label] [4 cells] */
.ep-cov__cands {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 0;
}
.ep-cov__cand-row1 {
  display: flex;
  align-items: stretch;
  min-height: 44px;
}
.ep-cov__cand-row2 {
  display: flex;
  align-items: center;
  min-height: 30px;
}
.ep-cov__cand-lbl {
  font-family: var(--ep-font);
  font-size: 13px;
  font-weight: bold;
  color: #000;
  width: 90px;
  flex: 0 0 90px;
  line-height: 1.3;
  padding-top: 3px;
}
.ep-cov__cand-lbl--mid { margin-left: 8px; }
.ep-cov__cand-val {
  flex: 1;
  border: 1.5px solid #000;
  min-height: 44px;
}
.ep-cov__cand-spacer { flex: 1; min-width: 24px; }

/* Individual character boxes (centre / index number cells) */
.ep-cov__cand-cells {
  display: flex;
  align-items: center;
}
.ep-cov__cell {
  width: 28px;
  height: 28px;
  border: 1.5px solid #000;
  margin-left: -1.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  flex: 0 0 28px;
}
.ep-cov__cell:first-child { margin-left: 0; }

/* Thick rule — divides candidate area from subject title */
.ep-cov__thick-rule {
  height: 3px;
  background: #000;
  margin: 0 0 2px;
}

/* Subject + code on same line */
.ep-cov__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 0 2px;
}
.ep-cov__subject-new {
  font-family: var(--ep-font);
  font-size: 26px;
  font-weight: bold;
  color: #000;
}
.ep-cov__code-main {
  font-family: var(--ep-font);
  font-size: 22px;
  font-weight: bold;
  color: #000;
  white-space: nowrap;
}

/* Paper info rows (Paper 2 / level id / duration / additional) */
.ep-cov__info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  line-height: 1.75;
}
.ep-cov__info-row--gap { margin-top: 8px; }
/* Level identifier — sits where "SPECIMEN PAPER" is on real paper */
.ep-cov__level-id {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  font-style: italic;
  color: #000;
}
.ep-cov__duration {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  font-weight: bold;
  color: #000;
}

/* Thin rule before READ THESE INSTRUCTIONS FIRST */
.ep-cov__rule {
  border: none;
  border-top: 1px solid #000;
  margin: 10px 0 12px;
}

/* Instructions (single-column paragraphs — no bullets) */
.ep-cov__instr2 {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
}
.ep-cov__instr2-head {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  font-weight: bold;
  margin: 0 0 8px;
  color: #000;
}
.ep-cov__instr2 p {
  margin: 0;
  line-height: 1.65;
  color: #000;
}
.ep-cov__instr2 .ep-gap { margin-top: 10px; }

/* Bottom footer */
.ep-cov__bottom-rule {
  border: none;
  border-top: 1px solid #000;
  margin: 0 0 8px;
}
.ep-cov__doc-count {
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
  text-align: center;
  margin: 0 0 10px;
}
.ep-cov__bottom-logos {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.ep-cov__bottom-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ep-font);
  font-size: 11px;
  color: #000;
  line-height: 1.35;
}
.ep-cov__bottom-logo span { white-space: nowrap; }
.ep-cov__bottom-logo img { height: 26px; width: auto; flex: 0 0 auto; }
.ep-cov__bottom-copy > * { flex: 0 0 auto; white-space: nowrap; }
.ep-cov__bottom-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
}

/* ============================================================
   INNER PAGE CHROME
   ============================================================ */
.ep-pg {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 1123px;
}

/* Inner page header — page number CENTERED at top, no rule */
.ep-pg__pgnum {
  text-align: center;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  font-weight: bold;
  color: #000;
  padding: 48px 0 0; /* page-number baseline ≈ 63 px from top (47.3 pt) — matches gold */
}
/* Preamble line — "Answer all questions." on first question page only */
.ep-pg__preamble {
  text-align: center;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  margin-bottom: 16px;
}

/* Content body */
.ep-pg__body {
  flex: 1;
  padding: 18px var(--ep-mr) 6px var(--ep-ml);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Running footer — no top rule; © left, code center, right column stacks marks+turnover */
.ep-pg__foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px var(--ep-mr) 36px var(--ep-ml); /* 36px ≈ 9.5 mm from bottom — matches specimen */
}
.ep-pg__foot-copy {
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
  white-space: nowrap;
  flex: 0 0 auto;
}
.ep-pg__foot-code {
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  color: #000;
  flex: 1;
  text-align: center;
}
.ep-pg__foot-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 15px;
  flex: 0 0 auto;
}
.ep-pg__marks-end {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);   /* 11 pt — [End of …] is body size (gold) */
  color: #000;
  white-space: nowrap;
}
.ep-pg__turnover {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);   /* 11 pt — [Turn over is body size, bold (gold) */
  font-weight: bold;
  color: #000;
  white-space: nowrap;
}

/* ============================================================
   QUESTION LAYOUT
   Each question row: flex — [num] [text flex-1] [marks]
   Hierarchy indented via margin-left on the num element.
   ============================================================ */
.ep-q-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 12px;
}
/* The number / letter label */
.ep-num {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  line-height: var(--ep-lh);
  flex: 0 0 auto;
  white-space: nowrap;
}
.ep-num--main   { min-width: 23px; font-weight: bold; text-align: left; }
.ep-num--sub    { min-width: 23px; text-align: left; margin-left: 30px; }
.ep-num--subsub { min-width: 23px; text-align: left; margin-left: 60px; }
/* Question / answer text */
.ep-text {
  flex: 1;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  line-height: var(--ep-lh);
  color: #000;
  margin: 0;
}
/* Marks badge e.g. [10] or [Total: 20] */
.ep-marks {
  flex: 0 0 var(--ep-marks-w);
  text-align: right;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 2px;
}

/* House style: major questions are NEVER separated by a horizontal rule.
   Each major question begins at the top of a fresh .ep-sheet (see
   AUTHORING-CONTRACT.md → "Question separation"). The old .ep-q-rule
   ("thin rule between major questions") has been retired — do not reintroduce it. */

/* Context scenario paragraph (intro to a question) */
.ep-context {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  line-height: var(--ep-lh);
  color: #000;
  margin: 0 0 12px;
}

/* ============================================================
   ANSWER SPACES
   ============================================================ */

/* Cambridge-style dotted answer lines.
   Stack .ep-dotline elements inside .ep-dotlines.
   Dots are drawn via CSS background-image — deterministic full width,
   never falls short regardless of container size. */
.ep-dotlines {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;   /* indent (--sub/--subsub padding-left) eats inward; right edge stays locked to the margin */
  overflow: hidden;
}
.ep-dotline {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 34.67px;       /* 26 pt row pitch (gold) */
  flex: 0 0 34.67px;
  /* Fine, dense leader dots measured from gold: ~1.5 px dot on a 4.1 px pitch
     (11 pt period leaders). Dot sits low in the row, on the writing baseline. */
  background-image: radial-gradient(circle, #000 0.8px, transparent 0.8px);
  background-size: 4.1px 4px;
  background-position: 0 27px;
  background-repeat: repeat-x;
}

/* Left-indent variants — align dotline left edge with sub/subsub body text.
   Apply the class to the .ep-dotlines container (or .ep-dotline-marks wrapper).
   Indent = margin-left(num) + min-width(num) + gap(7px) for each level:
     --sub    : 24 + 26 + 7 = 57 px  (aligns with (a)/(b)/(c) body text)
     --subsub : 52 + 26 + 7 = 85 px  (aligns with (i)/(ii)/(iii) body text)  */
.ep-dotlines--sub,
.ep-dotline-marks--sub    { padding-left: 60px; }   /* dots align with (a)/(b)/(c) body column (126 px abs) */
.ep-dotlines--subsub,
.ep-dotline-marks--subsub { padding-left: 90px; }   /* dots align with (i)/(ii) body column (156 px abs) */

/* Solid ruled lines (non-Cambridge contexts) */
.ep-lines {
  display: flex;
  flex-direction: column;
  gap: 23px;
  width: 100%;
  padding: 12px 0 4px;
}
.ep-line {
  width: 100%;
  height: 0;
  border-bottom: 1px solid #aaa;
}

/* Blank box (for tables, diagrams) */
.ep-blank {
  width: 100%;
  border: 1px solid #aaa;
  min-height: 110px;
}

/* ============================================================
   ACCOUNTING TABLES
   All tables: Times New Roman, hairline borders, amounts right-aligned.
   ============================================================ */

/* ---- Base exam table ---- */
.ep-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  margin-bottom: 14px;
}
.ep-tbl caption {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  font-weight: bold;
  text-align: center;
  caption-side: top;
  padding-bottom: 5px;
  color: #000;
}
.ep-tbl th,
.ep-tbl td {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  padding: 3px 8px;
  color: #000;
  vertical-align: top;
  line-height: 1.5;
}
.ep-tbl thead th {
  font-weight: bold;
  text-align: center;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}
.ep-tbl thead th:first-child { text-align: left; }

/* Outer-border variant */
.ep-tbl--box { border: 1px solid #000; }
.ep-tbl--box th,
.ep-tbl--box td { border: 1px solid #000; }

/* ---- Column alignment utilities ---- */
.ep-r  { text-align: right; font-variant-numeric: tabular-nums; }
.ep-c  { text-align: center; }
.ep-l  { text-align: left; }
.ep-i  { padding-left: 22px !important; }
.ep-i2 { padding-left: 40px !important; }

/* ---- Row-type modifiers ---- */
.ep-tbl .ep-subtotal th,
.ep-tbl .ep-subtotal td { border-top: 1px solid #000; }
.ep-tbl .ep-total th,
.ep-tbl .ep-total td    { border-top: 1px solid #000; font-weight: bold; }
.ep-tbl .ep-double th,
.ep-tbl .ep-double td   { border-top: 1px solid #000; font-weight: bold; }
.ep-tbl .ep-spacer td,
.ep-tbl .ep-spacer th   { padding-top: 8px; border: none; }
.ep-tbl--box .ep-spacer td,
.ep-tbl--box .ep-spacer th { border: 1px solid #000; }

/* Blank answer line inside a table cell */
.ep-ans {
  display: block;
  border-bottom: 1px solid #999;
  min-height: 18px;
}

/* ---- T-Account (Ledger account) ---- */
/* 8 columns: Date · Details · Fo · $  |  Date · Details · Fo · $ */
.ep-ledger {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  margin-bottom: 14px;
}
.ep-ledger th,
.ep-ledger td {
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  border: 1px solid #000;
  padding: 3px 7px;
  vertical-align: top;
  line-height: 1.5;
  color: #000;
}
/* Account name — spans all 8 columns */
.ep-ledger__name {
  font-weight: bold;
  text-align: center !important; /* override any th:first-child rules */
  font-family: var(--ep-font);
}
/* Dr / Cr side label */
.ep-ledger__side {
  font-weight: bold;
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 2px 7px;
}
/* Column headers: Date / Details / Fo / $ */
.ep-ledger__col {
  font-weight: bold;
  font-family: var(--ep-font);
  font-size: var(--ep-sz-sm);
  text-align: center;
  padding: 2px 7px;
}
.ep-ledger__col:first-child { text-align: left; }
/* Center divider — thicker left border on Cr side cells */
.ep-ledger .ep-div { border-left: 2px solid #000; }
/* Amount column alignment */
.ep-ledger .ep-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Total and balance rows */
.ep-ledger .ep-total td { font-weight: bold; }
.ep-ledger .ep-ledger__bal td { font-style: italic; }

/* ---- Journal entries ---- */
.ep-journal {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  color: #000;
  margin-bottom: 14px;
}
.ep-journal thead th {
  font-weight: bold;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 4px 8px;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  text-align: left;
}
.ep-journal thead th:nth-child(3),
.ep-journal thead th:nth-child(4) { text-align: right; }
.ep-journal tbody td {
  padding: 3px 8px;
  font-family: var(--ep-font);
  font-size: var(--ep-sz);
  vertical-align: top;
  line-height: 1.5;
  color: #000;
}
.ep-journal .ep-j-dr   { padding-left: 24px; }
.ep-journal .ep-j-cr   { padding-left: 48px; font-style: italic; }
.ep-journal .ep-j-narr { padding-left: 24px; font-style: italic; color: #444; font-size: var(--ep-sz-sm); }
.ep-journal tbody td:nth-child(3),
.ep-journal tbody td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
.ep-journal .ep-j-rule td { border-top: 1px solid #000; }
.ep-journal .ep-total td { border-top: 1px solid #000; font-weight: bold; }
.ep-journal .ep-double td { border-top: 3px double #000; font-weight: bold; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { margin: 0; padding: 0; }
.ep-canvas {
    background: #fff;
    padding: 0;
    gap: 0;
  }
  html, body { margin: 0; padding: 0; }
  .ep-sheet {
    box-shadow: none;
    break-after: page;
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    overflow: hidden;
  }
  .ep-sheet:last-child { break-after: auto; }
  .ep-level-chip,
  .ep-cov__logo-wordmark,
  .ep-cov__code-series {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ============================================================
   QUESTION CONTENT — CONTRACT VOCABULARY
   ------------------------------------------------------------
   The class family named by AUTHORING-CONTRACT.md §1-§6 and used
   by the golden reference files. Previously this layer lived only
   inline inside the golden HTML; it is now here so any generator
   linking exam-paper.css gets identical geometry.

   NOTE: this coexists with the older .ep-q-row / .ep-num /
   .ep-text / .ep-tbl family above. The CONTRACT vocabulary below
   is authoritative for generated papers; the older family is kept
   only for legacy files. Do not mix the two in one document.
   ============================================================ */

/* ---- Question / sub-part layout ---- */
.ep-q-stem { display:flex; gap:0; font-family:Arial,sans-serif; font-size:14.7px; color:#000; line-height:1.18; margin-bottom:8px; }
.ep-q-n { min-width:40px; flex:0 0 40px; font-weight:bold; }
.ep-q-body { flex:1; }
.ep-q-sub { display:flex; gap:0; padding-left:20px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; line-height:1.18; margin-bottom:10px; }
.ep-q-sub-n { min-width:36px; flex:0 0 36px; }
.ep-q-sub-body { flex:1; }
.ep-q-subsub { display:flex; gap:0; padding-left:56px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; line-height:1.18; margin-bottom:10px; }
.ep-q-subsub-n { min-width:28px; flex:0 0 28px; }
.ep-q-subsub-body { flex:1; }
.ep-required { font-family:Arial,sans-serif; font-size:14.7px; font-weight:bold; color:#000; line-height:1.18; margin:0 0 10px 20px; }
.ep-stmt-title { font-family:Arial,sans-serif; font-size:14.7px; color:#000; text-align:center; line-height:1.18; margin:0 0 6px; }

/* ---- Marks ---- */
.ep-dotline-marks { display:flex; align-items:center; gap:0; margin-bottom:14px; }
.ep-dotline-marks .ep-dotline { flex:1; }
.ep-mark { font-family:Arial,sans-serif; font-size:14.7px; color:#000; white-space:nowrap; padding-left:6px; flex:0 0 auto; line-height:34.67px; }
.ep-marks-right { text-align:right; font-family:Arial,sans-serif; font-size:14.7px; color:#000; margin-bottom:14px; }
.ep-total-marks { text-align:right; font-family:Arial,sans-serif; font-size:14.7px; color:#000; margin-top:17px; }

/* ---- Data table (question stem figures; no grid box) ---- */
.ep-data-tbl { width:100%; border-collapse:collapse; font-family:Arial,sans-serif; font-size:14.7px; color:#000; margin-bottom:12px; }
.ep-data-tbl th, .ep-data-tbl td { font-family:Arial,sans-serif; font-size:14.7px; padding:2px 8px; color:#000; vertical-align:top; line-height:1.18; }
.ep-data-tbl thead th { text-align:right; font-weight:bold; }
.ep-data-tbl thead th:first-child { text-align:left; }
.ep-data-tbl .ep-r { text-align:right; font-variant-numeric:tabular-nums; }
.ep-data-tbl .ep-c { text-align:center; }
.ep-data-tbl .ep-u { text-decoration:underline; }
.ep-data-tbl .ep-i { padding-left:22px !important; }
.ep-data-tbl .ep-bold td, .ep-data-tbl .ep-bold th { font-weight:bold; }
/* Ledger variant: date column right-aligned, year row left-aligned */
.ep-data-tbl--ledger tbody td:first-child { text-align:right; white-space:nowrap; }
.ep-data-tbl--ledger tbody tr.ep-year td:first-child { text-align:left; }

/* ---- Journal table (given entries; ruled grid) ---- */
.ep-journal-tbl { width:100%; border-collapse:collapse; font-family:Arial,sans-serif; font-size:14.7px; color:#000; margin-bottom:4px; }
.ep-journal-tbl caption { font-family:Arial,sans-serif; font-size:14.7px; font-weight:bold; color:#000; text-align:center; caption-side:top; padding-bottom:6px; }
.ep-journal-tbl th { border:1px solid #000; padding:4px 8px; font-family:Arial,sans-serif; font-size:14.7px; font-weight:normal; text-align:center; color:#000; }
.ep-journal-tbl th:first-child { text-align:left; }
.ep-journal-tbl td { border:1px solid #000; padding:0 8px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; height:28px; vertical-align:middle; }

/* ---- Tick / classify table ---- */
.ep-tick-tbl { border-collapse:collapse; font-family:Arial,sans-serif; font-size:14.7px; color:#000; margin-bottom:4px; }
.ep-tick-tbl th, .ep-tick-tbl td { border:1px solid #000; padding:3px 10px; font-family:Arial,sans-serif; font-size:14.7px; vertical-align:middle; height:28px; }
.ep-tick-tbl th { font-weight:normal; text-align:center; }
.ep-tick-tbl th:first-child { text-align:left; }
.ep-tick-tbl td { text-align:left; }
.ep-tick-tbl td:not(:first-child) { text-align:center; min-width:90px; }

/* ---- Given information block (stem figures, no table chrome) ---- */
.ep-given-block { margin:0 0 12px 20px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; }
.ep-given-block table { border-collapse:collapse; }
.ep-given-block td { padding:1px 0; vertical-align:top; line-height:1.18; font-family:Arial,sans-serif; font-size:14.7px; color:#000; }
.ep-given-block .ep-gb-label { padding-right:20px; min-width:260px; }
.ep-given-block .ep-gb-amt { text-align:right; min-width:70px; font-variant-numeric:tabular-nums; padding-right:4px; }
.ep-given-block .ep-gb-head { font-weight:bold; padding-top:8px; }
.ep-given-block .ep-gb-sub { padding-left:16px; }
.ep-given-block .ep-gb-col { text-align:right; min-width:60px; padding-right:8px; font-variant-numeric:tabular-nums; }
.ep-given-block .ep-gb-unit { font-weight:normal; color:#000; padding-right:20px; min-width:30px; }

/* ---- Additional information (numbered items in stem) ---- */
.ep-add-info { margin:0 0 12px 20px; }
.ep-add-info-head { font-family:Arial,sans-serif; font-size:14.7px; font-weight:normal; color:#000; margin-bottom:2px; }
.ep-add-info-item { display:flex; gap:0; font-family:Arial,sans-serif; font-size:14.7px; color:#000; line-height:1.18; }
.ep-add-info-n { flex:0 0 20px; }
.ep-add-info-text { flex:1; }

/* ---- Dated transaction list ---- */
.ep-tx-list { margin:0 0 12px 20px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; }
.ep-tx-year { line-height:1.18; }
.ep-tx-row { display:flex; gap:0; line-height:1.18; }
.ep-tx-month { flex:0 0 48px; }
.ep-tx-day { flex:0 0 24px; text-align:right; }
.ep-tx-text { flex:1; padding-left:12px; }

/* ---- Numbered answer points (contract §3) ---- */
.ep-numbered-lines { display:flex; flex-direction:column; gap:0; padding-left:20px; margin-bottom:2px; }
.ep-numbered-line { display:flex; align-items:center; gap:4px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; height:34.67px; }
.ep-nl-num { flex:0 0 30px; line-height:34.67px; }
.ep-nl-dot { flex:1; height:34.67px; background-image:radial-gradient(circle,#000 0.8px,transparent 0.8px); background-size:4.1px 4px; background-position:0 27px; background-repeat:repeat-x; }

/* ---- Labelled calculation lines (contract §3) ---- */
.ep-labelled-lines { display:flex; flex-direction:column; gap:0; padding-left:20px; margin-bottom:2px; }
.ep-labelled-lines--sub { padding-left:60px; }
.ep-labelled-line { display:flex; align-items:center; gap:4px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; }
.ep-ll-lbl { flex:0 0 auto; padding-right:8px; line-height:34.67px; white-space:nowrap; }
.ep-ll-lbl:empty { padding-right:0; }
.ep-ll-dot { flex:1; height:34.67px; background-image:radial-gradient(circle,#000 0.8px,transparent 0.8px); background-size:4.1px 4px; background-position:0 27px; background-repeat:repeat-x; }
.ep-ll-mark { flex:0 0 auto; padding-left:6px; line-height:34.67px; font-family:Arial,sans-serif; font-size:14.7px; color:#000; white-space:nowrap; }
.ep-labelled-gap { height:12px; }

/* ---- Data-table row grouping (contract §6: "group rows then .ep-i indented items") ---- */
.ep-data-tbl .ep-group td, .ep-data-tbl .ep-group th { font-weight:bold; padding-top:6px; }
.ep-data-tbl .ep-group + tr td.ep-i, .ep-data-tbl tr.ep-group ~ tr td.ep-i { padding-left:22px; }
