/* =====================================================================
 * Savalon Web — design system
 * Photography-led dark UI with crimson details. Display: Barlow Condensed
 * (800, uppercase — matches the logo's athletic lettering); body: Manrope;
 * codes: JetBrains Mono. Theme colours are runtime-editable via /theme.css
 * (loaded after this file) — never hard-code the accent, use var(--accent),
 * var(--accent-text) or a color-mix() of them.
 *
 * PAGE-LEVEL PATTERNS (public pages; see section 20 for the CSS)
 * ---------------------------------------------------------------------
 * .display            Display font utility (Barlow Condensed 800, uppercase,
 *                     tight leading). Sizes: .display--xl | --lg | --md | --sm.
 * .lead               Larger intro paragraph (max ~60ch).
 * .page-hero          Photo banner for inner pages (~300px), put it FIRST in
 *                     the page (right after partials/top). Pulls itself up
 *                     under the 24px main padding.
 *                       <section class="page-hero page-hero--scene-4">
 *                         <div class="container page-hero__inner">
 *                           <h1 class="page-hero__title">Nyheder</h1>
 *                           <p class="page-hero__sub">Kort undertekst.</p>
 *                           <div class="page-hero__actions">…buttons…</div>   (optional)
 *                         </div>
 *                       </section>
 *                     Photo: --scene-5 (default) | --scene-4 | --scene-1, or a
 *                     custom one with style="--page-hero-image: url('/uploads/x.jpg')".
 *                     .page-hero--sm = shorter (~220px). Follow it with
 *                     <div class="container section">…</div> for the content.
 * .section-head       Heading row above a section: __title (display), __sub,
 *                     __link (right-aligned "Alle … →" link). --center variant.
 *                       <header class="section-head">
 *                         <div><h2 class="section-head__title">Nyheder</h2>
 *                              <p class="section-head__sub">…</p></div>
 *                         <a class="section-head__link" href="/nyheder">Alle nyheder <icon arrow-right></a>
 *                       </header>
 * .band               Full-bleed section with its own background; content goes
 *                     in a .container inside. --surface (quiet raised tone with
 *                     hairlines), --photo (darkened hero photo; --band-image or
 *                     --scene-1|--scene-4|--scene-5), --tight (less padding).
 * .media-card         Image-led card WITHOUT a box: __media (16:10 image or
 *                     __fallback branded photo crop), __body, __meta, __title,
 *                     __text, __more. --feature = big split variant.
 *                     Lay them out with .media-grid (auto 1-3 columns).
 * .link-list          Hairline-separated rows instead of cards: <a class="link-list__item">
 *                     with __icon (style="--tile-color:#hex"), __body > __title
 *                     + __text, __state (status text), __arrow. --2col variant.
 * .split              Two-column layout: __aside (narrow, sticky heading) +
 *                     __main. --even (1:1), --reverse. Stacks below 900px.
 * .steps              Inline timeline (no boxes): <ol class="steps"> > li.steps__item
 *                     with __node (icon), __title (link stretches over item), __text.
 * .status-line        Quiet inline live status (with data-status, see site.js).
 * .btn--glass         Translucent button for use on photos.
 * Spacing: 8px scale --space-1 (8px) … --space-12 (96px); content max 1200px.
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * 1. Tokens
 * ------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Runtime theme (fallbacks — /theme.css overrides these) */
  --bg-canvas: #0D0F13;
  --bg-sidebar: #101318;
  --bg-surface-1: #14181F;
  --bg-surface-2: #1A1F28;
  --bg-surface-3: #222834;
  --accent: #B91C2C;
  --accent-hover: #CC2233;
  --accent-text: #F04E5E;
  --text-primary: #F3F5F8;
  --text-secondary: #9BA3B2;
  --text-muted: #636B7A;
  --success: #22A06B;
  --warning: #D9822B;
  --danger: #C9372C;
  --info: #3898A6;

  /* Derived colours */
  --text-dim: color-mix(in srgb, var(--text-muted) 70%, var(--bg-canvas));
  --text-on-accent: #FFFFFF;
  --success-text: color-mix(in srgb, var(--success) 62%, var(--text-primary));
  --warning-text: color-mix(in srgb, var(--warning) 66%, var(--text-primary));
  --danger-text: color-mix(in srgb, var(--danger) 62%, var(--text-primary));
  --info-text: color-mix(in srgb, var(--info) 62%, var(--text-primary));

  --border-hairline: color-mix(in srgb, var(--text-primary) 6%, transparent);
  --border-subtle: color-mix(in srgb, var(--text-primary) 9.5%, transparent);
  --border-strong: color-mix(in srgb, var(--text-primary) 17%, transparent);

  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 8%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 55%, transparent);
  --accent-active: color-mix(in srgb, var(--accent) 82%, black);

  --overlay: color-mix(in srgb, var(--bg-canvas) 72%, transparent);
  --row-hover: color-mix(in srgb, var(--text-primary) 2.5%, transparent);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent-text) 38%, transparent);

  /* Typography */
  --font-sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --fs-micro: 0.6875rem;
  --fs-small: 0.8125rem;
  --fs-ui: 0.875rem;
  --fs-body: 0.9375rem;
  --fs-lead: 1.0625rem;

  /* Shape */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.38), inset 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
  --shadow-raised: 0 18px 40px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 color-mix(in srgb, var(--text-primary) 5%, transparent);
  --shadow-popover: 0 24px 60px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--border-subtle);
  --shadow-btn-primary: 0 2px 10px -2px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.16);

  /* Spacing (8px scale) */
  --space-half: 4px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
  --space-12: 96px;
  --section-y: clamp(64px, 9vw, 120px);

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 760px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 72px;
  --main-pt: 24px;
  --sidebar-w: 264px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 0.15s var(--ease-out);
  --t-normal: 0.24s var(--ease-out);
}

/* ---------------------------------------------------------------------
 * 2. Base
 * ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--bg-surface-3) transparent;
  background: var(--bg-canvas);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.75rem, 3.4vw, 2.25rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }
strong, b { color: var(--text-primary); font-weight: 700; }
small { font-size: var(--fs-small); }

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
a:hover { color: color-mix(in srgb, var(--accent-text) 75%, white); }

img, svg, video { max-width: 100%; }
img { height: auto; }
svg { flex-shrink: 0; }

hr {
  border: 0;
  height: 1px;
  background: var(--border-hairline);
  margin: 24px 0;
}

code, kbd, samp, pre { font-family: var(--font-mono); }
code { font-size: 0.875em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-3);
  border: 2px solid var(--bg-canvas);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--bg-surface-3) 70%, var(--text-muted)); }

/* ---------------------------------------------------------------------
 * 3. Icons
 * ------------------------------------------------------------------- */
.icon {
  display: inline-block;
  flex: none;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
/* partials/icon sets width/height attributes; only size icons without them. */
.icon:not([width]) { width: 1em; height: 1em; }

/* ---------------------------------------------------------------------
 * 4. Utilities
 * ------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.muted { color: var(--text-muted); }
.text-accent { color: var(--accent-text); }
a.text-accent { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
a.text-accent:hover { color: color-mix(in srgb, var(--accent-text) 75%, white); }
.mono { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: -0.01em; }

.kbd, kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-bottom-width: 2px;
  border-radius: 5px;
  vertical-align: 0.05em;
}

.spacer { flex: 1 1 auto; }

.divider {
  border: 0;
  height: 1px;
  background: var(--border-hairline);
  margin: 20px 0;
}
.divider:not(:empty) {
  display: flex;
  align-items: center;
  gap: 14px;
  height: auto;
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.divider:not(:empty)::before,
.divider:not(:empty)::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-hairline);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 700;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; color: var(--text-on-accent); }

/* ---------------------------------------------------------------------
 * 5. Layout primitives
 * ------------------------------------------------------------------- */
.container {
  width: min(var(--container-max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.container--narrow { width: min(var(--container-narrow), 100% - 2 * var(--gutter)); }
.main:focus, .admin-content:focus { outline: none; }

.main {
  flex: 1 0 auto;
  width: 100%;
  position: relative;
  padding-top: var(--main-pt);
  padding-bottom: clamp(48px, 8vw, 88px);
}

.section { padding-block: clamp(32px, 5vw, 56px); }
.stack > .section { padding-block: clamp(8px, 1.6vw, 20px); }
/* A bare .section directly in <main> still gets centred content. */
.main > .section:not(.container) {
  padding-inline: max(var(--gutter), (100% - var(--container-max)) / 2);
}
.main > .section > .container { width: 100%; }

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 24px;
  row-gap: 0;
  align-items: end;
  padding: 16px 0 28px;
}
.page-header > :not(.page-header__actions) { grid-column: 1; min-width: 0; }
.page-header__actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.page-header__title {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.page-header__sub {
  margin: 8px 0 0;
  max-width: 68ch;
  color: var(--text-secondary);
  font-size: var(--fs-body);
}
@media (max-width: 640px) {
  .page-header { grid-template-columns: minmax(0, 1fr); }
  .page-header__actions {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
    margin-top: 16px;
  }
}

.grid {
  --grid-gap: 20px;
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.grid > * { min-width: 0; }
/* "At most N columns" — collapses on narrow containers (also inside the admin area). */
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 300px), (100% - var(--grid-gap)) / 2), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 260px), (100% - 2 * var(--grid-gap)) / 3), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 210px), (100% - 3 * var(--grid-gap)) / 4), 1fr)); }
.grid:has(> .card, > .stat, > .news-card) { align-items: stretch; }
/* Stat tiles are compact: keep two per row on phones. */
.grid--4:has(> .stat, > .card > .stat) { grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 140px), (100% - 3 * var(--grid-gap)) / 4), 1fr)); }
.grid--3:has(> .stat, > .card > .stat) { grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 140px), (100% - 2 * var(--grid-gap)) / 3), 1fr)); }
@media (max-width: 480px) { .grid { --grid-gap: 14px; } }

.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack > * { margin-block: 0; }
.stack--sm { gap: 6px; }
.stack--lg { gap: 32px; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.row > * { margin-block: 0; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }

/* ---------------------------------------------------------------------
 * 6. Site header & navigation
 * ------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
}
/* Solid layer (blurred glass) on its own pseudo-element so the overlay variant can fade it in. */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg-canvas) 84%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border-hairline);
  transition: opacity 0.35s var(--ease-out);
}
/* Over a full-bleed hero (home): fixed + transparent until the page scrolls (site.js adds .is-solid). */
.site-header--overlay {
  position: fixed;
  inset: 0 0 auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-canvas) 62%, transparent) 0%, transparent 100%);
}
.site-header--overlay::before { opacity: 0; }
.site-header--overlay.is-solid::before,
.site-header--overlay:has(.site-nav.is-open)::before,
.site-header--overlay:has(.user-menu[open])::before { opacity: 1; }
.site-header--overlay:not(.is-solid) .site-nav__link { color: color-mix(in srgb, var(--text-primary) 82%, transparent); }
.site-header--overlay:not(.is-solid) .site-nav__link:hover { background: color-mix(in srgb, var(--text-primary) 8%, transparent); color: var(--text-primary); }
.site-header--overlay:not(.is-solid) :is(.pill, .user-menu > summary, .btn--secondary) {
  background: color-mix(in srgb, var(--bg-canvas) 38%, transparent);
  border-color: color-mix(in srgb, var(--text-primary) 16%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}
.brand:hover { color: var(--text-primary); }
.brand__logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  transition: transform var(--t-normal);
}
.brand:hover .brand__logo { transform: rotate(-4deg) scale(1.04); }
.brand__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.site-nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.site-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--t-fast), background-color var(--t-fast);
}
.site-nav__link:hover { color: var(--text-primary); background: var(--bg-surface-1); }
.site-nav__link--active,
.site-header--overlay:not(.is-solid) .site-nav__link--active { color: var(--text-primary); }
.site-nav__link--active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 18px;
  height: 2px;
  margin-left: -9px;
  border-radius: 2px;
  background: var(--accent-text);
}
.site-nav__aside {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
/* Compound selectors so .pill/.btn (declared later) can't re-show them. */
.site-header .site-header__status { display: none; }
.site-header .nav-toggle { display: none; }

@media (max-width: 1279px) and (min-width: 1080px) {
  .site-nav__aside .nav-label { display: none; }
}

@media (max-width: 1079px) {
  .site-header .site-header__status { display: inline-flex; margin-left: auto; }
  .site-header .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: calc(-1 * var(--gutter));
    right: calc(-1 * var(--gutter));
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px var(--gutter) 20px;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 24px 40px -16px rgba(0, 0, 0, 0.7);
  }
  .site-nav.is-open { display: flex; animation: drop-in 0.2s var(--ease-out); }
  .site-nav__list { flex-direction: column; align-items: stretch; }
  .site-nav__link { height: 46px; font-size: var(--fs-body); }
  .site-nav__link--active { background: var(--bg-surface-1); }
  .site-nav__link--active::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; margin-left: 0; }
  .site-header--overlay .site-nav .site-nav__link { color: var(--text-secondary); }
  .site-header--overlay .site-nav .site-nav__link--active { color: var(--text-primary); }
  .site-nav__aside {
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-hairline);
  }
  .site-nav__aside > .status-pill { display: none; }
  .site-nav__aside > .btn { height: 44px; }
}
@media (max-width: 420px) {
  .site-header__status .status-pill__label { display: none; }
  .brand__name { max-width: 9.5em; }
  .site-header__inner .brand { font-size: 1.3rem; gap: 10px; }
  .site-header__inner .brand__logo { width: 38px; height: 38px; }
}

/* Live status pill */
.status-pill { font-variant-numeric: tabular-nums; }
.status-pill__count { color: var(--text-primary); font-weight: 700; }
.status-pill[data-status='offline'] .status-pill__count { color: var(--text-secondary); }

/* User dropdown (<details>) */
.user-menu { position: relative; }
.user-menu > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--bg-surface-2); border-color: var(--border-strong); }
.user-menu > summary .avatar { width: 30px; height: 30px; }
.user-menu__name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__chevron { color: var(--text-muted); transition: transform var(--t-fast); }
.user-menu[open] .user-menu__chevron { transform: rotate(180deg); }
.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 240px;
  padding: 6px;
  background: var(--bg-surface-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  animation: drop-in 0.18s var(--ease-out);
}
.user-menu__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}
.user-menu__head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__head small { display: block; color: var(--text-muted); }
.user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.user-menu__item:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.user-menu__item .icon { color: var(--text-muted); }
.user-menu__item:hover .icon { color: var(--accent-text); }
.user-menu__item--danger:hover { color: var(--danger-text); }
.user-menu__item--danger:hover .icon { color: var(--danger-text); }
.user-menu__sep { height: 1px; margin: 6px 4px; background: var(--border-hairline); }
.user-menu form { margin: 0; }
@media (max-width: 1079px) {
  .user-menu > summary { height: 46px; border-radius: var(--radius-sm); padding-inline: 6px 12px; }
  .user-menu__name { max-width: none; flex: 1; }
  .user-menu__panel { position: static; margin-top: 8px; box-shadow: none; border: 1px solid var(--border-hairline); animation: none; }
}

