/* Mobile first. The page must never scroll horizontally on a phone — that is
   a correctness bug here, not a polish item, so everything below is fluid and
   nothing carries a fixed width. */

:root {
  --ink: #1c1a17;
  --muted: #6b645c;
  --line: #e2ddd6;
  --bg: #fbf9f6;
  --accent: #7a4b2a;
  --error: #a12b1e;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7e1;
    --muted: #a49b91;
    --line: #37322c;
    --bg: #17150f;
    --accent: #d9a273;
    --error: #ef8b7d;
  }
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; }

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  /* index.html sets `viewport-fit=cover`, which deliberately extends the page
     under the notch and the home indicator — so every top-level container has
     to pad itself back out, or the first line of text sits beneath the clock.
     On anything without insets these resolve to 0 and nothing changes. */
  padding:
    calc(1.5rem + env(safe-area-inset-top)) calc(1.25rem + env(safe-area-inset-right))
    calc(4rem + env(safe-area-inset-bottom)) calc(1.25rem + env(safe-area-inset-left));
}

h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; }

.lede { color: var(--muted); margin: 0 0 1.5rem; }
.note { color: var(--muted); font-size: .9rem; }
.error { color: var(--error); font-size: .9rem; }

.env {
  margin: 0;
  padding: .4rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-size: .8rem;
  text-align: center;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

form p { margin: 0 0 1rem; }

label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .25rem;
}

input {
  width: 100%;
  padding: .7rem .75rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: .5rem;
}

input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  /* 44px minimum touch target — these are used one-handed, often standing. */
  min-height: 44px;
  width: 100%;
  padding: .7rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: .5rem;
  cursor: pointer;
}

button[data-busy="true"] { opacity: .6; cursor: progress; }

button.link {
  width: auto;
  min-height: 44px;
  margin-top: .5rem;
  padding: .5rem 0;
  color: var(--accent);
  background: none;
  font-weight: 400;
  text-decoration: underline;
}

/* Phase 1 --------------------------------------------------------------- */

.list { list-style: none; margin: 0 0 1.5rem; padding: 0; }

.list li {
  display: flex;
  flex-wrap: wrap;            /* wraps rather than pushing the page sideways */
  align-items: center;
  gap: .5rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}

.list li .grow { flex: 1 1 8rem; min-width: 0; }

.empty { color: var(--muted); font-size: .9rem; padding: .7rem 0; }

.inline { margin-bottom: 2rem; }

.card {
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }

/* A join code is shown once, when it is minted — it is never readable again,
   because rules cannot hide a single field. Rotating mints a new one. */
