/* -----------------------------------------------------------------------------
   GMS - the interface.

   The screens are an application shell: a header that says who is signed in, a
   sidebar that maps the system, and a content panel that holds one screen at a
   time. Hierarchy comes from surface, radius, space and one accent, so a screen
   reads as a set of panels rather than as a page of prose.

   The tokens follow the design language of New API (QuantumNous): OKLCH
   surfaces, a single primary accent, a radius scale derived from one value, and
   a dark theme that is a choice rather than a guess about the desk.

   The sections below are the tokens, the base, the shell, then the pieces the
   screens are built from.
   ----------------------------------------------------------------------------- */

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

:root {
  color-scheme: light;

  /* The theme switch sets data-theme on the root element before the page paints,
     so an explicit choice and the system preference are the same code path. */
  --font-sans: "Public Sans", "Inter Variable", Inter, system-ui, -apple-system,
    "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono",
    Menlo, monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.375rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-strong: 600;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;

  /* One radius, and everything round is derived from it - which is what keeps a
     card, the fields inside it and the button beside them looking related. */
  --radius: 1rem;
  --radius-xs: calc(var(--radius) * 0.4);
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 24px -6px rgb(0 0 0 / 0.14), 0 4px 8px -4px rgb(0 0 0 / 0.08);

  --header-height: 3.5rem;
  --sidebar-width: 16rem;
  --container-width: 80rem;
  --gutter: clamp(var(--space-4), 2vw, var(--space-6));

  /* The surface ladder: canvas, card, and the raised layer a menu sits on. */
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.49 0 0);

  /* One accent, and the quiet tints that are made from it rather than declared
     beside it: a hover, an active row and a badge cannot drift apart. */
  --primary: oklch(0.692 0.141 243.716);
  --primary-foreground: oklch(1 0 0);
  --accent: color-mix(in oklch, var(--primary) 12%, var(--background));
  --ring: oklch(0.708 0.16 249.003);

  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --success: oklch(0.596 0.145 163.225);
  --warning: oklch(0.681 0.162 75.834);
  --info: oklch(0.588 0.158 241.966);

  --border: oklch(0.93 0 0);
  --input: oklch(0.93 0 0);

  --sidebar: color-mix(in oklch, var(--foreground) 0.5%, var(--background));
  --sidebar-accent: color-mix(in oklch, var(--primary) 12%, var(--background));
  --sidebar-accent-foreground: oklch(0.579 0.196 255.909);
}

/* The dark theme is the same ladder read the other way round, so a screen that
   works in daylight works at night without a second set of components. */
.dark {
  color-scheme: dark;

  --background: oklch(0.235 0 0);
  --foreground: oklch(0.965 0 0);
  --card: oklch(0.285 0 0);
  --card-foreground: oklch(0.965 0 0);
  --popover: oklch(0.305 0 0);
  --popover-foreground: oklch(0.965 0 0);
  --muted: oklch(0.305 0 0);
  --muted-foreground: oklch(0.78 0 0);

  --primary: oklch(0.54 0.142 248.516);
  --primary-foreground: oklch(1 0 0);
  --accent: color-mix(in oklch, var(--primary) 20%, var(--background));
  --ring: oklch(0.554 0.148 250.726);

  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --success: oklch(0.696 0.17 162.48);
  --warning: oklch(0.769 0.188 70.08);
  --info: oklch(0.613 0.14 239.919);

  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 17%);

  --sidebar: oklch(0.225 0 0);
  --sidebar-accent: color-mix(in oklch, var(--primary) 20%, var(--background));
  --sidebar-accent-foreground: oklch(0.9 0.05 250);

  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 12px 28px -8px rgb(0 0 0 / 0.55);
}

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

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

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

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: var(--weight-normal) var(--text-base) / 1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: color-mix(in oklch, var(--primary) 28%, transparent);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: var(--weight-strong);
  font-size: var(--text-lg);
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--sidebar-accent-foreground);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

code {
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: break-word;
}

hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* A glyph the shell draws: sized by the container it sits in, and never
   stretched by a flow that has no opinion about its size. */
.icon {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  stroke-width: 1.75;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button:not(:disabled),
[role="button"]:not(:disabled) {
  cursor: pointer;
}

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

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

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

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  inset-block-start: -3.5rem;
  z-index: 60;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: var(--text-base);
  transition: inset-block-start 120ms ease;
}

.skip-link:focus {
  inset-block-start: var(--space-3);
}

/* The shell ---------------------------------------------------------------- */

/* The window holds the application rather than the document: the header and the
   sidebar stay where they are and one panel scrolls, which is what makes a long
   list of changes feel like a screen instead of a scrollbar. */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* A caller who is not signed in has no map and no session, so the shell is the
   header and the page - and the page is what scrolls. */
.app-shell.is-bare {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.app-header {
  position: relative;
  z-index: 40;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
  padding-inline: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

@supports (backdrop-filter: blur(1px)) {
  .app-header {
    background: color-mix(in oklch, var(--background) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
  }
}

.app-header-start,
.app-header-end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.app-header-end {
  margin-inline-start: auto;
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  color: var(--foreground);
  font-weight: var(--weight-strong);
  letter-spacing: -0.015em;
}

.brand:hover {
  text-decoration: none;
  background: var(--accent);
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    var(--primary),
    color-mix(in oklch, var(--primary) 45%, oklch(0.62 0.19 300))
  );
  color: var(--primary-foreground);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* The logo an Event is presented under, where a mark would otherwise stand.
   The height is the mark's and the width follows the image, so a square
   crest and a wide wordmark both fit the header without being redrawn. */
.brand-logo {
  flex: 0 0 auto;
  width: auto;
  height: 1.875rem;
  max-width: 8rem;
  object-fit: contain;
}

.brand-logo-sm {
  height: 1.25rem;
  max-width: 6rem;
}

.brand-name {
  font-size: var(--text-lg);
}

/* What the instance is, said beside its name: one deployment runs one Event. */
.brand-context {
  padding-inline-start: var(--space-3);
  margin-inline-start: var(--space-1);
  border-inline-start: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  white-space: nowrap;
}

@media (max-width: 47.99rem) {
  .brand-context {
    display: none;
  }
}

/* The body under the header: the map on the left, the screen on the right. */
.app-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--sidebar);
}

.sidebar {
  display: flex;
  flex: 0 0 var(--sidebar-width);
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 0;
}

.sidebar-nav {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 0.125rem;
  padding: var(--space-3);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-label {
  padding: var(--space-4) var(--space-3) var(--space-1);
  color: var(--muted-foreground);
  font-size: var(--text-2xs);
  font-weight: var(--weight-strong);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav > .sidebar-label:first-child {
  padding-block-start: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.4375rem 0.6875rem;
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-item svg {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 1.75;
}

.nav-item:hover {
  background: var(--sidebar-accent);
  color: var(--foreground);
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  font-weight: var(--weight-strong);
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* The panel one screen lives in. It sits on the sidebar tint, so the map and the
   screen are told apart by surface rather than by a rule between them. */
.app-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0 var(--space-3) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page-container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding: var(--space-5) var(--gutter) var(--space-8);
}

/* The drawer a narrow screen needs, since a column beside the page cannot fit. */
.sidebar-scrim {
  display: none;
}

@media (max-width: 63.99rem) {
  .app-content {
    margin: 0 var(--space-2) var(--space-2);
    border-radius: var(--radius-md);
  }

  .sidebar {
    position: fixed;
    inset-block: var(--header-height) 0;
    inset-inline-start: 0;
    z-index: 45;
    width: min(17rem, 82vw);
    border-inline-end: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  :root[data-sidebar="open"] .sidebar {
    transform: none;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgb(0 0 0 / 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  :root[data-sidebar="open"] .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 64rem) {
  .sidebar-toggle {
    display: none;
  }
}

/* The bare shell: no map, no session, and the page scrolls as a document. */
.app-shell.is-bare .app-body {
  flex-direction: column;
  background: var(--background);
}

.app-shell.is-bare .app-content {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell.is-bare .content-scroll {
  overflow: visible;
}

/* Controls in the header --------------------------------------------------- */

/* A square control that carries one glyph: the menu, the theme, a way back. */
.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted-foreground);
  transition: background-color 120ms ease, color 120ms ease;
}

.icon-button svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 1.75;
}

.icon-button:hover {
  background: var(--accent);
  color: var(--foreground);
}

.theme-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.125rem;
  padding: 0.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
}

.theme-switch button {
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius-md) - 0.25rem);
  background: transparent;
  color: var(--muted-foreground);
}

.theme-switch button svg {
  width: 0.9375rem;
  height: 0.9375rem;
  stroke-width: 1.75;
}

.theme-switch button:hover {
  color: var(--foreground);
}

/* The active button is the one the root element says is active, so a screen
   that was rendered before the script ran still points at the right one. */
:root[data-theme="light"] .theme-switch [data-theme-value="light"],
:root[data-theme="dark"] .theme-switch [data-theme-value="dark"],
:root[data-theme="system"] .theme-switch [data-theme-value="system"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
}

/* The account menu: a summary that opens what a session can do. */
.menu {
  position: relative;
}

.menu > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.1875rem 0.5rem 0.1875rem 0.1875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
  transition: background-color 120ms ease;
}

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

.menu > summary:hover,
.menu[open] > summary {
  background: var(--accent);
}

.menu-identity {
  display: grid;
  gap: 0;
  min-width: 0;
  line-height: 1.25;
}

.menu-name {
  overflow: hidden;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-username {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

@media (max-width: 47.99rem) {
  .menu-identity {
    display: none;
  }
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--sidebar-accent-foreground);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: 0.02em;
}

.menu-panel {
  position: absolute;
  inset-block-start: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: 50;
  display: grid;
  gap: var(--space-1);
  min-width: 15rem;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-lg);
}

.menu-head {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
}

.menu-head strong {
  font-size: var(--text-base);
}

.menu-head span {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 0.4375rem 0.6875rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-align: start;
}

.menu-item svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 1.75;
  color: var(--muted-foreground);
}

