/* MAAAW admin. The look of maaaw.dk (MAW_WebPagez, src/index.css): light and
   monochrome, Bebas Neue titles, DM Sans text, JetBrains Mono for numbers,
   ids and labels. Token names are the website's, so a change there maps 1:1.
   No script and no style attributes: the CSP allows this file and the fonts. */

/* ─── Fonts (self-hosted, GET /static/fonts/<name>) ────────────────────── */

@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/bebas-neue-latin.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: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/bebas-neue-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/static/fonts/dm-sans-latin.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: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/static/fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ─── Tokens ────────────────────────────────────────────────────────────── */

:root {
  /* maaaw.dk @theme, same names and values. */
  --color-bg: #ffffff;
  --color-bg-elevated: #f7f7f6;
  --color-fg: #111111;
  --color-accent: #111111;
  --color-accent-soft: rgba(17, 17, 17, 0.06);
  --color-border: rgba(0, 0, 0, 0.07);
  --color-border-strong: rgba(0, 0, 0, 0.14);
  --color-muted: rgba(17, 17, 17, 0.6);
  --color-dim: rgba(17, 17, 17, 0.4);
  --color-faint: rgba(17, 17, 17, 0.12);
  --color-grid: rgba(0, 0, 0, 0.035);

  --font-heading: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-cta: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-surface:
    0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-paper:
    0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.04);
  --ease-smooth: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Admin only: the one status tone the site does not need. 5.9:1 on white,
     5.4:1 on its soft fill. Failing is near-black inverted, not a colour. */
  --color-warn: #8a5a00;
  --color-warn-soft: #fbf6ea;
  --color-warn-line: rgba(138, 90, 0, 0.28);

  /* Chart series, monochrome: solid black, mid grey (3.4:1), outline, light. */
  --series-0: var(--color-fg);
  --series-1: #8a8a88;
  --series-2: var(--color-bg);
  --series-3: #d6d6d3;

  color-scheme: light;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-elevated);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--color-faint);
  color: var(--color-fg);
}

a {
  color: var(--color-fg);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: var(--color-fg);
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.scroll:focus-visible {
  outline: 2px solid var(--color-fg);
  outline-offset: 2px;
}

code,
time,
kbd {
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}

code {
  overflow-wrap: anywhere;
}

strong {
  font-weight: 600;
}

/* ─── Header ────────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--color-border);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 2rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.75rem 2.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-fg);
  text-decoration: none;
  flex-shrink: 0;
}

a.brand:hover .mark {
  opacity: 0.75;
}

.mark {
  display: block;
  width: 27px;
  height: 36px;
  color: var(--color-fg);
  transition: opacity 0.2s ease;
}

.mark .mark-bar {
  stroke: var(--color-faint);
}

.brand .rule {
  width: 1px;
  height: 20px;
  background: var(--color-border-strong);
}

.words {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wordmark {
  font-family: var(--font-heading);
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.06em;
}

.descriptor {
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  /* Muted, not dim: 8.5px type needs the 4.5:1 of muted. */
  color: var(--color-muted);
}

.top nav {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.top nav a {
  position: relative;
  padding: 0.5rem 0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--color-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* The site's hairline between nav items. */
.top nav a + a {
  margin-left: 2.5rem;
}

.top nav a + a::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 50%;
  width: 1px;
  height: 12px;
  margin-top: -6px;
  background: var(--color-border-strong);
}

.top nav a:hover,
.top nav a[aria-current="page"] {
  color: var(--color-fg);
}

.top nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.15rem;
  height: 1.5px;
  background: var(--color-fg);
}

.logout {
  margin-left: auto;
}

/* ─── Page ──────────────────────────────────────────────────────────────── */

main {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 4rem;
  flex: 1;
}

h1 {
  margin: 0 0 1.5rem;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(2.5rem, 4.4vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h2 {
  margin: 2.5rem 0 0.875rem;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h2 code {
  font-family: inherit;
  font-size: inherit;
}

/* Sub-headings inside a card: the site's mono label, with its short rule. */
h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.75rem 0 0.625rem;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

h3::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--color-faint);
}

p {
  margin: 0.75rem 0;
}

/* A card, as .surface on the site. */
section.app {
  margin-top: 1.25rem;
  padding: 0.25rem 1.5rem 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-surface);
  min-width: 0;
}

section.app > h2:first-child {
  margin-top: 1.25rem;
}

/* ─── Stats ─────────────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.stats div {
  min-width: 0;
  padding: 0.75rem 0.875rem 0.8rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.stats dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.stats dd {
  margin: 0.375rem 0 0;
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stats dd a {
  text-decoration-color: var(--color-faint);
}

.stats dd code {
  font-size: 0.8em;
  letter-spacing: 0;
}

.stats dd .badge {
  vertical-align: 0.2em;
}

.stats dd.note {
  margin-top: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--color-muted);
}

/* The overview's trend strip: white tiles on the grey page. */
.strip div {
  background: var(--color-bg);
  box-shadow: var(--shadow-surface);
}

