/* Doorward interface. Direction: Door leaf. See DESIGN.md for the token table and recipes.
   One stylesheet, no script, no inline style. Fonts are files beside this one. */

/* ---------- Fonts (SIL OFL 1.1, files unmodified from @fontsource-variable) ---------- */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  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: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
  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: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-mono-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  /* The door is one colour in both themes: darker than the dark room (0.205). */
  --door: oklch(0.13 0.005 85);
  --on-door: oklch(0.96 0.004 85);
  --on-door-2: oklch(0.74 0.006 85);
  --door-line: oklch(1 0 0 / 0.12);
  --door-hover: oklch(1 0 0 / 0.07);
  /* Behind the phone menu sheet. */
  --scrim: oklch(0 0 0 / 0.4);

  /* The room, light. */
  --paper: oklch(0.985 0.004 85);
  --surface: oklch(1 0 0);
  --sunken: oklch(0.955 0.005 85);
  --line: oklch(0.89 0.006 85);
  --line-strong: oklch(0.6 0.008 85);
  --ink: oklch(0.2 0.008 85);
  --ink-2: oklch(0.4 0.008 85);
  --ink-3: oklch(0.5 0.008 85);

  /* Verdicts: the only chroma. */
  --allow: oklch(0.5 0.13 150);
  --deny: oklch(0.5 0.19 27);
  /* The filled danger button: deep red under near-white text in both themes. */
  --deny-fill: oklch(0.5 0.19 27);
  --deny-hover: oklch(0.46 0.165 27);
  --warn: oklch(0.52 0.12 70);
  --deny-wash: oklch(0.955 0.02 27);
  --warn-wash: oklch(0.95 0.045 85);
  --allow-wash: oklch(0.955 0.025 150);
  --on-deny: oklch(0.985 0.004 85);

  --sans: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;

  --r1: 2px;
  --r2: 4px;
  --r3: 8px;

  --shadow-float: 0 1px 2px oklch(0 0 0 / 0.12), 0 12px 32px oklch(0 0 0 / 0.24);

  --control: 36px;
  --control-sm: 28px;
  --control-text: 14px;

  --rail: 232px;
  --gutter: 48px;

  --t-fast: 120ms;
  --t-mid: 200ms;
  --t-page: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-move: cubic-bezier(0.6, 0, 0.2, 1);

  /* Letter-spacing only on the three display styles, in whole pixels.
   Never em: on 1x screens a fractional spacing rounds unevenly, pair by pair. */
  --tight: -1px;

  interpolate-size: allow-keywords;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.205 0.005 85);
    --surface: oklch(0.165 0.005 85);
    --sunken: oklch(0.25 0.005 85);
    --line: oklch(0.3 0.005 85);
    --line-strong: oklch(0.56 0.006 85);
    --ink: oklch(0.95 0.004 85);
    --ink-2: oklch(0.8 0.005 85);
    --ink-3: oklch(0.68 0.006 85);

    --allow: oklch(0.78 0.15 150);
    --deny: oklch(0.74 0.15 25);
    --deny-fill: oklch(0.55 0.19 25);
    --deny-hover: oklch(0.51 0.185 25);
    --warn: oklch(0.82 0.13 80);
    --deny-wash: oklch(0.27 0.035 25);
    --warn-wash: oklch(0.285 0.04 80);
    --allow-wash: oklch(0.27 0.035 150);
  }
}

/* Touch screens and narrow windows: taller controls, 16 px control text. */
@media (pointer: coarse), (max-width: 639.98px) {
  :root {
    --control: 44px;
    --control-sm: 44px;
    --control-text: 16px;
  }
}

@media (max-width: 899.98px) {
  :root {
    --gutter: 20px;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--s5);
}

body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/20px var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  /* The door runs the full height of the page, however long the room is. */
  background-image: linear-gradient(to right, var(--door) var(--rail), transparent 0);
}

/* Card pages are used for seconds, by everyone, on anything: the large control size always. */
body[data-layout="card"] {
  --rail: clamp(320px, 38vw, 560px);
  --card-inset: clamp(32px, 8vw, 120px);
  --card-top: clamp(96px, 22vh, 208px);
  --control: 44px;
  --control-text: 16px;
}

/* The door's width and the column's place follow the window, in steps of 4 px, so
   every edge of the column falls on a whole pixel and 1 px borders stay sharp. */
@supports (inline-size: round(down, 1px, 4px)) {
  body[data-layout="card"] {
    --rail: round(down, clamp(320px, 38vw, 560px), 4px);
    --card-inset: round(down, clamp(32px, 8vw, 120px), 4px);
    --card-top: round(down, clamp(96px, 22vh, 208px), 4px);
  }
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
fieldset,
table {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

fieldset {
  border: 0;
  min-inline-size: 0;
}

h1 {
  font: 700 32px/36px var(--sans);
  letter-spacing: var(--tight);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* The second line of a title: the name of a header and its question mark, on a line of their own
   under the word Remove. */
h1 > .title-line {
  display: block;
}

/* The name of a header in a title: an inline box, so the question mark after it can follow on its line,
   in the mono face at 30 px. It breaks at its hyphens first; a segment too long for a line is broken. */
h1 > .title-line > .title-name {
  display: inline;
  font-family: var(--mono);
  font-size: 30px;
  overflow-wrap: break-word;
}

h2 {
  font: 650 20px/28px var(--sans);
  text-wrap: balance;
}

h3,
legend {
  font: 650 14px/20px var(--sans);
  padding: 0;
}

p {
  text-wrap: pretty;
}

code,
kbd,
samp,
time,
.mono {
  font: 400 13px/20px var(--mono);
  font-variant-ligatures: none;
}

/* Inline identifiers must not stretch the line they sit in. */
code,
.client-host {
  line-height: 1;
  overflow-wrap: anywhere;
}

/* A time in a line of text is mono in a sans line: on its own leading it made the line 21 px. */
time {
  line-height: 1;
}

/* .whole holds an identifier inside a sentence, with the stop after it: it goes to the next
   line in one piece and breaks inside, where it may, only when longer than a whole line. */
.whole {
  display: inline-block;
  max-inline-size: 100%;
  white-space: normal;
}

/* An inline block starts lines of its own. An indent inherited from the text around it
   would move its first line, onto its neighbour when the indent is negative: never inherit. */
.whole,
.state,
.email,
.email > span,
.notice a,
[data-direct-warning] a,
p[data-needs-values] a,
.back > a,
.button {
  text-indent: 0;
}

q {
  quotes: "\201C" "\201D";
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color var(--t-fast);
}

@media (hover: hover) {
  a:hover {
    text-decoration-color: currentColor;
  }
}

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

::selection {
  background: var(--ink);
  color: var(--paper);
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- The door: header as slab or rail ---------- */

.site {
  position: sticky;
  inset-block-start: 0;
  block-size: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--door);
  color: var(--on-door);
}

.site :focus-visible {
  outline-color: var(--on-door);
}

.site-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  block-size: 64px;
  padding-inline: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font: 700 16px/24px var(--sans);
  color: var(--on-door);
  text-decoration: none;
  border-radius: var(--r1);
}

/* The brand mark's 5 px of air hangs outside the 20 px edge; the ink starts at 20.
   The wordmark starts at 52, the edge every rail link shares. */
.brand-mark {
  flex: none;
  inline-size: 24px;
  block-size: 24px;
  margin-inline: -5px 5px;
  fill: currentColor;
}

/* The handle: only a closed door shows it. */
body[data-layout="card"] .site::after {
  content: "";
  position: absolute;
  inset-inline-end: var(--s6);
  inset-block-start: calc(50% - 6px);
  inline-size: 12px;
  block-size: 12px;
  border-radius: 50%;
  background: var(--on-door);
  /* The rose around the knob: a 1 px ring, 8 px out. */
  box-shadow: 0 0 0 7px var(--door), 0 0 0 8px var(--door-line);
}

.site-note {
  margin-block-start: auto;
  padding: 20px;
  max-inline-size: 34ch;
  color: var(--on-door-2);
  font: 400 13px/20px var(--sans);
}

.menu-button {
  display: none;
}

.menu-button > .when-open,
.site:has(nav:popover-open) .menu-button > .when-closed {
  display: none;
}

.site:has(nav:popover-open) .menu-button > .when-open {
  display: inline;
}

/* Rail navigation. The popover attribute only matters under 900 px. */
.site nav {
  position: static;
  inset: auto;
  flex: 1;
  display: flex;
  inline-size: auto;
  block-size: auto;
  margin: 0;
  padding: var(--s2) var(--s2) var(--s4);
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
}

.site nav ul {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.site nav .nav-break {
  margin-block-start: var(--s5);
}

.site nav .nav-end {
  margin-block-start: auto;
}

.site nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-block-size: 36px;
  /* 8 px of list padding plus 44: the label starts at 52, under the wordmark. */
  padding-inline: 44px var(--s3);
  border-radius: var(--r2);
  color: var(--on-door-2);
  font: 500 14px/20px var(--sans);
  text-decoration: none;
  transition: background-color var(--t-fast), color var(--t-fast);
}

/* The link of the page that is open already says so with its mark: no fill under it. */
@media (hover: hover) {
  .site nav a:not([aria-current="page"]):hover {
    background: var(--door-hover);
    color: var(--on-door);
  }
}

.site nav a[aria-current="page"] {
  color: var(--on-door);
  font-weight: 650;
}

/* Centred at 27, under the centre of the mark's ink (20 to 34). */
.nav-mark {
  position: absolute;
  inset-inline-start: var(--s4);
  inset-block-start: calc(50% - 3px);
  inline-size: 6px;
  block-size: 6px;
  border-radius: 50%;
  background: var(--on-door);
}

/* ---------- The room ---------- */

main {
  min-inline-size: 0;
  max-inline-size: 1208px;
  padding: 40px var(--gutter) var(--s9);
}

body[data-layout="card"] main {
  max-inline-size: none;
  padding: var(--card-top) var(--card-inset) var(--s8);
}

body[data-layout="card"] main > * {
  max-inline-size: 400px;
}

/* Flow inside a card page. */
body[data-layout="card"] main > * + * {
  margin-block-start: var(--s4);
}

body[data-layout="card"] main > h1 + * {
  margin-block-start: var(--s5);
}

body[data-layout="card"] main > form {
  margin-block-start: var(--s6);
}

/* A quiet way on, under a card page's form or under the one paragraph of a message page. */
body[data-layout="card"] main > .lede + .back {
  margin-block-start: var(--s5);
}

/* The size of the paragraph it follows; its target is a control's height (36 px, 44 on
   touch) while the line it stands in stays 28 px. */
.back {
  font: 400 16px/24px var(--sans);
}

.back > a {
  display: inline-block;
  margin-block: calc((28px - var(--control)) / 2);
  padding-block: calc((var(--control) - 24px) / 2);
  color: var(--ink-2);
}

/* A refusal as a title: the bar of the log, hung in the margin, 8 px from the words. */
h1[data-tone="bad"] {
  position: relative;
}

h1[data-tone="bad"]::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--s5) * -1);
  inset-block-start: 14px;
  inline-size: 16px;
  block-size: 6px;
  border-radius: 1px;
  background: var(--deny);
}

