/* The Routemark team service's admin pages, in the local console's language (ROU-163): the console's palette,
   type scale and radii, light and dark as equals. Calm surfaces, one ink, colour kept for meaning: route blue for
   links and the main action, merged green for what is in force, waiting amber for what waits on someone, failed
   red for what removes or failed. A page shows its figures first; explanations are one click down.
   The policy is style-src 'self': nothing here may depend on an inline style. */

:root {
  color-scheme: light;
  --ground: #F3F5F4;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --line: #DDE3E0;
  --line-2: #E9EEEB;
  --edge: #C5CEC9;
  --ink: #16201D;
  --ink-2: #46524D;
  --ink-3: #5F6C66;
  --route: #2650C8;
  --route-ink: #1B3C9E;
  --route-soft: #E7EDFB;
  --route-wash: #F4F7FD;
  --merged: #17864F;
  --merged-ink: #0F6A3D;
  --merged-soft: #E3F3EA;
  --waiting: #9A5B00;
  --waiting-ink: #7A4800;
  --waiting-soft: #FFF3D9;
  --waiting-edge: #EFCB82;
  --on-strong: #FFFFFF;
  --failed: #BF3A30;
  --failed-ink: #9C2A21;
  --failed-soft: #FBE8E6;
  --neutral-soft: #EDF0EE;
  --neutral-ink: #3A4541;
  --code: #F3F5F4;
  --mark-edge: transparent;
  --sans: -apple-system, system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0E1412;
    --surface: #161E1B;
    --surface-2: #1C2622;
    --line: #29352F;
    --line-2: #222C28;
    --edge: #3A4741;
    --ink: #E6ECE9;
    --ink-2: #B2BFB9;
    --ink-3: #8A9892;
    --route: #86A2FF;
    --route-ink: #A9BDFF;
    --route-soft: #1C2745;
    --route-wash: #172036;
    --merged: #4CC38A;
    --merged-ink: #7FD9AC;
    --merged-soft: #15301F;
    --waiting: #F0B455;
    --waiting-ink: #F0B455;
    --waiting-soft: #33260E;
    --waiting-edge: #6B4E17;
    --on-strong: #0E1412;
    --failed: #F07A70;
    --failed-ink: #F59A92;
    --failed-soft: #3A1D1A;
    --neutral-soft: #222C28;
    --neutral-ink: #C3CEC9;
    --code: #1C2622;
    --mark-edge: #3A4741;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0E1412;
  --surface: #161E1B;
  --surface-2: #1C2622;
  --line: #29352F;
  --line-2: #222C28;
  --edge: #3A4741;
  --ink: #E6ECE9;
  --ink-2: #B2BFB9;
  --ink-3: #8A9892;
  --route: #86A2FF;
  --route-ink: #A9BDFF;
  --route-soft: #1C2745;
  --route-wash: #172036;
  --merged: #4CC38A;
  --merged-ink: #7FD9AC;
  --merged-soft: #15301F;
  --waiting: #F0B455;
  --waiting-ink: #F0B455;
  --waiting-soft: #33260E;
  --waiting-edge: #6B4E17;
  --on-strong: #0E1412;
  --failed: #F07A70;
  --failed-ink: #F59A92;
  --failed-soft: #3A1D1A;
  --neutral-soft: #222C28;
  --neutral-ink: #C3CEC9;
  --code: #1C2622;
  --mark-edge: #3A4741;
}

/* ---------------------------------------------------------------- the page */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-width: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--ground);
  overflow-x: hidden;
}

a {
  color: var(--route);
  text-decoration: none;
}

a:hover {
  color: var(--route-ink);
  text-decoration: underline;
}

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

p {
  margin: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

code,
pre {
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

code {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--code);
}

pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  white-space: pre-wrap;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 6px;
}

small {
  font-size: 12px;
  color: var(--ink-3);
}

.strong {
  font-weight: 700;
}

