/* Rulebook styles, built on the "90s NL" design system (tokens.css).
   Dark is the default; light follows the visitor's system setting or the theme button. */

/* ---- Fonts (self-hosted, SIL Open Font License: see fonts/OFL-*.txt) ---- */
@font-face { font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/bebas-neue-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Bebas Neue'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/bebas-neue-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/space-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/space-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/space-mono-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/space-mono-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---- 90s NL tokens (from tokens.css) ---- */
:root {
  --ink-900: #0b0c0e; --ink-800: #16171b; --ink-700: #202227; --ink-600: #2b2d33; --ink-500: #383a41;
  --line-500: #3d4046; --line-300: #565962; --line-900: #000000;
  --mist-500: #8d919c; --mist-300: #63656d; --chalk-100: #eeece5; --chalk-000: #ffffff;
  --signal-good: #8fae86; --signal-warn: #c9a24b; --signal-critical: #b5524a; --signal-info: #6f8ea6;
  --overlay-scrim: rgba(11, 12, 14, .72);
  --bevel-raised: inset 1px 1px 0 rgba(255, 255, 255, .14), inset -1px -1px 0 rgba(0, 0, 0, .6);
  --bevel-sunken: inset -1px -1px 0 rgba(255, 255, 255, .12), inset 1px 1px 0 rgba(0, 0, 0, .65);
  --panel-elevation: 0 2px 0 rgba(0, 0, 0, .85);
  --focus-ring: 0 0 0 2px rgba(111, 142, 166, .65);
  color-scheme: dark;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --radius-none: 0px; --radius-hairline: 1px; --radius-sm: 2px; --radius-md: 4px; --radius-lg: 8px;
  --font-sans: 'Tahoma', 'Segoe UI', Geneva, Verdana, sans-serif;
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-mono: 'Space Mono', 'Consolas', 'Courier New', monospace;

  /* Site-specific */
  --top: 60px;
  --on-signal: #0b0c0e;   /* text on a signal-coloured surface, the same in both themes */
  --tint-good: rgba(143, 174, 134, .18); --tint-critical: rgba(181, 82, 74, .2); --tint-info: rgba(111, 142, 166, .16);
  /* Signal colours used as TEXT. Equal to the signals in dark; darker in light so small labels stay readable. */
  --text-info: var(--signal-info); --text-warn: var(--signal-warn); --text-good: var(--signal-good); --text-critical: var(--signal-critical);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink-900: #f2f0ea; --ink-800: #e6e2d9; --ink-700: #d9d4c8; --ink-600: #c7c1b2; --ink-500: #b6af9c;
    --line-500: #8c8879; --line-300: #fbfaf6; --line-900: #4a4738;
    --mist-500: #5c5848; --mist-300: #7b765f; --chalk-100: #1c1a15; --chalk-000: #0a0908;
    --overlay-scrim: rgba(28, 26, 21, .55);
    --bevel-raised: inset 1px 1px 0 #fbfaf6, inset -1px -1px 0 #4a4738;
    --bevel-sunken: inset -1px -1px 0 #fbfaf6, inset 1px 1px 0 #4a4738;
    --panel-elevation: 0 2px 6px rgba(10, 9, 8, .25);
    --focus-ring: 0 0 0 2px rgba(63, 90, 110, .55);
    --tint-info: rgba(63, 90, 110, .14);
    --text-info: #3f5a6e; --text-warn: #6e5212; --text-good: #3f5f37; --text-critical: #8f3a33;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ink-900: #f2f0ea; --ink-800: #e6e2d9; --ink-700: #d9d4c8; --ink-600: #c7c1b2; --ink-500: #b6af9c;
  --line-500: #8c8879; --line-300: #fbfaf6; --line-900: #4a4738;
  --mist-500: #5c5848; --mist-300: #7b765f; --chalk-100: #1c1a15; --chalk-000: #0a0908;
  --overlay-scrim: rgba(28, 26, 21, .55);
  --bevel-raised: inset 1px 1px 0 #fbfaf6, inset -1px -1px 0 #4a4738;
  --bevel-sunken: inset -1px -1px 0 #fbfaf6, inset 1px 1px 0 #4a4738;
  --panel-elevation: 0 2px 6px rgba(10, 9, 8, .25);
  --focus-ring: 0 0 0 2px rgba(63, 90, 110, .55);
  --tint-info: rgba(63, 90, 110, .14);
  --text-info: #3f5a6e; --text-warn: #6e5212; --text-good: #3f5f37; --text-critical: #8f3a33;
  color-scheme: light;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink-900); color: var(--chalk-100); font: 500 14px/1.6 var(--font-sans); }