/* The sentence belongs to the two buttons, not to the warning above it. */
body[data-layout="card"] main > [data-consent-notice] {
  margin-block-start: var(--s6);
  font-size: 16px;
  line-height: 24px;
}

.lede {
  color: var(--ink-2);
  font: 400 16px/24px var(--sans);
  max-inline-size: 64ch;
  text-wrap: balance;
}

/* Beside a 400 px form a paragraph fills the same width; it is not balanced into a column. */
body[data-layout="card"] .lede {
  text-wrap: pretty;
}

.lede code,
.lede .client-host {
  font-size: 14px;
}

/* The host a refusal names is the one fact in its sentence. */
.lede .client-host {
  color: var(--ink);
  font-weight: 600;
}

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

.strong {
  font-weight: 650;
}

/* Page head: where you are, then what you can do about it. */
.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "crumb crumb"
    "title actions"
    "under under";
  align-items: center;
  column-gap: var(--s5);
  margin-block-end: var(--s6);
}

.page-head > .crumb {
  grid-area: crumb;
  margin-block-end: var(--s1);
}

.page-head > h1 {
  grid-area: title;
}

.page-head > .lede,
.page-head > .meta {
  grid-area: under;
  margin-block-start: var(--s2);
}

.page-head > .head-actions {
  grid-area: actions;
  display: flex;
  gap: var(--s2);
}

.crumb {
  color: var(--ink-2);
  font: 500 13px/20px var(--sans);
}

.crumb a {
  display: inline-flex;
  align-items: center;
  min-block-size: 24px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s4);
  color: var(--ink-2);
}

/* A notice is as wide as a form wherever it stands, so its box ends where its text does. */
body[data-layout="panel"] main > .notice,
body[data-layout="page"] main > .notice,
body:is([data-layout="panel"], [data-layout="page"]) .part-body .notice {
  max-inline-size: 640px;
  margin-block-end: var(--s6);
}

/* There the box is the measure: its text runs to the padding. */
body[data-layout="panel"] main > .notice > p,
body[data-layout="page"] main > .notice > p {
  max-inline-size: none;
}

/* A part: title and one sentence on the left, the thing itself on the right.
   The first line of the right column sits on the title's baseline, whatever it is. */
.part {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: first baseline;
  column-gap: var(--s7);
  padding-block: var(--s5) var(--s6);
  border-block-start: 1px solid var(--line);
}

/* 24 + 8: the title stays 32 px under the rule, with room for a boxed first line beside it. */
.part-head {
  padding-block-start: var(--s2);
}

.part-head > p {
  margin-block-start: var(--s2);
  color: var(--ink-2);
  max-inline-size: 36ch;
}

.part-body {
  min-inline-size: 0;
}

.part-body > form,
.part-body > .narrow {
  max-inline-size: 640px;
}

.flow > * + * {
  margin-block-start: var(--s4);
}


.flow > .fields + .fields,
.flow > fieldset,
.flow > .fields + .checks,
.flow > fieldset + .checks {
  margin-block-start: var(--s5);
}

.flow > legend + p,
.flow > h3 + p {
  margin-block-start: var(--s1);
  max-inline-size: 64ch;
}

/* In a part's body a form that follows something starts a new group, and so does whatever
   follows a section: a server's block on the account page. */
.part-body.flow > * + form.flow,
.part-body.flow > [data-headers-full] {
  margin-block-start: var(--s6);
}

/* The add form is a second form under the switches form, so it starts further down: 64 px, the
   nearest token above 56 px. */
.part-body.flow > form.flow[action$="/headers"] {
  margin-block-start: var(--s8);
}

.part-body > section + * {
  margin-block-start: var(--s7);
}

.field > .below > .check {
  margin-block-start: var(--s2);
}

.flow > .form-actions {
  margin-block-start: var(--s6);
}

/* The first thing in a flow starts at its top. Hidden inputs come first in a form and take
   no room, so what follows them is the first thing. */
.flow > :first-child,
.flow > input[type="hidden"] + * {
  margin-block-start: 0;
}

/* A fact and the one action that changes it: apart from the form above, close to
   each other. */
.flow > form + .facts {
  margin-block-start: var(--s6);
}

.flow > .facts + .form-actions {
  margin-block-start: var(--s3);
}

.form-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* A part that follows anything but another part keeps its distance from it. */
* + .part {
  margin-block-start: var(--s7);
}

.part + .part,
.page-head + .part,
.notice + .part,
.providers + .part,
.empty + .part {
  margin-block-start: 0;
}

/* A full-width section with a heading row, used for tables. */
.block {
  margin-block-start: var(--s7);
}

/* A list that a part follows is closed by that part's rule: its last row keeps its room
   and gives up its own hairline, so no two rules run parallel with nothing between. */
.list:has(+ .part) > tbody > tr:last-child,
.list:has(+ .part) > tbody > tr:last-child > td,
:is(.block, .part):has(+ .part) .list:last-child > tbody > tr:last-child,
:is(.block, .part):has(+ .part) .list:last-child > tbody > tr:last-child > td {
  border-block-end-color: transparent;
}

/* The link ending a list's head stands on the action column's edge and takes a row
   action's hover: the fill overhangs the label by 8 px each side, the label does not move. */
.block-head > a {
  margin: calc(var(--r1) * -1) calc(var(--s2) * -1) calc(var(--r1) * -1) 0;
  padding: var(--s1) var(--s2);
  border-radius: var(--r2);
  transition: background-color var(--t-fast), text-decoration-color var(--t-fast);
}

@media (hover: hover) {
  .block-head > a:hover {
    background: var(--sunken);
  }
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  margin-block-end: var(--s4);
}

.count {
  color: var(--ink-3);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* A server's block on the account page: its name leads it, at the size of a mail provider's,
   and the state beside the name is said after it, in the size and weight of text. */
[data-values-server] > h3 {
  font-size: 16px;
  line-height: 24px;
}

/* The gap trails the name, so a state that drops to the next line starts on the block's edge. */
[data-values-server] > h3 > .block-name {
  margin-inline-end: var(--s2);
}

h3 > .state {
  font: 400 14px/20px var(--sans);
}

/* The locked list: each server's name and its state share one grid, so every mark starts on one edge. */
[data-values-locked] > .locked-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--s4);
  row-gap: var(--s3);
}

