/*
 * Earnings Quality Monitor — the one stylesheet.
 *
 * Specification: docs/DESIGN.md. A research note, not a dashboard: off-white
 * ground, near-black text, one navy for structure, muted red and amber for
 * warning signs and watch. Serif headings, sans body, mono for identifiers.
 * Tabular lining figures. Thin rules, white space, no cards, no shadows, no
 * gradients, corner radius 2px at most, no animation.
 *
 * Mobile first: every rule outside a min-width query is the 375px layout.
 * Chart marks are styled in charts.css, which the build appends to this file
 * so the site still serves one stylesheet.
 */

/* -- Fonts: self-hosted subsets, see scripts/build_fonts.py ------------------ */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/plex-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/plex-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/plex-sans-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Fallbacks with the web fonts' own metrics, measured from the shipped files,
   so the text does not move when the web font arrives (layout shift). */
@font-face {
  font-family: "Plex Fallback";
  src: local("Arial");
  size-adjust: 101.6%;
  ascent-override: 100.9%;
  descent-override: 27.1%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Plex Fallback";
  src: local("Arial Bold"), local("Arial");
  font-weight: 600;
  size-adjust: 97.1%;
  ascent-override: 105.5%;
  descent-override: 28.3%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Serif Fallback";
  src: local("Georgia Bold"), local("Georgia");
  font-weight: 600;
  size-adjust: 86.2%;
  ascent-override: 120.2%;
  descent-override: 38.9%;
  line-gap-override: 0%;
}

/* -- Tokens ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --ground: #fbfaf7;
  --sunk: #f3f0e9;
  --surface: #ffffff;
  --ink: #14181c;
  --ink-soft: #39414a;
  --muted: #5b6670;
  --rule: #ddd9d0;
  --rule-strong: #8e897d;
  --navy: #10243e;
  --link: #16385f;
  --red: #8c1d18;
  --red-bg: #f7e9e6;
  --amber: #7a4a00;
  --amber-bg: #f6ecd9;
  --focus: #1f5fbf;

  --serif: "Source Serif 4", "Serif Fallback", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Plex Fallback", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  --gutter: 16px;
  --content: 1120px;
  --measure: 68ch;

  /* Legacy names, kept so older markup keeps its colours. */
  --paper: var(--ground);
  --paper-sunk: var(--sunk);
}

/* Dark is a choice made with the toggle, never the operating system's. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #14161a;
  --sunk: #1b1e23;
  --surface: #191c20;
  --ink: #e8e6e0;
  --ink-soft: #c5c2b8;
  --muted: #9a978c;
  --rule: #30343a;
  --rule-strong: #6b6f76;
  --navy: #a9c0e0;
  --link: #a9c0e0;
  --red: #f0958c;
  --red-bg: #3a1f1d;
  --amber: #e3b36a;
  --amber-bg: #33290f;
  --focus: #8ab4f8;
}

@media (min-width: 720px) {
  :root { --gutter: 24px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 32px; }
}

/* -- Base -------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* A sticky table head must never cover the row that has focus. */
  scroll-padding-top: var(--s8);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  overflow-wrap: break-word;
}

@media (min-width: 1024px) {
  html { font-size: 106.25%; } /* 17px body on a desktop */
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: 1.75rem; line-height: 1.15; margin: 0 0 var(--s3); }
h2 {
  font-size: 1.375rem;
  line-height: 1.2;
  margin: var(--s7) 0 var(--s3);
  padding-top: var(--s4);
  border-top: 2px solid var(--navy);
}
h3 { font-size: 1.125rem; line-height: 1.3; margin: var(--s6) 0 var(--s2); }
h4 { font-family: var(--sans); font-size: 1rem; line-height: 1.35; margin: var(--s5) 0 var(--s2); }

@media (min-width: 720px) {
  h1 { font-size: 2.125rem; }
  h2 { font-size: 1.5rem; }
}
@media (min-width: 1024px) {
  h1 { font-size: 2.25rem; }
}