[hidden] { display: none !important; }
a { color: var(--text-info); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; line-height: 1; color: var(--chalk-000); text-wrap: balance; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; flex: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink-700); padding: 8px 12px; box-shadow: var(--bevel-raised); }
.skip:focus { left: 8px; }
.loading, .empty { color: var(--mist-500); padding: 40px 0; text-align: center; }
/* Uppercase micro-label (hud-label) */
.label, .eyebrow, .rule-code, .tile small, .stat span, .chip, .tag, kbd, .pager small, .field > span, .bar-status {
  font: 700 10px/12px var(--font-mono); letter-spacing: .09em; text-transform: uppercase; }

/* ---- Buttons and fields ---- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; text-decoration: none;
  font: 600 13px/18px var(--font-sans); color: var(--chalk-100); background: var(--ink-600); border: 1px solid var(--line-900);
  border-radius: var(--radius-hairline); padding: 6px 14px; box-shadow: var(--bevel-raised); }
.btn:hover { background: var(--ink-500); }
.btn:active { box-shadow: var(--bevel-sunken); }
.btn:focus-visible { box-shadow: var(--bevel-raised), var(--focus-ring); }
.btn.primary { background: var(--signal-info); color: var(--on-signal); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--ink-700); }
.btn.ghost:hover { background: var(--ink-500); }
.btn.danger { color: var(--text-critical); }
.btn[data-sure] { background: var(--signal-critical); color: #fff; }
.btn.sm { padding: 3px 10px; font-size: 12px; line-height: 16px; }
.btn.on { background: var(--ink-800); color: var(--chalk-000); box-shadow: var(--bevel-sunken); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn:disabled:active { box-shadow: var(--bevel-raised); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid transparent; border-radius: var(--radius-hairline); background: none; color: var(--mist-500); cursor: pointer; }
.icon-btn:hover { background: var(--ink-600); color: var(--chalk-100); box-shadow: var(--bevel-raised); border-color: var(--line-900); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; box-shadow: none; border-color: transparent; }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; background: var(--ink-600); color: var(--chalk-100); border: 1px solid var(--line-900); border-radius: var(--radius-hairline);
  padding: 7px 10px; box-shadow: var(--bevel-sunken); }
input::placeholder, textarea::placeholder { color: var(--mist-300); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--bevel-sunken), var(--focus-ring); }
textarea { min-height: 150px; resize: vertical; line-height: 1.55; display: block; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; color: var(--mist-500); margin-bottom: 5px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.row select { height: 37px; }
.row > .grow { flex: 1 1 180px; min-width: 0; }
.row > .fix { flex: 0 0 120px; }
.spacer { flex: 1; }

/* ---- Top bar (HUD strip) ---- */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--ink-800); border-bottom: 1px solid var(--line-900); box-shadow: inset 0 -1px 0 var(--line-500), var(--panel-elevation); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--chalk-000); text-decoration: none; min-width: 0; font: 400 30px/1 var(--font-display); letter-spacing: .02em; }
.brand #brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 3px; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--ink-600); color: var(--chalk-000); border: 1px solid var(--line-900); box-shadow: var(--bevel-raised); flex: none; }
.search { flex: 1; max-width: 460px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px;
  background: var(--ink-600); border: 1px solid var(--line-900); border-radius: var(--radius-hairline); box-shadow: var(--bevel-sunken); color: var(--mist-500); }