/* ---------------------------------------------------------------------
 * 7. Footer
 * ------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  padding: var(--space-10) 0 var(--space-4);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-hairline);
  font-size: var(--fs-ui);
}
.site-footer__grid {
  display: grid;
  gap: var(--space-5) var(--space-4);
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 0.75fr)) minmax(0, 1.4fr);
}
.site-footer__about .brand { font-size: 1.75rem; gap: 14px; }
.site-footer__about .brand__logo { width: 64px; height: 64px; }
.site-footer__about p { margin: var(--space-2) 0 0; max-width: 34ch; color: var(--text-muted); line-height: 1.65; }
.site-footer__heading {
  margin: 0 0 var(--space-2);
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 700;
  letter-spacing: -0.005em;
}
.site-footer__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer__links a { color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.site-footer__links a:hover { color: var(--text-primary); }
.site-footer__connect { display: grid; gap: 12px; align-content: start; }
.site-footer__connect .code-box { background: var(--bg-canvas); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: var(--space-8);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-hairline);
  color: var(--text-muted);
  font-size: var(--fs-small);
}
.site-footer__bottom a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 960px) {
  .site-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__about, .site-footer__connect { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-footer { padding-top: var(--space-8); }
}

/* ---------------------------------------------------------------------
 * 8. Hero
 * ------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(380px, 62vh, 620px);
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface-1);
  background-image:
    linear-gradient(100deg, color-mix(in srgb, var(--bg-canvas) 88%, transparent) 0%, color-mix(in srgb, var(--bg-canvas) 55%, transparent) 55%, color-mix(in srgb, var(--bg-canvas) 15%, transparent) 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--bg-canvas) 85%, transparent) 0%, transparent 45%),
    var(--hero-image, url('/static/img/hero.svg'));
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-raised);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
}
.hero::before {
  /* Hairline accent along the top edge */
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent-text) 55%, transparent), transparent);
  pointer-events: none;
}
.hero > * { position: relative; max-width: 100%; }
.hero__title {
  margin: 14px 0 12px;
  max-width: 18ch;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.hero__title em, .hero__title .text-accent { font-style: normal; color: var(--accent-text); }
.hero__text {
  margin: 0;
  max-width: 56ch;
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.65;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  background: color-mix(in srgb, var(--bg-canvas) 62%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}
/* Block-level status panel variant (e.g. a connect card inside the hero). */
.hero__status:is(aside, section, .card) {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius-md);
}
@media (max-width: 640px) {
  .hero { min-height: 0; padding: 28px 20px; border-radius: var(--radius-md); }
  .hero__actions > .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------------
 * 9. Cards
 * ------------------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-secondary);
}
/* Content placed straight into a card still gets breathing room. */
.card:not(:has(> .card__body, > .card__header, > .card__footer, > .table-wrap, > .list, > img, > .empty)) { padding: 20px; }
.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}
.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.card__title > .icon { color: var(--accent-text); }
.card__body { flex: 1 1 auto; padding: 20px; min-width: 0; }
.card__body > :first-child { margin-top: 0; }
.card__body > :last-child { margin-bottom: 0; }
.card__header + .card__body { padding-top: 18px; }
.card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-hairline);
  background: color-mix(in srgb, var(--bg-surface-2) 35%, transparent);
  border-radius: 0 0 calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px);
}
.card > img:first-child { border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0; }

.card--link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-normal), border-color var(--t-normal), box-shadow var(--t-normal), background-color var(--t-normal);
}
.card--link:hover {
  color: inherit;
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background-color: color-mix(in srgb, var(--bg-surface-1) 60%, var(--bg-surface-2));
  box-shadow: var(--shadow-raised);
}
.card--link:hover .card__title { color: var(--text-primary); }
.card--link:active { transform: translateY(0); }

.card--accent {
  --_accent: var(--card-accent, var(--accent));
  border-color: color-mix(in srgb, var(--_accent) 26%, var(--border-hairline));
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--_accent) 9%, transparent) 0%, transparent 45%);
  box-shadow: inset 3px 0 0 var(--_accent), var(--shadow-card);
}
.card--accent.card--link:hover {
  border-color: color-mix(in srgb, var(--_accent) 45%, transparent);
  box-shadow: inset 3px 0 0 var(--_accent), var(--shadow-raised);
}

/* Tinted icon square (template icons, category icons). Colour via style="--tile-color:#hex". */
.icon-tile {
  --_c: var(--tile-color, var(--accent));
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--_c) 16%, transparent);
  color: color-mix(in srgb, var(--_c) 70%, var(--text-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 28%, transparent);
}
.icon-tile--sm { width: 32px; height: 32px; border-radius: 9px; }

/* News cards (usable alone or combined with .card) */
.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-secondary);
  text-decoration: none;
  transition: transform var(--t-normal), border-color var(--t-normal), box-shadow var(--t-normal);
}
a.news-card:hover {
  color: var(--text-secondary);
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-raised);
}
.news-card.card--accent { border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 26%, var(--border-hairline)); }
.news-card__image,
.news-card > img:first-child {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-surface-2);
  border-radius: 0;
  transition: transform 0.6s var(--ease-out);
}
a.news-card:hover .news-card__image,
a.news-card:hover > img:first-child { transform: scale(1.03); }
.news-card__media {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  color: var(--text-muted);
  background:
    radial-gradient(80% 120% at 0% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg-surface-2);
}
.news-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  padding: 18px 20px 20px;
}
.news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: var(--fs-small);
}
.news-card__title,
.news-card :is(h2, h3):not(.card__title) {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.news-card__excerpt {
  margin: 0;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card__more {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-text);
  font-size: var(--fs-ui);
  font-weight: 700;
}
a.news-card:hover .news-card__more .icon { transform: translateX(3px); }
.news-card__more .icon { transition: transform var(--t-fast); }
@media (min-width: 800px) {
  .news-card--featured { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .news-card--featured .news-card__image,
  .news-card--featured > img:first-child,
  .news-card--featured .news-card__media { height: 100%; aspect-ratio: auto; min-height: 280px; }
  .news-card--featured .news-card__body { padding: 28px; justify-content: center; }
  .news-card--featured .news-card__title { font-size: 1.5rem; }
  .news-card--featured .news-card__more { margin-top: 10px; }
}

/* ---------------------------------------------------------------------
 * 10. Buttons
 * ------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--bg-surface-2);
  --btn-fg: var(--text-primary);
  --btn-border: var(--border-subtle);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { --btn-bg: var(--bg-surface-3); --btn-border: var(--border-strong); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled,
.btn[aria-disabled='true'],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}
.btn[aria-busy='true'] { cursor: progress; opacity: 0.75; }
.btn .icon { flex: none; }

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--text-on-accent);
  --btn-border: color-mix(in srgb, var(--accent) 70%, white 10%);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow-btn-primary);
}
.btn--primary:hover { --btn-bg: var(--accent-hover); --btn-border: color-mix(in srgb, var(--accent-hover) 70%, white 18%); }
.btn--primary:active { --btn-bg: var(--accent-active); }
.btn--primary:focus-visible { box-shadow: var(--shadow-btn-primary), var(--focus-ring); }

.btn--secondary { --btn-bg: var(--bg-surface-2); --btn-fg: var(--text-primary); --btn-border: var(--border-subtle); }
.btn--secondary:hover { --btn-bg: var(--bg-surface-3); --btn-border: var(--border-strong); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text-secondary); --btn-border: transparent; }
.btn--ghost:hover { --btn-bg: var(--bg-surface-2); --btn-fg: var(--text-primary); --btn-border: transparent; }

.btn--danger {
  --btn-bg: color-mix(in srgb, var(--danger) 13%, transparent);
  --btn-fg: var(--danger-text);
  --btn-border: color-mix(in srgb, var(--danger) 34%, transparent);
}
.btn--danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }

.btn--success {
  --btn-bg: color-mix(in srgb, var(--success) 14%, transparent);
  --btn-fg: var(--success-text);
  --btn-border: color-mix(in srgb, var(--success) 36%, transparent);
}
.btn--success:hover { --btn-bg: var(--success); --btn-fg: #fff; --btn-border: var(--success); }

.btn--sm { height: 32px; padding: 0 12px; gap: 6px; font-size: var(--fs-small); border-radius: 8px; }
.btn--lg { height: 46px; padding: 0 22px; gap: 10px; font-size: var(--fs-body); border-radius: 12px; }
.btn--block { display: flex; width: 100%; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--icon.btn--lg { width: 46px; }

/* Copy feedback */
.btn.is-copied, [data-copy].is-copied { --btn-fg: var(--success-text); color: var(--success-text); }

/* ---------------------------------------------------------------------
 * 11. Badges, pills, status dots
 * ------------------------------------------------------------------- */
.badge {
  --_c: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--_c) 30%, transparent);
  background: color-mix(in srgb, var(--_c) 13%, transparent);
  color: color-mix(in srgb, var(--_c) 72%, var(--text-primary));
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.badge .icon { width: 12px; height: 12px; }
/* Badge carrying normal text (e.g. a Danish permission label) rather than a short status word. */
.badge--text { height: auto; min-height: 22px; padding-block: 3px; line-height: 1.3; letter-spacing: 0; text-transform: none; white-space: normal; }
.badge--pending, .badge--accepted, .badge--rejected, .badge--withdrawn, .badge--open, .badge--closed { padding-left: 8px; }
:is(.badge--pending, .badge--accepted, .badge--rejected, .badge--withdrawn, .badge--open, .badge--closed)::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--_c);
  flex: none;
}
.badge--pending { --_c: var(--warning); }
.badge--accepted { --_c: var(--success); }
.badge--rejected { --_c: var(--danger); }
.badge--withdrawn { --_c: var(--text-muted); }
.badge--open { --_c: var(--success); }
.badge--closed { --_c: var(--text-muted); }
.badge--info { --_c: var(--info); }
.badge--muted { --_c: var(--text-muted); color: var(--text-secondary); }
.badge--success { --_c: var(--success); }
.badge--warning { --_c: var(--warning); }
.badge--danger { --_c: var(--danger); }
.badge--accent { --_c: var(--accent-text); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}
a.pill { transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
a.pill:hover { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--text-primary); }

.status-dot {
  --_c: var(--text-muted);
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--_c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--_c) 20%, transparent);
  vertical-align: middle;
}
.status-dot--online { --_c: var(--success); }
.status-dot--offline { --_c: var(--danger); }
.status-dot--online::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--_c);
  animation: status-pulse 2.4s ease-out infinite;
}
@keyframes status-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* ---------------------------------------------------------------------
 * 12. Alerts, flash, toasts
 * ------------------------------------------------------------------- */
.alert {
  --_c: var(--info);
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--_c) 32%, transparent);
  background: color-mix(in srgb, var(--_c) 10%, var(--bg-surface-1));
  color: var(--text-primary);
  font-size: var(--fs-ui);
  line-height: 1.55;
}
.alert > p:last-child { margin-bottom: 0; }
.alert a:not(.btn) { color: inherit; text-decoration: underline; }
.alert:has(> .icon:first-child) { padding-left: 46px; }
.alert > .icon:first-child {
  position: absolute;
  left: 16px;
  top: 15px;
  width: 18px;
  height: 18px;
  color: color-mix(in srgb, var(--_c) 70%, var(--text-primary));
}
.alert:has(> .alert__close) { padding-right: 46px; }
.alert__title { display: block; margin: 0 0 2px; font-weight: 700; color: var(--text-primary); }
.alert__close {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.alert__close:hover { background: color-mix(in srgb, var(--text-primary) 8%, transparent); color: var(--text-primary); }
.alert--success { --_c: var(--success); }
.alert--error { --_c: var(--danger); }
.alert--info { --_c: var(--info); }
.alert--warning { --_c: var(--warning); }

.flash-wrap { padding-top: 0; }
.flash-stack { display: grid; gap: 10px; margin-bottom: 20px; }
.flash-stack > .alert { box-shadow: var(--shadow-card); animation: drop-in 0.3s var(--ease-out); }
.alert.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toasts > .alert { pointer-events: auto; box-shadow: var(--shadow-popover); animation: toast-in 0.28s var(--ease-out); }

@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
 * 13. Forms
 * ------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.form > * { margin-block: 0; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field__label {
  display: block;
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 650;
  line-height: 1.4;
}
.field__required { color: var(--accent-text); margin-left: 2px; font-weight: 700; }
.field__help { margin: 0; color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; }
.field__help a { color: var(--text-secondary); text-decoration: underline; }
.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--danger-text);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.45;
}
.field__error::before {
  content: '!';
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--danger) 85%, transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-body);
  line-height: 1.4;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: 1; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent-border);
  background-color: color-mix(in srgb, var(--bg-surface-2) 80%, var(--bg-surface-3));
  box-shadow: var(--focus-ring);
}
.input:disabled, .textarea:disabled, .select:disabled,
.input[readonly], .textarea[readonly] {
  color: var(--text-secondary);
  background-color: color-mix(in srgb, var(--bg-surface-2) 50%, transparent);
}
.input:disabled, .textarea:disabled, .select:disabled { opacity: 0.6; cursor: not-allowed; }
.input[type='number'] { font-variant-numeric: tabular-nums; }
.input[type='search']::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }
.input[type='file'] { padding: 6px; cursor: pointer; }
.input[type='file']::file-selector-button {
  margin-right: 12px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: var(--bg-surface-3);
  color: var(--text-primary);
  font: 600 var(--fs-small) var(--font-sans);
  cursor: pointer;
}
.input[type='date'], .input[type='time'], .input[type='datetime-local'] { color-scheme: dark; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239BA3B2' 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 12px center;
  background-size: 16px;
  cursor: pointer;
}
.select[multiple], .select[size]:not([size='1']) { padding-right: 12px; background-image: none; min-height: 120px; }
.select option { background: var(--bg-surface-2); color: var(--text-primary); }

.field--invalid .input,
.field--invalid .textarea,
.field--invalid .select,
.input[aria-invalid='true'],
.textarea[aria-invalid='true'],
.select[aria-invalid='true'] {
  border-color: color-mix(in srgb, var(--danger) 70%, transparent);
  background-color: color-mix(in srgb, var(--danger) 6%, var(--bg-surface-2));
}
.field--invalid .input:focus,
.field--invalid .textarea:focus,
.field--invalid .select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 30%, transparent);
}
.field--invalid .field__label { color: var(--danger-text); }

/* Checkbox / radio */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  line-height: 1.45;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.check input[type='checkbox'],
.check input[type='radio'] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.check input[type='checkbox']::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--text-on-accent);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.12s var(--ease-out);
}
.check input[type='radio'] { border-radius: 50%; }
.check input[type='radio']::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-on-accent);
  transform: scale(0);
  transition: transform 0.12s var(--ease-out);
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::before { transform: scale(1); }
.check:hover input:not(:disabled) { border-color: color-mix(in srgb, var(--accent-text) 60%, transparent); }
.check input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.check input:disabled { opacity: 0.45; cursor: not-allowed; }
.check:has(input:disabled) { cursor: not-allowed; color: var(--text-muted); }
.check:has(input:checked) { color: var(--text-primary); }
.check strong { font-weight: 650; }

.check-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface-2) 40%, transparent);
}
.check-group--inline { flex-direction: row; flex-wrap: wrap; gap: 10px 22px; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}
.form > .form-actions,
.card__footer.form-actions { justify-content: flex-end; }
.form > .form-actions { padding-top: 20px; border-top: 1px solid var(--border-hairline); }
@media (max-width: 480px) {
  .form > .form-actions > .btn { flex: 1 1 auto; }
}

/* Colour picker + hex input */
.input-color { display: flex; align-items: center; gap: 10px; min-width: 0; }
.input-color input[type='color'] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 44px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input-color input[type='color']:hover { border-color: var(--border-strong); }
.input-color input[type='color']:focus-visible { outline: none; border-color: var(--accent-border); box-shadow: var(--focus-ring); }
.input-color input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
.input-color input[type='color']::-webkit-color-swatch { border: 0; border-radius: 6px; }
.input-color input[type='color']::-moz-color-swatch { border: 0; border-radius: 6px; }
.input-color .input { flex: 1 1 auto; max-width: 150px; font-family: var(--font-mono); font-size: var(--fs-ui); text-transform: uppercase; }
.input-color > .mono { color: var(--text-primary); text-transform: uppercase; }