.code {
  font: 600 1.3rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.pill {
  font-size: .75rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-actions button { width: auto; padding: .4rem .8rem; min-height: 36px; font-size: .85rem; }

select {
  width: 100%;
  padding: .7rem .75rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: .5rem;
}

/* Phase 2 --------------------------------------------------------------- */

h1.section { margin-top: 2.5rem; }

textarea {
  width: 100%;
  padding: .7rem .75rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: .5rem;
  resize: vertical;
}

.pair { display: flex; gap: .5rem; }
.pair input { flex: 1 1 0; min-width: 0; }

video {
  width: 100%;
  border-radius: .6rem;
  background: #000;
}

/* Prose in v1. The element per segment arrives with the time-synced version;
   see DESIGN "Scrolling description". */
.desc { white-space: pre-wrap; margin-top: 1rem; }

.file-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.file-row input[type="file"] { flex: 1 1 10rem; min-width: 0; font-size: .85rem; }

progress { width: 100%; height: .4rem; }

/* Phase 3 --------------------------------------------------------------- */

/* A reframe prompt is not a moderation incident — it is a parent who
   photographed their kid holding the drawing. It must not look like an error. */
.reframe {
  border: 1px solid var(--accent);
  border-radius: .6rem;
  padding: .8rem;
  margin: .75rem 0;
}
.reframe p { margin: 0 0 .6rem; font-size: .9rem; }

.quarantined { border-color: var(--error); }
.due { font-size: .85rem; color: var(--muted); }

/* Phase 4 --------------------------------------------------------------- */

h4.sub {
  margin: 1.2rem 0 .4rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.review {
  border-top: 1px solid var(--line);
  padding-top: .8rem;
  margin-top: .8rem;
}
.review img {
  display: block;
  width: 100%;
  border-radius: .5rem;
  margin: .5rem 0;
  background: var(--line);
}
.review textarea, .review select { margin-bottom: .5rem; }

.feedback {
  margin-top: .6rem;
  padding: .6rem .7rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 0 .4rem .4rem 0;
  font-size: .9rem;
}

/* Two labelled pickers rather than one input: the label states what will
   happen before the parent commits to a file. */
label.file-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .5rem 0;
  cursor: pointer;
}
label.file-row .note { flex: 0 0 auto; font-weight: 600; color: var(--ink); }
label.file-row input[type="file"] { flex: 1 1 8rem; min-width: 0; font-size: .8rem; }


/* App shell -------------------------------------------------------------

   The signed-in app is a shell rather than a document. Header and nav are
   fixed; only #content scrolls. Previously every section stacked into one
   column that grew longer every term, so finding anything meant scrolling
   past everything.                                                       */

/* `display: grid` beats the UA sheet's `[hidden] { display: none }`, exactly as
   `display: flex` did for `.assign` below — so the signed-in shell stayed on
   screen for signed-out visitors, with an empty nav and an empty content
   column. On desktop the sign-in form renders above it and hides the problem;
   on a phone the stray shell IS the first screen, which is how iOS found it. */
.shell[hidden] { display: none; }

.shell {
  display: grid;
  grid-template-columns: 15rem 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top" "nav content";
  height: 100dvh;
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: .75rem;
  /* Same reason as .wrap: the bar is the topmost thing on the signed-in
     screen, so it owns the status-bar inset. */
  padding:
    calc(.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right))
    .6rem calc(1rem + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar .brand { font-weight: 600; flex: none; }
.topbar .grow { flex: 1; min-width: 0; }

/* A long email address used to push the whole page sideways on a phone.
   Flex items refuse to shrink below their content by default, so the topbar
   grew past the viewport and took the document's width with it — and because
   every full-width element below then reported as overflowing, the symptom
   looked like a layout problem everywhere rather than one string here.
   `min-width: 0` is what actually permits the shrink; the ellipsis is what
   makes the result readable. */
.topbar .who {
  color: var(--muted);
  font-size: .85rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* On the narrowest phones the address is the first thing to go: the sign-out
   button and the section toggle both have to stay reachable. */
@media (max-width: 26rem) {
  .topbar .who { display: none; }
}

button.icon {
  width: auto;
  min-height: 40px;
  padding: .3rem .6rem;
  font-size: 1.15rem;
  background: none;
  color: var(--ink);
  display: none;            /* desktop keeps the nav open, so no toggle */
}

#sidenav {
  grid-area: nav;
  border-right: 1px solid var(--line);
  padding: 1rem .75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#sections { display: flex; flex-direction: column; gap: .15rem; }

#sections button {
  width: 100%;
  min-height: 44px;
  padding: .6rem .75rem;
  text-align: left;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
#sections button:hover { background: var(--paper-sunk, rgba(127,127,127,.12)); }
#sections button[aria-current="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 600;
}
#sections .count {
  margin-left: auto;
  min-width: 1.4rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: .75rem;
  font-weight: 600;
  text-align: center;
}

#content {
  grid-area: content;
  overflow-y: auto;
  /* The scrolling column owns the bottom inset: without it the last card sits
     under the home indicator and the final button is hard to hit. The top is
     already covered by .topbar above it. */
  padding:
    1.5rem calc(1.25rem + env(safe-area-inset-right))
    calc(4rem + env(safe-area-inset-bottom)) calc(1.25rem + env(safe-area-inset-left));
}
#content > section { max-width: 42rem; }
#content h1 { margin-top: 0; }

#nav-scrim { display: none; }

/* Phone: the nav slides over the content instead of taking a column. */
@media (max-width: 46rem) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "content"; }
  button.icon { display: block; }

  #sidenav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(16rem, 82vw);
    background: var(--bg);
    transform: translateX(-102%);
    transition: transform .18s ease;
  }
  #sidenav[data-open="true"] { transform: translateX(0); }

  #nav-scrim[data-open="true"] {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, .45);
  }
}