.strip dd.spark-cell {
  margin-top: 0.5rem;
}

/* ─── Tables ────────────────────────────────────────────────────────────── */

/* Wide tables scroll inside their frame, never the page. */
.scroll {
  /* Contains visually hidden labels, which are absolutely positioned. */
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}

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

caption {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
}

th,
td {
  padding: 0.55rem 0.875rem;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

thead th {
  padding-top: 0.625rem;
  padding-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: var(--color-bg-elevated);
  border-bottom-color: var(--color-border-strong);
}

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

tbody tr:hover > * {
  background: var(--color-accent-soft);
}

tbody th {
  font-weight: 500;
}

td time,
td code {
  font-size: 12.5px;
}

td time {
  color: var(--color-muted);
}

/* Portal ids leading a row are ids, so mono: "111" must not read as "Ill". */
:is(td, th):first-child > a[href^="/portals/"] {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

thead .num {
  font-size: 10px;
}

td.error,
td.scopes {
  white-space: normal;
  min-width: 16rem;
  overflow-wrap: anywhere;
  font-size: 13px;
}

td.error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
}

/* ─── Status ────────────────────────────────────────────────────────────── */

/* The site's mono tag. Neutral is "fine", warn is the one tone, fail inverts. */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-fg);
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
}

.badge.warn {
  color: var(--color-warn);
  background: var(--color-warn-soft);
  border-color: var(--color-warn-line);
}

.badge.fail {
  color: var(--color-bg);
  background: var(--color-fg);
  border-color: var(--color-fg);
  font-weight: 600;
}

.warn {
  color: var(--color-warn);
  font-weight: 600;
}

.ok {
  color: var(--color-fg);
}

p.ok {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* A short check stroke drawn in CSS, so "all clear" reads at a glance. */
p.ok::before {
  content: "";
  flex: none;
  width: 10px;
  height: 5px;
  margin-top: -3px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

.muted,
.count {
  color: var(--color-muted);
}

.count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footnote {
  max-width: 72ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-muted);
}

.empty {
  margin: 0.5rem 0;
  padding: 0.875rem 1rem;
  font-size: 14px;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
}

/* Needs attention: one list, broken first. Each line: what, then where to go. */
.alerts {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-surface);
  overflow: hidden;
}

.alerts li {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.7rem 1rem 0.7rem 0.875rem;
  font-size: 14px;
  border-left: 3px solid var(--color-warn);
}

.alerts li.sev-fail {
  border-left-color: var(--color-fg);
}

.alerts li + li {
  border-top: 1px solid var(--color-border);
}

.alerts .badge {
  justify-self: start;
}

.alerts strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}

.alerts .do {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem 0.75rem;
  font-size: 13px;
  white-space: nowrap;
}

.alerts .do a {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.alerts .do a::after {
  content: " →";
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}

.section-head .count {
  margin: 0;
}

/* The first section sits right under the page title. */
main > h1 + section > h2:first-child,
main > h1 + section > .section-head h2 {
  margin-top: 0;
}

.notice {
  padding: 0.625rem 0.875rem;
  font-size: 14px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}

.notice.warn {
  font-weight: 400;
  color: var(--color-fg);
  background: var(--color-warn-soft);
  border-color: var(--color-warn-line);
  border-left: 3px solid var(--color-warn);
}

/* ─── Controls ──────────────────────────────────────────────────────────── */

button,
select,
input {
  font: inherit;
  font-size: 14px;
  min-height: 2.5rem;
  border-radius: var(--radius-sm);
}

/* .btn-primary on the site. */
button {
  padding: 0.5rem 1.25rem;
  font-weight: 600;
  color: var(--color-bg);
  background: var(--color-fg);
  border: 1.5px solid var(--color-fg);
  box-shadow: var(--shadow-cta);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

button:hover {
  color: var(--color-fg);
  background: transparent;
}

/* .btn-outline on the site. */
.logout button,
.filter button {
  min-height: 2.125rem;
  padding: 0.375rem 0.875rem;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-fg);
  background: transparent;
  border: 1px solid var(--color-border-strong);
  box-shadow: none;
}

.logout button:hover,
.filter button:hover {
  background: var(--color-accent-soft);
  border-color: var(--color-fg);
}

select,
input {
  padding: 0.4rem 0.75rem;
  color: var(--color-fg);
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
}

select:hover,
input:hover {
  border-color: var(--color-dim);
}

label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
}