/* ---------------------------------------------------------------------
 * 14. Tables
 * ------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
}
.card > .table-wrap,
.card__body > .table-wrap:only-child { border: 0; border-radius: inherit; background: transparent; }
.card__body:has(> .table-wrap:only-child) { padding: 0; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-ui);
  font-variant-numeric: tabular-nums;
}
.table th {
  padding: 11px 16px;
  text-align: left;
  vertical-align: bottom;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-surface-2) 55%, transparent);
  border-bottom: 1px solid var(--border-hairline);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  vertical-align: middle;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-hairline);
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr { transition: background-color var(--t-fast); }
.table tbody tr:hover { background: var(--row-hover); }
.table td > a:not(.btn), .table td strong { color: var(--text-primary); }
.table td > a:not(.btn):hover { color: var(--accent-text); }
.table tbody th { background: none; color: var(--text-primary); font-size: var(--fs-ui); letter-spacing: 0; text-transform: none; font-weight: 600; vertical-align: middle; }
.table--compact th { padding: 8px 12px; }
.table--compact td { padding: 8px 12px; }
.table__actions { width: 1%; text-align: right; white-space: nowrap; }
.table__actions > .row, .table__actions > div { flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
.table__actions form { display: inline-flex; margin: 0; }
.table__actions > * + * { margin-left: 6px; }
.table__actions > .row > * + *, .table__actions > div > * + * { margin-left: 0; }

/* ---------------------------------------------------------------------
 * 15. Tabs, toolbar, pagination, breadcrumbs
 * ------------------------------------------------------------------- */
.tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-subtle);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 10px 14px 12px;
  border: 0;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-ui);
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--t-fast), background-color var(--t-fast);
}
.tab:hover { color: var(--text-primary); background: color-mix(in srgb, var(--bg-surface-1) 70%, transparent); }
.tab--active,
.tab[aria-selected='true'],
.tab[aria-current='page'] { color: var(--text-primary); }
.tab--active::after,
.tab[aria-selected='true']::after,
.tab[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.tab:focus-visible { outline-offset: -2px; }
.tab .badge { height: 18px; padding: 0 6px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.toolbar form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 auto; margin: 0; }
.toolbar .input, .toolbar .select { width: auto; flex: 1 1 180px; min-width: 0; max-width: 340px; }
.toolbar .select { flex-basis: 160px; max-width: 240px; }
/* Labelled filters: the .field wrapper is the flex item (a column flexbox), so its control must not grow vertically. */
.toolbar:has(> .field) { align-items: flex-end; }
.toolbar > .field { flex: 1 1 180px; max-width: 340px; }
.toolbar > .field > .input, .toolbar > .field > .select { flex: none; width: 100%; max-width: none; }
@media (max-width: 560px) {
  .toolbar, .toolbar form { width: 100%; }
  .toolbar .input, .toolbar .select { flex: 1 1 100%; max-width: none; }
  .toolbar > .field { flex: 1 1 100%; max-width: none; }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
a.pagination__item:hover { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--text-primary); }
.pagination__item--active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-btn-primary);
}
.pagination__item--disabled { opacity: 0.4; pointer-events: none; }
.pagination__gap { border-color: transparent; background: none; min-width: 20px; padding: 0 2px; }
@media (max-width: 480px) {
  .pagination__label { display: none; }
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-ui);
  color: var(--text-muted);
  white-space: nowrap;
}
.breadcrumbs li { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; }
.breadcrumbs li:not(:last-child) { max-width: min(40%, 32ch); }
.breadcrumbs li > a, .breadcrumbs li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs li + li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin: 0 6px 0 2px;
  border-right: 1.5px solid var(--text-dim);
  border-top: 1.5px solid var(--text-dim);
  transform: rotate(45deg);
  flex: none;
}
.breadcrumbs a { color: var(--text-muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--text-primary); }
.breadcrumbs [aria-current='page'] {
  color: var(--text-primary);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .breadcrumbs li:not(:last-child):not(:nth-last-child(2)) { display: none; }
  /* The first visible crumb has no visible predecessor, so it must not draw a separator. */
  .breadcrumbs li:nth-last-child(2)::before { display: none; }
  .breadcrumbs li:nth-last-child(2) { max-width: 45vw; }
}

/* ---------------------------------------------------------------------
 * 16. Content components
 * ------------------------------------------------------------------- */
/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-surface-1) 50%, transparent);
  color: var(--text-muted);
  text-align: center;
}
.card .empty, .card.empty { border: 0; background: none; }
.card.empty { padding: 0; align-items: stretch; border: 1px solid var(--border-hairline); background: var(--bg-surface-1); }
.card__body.empty { padding: 44px 24px; }
.card.empty > .card__body { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 24px; }
.empty > .icon,
.card.empty > .card__body > .icon,
.empty__icon {
  box-sizing: content-box;
  padding: 14px;
  border-radius: 16px;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  box-shadow: inset 0 0 0 1px var(--border-hairline);
}
.empty :is(h2, h3, .empty__title) { margin: 4px 0 0; color: var(--text-primary); font-size: 1.0625rem; }
.empty p { margin: 0; max-width: 48ch; }
.empty > .btn, .empty > .row { margin-top: 6px; }

/* Rendered markdown */
.prose {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: break-word;
  min-width: 0;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose :is(h1, h2, h3, h4, h5, h6) { margin: 1.6em 0 0.55em; color: var(--text-primary); scroll-margin-top: calc(var(--header-h) + 16px); }
.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.4rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-hairline); }
.prose h3 { font-size: 1.15rem; }
.prose h4 { font-size: 1rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--accent-text); }
.prose ol > li::marker { font-weight: 700; font-size: 0.92em; }
.prose a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 40%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { color: var(--text-primary); }
.prose blockquote {
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--bg-surface-2) 60%, transparent);
  color: var(--text-secondary);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code {
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: 0.86em;
}
.prose pre {
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-canvas) 80%, black);
  border: 1px solid var(--border-hairline);
  line-height: 1.55;
}
.prose pre code { padding: 0; border: 0; background: none; font-size: 0.86rem; }
.prose hr { margin: 2em 0; }
.prose img { border-radius: var(--radius-sm); }
.prose table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.92em; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--border-subtle); text-align: left; }
.prose th { background: var(--bg-surface-2); color: var(--text-primary); }
.prose.muted { color: var(--text-muted); }
.prose--sm { font-size: var(--fs-body); line-height: 1.65; }

/* Avatars */
.avatar {
  display: inline-block;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-surface-3);
  box-shadow: 0 0 0 1px var(--border-subtle);
  vertical-align: middle;
}
.avatar--sm { width: 24px; height: 24px; }
.avatar--lg { width: 72px; height: 72px; box-shadow: 0 0 0 3px var(--bg-surface-1), 0 0 0 4px var(--border-strong); }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  vertical-align: middle;
}
.user-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.user-chip:hover { color: var(--accent-text); }
.user-chip__meta { display: block; color: var(--text-muted); font-size: var(--fs-small); font-weight: 500; }

/* Stats */
.stat { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat:not(.card *, .hero *) {
  padding: 18px 20px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.stat__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.stat__value {
  color: var(--text-primary);
  font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat__value .muted { font-weight: 600; }
.stat__hint { color: var(--text-muted); font-size: var(--fs-small); }

/* Bordered list */
.list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
  overflow: hidden;
}
.card > .list, .card__body > .list:only-child { border: 0; border-radius: inherit; background: transparent; }
.card__body:has(> .list:only-child) { padding: 0; }
.list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  min-width: 0;
}
.list__item:last-child { border-bottom: 0; }
.list__item.stack { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
a.list__item, .list__item > a:only-child { color: var(--text-secondary); text-decoration: none; transition: background-color var(--t-fast); }
a.list__item:hover { background: var(--row-hover); color: var(--text-primary); }

/* Key / value grid */
.kv {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 10px 24px;
  margin: 0;
  font-size: var(--fs-ui);
}
.kv__key { margin: 0; color: var(--text-muted); font-weight: 600; }
.kv__value { margin: 0; min-width: 0; color: var(--text-primary); overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv__value { margin-bottom: 10px; }
  .kv__value:last-child { margin-bottom: 0; }
}

/* Copyable code line */
.code-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 5px 5px 5px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-canvas) 75%, black);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-ui);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: border-color var(--t-fast);
}
span.code-box { display: inline-flex; max-width: 100%; vertical-align: middle; min-height: 36px; padding-block: 2px; }
.code-box > code, .code-box > .mono, .code-box > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.code-box > code::-webkit-scrollbar { display: none; }
.code-box > .btn { flex: none; }
.code-box.is-copied { border-color: color-mix(in srgb, var(--success) 60%, transparent); }
.code-box[data-copy] { cursor: copy; }

/* Colour swatch */
.color-swatch {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--swatch, var(--text-muted));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.4);
  vertical-align: middle;
}
.color-swatch--lg { width: 28px; height: 28px; border-radius: 8px; }

/* Disclosure (<details>) */
.disclosure {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-1);
  min-width: 0;
}
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-weight: 650;
  font-size: var(--fs-ui);
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-radius: inherit;
  transition: background-color var(--t-fast);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--t-fast);
}
.disclosure > summary:hover { background: var(--row-hover); }
.disclosure[open] > summary { border-bottom: 1px solid var(--border-hairline); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.disclosure[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.disclosure > :not(summary) { margin: 14px 16px; }
.disclosure > pre, .disclosure pre {
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--bg-canvas) 80%, black);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.table .disclosure { background: transparent; }
.table .disclosure > summary { padding: 6px 10px; font-size: var(--fs-small); }
.table .disclosure > :not(summary) { margin: 8px 10px; }

/* Sortable list (behaviour in /static/js/sortable.js) */
.sortable { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sortable__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-1);
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.list.sortable { gap: 0; }
.list .sortable__item { border: 0; border-bottom: 1px solid var(--border-hairline); border-radius: 0; }
.list .sortable__item:last-child { border-bottom: 0; }
.sortable__handle {
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
}
.sortable__handle:active { cursor: grabbing; }
.sortable__handle:hover { color: var(--text-primary); }
.sortable__moves { display: inline-flex; gap: 4px; margin-left: auto; flex: none; }
.sortable__moves:empty { display: none; }
.sortable__item:is(.is-dragging, .dragging, [aria-grabbed='true']) {
  opacity: 0.55;
  background: var(--bg-surface-2);
  border-color: var(--accent-border);
}
.sortable__item:is(.is-over, .drag-over, .is-drop-target) {
  box-shadow: inset 0 2px 0 var(--accent);
}
.sortable.is-sorting { user-select: none; }
.sortable.is-saving { opacity: 0.7; pointer-events: none; }
.sortable__status { margin: 6px 0 0; font-size: var(--fs-small); }
.sortable__item:focus-within { border-color: var(--accent-border); }

/* Tabs rendered as <button> (markdown editor, JS tab lists) */
button.tab { -webkit-appearance: none; appearance: none; margin: 0; line-height: inherit; }
button.tab:disabled { opacity: 0.5; cursor: not-allowed; }

/* Markdown editor (behaviour in /static/js/markdown-editor.js) */
.md-editor { min-width: 0; }
.md-editor__bar { align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--border-subtle); }
.md-editor__bar > .tabs { border-bottom: 0; }
.md-editor__tools { gap: 4px; padding-bottom: 6px; }
.md-editor__tools .btn { min-width: 32px; padding-inline: 8px; }
.md-editor__preview { min-height: 120px; padding: 12px 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--bg-surface-2); overflow: auto; }
.md-editor__count { margin: 0; font-size: var(--fs-small); text-align: right; }
@media (max-width: 640px) {
  .md-editor__bar { flex-direction: column; align-items: stretch; }
  .md-editor__tools { flex-wrap: wrap; }
}

/* Template editor (admin/templates; behaviour in /static/js/template-editor.js) */
.tpl-editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.tpl-editor__preview { position: sticky; top: 16px; }
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: minmax(0, 1fr); } .tpl-editor__preview { position: static; } }
.tpl-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tpl-field { border: 1px solid color-mix(in srgb, var(--text-muted) 30%, transparent); border-radius: 10px; background: var(--bg-surface-2); }
.tpl-field--open { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tpl-field--dragging { opacity: .45; }
.tpl-field--drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.tpl-field--drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.tpl-field--invalid { border-color: var(--danger); }
.tpl-field__head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.tpl-field__title { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tpl-field__title--empty { color: var(--text-muted); font-style: italic; font-weight: 400; }
.tpl-field__body { padding: 4px 14px 14px; border-top: 1px solid color-mix(in srgb, var(--text-muted) 20%, transparent); }
.tpl-field__handle { cursor: grab; }
.tpl-preview-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent); }
.tpl-roles { max-height: 240px; overflow: auto; padding: 8px; border: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent); border-radius: 8px; }
.tpl-icon-preview,
.tpl-list__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px;
  border: 1px solid currentColor; background: color-mix(in srgb, currentColor 12%, transparent);
}

/* Rules */
.rule-category { scroll-margin-top: calc(var(--header-h) + 16px); min-width: 0; }
.rule-category > :is(h2, .rule-category__title) { display: flex; align-items: center; gap: 12px; }
.rule {
  position: relative;
  padding: 18px 20px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
  scroll-margin-top: calc(var(--header-h) + 16px);
  transition: border-color var(--t-fast), background-color var(--t-fast);
  min-width: 0;
}
.rule:hover { border-color: var(--border-subtle); }
.rule:target { border-color: var(--accent-border); background: color-mix(in srgb, var(--accent) 6%, var(--bg-surface-1)); }
.rule > .row { flex-wrap: nowrap; align-items: flex-start; }
.rule__code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 46px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
a.rule__code:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--text-primary); }
.rule__title { margin: 0; padding-top: 1px; color: var(--text-primary); font-size: 1.0625rem; font-weight: 700; line-height: 1.45; }
.rule__body { margin-top: 10px; color: var(--text-secondary); }
.rule__body.prose { font-size: var(--fs-body); line-height: 1.7; }

/* Timeline (application history / notes) */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline__item {
  --_c: var(--border-strong);
  position: relative;
  padding: 0 0 20px 28px;
  min-width: 0;
}
.timeline__item::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-canvas);
  border: 2px solid var(--_c);
  z-index: 1;
}
.timeline__item::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 2px;
  width: 1px;
  background: var(--border-subtle);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::after { display: none; }
.timeline__item--accent { --_c: var(--accent-text); }
.timeline__item--success, .timeline__item--accepted, .timeline__item--ok { --_c: var(--success); }
.timeline__item--danger, .timeline__item--rejected, .timeline__item--failed { --_c: var(--danger); }
.timeline__item--warning, .timeline__item--pending, .timeline__item--queued { --_c: var(--warning); }
.timeline__item--info { --_c: var(--info); }
.timeline__item--muted, .timeline__item--skipped, .timeline__item--withdrawn { --_c: var(--text-muted); }
.timeline__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--text-muted);
  font-size: var(--fs-small);
}
.timeline__meta strong { color: var(--text-primary); font-weight: 650; }
.timeline__body {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------
 * 17. Admin layout
 * ------------------------------------------------------------------- */
.admin { background: var(--bg-canvas); }
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  height: 100dvh;
  padding: 16px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-hairline);
  scrollbar-width: thin;
}
.admin-sidebar__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 4px; }
.admin-sidebar__head .brand { gap: 10px; font-size: 1.375rem; }
.admin-sidebar__head .brand__logo { width: 38px; height: 38px; }
.admin-sidebar .admin-sidebar__close { display: none; }
.admin-nav { display: flex; flex-direction: column; gap: 18px; }
.admin-nav__group { display: flex; flex-direction: column; gap: 2px; }
.admin-nav__heading {
  margin: 0;
  padding: 0 10px 6px;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.admin-nav__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.admin-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.admin-nav__link .icon { color: var(--text-muted); transition: color var(--t-fast); }
.admin-nav__link:hover { background: var(--bg-surface-1); color: var(--text-primary); }
.admin-nav__link:hover .icon { color: var(--text-secondary); }
.admin-nav__link--active {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 4%, transparent);
}
.admin-nav__link--active .icon { color: var(--accent-text); }
.admin-nav__link--active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.admin-sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
}
.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 2px 10px;
  min-width: 0;
}
.admin-user__info { flex: 1; min-width: 0; line-height: 1.3; }
.admin-user__name { display: block; color: var(--text-primary); font-weight: 700; font-size: var(--fs-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user__role { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: var(--fs-small); overflow: hidden; white-space: nowrap; }
.admin-user form { margin: 0; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg-canvas) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-hairline);
}
.admin-topbar .admin-topbar__toggle { display: none; }
.admin-topbar nav { min-width: 0; flex: 1 1 auto; }
.admin-topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.admin-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px;
  padding: 28px 32px 64px;
}
.admin-content .page-header { padding: 0 0 24px; }
.admin-content .page-header__title { font-size: clamp(1.4rem, 2.4vw, 1.75rem); }
.admin-content .container { width: 100%; }
.admin-content .section { padding-block: 0; }
.admin-content .section + .section { margin-top: 28px; }
.admin-content > .flash-stack { margin-bottom: 24px; }
/* Default vertical rhythm between top-level blocks (tabs, alerts, stat grids, toolbars, tables). */
.admin-content > .tabs { margin-bottom: 24px; }
.admin-content > :not(.page-header, .flash-stack, .tabs) + * { margin-top: 20px; }
.admin-backdrop { display: none; }