p, ul, ol, dl { margin: 0 0 var(--s4); }
p, li, dd { color: var(--ink-soft); }
main p, main ul, main ol, main dl, main h1, main h2, main h3, main h4 { max-width: var(--measure); }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: var(--s1); }
li > ul, li > ol { margin-top: var(--s1); margin-bottom: 0; }
strong, b { font-weight: 600; color: var(--ink); }
em { font-style: italic; }
small { font-size: 0.8125rem; color: var(--muted); }
sup, sub { line-height: 0; font-size: 0.75em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s6) 0; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

code, pre, .mono, .accession, .ident {
  font-family: var(--mono);
  font-size: 0.88em;
  font-variant-numeric: normal;
}
code { background: var(--sunk); padding: 0 0.2em; border-radius: 2px; }
pre { overflow-x: auto; padding: var(--s3); background: var(--sunk); }
pre code { background: none; padding: 0; }

img, svg { max-width: 100%; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- Page frame -------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: var(--s2) var(--s3);
  background: var(--navy);
  color: var(--ground);
  font-weight: 600;
}
.skip-link:focus { top: var(--s2); }

.masthead { border-bottom: 2px solid var(--navy); background: var(--ground); }
.masthead-inner {
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s2) var(--gutter) var(--s1);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--s4);
}
.masthead-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.2;
  margin: 0;
}
.masthead-title a {
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  padding: var(--s2) 0;
}
.masthead-title a:hover { text-decoration: underline; }
.masthead nav { grid-column: 1 / -1; min-width: 0; }
.masthead nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--s4);
  max-width: none;
}
.masthead nav li { margin: 0; }
.masthead nav a {
  display: inline-block;
  padding: 6px 0;
  min-height: 32px;
  font-size: 0.875rem;
  line-height: 20px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: var(--ink); text-decoration: underline; }
.masthead nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--navy);
}
.theme-toggle {
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  min-height: 28px;
  padding: 0 var(--s2);
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle[hidden] { display: none; }
.theme-toggle { grid-row: 1; grid-column: 2; }
.masthead nav { grid-row: 2; }

@media (min-width: 900px) {
  .masthead-inner {
    grid-template-columns: auto 1fr auto;
    padding-top: var(--s3);
    padding-bottom: 0;
    column-gap: var(--s6);
  }
  .masthead nav { grid-column: 2; grid-row: 1; }
  .theme-toggle { grid-column: 3; }
  .masthead nav ul { column-gap: var(--s5); justify-content: flex-end; }
  .masthead nav a { padding: var(--s3) 0; font-size: 0.9375rem; }
}

main, .container {
  display: block;
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s7);
}
@media (min-width: 720px) {
  main, .container { padding-top: var(--s6); padding-bottom: var(--s8); }
}
main:focus { outline: none; }

footer.site-foot {
  border-top: 2px solid var(--navy);
  background: var(--ground);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.site-foot-inner {
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s6);
}
.site-foot p { max-width: var(--measure); margin-bottom: var(--s2); }
.site-foot ul {
  list-style: none;
  margin: 0 0 var(--s3);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
}
.site-foot li { margin: 0; }
.site-foot a { display: inline-block; padding: var(--s1) 0; min-height: 24px; }

/* -- Page head --------------------------------------------------------------- */

.kicker {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  margin: 0 0 var(--s1);
  letter-spacing: 0;
  text-transform: none;
}
h2.kicker { font-family: var(--sans); border: 0; padding: 0; margin-top: 0; }
.shows, .lede, .standfirst {
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 var(--s4);
}
@media (min-width: 720px) {
  .shows, .lede, .standfirst { font-size: 1.1875rem; }
}
.byline, .as-of {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0 0 var(--s4);
  text-transform: none;
  letter-spacing: 0;
}
.byline strong { color: var(--ink); }

/* -- Key points -------------------------------------------------------------- */

.keypoints {
  background: var(--sunk);
  border-top: 2px solid var(--navy);
  padding: var(--s4);
  margin: var(--s5) 0 var(--s6);
  max-width: 52rem;
}
.keypoints h2 {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  border: 0;
  margin: 0 0 var(--s2);
  padding: 0;
}
.keypoints ul { margin: 0; padding-left: 1.1rem; max-width: none; }
.keypoints li { color: var(--ink); margin-bottom: var(--s2); }
.keypoints li:last-child { margin-bottom: 0; }

