/*
 * Cockpit emailing BEFR — "Registre des envois".
 * A dispatch register on ruled ledger paper: entries in a numbered margin, approvals as violet visa stamps,
 * blocks and the kill switch in rubric red. Tokens and components are documented in DESIGN.md.
 */

@font-face {
  font-family: "Public Sans";
  src: url("/fonts/public-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Public Sans";
  src: url("/fonts/public-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Ledger ramp: the only neutrals. Paper green to blue-black ink, one hue drift, seven steps. */
  --paper: oklch(98.6% 0.007 165);
  --band: oklch(96.4% 0.013 165);
  --rule: oklch(90% 0.02 170);
  --rule-strong: oklch(80% 0.028 180);
  --ink-faint: oklch(50% 0.03 215);
  --ink-soft: oklch(38% 0.035 240);
  --ink: oklch(24% 0.035 258);

  /* Inks with a job. Violet: visas and primary actions only. Rubric: blocks, pause, danger. */
  --visa: oklch(44% 0.17 300);
  --visa-deep: oklch(36% 0.16 300);
  --visa-wash: oklch(95.5% 0.025 300);
  --rubric: oklch(49% 0.18 27);
  --rubric-deep: oklch(41% 0.16 27);
  --rubric-wash: oklch(96% 0.022 27);
  --margin-rule: oklch(72% 0.11 25);
  --ochre: oklch(47% 0.1 70);
  --ochre-wash: oklch(96.5% 0.03 85);
  --ledger: oklch(42% 0.09 160);
  --ledger-wash: oklch(95.5% 0.03 160);
  --proof: oklch(100% 0 0);

  --font: "Public Sans", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Fixed scale, ratio ~1.2. */
  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-md: 0.9375rem;
  --t-base: 1rem;
  --t-lg: 1.25rem;
  --t-xl: 1.75rem;
  --t-2xl: 2.25rem;
  --t-3xl: 3rem;

  /* Spacing on a 4px rhythm. */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;

  --margin: 4.5rem;
  --page: 78rem;
  --radius: 2px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  accent-color: var(--visa);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-base) / 1.5 var(--font);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--visa-wash);
  color: var(--visa-deep);
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-color: currentColor;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
h1 {
  font-size: var(--t-xl);
}
h2 {
  font-size: var(--t-lg);
}
h3 {
  font-size: var(--t-base);
  font-weight: 650;
}
p {
  margin: 0;
}

code,
pre,
.mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

svg.i {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ---------- Masthead and index tabs ---------- */

.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--rule-strong);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s3) var(--s5) 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s2) var(--s5);
}
.title {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.title strong {
  font-size: var(--t-md);
  font-weight: 800;
  letter-spacing: -0.005em;
}
.title span {
  color: var(--ink-faint);
  font-size: var(--t-sm);
}
.who {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--t-sm);
  color: var(--ink-soft);
}
.who form {
  margin: 0;
}

.tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--s1);
  margin: 0 calc(var(--s2) * -1);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s2) var(--s3);
  color: var(--ink-soft);
  font-size: var(--t-md);
  font-weight: 550;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 700;
}
.tabs .count {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--visa);
  background: var(--visa-wash);
  padding: 0 var(--s2);
  border-radius: 999px;
  line-height: 1.6;
}

/* ---------- Register page: margin column with the red rule ---------- */

.register {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s6) var(--s5) var(--s8);
  position: relative;
  min-height: calc(100vh - 5.75rem);
}
/* The register's red margin rule runs the full page height, entries hang off it. */
.register::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--s5) + var(--margin) + var(--s5) / 2);
  border-left: 1px solid var(--margin-rule);
}
.folio {
  display: grid;
  grid-template-columns: var(--margin) minmax(0, 1fr);
  column-gap: var(--s5);
  position: relative;
}
.folio > .gutter {
  grid-column: 1;
  padding-top: 0.2rem;
  text-align: right;
  font-size: var(--t-sm);
  color: var(--ink-faint);
  font-weight: 600;
}
.folio > .body {
  grid-column: 2;
  min-width: 0;
}
.folio + .folio {
  margin-top: var(--s7);
}

.folio-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--ink);
  margin-bottom: var(--s1);
}
.folio-head .aside {
  font-size: var(--t-sm);
  color: var(--ink-soft);
}

.lede {
  color: var(--ink-soft);
  max-width: 70ch;
  margin-top: var(--s2);
}
.note {
  font-size: var(--t-sm);
  color: var(--ink-faint);
  max-width: 75ch;
}
.faint {
  color: var(--ink-faint);
}
.soft {
  color: var(--ink-soft);
}
.small {
  font-size: var(--t-sm);
}
.nowrap {
  white-space: nowrap;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--t-sm);
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: var(--s3);
}
.back:hover {
  color: var(--ink);
}