[data-values-locked] > .locked-list > section,
[data-values-locked] > .locked-list > section > h3 {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

[data-values-locked] > .locked-list + section,
[data-values-locked] > section + section {
  margin-block-start: var(--s3);
}

[data-values-locked] > :is(.locked-list, section) + p {
  margin-block-start: var(--s5);
}

/* ---------- Fields ---------- */

/* One .fields per visual row. Each field is label, control, hint on shared tracks,
   so a hint or a wrapped label on one field cannot move its neighbour's input. */
.fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: var(--s4);
}

/* Every pair shares the same two columns, so a second field always starts on one edge. */
.fields[data-cols="2"],
.fields[data-cols="2-1"],
.fields[data-cols="1-2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* The short field of a long and short pair: a third of the form, ragged right. */
.fields[data-cols="2-1"] > .field + .field {
  max-inline-size: 208px;
}

.field {
  display: grid;
  grid-row: 1 / span 3;
  grid-template-rows: subgrid;
  min-inline-size: 0;
}

@supports not (grid-template-rows: subgrid) {
  .fields {
    align-items: start;
  }

  .field {
    grid-template-rows: auto auto auto;
  }
}

label,
.label {
  font: 550 13px/20px var(--sans);
  color: var(--ink);
}

.field > label,
.field > .label {
  grid-area: 1 / 1;
  align-self: end;
  margin-block-end: var(--s1);
}

/* A link that belongs to a field sits at the far end of its label row. It comes after
   the control in the markup, so the keyboard reaches the control first. */
.field > .field-link {
  grid-area: 1 / 1;
  justify-self: end;
  align-self: end;
  /* A 24 px target on a 20 px line, ending where the label ends, 4 px above the control. */
  margin-block: calc(var(--s1) * -1) var(--s1);
  padding-block-start: var(--s1);
  border-radius: var(--r2);
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-2);
}

/* The ring hugs the link: it ends on the field's edge and stays clear of the control. */
.field > .field-link:focus-visible {
  outline-offset: 0;
}

/* A label that is a header's name is in the identifier face and still a label. */
label > code {
  font-weight: inherit;
}

/* A header's name may run past its half-width field, to the form's edge, before it wraps.
   The field keeps its column's width, so the name is never what sizes the control. */
[data-values-server] .field {
  grid-template-columns: minmax(0, 1fr);
}

[data-values-server] .field > label {
  justify-self: start;
  inline-size: max-content;
  max-inline-size: calc(200% + var(--s4));
}

.optional {
  color: var(--ink-3);
  font-weight: 400;
}

.hint,
.field-error {
  margin-block-start: var(--s1);
  font: 400 13px/20px var(--sans);
  color: var(--ink-3);
}

.field-error {
  color: var(--deny);
  font-weight: 550;
}

input:where([type="text"], [type="email"], [type="password"], [type="url"], [type="search"], [type="number"]),
select {
  inline-size: 100%;
  block-size: var(--control);
  padding-inline: var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  background-color: var(--surface);
  color: var(--ink);
  font: 400 var(--control-text) / 20px var(--sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

input.mono,
input[type="url"] {
  font-family: var(--mono);
  font-size: calc(var(--control-text) - 1px);
}

@media (hover: hover) {
  input:where([type="text"], [type="email"], [type="password"], [type="url"]):hover,
  select:hover {
    border-color: var(--ink);
  }
}

input:where([type="text"], [type="email"], [type="password"], [type="url"]):focus-visible,
select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}

input[aria-invalid="true"] {
  border-color: var(--deny);
  box-shadow: inset 0 0 0 1px var(--deny);
}

input:disabled,
select:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* Select: the arrow is two gradients, so no image file and no data: address. */
select {
  appearance: none;
  padding-inline-end: var(--s6);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: right 17px center, right 12px center;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}

/* Checkbox: the 24 px target overhangs its 18 px column by 3 px each side, so the box
   starts on the edge the fields above it start on. */
.check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: var(--s3);
  align-items: start;
  min-block-size: 24px;
}

.check > input[type="checkbox"] {
  margin-inline: -3px;
}

/* A path after a name is quieter and never broken: its gap trails the name, 12 px with the word space.
   A path that drops to the next line starts on the label's edge. */
.check > label > .check-name {
  margin-inline-end: var(--s2);
}

.check > label > code {
  color: var(--ink-2);
  white-space: nowrap;
}

/* Under 900 px the path has its own line under the name, on the name's edge, in every row. */
@media (max-width: 899.98px) {
  .check > label > code {
    display: block;
    line-height: 20px;
  }
}

.check > label {
  align-self: first baseline;
  padding-block: var(--r1);
  font-weight: 400;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.check > .hint {
  grid-column: 2;
  margin-block-start: 0;
}

/* The hint of a credentials form sits under the last field, not against its status line. */
[data-values-server] > form.flow > p.hint {
  margin-block-start: var(--s4);
}

/* The hint of each switch keeps a reading measure under its label. */
[data-switches] > .check > .hint {
  max-inline-size: 60ch;
}

.checks {
  display: grid;
  gap: var(--s3);
}

.checks[data-cols="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2) var(--s5);
}

input[type="checkbox"] {
  appearance: none;
  position: relative;
  inline-size: 24px;
  block-size: 24px;
  margin: 0;
  border-radius: var(--r2);
  background: none;
  cursor: pointer;
}

input[type="checkbox"]::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r1);
  background: var(--surface);
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 7px;
  background: var(--paper);
  clip-path: polygon(8% 52%, 0 64%, 38% 100%, 100% 22%, 90% 12%, 37% 76%);
  transform: scale(0);
  transition: transform var(--t-fast) var(--ease-out);
}

@media (hover: hover) {
  input[type="checkbox"]:hover::before {
    border-color: var(--ink);
  }
}

input[type="checkbox"]:checked::before {
  background: var(--ink);
  border-color: var(--ink);
}

input[type="checkbox"]:checked::after {
  transform: scale(1);
}

/* ---------- Buttons ---------- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  block-size: var(--control);
  padding-inline: var(--s4);
  border: 1px solid transparent;
  border-radius: var(--r2);
  background: none;
  color: var(--ink);
  font: 600 var(--control-text) / 20px var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform 125ms var(--ease-out);
}

button:active,
.button:active {
  transform: scale(0.97);
}

[data-kind="primary"] {
  background: var(--ink);
  color: var(--paper);
}

@media (hover: hover) {
  [data-kind="primary"]:hover {
    background: var(--ink-2);
  }
}

[data-kind="secondary"] {
  border-color: var(--line-strong);
}

@media (hover: hover) {
  [data-kind="secondary"]:hover {
    border-color: var(--ink);
    background: var(--sunken);
  }
}

/* data-kind="danger" marks every action that deletes, revokes, removes or disconnects.
   Filled red only in an opened confirmation and the Disconnect card; a row action keeps its look. */
.confirm [data-kind="danger"],
body[data-layout="card"] [data-kind="danger"] {
  background: var(--deny-fill);
  color: var(--on-deny);
}

@media (hover: hover) {
  .confirm [data-kind="danger"]:hover,
  body[data-layout="card"] [data-kind="danger"]:hover {
    background: var(--deny-hover);
  }
}

/* Row actions act at once and can be repeated, so they take a quiet link look, never red.
   The class sets the look whatever the data-kind says; the label ends on its column's edge. */
.row-action[data-kind],
.list td.act button[data-kind] {
  block-size: var(--control-sm);
  /* 8 px of padding and the 1 px (transparent) border every button has. */
  margin-inline-end: calc((var(--s2) + 1px) * -1);
  padding-inline: var(--s2);
  border-color: transparent;
  background: none;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: background-color var(--t-fast), color var(--t-fast), text-decoration-color var(--t-fast), transform 125ms var(--ease-out);
}

@media (hover: hover) {
  .row-action[data-kind]:hover,
  .list td.act button[data-kind]:hover {
    border-color: transparent;
    background: var(--sunken);
    color: var(--ink);
    text-decoration-color: currentColor;
  }
}

.row-action[data-kind]:focus-visible,
.list td.act button[data-kind]:focus-visible {
  color: var(--ink);
}

/* The ring of a quiet action stands on its hover fill's box, 1 px off it: one box for both
   states, for a row's action and for the link that ends a list's head. */
.block-head > a:focus-visible,
.row-action[data-kind]:focus-visible,
.list td.act button[data-kind]:focus-visible {
  outline-offset: 1px;
}

/* ---------- Status: a word with a shape ---------- */

.state {
  position: relative;
  display: inline-block;
  padding-inline-start: 20px;
  color: var(--ink);
}

/* The mark sits on the first line of the word, whatever the word wraps to. */
.state::before {
  position: absolute;
  inset-inline-start: 2px;
  inset-block-start: 6px;
}