.menu-item:hover {
  background: var(--accent);
  text-decoration: none;
}

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

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-block-end: var(--space-5);
}

.page-heading {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  max-width: 60ch;
}

.page-title {
  font-size: clamp(1.25rem, 1.05rem + 1vw, 1.5rem);
  font-weight: var(--weight-strong);
  line-height: 1.2;
  letter-spacing: -0.022em;
}

.page-lead {
  color: var(--muted-foreground);
  font-size: var(--text-base);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Where the screen sits in the map, above its title. */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.breadcrumb svg {
  width: 0.875rem;
  height: 0.875rem;
  stroke-width: 2;
}

.stack {
  display: grid;
  gap: var(--space-4);
}

/* Two columns on a desk, one on a phone: a screen that has a wide thing and a
   narrow thing beside it, or two halves of the same thing. */
.split {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 64rem) {
  .split {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

/* The parts of one screen, where a screen has parts ------------------------- */

/* A tab is a link rather than a control, and which part of a screen a caller is
   looking at is the address they are on: the server is what decides, so a tab
   that was rendered before any script ran still points at the right one. */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-block-end: var(--space-5);
  border-block-end: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.tab:hover {
  color: var(--foreground);
  text-decoration: none;
}

/* The part the caller is standing on: heading ink, underlined in the Event's
   second colour - which is the one place an accent is meant to be seen. */
.tab[aria-current="page"] {
  color: var(--foreground);
}

.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline: var(--space-4);
  inset-block-end: -1px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--brand-secondary, var(--primary));
}

/* Panels ------------------------------------------------------------------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-strong);
  letter-spacing: -0.01em;
}

.card-heading {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.card-description {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.card-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

.card-body {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* A grid of cards that decides its own columns: two or three on a desk, one on
   a phone, without a media query having to guess how many there should be. */
.card-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.card-grid > .card {
  display: flex;
  flex-direction: column;
}

.card-grid > .card > .card-body {
  flex: 1 1 auto;
}

/* A card that reacts to the pointer, for the grids where a card is a choice
   rather than a summary. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card-interactive {
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  }

  .card-interactive:hover {
    transform: translateY(-1px);
    border-color: color-mix(in oklch, var(--border) 60%, var(--foreground));
    box-shadow: var(--shadow-md);
  }
}

/* A group of fields that is a panel of its own. The legend carries the name for a
   screen reader and the heading carries it for a reader, because a legend cannot
   hold the description that belongs beside a title. */
.fieldset {
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* The four facts of a screen, said with a number or a word each. */
.stat-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.stat {
  display: grid;
  gap: 0.125rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.stat-label {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-strong);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.stat-value.is-empty,
.stat-value.is-text {
  color: var(--muted-foreground);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

.stat-meta {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

/* Badges ------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.0625rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.7;
  white-space: nowrap;
}

.badge svg {
  width: 0.8125rem;
  height: 0.8125rem;
  stroke-width: 2;
}

.badge-neutral {
  border-color: var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
}

.badge-primary {
  border-color: color-mix(in oklch, var(--primary) 30%, transparent);
  background: color-mix(in oklch, var(--primary) 14%, var(--background));
  color: color-mix(in oklch, var(--primary) 72%, var(--foreground));
}

.badge-success {
  border-color: color-mix(in oklch, var(--success) 30%, transparent);
  background: color-mix(in oklch, var(--success) 14%, var(--background));
  color: color-mix(in oklch, var(--success) 72%, var(--foreground));
}

.badge-warning {
  border-color: color-mix(in oklch, var(--warning) 32%, transparent);
  background: color-mix(in oklch, var(--warning) 14%, var(--background));
  color: color-mix(in oklch, var(--warning) 68%, var(--foreground));
}

.badge-destructive {
  border-color: color-mix(in oklch, var(--destructive) 30%, transparent);
  background: color-mix(in oklch, var(--destructive) 12%, var(--background));
  color: color-mix(in oklch, var(--destructive) 72%, var(--foreground));
}

.badge-code {
  border-color: var(--border);
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* A term and its value, one entry per row: what a summary panel is made of. */
.facts {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.fact {
  display: grid;
  gap: 0.125rem var(--space-4);
  align-items: baseline;
}

@media (min-width: 40rem) {
  .fact {
    grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  }
}

.fact dt {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.fact dd {
  margin: 0;
  font-size: var(--text-base);
  overflow-wrap: anywhere;
}

/* Lists -------------------------------------------------------------------- */

/* What changed, newest first: a rail with a dot per entry, so the order is
   something the eye can follow rather than something a reader has to work out. */
.timeline {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline > li {
  position: relative;
  padding-inline-start: var(--space-6);
  padding-block-end: var(--space-3);
}

.timeline > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.375rem;
  inset-block: 1.125rem 0;
  width: 1px;
  background: var(--border);
}

.timeline > li:last-child {
  padding-block-end: 0;
}

.timeline > li:last-child::before {
  display: none;
}

.timeline > li::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.375rem;
  width: 0.8125rem;
  height: 0.8125rem;
  border: 2px solid var(--card);
  border-radius: var(--radius-pill);
  background: var(--primary);
}

/* An entry that changed nothing but the record itself - an environment creating
   itself - is drawn in grey rather than in the accent. */
.timeline > li.is-system::after {
  background: var(--muted-foreground);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.timeline-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

/* The fields one entry moved, as a diff a reader can scan. */
.change-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
}

.change {
  display: grid;
  gap: 0.125rem var(--space-3);
  align-items: baseline;
  font-size: var(--text-sm);
}

@media (min-width: 40rem) {
  .change {
    grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
  }
}

.change dt {
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.change dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  min-width: 0;
}

.change-from {
  color: var(--muted-foreground);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklch, var(--muted-foreground) 60%, transparent);
}

.change-arrow {
  color: var(--muted-foreground);
}

/* A list of steps, where the order is the point, and a list of reasons, where it
   is not. Both are drawn with a marker of their own so they keep their rhythm in
   any panel they are put in. */
.steps,
.bullets {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps {
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-inline-start: var(--space-6);
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--sidebar-accent-foreground);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  line-height: 1;
}

.bullets > li {
  position: relative;
  padding-inline-start: var(--space-5);
}

.bullets > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.375rem;
  inset-block-start: 0.625rem;
  width: 0.3125rem;
  height: 0.3125rem;
  border-radius: var(--radius-pill);
  background: var(--primary);
}

/* Rows in a panel: a module, an account, one line of a table. */
.row-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row-list > li {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

.row-list > li:first-child {
  border-top: 0;
}

.row-list > li.is-quiet {
  background: color-mix(in oklch, var(--muted) 60%, var(--card));
}

.row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.row-title {
  font-size: var(--text-base);
  font-weight: var(--weight-strong);
}

.row-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-inline-start: auto;
}

.row-text {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

/* Tables: a list a reader orders, pages and scans by column. The markup is a real
   table and the library only adds the behaviour around it, so a row keeps the
   vocabulary the rows above are drawn with - the surface, the quiet row and the
   badges - and nothing here has to restate the theme. */
.table-scroll {
  overflow-x: auto;
  border-radius: inherit;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.data-table caption {
  padding: var(--space-4) var(--space-5);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  text-align: start;
}

.data-table thead th {
  position: relative;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-align: start;
  text-transform: uppercase;
  vertical-align: bottom;
  white-space: nowrap;
}

/* A heading that can be ordered keeps room for the two readings of the column. */
.data-table thead th.dt-orderable-asc,
.data-table thead th.dt-orderable-desc {
  padding-inline-end: var(--space-6);
}

.data-table .dt-column-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* Which way the column is ordered: faint until it is the column the table is
   ordered by, so a heading does not read as decoration. */
.data-table .dt-column-order {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--space-4);
  width: 0.75rem;
  height: 0.75rem;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  cursor: pointer;
}

.data-table .dt-column-order::before,
.data-table .dt-column-order::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  width: 0;
  height: 0;
  border: 0.25rem solid transparent;
  transform: translateX(-50%);
  opacity: 0.3;
}

.data-table .dt-column-order::before {
  inset-block-start: -0.125rem;
  border-bottom-color: currentColor;
}

.data-table .dt-column-order::after {
  inset-block-end: -0.125rem;
  border-top-color: currentColor;
}

.data-table th.dt-ordering-asc .dt-column-order::before,
.data-table th.dt-ordering-desc .dt-column-order::after {
  opacity: 1;
}

.data-table .dt-column-order:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* A column that cannot be ordered has no reading to show, so the empty indicator
   the library still renders is taken out of the heading rather than left as a
   control that answers nothing. */
.data-table th.dt-orderable-none .dt-column-order {
  display: none;
}

.data-table tbody td {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  vertical-align: top;
}

@media (hover: hover) {
  .data-table tbody tr:hover {
    background: color-mix(in oklch, var(--muted) 45%, var(--card));
  }
}

/* A row the reader can see but should not choose: exactly what the list drew
   quietly before the table did. */
.data-table tbody tr.is-quiet {
  background: color-mix(in oklch, var(--muted) 60%, var(--card));
  color: var(--muted-foreground);
}

/* The second line of a cell: what belongs with the value above it without being
   a column of its own. */
.cell-note {
  display: block;
  margin-block-start: 0.125rem;
  color: var(--muted-foreground);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* A cell whose content is what may be done to the row rather than what it is. */
.cell-tools {
  text-align: end;
}

.cell-tools .row-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-inline-start: 0;
}

/* What the library draws around the rows: the length control, the count and the
   paging. It is the same surfaces, the same radius and the same control metrics as
   the rest of the shell, and what separates a band from the table is the band's own
   padding rather than a gap, so the two cannot drift apart. */
.dt-container {
  display: grid;
}

.dt-layout-row {
  /* display: flex; */
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* The bands around the table - the length control above it, the count and the
   paging below it - are drawn on the inset of the cells they line up with and on
   the card footer's own padding, so the first control sits under the first column
   rather than against the card's border. The row that holds the table is the table
   itself: it keeps the full width, and the rules of its rows stay unbroken across
   the card. */
.dt-layout-row:not(.dt-layout-table) {
  padding: var(--space-3) var(--space-5);
}

.dt-layout-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.dt-layout-end {
  justify-content: flex-end;
}

.dt-length label,
.dt-search label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
}

/* The library's controls wear the shell's metrics rather than the smaller size a
   row's own control is drawn at: the length select is the same field the filter card
   above the table offers, and a paging button is a button. */
.dt-input {
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
  font-size: var(--text-base);
  box-shadow: var(--shadow-xs);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.dt-input:hover {
  border-color: color-mix(in oklch, var(--input) 55%, var(--foreground));
}

.dt-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent);
}

select.dt-input {
  appearance: none;
  padding-inline-end: 1.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878b93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.875rem;
}

.dt-info {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.dt-paging {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.dt-paging-button {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.dt-paging-button:hover:not(.disabled):not(.current) {
  border-color: color-mix(in oklch, var(--border) 60%, var(--foreground));
  background: var(--muted);
}

.dt-paging-button.current {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-foreground);
}

.dt-paging-button.disabled {
  opacity: 0.5;
  cursor: default;
}

/* A form the row carries in a template, opened as the row's child row: it is the
   width of the table rather than of the cell the button sits in. */
.data-table tr.row-editor > td {
  padding: var(--space-5);
  background: color-mix(in oklch, var(--muted) 45%, var(--card));
}

.data-table tr.row-editor .form-grid {
  max-width: 56rem;
}

.data-table tr.row-editor .actions {
  margin-block-start: var(--space-4);
}

/* Forms -------------------------------------------------------------------- */

.form {
  display: grid;
  gap: var(--space-4);
}

.form-grid {
  display: grid;
  gap: var(--space-4) var(--space-5);
}

@media (min-width: 56rem) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field {
  display: grid;
  align-content: start;
  gap: 0.375rem;
  min-width: 0;
}

.field-pair {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 40rem) {
  .field-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field-label {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.field-hint {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.input {
  width: 100%;
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
  font-size: var(--text-base);
  box-shadow: var(--shadow-xs);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:hover:not(:disabled):not([readonly]) {
  border-color: color-mix(in oklch, var(--input) 55%, var(--foreground));
}

.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent);
}

.input[readonly],
.input:disabled {
  background: var(--muted);
  color: var(--muted-foreground);
}

.input.input-validation-error,
.input[aria-invalid="true"] {
  border-color: var(--destructive);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--destructive) 25%, transparent);
}

select.input {
  appearance: none;
  padding-inline-end: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878b93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6875rem center;
  background-size: 0.9375rem;
}

/* A select that holds several answers is a box rather than a line: the height of a field belongs to a field
   that holds one value, and the arrow belongs to a control that drops down. A browser running no script is left
   with this list, so it has to be the control it looks like. */
select.input[multiple] {
  height: auto;
  padding: 0.25rem;
  background-image: none;
}

/* A select that site.js turns into a list that narrows as the caller types. The select stays in the form -
   it is what posts - and the field and the list below it stand in for it. */
.combobox {
  position: relative;
}

.combobox-input {
  padding-inline-end: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878b93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6875rem center;
  background-size: 0.9375rem;
}

.combobox-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.25rem);
  inset-inline: 0;
  max-height: 14rem;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-lg);
  list-style: none;
}

.combobox-option {
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: var(--text-base);
  cursor: pointer;
}

.combobox-option.is-active {
  background: var(--accent);
}

.combobox-option[aria-selected="true"] {
  font-weight: var(--weight-medium);
}

.combobox-empty {
  padding: 0.375rem 0.5rem;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* The same field when its list holds several answers. The field the caller types in is a search rather than
   the answer, so the answers are drawn under it as the labels themselves, each of them removable, and an entry
   that is already chosen carries a tick beside it. */
.combobox-field {
  position: relative;
}

.combobox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.combobox-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 100%;
  padding: 0.125rem var(--space-1) 0.125rem var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--foreground);
  font-size: var(--text-sm);
}

.combobox-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-chip-remove {
  position: relative;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--muted-foreground);
}