/* -- Proof numbers ----------------------------------------------------------- */

.proof {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3) var(--s4);
  margin: var(--s4) 0 var(--s4);
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  list-style: none;
  max-width: 52rem;
}
.proof > div, .proof > li { margin: 0; min-width: 0; }
.proof dt, .proof strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}
.proof dd, .proof span {
  display: block;
  margin: var(--s1) 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ink-soft);
}
@media (min-width: 720px) {
  .proof { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: var(--s4) 0; }
  .proof dt, .proof strong { font-size: 1.75rem; }
  .proof dd, .proof span { font-size: 0.875rem; }
}

.finding { font-size: 1rem; color: var(--ink); margin: 0 0 var(--s4); max-width: var(--measure); }

/* -- Next steps -------------------------------------------------------------- */

.next {
  list-style: none;
  padding: 0;
  margin: var(--s4) 0 var(--s6);
  display: grid;
  gap: var(--s2);
  max-width: 40rem;
}
.next li { margin: 0; }
.next a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  min-height: 48px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--navy);
  border-radius: 2px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.next a::after { content: "\2192"; font-weight: 400; color: var(--navy); }
.next a:hover { background: var(--sunk); text-decoration: underline; }
@media (min-width: 720px) {
  .next { grid-template-columns: 1fr 1fr; }
}

/* -- Steps ------------------------------------------------------------------- */

.steps { padding-left: 1.5rem; }
.steps li { margin-bottom: var(--s3); padding-left: var(--s1); color: var(--ink-soft); }
.steps li::marker { font-family: var(--serif); font-weight: 600; color: var(--navy); }
.steps strong { display: block; }

/* -- Callout, disclaimer, quote ---------------------------------------------- */

.callout, .disclaimer {
  border-left: 3px solid var(--navy);
  background: var(--sunk);
  padding: var(--s3) var(--s4);
  margin: var(--s4) 0;
  max-width: var(--measure);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.callout > :last-child, .disclaimer > :last-child { margin-bottom: 0; }
.callout-caution { border-left-color: var(--amber); }
.callout p, .disclaimer p { max-width: none; }
.quote, blockquote {
  border-left: 3px solid var(--rule-strong);
  margin: var(--s4) 0;
  padding: var(--s1) var(--s4);
  max-width: var(--measure);
  color: var(--ink);
}
.note { color: var(--ink-soft); font-size: 0.875rem; }
.sources, .source, .mono-small {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}
.sources a, .source a, .mono-small a { color: inherit; }
.footnotes { font-size: 0.875rem; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: var(--s3); }

/* -- Chips and n/a ----------------------------------------------------------- */

.chip, .flag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 0 var(--s2);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-soft);
  background: transparent;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
}
.chip-warning, .flag.flag-elevated { color: var(--red); border-color: var(--red); background: var(--red-bg); }
.chip-watch, .flag.flag-watch { color: var(--amber); border-color: var(--amber); background: var(--amber-bg); }
.flag-elevated { color: var(--red); }
.flag-watch { color: var(--amber); }
td.flag-elevated, .value.flag-elevated { font-weight: 600; }
.na, .value.na { color: var(--muted); }
.na-reason { display: block; font-size: 0.8125rem; line-height: 1.35; color: var(--muted); }

/* -- Glossary links and glosses ---------------------------------------------- */

.gloss { color: var(--ink-soft); }
/* First use of a technical term: the term itself links to its glossary entry.
   Dotted, so it reads as "this word has a definition" rather than "go here". */