.state[data-tone="bad"]::before {
  inset-inline-start: 1px;
  inset-block-start: 8px;
}

.state::before,
.notice::before,
.notice > .local-app + p::before,
.event[data-tone]::before,
.field-error::before {
  content: "";
  justify-self: center;
  box-sizing: border-box;
}

/* Allow, active, enabled, locked down: a solid disc. */
.state[data-tone="ok"]::before,
.notice[data-notice="ok"]::before {
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--allow);
}

/* Deny, refused, open to the world: a bar, as on a no-entry sign. */
.state[data-tone="bad"]::before,
.notice[data-notice="error"]::before,
.event[data-tone="bad"]::before,
.field-error::before {
  inline-size: 10px;
  block-size: 4px;
  border-radius: 1px;
  background: var(--deny);
}

/* Unverified, not checked: a hollow diamond. */
.state[data-tone="warn"]::before,
.notice[data-notice="warning"]::before,
.notice > .local-app + p::before,
.event[data-tone="warn"]::before {
  inline-size: 8px;
  block-size: 8px;
  border: 2px solid var(--warn);
  transform: rotate(45deg);
}

/* Off, disabled, not in use: a hollow ring. */
.state[data-tone="muted"]::before {
  inline-size: 8px;
  block-size: 8px;
  border: 2px solid var(--ink-3);
  border-radius: 50%;
}

.state[data-tone="muted"] {
  color: var(--ink-2);
}

/* ---------- Notices ---------- */

.notice {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  background: var(--sunken);
  color: var(--ink);
  transition: opacity var(--t-mid) var(--ease-out), transform var(--t-mid) var(--ease-out);
}

.notice::before {
  margin-block-start: 6px;
}

.notice[data-notice="error"]::before {
  margin-block-start: 8px;
}

.notice[data-notice="warning"] {
  background: var(--warn-wash);
}

.notice[data-notice="error"] {
  background: var(--deny-wash);
}

.notice[data-notice="ok"] {
  background: var(--allow-wash);
}

/* A success notice that carries an attention line takes the caution fill; its marks stay as they are. */
.notice[data-notice="ok"]:has(> .attention) {
  background: var(--warn-wash);
}

/* The text, not the mark, is the notice's baseline for whatever aligns to it. */
.notice > * {
  grid-column: 2;
  align-self: first baseline;
}

.notice > * + * {
  margin-block-start: var(--s1);
}

/* The box runs as wide as its place; the text keeps a reading measure. */
.notice > p {
  max-inline-size: 64ch;
}

/* Two warnings in one box, on the consent page: 8 px apart, and the second has its own diamond
   in the mark's column. */
.notice > .local-app + p {
  position: relative;
  margin-block-start: var(--s2);
}

.notice > .local-app + p::before {
  position: absolute;
  inset-inline-start: calc(var(--r1) - var(--s5));
  inset-block-start: 6px;
}

/* A line of a notice with its own attention mark: the mark stands in the notice's mark column. */
.notice > .attention {
  position: relative;
}

.notice > .attention::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--r1) - var(--s5));
  inset-block-start: 6px;
  inline-size: 8px;
  block-size: 8px;
  box-sizing: border-box;
  border: 2px solid var(--warn);
  transform: rotate(45deg);
}

/* A link goes to the next line whole; it breaks only when it is longer than a line.
   A 24 px target on the 20 px line. */
.notice a,
[data-direct-warning] a,
p[data-needs-values] a {
  display: inline-block;
  max-inline-size: 100%;
  margin-block: calc(var(--r1) * -1);
  padding-block: var(--r1);
}