/* ---------------------------------------------------------------- the header: brand, organisation, pages, sign out */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex-shrink: 0;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  box-shadow: 0 0 0 1px var(--mark-edge);
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 2px;
}

/* The organisation switcher: the current organisation's name; open, every organisation of this admin. */
.switcher {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
}

.switcher > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switcher > summary::-webkit-details-marker {
  display: none;
}

.switcher > summary::after {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin: -3px 2px 0 auto;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
}

.switcher > summary:hover {
  border-color: var(--edge);
}

.switcher > nav {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 11;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.switcher > nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.switcher > nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.switcher > nav a[aria-current="true"] {
  font-weight: 700;
  background: var(--route-wash);
  box-shadow: inset 3px 0 0 var(--route);
}

.switcher > nav a:last-child {
  margin-top: 4px;
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 6px 6px;
  color: var(--route);
  font-weight: 600;
}

/* The pages of an organisation, as the console's tabs. */
nav[aria-label="Pages"] {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 22px;
  min-width: 0;
  flex: 1 1 auto;
}

nav[aria-label="Pages"] a {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

nav[aria-label="Pages"] a:hover {
  color: var(--ink);
  text-decoration: none;
}

nav[aria-label="Pages"] a[aria-current="page"] {
  font-weight: 700;
  color: var(--ink);
  border-bottom-color: var(--route);
}

.sign-out {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- the view, its heading and its cards */

.view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.page-head h1,
.signin h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.crumbs {
  font-size: 13px;
  font-weight: 600;
}

.lede {
  font-size: 14px;
  color: var(--ink-2);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card-narrow {
  max-width: 560px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 4px 12px;
  min-width: 0;
}

.card-head h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.figure {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-top: -4px;
  font-variant-numeric: tabular-nums;
}

.card-danger {
  border-color: var(--failed-soft);
}

.card-danger .card-head h2 {
  color: var(--failed-ink);
}

.card-failed {
  border-color: var(--failed);
  background: var(--failed-soft);
}

.card-key {
  border-color: var(--waiting-edge);
  background: var(--waiting-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

/* One click down: what a figure means and how its form works. */
details.how > summary,
.revisions details > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}

details.how > summary::-webkit-details-marker,
.revisions details > summary::-webkit-details-marker {
  display: none;
}

details.how > summary::before,
.revisions details > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.12s ease;
}

details.how[open] > summary::before,
.revisions details[open] > summary::before {
  transform: rotate(45deg);
}

details.how > summary:hover {
  color: var(--ink);
}

details.how > p {
  margin-top: 8px;
  max-width: 72ch;
  font-size: 13px;
  color: var(--ink-2);
}

.notice {
  padding: 10px 14px;
  border: 1px solid var(--merged-soft);
  border-left: 4px solid var(--merged);
  border-radius: 8px;
  background: var(--merged-soft);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.alert {
  font-weight: 700;
  color: var(--failed-ink);
}

.empty,
td[colspan] {
  color: var(--ink-2);
}

p.empty,
li.empty {
  padding: 4px 0;
}

/* ---------------------------------------------------------------- chips, lists of rows, people and their keys */

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: var(--neutral-ink);
}

.chip-ok {
  background: var(--merged-soft);
  color: var(--merged-ink);
}

.chip-wait {
  background: var(--waiting-soft);
  color: var(--waiting-ink);
}

.chip-off {
  background: var(--neutral-soft);
  color: var(--ink-3);
  white-space: normal;
}

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

.new {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--waiting-soft);
  color: var(--waiting-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

ul.rows,
ul.machines,
ul.names {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.rows > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line-2);
  min-width: 0;
}

ul.rows > li:first-child {
  border-top: 0;
}

.row-main {
  min-width: 0;
  overflow-wrap: anywhere;
}

.person {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  min-width: 0;
}

.person h3 {
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.person > form {
  align-self: flex-start;
}

.key {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}

.key.is-revoked {
  color: var(--ink-3);
}

.key-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  min-width: 0;
}

.key-line p {
  min-width: 0;
  overflow-wrap: anywhere;
}

ul.machines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-2);
}

ul.machines li {
  overflow-wrap: anywhere;
}

.revisions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.revisions > section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-wrap: anywhere;
}

.revisions h2 {
  font-size: 15px;
  font-weight: 800;
}

/* ---------------------------------------------------------------- tables, which scroll inside their card */

.table-wrap {
  overflow-x: auto;
  min-width: 0;
  margin: 0 -18px;
  padding: 0 18px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
  overflow-wrap: break-word;
}

th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom-color: var(--line);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--surface-2);
}

