/* host-setup-panel: one stylesheet, no external asset, no inline style.
   tokens first, then layout, then components. light by default, dark by
   prefers-color-scheme. */

:root {
  color-scheme: light dark;

  /* type */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --fs-2xs: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.875rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --lh: 1.5;
  --tracking-caps: 0.07em;

  /* space, on a 4 px grid */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  /* shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --page-max: 84rem;

  /* colour, light */
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #efeee9;
  --ink: #16181d;
  --ink-2: #474c57;
  --ink-3: #62676f;
  --line: #e3e1da;
  --line-strong: #cbc8bf;
  /* the border of a form field, at least 3:1 against the surface and the page */
  --field-border: #858b95;
  --row-hover: #f7f6f1;
  --accent: #0b6b72;
  --accent-hover: #095a60;
  --accent-ink: #ffffff;
  --accent-soft: #e0efef;
  --focus: #0b6b72;
  --code-bg: #f6f5f1;

  --ok: #17703f;
  --ok-bg: #e5f3ea;
  --warn: #8f5300;
  --warn-bg: #fcf0d9;
  --bad: #b42318;
  --bad-bg: #fde8e5;
  --info: #2556b0;
  --info-bg: #e6edfb;
  --neutral: #575c67;
  --neutral-bg: #ecebe6;

  --chrome: #15181d;
  --chrome-2: #1e2229;
  --chrome-ink: #ecebe6;
  --chrome-muted: #9ca2ad;
  --chrome-accent: #5cc9c1;

  --shadow: 0 1px 2px rgb(20 22 28 / 0.05), 0 1px 1px rgb(20 22 28 / 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --surface: #16191e;
    --surface-2: #1b1f25;
    --surface-3: #22262d;
    --ink: #e8e6e0;
    --ink-2: #a9aeb8;
    --ink-3: #8b919a;
    --line: #282d34;
    --line-strong: #3a4049;
    --field-border: #6b717b;
    --row-hover: #1c2026;
    --accent: #4fc2ba;
    --accent-hover: #6fd3cc;
    --accent-ink: #0a1a1b;
    --accent-soft: #143130;
    --focus: #6fd3cc;
    --code-bg: #121519;

    --ok: #5fd49f;
    --ok-bg: #112d1f;
    --warn: #f2b85a;
    --warn-bg: #32260f;
    --bad: #ff8b7c;
    --bad-bg: #391714;
    --info: #94b6ff;
    --info-bg: #15223b;
    --neutral: #a9aeb8;
    --neutral-bg: #23272e;

    --chrome: #0a0c0f;
    --chrome-2: #14171c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

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

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

html {
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
/* the top bar is dark in both themes: the page's focus colour does not show on it */
.top :focus-visible { outline-color: var(--chrome-accent); }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 650; overflow-wrap: anywhere; }
h2 { font-size: var(--fs-lg); font-weight: 620; }
h3 { font-size: var(--fs-md); font-weight: 620; }
p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

code, .mono, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-ligatures: none;
}

.mono { overflow-wrap: anywhere; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

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

/* ---------------------------------------------------------------- chrome */

.top {
  background: var(--chrome);
  color: var(--chrome-ink);
  border-bottom: 2px solid var(--chrome-accent);
}

.top-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--chrome-ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { color: #fff; }

/* the mark: a host rack of three units, drawn in CSS */
.brand-mark {
  width: 18px; height: 18px;
  border-radius: 3px;
  background:
    linear-gradient(var(--chrome-accent) 0 0) 3px 4px / 12px 2px no-repeat,
    linear-gradient(var(--chrome-accent) 0 0) 3px 8px / 8px 2px no-repeat,
    linear-gradient(var(--chrome-accent) 0 0) 3px 12px / 10px 2px no-repeat,
    var(--chrome-2);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.nav {
  display: flex;
  gap: var(--sp-1);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  color: var(--chrome-muted);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 520;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  white-space: nowrap;
}
.nav a:hover { color: var(--chrome-ink); background: var(--chrome-2); }
.nav a[aria-current="page"] { color: var(--chrome-ink); background: var(--chrome-2); box-shadow: inset 0 -2px 0 var(--chrome-accent); }

.logout {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  white-space: nowrap;
}

.who { color: var(--chrome-ink); font-size: var(--fs-md); }

.role {
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--chrome-accent);
  border: 1px solid color-mix(in srgb, var(--chrome-accent) 45%, transparent);
  border-radius: 999px;
  padding: 1px var(--sp-2);
}

.logout button {
  background: transparent;
  color: var(--chrome-muted);
  border: 1px solid var(--chrome-2);
  min-height: 2rem;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}
.logout button:hover { color: var(--chrome-ink); border-color: var(--chrome-muted); background: var(--chrome-2); }

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

main {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-7);
  min-width: 0;
}

.titlebar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.titlebar > div { min-width: 0; }

.eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
  margin-bottom: var(--sp-1);
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }

.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.lede { color: var(--ink-2); max-width: 46rem; }

section, .block { margin-top: var(--sp-6); }
section.first { margin-top: 0; }
section > h2, .block > h2, .section-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.section-head h2 { margin: 0; }
.section-head .hint { flex-basis: 100%; }

.count {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 0 var(--sp-2);
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--sp-4); align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-4) var(--sp-5);
  min-width: 0;
}
.card + .card, .card + .alert, .alert + .card { margin-top: var(--sp-4); }
.card > h2, .card > h3 { margin-bottom: var(--sp-3); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

/* ---------------------------------------------------------------- facts */

dl.facts {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
  gap: var(--sp-2) var(--sp-5);
  margin: 0;
}
dl.facts dt { color: var(--ink-3); font-size: var(--fs-sm); padding-top: 1px; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* the cells draw the lines between them, so a row that is not full leaves
   no gap of another colour */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 0;
}
.stats > div { padding: var(--sp-3) var(--sp-4); min-width: 0; box-shadow: -1px -1px 0 var(--line); }
.stats dd .mono { font-size: var(--fs-md); font-weight: 500; }
.stats dt { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-3); font-weight: 600; }
.stats dd { margin: var(--sp-1) 0 0; font-size: var(--fs-lg); font-weight: 600; overflow-wrap: anywhere; }
.stats dd.mono { font-size: var(--fs-md); font-weight: 500; }

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