@starting-style {
  .notice {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.field-error {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: var(--s2);
}

.field-error::before {
  margin-block-start: 8px;
}

/* ---------- Tables ---------- */

.list {
  inline-size: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.list th {
  padding: 0 var(--s4) var(--s2) 0;
  border-block-end: 1px solid var(--ink);
  text-align: start;
  vertical-align: bottom;
  font: 500 12px/16px var(--sans);
  color: var(--ink-3);
  white-space: nowrap;
}

.list td {
  padding: var(--s3) var(--s4) var(--s3) 0;
  border-block-end: 1px solid var(--line);
  vertical-align: baseline;
  overflow-wrap: anywhere;
}

.list th:last-child,
.list td:last-child {
  padding-inline-end: 0;
}

/* A number never parts from its unit. */
.list .num,
.unit,
.count,
.range,
.nowrap {
  white-space: nowrap;
}

.list .num {
  text-align: end;
  padding-inline-end: var(--s5);
}

.activity .duration {
  padding-inline-end: var(--s4);
  white-space: nowrap;
}

/* The action hangs on the row's baseline and is never what makes the row tall:
   a row with an action is as high as a row without one. */
.list .act {
  text-align: end;
  padding-block: var(--s1);
}

.list .act form {
  display: inline-flex;
}

.list a.name {
  /* Inline, so a name that wraps gives the row its first baseline, not its last. */
  padding-block: var(--s1);
  font-weight: 650;
  text-decoration-color: transparent;
}

/* Where nothing can hover, the name shows it is a link the way every link does. */
@media (hover: none) {
  .list a.name {
    text-decoration-color: var(--line-strong);
  }
}

@media (hover: hover) {
  .list a.name:hover {
    text-decoration-color: currentColor;
  }
}

.list .sub {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
}

.list .sub.state {
  color: var(--ink-2);
}

.unit {
  display: none;
}

/* Column widths. The unnamed column takes what is left. */
.servers .c-path { inline-size: 22%; }
.servers .c-num { inline-size: 8%; }
.servers .c-state { inline-size: 28%; }

.users .c-role { inline-size: 12%; }
.users .c-num { inline-size: 12%; }
.users .c-state { inline-size: 20%; }

/* 48 px from a count to the state after it, so a numeral is not read with the state's mark.
   Users have the room from 900 px, where the table starts; servers from 1280 px, below. */
@media (min-width: 900px) {
  .users .num {
    padding-inline-end: var(--s7);
  }
}

.rules .c-rule { inline-size: 48px; }
.rules .c-effect { inline-size: 80px; }
.rules .c-subject { inline-size: 32%; }
.rules .c-act { inline-size: 120px; }

.invitations .c-role { inline-size: 56px; }
.invitations .c-when { inline-size: 176px; }
.invitations .c-by { inline-size: 248px; }
.invitations .c-act { inline-size: 56px; }

.redirects .c-source { inline-size: 136px; }
.redirects .c-state { inline-size: 136px; }
.redirects .c-act { inline-size: 104px; }

.blocked .c-client { inline-size: 30%; }
.blocked .c-act { inline-size: 216px; }

.clients .c-server { inline-size: 40%; }
.clients .c-act { inline-size: 128px; }

.tools { max-inline-size: 640px; }
.tools .c-effect { inline-size: 72px; }
.tools .c-server { inline-size: 32%; }

/* The three short columns hold their longest words and add up to 312 px, so in a 640 px
   table the name has 328 px and "Required" starts on the edge every second field starts on.
   In a narrower part body the name gives way first; it wraps, the short columns do not. */
.headers { max-inline-size: 640px; }
.headers .c-required { inline-size: 88px; }
.headers .c-stored { inline-size: 152px; }
.headers .c-act { inline-size: 72px; }

/* Where a part body is narrower than a form, the room "Stored by" has to spare is the name's. */
@media (max-width: 1279.98px) {
  .headers .c-stored { inline-size: 112px; }
}

/* A box is 24 px on a 20 px line: like an action, it is never what makes its row tall. */
.headers td.c-required {
  padding-block: var(--s1);
}

/* As a table the column's head is the box's label: the label keeps its line, so the box stands
   on the row's baseline, and is not seen. Stacked, with no head, it is read beside the box. */
@media (min-width: 900px) {
  .headers .check > label {
    inline-size: 0;
    overflow: hidden;
    white-space: nowrap;
  }
}

/* The first line of a part's body stands on the title's baseline: the head offers its text's
   baseline, not the bottom of its cells (4 px lower). */
.headers th {
  vertical-align: baseline;
}

/* Two tables size a column by what is in it. Tools: the tool column is as wide as its
   longest name, so the server sits beside it. */
@media (min-width: 900px) {
  .tools {
    display: grid;
    grid-template-columns: 72px fit-content(61%) minmax(0, 1fr);
  }

  /* Rules: Subject is as wide as its longest address, and "Applies to" keeps at least 30%. */
  .rules {
    display: grid;
    grid-template-columns: 48px 80px minmax(256px, max-content) minmax(30%, 1fr) max-content;
  }


  .tools thead,
  .tools tbody,
  .tools tr,
  .rules thead,
  .rules tbody,
  .rules tr {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
  }

  .tools tr,
  .rules tr {
    align-items: baseline;
    border-block-end: 1px solid var(--line);
  }

  .tools thead tr,
  .rules thead tr {
    border-block-end-color: var(--ink);
  }

  .tools th,
  .tools td,
  .tools .c-effect,
  .tools .c-server,
  .rules th,
  .rules td,
  .rules .c-rule,
  .rules .c-effect,
  .rules .c-subject,
  .rules .c-act {
    display: block;
    inline-size: auto;
    border: 0;
  }

  .tools td.lead {
    padding-inline-end: var(--s5);
  }
}

.activity {
  --c-event: calc(100% - 948px);
  --c-user: 256px;
  --c-decision: 132px;
  --c-duration: 96px;
  --c-time: 160px;
}

/* Activity: the label leads, and a mark hangs in the margin only when a row needs one. */
.event {
  position: relative;
  display: block;
  font-weight: 650;
}

/* Every shape is centred 17 px left of the label: the 8 px ones start 1 px further in. */
.event[data-tone]::before {
  position: absolute;
  inset-inline-start: -21px;
  inset-block-start: 6px;
}

.event[data-tone="bad"]::before {
  inset-inline-start: -22px;
  inset-block-start: 8px;
}

/* The detail is what tells two rows with one label apart: it is text, not a caption. */
.detail {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.activity td.decision {
  white-space: nowrap;
}

/* A path is 24 characters at most: 208 px holds it, and the name takes the rest. */
@media (min-width: 1280px) {
  .servers .c-path { inline-size: 208px; }

  /* The two counts share their 16%: the second is wider and holds the 48 px before the state. */
  .servers .c-num { inline-size: 6.5%; }
  .servers .c-num + .c-num { inline-size: 9.5%; }
  .servers .num + .num { padding-inline-end: var(--s7); }

  .invitations .c-when { inline-size: 20%; }
  .invitations .c-by { inline-size: 28%; }

  /* 32 px between the longest subject and what it applies to, where there is the room. */
  .rules .c-subject,
  .rules td:nth-child(3) {
    padding-inline-end: var(--s6);
  }
}

/* The log as a table: each row is a grid of two lines, the label's and one under it
   for the detail. "Server and tool" takes what the five fixed columns leave. */
@media (min-width: 1280px) {
  .activity,
  .activity thead,
  .activity tbody,
  .activity th,
  .activity td {
    display: block;
  }

  /* The second line is flexible, so a cell that spans both never stretches the first. */
  .activity tr {
    display: grid;
    grid-template-columns:
      var(--c-event) var(--c-user) minmax(0, 1fr)
      var(--c-decision) var(--c-duration) var(--c-time);
    grid-template-rows: auto 1fr;
    align-items: baseline;
    border-block-end: 1px solid var(--line);
  }

  .activity thead tr {
    border-block-end-color: var(--ink);
  }

  .activity th,
  .activity td {
    border: 0;
  }

  .activity td {
    grid-row: 1;
  }

  /* The label's cell spans to the Time column and lends its tracks to label and detail. */
  .activity td.what {
    grid-area: 1 / 1 / 3 / 6;
    display: grid;
    grid-template-columns: subgrid;
    grid-template-rows: subgrid;
    padding-block-end: 0;
  }

  .activity td.what > .event {
    grid-area: 1 / 1;
    padding-inline-end: var(--s4);
  }

  .activity td.what > .event:only-child,
  .activity td.what > .detail {
    padding-block-end: var(--s3);
  }

  .activity td.what > .detail {
    grid-area: 2 / 1 / 3 / -1;
  }

  /* On that long line an address moves to the next line whole before it breaks. */
  .activity .detail .email {
    display: inline-block;
    max-inline-size: 100%;
    vertical-align: top;
  }

  /* With a detail under it, the first line gives up its bottom padding to the second. */
  .activity tr:has(.detail) > :is(td.user, td.decision, td.duration, td.when) {
    padding-block-end: 0;
  }

  .activity td.user { grid-column: 2; }
  .activity td.where { grid-column: 3; grid-row: 1 / 3; }
  .activity td.decision { grid-column: 4; }
  .activity td.duration { grid-column: 5; }
  .activity td.when { grid-column: 6; }

  /* 32 px between a duration, set right, and the time after it, set left. */
  .activity th.duration,
  .activity td.duration {
    padding-inline-end: var(--s6);
  }

  /* No server in the row: the address runs on through that empty column. */
  .activity tr:has(> td.where:empty) > td.user {
    grid-column: 2 / 4;
  }

  /* A tool call: a long address or tool takes the detail's line too, never a third one,
     and the detail (a short phrase there) keeps to the Event column. */
  .activity tr:has(> td.where > code + code) > td.user {
    grid-row: 1 / 3;
    padding-block-end: var(--s3);
  }

  .activity tr:has(> td.where > code + code) .detail {
    grid-column: 1 / 2;
    padding-inline-end: var(--s4);
    text-wrap: balance;
  }

  /* A server and no tool: the address stays whole and the server follows it, moved
     right only when the address is wider than its column; the detail stops before it. */
  .activity tr:has(> td.where > code:only-child) {
    grid-template-columns:
      var(--c-event) minmax(var(--c-user), max-content) minmax(0, 1fr)
      var(--c-decision) var(--c-duration) var(--c-time);
  }

  .activity tr:has(> td.where > code:only-child) .detail {
    grid-column: 1 / 3;
    padding-inline-end: var(--s4);
  }
}

/* Server and tool on one line, "demo / slow"; a long tool name wraps after an underscore. */
.activity td.where {
  font: 400 13px/20px var(--mono);
}

.activity .where code {
  line-height: 1;
}

/* The slash stays with the server; a tool that does not fit beside it goes to the next
   line whole, and breaks inside only when it is longer than a line. */
.activity .where code + code {
  display: inline-block;
  max-inline-size: 100%;
  line-height: 20px;
  text-indent: 0;
  color: var(--ink-2);
}

.activity .where code:first-child:not(:only-child)::after {
  content: " / ";
  color: var(--ink-3);
}

.activity td.user {
  font-size: 13px;
}

.activity td.decision,
.activity td.duration {
  font-size: 13px;
  color: var(--ink-2);
}

.activity time {
  display: block;
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-2);
}

/* Toolbar above a table and pager below it. */
.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--s4) var(--s5);
  flex-wrap: wrap;
  margin-block-end: var(--s5);
}

.filters {
  display: grid;
  grid-template-rows: auto auto;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 232px);
  column-gap: var(--s3);
  row-gap: var(--s1);
}

.filters > button {
  grid-row: 2;
  justify-self: start;
}

.range {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  line-height: var(--control);
}

.pager {
  display: flex;
  gap: var(--s2);
  margin-block-start: var(--s5);
}

/* ---------- Overview counts ---------- */

/* Four counts of the overview. A cell is the number and its noun on one baseline and,
   under them, one line of state; the line's room is kept when there is nothing to say. */
.counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block-start: 1px solid var(--ink);
}

.counts > a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 36px 20px;
  align-items: baseline;
  /* 5 px: the noun's line ends 3 px above the numeral's, so the state line is 8 px under it. */
  gap: 5px var(--s2);
  padding: var(--s4) var(--s4) var(--s4) 0;
  border-block-end: 1px solid var(--line);
  text-decoration: none;
}

.counts > a + a {
  padding-inline-start: var(--s4);
  border-inline-start: 1px solid var(--line);
}

.count-value {
  grid-area: 1 / 1;
  /* Pulled 2 px left so the stem of the numeral meets the edge of the line under it. */
  margin-inline-start: -2px;
  font: 700 32px/36px var(--sans);
  letter-spacing: var(--tight);
  font-variant-numeric: tabular-nums;
}

.count-label {
  grid-area: 1 / 2;
  color: var(--ink-2);
  font: 500 14px/20px var(--sans);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--t-fast), color var(--t-fast);
}

@media (hover: hover) {
  .counts > a:hover .count-label {
    color: var(--ink);
    text-decoration-color: currentColor;
  }
}

.count-state {
  grid-area: 2 / 1 / 3 / -1;
  color: var(--ink-2);
  font: 400 13px/20px var(--sans);
  white-space: nowrap;
}

.count-state > .state + .state {
  margin-inline-start: var(--s3);
}

/* A line without a mark keeps the mark's room: one edge for the words of the four lines. */
.count-state:not(:has(> .state)) {
  padding-inline-start: 20px;
}

/* A date inside a sentence: the mono face's word space, 8 px, is halved. */
.count-state > time,
.hint time {
  word-spacing: calc(var(--s1) * -1);
}

/* ---------- Facts ---------- */

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--s2) var(--s5);
}

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

.facts dd {
  overflow-wrap: anywhere;
}

/* Tool names, one to a ruled row. From thirteen names on they fill two columns. */
.catalog {
  max-inline-size: 640px;
}