td[colspan] {
  padding: 18px 0;
  text-align: center;
}

table.tasks {
  min-width: 980px;
}

/* ---------------------------------------------------------------- forms: labels above fields, then the action */

form {
  margin: 0;
}

.form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}

.form-stack {
  flex-direction: column;
  align-items: stretch;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 0;
}

.form > label {
  flex: 1 1 220px;
  max-width: 420px;
}

.form-stack > label {
  flex: 0 0 auto;
  max-width: none;
}

input,
select {
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 7px 10px;
  min-height: 36px;
  min-width: 0;
  width: 100%;
}

input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--route);
  outline-offset: 0;
  border-color: var(--route);
}

input[readonly] {
  background: var(--surface-2);
}

#member-key {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
}

.hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: -4px;
}

/* ---------------------------------------------------------------- buttons: primary, quiet, danger */

button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

button:hover {
  border-color: var(--edge);
}

button.primary {
  background: var(--route);
  border-color: var(--route);
  color: var(--on-strong);
}

button.primary:hover {
  background: var(--route-ink);
  border-color: var(--route-ink);
}

button.quiet {
  background: var(--surface);
  color: var(--ink-2);
}

button.quiet:hover {
  color: var(--ink);
}

button.danger {
  background: var(--surface);
  border-color: var(--line);
  color: var(--failed-ink);
}

button.danger:hover {
  background: var(--failed-soft);
  border-color: var(--failed);
}

button:disabled,
button:disabled:hover {
  cursor: progress;
  opacity: 0.6;
}

.signin {
  margin: 32px auto 0;
  width: 100%;
}

.providers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.providers > button {
  flex: 1 1 200px;
}

#message:empty {
  display: none;
}

#message {
  font-size: 13px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- a send in progress (static/forms.js) */

.form-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  min-height: 36px;
}

form:not([data-state]) > .form-status {
  min-height: 0;
}

form[data-state="failed"] > .form-status {
  color: var(--failed-ink);
  font-weight: 700;
  flex-basis: 100%;
}

form[data-state="failed"] {
  border-color: var(--failed);
}

.spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--route);
  border-radius: 50%;
  animation: turn 0.8s linear infinite;
}

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

@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: breathe 1.6s ease-in-out infinite;
    border-color: var(--route);
  }

  details.how > summary::before {
    transition: none;
  }
}

/* ---------------------------------------------------------------- narrower screens */

@media (max-width: 899px) {
  .brand-label {
    display: none;
  }

  .top {
    padding: 0 20px;
  }

  .view {
    padding: 16px 20px 32px;
  }
}

