/* Website stylesheet.
 *
 * Hand-written CSS, no build step and no framework — the repository has no
 * Node toolchain and this site is small enough to stay that way.
 *
 * Every colour, type size and measurement comes from `tokens.css`, which is
 * GENERATED from the app's own ThemeData (see site/sync-theme.sh). Nothing in
 * this file may hardcode a colour: the point is that the site and the app share
 * one palette rather than two that drift. Dark mode needs no rules here either
 * — the tokens swap themselves under `prefers-color-scheme`.
 *
 * The component rules below deliberately mirror the app's widget themes
 * (elevatedButtonTheme, cardTheme, chipTheme, inputDecorationTheme, appBarTheme
 * in app_theme.dart): pill controls 52px tall, flat cards defined by a thin
 * outline rather than a shadow, stadium chips, filled inputs with a 2px focus
 * ring.
 */

/* ---------- semantic aliases over the generated tokens ---------- */

:root {
  /* The app paints its scaffold in `surface` and its cards in the same colour,
     separated by an outline — so does this. */
  --bg: var(--color-surface);
  --surface: var(--color-surface);
  --surface-alt: var(--color-surface-container);
  --text: var(--color-on-surface);
  --text-muted: var(--color-on-surface-variant);
  --border: var(--color-outline-variant);

  --brand: var(--color-primary);
  --brand-soft: var(--color-primary-container);
  --brand-strong: var(--color-on-primary-container);

  --danger: var(--color-error);
  --ok: var(--color-success);

  --page: 1120px;
  --prose: 68ch;

  /* Only genuinely raised things cast a shadow — the phone mock-up. Every
     surface the app also has stays flat, because the app's elevation is 0. */
  --shadow-raised: 0 1px 2px rgb(0 0 0 / 8%), 0 12px 32px rgb(0 0 0 / 12%);
}

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

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: var(--font-body-large-size);
  line-height: var(--font-body-large-line-height);
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  text-wrap: balance;
  /* German compounds — "Widerrufsbelehrung", "Geschäftsbedingungen" — are
     wider than a 360px viewport at display sizes and pushed the whole page
     sideways. Hyphenation picks the break points from the `lang` on <html>,
     which assets/js/i18n.js keeps in step with the language on screen. */
  overflow-wrap: break-word;
  hyphens: auto;
}

/* The app's expressive display scale. Headings grow with the viewport but never
   below the app's own size for that role, so a phone shows the app's typography
   exactly and a desktop scales it up. */
h1 {
  font-size: clamp(var(--font-display-large-size), 1.4rem + 3vw, 3.4rem);
  font-weight: var(--font-display-large-weight);
  line-height: var(--font-display-large-line-height);
  letter-spacing: var(--font-display-large-letter-spacing);
}

h2 {
  font-size: clamp(var(--font-display-small-size), 1.2rem + 1.4vw, 2.1rem);
  font-weight: var(--font-display-small-weight);
  line-height: var(--font-display-medium-line-height);
  letter-spacing: var(--font-display-small-letter-spacing);
}

h3 {
  font-size: var(--font-title-large-size);
  font-weight: var(--font-title-large-weight);
  letter-spacing: var(--font-title-large-letter-spacing);
  line-height: 1.25;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--brand);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

img,
svg {
  max-width: 100%;
}

/* ---------- layout ---------- */

.wrap {
  width: min(100% - 2rem, var(--page));
  margin-inline: auto;
}

.section {
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.section--tint {
  background: var(--surface-alt);
}

.section__lead {
  max-width: var(--prose);
  color: var(--text-muted);
  font-size: var(--font-body-large-size);
  line-height: var(--font-body-large-line-height);
}

.grid {
  display: grid;
  gap: var(--space-l);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: var(--space-s) var(--space-m);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

/* ---------- header (mirrors appBarTheme + dividerTheme) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid
    color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--font-title-large-size);
  font-weight: var(--font-title-large-weight);
  letter-spacing: var(--font-title-large-letter-spacing);
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
  flex: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem 1.1rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--font-label-large-size);
  font-weight: var(--font-label-large-weight);
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--text);
}

/* The language switcher (assets/js/i18n.js builds it into every header). It is
   the app's chip, one size down: the same stadium shape and the same selected
   state, small enough not to compete with the navigation next to it. */
.lang-switch {
  display: flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: var(--radius-full);
  background: color-mix(
    in srgb,
    var(--color-surface-container-highest) 60%,
    transparent
  );
}

.lang-switch__option {
  padding: 0.25rem 0.6rem;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--font-label-small-size);
  font-weight: var(--font-label-large-weight);
  letter-spacing: var(--font-label-small-letter-spacing);
  cursor: pointer;
}

.lang-switch__option:hover {
  color: var(--text);
}

.lang-switch__option[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* ---------- buttons (mirror elevatedButtonTheme / outlinedButtonTheme) ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: var(--font-label-large-size);
  font-weight: var(--font-label-large-weight);
  letter-spacing: var(--font-label-large-letter-spacing);
  text-decoration: none;
  cursor: pointer;
  /* The secondary button is the app's OutlinedButton: transparent, 1.5px
     outline, label in the primary colour. */
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--border);
}