@media (prefers-reduced-motion: reduce) {
  #sidenav { transition: none; }
}

.nav-group {
  margin: .9rem 0 .2rem;
  padding: 0 .75rem;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-group:first-child { margin-top: 0; }

/* Ad-hoc assignment panel (decision 31) ---------------------------------- */

/* `display: flex` on a class beats the UA sheet's `[hidden] { display: none }`,
   so without this the panel is permanently open and the Assign… button appears
   to do nothing. Any rule that sets display on an element toggled by `hidden`
   needs its own hidden case. */
.assign[hidden] { display: none; }

.assign {
  border-top: 1px solid var(--line);
  margin-top: .8rem;
  padding-top: .8rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  align-items: stretch;
}

/* A roster can be long, so it scrolls inside the card rather than pushing the
   Assign button off the bottom of a phone screen. */
.who-list {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  max-height: 11rem;
  overflow-y: auto;
}

label.check {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem 0;
  cursor: pointer;
}
/* A tick box small enough to miss with a thumb is a bug on the surface where
   half the studio works. */
label.check input { width: 1.1rem; height: 1.1rem; flex: none; }

/* Several videos per lesson (MVP R08) --------------------------------- */

.video-list { list-style: none; margin: .6rem 0; padding: 0; counter-reset: part; }
.video-list li {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem 0; border-top: 1px solid var(--line);
}
.video-list li:last-child { border-bottom: 1px solid var(--line); }
/* The running order is the point of the list, so it is numbered rather than
   left for the reader to infer from position. */
.video-list li::before {
  counter-increment: part; content: counter(part) ".";
  color: var(--muted); font-size: .85rem; flex: none;
}
.video-list input[type="text"] { flex: 1 1 8rem; min-width: 0; }
.video-list .note { flex: none; font-size: .8rem; }

/* The parts list under the player, for a family choosing where to resume. */
.parts { list-style: none; margin: .75rem 0 0; padding: 0; counter-reset: part; }
.parts li { border-top: 1px solid var(--line); }
.parts li:last-child { border-bottom: 1px solid var(--line); }
.parts li::before {
  counter-increment: part; content: counter(part) ".";
  color: var(--muted); font-size: .85rem; margin-right: .4rem;
}
.parts button { padding: .6rem 0; }
/* The part being watched is marked by weight and a rule, not by colour alone. */
.parts li.playing { border-left: 3px solid var(--accent); padding-left: .5rem; }
.parts li.playing button { font-weight: 600; }

/* Worksheets and reference images (MVP R09) ---------------------------- */

#lesson-worksheets { margin-top: 1.5rem; }
#lesson-worksheets h3 { font-size: 1rem; margin: 0 0 .6rem; }

/* Sized so a phone gets one legible sheet per row and a laptop gets two or
   three, without a breakpoint. */
.sheets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: .9rem;
}
.sheets figure { margin: 0; }
.sheets img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .4rem;
  /* A worksheet is nearly always paper: reserving the shape stops the page
     jumping as each minted URL resolves. */
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
  background: var(--line);
}
.sheets figcaption {
  margin-top: .35rem;
  font-size: .85rem;
  color: var(--muted);
}

/* Account page and learner editing ------------------------------------- */

.list input[type="text"] { flex: 1 1 8rem; min-width: 0; }
.list input.year { flex: 0 0 6.5rem; }