@media (max-width: 1023px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(296px, 86vw);
    transform: translateX(-102%);
    visibility: hidden;
    box-shadow: 24px 0 60px -10px rgba(0, 0, 0, 0.7);
    transition: transform var(--t-normal), visibility 0s linear 0.24s;
  }
  .admin-sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform var(--t-normal), visibility 0s;
  }
  .admin-sidebar .admin-sidebar__close { display: inline-flex; }
  .admin-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: var(--overlay);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-normal);
  }
  .nav-open .admin-backdrop { opacity: 1; pointer-events: auto; }
  .admin-topbar { padding: 0 16px 0 10px; gap: 8px; }
  .admin-topbar .admin-topbar__toggle { display: inline-flex; }
  .admin-content { padding: 20px 16px 48px; }
}
@media (max-width: 1023px) {
  .nav-open { overflow: hidden; }
}
@media (max-width: 560px) {
  .admin-topbar__actions .status-pill, .admin-topbar__actions .nav-label { display: none; }
}

/* ---------------------------------------------------------------------
 * 18. Error page
 * ------------------------------------------------------------------- */
.error-page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: max(520px, calc(100svh - var(--header-h) - 160px));
  margin-top: calc(-1 * var(--main-pt));
  padding: var(--space-10) 0;
  text-align: center;
}
.error-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('/static/img/hero/scene-1.jpg') center 40% / cover no-repeat;
  opacity: 0.32;
  filter: saturate(0.7);
}
.error-page::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 70% at 50% 45%, color-mix(in srgb, var(--bg-canvas) 55%, transparent), var(--bg-canvas) 100%),
    linear-gradient(180deg, transparent 60%, var(--bg-canvas));
}
.main:has(> .error-page) { padding-bottom: 0; }
.error-page__inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); max-width: 600px; }
.error-page__code {
  font-family: var(--font-display);
  font-size: clamp(6.5rem, 22vw, 12rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
  user-select: none;
}
.error-page__code span { color: var(--accent-text); }
.error-page__title {
  margin: var(--space-1) 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.error-page__text { margin: 0; max-width: 46ch; color: var(--text-secondary); font-size: var(--fs-lead); }
.error-page__actions { justify-content: center; margin-top: var(--space-2); }
@media (max-width: 480px) {
  .error-page__actions > .btn { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------------
 * 20. Page-level patterns (documented at the top of this file)
 * ------------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-wrap: balance;
}
.display--xl { font-size: clamp(3.25rem, 9vw, 7rem); line-height: 0.9; }
.display--lg { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.display--md { font-size: clamp(2rem, 4.2vw, 3.25rem); }
.display--sm { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1; }
.lead {
  max-width: 60ch;
  color: var(--text-secondary);
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  line-height: 1.65;
}

/* Public page headers use the display face too (admin keeps the compact sans). */
.site .page-header__title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

/* Section heading row */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-5);
}
.section-head > div { min-width: 0; max-width: 720px; }
.section-head__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.6vw, 3.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.section-head__title::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: var(--space-2);
  border-radius: 2px;
  background: var(--accent);
}
.section-head__sub {
  margin: var(--space-2) 0 0;
  max-width: 56ch;
  color: var(--text-secondary);
  font-size: var(--fs-lead);
  line-height: 1.6;
}
.section-head__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 700;
  white-space: nowrap;
}
.section-head__link .icon { color: var(--accent-text); transition: transform var(--t-fast); }
.section-head__link:hover { color: var(--text-primary); }
.section-head__link:hover .icon { transform: translateX(4px); }
.section-head--center { flex-direction: column; align-items: center; text-align: center; }
.section-head--center > div { margin-inline: auto; }
.section-head--center .section-head__title::before { margin-inline: auto; }
.section-head--center .section-head__sub { margin-inline: auto; }

/* Full-bleed bands */
.band {
  position: relative;
  isolation: isolate;
  padding-block: var(--section-y);
}
.band--tight { padding-block: var(--space-6); }
/* A page that ends in a band runs straight into the footer. */
.main:has(> .band:last-child) { padding-bottom: 0; }
.band--surface {
  background: var(--bg-sidebar);
  border-block: 1px solid var(--border-hairline);
}
.band--photo {
  --band-image: url('/static/img/hero/scene-1.jpg');
  overflow: hidden;
  background: var(--bg-canvas);
}
.band--scene-5 { --band-image: url('/static/img/hero/scene-5.jpg'); }
.band--scene-4 { --band-image: url('/static/img/hero/scene-4.jpg'); }
.band--scene-1 { --band-image: url('/static/img/hero/scene-1.jpg'); }
@media (max-width: 960px) {
  .band--photo, .band--scene-1 { --band-image: url('/static/img/hero/scene-1-960.jpg'); }
  .band--scene-5 { --band-image: url('/static/img/hero/scene-5-960.jpg'); }
  .band--scene-4 { --band-image: url('/static/img/hero/scene-4-960.jpg'); }
}
.band--photo::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--band-image) var(--band-position, center) / cover no-repeat;
}
.band--photo::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, var(--bg-canvas) 0%, transparent 30%, transparent 70%, var(--bg-canvas) 100%),
    linear-gradient(180deg, transparent 35%, color-mix(in srgb, var(--accent) 16%, transparent) 80%, transparent 100%),
    color-mix(in srgb, var(--bg-canvas) 66%, transparent);
}

/* Inner-page photo banner */
.page-hero {
  --page-hero-image: url('/static/img/hero/scene-5.jpg');
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: clamp(260px, 30vw, 340px);
  margin-top: calc(-1 * var(--main-pt));
  margin-bottom: var(--space-6);
  padding: var(--space-8) 0 var(--space-5);
  background: var(--bg-surface-1);
}
.flash-wrap + .page-hero { margin-top: 0; }
.page-hero--scene-5 { --page-hero-image: url('/static/img/hero/scene-5.jpg'); }
.page-hero--scene-4 { --page-hero-image: url('/static/img/hero/scene-4.jpg'); }
.page-hero--scene-1 { --page-hero-image: url('/static/img/hero/scene-1.jpg'); }
@media (max-width: 960px) {
  .page-hero, .page-hero--scene-5 { --page-hero-image: url('/static/img/hero/scene-5-960.jpg'); }
  .page-hero--scene-4 { --page-hero-image: url('/static/img/hero/scene-4-960.jpg'); }
  .page-hero--scene-1 { --page-hero-image: url('/static/img/hero/scene-1-960.jpg'); }
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--page-hero-image) var(--page-hero-position, center 45%) / cover no-repeat;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-canvas) 35%, transparent) 0%, color-mix(in srgb, var(--bg-canvas) 50%, transparent) 45%, var(--bg-canvas) 100%),
    linear-gradient(90deg, color-mix(in srgb, var(--bg-canvas) 70%, transparent) 0%, transparent 75%),
    linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--accent) 14%, transparent) 85%, transparent 100%);
}
.page-hero__inner { position: relative; min-width: 0; }
.page-hero__inner > .breadcrumbs { margin-bottom: var(--space-2); }
.page-hero__title {
  margin: 0;
  max-width: 20ch;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 6.4vw, 4.75rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.page-hero__sub {
  margin: var(--space-2) 0 0;
  max-width: 60ch;
  color: color-mix(in srgb, var(--text-primary) 80%, transparent);
  font-size: var(--fs-lead);
  line-height: 1.6;
}
.page-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--space-3); }
.page-hero--sm { min-height: clamp(200px, 20vw, 240px); }
@media (max-width: 640px) {
  .page-hero { min-height: 220px; padding: var(--space-6) 0 var(--space-4); margin-bottom: var(--space-4); }
}

/* Image-led cards (no box) */
.media-grid {
  display: grid;
  gap: var(--space-6) var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.media-grid > * { min-width: 0; }
.media-grid > .media-card--feature { grid-column: 1 / -1; }
.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  color: var(--text-secondary);
  text-decoration: none;
}
a.media-card:hover { color: var(--text-secondary); }
.media-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.85);
}
.media-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 7%, transparent);
  pointer-events: none;
}
.media-card__img,
.media-card__fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease-out);
}
.media-card__fallback {
  --fallback-image: url('/static/img/hero/scene-5-960.jpg');
  position: absolute;
  inset: 0;
  background: var(--fallback-image) var(--fallback-position, center) / cover no-repeat;
}
.media-card__fallback--scene-4 { --fallback-image: url('/static/img/hero/scene-4-960.jpg'); }
.media-card__fallback--scene-1 { --fallback-image: url('/static/img/hero/scene-1-960.jpg'); }
.media-card__fallback::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(200deg, transparent 15%, color-mix(in srgb, var(--bg-canvas) 88%, transparent) 92%),
    linear-gradient(0deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    color-mix(in srgb, var(--bg-canvas) 20%, transparent);
}
.media-card__mark {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 1;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}
a.media-card:hover :is(.media-card__img, .media-card__fallback) { transform: scale(1.045); }
.media-card__body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.media-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--text-muted);
  font-size: var(--fs-small);
  font-weight: 600;
}
.media-card__flag { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); }
.media-card__title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3125rem;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.018em;
  text-wrap: balance;
  transition: color var(--t-fast);
}
a.media-card:hover .media-card__title { color: color-mix(in srgb, var(--accent-text) 45%, var(--text-primary)); }
.media-card__text {
  margin: 0;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.media-card__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 700;
}
.media-card__more .icon { color: var(--accent-text); transition: transform var(--t-fast); }
a.media-card:hover .media-card__more .icon { transform: translateX(4px); }
@media (min-width: 860px) {
  .media-card--feature {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-6);
  }
  .media-card--feature .media-card__media { aspect-ratio: 16 / 9; }
  .media-card--feature .media-card__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.4vw, 2.875rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: 0.005em;
    text-transform: uppercase;
  }
  .media-card--feature .media-card__text { font-size: var(--fs-lead); -webkit-line-clamp: 4; line-clamp: 4; }
  .media-card--feature .media-card__body { gap: 14px; }
}

/* Hairline link rows */
.link-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-subtle);
}
.link-list > li { min-width: 0; border-bottom: 1px solid var(--border-subtle); }
.link-list--2col { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); column-gap: var(--space-5); border-top: 0; }
.link-list--2col > li:nth-child(-n + 2) { border-top: 1px solid var(--border-subtle); }
@media (max-width: 900px) { .link-list--2col > li:nth-child(2) { border-top: 0; } }
.link-list__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: 'icon body state arrow';
  align-items: center;
  gap: 4px 20px;
  padding: 22px 12px 22px 4px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background-color var(--t-normal), padding var(--t-normal);
}
a.link-list__item:hover {
  color: var(--text-secondary);
  background: linear-gradient(90deg, color-mix(in srgb, var(--text-primary) 3.5%, transparent), transparent 85%);
  padding-left: 12px;
}
.link-list__icon {
  --_c: var(--tile-color, var(--accent));
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--_c) 15%, transparent);
  color: color-mix(in srgb, var(--_c) 68%, var(--text-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 26%, transparent);
}
.link-list__body { grid-area: body; min-width: 0; }
.link-list__title { display: block; color: var(--text-primary); font-size: 1.0625rem; font-weight: 700; line-height: 1.3; }
.link-list__text {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-list__state {
  grid-area: state;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
}
.link-list__state--open { color: var(--success-text); }
.link-list__state--open::before,
.link-list__state--closed::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.link-list__state small { color: var(--text-muted); font-weight: 500; font-size: inherit; }
.link-list__arrow { grid-area: arrow; color: var(--text-muted); transition: transform var(--t-fast), color var(--t-fast); }
a.link-list__item:hover .link-list__arrow { transform: translateX(4px); color: var(--accent-text); }
@media (max-width: 560px) {
  .link-list__item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: 'icon body arrow' 'icon state arrow';
    column-gap: 16px;
    padding-block: 18px;
  }
  .link-list__icon { width: 44px; height: 44px; align-self: start; }
  .link-list__text { white-space: normal; }
  .link-list__state { margin-top: 6px; }
}

/* Two-column layout */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-5) clamp(40px, 7vw, 96px);
  align-items: start;
}
.split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split__aside { position: sticky; top: calc(var(--header-h) + var(--space-4)); min-width: 0; }
.split__main { min-width: 0; }
.split--reverse > .split__aside { order: 2; }
.split__aside .section-head { flex-direction: column; align-items: flex-start; margin-bottom: 0; }
@media (max-width: 900px) {
  .split, .split--even { grid-template-columns: minmax(0, 1fr); }
  .split__aside { position: static; }
  .split--reverse > .split__aside { order: 0; }
}

/* Inline steps timeline */
.steps {
  --node: 56px;
  --steps-gap: var(--space-4);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-5) var(--steps-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps__item { position: relative; min-width: 0; }
.steps__item::before {
  content: '';
  position: absolute;
  top: calc(var(--node) / 2);
  left: calc(var(--node) + 16px);
  right: calc(16px - var(--steps-gap));
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), var(--border-hairline));
}
.steps__item:last-child::before { display: none; }
.steps__node {
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  margin-bottom: var(--space-3);
  border-radius: 50%;
  background: var(--bg-surface-1);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  transition: background-color var(--t-normal), color var(--t-normal), box-shadow var(--t-normal), transform var(--t-normal);
}
.steps__item:hover .steps__node,
.steps__item:focus-within .steps__node {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  transform: translateY(-2px);
}
.steps__title { margin: 0 0 var(--space-1); color: var(--text-primary); font-size: 1.1875rem; font-weight: 750; letter-spacing: -0.015em; }
.steps__title a { color: inherit; }
.steps__title a::after { content: ''; position: absolute; inset: -12px; border-radius: var(--radius-md); }
.steps__title a:focus-visible { outline: none; }
.steps__title a:focus-visible::after { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.steps__text { margin: 0; max-width: 34ch; color: var(--text-secondary); }
@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps__item:nth-child(2n)::before { display: none; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .steps__item { display: grid; grid-template-columns: var(--node) minmax(0, 1fr); column-gap: 20px; align-items: start; }
  .steps__node { grid-row: 1 / span 2; margin: 0; }
  .steps__title { margin-top: 6px; }
  .steps__item::before,
  .steps__item:nth-child(2n)::before {
    display: block;
    top: calc(var(--node) + 8px);
    bottom: calc(8px - var(--space-4));
    left: calc(var(--node) / 2);
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, var(--border-strong), var(--border-hairline));
  }
  .steps__item:last-child::before { display: none; }
}

/* Quiet live status line */
.status-line {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 12px;
  margin: 0;
  color: color-mix(in srgb, var(--text-primary) 74%, transparent);
  font-size: var(--fs-ui);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.status-line > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 560px) {
  .status-line__sep--wrap { display: none; }
  .status-line__wrap { flex-basis: 100%; text-align: center; }
}
.status-line strong { color: var(--text-primary); font-weight: 700; }
.status-line__sep { color: color-mix(in srgb, var(--text-primary) 32%, transparent); }
a.status-line:hover { color: var(--text-primary); }