.btn:hover {
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}

/* The app's ElevatedButton: a solid, flat pill. No gradient and no shadow —
   `elevation: 0`, `shadowColor: transparent`. */
.btn--primary {
  background: var(--brand);
  color: var(--color-on-primary);
  border-color: transparent;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--brand) 88%, var(--color-on-primary));
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-l);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  /* Less at the bottom than the top: the next section brings its own top
     padding, and stacking two full ones left a hole under the buttons. */
  padding-block: clamp(3rem, 9vw, 6rem) clamp(2rem, 5vw, 3rem);
  background:
    radial-gradient(
      70rem 30rem at 15% -10%,
      color-mix(in srgb, var(--brand-gradient-start) 18%, transparent),
      transparent 65%
    ),
    radial-gradient(
      55rem 28rem at 95% 10%,
      color-mix(in srgb, var(--brand-gradient-end) 16%, transparent),
      transparent 60%
    );
}

.hero__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 60rem) {
  .hero__grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.hero__claim {
  font-size: var(--font-body-large-size);
  line-height: var(--font-body-large-line-height);
  color: var(--text-muted);
  max-width: 40ch;
}

.eyebrow {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  margin-bottom: var(--space-m);
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: var(--font-label-small-size);
  font-weight: var(--font-label-small-weight);
  letter-spacing: var(--font-label-small-letter-spacing);
  text-transform: uppercase;
}

/* ---------- cards (mirror cardTheme) ---------- */

.card {
  background: var(--surface);
  /* cardTheme: a thin outline at 35% instead of elevation. */
  border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  border-radius: var(--radius-l);
  padding: var(--space-l);
}

/* A heading inside a card is the app's AppSectionCard heading, not a page
   heading — titleLarge, not the display scale. */
.card h2,
.card h3 {
  margin-top: 0;
  font-size: var(--font-title-large-size);
  font-weight: var(--font-title-large-weight);
  letter-spacing: var(--font-title-large-letter-spacing);
  line-height: 1.25;
}

.card p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: var(--space-m);
  border-radius: var(--radius-s);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* ---------- phone frame (live demo) ---------- */

/* The "how to operate the demo" list next to the phone. Numbered, because the
   steps walk down the app's bottom bar in order. */
.steps {
  margin: 0 0 1em;
  padding-left: 1.3rem;
  color: var(--text-muted);
}

.steps li {
  margin-bottom: 0.5rem;
}

.steps strong {
  color: var(--text);
}


.demo {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 60rem) {
  .demo {
    grid-template-columns: 22rem 1fr;
  }
}

/* A physical object, so this is the one thing on the page that is allowed to
   cast a shadow. */
.phone {
  justify-self: center;
  width: min(20rem, 100%);
  aspect-ratio: 9 / 19;
  padding: 0.6rem;
  border-radius: 2.4rem;
  background: var(--color-inverse-surface);
  box-shadow: var(--shadow-raised);
}

.phone__screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 1.9rem;
  background: var(--surface);
}

/* The demo is a real, running build of the app with the in-memory test
 * backend. It is shown, not operated: pointer-events keeps every tap out, so
 * nothing inside can navigate, submit or reach a network. */
.phone__screen iframe {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.phone__fallback {
  display: grid;
  place-content: center;
  gap: 0.5rem;
  height: 100%;
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-body-medium-size);
  line-height: var(--font-body-medium-line-height);
}

/* ---------- forms (mirror inputDecorationTheme) ---------- */