.catalog:has(> li:nth-child(13)) {
  columns: 280px 2;
  column-gap: var(--s4);
}

.catalog li {
  break-inside: avoid;
  padding-block: var(--s2);
  border-block-end: 1px solid var(--line);
}

/* ---------- Disclosures ---------- */

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

details::details-content {
  block-size: 0;
  overflow-y: clip;
  opacity: 0;
  transition: block-size var(--t-mid) var(--ease-out), opacity var(--t-mid) var(--ease-out), content-visibility var(--t-mid) allow-discrete;
}

details[open]::details-content {
  block-size: auto;
  opacity: 1;
}

/* The chevron, drawn with two borders. */
.chevron {
  flex: none;
  inline-size: 8px;
  block-size: 8px;
  margin-inline: var(--s1);
  border-inline-end: 2px solid var(--ink-2);
  border-block-end: 2px solid var(--ink-2);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--t-mid) var(--ease-out);
}

details[open] > summary .chevron {
  transform: translateY(2px) rotate(225deg);
}

/* Mail providers: ruled rows that open one at a time. */
.providers {
  border-block-start: 1px solid var(--ink);
}

.provider {
  border-block-end: 1px solid var(--line);
}

.providers + .part,
.empty + .part {
  border-block-start: 0;
}

.provider > summary {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) auto;
  column-gap: var(--s7);
  align-items: center;
  min-block-size: 56px;
  border-radius: var(--r1);
}

.provider > summary > .provider-name {
  font: 650 16px/24px var(--sans);
}

.provider > form {
  max-inline-size: 640px;
  margin-inline-start: calc(232px + var(--s7));
  padding-block: var(--s5) var(--s6);
}

/* Confirming something that cannot be undone. The closed summary already says so:
   an outlined control and, beside it (under it when there is no room), the words. */
.confirm > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  inline-size: fit-content;
  border-radius: var(--r2);
}