/* ---------- Status statement (Aujourd'hui) ---------- */

.statement {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 1fr);
  gap: var(--s5) var(--s7);
  align-items: start;
}
.state-line {
  font-size: var(--t-3xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.state-line.paused {
  color: var(--rubric);
}
.state-line.live {
  color: var(--ledger);
}
.signature {
  margin-top: var(--s3);
  font-size: var(--t-md);
  color: var(--ink-soft);
}
.signature b {
  color: var(--ink);
  font-weight: 650;
}
.consequence {
  margin-top: var(--s2);
  font-size: var(--t-sm);
  color: var(--ink-faint);
  max-width: 60ch;
}

.switch {
  border: 1px solid var(--rule-strong);
  background: var(--band);
  padding: var(--s4);
  display: grid;
  gap: var(--s3);
}
.switch h2 {
  font-size: var(--t-md);
}

.departure {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
}
.departure .when {
  font-size: var(--t-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.departure .what {
  margin-top: var(--s2);
  font-size: var(--t-lg);
  color: var(--ink-soft);
}
.departure .what b {
  color: var(--ink);
}
.departure .go {
  margin-top: var(--s4);
}

/* ---------- Ledger rows ---------- */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ledger > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s2) var(--s5);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--s3) var(--s3) var(--s3) 0;
  border-bottom: 1px solid var(--rule);
}
th {
  font-size: var(--t-xs);
  font-weight: 650;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  padding-top: var(--s2);
  padding-bottom: var(--s2);
  border-bottom-color: var(--rule-strong);
}
td.n,
th.n {
  text-align: right;
  white-space: nowrap;
}
td.n {
  font-weight: 600;
}
tr.total td {
  font-weight: 700;
  border-top: 1px solid var(--ink);
}
tr.dim td {
  color: var(--ink-faint);
}
.table-wrap {
  overflow-x: auto;
}
.entry-title {
  font-weight: 650;
}
.entry-title a {
  text-decoration-color: transparent;
}
.entry-title a:hover {
  text-decoration-color: currentColor;
}
.code {
  font-family: var(--mono);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-soft);
  margin-right: var(--s1);
}
.sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--ink-faint);
  margin-top: 2px;
}

dl.facts {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
  margin: 0;
}
dl.facts dt,
dl.facts dd {
  margin: 0;
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--rule);
}
dl.facts dt {
  color: var(--ink-soft);
  font-size: var(--t-md);
  padding-right: var(--s4);
}
dl.facts dd.n {
  text-align: right;
  font-weight: 650;
}

/* ---------- Printed marks (statuses) ---------- */

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2rem 0.45rem;
  border: 1.5px solid currentColor;
  border-radius: var(--radius);
  font-size: var(--t-xs);
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--ink-soft);
}
.mark--visa {
  color: var(--visa);
  background: var(--visa-wash);
  transform: rotate(-1.5deg);
}
.mark--block {
  color: var(--rubric);
  background: var(--rubric-wash);
}
.mark--wait {
  color: var(--ochre);
  background: var(--ochre-wash);
}
.mark--done {
  color: var(--ledger);
  background: var(--ledger-wash);
}
.mark--void {
  color: var(--ink-faint);
  text-decoration: line-through;
  border-style: dashed;
}
.mark.press {
  animation: press 260ms var(--ease) both;
}
@keyframes press {
  0% {
    transform: rotate(-4deg) scale(1.35);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: rotate(-1.5deg) scale(1);
    opacity: 1;
  }
}
.visa-sign {
  display: block;
  font-size: var(--t-xs);
  color: var(--visa);
  margin-top: var(--s1);
}

.flag {
  font-weight: 600;
}
.flag--block {
  color: var(--rubric);
}
.flag--wait {
  color: var(--ochre);
}
.flag--ok {
  color: var(--ledger);
}

/* ---------- Alerts as numbered entries ---------- */

ol.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: entry;
}
ol.entries > li {
  counter-increment: entry;
  display: grid;
  grid-template-columns: 2rem auto minmax(0, 1fr);
  gap: var(--s3);
  align-items: baseline;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
}
ol.entries > li::before {
  content: counter(entry, decimal-leading-zero);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--ink-faint);
}

/* ---------- Buttons and forms ---------- */