#quiet-form select { flex: 0 0 auto; }

/* Confirmations sit under the form that caused them, not in the page-level
   error slot — "Saved." next to the wrong control is worse than silence. */
#name-said, #email-said, #password-said, #quiet-said {
  margin-top: .5rem;
  color: var(--accent);
}

[data-panel="account"] .card form { margin-top: .6rem; }
[data-panel="account"] .card label { display: block; margin-top: .5rem; }
[data-panel="account"] .card form.inline label { display: inline; }

/* Retiring things ------------------------------------------------------- */

/* Archived is a state, not a warning: dimmed and out of the way, but plainly
   still there and still readable. */
.card.archived { opacity: .72; }
.card.archived h3 { text-decoration: none; }

/* The irreversible actions borrow the existing --error red rather than adding
   a second one, so red means exactly one thing wherever it appears — and it
   follows the palette into dark mode for free. */
.link.danger { color: var(--error); }
.link.danger:hover { text-decoration: underline; }

/* Topics inside a course (MVP R03–R05) ---------------------------------- */

/* A topic is a heading in a list, so it reads as a level up rather than as
   another row of the same kind. */
li.topic {
  margin-top: .9rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
  align-items: center;
}
li.topic:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
li.topic input[type="text"] { font-weight: 600; }

/* Steps sit under their topic, indented just enough to read as belonging to
   it without pushing content off a narrow phone. */
li.step { padding-left: .9rem; }

/* An inactive student is paused, not gone — dimmed, still legible, still
   editable. Same treatment as an archived card, for the same reason. */
.list li.inactive { opacity: .6; }

/* Help ------------------------------------------------------------------ */

#help-search { width: 100%; margin-bottom: 1rem; }

details.faq {
  border-top: 1px solid var(--line);
  padding: .1rem 0;
}
details.faq:last-of-type { border-bottom: 1px solid var(--line); }

details.faq summary {
  cursor: pointer;
  padding: .75rem .5rem .75rem 0;
  font-weight: 600;
  /* A question that wraps must not sit under its own marker. */
  display: list-item;
  list-style-position: outside;
  margin-left: 1.1rem;
}
details.faq summary::marker { color: var(--muted); }
details.faq[open] summary { color: var(--accent); }
details.faq p {
  margin: 0 0 .7rem 1.1rem;
  color: var(--ink);
  max-width: 38rem;
}
details.faq p:last-child { padding-bottom: .6rem; }

/* Section headings are built from the vocabulary file, whose nouns are
   lowercase because they appear mid-sentence everywhere else ("a new
   assignment"). Capitalising the heading here means the vocabulary does not
   have to carry two spellings of every word. */
h1::first-letter { text-transform: uppercase; }

h2.sub { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
         color: var(--muted); margin: 1.8rem 0 .2rem; }

/* --- fees ----------------------------------------------------------------
   Money wants to be scannable: the amount reads as the second thing after the
   name, and the status carries colour so an overdue row is findable without
   reading any of them. */