/* Buttons for photos / big CTAs */
.btn--glass {
  --btn-bg: color-mix(in srgb, var(--text-primary) 7%, transparent);
  --btn-fg: var(--text-primary);
  --btn-border: color-mix(in srgb, var(--text-primary) 30%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.btn--glass:hover { --btn-bg: color-mix(in srgb, var(--text-primary) 15%, transparent); --btn-border: color-mix(in srgb, var(--text-primary) 50%, transparent); }
.btn--xl { height: 54px; padding: 0 28px; gap: 10px; font-size: 1rem; font-weight: 700; border-radius: 14px; }
@media (max-width: 480px) {
  .btn--xl { height: 52px; padding: 0 22px; }
}

/* ---------------------------------------------------------------------
 * 21. Home page
 * ------------------------------------------------------------------- */
.page-home .main { padding: 0; }
.page-home .flash-wrap {
  position: absolute;
  top: calc(var(--header-h) + var(--space-2));
  left: 0;
  right: 0;
  z-index: 5;
}

/* Full-bleed hero */
.hero-full {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: max(620px, 100vh);
  min-height: max(620px, 100svh);
  padding: calc(var(--header-h) + var(--space-5)) 0 var(--space-12);
  background: var(--bg-canvas);
  text-align: center;
}
.hero-full__media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero-full__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: var(--hero-position, center 55%);
  opacity: 0;
  transition: opacity 1.8s ease;
}
.hero-full__slide.is-active { opacity: 1; }
.hero-full__slide:is(.is-active, .is-leaving) { animation: hero-zoom 22s cubic-bezier(0.25, 0.1, 0.25, 1) both; }
@keyframes hero-zoom { from { transform: scale(var(--zoom-from, 1.02)); } to { transform: scale(var(--zoom-to, 1.12)); } }
/* The night photo carries the game's watermark bottom-right: keep it cropped out while zooming. */
.hero-full__slide--scene-1 { }
.hero-full::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--accent) 17%, transparent) 78%, transparent 100%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--bg-canvas) 70%, transparent) 0%,
      color-mix(in srgb, var(--bg-canvas) 38%, transparent) 20%,
      color-mix(in srgb, var(--bg-canvas) 42%, transparent) 50%,
      color-mix(in srgb, var(--bg-canvas) 78%, transparent) 80%,
      var(--bg-canvas) 100%),
    radial-gradient(70% 55% at 50% 50%, color-mix(in srgb, var(--bg-canvas) 40%, transparent), transparent 100%);
}
.hero-full__inner { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.hero-full__inner > * { animation: hero-rise 0.9s var(--ease-out) both; }
.hero-full__inner > :nth-child(2) { animation-delay: 0.08s; }
.hero-full__inner > :nth-child(3) { animation-delay: 0.16s; }
.hero-full__inner > :nth-child(4) { animation-delay: 0.24s; }
.hero-full__inner > :nth-child(5) { animation-delay: 0.32s; }
@keyframes hero-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero-full__logo {
  width: clamp(132px, 15vw, 212px);
  height: auto;
  margin-bottom: var(--space-3);
  filter: drop-shadow(0 20px 36px rgba(0, 0, 0, 0.55)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.hero-full__title {
  margin: 0;
  max-width: 14ch;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 9vw, 7.5rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: 0.008em;
  text-transform: uppercase;
  text-shadow: 0 6px 48px rgba(0, 0, 0, 0.5);
  text-wrap: balance;
}
.hero-full__text {
  margin: var(--space-3) auto 0;
  max-width: 50ch;
  color: color-mix(in srgb, var(--text-primary) 84%, transparent);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.6;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.hero-full__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: var(--space-5); }
.hero-full .status-line { margin-top: var(--space-4); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6); }
.hero-full__cue {
  position: absolute;
  left: 50%;
  bottom: var(--space-3);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  color: color-mix(in srgb, var(--text-primary) 62%, transparent);
  transition: color var(--t-fast);
}
.hero-full__cue:hover { color: var(--text-primary); }
.hero-full__cue .icon { animation: cue-bob 2.4s ease-in-out infinite; }
@keyframes cue-bob { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(4px); } }
@media (max-width: 640px) {
  .hero-full { padding: calc(var(--header-h) + var(--space-4)) 0 var(--space-10); }
  .hero-full__logo { margin-bottom: var(--space-2); }
  .hero-full__actions { flex-direction: column; align-items: stretch; width: min(100%, 340px); }
  .hero-full .status-line { font-size: var(--fs-small); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-full__slide:is(.is-active, .is-leaving), .hero-full__inner > *, .hero-full__cue .icon { animation: none; }
}

/* Connect strip below the hero */
.connect-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-4);
  border-block: 1px solid var(--border-subtle);
}
.connect-strip__title { margin: 0; color: var(--text-primary); font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase; }
.connect-strip__hint { margin: 6px 0 0; color: var(--text-secondary); font-size: var(--fs-ui); }
.connect-strip .code-box { min-height: 52px; padding-left: 18px; font-size: 0.9375rem; }
.connect-strip__links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 960px) {
  .connect-strip { grid-template-columns: minmax(0, 1fr); }
  .connect-strip__links { justify-content: flex-start; }
}

.home-section { padding-block: var(--section-y); }
.home-section + .home-section { padding-top: 0; }

/* Final call-to-action */
.home-cta { text-align: center; padding-block: clamp(96px, 14vw, 176px); }
/* Crop away the right/bottom edge of the photo (the game's watermark sits there). */
.home-cta::before { transform: scale(1.3); transform-origin: 30% 20%; }
.home-cta__title { margin: 0 auto; max-width: 16ch; }
.home-cta__text { margin: var(--space-3) auto 0; max-width: 52ch; color: color-mix(in srgb, var(--text-primary) 80%, transparent); font-size: var(--fs-lead); }
.home-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: var(--space-5); }
@media (max-width: 480px) {
  .home-cta__actions > .btn { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------------
 * 22. Small screens & motion
 * ------------------------------------------------------------------- */
@media (max-width: 480px) {
  .card__header, .card__body, .card__footer { padding-inline: 16px; }
  .card:not(:has(> .card__body, > .card__header, > .card__footer, > .table-wrap, > .list, > img, > .empty)) { padding: 16px; }
  .table th, .table td { padding-inline: 12px; }
  .btn--lg { height: 44px; padding: 0 18px; }
  /* Connect commands must be readable in full on phones rather than scroll inside a narrow box. */
  .code-box > code, .code-box > .mono { white-space: normal; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .status-dot--online::after { display: none; }
  .card--link:hover, a.news-card:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .admin-sidebar, .admin-topbar, .toasts, .flash-stack { display: none !important; }
  body { background: #fff; color: #000; }
  .admin-shell { display: block; }
}

/* ===== page: rules ===== */
/* Rules page (src/views/rules.ejs + public/js/rules-search.js). Everything is
 * prefixed .rules- so it never touches the shared .rule* classes used by the
 * admin preview. */
[data-rule][hidden], [data-rule-category][hidden], [data-rules-tab][hidden],
[data-rules-empty][hidden], [data-rules-count][hidden], [data-rules-key][hidden] { display: none !important; }

/* Hero: page-hero + meta line + large glass search */
.rules-hero { --page-hero-position: center 38%; min-height: clamp(360px, 34vw, 440px); }
.rules-hero .page-hero__sub { max-width: 64ch; text-wrap: balance; }
.rules-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: var(--space-2) 0 0;
  color: color-mix(in srgb, var(--text-primary) 64%, transparent);
  font-size: var(--fs-ui);
  font-weight: 600;
}
.rules-hero__sep { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.rules-search { position: relative; width: min(100%, 580px); margin-top: var(--space-4); }
.rules-search__input {
  display: block;
  width: 100%;
  height: 58px;
  padding: 0 56px 0 54px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 16%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-canvas) 58%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
  color: var(--text-primary);
  font: 500 1rem/1 var(--font-sans);
  appearance: none;
  transition: border-color var(--t-fast), background-color var(--t-fast), box-shadow var(--t-fast);
}
.rules-search__input::placeholder { color: color-mix(in srgb, var(--text-primary) 50%, transparent); opacity: 1; }
.rules-search__input:hover { border-color: color-mix(in srgb, var(--text-primary) 26%, transparent); }
.rules-search__input:focus {
  outline: none;
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--bg-canvas) 78%, transparent);
  box-shadow: var(--focus-ring), 0 24px 48px -24px rgba(0, 0, 0, 0.8);
}
.rules-search__input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.8); cursor: pointer; margin-right: -30px; }
.rules-search__icon {
  position: absolute;
  left: 19px;
  top: 50%;
  display: flex;
  transform: translateY(-50%);
  color: color-mix(in srgb, var(--text-primary) 62%, transparent);
  z-index: 1;
  pointer-events: none;
  transition: color var(--t-fast);
}
.rules-search:focus-within .rules-search__icon { color: var(--accent-text); }
.rules-search__key {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 26px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--text-primary) 18%, transparent);
  color: color-mix(in srgb, var(--text-primary) 72%, transparent);
  z-index: 1;
  pointer-events: none;
}
.rules-search:focus-within .rules-search__key { display: none; }
@media (hover: none) { .rules-search__key { display: none; } }

/* Layout: sticky category nav + rule list */
.rules-page { padding-top: var(--space-2); }
.rules-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
.rules-layout--single { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
.rules-main { display: flex; flex-direction: column; gap: var(--space-10); min-width: 0; }

.rules-toc {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - var(--header-h) - var(--space-8));
}
.rules-toc__title {
  margin: 0 0 var(--space-2);
  padding-left: 18px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.rules-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  border-left: 1px solid var(--border-subtle);
  scrollbar-width: none;
}
.rules-toc__list::-webkit-scrollbar { display: none; }
.rules-toc__link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: -1px;
  padding: 10px 12px 10px 17px;
  border-left: 2px solid transparent;
  border-radius: 0 10px 10px 0;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: 1.3;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}
.rules-toc__link:hover { color: var(--text-primary); background: var(--row-hover); }
.rules-toc__link:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.rules-toc__icon { display: flex; flex: none; color: var(--text-muted); transition: color var(--t-fast); }
.rules-toc__label { flex: 1 1 auto; min-width: 0; }
.rules-toc__count {
  flex: none;
  color: var(--text-muted);
  font: 600 0.75rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.rules-toc__entry.is-active > .rules-toc__link {
  color: var(--text-primary);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-softer), transparent 85%);
}
.rules-toc__entry.is-active .rules-toc__icon { color: var(--accent-text); }
.rules-searching .rules-toc__count { color: var(--accent-text); }
.rules-no-results .rules-toc { visibility: hidden; }
.rules-toc__help {
  margin: var(--space-4) 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: var(--fs-small);
  line-height: 1.6;
}
.rules-toc__help a {
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.rules-toc__help a:hover { color: var(--text-primary); text-decoration-color: currentColor; }

/* Category */
.rules-cat { min-width: 0; scroll-margin-top: calc(var(--header-h) + var(--space-3)); }
.rules-cat__head { display: flex; align-items: center; gap: var(--space-2); }
.rules-cat__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent) 4%, transparent));
  color: var(--accent-text);
}
.rules-cat__heading { min-width: 0; }
.rules-cat__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.rules-cat__title a { color: inherit; }
.rules-cat__title a:hover { color: var(--text-primary); }
.rules-cat__count { margin: 6px 0 0; color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; }
.rules-cat__desc {
  max-width: 64ch;
  margin: var(--space-3) 0 0;
  color: var(--text-secondary);
  font-size: var(--fs-lead);
  line-height: 1.65;
}
.rules-cat__none { margin: var(--space-3) 0 0; padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); color: var(--text-muted); }

/* Rule rows: hairlines, code column, no boxes */
.rules-list { margin: var(--space-4) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border-subtle); }
.rules-item {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 36px;
  gap: 0 var(--space-2);
  padding: var(--space-3) var(--space-1) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border-hairline);
  scroll-margin-top: calc(var(--header-h) + var(--space-3));
  transition: background-color var(--t-normal);
}
.rules-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--t-normal);
}
.rules-item:hover { background-color: var(--row-hover); }
.rules-item:target { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 75%); }
.rules-item:target::before { opacity: 1; }
.rules-item__code {
  align-self: start;
  padding-top: 3px;
  color: var(--accent-text);
  font: 600 0.875rem/1.4 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-decoration: none;
}
.rules-item__sect { margin-right: 5px; color: color-mix(in srgb, var(--accent-text) 50%, transparent); }
.rules-item__code:hover { color: var(--text-primary); }
.rules-item__content { min-width: 0; }
.rules-item__title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.rules-item__body {
  max-width: 68ch;
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--fs-body);
  line-height: 1.75;
}
.rules-item__copy {
  display: grid;
  place-items: center;
  align-self: start;
  width: 36px;
  height: 36px;
  margin-top: -5px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast), color var(--t-fast), background-color var(--t-fast);
}
.rules-item:hover .rules-item__copy,
.rules-item:target .rules-item__copy,
.rules-item__copy:focus-visible,
.rules-item__copy.is-copied { opacity: 1; }
.rules-item__copy:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.rules-item__copy:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rules-item__copy.is-copied { color: var(--success-text); }
@media (hover: none) { .rules-item__copy { opacity: 0.75; } }

/* Search highlight, result line, empty states */
.rules-mark {
  margin: 0 -1px;
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--text-primary);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.rules-status { margin: 0 0 calc(-1 * var(--space-6)); color: var(--text-secondary); font-size: var(--fs-ui); font-weight: 600; }
.rules-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--space-10) var(--space-3);
  color: var(--text-muted);
  text-align: center;
}
.rules-empty > .icon { color: var(--text-dim); }
.rules-empty__title {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}
.rules-empty p { margin: 0; max-width: 46ch; }
.rules-empty .btn { margin-top: var(--space-1); }

/* Closing band */
.rules-outro { --band-position: center 62%; margin-top: var(--section-y); text-align: center; }
.rules-outro__title { margin: 0 auto; max-width: 18ch; }
.rules-outro__text {
  max-width: 50ch;
  margin: var(--space-3) auto 0;
  color: color-mix(in srgb, var(--text-primary) 80%, transparent);
  font-size: var(--fs-lead);
  line-height: 1.6;
}
.rules-outro__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: var(--space-5); }

/* Tablet & phone: the category nav becomes a sticky horizontal scroller */
@media (max-width: 959.98px) {
  .rules-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .rules-toc {
    z-index: 20;
    top: var(--header-h);
    max-height: none;
    margin: 0 calc(-1 * var(--gutter));
    background: color-mix(in srgb, var(--bg-canvas) 86%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border-block: 1px solid var(--border-hairline);
  }
  .rules-toc__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .rules-toc__help { display: none; }
  .rules-toc__list {
    display: flex;
    gap: 4px;
    padding: 10px var(--gutter);
    border-left: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--gutter);
  }
  .rules-toc__entry { flex: none; }
  .rules-toc__link {
    gap: 8px;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    white-space: nowrap;
  }
  .rules-toc__entry.is-active > .rules-toc__link {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: var(--accent-soft);
  }
  .rules-toc__count { display: none; }
  .rules-searching .rules-toc__count { display: inline; }
  .rules-no-results .rules-toc { display: none; }
  .rules-main { gap: var(--space-8); }
  .rules-cat { scroll-margin-top: calc(var(--header-h) + 96px); }
  .rules-item { scroll-margin-top: calc(var(--header-h) + 76px); }
}
@media (max-width: 560px) {
  .rules-hero { min-height: 0; }
  .rules-page { padding-top: 0; }
  .rules-hero__meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .rules-hero__sep { display: none; }
  .rules-search { margin-top: var(--space-3); }
  .rules-search__input { height: 54px; padding-left: 50px; font-size: 16px; border-radius: 14px; }
  .rules-search__icon { left: 17px; }
  .rules-cat__icon { width: 44px; height: 44px; border-radius: 12px; }
  .rules-cat__desc { font-size: var(--fs-body); }
  .rules-item {
    grid-template-columns: minmax(0, 1fr) 36px;
    padding: var(--space-3) 0 var(--space-3) 14px;
  }
  .rules-item__code { grid-column: 1; grid-row: 1; padding-top: 0; margin-bottom: 4px; font-size: 0.8125rem; }
  .rules-item__content { grid-column: 1; grid-row: 2; }
  .rules-item__copy { grid-column: 2; grid-row: 1 / span 2; margin-top: -8px; }
  .rules-item__title { font-size: 1.0625rem; }
  .rules-outro__actions > .btn { flex: 1 1 100%; }
}
/* ===== end page: rules ===== */