button,
.button {
  font: inherit;
  font-size: var(--t-md);
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 2.5rem;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
button:hover,
.button:hover {
  background: var(--band);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.btn-visa {
  background: var(--visa);
  border-color: var(--visa);
  color: var(--proof);
}
.btn-visa:hover {
  background: var(--visa-deep);
  border-color: var(--visa-deep);
}
.btn-danger {
  background: var(--rubric);
  border-color: var(--rubric);
  color: var(--proof);
}
.btn-danger:hover {
  background: var(--rubric-deep);
  border-color: var(--rubric-deep);
}
.btn-quiet {
  border-color: var(--rule-strong);
  color: var(--ink-soft);
  font-weight: 550;
}
.btn-quiet:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}
.btn-small {
  min-height: 2rem;
  padding: var(--s1) var(--s3);
  font-size: var(--t-sm);
}
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.2em;
}
button.link:hover {
  color: var(--ink);
  background: none;
}

form {
  margin: 0;
}
form.inline {
  display: inline-flex;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
}
.field {
  display: grid;
  gap: var(--s1);
}
.field > span {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-soft);
}
.row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: end;
}

input,
select,
textarea {
  font: inherit;
  font-size: var(--t-md);
  color: var(--ink);
  background: var(--proof);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: var(--s2) var(--s3);
  min-height: 2.5rem;
}
input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-faint);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--visa);
  outline-offset: 0;
  border-color: var(--visa);
}
input[type="checkbox"] {
  min-height: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
}
input.num {
  width: 5.5rem;
  text-align: right;
}
input.grow {
  width: 100%;
}
label.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-md);
  color: var(--ink-soft);
  cursor: pointer;
}
textarea.json {
  width: 100%;
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: 1.5;
  background: var(--proof);
}

/* ---------- Flash annotations ---------- */

.flash {
  max-width: var(--page);
  margin: var(--s4) auto 0;
  padding: 0 var(--s5);
}
.flash p {
  display: flex;
  gap: var(--s2);
  align-items: baseline;
  padding: var(--s3) var(--s4);
  border: 1px solid currentColor;
  font-weight: 600;
}
.flash .ok {
  color: var(--visa-deep);
  background: var(--visa-wash);
}
.flash .err {
  color: var(--rubric-deep);
  background: var(--rubric-wash);
}

/* ---------- Day spine (À valider) ---------- */

.day .gutter {
  position: sticky;
  top: 6.5rem;
  align-self: start;
  text-align: right;
  color: var(--ink);
}
.day .gutter .dow {
  display: block;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.day .gutter .dom {
  display: block;
  font-size: var(--t-2xl);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.day .gutter .mon {
  display: block;
  font-size: var(--t-sm);
  color: var(--ink-soft);
}

table.lots td:last-child {
  text-align: right;
  white-space: nowrap;
}

/* ---------- Lot: ledger column + proof column ---------- */

.lot-head {
  display: grid;
  gap: var(--s2);
}
.lot-head h1 {
  font-size: var(--t-2xl);
  letter-spacing: -0.02em;
}
.lot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  align-items: center;
  color: var(--ink-soft);
  font-size: var(--t-md);
}
.decision {
  margin-top: var(--s4);
  padding: var(--s4);
  border: 1px solid var(--rule-strong);
  background: var(--band);
  display: grid;
  gap: var(--s3);
}
.decision .consequence {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--t-md);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 42rem);
  gap: var(--s6);
  align-items: start;
  margin-top: var(--s6);
}
.split > .proof-col {
  position: sticky;
  top: 6.5rem;
}
.stack > * + * {
  margin-top: var(--s6);
}
.stack h2 {
  font-size: var(--t-md);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--ink);
}

.proof {
  background: var(--proof);
  box-shadow: 0 1px 2px oklch(24% 0.035 258 / 0.06), 0 12px 28px -16px oklch(24% 0.035 258 / 0.25);
}
.proof-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-sm);
  color: var(--ink-soft);
  background: var(--band);
}
.proof-head nav {
  display: flex;
  gap: var(--s3);
}
.proof iframe {
  display: block;
  width: 100%;
  height: max(36rem, 78vh);
  border: 0;
  background: var(--proof);
}
.proof .fallback {
  padding: var(--s5);
}

details summary {
  cursor: pointer;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-soft);
  padding: var(--s2) 0;
}
details summary:hover {
  color: var(--ink);
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--t-sm);
}
pre.val {
  max-height: 14rem;
  overflow: auto;
  background: var(--band);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule);
}

/* ---------- Scenario list ---------- */