/* A phone: the header's pages become a strip of their own that scrolls sideways; cards stack. */
@media (max-width: 700px) {
  .top {
    flex-wrap: wrap;
    padding: 8px 16px 0;
    gap: 8px 10px;
  }

  .brand-name {
    font-size: 16px;
  }

  .switcher {
    flex: 1 1 0;
  }

  .switcher > summary {
    max-width: 100%;
  }

  .switcher > nav {
    left: auto;
    right: 0;
  }

  .sign-out button {
    padding: 5px 10px;
    min-height: 32px;
  }

  nav[aria-label="Pages"] {
    order: 5;
    flex: 1 1 100%;
    gap: 18px;
    min-height: 42px;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px;
    border-top: 1px solid var(--line-2);
  }

  .view {
    padding: 14px 16px 28px;
    gap: 12px;
  }

  .page-head h1,
  .signin h1 {
    font-size: 22px;
  }

  .card {
    padding: 14px;
  }

  .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
  }

  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .form > label {
    flex-basis: 100%;
    max-width: none;
  }

  .form > button,
  ul.rows form,
  ul.rows button,
  .key-line form,
  .key-line button {
    width: 100%;
  }

  .signin {
    margin-top: 12px;
  }
}

/* ---------------------------------------------------------------- the ledger (M5): figures first, one card per
   measure, the tables one click down. A figure no machine measured is said, never drawn as a zero. */

.page-sub {
  font-size: 13px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.views {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.views a,
.views span {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.views a:hover {
  border-color: var(--edge);
  color: var(--ink);
  text-decoration: none;
}

.views [aria-current="page"] {
  background: var(--route-soft);
  border-color: var(--route-soft);
  color: var(--route-ink);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tile-half {
  grid-column: span 2;
}

.tile-whole {
  grid-column: 1 / -1;
}

.tile-head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}

.tile-head h2,
.tile-stack h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.tile .figure {
  margin-top: 0;
  padding-top: 4px;
  overflow-wrap: anywhere;
}

.figure .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 6px;
}

.tile .figure-absent {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-3);
  padding-top: 8px;
}

.tile .figure-side {
  font-size: 28px;
}

.tile-line {
  font-size: 13px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.tile-small {
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.tile-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px 24px;
  min-width: 0;
}

.tile-split > div,
.tile-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tile-split > div + div {
  border-left: 1px solid var(--line-2);
  padding-left: 24px;
}

/* A fold inside a card: why a figure is absent and how it is counted. */
details.inline > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--route);
  overflow-wrap: anywhere;
}

details.inline > .fold-body {
  padding: 6px 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-2);
}

/* One click down: a table per grouping, behind its own fold. */
details.down {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}

details.down > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

details.down > summary::-webkit-details-marker {
  display: none;
}

details.down > summary::before {
  content: "";
  flex-shrink: 0;
  align-self: center;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.12s ease;
}

details.down[open] > summary::before {
  transform: rotate(45deg);
}

details.down > summary h2 {
  font-size: 15px;
  font-weight: 800;
}

details.down > .fold-body {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.card-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}

.card-note {
  font-size: 13px;
  color: var(--ink-3);
}

table.figures {
  font-variant-numeric: tabular-nums;
}

table.figures th,
table.figures td {
  text-align: right;
  padding: 9px 0 9px 14px;
}

table.figures th {
  white-space: normal;
  vertical-align: bottom;
  min-width: 72px;
}

table.figures td {
  white-space: nowrap;
}

table.figures th:first-child,
table.figures td:first-child {
  text-align: left;
  padding-left: 0;
  white-space: normal;
  min-width: 160px;
  overflow-wrap: anywhere;
}

table.figures td[colspan] {
  text-align: center;
}

td .sub,
th .sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}

.absent-cell {
  color: var(--ink-3);
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--neutral-ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

tr.total td {
  font-weight: 700;
  border-top: 1px solid var(--line);
}

/* What this ledger is not: at the foot of every view. */
.not-is {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--edge);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.not-is h2 {
  font-size: 14px;
  font-weight: 800;
}

.not-is p {
  max-width: 900px;
  font-size: 13px;
  color: var(--ink-2);
}

@media (prefers-reduced-motion: reduce) {
  details.down > summary::before {
    transition: none;
  }
}

@media (max-width: 1000px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile-half {
    grid-column: span 1;
  }
}

@media (max-width: 700px) {
  .tiles,
  .tile-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile-half {
    grid-column: auto;
  }

  .tile-split > div + div {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line-2);
    padding-top: 10px;
  }

  .tile .figure:not(.figure-absent):not(.figure-side) {
    font-size: 32px;
  }

  details.down > summary {
    padding: 12px 14px;
  }

  details.down > .fold-body {
    padding: 0 14px 14px;
  }

  details.down .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
  }

  .not-is {
    padding: 12px 14px;
  }
}