.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: clip;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow-x: auto;
  max-width: 100%;
}

table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-md); }

th {
  text-align: left;
  font-size: var(--fs-2xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
  background: var(--surface-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: bottom;
}

.table-card th { position: sticky; top: 0; z-index: 1; }

td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  min-width: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--row-hover); }
td.num, th.num { text-align: right; }
/* a long id widens its column rather than breaking mid-word, as long as
   the table has room */
td.mono { overflow-wrap: break-word; }
td.primary a { font-weight: 600; text-decoration: none; }
td.primary a:hover { text-decoration: underline; }

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
  padding: 0 0.6em 0 0.5em;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--neutral);
  background: var(--neutral-bg);
}

/* the shape says the tone without colour: dot ok, triangle in progress,
   square refused, diamond info, ring neutral */
.pill::before {
  content: "";
  width: 0.55em;
  height: 0.55em;
  flex: none;
  background: currentColor;
}
.tone-ok { color: var(--ok); background: var(--ok-bg); }
.tone-ok::before { border-radius: 50%; }
.tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-warn::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 0.65em; }
.tone-bad { color: var(--bad); background: var(--bad-bg); }
.tone-bad::before { border-radius: 1px; }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-info::before { transform: rotate(45deg) scale(0.85); }
.tone-neutral::before { background: transparent; border: 1.5px solid currentColor; border-radius: 50%; }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 0 var(--sp-1);
  overflow-wrap: anywhere;
}