.combobox-chip-remove:hover {
  color: var(--foreground);
}

/* The cross is drawn rather than written: a glyph would come from whichever font the host happens to have. */
.combobox-chip-remove::before,
.combobox-chip-remove::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.625rem;
  height: 1px;
  margin: -0.5px 0 0 -0.3125rem;
  background: currentColor;
}

.combobox-chip-remove::before {
  transform: rotate(45deg);
}

.combobox-chip-remove::after {
  transform: rotate(-45deg);
}

.combobox-multiple .combobox-option {
  position: relative;
  padding-inline-start: 1.875rem;
}

/* The box an entry is chosen in, and the tick on it: the same reading as a ticked list, drawn small enough to
   sit beside a label. */
.combobox-multiple .combobox-option::before {
  content: '';
  position: absolute;
  inset-inline-start: 0.625rem;
  top: 50%;
  width: 0.875rem;
  height: 0.875rem;
  margin-top: -0.4375rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-xs);
  background: var(--background);
}

.combobox-multiple .combobox-option::after {
  content: '';
  position: absolute;
  inset-inline-start: 0.9375rem;
  top: 50%;
  width: 0.25rem;
  height: 0.5rem;
  margin-top: -0.25rem;
  border-right: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(45deg);
}

.combobox-multiple .combobox-option[aria-selected="true"]::after {
  border-color: currentColor;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-base);
}

