/*
 * BijliLens. One stylesheet, no dependencies.
 *
 * The look borrows from the bill itself: ruled boxes like a printed form, ledger double
 * rules above totals, and a payment stub with a perforation. Teal carries the brand, amber
 * marks "this bill" and keyboard focus, and every figure is set in tabular numerals.
 *
 * Contents: tokens, base, page frame, controls, messages, tables, start screen, bill list,
 * bill header, picture viewer, bill details, charts, insights, ask, compare, generate CSVs,
 * motion.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  --paper: #f1f4f3;
  --surface: #ffffff;
  --sunken: #e8edeb;
  --ink: #13262b;
  --ink-2: #3b5056;
  --ink-3: #566a70;
  --line: #d2dad8;
  --line-strong: #74878a;

  --brand: #0a5a61;
  --brand-strong: #07474d;
  --brand-ink: #ffffff;
  --brand-soft: #dbeae9;
  --spark: #f2a81d;
  --spark-ink: #33250a;
  --winter: #3e5ecc;

  --ok: #17643c;
  --ok-soft: #ddf0e4;
  --warn: #7a4b00;
  --warn-soft: #fff1cf;
  --bad: #9e2a1d;
  --bad-ink: #ffffff;
  --bad-soft: #fbe5e1;

  --stub: #0b4f56;
  --stub-ink: #ffffff;
  --stub-muted: #bfe0df;
  --stub-line: #6fa5a8;

  --series-1: var(--brand);
  --series-2: var(--warn);

  --shadow: 0 12px 28px rgb(13 38 43 / 0.18);
  --radius: 10px;
  --radius-small: 6px;
  --page: 78rem;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Geeza Pro", Tahoma, sans-serif;
  --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e191b;
    --surface: #152327;
    --sunken: #1b2e33;
    --ink: #e7efed;
    --ink-2: #b9c8c5;
    --ink-3: #96a9a7;
    --line: #2a3f45;
    --line-strong: #6b878d;

    --brand: #62c7cc;
    --brand-strong: #86d8dc;
    --brand-ink: #06272a;
    --brand-soft: #173a3f;
    --spark: #f5b942;
    --spark-ink: #33250a;
    --winter: #8fa8ff;

    --ok: #74d69d;
    --ok-soft: #143425;
    --warn: #f3c567;
    --warn-soft: #3a2c0b;
    --bad: #ff9e91;
    --bad-ink: #2b0e0a;
    --bad-soft: #43201b;

    --stub: #0e474d;
    --stub-ink: #eef8f7;
    --stub-muted: #a9d6d4;
    --stub-line: #5f9a9e;

    --shadow: 0 12px 28px rgb(0 0 0 / 0.5);
  }
}

/* ---------------------------------------------------------------- base */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.5rem, 1.25rem + 1.1vw, 1.9rem);
  font-weight: 750;
  letter-spacing: -0.015em;
}

h2 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.03rem;
  font-weight: 700;
}

h4 {
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--brand);
  text-underline-offset: 0.15em;
}