/* ===== page: news-pages ===== */
/* News list (/nyheder), news article (/nyheder/:slug) and custom pages (/side/:slug, e.g. FAQ). */

/* --- Shared: breadcrumbs on photo heroes, long-form prose -------------- */
:is(.article-hero, .doc-hero) .breadcrumbs { margin-bottom: var(--space-3); }
:is(.article-hero, .doc-hero) .breadcrumbs a { color: color-mix(in srgb, var(--text-primary) 68%, transparent); }
:is(.article-hero, .doc-hero) .breadcrumbs a:hover { color: var(--text-primary); }
:is(.article-hero, .doc-hero) .breadcrumbs li + li::before { border-color: color-mix(in srgb, var(--text-primary) 40%, transparent); }

.prose:is(.article__body, .doc__body) {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: color-mix(in srgb, var(--text-secondary) 58%, var(--text-primary));
}
@media (min-width: 720px) {
  .prose.article__body { font-size: 1.125rem; }
}
.prose:is(.article__body, .doc__body) > p:first-child {
  color: color-mix(in srgb, var(--text-primary) 88%, var(--text-secondary));
  font-size: 1.12em;
  line-height: 1.7;
}
.prose:is(.article__body, .doc__body) a {
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose:is(.article__body, .doc__body) h3 {
  margin: 1.9em 0 0.5em;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.012em;
  line-height: 1.3;
}
/* Numbered lists: small crimson counters instead of plain digits. */
.prose:is(.article__body, .doc__body) ol { list-style: none; padding-left: 0; counter-reset: prose-ol; }
.prose:is(.article__body, .doc__body) ol > li {
  position: relative;
  margin: 0.65em 0;
  padding-left: 2.5em;
  counter-increment: prose-ol;
}
.prose:is(.article__body, .doc__body) ol > li::before {
  content: counter(prose-ol);
  position: absolute;
  left: 0;
  top: 0.26em;
  display: grid;
  place-items: center;
  width: 1.85em;
  height: 1.85em;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--accent-text);
  font-size: 0.78em;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.prose:is(.article__body, .doc__body) ul { list-style: none; padding-left: 0; }
.prose:is(.article__body, .doc__body) ul > li { position: relative; margin: 0.5em 0; padding-left: 1.6em; }
.prose:is(.article__body, .doc__body) ul > li::before {
  content: '';
  position: absolute;
  left: 0.2em;
  top: calc(0.9em - 1px);
  width: 0.6em;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.prose:is(.article__body, .doc__body) blockquote {
  margin: 1.8em 0;
  padding: 0.15em 0 0.15em 1.3em;
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: none;
  color: var(--text-primary);
  font-size: 1.12em;
  font-weight: 500;
  line-height: 1.65;
}
.prose:is(.article__body, .doc__body) hr {
  height: 1px;
  margin: 2.75em 0;
  border: 0;
  background: var(--border-subtle);
}
.prose:is(.article__body, .doc__body) img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--border-hairline);
}
.prose:is(.article__body, .doc__body) table { font-size: 0.9em; }

/* --- News list ------------------------------------------------------- */
.news-hero { --page-hero-position: center 32%; }
.news-index { padding-top: var(--space-1); }
.news-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-8) var(--space-4);
}
.news-grid > .media-card { grid-column: span 2; }
.news-grid > .news-grid__half { grid-column: span 3; }
.news-grid > .media-card--feature {
  grid-column: 1 / -1;
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-hairline);
}
.news-grid__half .media-card__title { font-size: clamp(1.375rem, 2vw, 1.625rem); }
.news-read { display: inline-flex; align-items: center; gap: 14px; }
.news-read::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
@media (max-width: 960px) {
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-3); }
  .news-grid > .media-card,
  .news-grid > .news-grid__half { grid-column: span 1; }
  .news-grid > .media-card--feature { grid-column: 1 / -1; padding-bottom: var(--space-6); }
}
@media (max-width: 859px) {
  .news-grid > .media-card--feature .media-card__title {
    font-family: var(--font-display);
    font-size: clamp(1.875rem, 6vw, 2.375rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: 0.005em;
    text-transform: uppercase;
  }
}
@media (max-width: 620px) {
  .news-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .news-grid > .media-card { gap: var(--space-2); }
}

/* Pager: hairline row, quiet numbers, text steps at the ends. */
.news-pager {
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--space-2);
  margin-top: var(--space-10);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.news-pager__pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-width: 0; }
.news-pager .pagination__item {
  min-width: 40px;
  height: 40px;
  border-color: transparent;
  border-radius: var(--radius-full);
  background: none;
}
.news-pager a.pagination__item:hover { background: var(--bg-surface-1); border-color: var(--border-subtle); }
.news-pager .pagination__item--active { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.news-pager .news-pager__step { padding: 0 18px; border-color: var(--border-subtle); color: var(--text-primary); }
.news-pager .news-pager__step .icon { color: var(--accent-text); }
.news-pager .pagination__item--disabled { opacity: 0.35; }
.news-pager .pagination__gap { min-width: 24px; padding: 0; }
@media (max-width: 480px) {
  .news-pager .news-pager__step { padding: 0; width: 40px; }
}

/* Empty state: quiet and centred, no box. */
.news-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  max-width: 520px;
  margin-inline: auto;
  padding: var(--space-8) 0 var(--space-4);
  text-align: center;
}
.news-empty__mark { width: 72px; height: 72px; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35)); }
.news-empty__title { margin: var(--space-1) 0 0; }
.news-empty__text { margin: 0; color: var(--text-secondary); line-height: 1.65; }
.news-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: var(--space-2); }

/* --- News article ---------------------------------------------------- */
.article-hero {
  --article-w: 720px;
  min-height: clamp(400px, 42vw, 560px);
  margin-bottom: var(--space-6);
  padding: var(--space-12) 0 var(--space-6);
}
.article-hero--cover { --page-hero-position: center; }
.article-hero::after {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--bg-canvas) 50%, transparent) 0%,
      color-mix(in srgb, var(--bg-canvas) 45%, transparent) 30%,
      color-mix(in srgb, var(--bg-canvas) 82%, transparent) 72%,
      var(--bg-canvas) 100%),
    linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--accent) 16%, transparent) 85%, transparent 100%);
}
.article-hero .article-hero__inner { width: min(var(--article-w), 100% - 2 * var(--gutter)); }
.article-hero__flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-2);
  color: var(--accent-text);
  font-size: var(--fs-ui);
  font-weight: 700;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
.article-hero .article-hero__title {
  max-width: none;
  font-size: clamp(2.5rem, 5.6vw, 4.25rem);
  line-height: 0.94;
}
.article-hero .article-hero__lead {
  max-width: none;
  margin-top: var(--space-3);
  color: color-mix(in srgb, var(--text-primary) 86%, transparent);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}
.article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: var(--space-4);
  color: color-mix(in srgb, var(--text-primary) 70%, transparent);
  font-size: var(--fs-ui);
  font-weight: 600;
}
.article-byline > * { display: inline-flex; align-items: center; gap: 14px; }
.article-byline > * + *::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.article-byline__author { gap: 10px; }
.article-byline__author > span { display: inline; }
.article-byline strong { color: var(--text-primary); font-weight: 700; }
.article-byline .avatar { width: 32px; height: 32px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-primary) 18%, transparent); }

.article { width: 100%; max-width: 720px; margin-inline: auto; }
.prose.article__body h2 {
  margin: 2.1em 0 0.6em;
  padding: 0;
  border: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.prose.article__body h2::before {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: var(--accent);
}
.article__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-8);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.article__stamp { margin: 0; color: var(--text-muted); font-size: var(--fs-small); font-weight: 500; }
.article__footer-links { display: flex; flex-wrap: wrap; gap: 4px; margin-right: -12px; }

/* Older / newer: a hairline split band that runs into the footer. */
.article-more { margin-top: var(--space-8); padding-block: 0; border-bottom: 0; }
.article-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.article-pager--single { grid-template-columns: minmax(0, 1fr); }
.article-pager__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: var(--space-6) var(--space-5) var(--space-6) 0;
  color: var(--text-secondary);
  text-decoration: none;
}
.article-pager__link + .article-pager__link { padding-left: var(--space-5); border-left: 1px solid var(--border-subtle); }
.article-pager__link--next { grid-column: -2; align-items: flex-end; padding-right: 0; text-align: right; }
.article-pager__dir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: var(--fs-ui);
  font-weight: 650;
}
.article-pager__dir .icon { color: var(--accent-text); transition: transform var(--t-fast); }
.article-pager__title {
  max-width: 24ch;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
  transition: color var(--t-fast);
}
a.article-pager__link:hover { color: var(--text-secondary); }
a.article-pager__link:hover .article-pager__title { color: color-mix(in srgb, var(--accent-text) 45%, var(--text-primary)); }
a.article-pager__link:hover .article-pager__dir .icon { transform: translateX(-4px); }
a.article-pager__link--next:hover .article-pager__dir .icon { transform: translateX(4px); }
@media (max-width: 640px) {
  .article-hero { min-height: 360px; padding: var(--space-10) 0 var(--space-4); margin-bottom: var(--space-4); }
  /* The title sits right below, so the crumb trail shortens to a "Nyheder" back link. */
  .article-hero .breadcrumbs li:last-child { display: none; }
  .article-byline { margin-top: var(--space-3); }
  .article-byline__author { flex-basis: 100%; }
  .article-byline__author + *::before { display: none; }
  .article-pager { grid-template-columns: minmax(0, 1fr); }
  .article-pager__link { padding: var(--space-4) 0; }
  .article-pager__link + .article-pager__link { padding-left: 0; border-left: 0; border-top: 1px solid var(--border-subtle); }
  .article-pager__link--next { grid-column: auto; align-items: flex-start; text-align: left; }
  .article__footer-links { margin-right: 0; margin-left: -12px; }
}

/* --- Custom pages (FAQ, guides) -------------------------------------- */
.doc-hero { --page-hero-position: center 64%; }
.doc-hero--solo .page-hero__inner { width: min(720px, 100% - 2 * var(--gutter)); }
.doc-hero__stamp { color: color-mix(in srgb, var(--text-primary) 70%, transparent); font-size: var(--fs-ui); font-weight: 600; }
.doc__main { min-width: 0; }
.doc:not(.doc--toc) .doc__main { max-width: 720px; margin-inline: auto; }
.doc--toc {
  display: grid;
  grid-template-columns: minmax(0, 232px) minmax(0, 720px);
  gap: var(--space-5) clamp(40px, 7vw, 112px);
  align-items: start;
}
.doc__aside {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  max-height: calc(100vh - var(--header-h) - var(--space-8));
  overflow-y: auto;
  min-width: 0;
  scrollbar-width: thin;
}
.doc-toc__title { margin: 0 0 var(--space-2); color: var(--text-primary); font-size: var(--fs-ui); font-weight: 700; }
.doc-toc__list { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--border-subtle); }
.doc-toc__link {
  display: block;
  margin-left: -1px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.45;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.doc-toc__link:hover { color: var(--text-primary); border-left-color: var(--accent); }
.doc-toc__link:focus-visible { outline-offset: -2px; }
.doc-toc-m { display: none; }

/* FAQ-style headings: each section opens with a hairline, like a list of questions. */
.prose.doc__body h2 {
  margin: 1.9em 0 0.55em;
  padding: 1.5em 0 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.4375rem);
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.3;
  text-wrap: balance;
  transition: color 0.6s var(--ease-out);
}
.prose.doc__body > h2:first-child { padding-top: 0; border-top: 0; }
.prose.doc__body h2:target { color: color-mix(in srgb, var(--accent-text) 55%, var(--text-primary)); }

.doc-help { margin-top: var(--space-10); border-bottom: 0; }
.doc-help__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}
.doc-help__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.doc-help__text { margin: 8px 0 0; color: var(--text-secondary); }
.doc-help__actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 900px) {
  .doc--toc { grid-template-columns: minmax(0, 1fr); }
  .doc__aside { display: none; }
  .doc-toc-m { display: block; margin-bottom: var(--space-5); border-block: 1px solid var(--border-subtle); }
  .doc-toc-m__summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    color: var(--text-primary);
    font-size: var(--fs-ui);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
  }
  .doc-toc-m__summary::-webkit-details-marker { display: none; }
  .doc-toc-m__summary > .icon:first-child { color: var(--accent-text); }
  .doc-toc-m__summary > .icon:last-child { color: var(--text-muted); transition: transform var(--t-fast); }
  .doc-toc-m[open] .doc-toc-m__summary > .icon:last-child { transform: rotate(180deg); }
  .doc-toc-m__count { margin-left: auto; color: var(--text-muted); font-weight: 600; }
  .doc-toc-m .doc-toc__list { margin: 0 0 var(--space-2); }
}
@media (max-width: 560px) {
  .doc-help__actions { width: 100%; }
  .doc-help__actions > .btn { flex: 1 1 auto; }
}
/* ===== end page: news-pages ===== */

/* ===== page: people ===== */
/* Team (/team), server status (/status), profile (/profil) and login (/login error states). */

/* --- Team --------------------------------------------------------------- */
.team-hero { min-height: clamp(300px, 32vw, 380px); }
.team-groups { display: grid; padding-bottom: var(--space-4); }
.team-group {
  --role: var(--accent);
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: var(--space-4) clamp(32px, 6vw, 88px);
  padding-block: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}
.team-group:first-child { border-top: 0; padding-top: var(--space-2); }
.team-group__head { min-width: 0; }
.team-group__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 2.9vw, 2.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}
.team-group__title::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: var(--space-2);
  border-radius: 2px;
  background: var(--role);
}
.team-group__count { margin: 12px 0 0; color: var(--text-muted); font-size: var(--fs-ui); font-weight: 600; }
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-5) var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.team-group--lead .team-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.team-member { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.team-member__ring {
  display: block;
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-2);
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--role), color-mix(in srgb, var(--role) 18%, transparent) 70%);
  box-shadow: 0 22px 40px -22px color-mix(in srgb, var(--role) 75%, black);
  transition: transform var(--t-normal), box-shadow var(--t-normal);
}
.team-group--lead .team-member__ring { width: 148px; height: 148px; }
.team-member:hover .team-member__ring { transform: translateY(-4px); box-shadow: 0 28px 48px -22px color-mix(in srgb, var(--role) 90%, black); }
.team-member__avatar {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 4px solid var(--bg-canvas);
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-surface-2);
}
.team-member__name { max-width: 100%; color: var(--text-primary); font-size: 1.0625rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.team-member__handle { max-width: 100%; overflow: hidden; color: var(--text-muted); font-size: var(--fs-small); text-overflow: ellipsis; white-space: nowrap; }
.team-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-8) 0 var(--section-y);
  color: var(--text-muted);
  text-align: center;
}
.team-empty__title { margin: var(--space-1) 0 0; font-size: 1.25rem; }
.team-empty p { margin: 0; max-width: 48ch; color: var(--text-secondary); }
.team-cta { text-align: center; padding-block: clamp(88px, 12vw, 152px); }
.team-cta__title { margin: 0 auto; max-width: 16ch; }
.team-cta__text { margin: var(--space-3) auto 0; max-width: 54ch; color: color-mix(in srgb, var(--text-primary) 80%, transparent); font-size: var(--fs-lead); }
.team-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: var(--space-5); }
@media (max-width: 900px) {
  .team-group { grid-template-columns: minmax(0, 1fr); padding-block: var(--space-6); }
}
@media (max-width: 560px) {
  .team-grid, .team-group--lead .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-2); }
  .team-member__ring { width: 104px; height: 104px; }
  .team-group--lead .team-member__ring { width: 124px; height: 124px; }
  .team-cta__actions > .btn { flex: 1 1 100%; }
}