.checkbox input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0.1875rem 0 0;
  accent-color: var(--primary);
}

/* A set of answers that belong together - the choices of a form field, the declarations a reader accepts -
   wraps rather than stacking, so a short list stays one line on a wide screen. */
.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}

.choice-list .checkbox {
  flex: 0 0 auto;
}

/* An answer already recorded, shown where the field was: it is a value rather than a control, so it carries
   no input styling and no fixed height. */
.form-answer {
  margin: 0;
  padding: var(--space-2) 0;
  font-size: var(--text-base);
  color: var(--foreground);
  overflow-wrap: anywhere;
}

.field-validation-error {
  color: var(--destructive);
  font-size: var(--text-xs);
}

/* The validation helpers write these two classes; an empty message is not a line
   of the page, so it takes up no room. */
.field-validation-valid,
.validation-summary-valid {
  display: none;
}

/* A switch is a control that says which of two states a thing is in, so the
   state is drawn rather than described. It posts, because the state is stored. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.25rem 0.75rem 0.25rem 0.3125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.switch:hover {
  border-color: color-mix(in oklch, var(--border) 50%, var(--foreground));
  background: var(--accent);
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 2.125rem;
  height: 1.1875rem;
  border-radius: var(--radius-pill);
  background: var(--input);
  transition: background-color 140ms ease;
}

.switch-thumb {
  position: absolute;
  inset-block-start: 0.15625rem;
  inset-inline-start: 0.15625rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--radius-pill);
  background: var(--background);
  box-shadow: var(--shadow-sm);
  transition: translate 140ms ease;
}

.switch[aria-checked="true"] .switch-track {
  background: var(--primary);
}

.switch[aria-checked="true"] .switch-thumb {
  translate: 0.9375rem 0;
}

/* What a screen shows when there is nothing to show, said as a state rather than
   left as an absence. */