/* ---------------------------------------------------------------- M6: the waiting runs on the ledger, and the
   record of each merge. Facts as they were sent: no colour says good or bad of a line or of a person. */

.views [aria-current="true"] {
  background: var(--route-soft);
  border-color: var(--route-soft);
  color: var(--route-ink);
}

table.waiting {
  min-width: 860px;
}

/* A plain link that reads as one of the site's buttons: it gives a file, it sends nothing. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--edge);
  color: var(--ink);
  text-decoration: none;
}

.card-head .button {
  margin-left: auto;
  align-self: center;
}

/* One line per merge, each a fold that opens to its facts. The lines share their columns with the heading row
   and scroll inside their card, as the tables do. */
.merge-list {
  min-width: 1080px;
  font-size: 13px;
}

.merge-head,
details.merge > summary {
  display: grid;
  grid-template-columns: 10px 1.15fr 1fr 0.9fr 1.3fr 1.4fr 1.6fr 0.95fr 1.4fr minmax(112px, 1fr);
  gap: 4px 12px;
  align-items: start;
  padding: 9px 0;
  min-width: 0;
}

.merge-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}

details.merge {
  border-bottom: 1px solid var(--line-2);
}

details.merge:last-child {
  border-bottom: 0;
}

details.merge > summary {
  list-style: none;
  cursor: pointer;
}

details.merge > summary::-webkit-details-marker {
  display: none;
}

details.merge > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.12s ease;
}

details.merge[open] > summary::before {
  transform: rotate(45deg);
}

details.merge > summary:hover {
  background: var(--surface-2);
}

details.merge > summary > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.merge-head > span {
  min-width: 0;
}

.merge-commit code {
  white-space: nowrap;
}

/* The opened facts stay in the part of the list that is in view when the list is scrolled sideways. */
dl.facts {
  position: sticky;
  left: 0;
  max-width: calc(100vw - 64px);
  display: grid;
  grid-template-columns: minmax(160px, 280px) minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  padding: 4px 0 14px 22px;
}

dl.facts dt {
  font-weight: 600;
  color: var(--ink-3);
}

dl.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  details.merge > summary::before {
    transition: none;
  }
}

@media (max-width: 700px) {
  dl.facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding-left: 14px;
  }

  dl.facts dd {
    padding-bottom: 6px;
  }
}

/* ---------------------------------------------------------------- the terms and the privacy pages (M7): a table
   of contents beside the prose, as the public site's terms page has it, at a readable measure; and the footer that
   every page carries, with its two links. */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 70ch);
  gap: 32px;
  align-items: start;
  min-width: 0;
}

.toc {
  position: sticky;
  top: 72px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.toc a:hover {
  color: var(--route-ink);
}

.prose {
  min-width: 0;
  max-width: 70ch;
  display: flex;
  flex-direction: column;
  gap: 28px;
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.prose section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-margin-top: 72px;
}

.prose h2 {
  font-size: 19px;
  font-weight: 700;
}

.prose ul {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prose code {
  font-size: 13.5px;
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.foot a {
  color: var(--ink-3);
}

.foot a:hover {
  color: var(--route-ink);
}

@media (max-width: 899px) {
  .doc {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .toc {
    position: static;
  }

  .foot {
    padding: 14px 20px 28px;
  }
}

@media (max-width: 700px) {
  .prose {
    gap: 22px;
    font-size: 14.5px;
  }

  .foot {
    padding: 12px 16px 24px;
  }
}