.filter input,
.filter select {
  min-height: 2.125rem;
  max-width: 100%;
}

.pager {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Funnel: the install-window links, as small mono tabs. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 12px;
}

.tabs a {
  padding: 0.3rem 0.7rem;
  color: var(--color-muted);
  text-decoration: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.tabs a:hover {
  color: var(--color-fg);
  border-color: var(--color-fg);
}

.tabs a[aria-current="page"] {
  color: var(--color-bg);
  background: var(--color-fg);
  border-color: var(--color-fg);
}

/* ─── Login and signed-out pages ────────────────────────────────────────── */

/* The site's faint 48px grid, behind one paper card. */
body.gate {
  background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 48px 48px;
}

.login {
  flex: none;
  width: calc(100% - 2rem);
  max-width: 25rem;
  margin: 14vh auto 3rem;
  padding: 2rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
}

.login .brand {
  margin-bottom: 2rem;
}

.login h1 {
  margin-bottom: 1rem;
  font-size: 2.75rem;
}

.login form {
  display: grid;
  gap: 0.5rem;
}

.login form button {
  margin-top: 0.75rem;
  min-height: 2.75rem;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.25rem 2.5rem 2rem;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.foot .wordmark {
  font-size: 18px;
  color: var(--color-muted);
}

/* ─── Charts: server-rendered SVG, monochrome ───────────────────────────── */

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 0.5rem 2rem;
}

.chart {
  margin: 1.25rem 0 0;
  min-width: 0;
  max-width: 42rem;
}

.chart figcaption {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.5rem;
}

.chart .grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.chart .axis,
.spark .axis {
  stroke: var(--color-border-strong);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart .axis-label {
  fill: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .dot {
  stroke: var(--color-bg);
  stroke-width: 1;
}

.line.s0 {
  stroke: var(--series-0);
}

.line.s1 {
  stroke: var(--series-1);
}

.line.s2 {
  stroke: var(--color-fg);
  stroke-dasharray: 6 4;
}

.line.s3 {
  stroke: var(--series-1);
  stroke-dasharray: 2 4;
}

.bar.s0,
.dot.s0,
.swatch.s0 {
  fill: var(--series-0);
  background: var(--series-0);
}

.bar.s1,
.dot.s1,
.swatch.s1 {
  fill: var(--series-1);
  background: var(--series-1);
}

.bar.s2,
.dot.s2,
.swatch.s2 {
  fill: var(--series-2);
  background: var(--series-2);
  stroke: var(--color-fg);
  stroke-width: 1;
}

.bar.s3,
.dot.s3,
.swatch.s3 {
  fill: var(--series-3);
  background: var(--series-3);
  stroke: var(--series-1);
  stroke-width: 1;
}

.swatch.s2 {
  box-shadow: inset 0 0 0 1px var(--color-fg);
}

.swatch.s3 {
  box-shadow: inset 0 0 0 1px var(--series-1);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.375rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.4rem;
  border-radius: 2px;
  vertical-align: -1px;
}

.data {
  margin-top: 0.5rem;
}

.data summary {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  cursor: pointer;
}

.data summary:hover,
.data[open] summary {
  color: var(--color-fg);
}

.data .scroll {
  margin-top: 0.5rem;
  max-height: 24rem;
  overflow-y: auto;
}

.data tbody th {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--color-fg);
}

.spark {
  display: block;
  width: 100%;
  max-width: 8rem;
  height: 1.75rem;
}

/* ─── Support: scopes and the copyable summary ──────────────────────────── */

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scope-list code {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

textarea.summary {
  display: block;
  width: 100%;
  padding: 0.75rem 0.875rem;
  color: var(--color-fg);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: 12.5px/1.6 var(--font-mono);
  resize: vertical;
}

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

/* ─── Navigation aids ───────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.875rem;
  font-size: 14px;
  color: var(--color-bg);
  background: var(--color-fg);
  border-radius: var(--radius-sm);
}

.skip:focus {
  top: 0.75rem;
}

main:focus {
  outline: none;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.crumbs li + li::before {
  content: "/";
  margin: 0 0.625rem;
  color: var(--color-dim);
}

.crumbs a {
  color: var(--color-muted);
}

.crumbs a:hover {
  color: var(--color-fg);
}

.next {
  font-size: 14px;
}

h2.divider {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-strong);
}

/* A number with its qualifier underneath: "92.3%" over "(below 95%)". */
.stats dd small {
  display: block;
  margin-top: 0.125rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
}

.stats.key dd:first-of-type {
  font-size: 1.75rem;
}

.stats.key dd.note {
  margin-top: 0.375rem;
}

/* Ids leading a row read left to right, like the text they are. */
td.id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Long tables: the frame scrolls, the column names stay. Wide screens only:
   on a phone a scroll box inside the page scroll is a trap. */
@media (min-width: 56.01rem) {
  .scroll.tall {
    max-height: min(75vh, 48rem);
    overflow: auto;
  }
}

.scroll.tall thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--color-border-strong);
}

/* Shadows at the edges show that a table scrolls sideways (a CSS-only cue). */
.scroll {
  background:
    linear-gradient(to right, var(--color-bg) 30%, transparent) left / 2rem 100%
      no-repeat local,
    linear-gradient(to left, var(--color-bg) 30%, transparent) right / 2rem 100%
      no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.14), transparent)
      left / 0.75rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.14), transparent)
      right / 0.75rem 100% no-repeat scroll,
    var(--color-bg);
}