.search:focus-within { box-shadow: var(--bevel-sunken), var(--focus-ring); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--chalk-100); box-shadow: none; padding: 0; }
.search input:focus { box-shadow: none; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
kbd { color: var(--mist-500); background: var(--ink-700); border: 1px solid var(--line-900); box-shadow: var(--bevel-raised); padding: 2px 6px; }
.actions, #actions { display: flex; align-items: center; gap: 8px; }
.who { font: 700 11px/14px var(--font-mono); color: var(--mist-500); white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.menu-btn { display: none; }
:root .moon { display: block; }
:root .sun { display: none; }
:root[data-theme="light"] .moon { display: none; }
:root[data-theme="light"] .sun { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .moon { display: none; }
  :root:not([data-theme="dark"]) .sun { display: block; }
}

/* ---- Three columns ---- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr) 270px; max-width: 1560px; margin: 0 auto; }
.side { position: sticky; top: var(--top); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); overflow-y: auto; padding: 20px 14px 90px; background: var(--ink-800); }
.side-l { border-right: 1px solid var(--line-900); box-shadow: inset -1px 0 0 var(--line-500); }
.side-r { border-left: 1px solid var(--line-900); box-shadow: inset 1px 0 0 var(--line-500); }
main { min-width: 0; padding: 34px 40px 140px; outline: none; }
main > * { max-width: 800px; margin-left: auto; margin-right: auto; }
/* Panel title: "HOOFDSTUKKEN", "OP DEZE PAGINA", … */
.label { font: 400 24px/1 var(--font-display); letter-spacing: .03em; text-transform: none; color: var(--chalk-000);
  margin: 0 0 12px; padding: 0 8px 8px; border-bottom: 1px solid var(--line-900); box-shadow: 0 1px 0 var(--line-500); }

/* Left: chapters */
.nav-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 3px; border: 1px solid transparent; border-radius: var(--radius-hairline);
  color: var(--chalk-100); text-decoration: none; line-height: 1.35; }
.nav-item:hover { background: var(--ink-700); border-color: var(--line-900); box-shadow: var(--bevel-raised); }
.nav-item .n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); background: var(--ink-600);
  border: 1px solid var(--line-900); box-shadow: var(--bevel-raised); color: var(--mist-500); font: 700 12px/1 var(--font-mono); }
.nav-item .n svg { width: 14px; height: 14px; stroke-width: 2; }
.nav-item .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nav-item .c { font: 700 11px/1 var(--font-mono); color: var(--mist-300); }
.nav-item.on { background: var(--ink-900); border-color: var(--line-900); box-shadow: var(--bevel-sunken), inset 3px 0 0 var(--signal-info); color: var(--chalk-000); font-weight: 700; }
.nav-item.on .n { background: var(--signal-info); color: var(--on-signal); }
.nav-item.on .c { color: var(--mist-500); }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row .nav-item { flex: 1; min-width: 0; }
.nav-row .icon-btn { width: 24px; height: 28px; font-size: 13px; }
.nav-staff { display: none; }
.side .btn.add { width: 100%; justify-content: center; margin-top: 10px; }

/* Right: on this page + legend */
.toc-link { display: flex; gap: 8px; padding: 5px 10px; border-left: 2px solid var(--line-500); color: var(--mist-500); text-decoration: none; font-size: 13px; line-height: 1.4; }
.toc-link b { flex: none; font: 700 11px/1.7 var(--font-mono); }
.toc-link:hover { color: var(--chalk-100); background: var(--ink-700); }
.toc-link.on { color: var(--chalk-000); border-color: var(--signal-info); background: var(--tint-info); }
.legend { margin-top: 28px; }
.toc-empty + .legend, .legend:first-child { margin-top: 0; }
.lg { display: flex; gap: 10px; align-items: baseline; font-size: 13px; line-height: 1.4; margin: 0 8px 9px; color: var(--mist-500); }
.chip { flex: none; display: inline-block; padding: 3px 7px; border-radius: var(--radius-sm); background: var(--ink-600); color: var(--text-warn);
  border: 1px solid var(--line-900); box-shadow: var(--bevel-raised); white-space: nowrap; }