.form-grid {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.field,
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* A .field-group holds several controls under one caption (a colour with its
   switch, a logo with its buttons), so it must not give them the filled look
   .field gives its one input. */
.field > span,
.field-group > span:first-child {
  font-size: var(--font-title-small-size);
  font-weight: var(--font-title-small-weight);
}

/* Filled, generously rounded, borderless at rest, 2px primary focus ring —
   the app's fields, with its 18px content padding. */
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: var(--font-body-large-size);
  padding: 18px;
  border: 2px solid transparent;
  border-radius: var(--radius-m);
  background: color-mix(
    in srgb,
    var(--color-surface-container-highest) 50%,
    transparent
  );
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  /* The app uses the fully opaque container in dark mode. */
  .field input,
  .field select,
  .field textarea {
    background: var(--color-surface-container-high);
  }
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
}

/* `:user-invalid`, not `:invalid`: an empty required field is invalid from the
   moment the page loads, which would paint the whole delivery form red before
   the visitor has typed a character. This only fires once they have actually
   interacted with the field or tried to submit. */
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid {
  border-color: var(--danger);
}

/* The events console marks the field a rejected form is about (empty, or a
   value the server refuses) with `aria-invalid`, as the app's input theme does
   after a failed sign-in: red border, plus one glow so the eye finds it. The
   flag is lifted again as soon as the field is edited. Same specificity as
   `:focus` above and later, so the red survives while the field has focus. */
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"],
fieldset[aria-invalid="true"] {
  border-color: var(--danger);
  animation: field-flash 0.9s ease-out;
}

fieldset[aria-invalid="true"] {
  border-width: 2px;
  border-style: solid;
  border-radius: var(--radius-m);
}

.btn[aria-invalid="true"] {
  border-color: var(--danger);
  animation: field-flash 0.9s ease-out;
}

@keyframes field-flash {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 60%, transparent); }
  to { box-shadow: 0 0 0 10px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .field input[aria-invalid="true"],
  .field select[aria-invalid="true"],
  .field textarea[aria-invalid="true"],
  fieldset[aria-invalid="true"],
  .btn[aria-invalid="true"] {
    animation: none;
  }
}

.field--wide {
  grid-column: 1 / -1;
}

.hint {
  color: var(--text-muted);
  font-size: var(--font-body-small-size);
  line-height: var(--font-body-small-line-height);
}

/* ---------- chips (mirror chipTheme) ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.chip {
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface-container-highest);
  color: var(--text);
  font-family: inherit;
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
}

.stepper button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--brand);
  font-size: 1.25rem;
  cursor: pointer;
}

.stepper button[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
}

.stepper output {
  min-width: 2ch;
  text-align: center;
  font-size: var(--font-title-large-size);
  font-weight: var(--font-title-large-weight);
}

.check {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: var(--space-s);
  font-size: var(--font-body-large-size);
  line-height: var(--font-body-large-line-height);
}

.check input {
  margin-top: 0.3rem;
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  accent-color: var(--brand);
}

/* ---------- order summary ---------- */

.summary {
  list-style: none;
  margin: 0 0 var(--space-m);
  padding: 0;
}

.summary li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-m);
  padding: 0.4rem 0;
  border-bottom: 1px dashed
    color-mix(in srgb, var(--border) 50%, transparent);
}

.summary li:last-child {
  border-bottom: 0;
  border-top: 2px solid var(--border);
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  font-size: var(--font-title-large-size);
  font-weight: var(--font-title-large-weight);
}

.shirt-preview {
  display: block;
  width: min(16rem, 100%);
  margin-inline: auto;
  background: var(--color-surface-container-highest);
  border-radius: var(--radius-m);
  padding: var(--space-l);
  color: var(--border);
}

/* ---------- notices (mirror AppInlineBanner) ---------- */

.notice {
  display: flex;
  gap: var(--space-s);
  padding: var(--space-m);
  border-radius: var(--radius-s);
  background: var(--surface-alt);
  color: var(--text);
  margin-block: var(--space-l);
}

/* The draft banners on the legal pages use the app's warning accent — the same
   colour AppInlineBanner paints the privacy statement's draft notice. */
.notice--draft {
  background: var(--color-warning);
  color: var(--color-on-warning);
}

.notice--draft a {
  color: inherit;
}

.notice--warn {
  display: block;
  background: color-mix(in srgb, var(--color-warning) 16%, var(--surface));
  border-left: 4px solid var(--color-warning);
  color: var(--text);
}