.newer {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--info);
  white-space: nowrap;
}
.newer::before { content: "\2191"; font-weight: 700; }

/* ---------------------------------------------------------------- notices */

.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--neutral);
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow);
}
.alert .code { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-3); margin: var(--sp-1) 0 0; }
.alert .problems + .code { margin-top: var(--sp-3); }
.alert-bad, .problem { border-left-color: var(--bad); }
.alert-bad > strong:first-child, .problem > strong:first-child { color: var(--bad); }
.alert-ok, .ok { border-left-color: var(--ok); }
.alert-info { border-left-color: var(--info); }
.alert-warn { border-left-color: var(--warn); }

.problem, .ok {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-3) var(--sp-4);
}
.problem { border-left-color: var(--bad); }
.ok { border-left-color: var(--ok); }

.violations {
  list-style: none;
  margin: 0 0 var(--sp-5);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.violations li { padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--line); color: var(--bad); }
.violations li:first-child { border-top: 0; }
.violations .code { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-3); margin-right: var(--sp-2); }

.refused { color: var(--bad); }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  text-align: center;
  color: var(--ink-3);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.empty strong { display: block; color: var(--ink-2); margin-bottom: var(--sp-1); }

/* message pages: refusals, sign-in problems, sign-out */
body.is-message main { max-width: 36rem; padding-top: 12vh; }
body.is-message .titlebar { margin-bottom: var(--sp-3); }
.status-code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}
.status-code strong { color: var(--bad); font-weight: 650; }
.message-body { color: var(--ink-2); font-size: var(--fs-base); }
.message-body form, .message-body .actions { margin-top: var(--sp-4); }

/* ---------------------------------------------------------------- forms */

form.stack { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 40rem; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
legend {
  font-size: var(--fs-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
  padding: 0 var(--sp-2);
  margin-left: calc(-1 * var(--sp-2));
}

label { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 520; margin-top: var(--sp-2); }
label:first-of-type { margin-top: 0; }
label.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 450;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 0;
  cursor: pointer;
}
label.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.choice input { margin-top: 0.25em; accent-color: var(--accent); }

input, select, textarea, button { font: inherit; font-size: var(--fs-md); }

input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]), select, textarea {
  width: 100%;
  min-height: 2.375rem;
  padding: var(--sp-2) var(--sp-3);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
}
textarea { font-family: var(--font-mono); font-size: var(--fs-sm); resize: vertical; }
/* the native control ignores padding and centres its text on some engines;
   the chevron is drawn with gradients because the csp allows no data: image */
select {
  appearance: none;
  text-align: left;
  line-height: var(--lh);
  padding-right: calc(var(--sp-3) + 1.25rem);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - var(--sp-3) - 5px) 50%, calc(100% - var(--sp-3)) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select[multiple] { background-image: none; padding-right: var(--sp-3); }
/* forced colors drop background images, so the native arrow comes back */
@media (forced-colors: active) {
  select { appearance: auto; }
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--focus) 40%, transparent); outline-offset: 0; border-color: var(--focus); }
input::placeholder { color: var(--ink-3); }

.hint { color: var(--ink-3); font-size: var(--fs-sm); margin: 0; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.375rem;
  padding: 0 var(--sp-4);
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: 1;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
form.stack > button { align-self: flex-start; }

.button.secondary, button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}
.button.secondary:hover, button.secondary:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-strong); }

button.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.danger:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
button.small { min-height: 1.875rem; padding: 0 var(--sp-3); font-size: var(--fs-sm); }

form.search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  max-width: 40rem;
}
form.search label { margin: 0; white-space: nowrap; }
form.search input { flex: 1; min-width: 0; }

form.inline { display: inline; margin: 0; }