a.term {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a.term:hover { color: var(--link); text-decoration-style: solid; }
dl.glossary dt {
  font-weight: 600;
  color: var(--ink);
  margin-top: var(--s4);
  scroll-margin-top: var(--s5);
}
dl.glossary dt .technical { font-weight: 400; color: var(--muted); }
dl.glossary dd { margin: var(--s1) 0 0; }
dl.glossary dd.precise, dl.glossary dd .note { font-size: 0.875rem; color: var(--ink-soft); }
dl.glossary dt:target { background: var(--sunk); outline: 2px solid var(--navy); outline-offset: 4px; }

/* -- Tables ------------------------------------------------------------------ */

.table-wrap, .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s4) 0 var(--s5);
  max-width: 100%;
}
.table-wrap:focus-visible, .table-scroll:focus-visible { outline-offset: 0; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums lining-nums;
}
table.data caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  padding: 0 0 var(--s2);
}
table.data th, table.data td {
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  color: var(--ink);
}
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-soft);
  vertical-align: bottom;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--ground);
  letter-spacing: 0;
  text-transform: none;
}
table.data tbody th { font-weight: 600; }
table.data tbody th .note, table.data tbody th small, table.data tbody th .na-reason { font-weight: 400; }
.table-wrap, .table-scroll { position: relative; }
table.data .num { text-align: right; white-space: nowrap; }
table.data td.name, table.data th.name { font-weight: 600; }
table.data td.note { color: var(--ink-soft); font-size: 0.8125rem; min-width: 16ch; }
table.data tr.subhead td, table.data tr.subhead th {
  background: var(--sunk);
  font-weight: 600;
  color: var(--ink);
  border-top: 1px solid var(--rule-strong);
  padding-left: var(--s2);
}
table.data tr.total td, table.data tr.total th { border-top: 1px solid var(--rule-strong); font-weight: 600; }
table.data td.thin, table.data th.thin { width: 1%; white-space: nowrap; }
/* A short table of a few figures should not stretch across a wide screen. */
table.data.narrow { max-width: 44rem; }
.muted { color: var(--muted); }
table.data a { text-underline-offset: 2px; }
table.data td.num a { display: inline-block; min-height: 24px; }
/* A dense table cannot shrink past its numbers. On a narrow screen its cells
   stop wrapping and the table scrolls inside its own container, so the page
   itself never scrolls sideways. Columns of prose keep wrapping. */
@media (max-width: 899px) {
  .table-wrap table.data th, .table-wrap table.data td,
  .table-scroll table.data th, .table-scroll table.data td { white-space: nowrap; }
  .table-wrap table.data td.note, .table-scroll table.data td.note,
  .table-wrap table.data .wrap, .table-scroll table.data .wrap { white-space: normal; min-width: 22ch; }
  .table-wrap table.data.prose td, .table-wrap table.data.prose th { white-space: normal; }
}
.table-scroll table.data th, .table-scroll table.data td { white-space: nowrap; }
.table-scroll table.data td.note { white-space: normal; min-width: 22ch; }
@media (max-width: 899px) {
  /* The frozen first column must leave room to see the figures beside it. */
  .table-scroll th[scope="row"], .table-scroll thead th:first-child,
  .table-wrap.sticky-first th:first-child, .table-wrap.sticky-first td:first-child {
    white-space: normal;
    min-width: 9rem;
    max-width: 42vw;
  }
}
/* The first column stays in view while the rest scrolls. */
.table-wrap.sticky-first th:first-child, .table-wrap.sticky-first td:first-child,
.table-scroll th[scope="row"], .table-scroll thead th:first-child {
  position: sticky;
  left: 0;
  background: var(--ground);
  padding-right: var(--s3);
}

/* Sortable headers: a real button fills the cell. */
table.data thead th button.sort {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: flex-end;
  gap: var(--s1);
  min-height: 24px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
table.data thead th button.sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
table.data thead th button.sort .dir { color: var(--muted); font-weight: 400; }
table.data thead th[aria-sort] button.sort .dir { color: var(--ink); }
table.data thead th[data-sort] { cursor: pointer; }

/* -- Forms and controls ------------------------------------------------------ */

.controls {
  display: grid;
  gap: var(--s3);
  margin: var(--s4) 0;
  max-width: 60rem;
}
@media (min-width: 720px) {
  .controls { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
  .control-wide { grid-column: 1 / -1; }
}
.control label, .control .kicker { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--ink-soft); margin-bottom: var(--s1); }
input[type="search"], input[type="text"], select {
  width: 100%;
  min-height: 40px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  margin: 0;
}
input::placeholder { color: var(--muted); opacity: 1; }
.result-count, .control-wide output { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
a.button, button.button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s4);
  border: 1px solid var(--navy);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
a.button:hover, button.button:hover { background: var(--sunk); text-decoration: underline; }

details { margin: var(--s3) 0; }
summary {
  cursor: pointer;
  min-height: 32px;
  padding: var(--s1) 0;
  font-weight: 600;
  color: var(--link);
}
summary:hover { text-decoration: underline; }
details[open] > summary { margin-bottom: var(--s2); }

/* -- In-page contents -------------------------------------------------------- */

nav.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s4);
  margin: var(--s4) 0 var(--s5);
  padding: var(--s2) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}