.notice--warn strong {
  display: block;
}

/* What a colour pair really looks like, shown next to its warning. */
.contrast-sample {
  display: inline-block;
  margin: var(--space-xs) var(--space-s) 0 0;
  padding: var(--space-xs) var(--space-m);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-weight: 600;
}

.notice--error {
  background: var(--color-error-container);
  color: var(--color-on-error-container);
}

.notice--ok {
  background: color-mix(in srgb, var(--color-success) 18%, var(--surface));
  color: var(--text);
}

.notice p:last-child {
  margin-bottom: 0;
}

/* Placeholder for a legally required value that has not been configured. */
.todo {
  padding: 0.05em 0.45em;
  border-radius: 0.4em;
  background: color-mix(in srgb, var(--color-warning) 30%, transparent);
  color: var(--text);
  font-style: italic;
}

/* ---------- codes (order confirmation) ---------- */

.codes {
  display: grid;
  gap: var(--space-m);
  padding: 0;
  margin: 0;
  list-style: none;
}

.code-card {
  border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  border-radius: var(--radius-s);
  background: var(--surface);
  padding: var(--space-m);
}

.code-qr {
  display: grid;
  justify-items: start;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

.code-qr__image {
  width: min(100%, 14rem);
  border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  border-radius: var(--radius-s);
  overflow: hidden;
  line-height: 0;
}

.code-qr__image svg {
  display: block;
  width: 100%;
  height: auto;
}

.code-card dl {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem 0.9rem;
  align-items: center;
  margin: 0;
}

.code-card dt {
  color: var(--text-muted);
  font-size: var(--font-body-medium-size);
}

.code-card dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-body-large-size);
  word-break: break-all;
}

.copy {
  padding: 0.35rem 0.8rem;
  font-family: inherit;
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}

/* ---------- prose (legal pages) ---------- */

.prose {
  max-width: var(--prose);
}

.prose h2 {
  margin-top: 2.25rem;
  font-size: var(--font-headline-small-size);
  font-weight: var(--font-headline-small-weight);
  letter-spacing: var(--font-headline-small-letter-spacing);
}

.prose dl {
  margin: 0 0 1em;
}

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

.prose dd {
  margin: 0 0 0.6em;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid
    color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
  background: var(--surface);
  padding-block: var(--space-xl);
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: var(--font-body-medium-size);
  line-height: var(--font-body-medium-line-height);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-l);
  align-items: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  margin-left: auto;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover,
.site-footer a[aria-current] {
  color: var(--text);
}

[hidden] {
  display: none !important;
}

/* ---------- event administration (events/index.html) ---------- */

.admin-badge {
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
}

.admin-narrow {
  max-width: 28rem;
  margin-inline: auto;
}

.admin-list {
  display: grid;
  gap: var(--space-m);
  padding: 0;
  margin: var(--space-l) 0 0;
  list-style: none;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-l);
  align-items: center;
  justify-content: space-between;
}

.admin-row__title {
  margin: 0;
  font-size: var(--font-title-large-size);
}

.admin-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
}

.admin-create-card {
  margin-block: var(--space-l);
}

.admin-create-card summary {
  cursor: pointer;
  font-weight: var(--font-title-small-weight);
}

.admin-create-card form {
  margin-top: var(--space-m);
}

.admin-tab > * + * {
  margin-top: var(--space-l);
}

.admin-danger {
  border-color: var(--danger);
}

/* A card is a column, not a page: its heading must not outgrow a phone. */
.admin-narrow h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  overflow-wrap: break-word;
}

/* The authenticator secret: groups of four that wrap between groups. */
.secret {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  margin: var(--space-s) 0;
  font-size: var(--font-title-large-size);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.secret__group {
  white-space: nowrap;
}

.admin-steps {
  padding-left: 1.2rem;
  margin: var(--space-m) 0;
}

.admin-steps li {
  margin-bottom: var(--space-s);
}

.recovery {
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  padding: 0;
  margin: var(--space-m) 0;
  list-style: none;
  font-size: var(--font-body-large-size);
}

/* The buttons of a table row: side by side, at the right edge, centred on the
   row's own line. */
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
}