.empty {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  padding: var(--space-7) var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  text-align: center;
}

.empty svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 1.5;
}

.empty-title {
  color: var(--foreground);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}

.empty-text {
  max-width: 44ch;
  font-size: var(--text-sm);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.25rem;
  padding-inline: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease,
    box-shadow 120ms ease, transform 100ms ease;
}

.button svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 1.75;
}

.button:hover {
  text-decoration: none;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button:disabled,
.button[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-xs);
}

.button-primary:hover {
  background: color-mix(in oklch, var(--primary) 88%, var(--foreground));
}

.button-outline {
  border-color: var(--input);
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
}

.button-outline:hover {
  background: var(--accent);
}

.button-ghost {
  background: transparent;
  color: var(--foreground);
}

.button-ghost:hover {
  background: var(--accent);
}

.button-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  box-shadow: var(--shadow-xs);
}

.button-destructive:hover {
  background: color-mix(in oklch, var(--destructive) 86%, var(--foreground));
}

.button-sm {
  height: 2rem;
  padding-inline: var(--space-3);
  font-size: var(--text-sm);
}

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

/* Messages ----------------------------------------------------------------- */

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: var(--text-base);
  line-height: 1.55;
}

.alert svg {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin-block-start: 0.0625rem;
  stroke-width: 1.75;
}