.summary {
  margin: 0 0 1rem;
  color: var(--muted);
}
.summary strong {
  color: var(--ink);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.invoice-head {
  display: flex;
  align-items: baseline;
  gap: .75rem;
}
.invoice-head h3 { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.invoice .amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Status carries meaning, so it carries colour — but only three ways, because
   a palette with a shade for every state stops being readable at a glance. */
.pill[data-status="due"]           { border-color: var(--accent); color: var(--accent); }
.pill[data-status="partiallyPaid"] { border-color: var(--accent); color: var(--accent); }
.pill[data-status="paid"]          { border-color: #3f7d52; color: #3f7d52; }
.pill[data-status="waived"],
.pill[data-status="void"]          { opacity: .7; }
/* The one row anybody is looking for. Filled rather than outlined, because at
   a glance on a phone an outline in a list of outlines is not a signal. */
.pill[data-status="overdue"] {
  border-color: var(--error);
  background: var(--error);
  color: var(--bg);
  font-weight: 600;
}

/* Sweeps, not primary actions: a teacher's job on this screen is to record
   what arrived, and these two were shouting louder than the button that does
   it. */
#billing-remind, #billing-issue {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
}

.invoice details { margin-top: .75rem; }
.invoice details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .9rem;
}
.invoice details .list { margin: .5rem 0 0; }
.invoice details .list li { font-size: .9rem; }

/* Both of these are rows of controls that must wrap rather than push the page
   sideways — the no-horizontal-scroll rule is a correctness bug here. */
.pay-form, .fee-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin: .75rem 0 0;
}
.pay-form input, .fee-form input { flex: 1 1 7rem; min-width: 0; width: auto; }
.pay-form select { flex: 0 1 10rem; width: auto; }
.pay-form button, .fee-form button { width: auto; flex: 0 0 auto; }
.fee-form .note { flex: 0 1 auto; }

#billing-remind, #billing-issue { width: auto; }

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

/* --- how to pay, and claims ---------------------------------------------- */

.pay-how {
  margin-top: .9rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.pay-how > .note:first-child {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .72rem;
  margin: 0 0 .4rem;
}
.pay-options { margin-bottom: .5rem; }
.pay-options li { gap: .5rem; }
/* A handle is copied by eye and by thumb, so it gets the monospace treatment
   the join code does — an l and a 1 must not look the same. */
.pay-options .handle {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.pay-link {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: .4rem;
  padding: .3rem .6rem;
  font-size: .85rem;
}
.pay-link:hover, .pay-link:focus-visible { text-decoration: underline; }

.claim { margin-top: .75rem; }
.claim-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin: 0;
}
.claim-form input { flex: 1 1 7rem; min-width: 0; width: auto; }
.claim-form select { flex: 0 1 9rem; width: auto; }
.claim-form button { width: auto; flex: 0 0 auto; }

/* The teacher's copy of a claim. Tinted rather than bordered, because it is
   one thing to act on inside a card, not a card of its own. */
.claim-pending {
  margin: .9rem 0 0;
  padding: .7rem .8rem;
  border-radius: .45rem;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-left: 3px solid var(--accent);
}
.claim-pending p { margin: 0 0 .5rem; font-size: .92rem; }
.claim-pending .row-actions { margin: 0; }

/* --- the owner's ledger --------------------------------------------------
   A reading surface, not a working one: the figures lead, the chart gives them
   shape, and nothing here is a control except the period. */

.ledger {
  margin: 1.5rem 0 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.ledger .row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.ledger h2 { flex: 1 1 auto; margin: 0 0 .75rem; }
.ledger select { width: auto; flex: 0 1 12rem; }
.ledger h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }

.ledger-now {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 1.25rem;
}
.figure {
  flex: 1 1 9rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.figure strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.aged li { gap: .5rem; }
/* The only row that is a problem rather than a number. */
.aged li.stale strong { color: var(--error); }

.ledger-months {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  /* Twelve or twenty-four months will not fit a phone, and squeezing them to
     hairlines helps nobody — it scrolls in its own box so the page does not. */
  overflow-x: auto;
  padding-bottom: .25rem;
  margin-bottom: .5rem;
}
.ledger-month {
  flex: 1 0 3.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}
.ledger-month .bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 5.5rem;
  width: 100%;
  justify-content: center;
}
.bar {
  width: 40%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
}
.bar.billed    { background: var(--line); }
.bar.collected { background: var(--accent); }
.ledger-month .amount {
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
}

.swatch {
  display: inline-block;
  width: .6rem; height: .6rem;
  border-radius: 2px;
  vertical-align: baseline;
}
.swatch.billed    { background: var(--line); }
.swatch.collected { background: var(--accent); }

/* A discount is stated, never silently netted off the total. */
.note.discount { color: var(--accent); }