/* Edit and delete never part, even when the labelled buttons before them wrap. */
.icon-pair {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.table td.cell-actions,
.table th.cell-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

/* The cell is only as wide as its content (width 1%), so wrapping would stack
   the icons into a column; they stay on one line instead. */
.table td.cell-actions .admin-actions {
  flex-wrap: nowrap;
}

/* .btn-row pushes itself down from what is above it; in a cell there is
   nothing above it, and the push would drag the buttons off the row's middle. */
.table .btn-row {
  margin-top: 0;
}

/* Icon-only buttons (edit, delete): the pill becomes a circle. */
.btn--icon {
  width: 2.5rem;
  min-height: 2.5rem;
  height: 2.5rem;
  padding: 0;
  flex: none;
}

.btn--icon svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.btn--icon-danger {
  color: var(--danger);
}

.btn--icon-danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* Pushes a lone button to the right end of its row. */
.btn-row__end {
  margin-left: auto;
}

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

.badge {
  display: inline-block;
  padding: 0.1rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--surface-alt);
  color: var(--text);
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
  white-space: nowrap;
}

.badge--ok {
  background: color-mix(in srgb, var(--color-success) 18%, var(--surface));
}

/* Destructive action: the app's error colour, same pill as .btn--primary. */
.btn--danger {
  background: var(--danger);
  color: var(--color-on-error);
  border-color: transparent;
}

.btn--danger:hover {
  background: color-mix(in srgb, var(--danger) 88%, var(--color-on-error));
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-block: var(--space-l);
  border-bottom: 1px solid
    color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
}

.tabs a {
  padding: 0.6rem 1rem;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: var(--font-label-large-weight);
  text-decoration: none;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--brand);
  color: var(--text);
}

/* Wide tables scroll inside their own box, never the page. */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-body-medium-size);
}

.table th,
.table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid
    color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
  text-align: left;
  vertical-align: middle;
}

.table th.cell-num,
.table td.cell-num {
  text-align: center;
}

.table th {
  color: var(--text-muted);
  font-weight: var(--font-title-small-weight);
  white-space: nowrap;
}

/* Phones: one card per row, each cell labelled by its column. */
@media (max-width: 40rem) {
  .table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table--stack,
  .table--stack tbody,
  .table--stack tr,
  .table--stack td {
    display: block;
    width: 100%;
  }

  .table--stack tr {
    margin-bottom: var(--space-m);
    padding: var(--space-xs) var(--space-s);
    border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
    border-radius: var(--radius-s);
  }

  .table--stack td {
    display: flex;
    gap: var(--space-s);
    justify-content: space-between;
    align-items: center;
    border-bottom: 0;
    padding: 0.4rem 0;
  }

  .table--stack td::before {
    content: attr(data-label);
    flex: none;
    color: var(--text-muted);
    font-weight: var(--font-title-small-weight);
  }

  /* A card's buttons keep to the right edge, under no label: the icons say
     what they are. */
  .table--stack td.cell-actions {
    justify-content: flex-end;
    width: 100%;
    text-align: right;
  }

  /* A card is as wide as the screen, so there the buttons may wrap again. */
  .table--stack td.cell-actions .admin-actions {
    flex-wrap: wrap;
  }

  .table--stack td.cell-actions::before {
    content: none;
  }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.swatch-row {
  display: flex;
  gap: var(--space-s);
  align-items: center;
  margin-bottom: var(--space-xs);
}

.swatch-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand);
}

/* The category name sits next to its colour without a .field wrapper, so it
   takes the field look itself; flex-wrap keeps the buttons on a phone. */
.swatch-row {
  flex-wrap: wrap;
}

.swatch-row input[type="text"] {
  flex: 1 1 10rem;
  min-width: 0;
  font-family: inherit;
  font-size: var(--font-body-large-size);
  padding: 12px 14px;
  border: 2px solid transparent;
  border-radius: var(--radius-m);
  background: var(--color-surface-container-high);
  color: var(--text);
}

.swatch-row input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
}

/* Colour picker: a round swatch that opens a wheel, beside a hex field. */
.color-picker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s);
}

.color-swatch {
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.color-swatch:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.color-hex {
  width: 6.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-body-large-size);
  padding: 8px 12px;
  border: 2px solid transparent;
  border-radius: var(--radius-m);
  background: var(--color-surface-container-high);
  color: var(--text);
  text-transform: uppercase;
}

.color-hex:focus {
  outline: none;
  border-color: var(--brand);
}

.color-hex[aria-invalid="true"] {
  border-color: var(--danger);
}

