:root {
  --bg: #fbfbf8;
  --raised: #ffffff;
  --frame: #f1f1ec;
  --text: #1d2024;
  --text-2: #3b4148;
  --muted: #666d75;
  --faint: #9aa0a7;
  --line: #e2e2dc;
  --line-strong: #c8c8c0;
  --accent: #2b6a57;
  --accent-ink: #ffffff;
  --danger: #b42a2f;
  --radius: 6px;
  --radius-sm: 4px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --fs-meta: 12px;
  --fs-body: 14px;
  --fs-lead: 15px;
  --fs-h2: 15px;
  --fs-title: 22px;
  --page-w: 860px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315;
    --raised: #171a1d;
    --frame: #1d2125;
    --text: #e6e8ea;
    --text-2: #b8bdc3;
    --muted: #8a9199;
    --faint: #5b626a;
    --line: #262a2f;
    --line-strong: #363b42;
    --accent: #72b9a1;
    --accent-ink: #111315;
    --danger: #e5484d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315;
  --raised: #171a1d;
  --frame: #1d2125;
  --text: #e6e8ea;
  --text-2: #b8bdc3;
  --muted: #8a9199;
  --faint: #5b626a;
  --line: #262a2f;
  --line-strong: #363b42;
  --accent: #72b9a1;
  --accent-ink: #111315;
  --danger: #e5484d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
main { max-width: var(--page-w); margin: 0 auto; padding: 28px 16px 48px; }
a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; background: var(--raised); padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); z-index: 1; }

/* Site header and footer */
.site-head { border-bottom: 1px solid var(--line); }
.site-head .in, .site-foot .in { max-width: var(--page-w); margin: 0 auto; padding: 12px 16px; }
.site-head .in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; }
.site-name { color: var(--text); font-weight: 600; }
.site-name:hover { text-decoration: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-meta); }
.site-foot .in { padding-top: 16px; padding-bottom: 24px; }
.site-foot p { margin: 0 0 4px; }

/* Page heads */
.page-head { border-bottom: 1px solid var(--line-strong); padding-bottom: 16px; }
h1 { color: var(--text); font-size: var(--fs-title); font-weight: 600; line-height: 1.25; margin: 0 0 8px; }
.page-head p { margin: 0 0 8px; }
.page-head p:last-child { margin-bottom: 0; }
.head-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.crumb { margin: 0 0 8px; font-size: var(--fs-meta); }

section { padding-top: 28px; }
h2 { color: var(--text); font-size: var(--fs-h2); font-weight: 600; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
h2 .muted { font-weight: 400; }
h3 { color: var(--text); font-size: var(--fs-body); font-weight: 500; margin: 20px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-meta); }
strong, .em { color: var(--text); font-weight: 500; }
.err { color: var(--danger); font-size: var(--fs-meta); margin: 8px 0 0; }