.toc-inline { display: none; }

/* ---- Centre: content ---- */
.eyebrow { color: var(--text-info); margin-bottom: 10px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(36px, 4.6vw, 44px); line-height: .95; }
.page-head .lede { color: var(--mist-500); font-size: 16px; line-height: 22px; margin-top: 10px; }
.meta { font: 500 11px/14px var(--font-sans); color: var(--mist-500); margin-top: 12px; }
/* Panels ("windows") */
.card { --pad-y: 20px; --pad-x: 24px; background: var(--ink-700); border: 1px solid var(--line-900); border-radius: var(--radius-md);
  padding: var(--pad-y) var(--pad-x); margin-bottom: 16px; box-shadow: var(--bevel-raised), var(--panel-elevation); }
.card > h2 { font-size: 26px; margin-bottom: 12px; }
.hint { color: var(--mist-500); font-size: 12px; line-height: 16px; }

/* Article: the code row is the window's title bar */
.rule { transition: box-shadow .3s; }
.rule.flash { box-shadow: var(--bevel-raised), var(--panel-elevation), 0 0 0 2px var(--signal-info); }
.rule-top { display: flex; align-items: center; gap: 10px; margin: calc(-1 * var(--pad-y)) calc(-1 * var(--pad-x)) 14px; padding: 7px 10px 7px var(--pad-x);
  background: var(--ink-800); border-bottom: 1px solid var(--line-900); border-radius: var(--radius-md) var(--radius-md) 0 0; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .06); }
.rule-code { color: var(--mist-500); }
.rule-top .icon-btn { width: 26px; height: 26px; opacity: 0; }
.rule-top .icon-btn svg { width: 15px; height: 15px; }
.rule:hover .rule-top .icon-btn, .rule-top .icon-btn:focus-visible { opacity: 1; }
.rule h2 { font-size: 28px; margin-bottom: 10px; }

.prose { overflow-wrap: anywhere; }
.prose p { margin: .55em 0; }
.prose ul, .prose ol { margin: .5em 0; padding-left: 22px; }
.prose ul { list-style: square; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--text-info); font-family: var(--font-mono); font-weight: 700; }
.prose h4 { font: 400 20px/1 var(--font-display); letter-spacing: .02em; color: var(--chalk-000); margin: 1em 0 .35em; }
.prose blockquote { margin: .9em 0; padding: 8px 14px; background: var(--ink-800); border: 1px solid var(--line-900); border-left: 3px solid var(--signal-info);
  border-radius: var(--radius-sm); box-shadow: var(--bevel-sunken); }