.alert-title {
  font-weight: var(--weight-medium);
}

/* The validation summary arrives as a list, and it is a list inside a message. */
.alert ul {
  margin: 0;
  padding-inline-start: var(--space-4);
}

.alert-success {
  border-color: color-mix(in oklch, var(--success) 30%, transparent);
  background: color-mix(in oklch, var(--success) 10%, var(--background));
}

.alert-success svg {
  color: var(--success);
}

.alert-destructive {
  border-color: color-mix(in oklch, var(--destructive) 32%, transparent);
  background: color-mix(in oklch, var(--destructive) 9%, var(--background));
}

.alert-destructive svg {
  color: var(--destructive);
}

.alert-info {
  border-color: color-mix(in oklch, var(--info) 30%, transparent);
  background: color-mix(in oklch, var(--info) 9%, var(--background));
}

.alert-info svg {
  color: var(--info);
}

.note {
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in oklch, var(--primary) 26%, transparent);
  border-radius: var(--radius-md);
  background: var(--accent);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.footnote {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.muted {
  color: var(--muted-foreground);
}

/* The screens that are one question and one answer -------------------------- */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--header-height) - var(--space-6));
  padding-block: var(--space-6);
}

.auth-card {
  display: grid;
  gap: var(--space-5);
  width: 100%;
  max-width: 24rem;
}