.confirm-open {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-block-size: var(--control);
  padding-inline: var(--s4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  font: 600 var(--control-text) / 20px var(--sans);
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

@media (hover: hover) {
  .confirm > summary:hover > .confirm-open {
    border-color: var(--ink);
    background: var(--sunken);
  }
}

.confirm-note {
  color: var(--ink-2);
  font: 400 13px/20px var(--sans);
}

/* Open, the body says it in full. */
.confirm[open] .confirm-note {
  display: none;
}

/* The ring goes round the control, not round the control and its note. */
.confirm > summary:focus-visible {
  outline: 0;
}

.confirm > summary:focus-visible > .confirm-open {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* A summary without the two spans is the control itself, as before round 5. */
.confirm > summary:not(:has(> .confirm-open)) {
  display: inline-flex;
  gap: var(--s2);
  min-block-size: var(--control);
  padding-inline: var(--s4);
  border: 1px solid var(--line-strong);
  font: 600 var(--control-text) / 20px var(--sans);
}

.confirm-body {
  display: grid;
  gap: var(--s4);
  justify-items: start;
  max-inline-size: 640px;
  padding-block-start: var(--s4);
}

/* ---------- Empty state ---------- */

.empty {
  padding-block: var(--s7);
  border-block: 1px solid var(--line);
  border-block-start-color: var(--ink);
}

.empty > h2 + p {
  margin-block-start: var(--s2);
  color: var(--ink-2);
  max-inline-size: 56ch;
}

/* ---------- Card pages ---------- */

body[data-layout="card"] form.flow > button {
  inline-size: 100%;
  margin-block-start: var(--s5);
}

body[data-layout="card"] .facts {
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0;
}

body[data-layout="card"] .facts dt {
  font-size: 13px;
}

/* A value on a card page is read, not scanned: 16 on 24, the size of the words around it. */
body[data-layout="card"] .facts dd {
  font-size: 16px;
  line-height: 24px;
}

body[data-layout="card"] .facts dd + dt {
  margin-block-start: var(--s3);
}

/* Consent. The destination is the largest thing on the page. */
.consent-title {
  font: 500 16px/24px var(--sans);
  letter-spacing: 0;
  color: var(--ink-2);
}

/* What stands under the destination explains it: 12 px under the digits to the eye, and the
   facts start 32 px after it. A box needs 4 and 28 px for that, a plain line 0 and 24. */
main[data-page="consent"] > .consent-title + * {
  margin-block-start: var(--s1);
}

main[data-page="consent"] > .consent-title + p {
  margin-block-start: 0;
}

main[data-page="consent"] > .facts {
  margin-block-start: 28px;
}

main[data-page="consent"] > p + .facts {
  margin-block-start: var(--s5);
}

.dest {
  display: block;
  margin-block-start: var(--s1);
  font: 700 32px/36px var(--mono);
  letter-spacing: var(--tight);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* What Approve grants is the second thing the eye meets, after the destination. */
main[data-page="consent"] .facts dd.grant {
  font-weight: 650;
  font-size: 20px;
  line-height: 28px;
}

main[data-page="consent"] .facts dd + dt {
  margin-block-start: var(--s4);
}

/* Email addresses use the sans face with kerning off: the face kerns a stop after "w" too tightly.
   No tracking here (see --tight). */
.email {
  font-kerning: none;
  letter-spacing: 0;
}

/* The name and the "@domain" are each one piece: a line breaks between them first, and
   inside one (before a dot) only when the piece is wider than its line. */
.email > span,
.address > span {
  display: inline-block;
  max-inline-size: 100%;
}

/* An underline does not reach into an inline block by itself. */
a .email,
a .email > span,
a .address,
a .address > span {
  text-decoration: inherit;
}

.client-name {
  font-weight: 650;
}

.client-host,
.facts dd.id {
  font-family: var(--mono);
  font-size: 13px;
}

body[data-layout="card"] .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}

body[data-layout="card"] .actions button,
body[data-layout="card"] .actions .button {
  inline-size: 100%;
}

/* A question and its two answers: the same distance as a lede and its first field. */
body[data-layout="card"] main > .lede + .actions {
  margin-block-start: var(--s6);
}

/* A link to copy, in a box as wide as a field. Its origin and its path are one piece each:
   the line breaks between them first, and inside one only when it is longer than a line. */
.copy {
  display: block;
  line-height: 20px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2);
  background: var(--surface);
  user-select: all;
}

.copy > span {
  display: inline-block;
  max-inline-size: 100%;
  text-indent: 0;
}

/* The path ends in a token: it fills its line to the end and never stops at a hyphen. */
.copy > span + span {
  word-break: break-all;
}

/* ---------- Narrow windows: the rail becomes a bar, the menu a sheet ---------- */

/* The panel and the account page give up the rail under 1100 px: beside it a table
   would have less than 772 px. Card pages have no table and keep the door to 900 px. */
@media (max-width: 1099.98px) {
  body:not([data-layout="card"]) {
    display: block;
    background-image: none;
  }

  body:not([data-layout="card"]) .site {
    position: static;
    block-size: auto;
  }

  body:not([data-layout="card"]) .site-bar {
    block-size: 56px;
  }

  body:not([data-layout="card"]) main {
    padding: var(--s6) var(--gutter) var(--s8);
  }

  /* Without popover support the navigation stays a plain list under the bar. */
  .site nav {
    padding: 0 var(--s2) var(--s3);
  }

  /* A one-link navigation (a plain user's account) has no menu: the bar is the brand alone. */
  .site nav:not([popover]) {
    display: none;
  }

  .site nav a {
    min-block-size: 44px;
    font-size: 16px;
  }

  @supports selector(:popover-open) {
    .menu-button {
      display: inline-flex;
      block-size: 44px;
      margin-inline-end: calc(var(--s3) * -1);
      padding-inline: var(--s3);
      border-color: transparent;
      color: var(--on-door);
      font-size: 14px;
    }

    @media (hover: hover) {
      .menu-button:hover {
        border-color: transparent;
        background: var(--door-hover);
      }
    }

    .site nav[popover] {
      position: fixed;
      inset: 56px 0 auto 0;
      display: none;
      inline-size: 100%;
      max-block-size: calc(100dvh - 56px);
      padding: var(--s2) var(--s2) var(--s4);
      background: var(--door);
      color: var(--on-door);
      border-block-start: 1px solid var(--door-line);
      box-shadow: var(--shadow-float);
      overflow-y: auto;
      /* The sheet is the door: solid from its first frame, unrolled from under the bar by
         a clip and never faded. Open, the clip ends below the box, where the shadow is. */
      clip-path: inset(0 0 100% 0);
      transition: clip-path var(--t-mid) var(--ease-out), overlay var(--t-mid) allow-discrete, display var(--t-mid) allow-discrete;
    }

    .site nav[popover]:popover-open {
      display: flex;
      clip-path: inset(0 0 calc(var(--s7) * -1) 0);
    }

    @starting-style {
      .site nav[popover]:popover-open {
        clip-path: inset(0 0 100% 0);
      }
    }

    /* Only what is written on the door fades. */
    .site nav[popover] > ul {
      opacity: 0;
      transition: opacity var(--t-mid) var(--ease-out);
    }

    .site nav[popover]:popover-open > ul {
      opacity: 1;
    }

    @starting-style {
      .site nav[popover]:popover-open > ul {
        opacity: 0;
      }
    }

    /* The bar stays lit: the backdrop starts under it. */
    .site nav[popover]::backdrop {
      inset-block-start: 56px;
      background: var(--scrim);
    }

    /* The scrim comes and goes with the sheet, on its time and curve; the reduced motion
       rule does not reach a backdrop, so the fade is declared only where motion is wanted. */
    @media (prefers-reduced-motion: no-preference) {
      .site nav[popover]::backdrop {
        opacity: 0;
        transition: opacity var(--t-mid) var(--ease-out), overlay var(--t-mid) allow-discrete, display var(--t-mid) allow-discrete;
      }

      .site nav[popover]:popover-open::backdrop {
        opacity: 1;
      }

      @starting-style {
        .site nav[popover]:popover-open::backdrop {
          opacity: 0;
        }
      }
    }

    .site:has(nav:popover-open) .menu-button {
      background: var(--door-hover);
    }

    .site nav .nav-end {
      margin-block-start: var(--s4);
    }
  }
}

/* From 720 px a card page keeps the door beside the room: a 240 px door, and the 400 px column
   centred in the paper until it stands 64 px from the seam (40 at 720, 64 from 768). */
@media (min-width: 720px) and (max-width: 899.98px) {
  body[data-layout="card"] {
    --rail: 240px;
    --card-inset: clamp(40px, calc((100% - 400px) / 2), 64px);
  }

  @supports (inline-size: round(down, 1px, 4px)) {
    body[data-layout="card"] {
      --card-inset: round(down, clamp(40px, calc((100% - 400px) / 2), 64px), 4px);
    }
  }
}

@media (max-width: 719.98px) {
  body[data-layout="card"] {
    display: block;
    background-image: none;
  }

  body[data-layout="card"] .site {
    position: static;
    block-size: auto;
  }

  body[data-layout="card"] .site-bar {
    block-size: 56px;
  }

  body[data-layout="card"] .site::after {
    display: none;
  }

  /* The closed door as a bar still says what Doorward is, under its name. */
  .site-note {
    margin-block-start: 0;
    padding: 0 var(--gutter) var(--s4);
    max-inline-size: none;
  }

  /* No margin to hang in: the bar stands on its own line, 12 px above the title, and the
     title and every paragraph keep the page's edge. */
  h1[data-tone="bad"]::before {
    position: static;
    display: block;
    margin-block-end: var(--s3);
  }

  body[data-layout="card"] main {
    padding: var(--s7) var(--gutter) var(--s8);
  }
}

/* Under 360 px the sentence would take three lines of the bar: the bar is the name alone. */
@media (max-width: 359.98px) {
  .site-note {
    display: none;
  }
}

@media (max-width: 899.98px) {
  .part {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--s5);
  }

  .part-head > p {
    max-inline-size: 64ch;
  }

  .provider > summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: var(--s4);
  }

  .provider > form {
    margin-inline-start: 0;
  }

  /* A 20 px gutter is too narrow to hang a mark in: the log keeps a 20 px column for it.
     Every line of every record starts on one edge and a mark stands on the page edge. */
  .activity tr {
    padding-inline-start: 20px;
  }

  .event[data-tone]::before {
    inset-inline-start: -18px;
  }

  .event[data-tone="bad"]::before {
    inset-inline-start: -19px;
  }

  /* Generic lists: each row is a small block, the name first, the action last. */
  .list:not(.activity),
  .list:not(.activity) tbody,
  .list:not(.activity) td {
    display: block;
  }

  .list:not(.activity) thead {
    display: none;
  }

  /* Lines are 4 px apart by a margin, not a row gap, so the empty rows the action cell
     spans add nothing. 8 px of padding plus the first line's 4 px margin is the usual 12. */
  .list:not(.activity) tr {
    display: grid;
    grid-template-columns: max-content max-content minmax(0, 1fr) auto;
    align-items: baseline;
    padding-block: var(--s2) 11px;
    border-block-end: 1px solid var(--line);
  }

  .list:not(.activity) tbody tr:first-child {
    border-block-start: 1px solid var(--ink);
  }

  .list:not(.activity) td,
  .list:not(.activity) td.num {
    margin-block-start: var(--s1);
    padding: 0;
    border: 0;
    text-align: start;
    grid-column: 1 / -1;
  }

  /* Only the first line shares its width with the action. */
  .list:not(.activity) td:first-child {
    grid-column: 1 / 4;
  }

  .list .lead {
    font-size: 16px;
    line-height: 24px;
  }

  .list a.name {
    display: block;
    margin-block: -10px;
    padding-block: 10px;
    text-decoration-color: var(--line-strong);
  }

  .list:not(.activity) td.half {
    grid-column: 1;
    color: var(--ink-2);
  }

  .list:not(.activity) td.half + td.half {
    grid-column: 2;
    padding-inline-start: var(--s2);
  }

  /* Under a lead cell the second half runs to the record's edge: the action's column is
     on the first line only, and must not take room from a line it is not on. */
  .list:not(.activity) td:not(.half) ~ td.half + td.half {
    grid-column: 2 / -1;
  }

  /* A lead-in phrase wraps like the sentence it starts; only a unit after a number is glued. */
  .invitations td > .unit,
  .blocked td > .unit {
    white-space: normal;
  }

  .list:not(.activity) td.half + td.half::before {
    content: "\00B7";
    margin-inline-end: var(--s2);
    color: var(--ink-3);
  }

  /* A row action sits on the record's first line, at the right, centred on it.
   Its hit area overhangs above and below, so the line is no taller and the rhythm holds. */
  .list:not(.activity) td.act {
    grid-column: 4;
    grid-row: 1;
    align-self: start;
    padding-inline-start: var(--s3);
  }

  .list:not(.activity) td.act button,
  .list:not(.activity) td.act .row-action {
    margin-block: calc((var(--first-line, 24px) - var(--control-sm)) / 2);
    /* The ring is drawn 3 px inside the hit area, clear of the hairline above. */
    outline-offset: -3px;
  }

  .list:not(.activity) td.act:empty {
    display: none;
  }

  /* A reason in place of an action reads as a line of the record. */
  .list:not(.activity) td.act.reason {
    grid-column: 1 / -1;
    grid-row: auto;
    padding-inline-start: 0;
  }

  /* One mark column in every list: a mark stands on the list's edge and its word 20 px in.
     What follows a verdict on its line starts after a column of one width, on one edge. */
  .list {
    --c-verdict: calc(20px + var(--s7));
  }

  /* The state of an address is the record's last line, alone, as in servers and users. */
  .list.redirects:not(.activity) td.lead ~ td.half + td.half {
    grid-column: 1 / -1;
    padding-inline-start: 0;
  }

  .list.redirects:not(.activity) td.lead ~ td.half + td.half::before {
    content: none;
  }

  /* A tool verdict: the verdict in its column, then "echo on demo" as text that wraps
     under the tool, never under the mark. "on server" never splits. */
  .tools.list tr {
    display: block;
    padding-block: var(--s3) 11px;
    padding-inline-start: var(--c-verdict);
    font-size: 14px;
    line-height: 20px;
    word-spacing: var(--s1);
  }

  /* Out of the line, so no space of the markup stands between the column and the tool. */
  .tools.list td:first-child {
    float: inline-start;
    inline-size: var(--c-verdict);
    margin-inline-start: calc(var(--c-verdict) * -1);
  }

  .tools.list td,
  .tools.list td.half + td.half {
    display: inline;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 20px;
  }

  /* The list's wider word space is for the gaps between cells, not for words in a piece. */
  .tools.list .state,
  .tools.list .whole {
    word-spacing: normal;
  }

  /* One space after each cell, whether or not the markup has white space between cells. */
  .tools.list td::after {
    content: " ";
  }

  .tools.list td.half + td.half::before {
    content: none;
  }

  .tools.list td:last-child {
    white-space: nowrap;
  }

  /* Rules lead with their number and verdict. */
  .rules.list {
    --first-line: 20px;
  }

  /* Number, verdict and action are centred on one 20 px line; a shared baseline across
     mono and sans would make that line 21 px. */
  .rules.list tr {
    align-items: center;
  }

  /* A rule leads with its verdict, in the verdict column; its number follows on one edge. */
  .rules.list td.half {
    grid-row: 1;
    grid-column: 2 / 4;
  }

  .rules.list td.half + td.half {
    grid-column: 1;
    inline-size: var(--c-verdict);
    padding-inline-start: 0;
    color: inherit;
  }

  .rules.list td.half + td.half::before {
    content: none;
  }

  /* Under a verdict every other line of the rule starts where the verdict's word does;
     the note keeps its own mark in the mark column. */
  .rules.list td:not(.half):not(.act) {
    padding-inline-start: 20px;
  }

  .rules.list .sub.state {
    margin-inline-start: -20px;
  }

  .unit {
    display: inline;
  }
}