.prose blockquote p { margin: .2em 0; }
.prose code { font: 12px var(--font-mono); background: var(--ink-800); padding: 1px 5px; border-radius: var(--radius-sm); }
.prose strong { color: var(--chalk-000); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
mark { background: var(--signal-warn); color: var(--on-signal); padding: 0 2px; }

/* Home: chapter grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--ink-700); border: 1px solid var(--line-900); border-radius: var(--radius-md); padding: 14px 16px;
  color: var(--chalk-100); text-decoration: none; box-shadow: var(--bevel-raised), var(--panel-elevation); }
.tile:hover { background: var(--ink-600); }
.tile:active { box-shadow: var(--bevel-sunken); }
.tile small { color: var(--text-info); }
.tile b { font: 400 24px/1 var(--font-display); letter-spacing: .02em; color: var(--chalk-000); }
.tile span { color: var(--mist-500); font-size: 12px; }
.section-title { font: 400 26px/1 var(--font-display); letter-spacing: .02em; color: var(--chalk-000); margin-top: 34px; margin-bottom: 14px; }

/* Article: previous / next */
.pager { display: flex; gap: 12px; margin-top: 26px; }
.pager a { flex: 1; min-width: 0; padding: 12px 16px; background: var(--ink-700); border: 1px solid var(--line-900); border-radius: var(--radius-md);
  box-shadow: var(--bevel-raised), var(--panel-elevation); text-decoration: none; color: var(--chalk-000); font: 400 22px/1.05 var(--font-display); letter-spacing: .02em; }
.pager a:hover { background: var(--ink-600); }
.pager small { display: block; color: var(--mist-500); margin-bottom: 4px; }
.pager .next { text-align: right; }

/* Search results */
.hit { display: block; text-decoration: none; color: var(--chalk-100); }
.hit:hover { background: var(--ink-600); }
.hit h2 { font-size: 24px; margin: 6px 0 4px; }
.hit p { color: var(--mist-500); font-size: 13px; }

/* ---- Editing ---- */
.edit-card { border-style: dashed; border-color: var(--line-300); }
.edit-tools { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 6px; }
.edit-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.preview { margin-top: 10px; padding: 12px 14px; background: var(--ink-800); border: 1px solid var(--line-900); box-shadow: var(--bevel-sunken); }
.title-input { font: 400 32px/1.1 var(--font-display) !important; letter-spacing: .02em; }
main > .btn.add { display: flex; width: 100%; justify-content: center; padding: 12px; }
.banner { display: flex; gap: 10px; align-items: center; background: var(--ink-800); color: var(--chalk-100); border: 1px solid var(--line-900); border-left: 3px solid var(--signal-warn);
  box-shadow: var(--bevel-sunken); padding: 9px 14px; font-size: 12px; margin-bottom: 18px; }

.bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; width: min(920px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ink-700); border: 1px solid var(--line-900); border-radius: var(--radius-md);
  box-shadow: var(--bevel-raised), 0 8px 30px rgba(0, 0, 0, .5); }
.bar-status { white-space: nowrap; padding-left: 4px; color: var(--mist-500); }
.bar-status.dirty { color: var(--text-warn); }
.bar input { flex: 1; min-width: 0; }
.review { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 29; width: min(920px, calc(100vw - 24px)); max-height: min(60vh, 520px); overflow-y: auto;
  padding: 16px 18px; background: var(--ink-700); border: 1px solid var(--line-900); border-radius: var(--radius-lg); box-shadow: var(--bevel-raised), 0 8px 30px rgba(0, 0, 0, .5); }
.review h2 { font-size: 26px; margin-bottom: 6px; }

/* Automatic change lists (version history + "Wijzigingen" above the publish bar) */
.changes { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.changes li { padding: 5px 0 5px 16px; position: relative; overflow-wrap: anywhere; }
.changes li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 6px; height: 6px; background: var(--signal-info); }
.changes .more { color: var(--mist-500); }
.changes .more::before { background: var(--line-500); }
.diff { margin: 6px 0 4px; border: 1px solid var(--line-900); border-radius: var(--radius-sm); overflow: hidden; font: 500 13px/1.55 var(--font-sans); background: var(--ink-900); }
.diff div { padding: 2px 10px 2px 26px; position: relative; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--mist-500); }
.diff div::before { position: absolute; left: 9px; font-weight: 700; }
.diff .add { background: var(--tint-good); color: var(--chalk-100); }
.diff .add::before { content: "+"; color: var(--text-good); }
.diff .del { background: var(--tint-critical); color: var(--chalk-100); text-decoration: line-through; text-decoration-color: var(--signal-critical); }
.diff .del::before { content: "−"; color: var(--text-critical); }
.diff .gap { text-align: center; padding: 0; line-height: 1.1; color: var(--mist-300); }
/* What a version changed: shown in full under each entry, scrolls on its own when it gets long. */
.log-detail { flex: 1 1 100%; min-width: 0; max-height: 360px; overflow-y: auto; padding: 2px 12px 8px; background: var(--ink-800); border: 1px solid var(--line-900); box-shadow: var(--bevel-sunken); }
.log-detail .changes { margin-top: 2px; }
.toast { position: fixed; left: 50%; top: calc(var(--top) + 14px); transform: translateX(-50%); z-index: 40; max-width: min(520px, calc(100vw - 24px));
  background: var(--ink-800); color: var(--chalk-000); padding: 10px 16px; border: 1px solid var(--line-900); border-left: 3px solid var(--signal-info);
  border-radius: var(--radius-md); font-size: 13px; box-shadow: var(--bevel-raised), 0 8px 30px rgba(0, 0, 0, .45); }