.auth-head {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  text-align: center;
}

.auth-head .brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

.auth-head .brand-logo {
  height: 2.5rem;
  max-width: 12rem;
}

.auth-panel {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-md);
}

.narrow {
  display: grid;
  gap: var(--space-5);
  max-width: 32rem;
  margin-inline: auto;
}

/* The Event's own appearance, on the screen that sets it -------------------- */

/* The same shell read twice, in daylight and at night, so a brand is chosen by
   looking at both rather than by imagining the other one. The panel marked dark
   carries the dark token block, which is the whole of how the dark theme is
   built: a rule about the element, not a second stylesheet. */
.brand-previews {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 48rem) {
  .brand-previews {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.brand-preview {
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.brand-preview-frame {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
}

.brand-preview-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-preview-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* An entry of the map, which is where the second colour is read as well. */
.brand-preview-link {
  padding-inline: var(--space-3);
  color: var(--sidebar-accent-foreground);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.brand-preview-caption {
  color: var(--muted-foreground);
  font-size: var(--text-xs);
}

/* A colour is typed as the brand guide writes it, and picked when it is easier
   to look at it than to copy it: the picker writes into the field beside it. */
.colour-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.colour-field .input {
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.colour-picker {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
}

/* The logo the Event is presented under now, beside what it is called. */
.logo-current {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  margin-block-end: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
}

.logo-image {
  flex: 0 0 auto;
  width: auto;
  height: 3rem;
  max-width: 12rem;
  object-fit: contain;
}

.logo-meta {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}