/* Buttons */
.btn, .btn-secondary {
  font: inherit; font-weight: 500; border-radius: var(--radius-sm); padding: 6px 14px; cursor: pointer;
}
.btn { color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); }
.btn-secondary { color: var(--accent); background: var(--raised); border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--frame); }
.btn-text { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.btn-text:hover { text-decoration: underline; }

/* Your year */
ul.hl { list-style: none; margin: -12px 0 12px; padding: 0; }
ul.hl li { border-bottom: 1px solid var(--line); padding: 9px 0; color: var(--text); font-size: var(--fs-lead); }
ul.hl li .rg { color: var(--muted); font-size: var(--fs-meta); margin-top: 2px; }
.show-ranges ul.hl li .rg { display: block; }
.hl-actions { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }

/* Ranges show only when Show ranges is on. */
body:not(.show-ranges) .rg, body:not(.show-ranges) .rgi { display: none; }
.rgi { color: var(--muted); }
pre.share { font: var(--fs-meta)/1.6 var(--mono); color: var(--text-2); background: var(--frame); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-fallback { margin-top: 10px; }
.copy-fallback textarea { width: 100%; font: var(--fs-meta)/1.5 var(--mono); color: var(--text); background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px; }

/* Inputs */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.group { border-top: 1px solid var(--line); padding: 12px 0 6px; margin-top: 12px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.group-head legend, .group-head .legend { color: var(--text); font-weight: 500; padding: 0; float: left; }
.code { color: var(--muted); font-family: var(--mono); font-size: var(--fs-meta); margin-right: 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; clear: both; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label, .field .lab { color: var(--muted); font-size: var(--fs-meta); }
.field .hint, p.hint { color: var(--muted); font-size: var(--fs-meta); }
.fields.presets { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 10px; }
input[type="number"], input[type="text"], input[type="search"], select {
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  width: 100%;
  min-width: 0;
}
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: none; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; }
.basis-actions { margin: 10px 0 0; }

/* The question flow */
.flow-page .page-head { border-bottom: 0; padding-bottom: 4px; }
#flow { margin-top: 8px; }
#flow .step { border-top: 1px solid var(--line); padding: 14px 0 12px; }
@media (min-width: 700px) {
  #flow .steps { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  #flow .step.wide { grid-column: 1 / -1; }
}
#flow .step legend { color: var(--text); font-weight: 500; font-size: var(--fs-lead); padding: 0; margin-bottom: 10px; float: left; width: 100%; }
#flow .step > :not(legend) { clear: both; }
#flow .fields { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-width: 680px; }
#flow p.hint { margin: 8px 0 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.progress { color: var(--muted); font-size: var(--fs-meta); margin: 0; }
.progress:empty { display: none; }
.flow-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
#flow.paged .step { display: none; min-height: 220px; }
#flow.paged .step.active { display: block; }
#flow.paged .flow-nav #nextBtn, #flow.paged .flow-nav #seeBtn { margin-left: auto; }
#pickerWrap { margin-top: 10px; }

/* Collapsible subsections */
details.fold { border-top: 1px solid var(--line); }
details.fold:last-child { border-bottom: 1px solid var(--line); }
details.fold + :not(details.fold) { margin-top: 14px; }
details.fold > summary { cursor: pointer; padding: 9px 0; color: var(--text); font-weight: 500; }
details.fold > summary .sum-note { color: var(--muted); font-weight: 400; font-size: var(--fs-meta); margin-left: 6px; }
details.fold > summary:hover { background: var(--frame); }
details.fold > .fold-body { padding: 2px 0 16px; }
details.fold.nested { margin-top: 12px; }
details.fold.nested > summary { font-weight: 400; color: var(--text-2); }
.fold-group { margin: 6px 0 12px; }
.fold-group details.fold:last-child { border-bottom: 1px solid var(--line); }
main > .fold-group { margin-top: 28px; }

/* Contents lists */
nav.toc { padding-top: 24px; }
nav.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
nav.toc li { margin-bottom: 3px; break-inside: avoid; }
nav.toc ul.plain { columns: 2; column-gap: 32px; }

/* Tables */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; color: var(--muted); font-size: var(--fs-meta); font-weight: 400; }
th.n, td.n { text-align: right; white-space: nowrap; }
td .c { display: block; color: var(--text); }
td .r { display: block; color: var(--muted); font-size: var(--fs-meta); }
td .c.muted { color: var(--muted); }
tr.total td { border-top: 1px solid var(--line-strong); }
tr.total td:first-child, tr.total .c { font-weight: 600; color: var(--text); }
tr.retired td { color: var(--muted); }
td.small { font-size: var(--fs-meta); color: var(--text-2); }
table.board { min-width: 560px; }
table.board td { font-size: var(--fs-meta); }
table.board td.co, table.dir td.co { font-size: var(--fs-body); color: var(--text); min-width: 140px; }
table.dir td { font-size: var(--fs-meta); }
#aiTable td:first-child { min-width: 240px; }
#aiTable th.n { white-space: normal; }
.flag { color: var(--muted); font-size: var(--fs-meta); font-style: italic; white-space: nowrap; }
.table-foot { margin: 8px 0 0; }

ol.notes { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: var(--fs-meta); }
ol.notes li { margin-bottom: 4px; }
ul.plain { margin: 0 0 10px; padding-left: 20px; }
ul.plain li { margin-bottom: 4px; }

/* Company picker */
.picker-head { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: end; margin: 4px 0 8px; }
.picker-head .field { width: 240px; max-width: 100%; }
.picker-count { color: var(--muted); font-size: var(--fs-meta); }
.sector { margin: 10px 0 0; }
.sector-head { color: var(--text); font-weight: 500; margin: 0 0 6px; }
.sector-head .muted { font-weight: 400; font-size: var(--fs-meta); margin-left: 4px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.chip { display: flex; align-items: flex-start; gap: 8px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--raised); color: var(--text-2); cursor: pointer; min-width: 0; }
.chip input { margin-top: 3px; }
.chip:hover { background: var(--frame); }
.chip:has(input:checked) { border-color: var(--accent); }
.chip-text { display: flex; flex-direction: column; min-width: 0; }
.chip-name { color: var(--text); line-height: 1.35; }
.chip-sub { color: var(--muted); font-size: var(--fs-meta); line-height: 1.4; }

/* Filter box on the directory and sources pages */
.filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 16px; padding-top: 20px; }
.filter .field { width: 320px; max-width: 100%; }

/* Methodology rows, source lists, cards */
.rows { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
.row { padding: 10px 12px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-head .name { color: var(--text); }
.row-vals { color: var(--text-2); font-family: var(--mono); font-size: var(--fs-meta); }
.row p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-meta); }
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.sources .row > a { color: var(--accent); }

ul.items { margin: 0; padding-left: 18px; }
ul.items li { margin-bottom: 6px; }
ul.items .d, .src { color: var(--muted); font-size: var(--fs-meta); }
ul.src-list li { font-size: var(--fs-meta); }
td details summary, .cards summary { cursor: pointer; }
.cards { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
.cards details { border-top: 1px solid var(--line); }
.cards details:first-child { border-top: 0; }
.cards summary { padding: 9px 12px; color: var(--text); }
.cards summary .muted { font-size: var(--fs-meta); margin-left: 6px; }
.card-body { padding: 2px 12px 14px; font-size: var(--fs-meta); }
.card-body h4 { color: var(--text); font-size: var(--fs-meta); font-weight: 600; margin: 14px 0 6px; }
.card-body p { margin: 0 0 6px; }
.card-body dl, .basis-list, dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.card-body dt, .basis-list dt, dl.facts dt { color: var(--muted); }
.card-body dd, .basis-list dd, dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts { padding-top: 20px; }
dl.facts.score { padding-top: 4px; margin-bottom: 10px; }
.calc { font-family: var(--mono); font-size: var(--fs-meta); color: var(--text-2); background: var(--frame); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
#btsTable td:last-child { min-width: 0; overflow-wrap: anywhere; }

/* What changes it most */
ol.levers { margin: 0; padding-left: 20px; }
ol.levers li { padding: 3px 0; }

@media (max-width: 640px) {
  main { padding-top: 20px; }
  .fields { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  #flow .fields { grid-template-columns: 1fr 1fr; }
  .fields.presets { grid-template-columns: 1fr; }
  nav.toc ol, nav.toc ul.plain { columns: 1; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); padding: 8px 0; }
  table.stack tr:first-child { border-top: 0; }
  table.stack tr.total { border-top: 1px solid var(--line-strong); }
  table.stack td { border: 0; padding: 4px 12px; text-align: left; white-space: normal; }
  table.stack td:first-child { grid-column: 1 / -1; }
  table.stack td:empty { display: none; }
  table.stack tr.grp th { grid-column: 1 / -1; border: 0; padding: 4px 12px; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; color: var(--faint); font-size: var(--fs-meta); }
  table.dir td:nth-child(2) { grid-column: 1 / -1; }
  .card-body dl, .basis-list, dl.facts { grid-template-columns: 1fr; gap: 0; }
  .card-body dd, .basis-list dd, dl.facts dd { margin-bottom: 6px; }
  dl.facts.score { grid-template-columns: max-content 1fr; gap: 2px 16px; }
}
@media (max-width: 340px) {
  .fields, #flow .fields { grid-template-columns: 1fr; }
}
@media print {
  body { background: #fff; color: #000; }
  .site-nav, .skip { display: none; }
  input, select { border-color: #999; }
}

/* Water page */
dl.facts.defs { padding-top: 4px; margin-bottom: 12px; }
.ctx .fields { margin-bottom: 6px; }
.ctx-ex { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 4px; }
.ctx-ex .btn-text[aria-pressed="true"] { color: var(--text); font-weight: 500; cursor: default; text-decoration: none; }
#ctxTable tr.grp th { color: var(--text); font-weight: 500; border-top: 1px solid var(--line-strong); }
#ctxTable tbody:first-of-type tr.grp th { border-top: 0; }