/* ---------- The activity log at four widths ---------- */

/* 1280 to 1439 px: the same table with narrower columns. */
@media (max-width: 1439.98px) {
  .activity {
    --c-event: round(down, calc(164px + (100% - 936px) * 5 / 12), 1px);
    --c-user: 240px;
    --c-decision: 116px;
    --c-time: 88px;
  }
}

/* There the time is two lines; its cell spans both rows, so the detail stays under the label. */
@media (min-width: 1280px) and (max-width: 1439.98px) {
  .activity td.when {
    grid-row: 1 / 3;
  }
}

/* 640 to 1279 px: each row is a record in three columns: what happened; who, where
   and the decision; when and how long. */
@media (max-width: 1279.98px) {
  /* Under 1280 px a quarter of the room cannot hold the longest state line: two by two. */
  .counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .counts > a:nth-child(odd) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .activity,
  .activity tbody,
  .activity td {
    display: block;
  }

  .activity thead {
    display: none;
  }

  /* No head to say the zone, so the cell says it. */
  .activity .unit {
    display: inline;
  }

  .activity tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 264px) 104px;
    column-gap: var(--s5);
    padding-block: var(--s3) 11px;
    border-block-end: 1px solid var(--line);
  }

  .activity tbody tr:first-child {
    border-block-start: 1px solid var(--ink);
  }

  .activity td,
  .activity td.num {
    padding: 0;
    border: 0;
  }

  .activity td:empty {
    display: none;
  }

  .activity td.what {
    grid-column: 1;
    grid-row: 1 / span 3;
  }

  .activity td.user {
    grid-column: 2;
    grid-row: 1;
  }

  .activity td.where {
    grid-column: 2;
    grid-row: 2;
  }

  .activity td.decision {
    grid-column: 2;
    grid-row: 3;
  }

  .activity td.when {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .activity td.duration {
    grid-column: 3;
    grid-row: 3;
    text-align: start;
  }
}

@media (max-width: 639.98px) {
  h1 {
    font-size: 28px;
    line-height: 32px;
  }

  h1 > .title-line > .title-name {
    font-size: 26px;
  }

  .dest {
    font-size: 28px;
    line-height: 32px;
  }

  /* A title that is an address: between the phone title and h2, so it breaks less. */
  .title-id {
    font-size: 24px;
    line-height: 28px;
  }

  .page-head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "crumb"
      "title"
      "under"
      "actions";
  }

  .page-head > .head-actions {
    margin-block-start: var(--s4);
  }

  .fields,
  .fields[data-cols="2"],
  .fields[data-cols="2-1"],
  .fields[data-cols="1-2"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: var(--s5);
  }

  .field {
    grid-row: auto;
    grid-template-rows: auto auto auto;
  }

  .fields[data-cols="2-1"] > .field + .field {
    max-inline-size: none;
  }

  /* One column: a header's name wraps at the field's edge. */
  [data-values-server] .field > label {
    inline-size: auto;
    max-inline-size: 100%;
  }

  .checks[data-cols="2"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .check {
    min-block-size: 44px;
  }

  .check > input {
    margin-block: 10px;
  }

  .check > label {
    padding-block: var(--s3);
  }

  .check > .hint {
    margin-block-start: calc(var(--s2) * -1);
    padding-block-end: var(--s2);
  }

  .filters {
    grid-auto-flow: row;
    grid-template-rows: none;
    grid-template-columns: minmax(0, 1fr);
    inline-size: 100%;
  }

  .filters > select {
    margin-block-end: var(--s3);
  }

  .filters > button {
    grid-row: auto;
  }

  .form-actions > button {
    flex: 1;
  }

  /* One count to a row: the longest state line needs the whole width. */
  .counts {
    grid-template-columns: minmax(0, 1fr);
  }

  .counts > a,
  .counts > a:nth-child(even) {
    padding: var(--s3) 0;
    border-inline-start: 0;
  }

  .range {
    line-height: 20px;
  }

  /* Under 640 px the log is one column: the label with its duration, then the rest. */
  .activity tr {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--s4);
  }

  .activity td.user,
  .activity td.where,
  .activity td.decision,
  .activity td.when {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .activity td.what {
    grid-column: 1;
    grid-row: 1;
  }

  .activity td.duration {
    grid-column: 2;
    grid-row: 1;
  }

  .activity td.user {
    margin-block-start: var(--s1);
  }

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

  .provider > summary > .state {
    font-size: 13px;
  }
}

/* ---------- Moving between pages ---------- */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  html {
    scroll-behavior: smooth;
  }
}

.site {
  view-transition-name: door;
}

.brand {
  view-transition-name: brand;
}

.nav-mark {
  view-transition-name: nav-mark;
}

/* The note of a card page and the rail links leave with the door: the leaving side is gone
   by 30% of the move and the arriving side starts at 60%, so they never show through. */
.site-note {
  view-transition-name: door-note;
}

.site nav {
  view-transition-name: door-nav;
}

main {
  view-transition-name: room;
}

/* The page behind the door and the room does not cross-fade: the new one is simply
   there, so no grey band shows between the two moving edges. */
::view-transition-old(root) {
  animation: none;
  opacity: 0;
}

::view-transition-new(root) {
  animation: none;
}

::view-transition-group(door) {
  background: var(--door);
}

::view-transition-group(door),
::view-transition-group(room) {
  animation-duration: var(--t-page);
  animation-timing-function: var(--ease-move);
}

::view-transition-group(nav-mark),
::view-transition-group(door-nav),
::view-transition-group(door-note) {
  animation-duration: var(--t-mid);
  animation-timing-function: var(--ease-out);
}

::view-transition-old(door-note):only-child,
::view-transition-old(door-nav):only-child {
  animation: room-out calc(var(--t-page) * 0.3) ease-in both;
}

::view-transition-new(door-note):only-child,
::view-transition-new(door-nav):only-child,
::view-transition-new(nav-mark):only-child {
  animation: door-text-in calc(var(--t-page) * 0.4) var(--ease-out) calc(var(--t-page) * 0.6) both;
}

/* Snapshots are cropped, never stretched, while the door changes width. */
::view-transition-old(door),
::view-transition-new(door),
::view-transition-old(room),
::view-transition-new(room) {
  inline-size: 100%;
  block-size: 100%;
  object-fit: none;
  object-position: left top;
  overflow: clip;
}

/* The room is cropped at the door's edge only. Its box is never shorter than the window,
   so a page taller than the one before is not cut along a line that travels down. */
::view-transition-old(room),
::view-transition-new(room) {
  block-size: max(100%, 100vb);
  mix-blend-mode: plus-lighter;
}

/* One dissolve: the old room leaves while the new one arrives, on the same curve, and the
   two add up, so the column is never empty and what both pages share stands still. */
::view-transition-old(room) {
  animation: room-out var(--t-fast) var(--ease-out) both;
}

::view-transition-new(room) {
  animation: room-in var(--t-fast) var(--ease-out) both;
}

@keyframes room-out {
  to {
    opacity: 0;
  }
}

@keyframes door-text-in {
  from {
    opacity: 0;
  }
}

@keyframes room-in {
  from {
    opacity: 0;
  }
}

/* Forced colours drop backgrounds, so the marks are redrawn in the text colour. */
@media (forced-colors: active) {
  .state::before,
  .notice::before,
  .notice > .local-app + p::before,
  .event[data-tone]::before,
  .field-error::before,
  h1[data-tone="bad"]::before,
  .nav-mark,
  body[data-layout="card"] .site::after,
  input[type="checkbox"]::before,
  input[type="checkbox"]::after {
    forced-color-adjust: none;
    border-color: CanvasText;
  }

  .state[data-tone="ok"]::before,
  .state[data-tone="bad"]::before,
  .notice[data-notice="ok"]::before,
  .notice[data-notice="error"]::before,
  .event[data-tone="bad"]::before,
  .field-error::before,
  h1[data-tone="bad"]::before,
  .nav-mark,
  body[data-layout="card"] .site::after,
  input[type="checkbox"]:checked::before {
    background: CanvasText;
  }

  input[type="checkbox"]::after {
    background: Canvas;
  }

  .site {
    border-inline-end: 1px solid CanvasText;
  }
}

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

  button:active,
  .button:active {
    transform: none;
  }
}