.families {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: var(--s4) 0 var(--s5);
}
.families a {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: var(--s1) var(--s3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
.families a:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}
.families a[aria-current="true"] {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
table.scen input.num {
  width: 4.75rem;
}
table.scen td {
  vertical-align: middle;
}

/* ---------- Settings ---------- */

.pending {
  border: 1px solid var(--ochre);
  background: var(--ochre-wash);
  padding: var(--s4) var(--s5);
  display: grid;
  gap: var(--s3);
}
.pending h2 {
  color: var(--ochre);
  font-size: var(--t-lg);
}
.diff tr.d-added td {
  background: var(--ledger-wash);
}
.diff tr.d-removed td {
  background: var(--rubric-wash);
}
.diff tr.d-changed td {
  background: var(--ochre-wash);
}
.diff td:first-child {
  padding-left: var(--s2);
}

/* ---------- Empty states ---------- */

.empty {
  padding: var(--s5) 0;
  max-width: 62ch;
  display: grid;
  gap: var(--s2);
}
.empty strong {
  font-size: var(--t-lg);
}
.empty p {
  color: var(--ink-soft);
}

/* ---------- Login ---------- */

.cover {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s5);
}
.cover-sheet {
  width: min(100%, 26rem);
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: var(--s4);
  position: relative;
}
.cover-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3rem;
  border-left: 1px solid var(--margin-rule);
}
.cover-sheet > * {
  grid-column: 2;
}
.cover-sheet h1 {
  font-size: var(--t-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.cover-sheet .lede {
  margin: var(--s2) 0 var(--s5);
}
.cover-sheet form {
  display: grid;
  gap: var(--s4);
}
.cover-sheet input {
  width: 100%;
}
.cover-sheet .error {
  color: var(--rubric-deep);
  background: var(--rubric-wash);
  border: 1px solid currentColor;
  padding: var(--s2) var(--s3);
  font-weight: 600;
  margin-bottom: var(--s4);
}

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .statement,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .split > .proof-col {
    position: static;
  }
}

@media (max-width: 640px) {
  :root {
    --margin: 2.25rem;
  }
  .register {
    padding: var(--s5) var(--s4) var(--s7);
  }
  .register::before {
    left: calc(var(--s4) + var(--margin) + var(--s3) / 2);
  }
  .masthead-inner {
    padding: var(--s3) var(--s4) 0;
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: var(--s3);
  }
  .title strong {
    font-size: var(--t-sm);
  }
  .masthead .long {
    display: none;
  }
  .title span {
    display: none;
  }
  .who .user {
    display: none;
  }
  .folio {
    column-gap: var(--s3);
  }
  .state-line {
    font-size: var(--t-2xl);
  }
  .departure .when {
    font-size: var(--t-xl);
  }
  .departure .what {
    font-size: var(--t-base);
  }
  .day .gutter {
    top: 6rem;
  }
  .day .gutter .dom {
    font-size: var(--t-xl);
  }
  .day .gutter .mon {
    font-size: var(--t-xs);
  }
  .lot-head h1 {
    font-size: var(--t-xl);
  }
  dl.facts {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* Ledger tables become stacked entries. */
  table.stackable thead {
    display: none;
  }
  table.stackable,
  table.stackable tbody,
  table.stackable tr,
  table.stackable td {
    display: block;
    width: 100%;
  }
  table.stackable tr {
    padding: var(--s3) 0;
    border-bottom: 1px solid var(--rule);
  }
  table.stackable td {
    border: 0;
    padding: var(--s1) 0;
    text-align: left;
  }
  table.stackable td.n,
  table.lots td:last-child {
    text-align: left;
  }
  table.stackable td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--ink-faint);
    font-size: var(--t-sm);
    font-weight: 500;
  }
  ol.entries > li {
    grid-template-columns: 1.75rem minmax(0, 1fr);
  }
  ol.entries > li > .mark {
    grid-column: 2;
    justify-self: start;
  }
  ol.entries > li > :last-child {
    grid-column: 2;
  }
}

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

/* ---------- Spacing utilities (rhythm steps only) ---------- */

.mt3 {
  margin-top: var(--s3);
}
.mt4 {
  margin-top: var(--s4);
}
.mt5 {
  margin-top: var(--s5);
}
.pt3 {
  padding-top: var(--s3);
}
.py2 {
  padding-top: var(--s2);
  padding-bottom: var(--s2);
}
.py3 {
  padding-top: var(--s3);
  padding-bottom: var(--s3);
}
.mt2 {
  margin-top: var(--s2);
}

/* Lots of a day grouped by scenario family (collapsed by default on phones) */
details.fam { border-top: 1px solid var(--rule); }
details.fam + details.fam { margin-top: 0; }
details.fam > summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0; cursor: pointer; list-style: none;
}
details.fam > summary::-webkit-details-marker { display: none; }
details.fam > summary .fam-name { font-weight: 600; font-size: var(--t-md); color: var(--ink); }
details.fam > summary .fam-name::before { content: "+"; display: inline-block; width: 1.25rem; color: var(--ink-faint); font-family: var(--mono); }
details.fam[open] > summary .fam-name::before { content: "−"; }
details.fam > summary .aside { color: var(--ink-faint); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
details.fam > summary:focus-visible { outline: 2px solid var(--visa); outline-offset: 2px; }