/* --- Server status ------------------------------------------------------- */
.srv-hero { min-height: clamp(380px, 38vw, 480px); --page-hero-position: center 62%; }
.srv-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 var(--space-2);
  color: color-mix(in srgb, var(--text-primary) 80%, transparent);
  font-size: var(--fs-ui);
  font-weight: 600;
}
.srv-hero .status-dot { width: 10px; height: 10px; }
.srv-hero__title { max-width: 18ch; }
.srv-hero__sub { font-variant-numeric: tabular-nums; }
.srv-hero__sub strong { color: var(--text-primary); }

.srv-now { padding-bottom: var(--section-y); }
.srv-gauge__count {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}
.srv-gauge__players { font-size: clamp(5rem, 11vw, 8.5rem); letter-spacing: -0.01em; }
.srv-gauge__max { color: var(--text-muted); font-size: clamp(2rem, 4.2vw, 3.25rem); }
.srv-gauge[data-status='offline'] .srv-gauge__players { color: var(--text-muted); }
.srv-gauge__label { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--fs-lead); }
.srv-gauge__meter {
  height: 6px;
  margin-top: var(--space-3);
  overflow: hidden;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
}
.srv-gauge__meter > span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-text));
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
}
.srv-note {
  display: flex;
  gap: 12px;
  margin: var(--space-4) 0 0;
  padding: 16px 18px;
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--warning) 9%, transparent);
  color: var(--text-primary);
}
.srv-note .icon { margin-top: 3px; color: var(--warning-text); }
.srv-facts { margin: var(--space-6) 0 0; border-top: 1px solid var(--border-subtle); }
.srv-facts__row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 6px var(--space-3);
  padding: 22px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.srv-facts dt { display: flex; align-items: center; gap: 12px; min-height: 1.625rem; color: var(--text-secondary); font-size: var(--fs-ui); font-weight: 600; }
.srv-facts dt .icon { color: var(--accent-text); }
.srv-facts dd { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.srv-facts__value { color: var(--text-primary); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.srv-facts__value::first-letter { text-transform: uppercase; }
.srv-facts__hint { color: var(--text-muted); font-size: var(--fs-small); }

.srv-howto { display: grid; margin: 0; padding: 0; list-style: none; }
.srv-howto__item { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 20px; padding-bottom: var(--space-5); }
.srv-howto__item:last-child { padding-bottom: 0; }
.srv-howto__item::before {
  content: '';
  position: absolute;
  left: 23.5px;
  top: 60px;
  bottom: 12px;
  width: 1px;
  background: linear-gradient(180deg, var(--border-strong), var(--border-hairline));
}
.srv-howto__item:last-child::before { display: none; }
.srv-howto__node {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-1);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.srv-howto__body { min-width: 0; }
.srv-howto__title { margin: 10px 0 6px; color: var(--text-primary); font-size: 1.1875rem; font-weight: 750; letter-spacing: -0.015em; }
.srv-howto__title .kbd { margin-inline: 2px; vertical-align: 0.1em; }
.srv-howto__text { margin: 0; max-width: 58ch; color: var(--text-secondary); }
.srv-howto__code { margin-top: 14px; min-height: 52px; padding-left: 18px; font-size: 0.9375rem; }
.srv-howto__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-2); }

.srv-players-section { padding-top: var(--section-y); }
.srv-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  column-gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-subtle);
}
.srv-players__item { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--border-hairline); }
.srv-players__initial {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-small);
  font-weight: 700;
}
.srv-players__name { min-width: 0; overflow: hidden; color: var(--text-primary); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.srv-players-empty { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--text-secondary); }
@media (max-width: 560px) {
  .srv-hero__title { font-size: clamp(2.5rem, 12vw, 3.25rem); }
  .srv-hero .page-hero__actions > .btn { flex: 1 1 100%; }
  .srv-facts__row { grid-template-columns: minmax(0, 1fr); padding: 18px 0; }
  .srv-howto__item { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
  .srv-howto__node { width: 40px; height: 40px; }
  .srv-howto__item::before { left: 19.5px; top: 52px; }
  .srv-howto__title { margin-top: 6px; }
}

/* --- Profile ------------------------------------------------------------- */
.profile-hero { min-height: clamp(300px, 30vw, 360px); --page-hero-position: center 40%; }
.profile-hero__inner { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); }
.profile-hero__id { display: flex; align-items: center; gap: 28px; min-width: 0; }
.profile-hero__ring {
  display: block;
  flex: none;
  width: 136px;
  height: 136px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--accent-text), var(--accent) 40%, color-mix(in srgb, var(--accent) 15%, transparent) 80%);
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.8);
}
.profile-hero__avatar {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 4px solid var(--bg-canvas);
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-surface-2);
}
.profile-hero__text { min-width: 0; }
.profile-hero__name { max-width: 18ch; font-size: clamp(2.5rem, 5.4vw, 4.25rem); }
.profile-hero__handle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 10px 0 0;
  color: color-mix(in srgb, var(--text-primary) 78%, transparent);
  font-size: var(--fs-lead);
  font-weight: 600;
}
.profile-hero__wl { display: inline-flex; align-items: center; gap: 6px; color: var(--success-text); font-size: var(--fs-ui); font-weight: 700; }
.profile-roles { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; }
.profile-roles__item {
  --role: var(--accent-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--text-primary) 88%, transparent);
  font-size: var(--fs-ui);
  font-weight: 600;
}
.profile-roles__item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--role);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--role) 25%, transparent);
}
.profile-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.profile-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  margin: 0;
  border-block: 1px solid var(--border-subtle);
}
.profile-meta__item { min-width: 0; padding: 16px 24px; border-left: 1px solid var(--border-hairline); }
.profile-meta__item:first-child { padding-left: 0; border-left: 0; }
.profile-meta dt { margin-bottom: 2px; color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; }
.profile-meta dd { display: flex; align-items: center; gap: 6px; min-height: 30px; margin: 0; color: var(--text-primary); font-weight: 650; }
.profile-meta dd .mono { font-size: 0.875rem; }
.profile-meta dd .muted { font-weight: 500; font-size: var(--fs-ui); }
@media (max-width: 720px) {
  .profile-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-2); }
  .profile-meta__item { padding: 14px 0; border-left: 0; }
  .profile-meta__item:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--border-hairline); }
}

.profile-journey { --_c: var(--text-muted); padding-block: var(--space-10) var(--section-y); }
.profile-journey--done { --_c: var(--success); }
.profile-journey--waiting { --_c: var(--warning); }
.profile-journey__state { display: inline-flex; align-items: center; gap: 12px; margin: 0; padding: 6px 0; color: var(--text-primary); font-size: 1.0625rem; font-weight: 700; white-space: nowrap; }
.profile-journey__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--_c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--_c) 22%, transparent); }
.profile-journey__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: var(--space-6); }
.profile-journey__updated { color: var(--text-muted); font-size: var(--fs-small); }

.journey {
  --node: 56px;
  --gap: var(--space-4);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4) var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.journey__step { position: relative; min-width: 0; }
/* Connector to the next step; crimson once this step is done. */
.journey__step::after {
  content: '';
  position: absolute;
  top: calc(var(--node) / 2 - 1px);
  left: calc(var(--node) + 12px);
  right: calc(12px - var(--gap));
  height: 2px;
  border-radius: 2px;
  background: var(--border-subtle);
}
.journey__step--done::after { background: linear-gradient(90deg, var(--accent), var(--accent-text)); }
.journey__step:last-child::after { display: none; }
.journey__node {
  display: grid;
  place-items: center;
  width: var(--node);
  height: var(--node);
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--bg-surface-1);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.journey__step--done .journey__node {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--accent) 85%, transparent);
}
.journey__step--current .journey__node {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-canvas));
  color: var(--accent-text);
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 6px color-mix(in srgb, var(--accent) 14%, transparent), 0 0 36px 2px color-mix(in srgb, var(--accent) 28%, transparent);
}
.journey__body { display: block; min-width: 0; }
.journey__caption { display: block; margin-bottom: 4px; color: var(--accent-text); font-size: var(--fs-small); font-weight: 700; }
.journey__step--done .journey__caption { color: var(--text-muted); }
.journey__title { display: block; color: var(--text-primary); font-size: 1.25rem; font-weight: 750; letter-spacing: -0.015em; line-height: 1.25; }
.journey__step--todo .journey__title { color: color-mix(in srgb, var(--text-primary) 60%, transparent); }
.journey__text { display: block; max-width: 30ch; margin-top: 6px; color: var(--text-secondary); font-size: var(--fs-ui); }
.journey__step--todo .journey__text { color: var(--text-muted); }
@media (max-width: 760px) {
  .journey { --node: 48px; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .journey__step { display: grid; grid-template-columns: var(--node) minmax(0, 1fr); column-gap: 20px; align-items: start; }
  .journey__node { margin: 0; font-size: 1.3rem; }
  .journey__body { padding-top: 2px; }
  .journey__step::after { top: calc(var(--node) + 8px); bottom: calc(8px - var(--space-4)); left: calc(var(--node) / 2 - 1px); right: auto; width: 2px; height: auto; }
  .journey__step--done::after { background: linear-gradient(180deg, var(--accent), var(--accent-text)); }
  .journey__text { max-width: none; }
}

.profile-block { min-width: 0; }
.profile-block__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.profile-block__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.625rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.profile-block__title::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: var(--space-2);
  border-radius: 2px;
  background: var(--accent);
}
.profile-block__count { padding-bottom: 4px; color: var(--text-muted); font-size: var(--fs-ui); font-weight: 600; }
.profile-block__empty { padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.profile-block__empty p { max-width: 52ch; margin: 0 0 var(--space-2); color: var(--text-secondary); }
.profile-block__subtitle { margin: var(--space-5) 0 var(--space-1); color: var(--text-primary); font-size: var(--fs-body); font-weight: 700; letter-spacing: -0.005em; }
.profile-chars { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-subtle); }
.profile-chars__item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border-subtle); }
.profile-chars__mono {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent);
}
.profile-chars__body { min-width: 0; }
.profile-chars__name { display: block; overflow: hidden; color: var(--text-primary); font-size: 1.0625rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.profile-chars__job { display: block; color: var(--text-secondary); font-size: var(--fs-ui); }
.profile-chars__slot { color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; white-space: nowrap; }
.profile-links { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-hairline); }
.profile-links__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; padding: 12px 0; border-bottom: 1px solid var(--border-hairline); font-size: var(--fs-ui); }
.profile-links__item code { color: var(--text-primary); }
.profile-links__name { flex: 1 1 auto; min-width: 0; color: var(--text-secondary); }
.profile-links__seen { color: var(--text-muted); font-size: var(--fs-small); }
.profile-apps__state { --_c: var(--text-muted); color: color-mix(in srgb, var(--_c) 62%, var(--text-primary)); }
.profile-apps__state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--_c); }
.profile-apps__state--pending { --_c: var(--warning); }
.profile-apps__state--accepted { --_c: var(--success); }
.profile-apps__state--rejected { --_c: var(--danger); }
.profile-apps__state--withdrawn { color: var(--text-muted); }
@media (max-width: 640px) {
  .profile-hero__id { gap: 18px; }
  .profile-hero__ring { width: 96px; height: 96px; }
  .profile-hero__avatar { border-width: 3px; }
  .profile-hero__name { font-size: clamp(2.125rem, 10vw, 2.75rem); }
  .profile-hero__handle { font-size: var(--fs-body); }
  .profile-hero__actions { width: 100%; }
  .profile-hero__actions > .btn { flex: 1 1 auto; }
  .profile-journey { padding-top: var(--space-6); }
  .profile-journey__foot > .btn { flex: 1 1 100%; }
}

/* --- Login --------------------------------------------------------------- */
.login-page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: max(600px, calc(100svh - var(--header-h)));
  margin-top: calc(-1 * var(--main-pt));
  padding: var(--space-10) 0;
  text-align: center;
}
.flash-wrap + .login-page { margin-top: 0; }
.main:has(> .login-page) { padding-bottom: 0; }
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('/static/img/hero/scene-5.jpg') center 58% / cover no-repeat;
}
@media (max-width: 960px) {
  .login-page::before { background-image: url('/static/img/hero/scene-5-960.jpg'); }
}
.login-page--banned::before { filter: grayscale(0.85) brightness(0.8); }
.login-page::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--accent) 15%, transparent) 80%, transparent 100%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--bg-canvas) 72%, transparent) 0%,
      color-mix(in srgb, var(--bg-canvas) 45%, transparent) 30%,
      color-mix(in srgb, var(--bg-canvas) 60%, transparent) 65%,
      var(--bg-canvas) 100%),
    radial-gradient(60% 55% at 50% 50%, color-mix(in srgb, var(--bg-canvas) 45%, transparent), transparent 100%);
}
.login-page__inner { display: flex; flex-direction: column; align-items: center; max-width: 680px; }
.login-page__logo {
  width: clamp(112px, 11vw, 148px);
  height: auto;
  margin-bottom: var(--space-3);
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.55)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.login-page__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.5vw, 5.25rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0.008em;
  text-transform: uppercase;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.5);
  text-wrap: balance;
}
.login-page__text {
  margin: var(--space-3) auto 0;
  max-width: 48ch;
  color: color-mix(in srgb, var(--text-primary) 84%, transparent);
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  line-height: 1.6;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}
.login-page__notice {
  display: flex;
  gap: 12px;
  max-width: 540px;
  margin-top: var(--space-3);
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--danger) 16%, color-mix(in srgb, var(--bg-canvas) 70%, transparent));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  text-align: left;
}
.login-page__notice > .icon { margin-top: 3px; color: var(--danger-text); }
.login-page__notice p { margin: 0; }
.login-page__notice strong { display: block; margin-bottom: 2px; }
.login-page__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: var(--space-5); }
.login-page__fine {
  max-width: 54ch;
  margin: var(--space-3) 0 0;
  color: color-mix(in srgb, var(--text-primary) 64%, transparent);
  font-size: var(--fs-small);
  text-wrap: balance;
}
.login-page__fine > .icon { margin-right: 6px; vertical-align: -2px; }
@media (max-width: 480px) {
  .login-page { padding: var(--space-8) 0; }
  .login-page__actions { align-self: stretch; }
  .login-page__actions > .btn { flex: 1 1 100%; }
}
/* ===== end page: people ===== */

/* ===== page: applications ===== */
/* Public application pages (src/views/applications/*): overview, form, Mine ansøgninger + detail.
 * Builds on page-hero, section-head, link-list, steps and band. Everything is prefixed .app-.
 * .app-answers is also rendered inside the admin application detail card. */

/* Status text with a coloured dot (open/closed, pending/accepted/rejected/withdrawn) */
.app-state {
  --_c: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--_c) 60%, var(--text-primary));
  font-size: var(--fs-small);
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
.app-state::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--_c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--_c) 20%, transparent);
}
.app-state--open, .app-state--accepted { --_c: var(--success); }
.app-state--pending { --_c: var(--warning); }
.app-state--rejected { --_c: var(--danger); }
.app-state--closed, .app-state--withdrawn { --_c: var(--text-muted); color: var(--text-secondary); }

/* Icon tile next to a page-hero title */
.app-hero-title { display: flex; align-items: center; gap: 20px; min-width: 0; }
.app-hero-title__icon {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--_c) 24%, color-mix(in srgb, var(--bg-canvas) 55%, transparent));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
@media (max-width: 640px) {
  .app-hero-title { gap: 14px; }
  .app-hero-title__icon { width: 48px; height: 48px; border-radius: 13px; }
  .app-hero-title__icon .icon { width: 22px; height: 22px; }
}

.app-empty { padding-block: var(--space-10); }