@media (hover: hover) {
  a:hover {
    text-decoration-thickness: 2px;
  }
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--spark);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.lede {
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

.muted {
  color: var(--ink-2);
  font-size: 0.9rem;
}

.not-printed {
  color: var(--ink-3);
  font-style: italic;
  font-weight: 400;
}

.amount,
.clock {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-with-tag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.path {
  font-family: var(--font-code);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--pass {
  color: var(--ok);
}

.icon--fail {
  color: var(--bad);
}

.icon--caution {
  color: var(--warn);
}

.icon--info {
  color: var(--brand);
}

.icon--waiting {
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- page frame */

.skip-link {
  position: absolute;
  top: -4rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--paper);
  font-weight: 650;
}

.skip-link:focus {
  top: 0.5rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.5rem 1rem 0;
}

.brand {
  display: inline-flex;
  order: 1;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  padding: 0.25rem 0;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.brand__lens {
  fill: var(--brand);
}

.brand__bolt {
  fill: var(--spark);
}

.brand__handle {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
}

/* On a narrow screen the status area dissolves into the header's own rows:
   brand and Models button first, the demo badge on a row of its own, then the views. */
.status {
  display: contents;
}

.popover {
  position: relative;
  order: 2;
}

.demo-badge {
  flex-basis: 100%;
  order: 3;
  margin: 0.4rem 0 0;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius-small);
  background: var(--warn-soft);
  color: var(--ink);
  font-size: 0.8125rem;
}

.site-nav {
  flex-basis: 100%;
  order: 4;
  margin-top: 0.25rem;
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.15rem;
  margin: 0 -0.6rem;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: block;
  padding: 0.55rem 0.6rem 0.45rem;
  border-bottom: 3px solid transparent;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}

@media (hover: hover) {
  .site-nav__link:hover {
    border-bottom-color: var(--line-strong);
    color: var(--ink);
  }
}

.site-nav__link[aria-current="page"] {
  border-bottom-color: var(--brand);
  color: var(--ink);
  font-weight: 750;
}

@media (min-width: 48rem) {
  .status {
    display: flex;
    order: 2;
    align-items: center;
    gap: 0.75rem;
  }

  .popover,
  .demo-badge {
    order: 0;
  }

  .demo-badge {
    flex-basis: auto;
    margin: 0;
  }
}

@media (min-width: 75rem) {
  .brand {
    margin-right: 1rem;
  }

  .site-nav {
    flex: 1 1 auto;
    order: 2;
    align-self: flex-end;
    margin-top: 0;
  }

  .site-nav__list {
    margin: 0;
  }

  .site-nav__link {
    padding: 0.85rem 0.7rem 0.75rem;
  }

  .status {
    order: 3;
  }
}

.banner-slot {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1rem;
}

.banner-slot:not(:empty) {
  padding-top: 1rem;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  min-width: 0;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* The main region takes the focus after a navigation; it is not a control. */
.site-main:focus {
  outline: none;
  box-shadow: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.875rem;
}

.site-footer p {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1rem;
}

.noscript,
.page-problem {
  max-width: 40rem;
}

.noscript {
  margin: 2rem auto;
  padding: 1rem;
  border: 1px solid var(--bad);
  border-radius: var(--radius-small);
  background: var(--bad-soft);
}

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

@media (hover: hover) {
  .btn:hover {
    background: var(--sunken);
  }
}

.btn--small {
  min-height: 2rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.875rem;
}

.btn--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
}

@media (hover: hover) {
  .btn--primary:hover {
    border-color: var(--brand-strong);
    background: var(--brand-strong);
  }
}

.btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (hover: hover) {
  .btn--quiet:hover {
    background: var(--brand-soft);
  }
}

.btn--danger {
  border-color: var(--bad);
  background: var(--bad);
  color: var(--bad-ink);
}

@media (hover: hover) {
  .btn--danger:hover {
    background: var(--bad);
    filter: brightness(0.92);
  }
}

.btn:disabled,
.btn[aria-disabled="true"],
.chip[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.field__label {
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
}

.select,
.textarea {
  max-width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.textarea {
  display: block;
  width: 100%;
  line-height: 1.45;
  resize: vertical;
}

.textarea:disabled {
  background: var(--sunken);
  color: var(--ink-2);
}

.textarea::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.segmented {
  display: inline-flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.segmented__choice {
  position: relative;
  display: inline-flex;
}

.segmented__choice + .segmented__choice {
  border-left: 1px solid var(--line-strong);
}

.segmented__choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__choice span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.segmented__choice:first-of-type span {
  border-radius: 5px 0 0 5px;
}

.segmented__choice:last-of-type span {
  border-radius: 0 5px 5px 0;
}

.segmented__choice input:checked + span {
  background: var(--brand);
  color: var(--brand-ink);
}

.segmented__choice input:focus-visible + span {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--spark);
}

.segmented [lang="ur"] {
  font-family: var(--font-urdu);
  line-height: 1.9;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
}

.toolbar:empty {
  display: none;
}

.tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.tag--neutral {
  border-color: var(--line);
  background: var(--sunken);
  color: var(--ink-2);
}

.tag--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag--bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.tag--brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.tag--spark {
  background: var(--spark);
  color: var(--spark-ink);
}

.popover__count {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.75rem;
}

.popover__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  width: min(23rem, calc(100vw - 2rem));
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.popover__panel h2 {
  font-size: 1.05rem;
}

.popover__panel h3 {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.popover__panel p:last-child {
  margin-bottom: 0;
}

.model-list,
.role-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.model-list__item {
  display: grid;
  gap: 0.1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}

.model-list__name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.model-list__usage,
.model-list__state {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.role-list__row {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line);
}

.role-list dt {
  color: var(--ink-2);
}

.role-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- messages */

.notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: var(--radius-small);
  background: var(--surface);
}

.notice > .icon {
  margin-top: 0.25rem;
}

.notice--info {
  border-color: var(--brand);
}

.notice--warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.notice--bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.notice--ok {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.notice__title {
  margin: 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.notice__body p {
  margin: 0.25rem 0 0;
}

.notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  color: var(--ink-2);
}

.spinner {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- tables */

.table-scroll {
  /* The scroller is the containing block of visually hidden text in a cell, so that text cannot widen the page. */
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.table-scroll + .table-scroll {
  margin-top: 1rem;
}

.table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  font-size: 0.9375rem;
}

.table caption {
  padding: 0.6rem 0.75rem 0.5rem;
  caption-side: top;
  font-weight: 700;
  text-align: left;
}

.table th,
.table td {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
  vertical-align: bottom;
}

.table tbody th,
.table tfoot th {
  font-weight: 500;
}

/* The row's name stays in view while a wide table scrolls sideways. */
.table tbody th,
.table tfoot th,
.table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.table tbody th,
.table tfoot th {
  background: var(--surface);
}

.table .is-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.table .is-action {
  width: 1%;
  padding-block: 0.3rem;
  text-align: right;
  white-space: nowrap;
}

/* As in a ledger: one firm rule above a subtotal; the double rule is kept for the bill's totals. */
.table tfoot th,
.table tfoot td {
  border-top: 2px solid var(--ink-3);
  font-weight: 700;
}

.table__empty {
  color: var(--ink-2);
}

.table--lines .tag {
  vertical-align: 0.05em;
}

.line__label {
  margin-right: 0.35rem;
}

.explain td {
  padding: 0.2rem 0.75rem 0.8rem;
  border-top: 0;
}

.explain__text {
  max-width: 68ch;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
}

.explain__text.is-urdu {
  border-right: 3px solid var(--brand);
  border-left: 0;
  font-family: var(--font-urdu);
  font-size: 1.05rem;
  line-height: 2.3;
}

@media (max-width: 30rem) {
  .table th,
  .table td {
    padding-inline: 0.55rem;
  }
}

/* ---------------------------------------------------------------- start screen */

.start {
  display: grid;
  gap: 2.25rem;
}

.start__main,
.start__library {
  min-width: 0;
}

.start__promise {
  margin: 0.25rem 0 1rem;
  font-size: clamp(2.1rem, 1.25rem + 3.6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.start__promise span {
  display: block;
}

.start__upload {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@media (min-width: 62rem) {
  .start {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 3.5rem;
    align-items: start;
  }

  .start__library {
    padding-top: 0.75rem;
  }
}

.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 2.25rem 1.25rem 2rem;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}

.dropzone.is-dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
}

@media (hover: hover) {
  .dropzone:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
  }
}

.dropzone.is-dragging {
  border-style: solid;
}

.dropzone:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--spark);
}

.dropzone__title {
  font-size: 1.2rem;
  font-weight: 700;
}

.dropzone__or,
.dropzone__hint {
  color: var(--ink-2);
}

.dropzone__button {
  margin: 0.7rem 0 0.5rem;
}

.dropzone__hint {
  font-size: 0.875rem;
}

.progress {
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.progress h2 {
  margin-bottom: 0.25rem;
}

.progress__file {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.progress__elapsed {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.progress__elapsed .clock {
  color: var(--ink);
  font-weight: 700;
}

.progress__list {
  margin: 0 0 1rem;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.progress__stage {
  display: grid;
  grid-template-columns: 1rem minmax(0, 11.5rem) minmax(0, 1fr);
  gap: 0.15rem 0.7rem;
  align-items: start;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.progress__stage > .icon,
.progress__stage > .spinner {
  margin-top: 0.25rem;
}

.progress__name {
  font-weight: 650;
}

.progress__detail {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.progress__stage--waiting .progress__name {
  color: var(--ink-2);
  font-weight: 500;
}

.progress__stage--error .progress__detail {
  color: var(--bad);
}

@media (max-width: 30rem) {
  .progress__stage {
    grid-template-columns: 1rem minmax(0, 1fr);
  }

  .progress__detail {
    grid-column: 2;
  }
}

.meter {
  display: block;
  width: 100%;
  height: 0.65rem;
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--sunken);
  appearance: none;
}

.meter::-webkit-progress-bar {
  background: var(--sunken);
}

.meter::-webkit-progress-value {
  background: var(--brand);
}

.meter::-moz-progress-bar {
  background: var(--brand);
}

/* ---------------------------------------------------------------- bill list */

.bill-list,
.file-list {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  list-style: none;
}

.bill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.5rem;
  padding-right: 0.5rem;
  border-top: 1px solid var(--line);
}

.bill-row:first-child {
  border-top: 0;
}

.bill-row__link {
  display: grid;
  flex: 1 1 13rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 1rem;
  min-width: 0;
  padding: 0.7rem 0.4rem 0.7rem 0.9rem;
  border-radius: var(--radius-small);
  color: inherit;
  text-decoration: none;
}

.bill-row__name {
  grid-column: 1;
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (hover: hover) {
  .bill-row__link:hover .bill-row__name {
    text-decoration-thickness: 2px;
  }
}

.bill-row__id {
  grid-row: 2;
  grid-column: 1;
  color: var(--ink-2);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.bill-row__figures {
  display: grid;
  grid-row: 1 / span 2;
  grid-column: 2;
  align-content: center;
  justify-items: end;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.bill-row__figures .amount {
  color: var(--ink);
  font-weight: 700;
}

.bill-row__tags {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 0.35rem;
}

.bill-row__tags:empty {
  display: none;
}

.bill-row__confirm {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-right: -0.5rem;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--line);
  background: var(--bad-soft);
}

.bill-row:last-child .bill-row__confirm {
  border-radius: 0 0 var(--radius) var(--radius);
}

.bill-row__confirm p {
  flex: 1 1 12rem;
  margin: 0;
}

/* ---------------------------------------------------------------- bill header */

.bill-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.bill-bar__title {
  min-width: 0;
}

.bill-bar__title h1 {
  margin: 0;
}

.bill-bar__meta {
  margin: 0.2rem 0 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.bill-bar__meta:empty {
  display: none;
}

.bill-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  min-width: 0;
}

.chooser__list {
  display: grid;
  gap: 0.5rem;
  max-width: 40rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.chooser__link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

@media (hover: hover) {
  .chooser__link:hover {
    border-color: var(--brand);
  }
}

.chooser__name {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.chooser__meta {
  color: var(--ink-2);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- picture viewer */

.result {
  display: grid;
  gap: 1.5rem;
}

.result__picture,
.result__details {
  min-width: 0;
}

.viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  height: min(70vh, 34rem);
}

@media (min-width: 62rem) {
  .result {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 2rem;
    align-items: start;
  }

  .result__picture {
    position: sticky;
    top: 1rem;
  }

  .viewer {
    height: calc(100vh - 2rem);
    min-height: 24rem;
  }
}

.viewer__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.viewer__toolbar .btn {
  min-width: 2rem;
}

.viewer__zoom {
  min-width: 3.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: center;
}

.viewer__hint {
  margin-left: auto;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.viewer__stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--sunken);
  touch-action: pan-x pan-y;
}

.viewer__stage.is-zoomed {
  cursor: grab;
  touch-action: none;
}

.viewer__stage.is-dragging {
  cursor: grabbing;
}

.viewer__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer__missing {
  margin: 0;
  padding: 2rem 1rem;
  color: var(--ink-2);
  text-align: center;
}

/* ---------------------------------------------------------------- bill details */

.details {
  display: grid;
  gap: 2rem;
  min-width: 0;
}

.details__section {
  min-width: 0;
}

.cautions {
  display: grid;
  gap: 0.5rem;
}

/* The payment stub: what to pay and by when, torn off along a perforation. */
.stub {
  border-radius: var(--radius);
  background: var(--stub);
  color: var(--stub-ink);
}

.stub dl {
  margin: 0;
}

.stub dt {
  color: var(--stub-muted);
  font-size: 0.8125rem;
}

.stub dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.stub .not-printed,
.stub__tariff {
  color: var(--stub-muted);
}

.stub__main {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.9rem 2rem;
  padding: 1.25rem 1.4rem 1.2rem;
}

.stub__payable dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.7rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.stub__payable .tag {
  letter-spacing: 0;
}

.stub__payable .not-printed {
  font-size: 1.4rem;
}

.stub__due dd {
  font-size: 1.2rem;
  font-weight: 700;
}

.stub__perforation {
  position: relative;
  margin: 0 1.2rem;
  border-top: 2px dashed var(--stub-line);
}

.stub__perforation::before,
.stub__perforation::after {
  position: absolute;
  top: -0.75rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.stub__perforation::before {
  left: -1.9rem;
}

.stub__perforation::after {
  right: -1.9rem;
}

.stub__cells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.9rem 1.5rem;
  padding: 1.15rem 1.4rem 1.3rem;
}

.stub__cells dd {
  font-size: 1.05rem;
  font-weight: 700;
}

.stub__tariff {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Ruled boxes, as on a printed form. */
.boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(9.5rem, 30%), 1fr));
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.boxes > div {
  margin: 0 -1px -1px 0;
  padding: 0.6rem 0.8rem 0.7rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.boxes dt {
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.boxes dd {
  margin: 0.1rem 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.boxes + .muted {
  margin-top: 0.75rem;
}

.sums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 3px double var(--ink-3);
}

.sums dt {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.sums dd {
  margin: 0;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.reads {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.reads__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.75rem;
}

.reads__role {
  min-width: 8.5rem;
  font-weight: 650;
}

.reads__model {
  overflow-wrap: anywhere;
}

.reads__time {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.reads__error {
  display: inline-flex;
  flex-basis: 100%;
  align-items: center;
  gap: 0.35rem;
  color: var(--bad);
}

.verdict {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.verdict--pass {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.verdict .icon {
  margin-top: 0.25rem;
}

.disputes,
.checks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.disputes {
  display: grid;
  gap: 0.6rem;
}

.dispute {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.dispute__values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0 0 0.5rem;
}

.dispute__values dt {
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.dispute__values dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.dispute__how {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.checks {
  border-top: 1px solid var(--line);
}

.check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.check > .icon {
  margin-top: 0.25rem;
}

.check__label {
  margin: 0;
}

.check--pass strong {
  color: var(--ok);
}

.check--fail strong {
  color: var(--bad);
}

.check__detail {
  margin: 0.1rem 0 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.json {
  max-height: 26rem;
  margin: 0;
  padding: 0.9rem 1rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  /* A soft shade at the bottom edge while there is more to scroll to; the local cover hides it at the end. */
  background:
    linear-gradient(var(--surface), var(--surface)) bottom / 100% 1.25rem no-repeat local,
    linear-gradient(to top, var(--line-strong), transparent) bottom / 100% 1.25rem no-repeat scroll,
    var(--surface);
  font-family: var(--font-code);
  font-size: 0.8125rem;
  line-height: 1.5;
  tab-size: 2;
}

.json code {
  font-family: inherit;
}

.copy-status {
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- charts */

.chart {
  position: relative;
  margin: 0 0 1rem;
}

.chart__frame {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.chart__svg {
  display: block;
}

.chart__grid {
  stroke: var(--line);
}

.chart__zero {
  stroke: var(--ink-3);
}

.chart__tick,
.chart__month,
.chart__year,
.chart__value {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.chart__month.is-highlight,
.chart__value {
  fill: var(--ink);
  font-weight: 700;
}

/* A halo in the surface colour keeps a bar's value readable over the grid lines behind it. */
.chart__value {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-linejoin: round;
  stroke-width: 3px;
  pointer-events: none;
}

.chart__slot {
  outline: none;
  box-shadow: none;
}

.chart__hit {
  fill: var(--ink);
  fill-opacity: 0;
}

@media (hover: hover) {
  .chart__slot:hover .chart__hit {
    fill-opacity: 0.06;
  }
}

.chart__slot:focus-visible .chart__hit {
  fill: var(--spark);
  fill-opacity: 0.2;
  stroke: var(--ink);
  stroke-width: 2;
}

.chart__bar--units,
.chart__bar--billed {
  fill: var(--series-1);
}

.chart__bar--paid {
  fill: var(--brand-soft);
  stroke: var(--series-1);
  stroke-width: 1.5;
}

.chart__bar--units.is-highlight {
  fill: var(--spark);
}

/* The dark outline gives the amber bar an edge that does not depend on its colour. */
.chart__hatch {
  stroke: var(--spark-ink);
  stroke-width: 1.5;
  pointer-events: none;
}

.chart__hatch-line {
  stroke: var(--spark-ink);
  stroke-opacity: 0.5;
  stroke-width: 1.6;
}

.chart__gap {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.5;
}

.chart__reference {
  stroke: var(--ink);
  stroke-dasharray: 6 4;
  stroke-width: 1.5;
  pointer-events: none;
}

.chart__line {
  fill: none;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chart__line--first {
  stroke: var(--series-1);
}

.chart__line--second {
  stroke: var(--series-2);
  stroke-dasharray: 6 4;
}

.chart__marker--first {
  fill: var(--series-1);
}

.chart__marker--second {
  fill: var(--surface);
  stroke: var(--series-2);
  stroke-width: 2;
}

.chart__tip {
  position: absolute;
  z-index: 5;
  display: grid;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

.chart3d__canvas {
  display: block;
  max-width: 100%;
  cursor: grab;
  touch-action: pan-y;
}

.chart3d__canvas.is-dragging {
  cursor: grabbing;
}

.chart3d__reset {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 2;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

@media (hover: hover) {
  .chart3d__reset:hover {
    background: var(--sunken);
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  margin: 0 0 0.6rem;
  padding: 0;
  color: var(--ink-2);
  font-size: 0.875rem;
  list-style: none;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend__swatch {
  flex: none;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
}

.legend__swatch--units,
.legend__swatch--billed {
  background: var(--series-1);
}

.legend__swatch--summer {
  background: var(--spark);
}

.legend__swatch--winter {
  background: var(--winter);
}

.legend__swatch--other {
  background: var(--brand);
}

/* In the 3D view the paid bars are solid in the second series colour. */
.legend--3d .legend__swatch--paid {
  border-color: var(--series-2);
  background: var(--series-2);
}

.legend__swatch--paid {
  border: 1.5px solid var(--series-1);
  background: var(--brand-soft);
}

.legend__swatch--highlight {
  border: 1.5px solid var(--spark-ink);
  background: repeating-linear-gradient(45deg, var(--spark) 0 3px, #b9801a 3px 4.5px);
}

/* In the 3D view the bill's month is an outlined bar in its season colour, not the hatched 2D bar. */
.legend--3d .legend__swatch--highlight {
  border: 2px solid var(--ink);
  background: transparent;
}

.legend__swatch--reference {
  width: 1.4rem;
  height: 0;
  border-top: 2px dashed var(--ink);
  border-radius: 0;
}

.legend__swatch--gap {
  width: 0.55rem;
  height: 0.55rem;
  border: 1.5px solid var(--ink-3);
  border-radius: 50%;
}

.legend__swatch--first {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--series-1);
}

.legend__swatch--second {
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--series-2);
  border-radius: 0;
  background: var(--surface);
}

/* ---------------------------------------------------------------- insights */

.insights__history,
.insights__figures,
.insights__missing,
.compare__section {
  margin-bottom: 2.25rem;
}

.insights__history > p {
  max-width: 75ch;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.insights__history > .table-scroll,
.compare__history > .table-scroll {
  max-width: 44rem;
}

.insights__missing ul {
  max-width: 75ch;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-2);
}

.insights__missing li {
  margin-bottom: 0.25rem;
}

/* The figures sit in one ruled sheet instead of separate cards; a short last row stretches to fill it. */
.figures {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.figure {
  flex: 1 1 19rem;
  min-width: 0;
  margin: 0 -1px -1px 0;
  padding: 1rem 1.1rem 1.1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.figure > * {
  max-width: 44rem;
}

.figure h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin: 0 0 0.35rem;
  color: var(--ink-2);
  font-size: 0.95rem;
  font-weight: 650;
}

.figure__value {
  margin: 0 0 0.6rem;
  line-height: 1.25;
}

.figure__number {
  font-size: 1.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: -0.015em;
}

/* The words after a headline number wrap as one piece instead of leaving a word behind. */
.figure__unit {
  display: inline-block;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.figure__body {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.figure__body p {
  margin: 0 0 0.4rem;
}

.figure__method {
  margin: 0.5rem 0 0;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.figure__list {
  margin: 0 0 0.4rem;
  padding-left: 1.1rem;
}

.figure__pairs {
  display: grid;
  gap: 0.15rem;
  margin: 0.25rem 0 0.5rem;
}

.figure__pairs > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 1rem;
}

.figure__pairs dt {
  color: var(--ink-2);
}

.figure__pairs dd {
  margin: 0;
  font-weight: 650;
}

.figure__levels {
  margin: 0.4rem 0 0.5rem;
  padding: 0;
  list-style: none;
}

.figure__levels li {
  padding: 0.4rem 0 0.1rem;
  border-top: 1px solid var(--line);
}

/* A date inside a printed label (wrapped in this class by the view) never breaks at its hyphens. */
.figure__date {
  white-space: nowrap;
}

.figure__levels .figure__pairs {
  margin: 0.1rem 0 0.3rem;
}

.pay-strip,
.pay-strip__key {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.pay-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.1rem, 1fr));
  gap: 2px;
  margin-top: 0.25rem;
}

.pay-strip__cell {
  display: grid;
  justify-items: center;
  padding: 0.2rem 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--sunken);
}

.pay-strip__cell[data-status="paid in full"],
.pay-strip__cell[data-status="paid more than billed"] {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.pay-strip__cell[data-status="part paid"] {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.pay-strip__cell[data-status="no payment shown"] {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.pay-strip__mark {
  font-weight: 750;
  line-height: 1.25;
}

.pay-strip__month {
  color: var(--ink-2);
  font-size: 0.75rem;
}

.pay-strip__key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

/* ---------------------------------------------------------------- ask */

.ask {
  display: grid;
  gap: 1.5rem;
}

.ask > *,
.ask__answers > * {
  min-width: 0;
  scroll-margin-block: 1rem;
}

/* On one column the newest answer sits straight under the question box, and older answers go below the suggestions. */
@media (max-width: 61.99rem) {
  .ask__answers {
    display: contents;
  }

  .ask__suggested {
    order: 1;
  }

  .ask__earlier {
    order: 2;
  }
}

@media (min-width: 62rem) {
  .ask {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    column-gap: 2.5rem;
    align-items: start;
  }

  .ask__compose,
  .ask__suggested {
    grid-column: 1;
  }

  .ask__answers {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .ask__latest + .ask__earlier {
    margin-top: 1.75rem;
  }
}

.ask__form {
  display: grid;
  gap: 0.35rem;
}

.ask__form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.ask__form-foot .muted {
  flex: 1 1 12rem;
}

.ask__counter {
  color: var(--ink-2);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.ask__counter.is-limit {
  color: var(--bad);
  font-weight: 700;
}

.ask__problem:not(:empty) {
  margin-top: 1rem;
}

.ask__suggested h2,
.ask__answers h2 {
  font-size: 1.1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

@media (hover: hover) {
  .chip:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
  }
}

.answers {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.ask__latest .answer {
  border-color: var(--brand);
  border-left-width: 4px;
}

.answer__question {
  margin: 0;
  padding: 0.9rem 1.1rem 0.3rem;
  font-size: 1rem;
}

.answer__text {
  max-width: 72ch;
  margin: 0;
  padding: 0 1.1rem 0.8rem;
  overflow-wrap: anywhere;
}

.answer__check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.5rem;
  margin: 0;
  padding: 0.55rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.answer__check--ok strong {
  color: var(--ok);
}

.answer__check--caution {
  border-top-color: var(--warn);
  background: var(--warn-soft);
}

.answer__check--caution strong {
  color: var(--warn);
}

.answer__source {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- compare */

.compare__pickers {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
  margin: 1rem 0 1.75rem;
}

.compare__pickers .field {
  flex: 1 1 16rem;
}

.compare__pickers .select,
.bill-bar .select {
  width: 100%;
}

.compare__body {
  min-width: 0;
}

.compare__body > .notice + .notice {
  margin-top: 0.75rem;
}

.compare__note {
  display: block;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: normal;
}

.compare__section .table-scroll {
  margin-bottom: 0.6rem;
}

/* Bill names are long: they wrap, so that the values of both bills fit beside each other on a phone. */
.compare__section .table thead th {
  min-width: 6.5rem;
  white-space: normal;
}

.delta {
  font-variant-numeric: tabular-nums;
}

/* A row where the two bills differ carries an amber bar as well as the word or the signed figure. */
.compare__section tr:has(.delta) th,
.compare__section tr:has(.tag--spark) th {
  box-shadow: inset 4px 0 0 var(--spark);
}

/* ---------------------------------------------------------------- generate CSVs */

.batch__body,
.batch__progress,
.batch__result {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.batch__body,
.batch__progress:not(:empty) {
  margin-bottom: 1.5rem;
}

.batch__body {
  margin-top: 1.25rem;
}

.batch__facts {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.batch__facts dt {
  color: var(--ink-2);
  font-size: 0.875rem;
}

.batch__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.batch__controls {
  display: grid;
  gap: 1rem;
  justify-items: start;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.6rem;
  align-items: start;
}

.option input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  accent-color: var(--brand);
}

.option label {
  font-weight: 650;
}

.option p {
  grid-column: 2;
  max-width: 62ch;
  margin: 0;
}

.batch__report .boxes {
  margin-top: 1rem;
}

.batch__list {
  max-width: 80ch;
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.batch__list li {
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}

.file-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--line);
}

.file-list__item:first-child {
  border-top: 0;
}

.file-list__name {
  font-weight: 700;
}

.file-list__meta {
  flex: 1 1 10rem;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