.chart .plot {
  max-width: 100%;
}

/* Charts beside each other share a top line: caption, legend, plot. */
.charts .chart {
  display: flex;
  flex-direction: column;
}

.charts .chart .plot {
  margin-top: auto;
}

/* A note that only matters when columns are hidden (narrow-hide, below). */
.narrow-only {
  display: none;
}

/* ─── Small screens (down to 390px) ─────────────────────────────────────── */

@media (max-width: 56rem) {
  .topbar {
    flex-wrap: wrap;
    padding: 0.625rem 1rem 0;
  }

  /* Brand and log out on one line; the sections on the next, scrolling
     sideways inside the header if they ever outgrow it. */
  .top nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -1rem;
    padding: 0 1rem;
    border-top: 1px solid var(--color-border);
  }

  .top nav a {
    padding: 0.7rem 0;
    font-size: 13px;
  }

  .top nav a + a {
    margin-left: 1.125rem;
  }

  .top nav a + a::before {
    left: -0.5625rem;
  }

  .top nav a[aria-current="page"]::after {
    bottom: 0;
  }

  main {
    padding: 1.75rem 1rem 3rem;
  }

  .foot {
    padding: 1rem 1rem 1.5rem;
  }

  section.app {
    padding: 0.125rem 1rem 1.125rem;
  }
}

@media (max-width: 40rem) {
  /* A table with ten columns keeps the six that identify the portal and its billing; the rest is on the portal's
     page. Add narrow-hide to a column that can wait. */
  .narrow-hide {
    display: none;
  }

  .narrow-only {
    display: block;
  }

  /* A table of many columns (table(..., { stack: true }), every td labelled) becomes a card per row: the label
     above or beside its value, nothing to scroll sideways. */
  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  table.stack,
  table.stack tbody,
  table.stack tr {
    display: block;
  }

  table.stack tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border-strong);
  }

  table.stack td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.5rem;
    padding: 0.25rem 0.875rem;
    border: 0;
    text-align: left;
  }

  table.stack td::before {
    flex: 0 0 7.5rem;
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--color-muted);
  }

  /* The first-column pin is for scrolling tables; a card has no sideways scroll. */
  .scroll table.stack td:first-child {
    position: static;
    box-shadow: none;
  }

  h1 {
    margin-bottom: 1.125rem;
  }

  h2 {
    font-size: 1.5rem;
  }

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

  .stats dd {
    font-size: 1.15rem;
  }

  /* The SVG scales with its box: on a phone the chart is about 0.7x its
     viewBox, so its type is set larger to land near 11px on screen. */
  .chart .tick,
  .chart .axis-label {
    font-size: 15px;
  }

  /* Half the x labels on a phone, so the larger type never collides; the
     data table under each chart has every value. */
  .chart .tick.alt {
    display: none;
  }

  /* Category names (funnel steps) are long and all shown: keep them smaller. */
  .chart .categories .tick {
    font-size: 13px;
  }

  .chart .axis-label {
    letter-spacing: 0.02em;
  }

  /* Needs attention stacks: badge and text, then the links. */
  .alerts li {
    grid-template-columns: 4.25rem minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
  }

  .alerts .do {
    grid-column: 2;
    justify-content: flex-start;
  }

  /* The first column (an id or a name) stays put while the rest scrolls. */
  .scroll :is(td, th):first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--color-bg);
    box-shadow: inset -1px 0 0 var(--color-border);
  }

  .scroll thead th:first-child {
    z-index: 2;
    background: var(--color-bg-elevated);
  }

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

  .login {
    margin-top: 8vh;
    padding: 1.5rem;
  }
}

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

@media (forced-colors: active) {
  .bar,
  .dot,
  .swatch {
    fill: CanvasText;
    background: CanvasText;
  }

  .line {
    stroke: CanvasText;
  }

  .badge.fail {
    forced-color-adjust: none;
    color: Canvas;
    background: CanvasText;
  }
}