/* --- Overview: the entry application as a photo-led feature ----------- */
.app-feature {
  --_c: var(--tile-color, var(--accent));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-5);
  padding: clamp(32px, 5.5vw, 72px);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  text-decoration: none;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9), inset 0 0 0 1px var(--border-subtle);
}
a.app-feature:hover { color: var(--text-secondary); }
.app-feature::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('/static/img/hero/scene-5.jpg') center 62% / cover no-repeat;
  transition: transform 1.4s var(--ease-out);
}
.app-feature::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg-canvas) 94%, transparent) 0%, color-mix(in srgb, var(--bg-canvas) 80%, transparent) 42%, color-mix(in srgb, var(--bg-canvas) 30%, transparent) 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%);
}
.app-feature:hover::before { transform: scale(1.035); }
@media (max-width: 960px) {
  .app-feature::before { background-image: url('/static/img/hero/scene-5-960.jpg'); }
}
.app-feature__body { min-width: 0; }
.app-feature__kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 var(--space-2);
  color: var(--accent-text);
  font-size: var(--fs-ui);
  font-weight: 700;
}
.app-feature__kicker::before { content: ''; width: 28px; height: 2px; border-radius: 2px; background: var(--accent); }
.app-feature__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.5vw, 5.75rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.45);
  overflow-wrap: anywhere;
}
.app-feature__text {
  margin: var(--space-2) 0 0;
  max-width: 50ch;
  color: color-mix(in srgb, var(--text-primary) 84%, transparent);
  font-size: var(--fs-lead);
  line-height: 1.6;
}
.app-feature__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  color: color-mix(in srgb, var(--text-primary) 80%, transparent);
  font-size: var(--fs-ui);
  font-weight: 600;
}
.app-feature__facts li { display: inline-flex; align-items: center; gap: 8px; }
.app-feature__facts .icon { color: var(--accent-text); }
.app-feature__mine { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--fs-ui); }
.app-feature__cta { margin-top: var(--space-4); }
.app-feature__cta .icon { transition: transform var(--t-fast); }
.app-feature:hover .app-feature__cta { --btn-bg: var(--accent-hover); }
.app-feature:hover .app-feature__cta .icon { transform: translateX(4px); }
.app-feature:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.app-feature__mark {
  width: clamp(150px, 17vw, 220px);
  height: auto;
  margin-right: clamp(0px, 2vw, 32px);
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.6)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
  transition: transform 0.9s var(--ease-out);
}
.app-feature:hover .app-feature__mark { transform: translateY(-4px) rotate(-2deg); }
@media (max-width: 760px) {
  .app-feature { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4) var(--space-3); }
  .app-feature__mark { order: -1; width: 88px; margin: 0; }
  .app-feature::after {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg-canvas) 45%, transparent) 0%, color-mix(in srgb, var(--bg-canvas) 88%, transparent) 55%),
      linear-gradient(0deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%);
  }
}
@media (max-width: 480px) {
  .app-feature__cta { width: 100%; }
}

/* --- Overview: roles as an open, hairline-ruled grid ------------------ */
.app-roles-section { padding-bottom: var(--section-y); }
.app-feature + .app-roles-section { padding-top: var(--section-y); }
.app-roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}
.app-role {
  --_c: var(--tile-color, var(--accent));
  position: relative;
  min-width: 0;
  border-top: 1px solid var(--border-subtle);
}
.app-role::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--_c);
  transition: width 0.6s var(--ease-out);
}
.app-role:hover::before, .app-role:focus-within::before { width: 100%; }
.app-role__link {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: var(--space-4) 0 var(--space-6);
  color: var(--text-secondary);
  text-decoration: none;
}
a.app-role__link:hover { color: var(--text-secondary); }
.app-role__link:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 6px; border-radius: 4px; }
.app-role__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.app-role__icon { width: 56px; height: 56px; border-radius: 16px; transition: transform var(--t-normal); }
.app-role__link:hover .app-role__icon { transform: translateY(-2px); }
.app-role__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 3.4vw, 3rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  transition: color var(--t-fast);
}
.app-role__link:hover .app-role__title { color: color-mix(in srgb, var(--_c) 30%, var(--text-primary)); }
.app-role__text { margin: 0; max-width: 46ch; color: var(--text-secondary); font-size: var(--fs-body); line-height: 1.65; }
.app-role__reqs { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; }
.app-role__reqs > span { display: inline-flex; align-items: center; gap: 7px; }
.app-role__mine { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-secondary); font-size: var(--fs-small); }
.app-role__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--text-primary);
  font-size: var(--fs-ui);
  font-weight: 700;
}
.app-role__more .icon { color: color-mix(in srgb, var(--_c) 55%, var(--text-primary)); transition: transform var(--t-fast); }
.app-role__link:hover .app-role__more .icon { transform: translateX(4px); }
.app-role--closed .app-role__icon { filter: grayscale(1); opacity: 0.6; }
.app-role--closed .app-role__title { color: var(--text-secondary); }
.app-role--closed::before { background: var(--text-muted); }
@media (max-width: 760px) {
  .app-roles { grid-template-columns: minmax(0, 1fr); }
  .app-role__link { padding-bottom: var(--space-5); }
}

/* --- Overview: process band (three inline steps) ---------------------- */
@media (min-width: 961px) {
  .app-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) and (min-width: 561px) {
  .app-steps { --node: 48px; --steps-gap: var(--space-3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-steps .steps__item:nth-child(2)::before { display: block; }
}

/* --- Form + detail: main column with a sticky side summary ------------ */
.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-5) clamp(40px, 6vw, 88px);
  align-items: start;
}
.app-main { min-width: 0; }
.app-aside { order: 2; position: sticky; top: calc(var(--header-h) + var(--space-3)); min-width: 0; }
@media (max-width: 1000px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .app-aside { position: static; }
  .app-layout--form .app-aside { order: 0; }
  .app-toc { display: none; }
}

.app-summary {
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-1);
  box-shadow: inset 0 0 0 1px var(--border-hairline), 0 30px 60px -36px rgba(0, 0, 0, 0.85);
}
.app-summary__title {
  margin: 0 0 var(--space-3);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.app-summary__help {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-hairline);
  color: var(--text-muted);
  font-size: var(--fs-small);
  line-height: 1.6;
}
.app-summary__help a { color: var(--text-secondary); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.app-summary__help a:hover { color: var(--text-primary); text-decoration-color: currentColor; }

.app-facts { display: grid; margin: 0; }
.app-facts__row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-hairline);
}
.app-facts__row:first-child { padding-top: 0; }
.app-facts__row:last-child { border-bottom: 0; padding-bottom: 0; }
.app-facts dt { margin: 0; color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; line-height: 1.5; }
.app-facts dd { margin: 0; min-width: 0; color: var(--text-primary); font-size: var(--fs-ui); font-weight: 550; line-height: 1.45; overflow-wrap: anywhere; }
.app-facts--after { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--border-hairline); }

.app-toc { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--border-hairline); }
.app-toc__title { margin: 0 0 10px; color: var(--text-primary); font-size: var(--fs-ui); font-weight: 700; }
.app-toc__list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--border-subtle); }
.app-toc__list a {
  display: block;
  margin-left: -1px;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  font-size: var(--fs-ui);
  line-height: 1.4;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.app-toc__list a:hover { color: var(--text-primary); border-left-color: var(--accent); }
.app-toc__list a:focus-visible { outline-offset: -2px; }

/* Template description above the form */
.app-intro {
  max-width: 70ch;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-lead);
  line-height: 1.75;
}
.app-intro h2 {
  margin-top: 1.5em;
  padding: 0;
  border: 0;
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.app-intro h3 { font-size: 1.1875rem; }

/* Login / eligibility gate */
.app-gate {
  --_c: var(--accent);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--_c) 15%, var(--bg-surface-1)) 0%, var(--bg-surface-1) 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 30%, transparent), 0 30px 60px -36px rgba(0, 0, 0, 0.85);
}
.app-gate--warning { --_c: var(--warning); }
.app-gate--info { --_c: var(--info); }
.app-gate__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--_c) 20%, transparent);
  color: color-mix(in srgb, var(--_c) 62%, var(--text-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 36%, transparent);
}
.app-gate__body { min-width: 0; }
.app-gate__title {
  margin: 6px 0 var(--space-1);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.app-gate__body p { margin: 0 0 var(--space-3); max-width: 58ch; }
.app-gate__body > :last-child { margin-bottom: 0; }
@media (max-width: 560px) {
  .app-gate { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3); }
  .app-gate .btn { width: 100%; white-space: normal; height: auto; min-height: 46px; padding-block: 10px; text-align: center; }
}

/* --- The long-form application form ---------------------------------- */
.app-form { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.app-form__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; }
.app-form__title,
.app-section-title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.app-form__title::before,
.app-section-title::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: var(--space-2);
  border-radius: 2px;
  background: var(--accent);
}
.app-section-title { margin-bottom: var(--space-3); }
.app-form__note { margin: 0; color: var(--text-muted); font-size: var(--fs-small); }
.app-form > .alert { margin: 0; }

.app-form__group {
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-width: 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--header-h) + var(--space-3));
}
.app-form__group-head { display: flex; flex-direction: column; gap: 6px; }
.app-form__group-title { margin: 0; color: var(--text-primary); font-size: 1.375rem; font-weight: 750; line-height: 1.25; letter-spacing: -0.018em; }
.app-form__group-help { margin: 0; max-width: 64ch; color: var(--text-secondary); white-space: pre-wrap; }

.app-form .field { gap: 8px; }
.app-form .field__label { font-size: 1rem; font-weight: 650; line-height: 1.45; }
.app-form .field__help { max-width: 70ch; color: color-mix(in srgb, var(--text-secondary) 80%, var(--text-muted)); font-size: var(--fs-ui); }
.app-form .field__help + :is(.input, .textarea, .select, .check-group, .alert) { margin-top: 4px; }
.app-form :is(.input, .select) {
  min-height: 50px;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: var(--bg-surface-1);
  font-size: 1rem;
}
.app-form .select { padding-right: 44px; background-position: right 16px center; }
.app-form .textarea {
  min-height: 188px;
  padding: 14px 16px;
  border-radius: 12px;
  background-color: var(--bg-surface-1);
  font-size: 1rem;
  line-height: 1.7;
}
.app-form :is(.input, .textarea, .select):focus { background-color: var(--bg-surface-2); }
.app-form .check-group { gap: 2px; padding: 6px; border-radius: 12px; background: var(--bg-surface-1); border-color: var(--border-subtle); }
.app-form .check-group .check { padding: 10px 12px; border-radius: 8px; font-size: var(--fs-body); transition: background-color var(--t-fast); }
.app-form .check-group .check:hover { background: var(--row-hover); }
.app-form .check-group .check:has(input:checked) { background: var(--accent-softer); }
.app-form .field > .check {
  display: flex;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--bg-surface-1);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--fs-body);
  transition: box-shadow var(--t-fast), background-color var(--t-fast);
}
.app-form .field > .check:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.app-form .field > .check:has(input:checked) { background: var(--accent-softer); box-shadow: inset 0 0 0 1px var(--accent-border); }
.app-form .field--invalid > .check { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 65%, transparent); }

.app-form__submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-1);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.app-form__submit-text { flex: 1 1 260px; margin: 0; max-width: 46ch; color: var(--text-secondary); font-size: var(--fs-ui); }
@media (max-width: 560px) {
  .app-form__submit .btn { width: 100%; }
}

/* --- Mine ansøgninger -------------------------------------------------- */
.app-narrow > * { max-width: 920px; }
.app-mine-summary { margin: 0 0 var(--space-3); color: var(--text-secondary); font-size: var(--fs-lead); }
.app-history .link-list__item { padding-block: 24px; }

/* Detail: outcome panel */
.app-verdict {
  --_c: var(--info);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--_c) 14%, var(--bg-surface-1)) 0%, var(--bg-surface-1) 68%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 28%, transparent), 0 30px 60px -36px rgba(0, 0, 0, 0.85);
}
.app-verdict--pending { --_c: var(--warning); }
.app-verdict--accepted { --_c: var(--success); }
.app-verdict--rejected { --_c: var(--danger); }
.app-verdict--withdrawn { --_c: var(--text-muted); }
.app-verdict__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--_c) 22%, transparent);
  color: color-mix(in srgb, var(--_c) 60%, var(--text-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 40%, transparent);
}
.app-verdict__body { min-width: 0; }
.app-verdict__title {
  margin: 6px 0 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.4vw, 2.5rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.app-verdict__meta { margin: 10px 0 0; color: var(--text-muted); font-size: var(--fs-small); font-weight: 600; }
.app-verdict__text { margin: 12px 0 0; max-width: 62ch; color: var(--text-secondary); }
.app-verdict__text a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }
.app-verdict__reason {
  margin: var(--space-3) 0 0;
  padding: 16px 20px;
  border-left: 3px solid var(--_c);
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--bg-canvas) 50%, transparent);
}
.app-verdict__reason figcaption { margin-bottom: 6px; color: color-mix(in srgb, var(--_c) 55%, var(--text-primary)); font-size: var(--fs-small); font-weight: 700; }
.app-verdict__reason blockquote { margin: 0; color: var(--text-primary); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-verdict__action { margin-top: var(--space-3); }
@media (max-width: 560px) {
  .app-verdict { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3); margin-bottom: var(--space-6); }
  .app-verdict__icon { width: 44px; height: 44px; }
}

/* Detail: progress track */
.app-track { display: grid; margin: 0; padding: 0; list-style: none; }
.app-track__step {
  --_c: var(--text-dim);
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 2px;
  padding-bottom: 22px;
}
.app-track__step:last-child { padding-bottom: 0; }
.app-track__step::before {
  content: '';
  position: absolute;
  left: 13.5px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--border-subtle);
}
.app-track__step:last-child::before { display: none; }
.app-track__step--done::before { background: color-mix(in srgb, var(--success) 45%, transparent); }
.app-track__node {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--_c) 18%, var(--bg-surface-1));
  color: color-mix(in srgb, var(--_c) 70%, var(--text-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_c) 45%, transparent);
}
.app-track__step--done { --_c: var(--success); }
.app-track__step--current { --_c: var(--warning); }
.app-track__step--withdrawn { --_c: var(--text-muted); }
.app-track__step--accepted { --_c: var(--success); }
.app-track__step--rejected { --_c: var(--danger); }
.app-track__step:is(.app-track__step--accepted, .app-track__step--rejected) .app-track__node {
  background: var(--_c);
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--_c) 70%, transparent);
}
.app-track__step--current .app-track__node { position: relative; }
.app-track__step--current .app-track__node::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--_c);
  animation: app-track-pulse 2.4s ease-out infinite;
}
@keyframes app-track-pulse { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(1.7); opacity: 0; } }
.app-track__step--todo .app-track__node { background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.app-track__title { color: var(--text-primary); font-size: var(--fs-ui); font-weight: 700; line-height: 28px; }
.app-track__step--todo .app-track__title { color: var(--text-secondary); }
.app-track__date { color: var(--text-secondary); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.app-track__text { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; }

.app-withdraw { margin: var(--space-3) 0 0; padding-top: var(--space-2); border-top: 1px solid var(--border-hairline); }
.app-withdraw__btn { --btn-fg: var(--danger-text); }
.app-withdraw__btn:hover { --btn-bg: color-mix(in srgb, var(--danger) 12%, transparent); --btn-fg: var(--danger-text); }

/* Answers (public detail and the admin application detail card) */
.app-answers { display: grid; min-width: 0; }
.app-answers__item { display: grid; gap: 8px; min-width: 0; padding: 22px 0; border-top: 1px solid var(--border-hairline); }
.app-answers > :first-child { padding-top: 0; border-top: 0; }
.app-answers > :last-child { padding-bottom: 0; }
.app-answers__q { margin: 0; color: var(--text-secondary); font-size: var(--fs-ui); font-weight: 650; line-height: 1.5; }
.app-answers__a { max-width: 75ch; color: var(--text-primary); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-answers__a--empty { color: var(--text-muted); }
.app-answers__section { padding: var(--space-4) 0 var(--space-1); border-top: 1px solid var(--border-subtle); }
.app-answers__heading { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--text-primary); font-size: 1.125rem; font-weight: 750; letter-spacing: -0.015em; }
.app-answers__heading::before { content: ''; flex: none; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); }
.app-answers__help { margin: 6px 0 0; color: var(--text-muted); font-size: var(--fs-small); white-space: pre-wrap; }
.app-answers__section + .app-answers__item { border-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .app-track__step--current .app-track__node::after { animation: none; display: none; }
  .app-feature::before, .app-feature__mark { transition: none; }
}