form.pick {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
form.pick > div { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 8rem; }
form.pick label { margin: 0; }

/* Reject sits on the line of the Approve button, after the fingerprint */
.decide { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.decide > form.stack { flex: 0 1 30rem; }

/* ---------------------------------------------------------------- code */

pre {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.55;
  max-width: 100%;
}

pre.oneliner {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: var(--fs-md);
  padding: var(--sp-4) var(--sp-5);
  background: var(--chrome);
  color: var(--chrome-ink);
  border-color: var(--chrome);
  border-left: 4px solid var(--chrome-accent);
}

pre.raw { max-height: 32rem; overflow: auto; }

.code { font-family: var(--font-mono); color: var(--ink-3); }

details { min-width: 0; }
details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 560;
  list-style-position: outside;
}
details > summary:hover { color: var(--accent-hover); }
details[open] > summary { margin-bottom: var(--sp-2); }

.steps { margin: 0; padding-left: 1.25rem; color: var(--ink-2); }
.steps li + li { margin-top: var(--sp-1); }

/* ---------------------------------------------------------------- template document */

.doc {
  margin-top: var(--sp-6);
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}

.toc {
  position: sticky;
  top: var(--sp-4);
  font-size: var(--fs-sm);
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block;
  padding: var(--sp-1) var(--sp-3);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
}
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.toc .toc-title { display: block; margin-bottom: var(--sp-2); }

.doc-body > section:first-child { margin-top: 0; }
.doc-body section { scroll-margin-top: var(--sp-4); }

.layers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
.layers li { display: inline-flex; align-items: center; }
.layers li + li::before { content: "\2192"; color: var(--ink-3); margin: 0 var(--sp-2); font-family: var(--font-sans); }
.layers .tag { font-size: var(--fs-sm); }

.source {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 1px var(--sp-2);
}

/* a described value: label column, then the value */
.kv { margin: 0; display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr); }
.kv > div { display: contents; }
.kv dt, .kv dd { padding: 5px 0; border-top: 1px solid var(--line); margin: 0; min-width: 0; }
.kv > div:first-child > dt, .kv > div:first-child > dd { border-top: 0; }
.kv dt { color: var(--ink-2); font-family: var(--font-sans); font-size: var(--fs-sm); padding-right: var(--sp-4); }
.kv dt .hint { display: block; font-size: var(--fs-xs); margin-top: 2px; }
/* a hint shows once, at the field, not again for every element of a list */
.kv .kv dt .hint { display: none; }
.kv dd { font-family: var(--font-mono); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.kv .kv { border-left: 2px solid var(--line); padding-left: var(--sp-3); }
.kv .kv dt { color: var(--ink-3); }

.names { list-style: none; margin: 0 0 var(--sp-1); padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.names .tag { font-size: var(--fs-sm); padding: 1px var(--sp-2); }
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist > li { padding: 1px 0; }
.vlist > li.obj { padding: var(--sp-2) 0; border-top: 1px dashed var(--line); }
.vlist > li.obj:first-child { border-top: 0; padding-top: 0; }

.vmap { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px var(--sp-4); }
.vmap dt { color: var(--ink-2); overflow-wrap: anywhere; max-width: 22rem; }
.vmap dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* a map inside a .kv value takes its row rules; its first row needs none */
.kv .vmap > dt:first-of-type, .kv .vmap > dd:first-of-type { border-top: 0; padding-top: 0; }
.vmap dd .empty-value, .vmap dd:empty::after { color: var(--ink-3); }

.v-null { color: var(--bad); font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.v-absent, .v-empty { color: var(--ink-3); font-family: var(--font-sans); font-style: italic; }
.v-blank { color: var(--ink-3); }
.v-json { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-3); }

.card.product { margin-top: var(--sp-4); }
.card.product > h3 { font-size: var(--fs-base); }
.product-section + .product-section { margin-top: var(--sp-4); }
.product-section > h4 {
  font-size: var(--fs-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
  margin-bottom: var(--sp-1);
}

.block-list > .card { padding-top: var(--sp-3); }
.block-list > .card > .source { display: inline-block; margin-bottom: var(--sp-2); }

/* ---------------------------------------------------------------- diff */

.diff-row td { font-size: var(--fs-sm); }
.diff-old, .diff-new {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  border: 0;
  max-height: 16rem;
  overflow: auto;
}
.diff-old { background: var(--bad-bg); color: var(--ink); }
.diff-new { background: var(--ok-bg); color: var(--ink); }
/* "\2212\20" : a hex escape eats one space after it, so the space is escaped too */
.diff-old::before { content: "\2212\20"; color: var(--bad); font-weight: 700; }
.diff-new::before { content: "+\20"; color: var(--ok); font-weight: 700; }
.diff-pair > * + * { margin-top: var(--sp-1); }
/* every group's table has the same columns, so they line up down the page */
table.diff { table-layout: fixed; }
table.diff .c-change { width: 8.5rem; }
table.diff .c-where { width: 13rem; }
table.diff .c-member { width: 30%; }

/* ---------------------------------------------------------------- template edit forms */

form.edit { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 60rem; }
form.edit .fields { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }

.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field > label, .field > .label { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 520; }
.field > label .hint, .field > .label .hint { display: block; font-weight: 400; font-size: var(--fs-xs); margin-top: 2px; }
.field.has-problem input, .field.has-problem select, .field.has-problem textarea, .row.has-problem { border-color: var(--bad); }

/* a value the form keeps as stored */
.readonly {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow-wrap: anywhere;
  min-width: 0;
}
.ro {
  font-size: var(--fs-2xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 var(--sp-2);
  margin-left: var(--sp-1);
  white-space: nowrap;
}

fieldset.group {
  background: var(--surface-2);
  box-shadow: none;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  gap: var(--sp-3);
}
fieldset.group fieldset.group { background: var(--surface); }
fieldset.group > legend { color: var(--ink-2); }
fieldset.range > .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }

.row-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.row-list:empty { display: none; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.row > .field-problems { grid-column: 1 / -1; }
.row-fields { display: grid; grid-template-columns: minmax(8rem, 18rem) minmax(0, 1fr); gap: var(--sp-2) var(--sp-3); align-items: start; min-width: 0; }
.row-fields.single { grid-template-columns: minmax(0, 1fr); }
.row-fields.stack { display: flex; flex-direction: column; align-items: stretch; }
.row-fields > fieldset.group { grid-column: 1 / -1; }
/* rows of one or two inputs line up as a table: the first row's labels head
   the columns, and the later rows keep theirs for screen readers only */
@media (min-width: 761px) {
  .row + .row > .row-fields:not(.stack) > .field > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .row + .row:has(> .row-fields:not(.stack)) { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
}

.field-problems { list-style: none; margin: 0; padding: 0; color: var(--bad); font-size: var(--fs-sm); }
.field-problems li::before { content: "\25A0\20"; font-size: 0.7em; vertical-align: 0.15em; }
.problems { margin: var(--sp-2) 0 0; padding-left: 1.25rem; }
.problems li + li { margin-top: var(--sp-1); }
.problems .mono { font-weight: 600; }

/* the save stays in reach at the end of a long form */
.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- template workflow */

.workflow { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--sp-4); align-items: start; }
.workflow > .card + .card { margin-top: 0; }
.workflow form.stack { max-width: none; gap: var(--sp-2); }
.workflow form.stack > button { margin-top: var(--sp-2); }
.workflow .hint { margin-bottom: var(--sp-3); }
.section-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.card.confirm { max-width: 40rem; }
.card.confirm form { margin-top: var(--sp-4); }

.host-diff + .host-diff { margin-top: var(--sp-4); }
.host-diff h2 { font-size: var(--fs-base); overflow-wrap: anywhere; }
.host-diff .problem { margin-bottom: var(--sp-3); overflow-wrap: anywhere; }
.host-diff .table-wrap { box-shadow: none; }
.host-diff .hint { margin-top: var(--sp-2); }
.move-step { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
table.move-diff td:first-child { width: 7rem; }
/* a resource id and a JSON pointer break anywhere, so the paths stay in view */
table.move-diff td + td { overflow-wrap: anywhere; }
.secrets { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); margin-top: var(--sp-3); }
.secrets .label { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-3); }
.secrets .names li { display: inline-flex; align-items: center; gap: var(--sp-1); }
.move-confirm, .after-move, .move-back { margin-top: var(--sp-5); }
form.pick.move-pick { margin: var(--sp-3) 0 0; }
table.move-hosts td:first-child { width: 4rem; }
table.move-hosts input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
table.move-hosts label { margin: 0; color: inherit; font-size: inherit; font-weight: 600; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 1080px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .toc { position: static; }
  .toc ol { display: flex; gap: var(--sp-1); overflow-x: auto; border-left: 0; padding-bottom: var(--sp-1); scrollbar-width: thin; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 2px var(--sp-3); margin: 0; white-space: nowrap; background: var(--surface); }
  .toc a:hover { border-color: var(--accent); }
}

/* below 900 px the links, the role, the name and Sign out no longer fit one
   row with an administrator's five links */
@media (max-width: 900px) {
  .top-inner { flex-wrap: wrap; gap: 0 var(--sp-3); padding: var(--sp-2) var(--sp-4) 0; }
  /* the links wrap onto a second row rather than scroll: a hidden
     scrollbar would hide the last links with no cue */
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; overflow-x: visible; margin: var(--sp-1) calc(-1 * var(--sp-2)) 0; padding-bottom: var(--sp-1); }
  .nav a { padding: var(--sp-2); }
  /* a long name wraps, whole, rather than being cut: a touch screen shows
     no title */
  .logout { flex: 1 1 0; min-width: 0; justify-content: flex-end; flex-wrap: wrap; white-space: normal; row-gap: var(--sp-1); padding: var(--sp-1) 0; }
  .who { min-width: 0; overflow-wrap: anywhere; text-align: right; }
}

@media (max-width: 760px) {
  main { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  h1 { font-size: var(--fs-xl); }
  .card { padding: var(--sp-3) var(--sp-4); }
  fieldset { padding: var(--sp-3) var(--sp-4) var(--sp-4); }

  dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dl.facts dt { margin-top: var(--sp-3); }
  dl.facts dt:first-child { margin-top: 0; }

  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding-bottom: 0; }
  .kv dd { border-top: 0; padding-top: var(--sp-1); }
  .vmap { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .vmap dd { margin-bottom: var(--sp-2); padding-left: var(--sp-3); }

  form.search { flex-wrap: wrap; }
  form.search label { flex-basis: 100%; }

  /* lists of records turn into cards: each cell under its column label */
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-card:has(> table.cards) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.cards tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-2) var(--sp-4);
    margin-bottom: var(--sp-3);
  }
  /* the label sits in a fixed left column; the cell's own content, text and
     elements alike, flows as one block beside it */
  table.cards td {
    position: relative;
    min-height: 1.9rem;
    padding: var(--sp-1) 0 var(--sp-1) 8.25rem;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  /* a card has room for one value per line, so a long one may wrap */
  table.cards td.nowrap { white-space: normal; }
  table.cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: var(--sp-1);
    width: 7.5rem;
    font-size: var(--fs-2xs);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    color: var(--ink-3);
    padding-top: 0.2em;
  }
  table.cards td:empty { display: none; }
  table.cards td.primary { font-size: var(--fs-base); border-bottom: 1px solid var(--line); padding-bottom: var(--sp-2); margin-bottom: var(--sp-1); }
  table.diff { table-layout: auto; }
  table.cards tbody tr:hover td { background: transparent; }

  .row { grid-template-columns: minmax(0, 1fr); }
  .row > button { justify-self: start; }
  .row-fields { grid-template-columns: minmax(0, 1fr); }
  fieldset.group { padding: var(--sp-3); }
  fieldset.range > .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