nav.toc a { display: inline-block; padding: var(--s1) 0; min-height: 28px; }

/* -- Figures ----------------------------------------------------------------- */

figure { margin: var(--s5) 0 var(--s6); }
figure.chart, figure.timeline { max-width: 52rem; }
figure.chart figcaption { margin-bottom: var(--s3); }
.chart-title {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 var(--s1);
  max-width: var(--measure);
}
.chart-sub { font-size: 0.875rem; line-height: 1.4; color: var(--ink-soft); margin: 0; max-width: var(--measure); }
figure.chart .source { margin: var(--s2) 0 0; }
figure.chart details { margin-top: var(--s1); font-size: 0.875rem; }
figure.chart details summary { font-weight: 400; font-size: 0.875rem; }
figure figcaption.plain { font-size: 0.875rem; color: var(--ink-soft); max-width: var(--measure); }

/* -- Company tear sheet ------------------------------------------------------ */

.strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3) var(--s4);
  margin: var(--s4) 0;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  max-width: 60rem;
}
.strip > div { min-width: 0; }
.strip dt { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.strip dd { margin: 0; font-size: 1rem; color: var(--ink); }
@media (min-width: 720px) {
  .strip { grid-template-columns: repeat(5, minmax(0, auto)); }
}

.families { display: grid; gap: var(--s5); }
@media (min-width: 900px) {
  .families { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); }
}
.family { border-top: 1px solid var(--rule-strong); padding-top: var(--s3); min-width: 0; }
.family header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.family header h3 { margin: 0 0 var(--s2); }
.family .count { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s1) var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--rule);
}
.signal-row:last-child { border-bottom: 0; }
.signal-row .label { font-size: 0.9375rem; color: var(--ink); min-width: 0; }
.signal-row .label .sub { display: block; font-size: 0.8125rem; color: var(--muted); }
.signal-row .value { text-align: right; white-space: nowrap; color: var(--ink); }
.signal-row .value.na { font-size: 0.8125rem; white-space: normal; max-width: 14rem; }
.indicator-row details.inputs { grid-column: 1 / -1; margin: 0; font-size: 0.8125rem; }
.indicator-row details.inputs summary { font-weight: 400; font-size: 0.8125rem; min-height: 24px; }
.indicator-row details.inputs table { width: 100%; border-collapse: collapse; }
.indicator-row details.inputs td { padding: var(--s1) var(--s3) var(--s1) 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.indicator-row details.inputs td.num { text-align: right; white-space: nowrap; }
.spark { display: inline-block; vertical-align: middle; }

/* -- Filing record list ------------------------------------------------------ */

ul.timeline, ol.record {
  list-style: none;
  padding: 0;
  margin: var(--s4) 0;
  max-width: var(--measure);
  border-left: 2px solid var(--rule-strong);
}
ul.timeline li, ol.record li { margin: 0; padding: var(--s2) 0 var(--s3) var(--s4); }
ul.timeline li .date, ol.record li .date { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
ul.timeline li.elevated { border-left: 3px solid var(--red); margin-left: -2px; }

/* -- Screener ---------------------------------------------------------------- */

.legend { background: var(--sunk); padding: var(--s4); margin: var(--s4) 0; max-width: 60rem; }
.legend dl { margin: 0; max-width: none; }
.legend h2, .legend h3 { font-family: var(--sans); font-size: 1rem; border: 0; padding: 0; margin: 0 0 var(--s2); }
a.cite { white-space: normal; }
.table-scroll table.data th[scope="row"] { white-space: normal; min-width: 12rem; max-width: 28ch; }
.legend dt { font-weight: 600; color: var(--ink); margin-top: var(--s3); }
.legend dt:first-child { margin-top: 0; }
.legend dd { margin: var(--s1) 0 0; font-size: 0.9375rem; }
table.data th.fam, table.data td.fam { text-align: right; }
table.data th.group { text-align: center; border-bottom: 1px solid var(--rule-strong); color: var(--ink); }
/* The header stays in view because the table scrolls inside its own box. */
.screener-table thead { position: sticky; top: 0; z-index: 1; }
.screener-table td.wrap, .screener-table th.wrap { white-space: normal; min-width: 16ch; }
@media (min-width: 900px) {
  .screener-table { max-height: 85vh; overflow: auto; border-bottom: 1px solid var(--rule-strong); }
}

.company-list { list-style: none; padding: 0; margin: var(--s4) 0; border-top: 1px solid var(--rule-strong); max-width: none; }
.company-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--s3);
  margin: 0;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
}
/* Five hundred rows: the browser lays out only the ones near the screen. */
.company-list li { content-visibility: auto; contain-intrinsic-size: auto 68px; }
.company-list .co { font-weight: 600; color: var(--ink); }
.company-list .co a { display: inline-block; min-height: 24px; }
.company-list .meta { grid-column: 1; font-size: 0.8125rem; color: var(--muted); }
.company-list .count { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; }
/* Phone: the list. Wider: the table. Without CSS both are readable in order. */
.only-wide { display: none; }
@media (min-width: 900px) {
  .only-narrow { display: none; }
  .only-wide { display: block; }
}