.color-pop {
  /* In the flow, under the picker and pushing what follows down: a floating
     wheel covered the colours below it. */
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-s);
  padding: var(--space-s);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.color-pop[hidden] {
  display: none;
}

/* In a row of the console (colours of the look, categories) the picker has no
   box of its own: swatch and hex field are items of the row, so they stay on
   one line with the checkbox and the label, and the wheel takes a line of its
   own at the end of the row, pushing the next row down. */
.swatch-row .color-picker {
  display: contents;
}

.swatch-row input.color-hex {
  flex: none;
  width: 6.5rem;
  min-width: 0;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.swatch-row .color-pop {
  order: 1;
  flex: 0 0 100%;
}

.color-wheel {
  width: 168px;
  height: 168px;
  touch-action: none;
  cursor: crosshair;
}

.color-brightness {
  width: 100%;
  accent-color: var(--brand);
}

/* The sections of one admin tab (stickers, challenges, groups) stacked with air
   between them; an editor that is not open is empty and takes no room. */
.board > :not(:empty) ~ :not(:empty) {
  margin-top: var(--space-l);
}

/* Sections inside a card (place look, categories): a heading and a hairline,
   not the browser's boxed fieldset. */
.panel-section {
  margin-top: var(--space-l);
  padding-top: var(--space-m);
  border-top: 1px solid
    color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
}

.panel-section h3 {
  margin: 0 0 var(--space-s);
  font-size: var(--font-title-medium-size);
  font-weight: var(--font-title-medium-weight);
}

/* A notice that is the section's content sits under the heading with no margin
   of its own (the default one is for notices between paragraphs). */
.panel-section > .notice {
  margin-block: 0;
}

/* The note after the last section would otherwise touch its checkboxes. */
.panel-section ~ .hint {
  margin-top: var(--space-m);
}

/* Logo choice: a button, the preview and a remove icon beside it. */
.logo-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s);
}

.logo-pick .place-logo {
  margin-block: 0;
}

/* Branding picture: the image, or a placeholder of the same box so the
 * buttons below it stay where they are whether or not a picture is set. */
.slot-image {
  display: block;
  box-sizing: border-box;
  width: 240px;
  max-width: 100%;
  height: 120px;
  margin-block: var(--space-xs, 0.25rem) var(--space-s);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-s, 8px);
}

.slot-image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--text-muted);
}

/* The one-time display of a new join code. */
.reveal {
  border-color: var(--brand);
}

.reveal .btn-row {
  align-items: center;
}

.reveal__code {
  margin: var(--space-m) 0;
  font-size: clamp(1.4rem, 1rem + 2.4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* The scanner's contrast is not the theme's: it stays black on white. */
.reveal__qr {
  display: block;
  width: min(16rem, 100%);
  height: auto;
  margin: var(--space-m) 0;
}

/* Printing the code prints the code and nothing else. */
@media print {
  body.print-code * {
    visibility: hidden;
  }

  body.print-code .reveal,
  body.print-code .reveal * {
    visibility: visible;
  }

  body.print-code .reveal {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    border: 0;
  }

  body.print-code .reveal .btn-row,
  body.print-code .reveal .notice {
    display: none;
  }
}

/* Sticker pool in the event console. */
.sticker-thumb {
  width: 2rem;
  height: 2rem;
  vertical-align: middle;
  object-fit: contain;
  border-radius: var(--radius-s);
  background: var(--surface-alt);
}

.slot {
  margin-bottom: var(--space-m);
}

.check {
  display: flex;
  gap: var(--space-s);
  align-items: center;
  margin-bottom: var(--space-xs);
}

/* Map editor in the event console. */
/* The places (or the form of the selected one), then the map under them. */
.map-layout {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: minmax(0, 1fr);
}

.map-canvas {
  /* Leaflet panes use z-indexes up to 1000: keep them below the sticky header. */
  isolation: isolate;
  height: min(60vh, 34rem);
  min-height: 18rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-m);
}

.map-pin-wrap {
  background: none;
  border: 0;
}

.map-pin {
  display: block;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 55%);
}

.map-pin--on {
  box-shadow: 0 0 0 3px #000;
}

.place-logo {
  display: block;
  max-width: 160px;
  max-height: 80px;
  margin-block: var(--space-s);
  object-fit: contain;
}

.map-save {
  position: sticky;
  bottom: var(--space-s);
  align-items: center;
}