/* ---- Staff panel and login ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--ink-800); border: 1px solid var(--line-900); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--bevel-sunken); }
.stat b { display: block; font: 700 26px/26px var(--font-mono); color: var(--chalk-000); margin-bottom: 6px; }
.stat span { color: var(--mist-500); }
.log { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-500); }
.log:first-of-type { border-top: 0; }
.log > div:first-child { flex: 1 1 240px; min-width: 0; }
.log b { color: var(--chalk-000); }
.log small { color: var(--mist-500); display: block; font-size: 11px; line-height: 16px; }
.tag { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--ink-600); color: var(--mist-500); border: 1px solid var(--line-900); vertical-align: 1px; }
.tag.you { background: var(--signal-info); color: var(--on-signal); }
.login { max-width: 400px; margin-top: 30px; }
.login h1 { font-size: 34px; margin-bottom: 8px; }
.login .btn { width: 100%; justify-content: center; padding: 9px; font-size: 14px; }
.login .or { text-align: center; color: var(--mist-500); font-size: 12px; margin: 16px 0; }
.error { color: var(--text-critical); font-size: 13px; margin: 10px 0; }

/* ---- Smaller screens ---- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 270px minmax(0, 1fr); }
  .side-r { display: none; }
  .toc-inline { display: block; padding: 12px 16px; }
  .toc-inline summary { cursor: pointer; font: 400 22px/1 var(--font-display); letter-spacing: .02em; color: var(--chalk-000); }
  .toc-inline .toc-link { margin-top: 0; }
  .toc-inline summary + * { margin-top: 10px; }
}
@media (max-width: 820px) {
  .layout { display: block; }
  .menu-btn { display: inline-grid; }
  .top { padding: 0 12px; gap: 8px; }
  .brand #brand, kbd, .who { display: none; }
  .brand { flex: none; }
  /* Logged-in staff find their buttons at the bottom of the chapter menu instead of in the top bar. */
  #actions.staff { display: none; }
  .nav-staff { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-500); }
  .nav-staff .btn { justify-content: center; }
  main { padding: 22px 16px 150px; }
  .side-l { position: fixed; z-index: 25; left: 0; top: var(--top); width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s; }
  .nav-open .side-l { transform: none; }
  .scrim { position: fixed; inset: var(--top) 0 0 0; z-index: 24; background: var(--overlay-scrim); display: none; }
  .nav-open .scrim { display: block; }
  .card { --pad-y: 16px; --pad-x: 16px; }
  .stats { grid-template-columns: 1fr; }
  .bar { flex-wrap: wrap; }
  .bar-status { flex: 1 1 100%; }
  .rule-top .icon-btn { opacity: 1; }
  .pager { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .top, .side, .bar, .toast, .pager, .toc-inline, .rule-top .icon-btn { display: none !important; }
  .layout { display: block; } main { padding: 0; } .card { break-inside: avoid; box-shadow: none; }
}