/* -- Print: an A4 research note ---------------------------------------------- */

@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --ground: #ffffff;
    --sunk: #f3f0e9;
    --surface: #ffffff;
    --ink: #000000;
    --ink-soft: #1f1f1f;
    --muted: #444444;
    --rule: #bbbbbb;
    --rule-strong: #666666;
    --navy: #10243e;
    --link: #000000;
    --red: #8c1d18;
    --red-bg: #ffffff;
    --amber: #7a4a00;
    --amber-bg: #ffffff;
  }
  @page { size: A4; margin: 16mm 15mm 18mm; }
  html { font-size: 10pt; }
  body { background: #fff; }
  .masthead nav, .theme-toggle, .skip-link, .controls, nav.toc, .next, .no-print,
  .site-foot ul, .only-narrow { display: none !important; }
  .only-wide { display: block !important; }
  .masthead { border-bottom: 1pt solid #000; }
  .masthead-inner, main, .container, .site-foot-inner { max-width: none; padding-left: 0; padding-right: 0; }
  main, .container { padding-top: 6mm; padding-bottom: 0; }
  h1 { font-size: 20pt; }
  h2 { font-size: 13pt; margin-top: 8mm; break-after: avoid; }
  h3 { font-size: 11pt; break-after: avoid; }
  p, li { orphans: 3; widows: 3; }
  a { color: inherit; text-decoration: none; }
  figure, .keypoints, .callout, .disclaimer, tr { break-inside: avoid; }
  thead { display: table-header-group; }
  .table-wrap, .table-scroll { overflow: visible; }
  .table-wrap table.data th, .table-wrap table.data td,
  .table-scroll table.data th, .table-scroll table.data td { white-space: normal; position: static; }
  table.data { font-size: 8.5pt; }
  /* Collapsed sections stay collapsed: a printed note is the summary, and the
     inputs behind each figure are a click away on screen. */
  details:not([open]) { display: none; }
  details > summary { list-style: none; color: inherit; }
  a.term { text-decoration: none; }
  .print-footnote-ref { font-size: 0.7em; vertical-align: super; }
  .print-footnotes { display: block !important; font-size: 8pt; margin-top: 8mm; border-top: 0.5pt solid #666; padding-top: 3mm; }
  .print-footnotes li { overflow-wrap: anywhere; color: #1f1f1f; }
}
.print-footnotes, .print-footnote-ref { display: none; }
@media print {
  .print-footnote-ref { display: inline; }
}

/* No animation anywhere; stated so none is added. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/*
 * Earnings Quality Monitor — chart styles
 *
 * The charts are inline SVG written by eqm.site.charts. They carry no colour
 * and no font size of their own: every mark and every label takes both from a
 * class here, and every colour here is a design token, so the dark theme and
 * print restyle a chart without a second drawing.
 *
 * Each chart is drawn twice, 720 and 340 user units wide. A user unit is about
 * one CSS pixel at the sizes shown (the narrow drawing is capped at 520 px),
 * so the 12 px below is 12 px or more on the screen. Nothing here is smaller.
 */

.chart-svg,
.chart-multiple,
.spark {
  display: block;
  height: auto;
  overflow: visible;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}

.chart-svg {
  width: 100%;
}

/* A phone gets the drawing made for a phone. */
.chart-wide {
  display: none;
}

.chart-narrow {
  max-width: 520px;
}

@media (min-width: 760px) {
  .chart-wide {
    display: block;
  }

  .chart-narrow {
    display: none;
  }
}

@media print {
  .chart-wide {
    display: block;
  }

  .chart-narrow {
    display: none;
  }
}

/* Word-sized charts: one indicator against its limit, and the screener's
   warning-sign count by year. Fixed size, so a table column stays aligned. */
.chart-multiple {
  display: inline-block;
  width: 132px;
  height: 30px;
  vertical-align: middle;
}

.spark {
  display: inline-block;
  width: auto;
  height: 18px;
  max-width: 84px;
  vertical-align: middle;
}

/* Text. One size; weight and tone carry the hierarchy. */
.c-text,
.c-label,
.c-strong,
.c-on {
  font-size: 12px;
  font-weight: 400;
  stroke: none;
}

.c-text {
  fill: var(--muted);
}

.c-label {
  fill: var(--ink);
}

.c-strong {
  fill: var(--ink);
  font-weight: 600;
}

/* A count set on a solid bar. */
.c-on {
  fill: var(--ground);
  font-weight: 600;
}

.c-mid {
  text-anchor: middle;
}

.c-end {
  text-anchor: end;
}

/* Fills. Navy is the neutral series, red a warning sign, amber a watch, grey
   context. */
.c-navy {
  fill: var(--navy);
}

.c-red {
  fill: var(--red);
}

.c-amber {
  fill: var(--amber);
}

.c-grey {
  fill: var(--muted);
}

/* The bulk of a distribution, behind the part that is picked out in navy. */
.c-soft {
  fill: var(--rule-strong);
}

.c-ground {
  fill: var(--ground);
}

.c-band {
  fill: var(--sunk);
}

/* Lines. */
.c-axis,
.c-grid,
.c-ref,
.c-mark,
.c-line-navy,
.c-line-red,
.c-line-grey {
  fill: none;
  stroke-width: 1;
}

.c-axis {
  stroke: var(--rule-strong);
  shape-rendering: crispEdges;
}

.c-grid {
  stroke: var(--rule);
  shape-rendering: crispEdges;
}

/* A reference line: the guessing line, an indicator's limit. */
.c-ref {
  stroke: var(--muted);
  stroke-dasharray: 4 3;
}

/* The date the problem came out; the real result on a histogram. */
.c-mark {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.c-line-navy {
  stroke: var(--navy);
  stroke-width: 2;
}

.c-line-red {
  stroke: var(--red);
  stroke-width: 2;
}

.c-line-grey {
  stroke: var(--muted);
  stroke-width: 2;
}

.c-dash {
  stroke-dasharray: 7 4;
}

.c-thin {
  stroke-width: 1.25;
  stroke-linejoin: round;
}

/* The second category in a stacked bar is hatched as well as tinted, so it
   reads without colour. Each drawing defines its own pattern. */
.c-tint-red {
  fill: var(--red);
  fill-opacity: 0.14;
}

.c-tint-grey {
  fill: var(--muted);
  fill-opacity: 0.14;
}

.c-hatch-red {
  stroke: var(--red);
  stroke-width: 2;
}

.c-hatch-grey {
  stroke: var(--muted);
  stroke-width: 2;
}

.c-seg-red {
  stroke: var(--red);
  stroke-width: 1;
}

.c-seg-grey {
  stroke: var(--muted);
  stroke-width: 1;
}
