/* ── Fonts ─────────────────────────────────────────────────────────────────── */

/* The headings' serif, shipped with Zone (public/vendor/source-serif), so
   they look the same on every system and nothing loads from other hosts.
   One variable file per subset; a page with only Latin text loads one. */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/public/vendor/source-serif/source-serif-4-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: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/public/vendor/source-serif/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Variables ─────────────────────────────────────────────────────────────── */

/* Zone's look, shared with zonewiki.com and Zone CP's pages: warm paper and
   ink, a deep green accent, serif headings over a system sans. */
:root {
  --bg:           #f6f4ee;
  --fg:           #1d1f1c;
  --muted:        #676a63;
  --border:       #e2e0d8;
  --nav-bg:       #f6f4ee;
  --code-bg:      #edebe4;
  --link:         #3a7563;
  --link-missing: #a33232;
  --btn-bg:       #ebe8e0;
  --btn-fg:       #34362f;
  --btn-primary:  #3a7563;
  --btn-primary-fg: #ffffff;
  --accent:       #3a7563;
  --surface:      #ffffff;   /* fields, the editor, modals and menus: a sheet on the paper */
  --shadow:       0 1px 3px rgba(30,30,20,.08);
  --serif:        "Source Serif 4", Charter, "Bitstream Charter", Cambria, Georgia, serif;
  --sans:         -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:         "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    --bg:           #141513;
    --fg:           #ebeae4;
    --muted:        #a2a39b;
    --border:       #34362f;
    --nav-bg:       #1a1b18;
    --code-bg:      #1d1f1b;
    --link:         #8cc7b4;
    --link-missing: #ec9a9a;
    --btn-bg:       #262823;
    --btn-fg:       #d6d5ce;
    --btn-primary:  #3f7a68;
    --btn-primary-fg: #ffffff;
    --accent:       #8cc7b4;
    --surface:      #1d1f1b;
    --shadow:       0 1px 3px rgba(0,0,0,.3);
  }
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */

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

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
}

/* ── Brand ─────────────────────────────────────────────────────────────────── */

.site-logo {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */

.rename-bar.hidden { display: none; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */

/* Secondary buttons outlined on white, as on zonewiki.com: quiet next to
   the text, the accent on hover. Primary ones are filled (.btn-primary). */
.btn {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--btn-fg);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary:hover { color: var(--btn-primary-fg); border-color: var(--btn-primary); opacity: .85; }
.btn-danger:hover { color: var(--link-missing); border-color: var(--link-missing); opacity: .85; }
.btn-sm { padding: .15rem .4rem; font-size: .75rem; line-height: 1; }
.btn-primary {
  background: var(--btn-primary);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary);
}
.btn-danger {
  background: transparent;
  color: var(--link-missing);
  border-color: var(--link-missing);
}

/* Shown only on small screens (see the 640px media query) */
.mobile-only { display: none; }

/* Action bar (action_bar in templates/partials/modules.html): the phone's bottom tab bar
   (see the 640px media query). Desktop has the top actions instead. */
.action-buttons {
  display: flex; gap: .5rem;
  position: fixed; z-index: 300;
  right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom));
}
.action-buttons .action-module, .action-sep { display: none; }
.action-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.action-buttons button {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--nav-bg); color: var(--muted); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: color .15s, box-shadow .15s;
}
.action-buttons button:hover { color: var(--fg); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
@media (min-width: 641px) { .action-buttons { display: none; } }

/* Top actions (top_actions.html): on desktop, at the top right of the
   page in line with the breadcrumb: Search as a labelled pill, before it
   the Sharing chip while sharing mode is on.
   The breadcrumb and the status badges keep their room free
   (--top-actions-w, its width). Phones have the tab bar. */
/* The pill's margin and fixed width, the chip's and the user button's when
   they are there: fixed widths, so the row's width doesn't depend on the font. */
main {
  --top-actions-w: calc(8.75rem + var(--top-sharing-w, 0rem) + var(--top-user-w, 0rem));
}
main:has(> .top-actions .top-sharing) { --top-sharing-w: 6.25rem; }
.top-actions {
  /* The search pill's border on the content's edge. */
  position: absolute; top: 1.5rem; right: var(--main-pad);
  display: flex; align-items: center; gap: .25rem;
}
.top-actions .top-search {
  width: 8.25rem; justify-content: flex-start; gap: .45rem; margin-left: .5rem; padding: 0 .45rem 0 .6rem;
  border-color: var(--border); background: var(--surface); font: inherit; font-size: .8rem;
}
.top-actions .top-search svg { width: 16px; height: 16px; }
.top-search-key {
  margin-left: auto; padding: .05rem .3rem; border: 1px solid var(--border); border-radius: 4px;
  background: var(--code-bg); font-family: inherit; font-size: .7rem; color: var(--muted);
}
.top-actions button {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.top-actions button:hover { color: var(--fg); background: var(--btn-bg); }
.top-actions button:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
/* The menu's button, after the pill (2.25rem and a gap): with users a round
   initial (the user button), without three lines. */
main:has(> .top-actions .top-user) { --top-user-w: 2.6rem; }
.top-actions .top-user {
  margin-left: .35rem; border-radius: 50%; border-color: var(--border);
  background: var(--surface); font: inherit; font-size: .85rem; font-weight: 600; color: var(--fg);
}
.top-actions .top-menu { color: var(--muted); }
.top-actions .top-user[aria-current], .top-actions .top-user[aria-expanded="true"] { background: var(--btn-bg); }
main:has(> .top-actions) > .breadcrumb { min-height: 2.25rem; padding-right: calc(var(--top-actions-w) + 1.25rem); }

/* ── Sharing mode ─────────────────────────────────────────────────────────── */
/* For sharing the screen (zonewiki.js toggleSharing, html.sharing): the page
   on screen stays as it is, everything that shows other pages around it
   goes. A thin bar across the top and the highlighted eye say it is on. */
html.sharing body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 3px; z-index: 1000;
  background: #f59e0b; pointer-events: none;
}
/* The Sharing chip at the top right, there only while it is on: amber as the
   bar, a click turns it off. Off, the user menu and S turn it on. */
.top-actions .top-sharing {
  width: 6rem; gap: .35rem; border-radius: 999px;
  font: inherit; font-size: .8rem; font-weight: 600;
  color: #b45309; background: color-mix(in srgb, #f59e0b 18%, transparent);
}
.top-actions .top-sharing:hover { color: #92400e; background: color-mix(in srgb, #f59e0b 28%, transparent); }
@media (prefers-color-scheme: dark) {
  .top-actions .top-sharing, .top-actions .top-sharing:hover { color: #fbbf24; }
}
html.sharing :is(
  .trail-link, .trail-sep, .breadcrumb-clear,  /* the pages visited before */
  .breadcrumb-right,                             /* backlinks chip */
  .page-foot, .rail-context .backlinks,          /* backlinks, linked tasks, related, links to */
  .section-tasks,                                /* a section's linked tasks */
  .module-counts, #uncommitted-badge             /* status counts */
) { display: none !important; }

/* The Tasks links' counts (module_counts in templates/partials/modules.html,
   kept current by js/chrome.js): tasks due today or overdue (orange) and tasks in Focus (muted),
   each hidden at zero. */
.module-counts { display: inline-flex; gap: .2rem; margin-left: .3rem; }
.module-counts:not(:has(> :not([hidden]))) { display: none; }
.module-due, .module-focus, .module-new {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
  border-radius: 1rem; font-size: .7rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.module-due { background: color-mix(in srgb, #f97316 18%, transparent); color: #c2540a; }
.module-focus { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
/* Tasks someone gave you that you haven't touched yet: the accent, filled, as
   the "new" on their cards. */
.module-new { background: var(--link); color: var(--bg); }
:is(.module-due, .module-focus, .module-new)[hidden] { display: none; }
/* The Tasks links show one number, what is due (today or overdue), and a dot
   when there is news for you: how many, and how much is for today, are in the
   link's tooltip, and the Today tab says its own. (Until 2026-11 they showed
   three numbers without a word. A pill of the list switcher keeps its
   numbers: .tasks-place is no .module-link.) */
.module-link .module-focus { display: none; }
.module-link .module-new {
  min-width: 0; width: .5rem; height: .5rem; padding: 0; align-self: center;
  font-size: 0; overflow: hidden;
}
@media screen and (prefers-color-scheme: dark) {
  .module-due { background: color-mix(in srgb, #f97316 22%, transparent); color: #fb923c; }
  .module-focus { background: color-mix(in srgb, var(--muted) 25%, transparent); }
}

/* ── Main ──────────────────────────────────────────────────────────────────── */

main {
  position: relative;
  --main-pad: 1.5rem;   /* its side padding; the top row aligns to it */
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* ── Side columns ──────────────────────────────────────────────────────────── */
/* A page view on a big screen (view_page, main.wide): the table of contents
   on the left, what links to the page on the right, both sticky. The right
   one copies the sections smaller screens show at the page's end, which hide
   there. The text keeps its reading width; tables,
   code blocks and images alone in a paragraph grow into the middle column
   only when they need it. */

.rail { display: none; }
.rail-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-bottom: .5rem;
}
.rail-toc ul { list-style: none; border-left: 1px solid var(--border); }
.rail-toc li a {
  display: block; margin-left: -1px; padding: .2rem 0 .2rem .8rem;
  border-left: 2px solid transparent;
  color: var(--muted); font-size: .82rem; line-height: 1.4; text-decoration: none;
}
.rail-toc li.toc-h3 a { padding-left: 1.6rem; font-size: .78rem; }
.rail-toc li a:hover { color: var(--link); }
.rail-toc li a.active { color: var(--fg); border-left-color: var(--btn-primary); }
/* A section's linked tasks (_inject_section_tasks): a chip after its
   heading that opens the list. */
.section-tasks { position: relative; flex-shrink: 0; margin-left: auto; font-size: .75rem; }
.section-tasks + .section-edit-btn { margin-left: .5rem; }
.section-tasks summary {
  list-style: none; cursor: pointer; color: var(--muted);
  padding: .05rem .4rem; border: 1px solid var(--border); border-radius: 999px;
}
.section-tasks summary::-webkit-details-marker { display: none; }
.section-tasks summary:hover, .section-tasks[open] summary { color: var(--fg); }
.section-tasks ul {
  position: absolute; right: 0; top: calc(100% + .3rem); z-index: 50;
  min-width: 14rem; max-width: 22rem; margin: 0; padding: .4rem .6rem; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.page-content .section-tasks li { margin: 0; padding: .15rem 0; font-size: .85rem; }
.task-bl-section { font-size: .75rem; color: var(--muted) !important; white-space: nowrap; }
.rail-context .backlinks li a.task-bl-section { font-size: .72rem; color: var(--muted); }
.rail-top {
  display: inline-block; margin-top: 1rem; padding: .2rem 0;
  font-size: .78rem; color: var(--muted); text-decoration: none;
}
.rail-top[hidden] { display: none; }
.rail-top:hover { color: var(--link); }
.rail-context .backlinks,
.rail-context .backlinks + .backlinks { margin: 0 0 1.4rem; padding: 0; border: none; }
.rail-context .backlinks ul { display: block; }
.rail-context .backlinks li { padding: .15rem 0; line-height: 1.4; }
.rail-context .backlinks li + li::before { content: none; }
.rail-context .backlinks li a { font-size: .82rem; color: var(--fg); }
.rail-context .backlinks li a:hover { color: var(--link); text-decoration: none; }

@media (min-width: 1320px) {
  /* The wide page, with wider side padding: on a window not much wider
     than the page, the badges fixed at the top left would otherwise touch
     the breadcrumb. */
  body:not(.editor-page) main {
    max-width: calc(14rem + 60rem + 14rem + 2 * 3rem + 2 * 3.5rem);
    padding-inline: 3.5rem;
  }
  body:not(.editor-page) main { --main-pad: 3.5rem; }
  /* Every view gets that top row (breadcrumb and top actions), so it stays
     put when switching modules; the views without side columns (tasks,
     notes, search, …) keep their content at its usual width, centred. */
  body:not(.editor-page) main:not(.wide) > :not(.breadcrumb, .top-actions, .top-badges, .remote-badge) {
    max-width: 46rem; margin-inline: auto;
  }
  .page-grid {
    display: grid;
    /* The middle column is never narrower than its sheet needs for the
       text's full width (46rem and the sheet's padding and border), as on
       views without side columns; between 1320 and about 1600px wide the
       side columns give way instead (down to 9rem). */
    grid-template-columns: minmax(9rem, 14rem) minmax(calc(46rem + 2 * 2.25rem + 2px), 60rem) minmax(9rem, 14rem);
    column-gap: 3rem;
  }
  .rail {
    display: block; position: sticky; top: 1.5rem; align-self: start;
    max-height: calc(100vh - 3rem); overflow-y: auto; padding-top: .25rem;
  }
  /* A column taller than the window scrolls; a fade marks the edge with
     more (zonewiki.js sets the classes). */
  .rail.rail-more-below { mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5rem), transparent); }
  .rail.rail-more-above { mask-image: linear-gradient(to top, #000 calc(100% - 2.5rem), transparent); }
  .rail.rail-more-above.rail-more-below {
    mask-image: linear-gradient(to bottom, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
  }
  .page-col { min-width: 0; container-type: inline-size; }
  .page-col > :is(.tasks-places, .page-header, .page-meta-wrapper, .page-tldr, .page-content) {
    max-width: 46rem; margin-inline: auto;
  }
  .page-foot { display: none; }
  /* The right column lists the backlinks, so the breadcrumb's chip goes. */
  main.wide .breadcrumb-right { display: none; }
  /* As wide as the text, unless a line or a row needs more: then up to the
     middle column, centred. Text itself stays at its reading width. */
  .page-col .page-content > :is(pre, table, p.img-block) {
    width: max-content; min-width: 100%; max-width: 100cqw;
    position: relative; left: 50%; translate: -50% 0;
  }
}

/* ── The sheet ─────────────────────────────────────────────────────────────── */
/* A page's own column (view.html .page-col; not when it holds a .sheet of
   its own, as /tasks with side columns does) and the content of /tasks (its
   list switcher, heading and list), Notes, Admin and the history views (an
   old version, what a save changed, uncommitted and deleted pages: .sheet) sit
   on a sheet on the paper: white, in dark mode a step lighter, the side
   columns and the top row on the paper around it. Inside it the sheet is the page's background (--bg), so
   what paints itself in the page's colour (a folded section's label, …)
   matches. Task cards on a sheet are white too, set off by a firmer
   border and their shadow; the urgency tints mix with the card's colour. Phones keep the paper: the screen is the page there. The text
   keeps the width every view's content has. */
@media (min-width: 641px) {
  :is(.page-col:not(:has(> .sheet)), .sheet) {
    --bg: var(--surface);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem 2.25rem 2.5rem;
    box-shadow: 0 1px 2px rgba(30, 30, 20, .04);
  }
  :is(.page-col:not(:has(> .sheet)), .sheet) .tasks-app {
    --border: #d9dad6;
    --section-bg: #f0f0ed;
    --card-bg: var(--surface);
  }
}
@media screen and (min-width: 641px) and (prefers-color-scheme: dark) {
  :is(.page-col:not(:has(> .sheet)), .sheet) .tasks-app {
    --border: #45473f;
    --section-bg: #272922;
    --card-bg: #232520;
  }
}
@media (min-width: 641px) and (max-width: 1319px) {
  /* Without the side columns the sheet reaches into main's padding. */
  :is(.page-col:not(:has(> .sheet)), .sheet) {
    margin-inline: calc(-1 * var(--main-pad));
    padding-inline: calc(var(--main-pad) - 1px);   /* less its border */
  }
}
@media (min-width: 1320px) {
  /* The side columns start level with the sheet's title. */
  .page-grid > .rail { padding-top: 2rem; }
  /* A view without side columns: the sheet is the text's width and its own
     padding (after the 46rem of main:not(.wide) > … above, same weight). */
  body:not(.editor-page) main:not(.wide) > .sheet { max-width: calc(46rem + 2 * 2.25rem + 2px); }
  /* A page's sheet: as wide as other views' (the text and the sheet's
     padding), centred in the middle column; the whole column only when the
     page has something wider than the text (.sheet-wide, js/chrome.js), so
     a wide table or code block stays on the white. */
  .page-grid > .page-col:not(:has(> .sheet)) {
    justify-self: center; width: 100%; max-width: calc(46rem + 2 * 2.25rem + 2px);
  }
  .page-grid > .page-col.sheet-wide { max-width: none; }
  /* /tasks (its lists in the left column): the sheet as wide as a page's,
     centred in the middle column, so the heading sits where a page's does;
     the row of pills hides, the column has the lists. */
  .page-grid > .page-col:has(> .sheet) {
    justify-self: center; width: 100%; max-width: calc(46rem + 2 * 2.25rem + 2px);
  }
  .page-col > .sheet > :is(.page-header, .page-content) { max-width: 46rem; margin-inline: auto; }
  .page-grid .tasks-places { display: none; }
}

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

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 60%, var(--border));
}

.page-header h1 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.page-meta-wrapper {
  /* A normal block right after .page-header (not inside it, not absolutely
     positioned): the border-bottom above stays anchored under the H1/actions
     row, and this can still grow (e.g. an expanded tldr) without overlapping
     the article below it. The negative top margin pulls it back up under
     the header's own 1.5rem margin-bottom instead of adding a second gap. */
  margin: -1.1rem 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  font-size: .75rem;
  color: var(--muted);
}

.page-meta-left, .page-meta-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}

.page-meta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
/* Commit, as one more word on the "— uncommitted" meta line rather than a
   button on a row of its own. */
.commit-link {
  background: none; border: none; padding: 0; font: inherit; font-weight: 600;
  color: var(--link); cursor: pointer;
}
.commit-link:hover { text-decoration: underline; }
.commit-link:disabled { color: var(--muted); cursor: default; text-decoration: none; }
@media (pointer: coarse) { .commit-link { padding: .35rem .25rem; margin: -.35rem -.25rem; } }

/* ── Page frontmatter (tldr / tags) ──────────────────────────────────────── */

.page-frontmatter { margin: 0 0 1rem; }
.page-frontmatter summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .85rem;
  width: fit-content;
}
.page-frontmatter summary:hover { color: var(--fg); }
.page-frontmatter[open] summary { margin-bottom: .5rem; }
/* pre-line: a literal (`tldr: |`) or paragraphed tldr keeps its line breaks. */
.page-tldr { color: var(--muted); font-style: italic; margin: 0 0 .5rem; white-space: pre-line; }
.page-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
/* Frontmatter sources, at the article's end. */
.page-sources {
  margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--muted); overflow-wrap: anywhere;
}
.page-content .page-sources h2 {
  font-size: .85rem; font-weight: 600; margin: 0 0 .35rem; padding: 0; border: none;
}
.page-sources ul { margin: 0; }
.page-tag { text-decoration: none; }
.page-tag:hover { background: var(--btn-primary); color: var(--btn-primary-fg); }

/* tldr toggle in the page-meta row: a visually-hidden checkbox before the row,
   its label inside the row next to the tags, and the text as a sibling after
   the row. Because all three are siblings, checking the box reveals the text
   as its own full-width line below — the label never moves, nothing overlays
   the article, and no JS is involved. */
.tldr-toggle { position: absolute; opacity: 0; width: 0; height: 0; }
.tldr-label {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  white-space: nowrap;
}
.tldr-label::before { content: '▸ '; }
.tldr-toggle:checked ~ .page-meta-wrapper .tldr-label::before { content: '▾ '; }
.tldr-label:hover { color: var(--fg); }
.tldr-toggle:focus-visible ~ .page-meta-wrapper .tldr-label {
  outline: 2px solid var(--btn-primary);
  outline-offset: 2px;
}
.tldr-toggle ~ .page-tldr { display: none; }
/* When open, hand the row's bottom margin over to the revealed text so the
   text sits snug under the label instead of a full 1.5rem gap below it. */
.tldr-toggle:checked ~ .page-meta-wrapper { margin-bottom: .35rem; }
/* Top and bottom only: from 1320px the side columns centre the text with
   margin-inline: auto (Side columns), and this rule is the more specific. */
.tldr-toggle:checked ~ .page-tldr {
  display: block;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

/* ── Typography ────────────────────────────────────────────────────────────── */

/* Break long unbroken tokens (identifiers, hashes, paths) rather than letting
   them push the page wider than a phone viewport. Only kicks in when a word
   would otherwise overflow; <pre>/tables keep their own horizontal scroll. */
.page-content { overflow-wrap: break-word; }
/* Help (help.html): the document's own # heading is its title; at its end
   the manual's pages before and after it. */
.help-content > h1:first-child { margin-top: 0; font-size: 2rem; }
.help-content img { max-width: 100%; height: auto; }
.help-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.help-pager .help-next { margin-left: auto; text-align: right; }
.page-content h1 { font-family: var(--serif); font-size: 1.875rem; font-weight: 500; margin: 2rem 0 .875rem; padding-bottom: .35rem; border-bottom: 1px solid color-mix(in srgb, var(--muted) 60%, var(--border)); line-height: 1.25; letter-spacing: -.02em; }
.page-content h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; margin: 0; padding-bottom: .1rem; border-bottom: 1px solid color-mix(in srgb, var(--muted) 30%, var(--border)); }
.page-content h3 { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 .5rem; width: fit-content; }
.page-content h4 { font-size: .95rem; font-weight: 600; margin: 1.25rem 0 .4rem; }

/* Section edit wrapper injected around each <h2> in page view */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.section-header-h2 {
  margin: 2rem 0 .875rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 30%, var(--border));
}
/* Between sections only space: the h2's own rule marks the start, a second
   line above it made two lines per section. Page view: sections wrapped in
   .section-header-h2; the preview pane: plain h2 tags. */
.section-header-h2 ~ .section-header-h2,
.page-content h2 ~ h2 {
  margin-top: 2.75rem;
}
.section-header-h2 h2 { margin: 0; padding: 0; border: none; }
.section-header-h3 {
  margin: 1.5rem 0 .5rem;
}
.section-header-h3 h3 { margin: 0; }
.section-edit-btn {
  opacity: 0;
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  padding: .1rem .25rem;
  border-radius: 4px;
  transition: opacity .15s, background .15s;
  line-height: 1;
}
.section-header:hover .section-edit-btn { opacity: 1; }
.section-edit-btn:hover {
  opacity: 1;
  background: var(--btn-bg);
  color: var(--fg);
}

/* The copy-link icon by the page title and each heading (js/page.js),
   after its text. Sized in em, so it scales with the heading, and centred on the first line. */
:is(.page-header, .page-content) .heading-link {
  display: inline-flex;
  vertical-align: middle;
  margin-left: .3em;
  padding: .2em;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.heading-link svg { width: max(.875rem, .6em); height: max(.875rem, .6em); }
:is(h1, h2, h3):hover > .heading-link { opacity: .7; }
:is(.page-header, .page-content) .heading-link:is(:hover, :focus-visible, .copied) { opacity: 1; background: var(--btn-bg); color: var(--fg); }
:is(.page-header, .page-content) .heading-link.copied { color: var(--green-text, var(--btn-primary)); }
.slide-body .heading-link { display: none; }

/* The chevron that folds a section (js/fold.js): after the heading on
   narrow screens, always shown; in the margin left of it from 800px,
   shown on hover and while folded. */
.page-content .section-fold {
  display: inline-flex;
  vertical-align: middle;
  margin-left: .3em;
  padding: .2em;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  opacity: .5;
  transition: opacity .15s, background .15s, color .15s, rotate .15s;
}
.section-fold svg { width: max(.875rem, .6em); height: max(.875rem, .6em); }
.section-folded .section-fold { rotate: -90deg; }
/* A folded section's heading: a wavy line in place of its rule (on the
   header of a ##, on the heading of a ###), so it shows that more is there. */
.section-header-h2.section-folded, .section-folded > h3 { border-bottom-color: transparent; position: relative; }
.section-folded.section-header-h2::after, .section-folded > h3::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 6px;
  background: color-mix(in srgb, var(--muted) 70%, var(--border));
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6'%3E%3Cpath d='M0 3q3-3 6 0t6 0' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") repeat-x left center / 12px 6px;
}
.page-content .section-fold:is(:hover, :focus-visible) { opacity: 1; background: var(--btn-bg); color: var(--fg); }
@media (pointer: coarse) { .page-content .section-fold { padding: .35em; margin-block: -.2em; } }
@media (min-width: 800px) {
  :is(h2, h3):has(> .section-fold) { position: relative; }
  .page-content .section-fold { position: absolute; right: 100%; top: .5lh; translate: 0 -50%; margin: 0 .25em 0 0; opacity: 0; }
  :is(h2, h3):hover > .section-fold, .section-folded .section-fold { opacity: .7; }
}
/* Folded content: hidden="until-found" keeps an element's box (only its
   content is hidden), so its margins, padding and borders go too. */
.page-content [data-fold-hidden] { margin: 0 !important; padding: 0 !important; border: 0 !important; }
/* "folded" in the middle of the wavy line; a click unfolds the section. */
.section-folded-label { display: none; }
/* A short ###'s line is long enough for the wave to show on both sides. */
.section-folded > h3 { min-width: 8rem; }
.section-folded > .section-folded-label, .section-folded > h3 > .section-folded-label {
  display: block;
  position: absolute;
  left: 50%;
  bottom: -1px;
  translate: -50% 50%;
  z-index: 1;                        /* over the wave (::after) */
  padding: 0 .5rem;
  border: 0;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
}
.section-folded-label:is(:hover, :focus-visible) { color: var(--fg); background: var(--btn-bg); }
@media (pointer: coarse) { .section-folded > .section-folded-label, .section-folded > h3 > .section-folded-label { padding: .3rem .75rem; } }
.slide-body :is(.section-fold, .section-folded-label) { display: none; }
@media print { :is(.section-fold, .section-folded-label) { display: none; } }

.page-content p { margin-bottom: .875rem; }
.page-content ul, .page-content ol { margin: .375rem 0 .875rem 1.5rem; }
.page-content li { margin-bottom: .2rem; }
.page-content li > p { margin-bottom: 0; }
.page-content li > ul, .page-content li > ol { margin-top: .2rem; margin-bottom: 0; }

.page-content blockquote {
  border-left: 3px solid var(--border);
  padding: .25rem 0 .25rem 1rem;
  color: var(--muted);
  margin: 1rem 0;
}

/* Callouts: "> [!NOTE]" etc. GitHub's five kinds and meanings, in Zone's
   palette: slate, the accent green, plum, ochre and brick (the warning and
   danger colours of Zone CP's pages). Each type sets --alert, which tints
   the bar, background and title. */
.page-content .markdown-alert {
  --alert: #3d6a8e;
  border-left: 3px solid var(--alert);
  background: color-mix(in srgb, var(--alert) 7%, transparent);
  border-radius: 0 6px 6px 0;
  padding: .55rem 1rem;
  margin: 1rem 0;
}
.page-content .markdown-alert > :last-child { margin-bottom: 0; }
.page-content .markdown-alert-title {
  margin: 0 0 .3rem; font-weight: 600; color: var(--alert);
}
.page-content .markdown-alert-title::before { margin-right: .4rem; }
.page-content .markdown-alert-note      { --alert: #3d6a8e; }
.page-content .markdown-alert-tip       { --alert: #3a7563; }
.page-content .markdown-alert-important { --alert: #7a4f86; }
.page-content .markdown-alert-warning   { --alert: #8a5a00; }
.page-content .markdown-alert-caution   { --alert: #a33232; }
.page-content .markdown-alert-note      .markdown-alert-title::before { content: "ℹ"; }
.page-content .markdown-alert-tip       .markdown-alert-title::before { content: "💡"; }
.page-content .markdown-alert-important .markdown-alert-title::before { content: "❗"; }
.page-content .markdown-alert-warning   .markdown-alert-title::before { content: "⚠"; }
.page-content .markdown-alert-caution   .markdown-alert-title::before { content: "⛔"; }
@media screen and (prefers-color-scheme: dark) {
  .page-content .markdown-alert-note      { --alert: #8fb3d1; }
  .page-content .markdown-alert-tip       { --alert: #8cc7b4; }
  .page-content .markdown-alert-important { --alert: #c3a1d0; }
  .page-content .markdown-alert-warning   { --alert: #e3b866; }
  .page-content .markdown-alert-caution   { --alert: #ec9a9a; }
}

.page-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.page-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .875rem; }
/* Rows apart by lines only, no grid: the header row on a firmer line. */
.page-content th, .page-content td { padding: .45rem .75rem; border: 0; border-bottom: 1px solid var(--border); text-align: left; }
.page-content th { font-weight: 600; border-bottom: 1.5px solid color-mix(in srgb, var(--muted) 45%, var(--border)); }
/* Sortable tables (zonewiki.js): the arrow shows the sort; a faint ↕ on hover
   says the header can be clicked. */
.sortable-table thead th { cursor: pointer; user-select: none; }
.sortable-table thead th::after { content: ''; margin-left: .35em; font-size: .8em; color: var(--muted); }
.sortable-table thead th[aria-sort="ascending"]::after  { content: '▲'; }
.sortable-table thead th[aria-sort="descending"]::after { content: '▼'; }
@media (hover: hover) {
  .sortable-table thead th[aria-sort="none"]:hover::after { content: '↕'; }
}

/* ── Links ─────────────────────────────────────────────────────────────────── */

.page-content a {
  color: var(--link);
  text-decoration: none;
}
.page-content a:hover {
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-underline-offset: 3px;
}
.page-content a.wikilink-missing { color: var(--link-missing); text-decoration: underline; text-decoration-style: dashed; }
.page-content a[href^="http"]::after { content: "\00a0\2197"; font-size: .75em; opacity: .6; }

/* ── Code ──────────────────────────────────────────────────────────────────── */

.page-content code {
  font-family: var(--mono);
  font-size: .8125em;
  background: var(--code-bg);
  padding: .15em .4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.page-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  margin: 1rem 0;
}
.page-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .8125rem;
}
/* The highlight.js theme pads `pre code.hljs` by 1em, on top of the pre's
   own padding. */
.page-content pre code.hljs { padding: 0; }

/* Math (KaTeX) and diagrams (Mermaid), js/figures.js: display math and a
   diagram centred, scrolling sideways when wider than the text. */
.page-content .math-display {
  display: block;
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}
.page-content .math-display .katex-display { margin: 0; }
.page-content .mermaid-diagram {
  margin: 1rem 0;
  overflow-x: auto;
  text-align: center;
}
.page-content .mermaid-diagram svg { max-width: 100%; height: auto; }
.page-content .mermaid-error {
  margin: -.5rem 0 1rem;
  color: var(--link-missing);
  font-size: .8125rem;
}

/* Images never overflow, are always shrunk to fit */
.page-content img { max-width: 100%; height: auto; cursor: zoom-in; }

/* clear float after article content */
.page-content::after { content: ''; display: table; clear: both; }

/* ── Image lightbox ────────────────────────────────────────────────────────── */

#img-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#img-lightbox.open { display: flex; }
#img-lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 4px 32px rgba(0,0,0,.6);
  border-radius: 2px;
  cursor: default;
}

/* ── Search results page ───────────────────────────────────────────────────── */

/* Its heading like a page's title; the results white cards on the paper. */
.search-results h1, main > h1, main > .sheet > h1 { font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
/* Section headings on a view's sheet (Admin's Invite someone, Roles): as a page's h2. */
main > .sheet > h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; margin: 2.25rem 0 .6rem; }
.search-results h1 { margin-bottom: 1.5rem; }
.search-result-card {
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .625rem;
  transition: box-shadow .15s;
}
.search-result-card:hover { box-shadow: var(--shadow); }
.search-result-card a { text-decoration: none; color: var(--link); font-weight: 600; font-size: 1rem; }
.search-result-card p { margin: .3rem 0 0; font-size: .875rem; color: var(--muted); }
.search-more { display: block; margin: .4rem 0 .2rem; font-size: .875rem; text-align: right; }
.search-count { color: var(--muted); font-size: .875rem; margin: 0 0 .75rem; }
/* Folder and edit date (task: list and status), to tell alike titles apart. */
.search-result-card .result-meta {
  display: block;
  margin-top: .1rem;
  font-size: .75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-card mark,
.page-list-item a mark { background: none; color: var(--link); font-weight: 600; font-style: normal; }

/* ── Text inputs (forms and modals) ─────────────────────────────────────────── */

/* Shared chrome; per-context rules below adjust size/layout. */
.new-page-form input[type="text"],
.rename-form input[type="text"],
#modal-filter,
.modal input[type="text"],
.modal select,
.login-form input {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s;
}
.new-page-form input[type="text"]:focus,
.rename-form input[type="text"]:focus,
#modal-filter:focus,
.modal input[type="text"]:focus,
.modal select:focus,
.login-form input:focus { border-color: var(--link); }

/* ── New page form ─────────────────────────────────────────────────────────── */

.new-page-form { max-width: 440px; margin-top: 1.5rem; }
.new-page-form h1 { margin-bottom: 1.5rem; }
.new-page-form label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: .4rem; }
.new-page-form input[type="text"] { width: 100%; margin-bottom: 1rem; }
/* For: whom the page is for (New page on a group's home leads here). */
.new-page-form select {
  display: block; width: 100%; margin-bottom: 1rem; padding: .45rem .6rem; font: inherit;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
.new-page-form .promote-check { display: block; margin-bottom: 1rem; }

/* ── Rename bar ────────────────────────────────────────────────────────────── */

.rename-bar {
  display: flex;
  align-items: center;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--code-bg);
  flex-shrink: 0;
}

.rename-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  width: 100%;
}
/* What a rename to other readers asks: a line of its own under the field. */
.rename-form .rename-ask { flex-basis: 100%; line-height: 1.45; }

.rename-form label {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
}

.rename-form input[type="text"] {
  flex: 1;
  max-width: 320px;
  padding: .3rem .6rem;
  font-size: .875rem;
}

.rename-error {
  font-size: .8rem;
  color: var(--link-missing);
  margin-left: .5rem;
}

.conflict-banner {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.conflict-actions {
  margin-left: auto;
  display: flex;
  gap: .4rem;
}
.conflict-actions .btn-small {
  font-size: .78rem;
  padding: .25rem .6rem;
}
@media screen and (prefers-color-scheme: dark) {
  .conflict-banner { background: #451a03; color: #fbbf24; border-color: #b45309; }
}

/* A new page from a link on a private page: shared unless made private. */
.shared-new-banner {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem 1rem;
  margin-bottom: .5rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
/* A link on a private page to a page that doesn't exist yet and would be shared. */
.wikilink-private::after { content: "\1F512"; font-size: .7em; opacity: .6; margin-left: .2em; }
/* A link to a group's page that not every reader of this page sees. */
.wikilink-group::after { content: "\1F465"; font-size: .7em; opacity: .6; margin-left: .2em; }
.wikilink-shared-new::after { content: "\1F310"; font-size: .7em; opacity: .6; margin-left: .2em; }

/* ── Modals ──────────────────────────────────────────────────────────────────── */

/* Shared dialog chrome; per-modal rules set width and vertical position. */
.search-modal, .modal, .shortcuts-modal {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  padding: 1.25rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  margin: 20vh auto auto;
}
.search-modal[open], .modal[open], .shortcuts-modal[open] {
  display: flex;
  flex-direction: column;
}
.search-modal::backdrop, .modal::backdrop, .shortcuts-modal::backdrop {
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* ── Search modal ────────────────────────────────────────────────────────────── */

.search-modal {
  width: min(660px, 92vw);
  max-height: 72vh;
  overflow: hidden;
  margin: 12vh auto auto;
}

/* The preview pane (showModalPreview in zonewiki.js): wide screens only, the
   modal then wider, results on the left, the highlighted one on the right. */
.search-preview { display: none; }
@media (min-width: 1100px) {
  .search-modal { width: min(1180px, 94vw); height: 76vh; max-height: none; }
  .search-modal[open] {
    display: grid; gap: 0 1.25rem;
    grid-template: auto minmax(0, 1fr) / minmax(0, 32rem) minmax(0, 1fr);
  }
  .search-modal-controls { grid-column: 1 / -1; }
  .search-preview {
    display: block; overflow-y: auto; min-width: 0;
    border-left: 1px solid var(--border); padding: .25rem 0 1rem 1.25rem;
  }
  .search-preview .page-content { font-size: .9rem; }
  .search-preview-title { font-size: 1.3rem; margin: 0 0 .75rem; }
  .search-preview-card { display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }
  .search-preview-card .result-title { font-weight: 600; font-size: 1.05rem; }
}

.search-modal-controls {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .875rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#modal-filter {
  flex: 1;
  min-width: 140px;
  font-size: .9375rem;
}

#modal-sort {
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  font-size: .8125rem;
  outline: none;
  cursor: pointer;
}

.modal-results {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.unlinked-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.unlinked-label input { cursor: pointer; }

/* Semantic search on or not (js/search.js): a dot and a word, muted. */
.search-mode {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-left: auto; font-size: .8125rem; color: var(--muted); white-space: nowrap; cursor: help;
}
.search-mode::before {
  content: ""; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--muted); opacity: .6;
}
.search-mode[data-state="on"]::before { background: var(--btn-primary); opacity: 1; }
.search-mode[data-state="indexing"]::before { background: var(--btn-primary); opacity: .45; }

.page-list { list-style: none; }

.page-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}
.page-list-item:last-child { border-bottom: none; }
/* Built-in pages pinned above the pages (search modal, empty query): the
   last of them gets a stronger rule to set them apart. */
.page-list-special:not(:has(+ .page-list-special)):not(:last-child) {
  border-bottom: 2px solid color-mix(in srgb, var(--muted) 45%, var(--border));
}
.page-list-item a { color: var(--link); text-decoration: none; font-weight: 500; }
.page-list-item a:hover { text-decoration: underline; }
.page-list-item.hidden { display: none; }
.page-list-item.active { background: var(--code-bg); margin: 0 -.75rem; padding-left: .75rem; padding-right: .75rem; border-radius: 6px; }

.page-item-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.page-slug {
  font-family: var(--mono);
  font-size: .775rem;
  color: var(--muted);
  white-space: nowrap;
}

/* A private page's lock: beside its title, in the page lists */
.lock { font-size: .75em; opacity: .75; font-weight: normal; }
.page-item-right .lock { margin-right: .35rem; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .8125rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.editor-pane > .breadcrumb {
  margin-bottom: 0;
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  flex-shrink: 0;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); }
/* The breadcrumb's root is the module switcher (modules.html): the Z logo
   with Wiki, then Tasks and Notes (with users Wiki · Private | Tasks · Notes). It is a control, not part
   of the trail: a pill group with the current module shaded, and a thin
   vertical divider (the first separator) between it and the pages. Phones
   and the editor show the logo only, followed by a plain "›". */
.breadcrumb-home {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.breadcrumb .module-link { display: inline-flex; align-items: center; gap: .4rem; }
@media (min-width: 641px) {
  body:not(.editor-page) .module-group {
    display: inline-flex; align-items: center; padding: 2px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  }
  /* The lock before Private and Notes: only you see these. */
  .module-lock { display: inline-flex; align-items: center; margin-right: -.15rem; color: var(--muted); }
  /* A group's name is as long as its admin made it: the pill keeps its place in the row. */
  .module-switch .module-link[data-module="groups"] .module-label {
    max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    /* The label's box is trimmed to its capitals (below): room for what is cut off above and below them. */
    padding-block: .35em; margin-block: -.35em;
  }
  /* A fixed height with the content centred, the label's box trimmed to its
     capitals: the letters sit in the middle whatever the font's metrics
     (padding tuned for one font, Segoe UI, put them high with another).
     A browser without text-box centres the line box instead. */
  body:not(.editor-page) .module-switch .module-link {
    height: 1.5rem; padding: 0 .65rem; border-radius: 999px;
    transition: background .15s, color .15s;
  }
  body:not(.editor-page) .module-switch .module-label { text-box: trim-both cap alphabetic; }
  body:not(.editor-page) .module-switch .module-link:hover,
  body:not(.editor-page) .module-switch .module-menu-btn:hover { background: var(--btn-bg); color: var(--fg); }
  body:not(.editor-page) .module-switch .module-link[aria-current],
  body:not(.editor-page) .module-switch .module-menu-btn[aria-current] {
    background: color-mix(in srgb, var(--fg) 8%, var(--btn-bg)); color: var(--fg); font-weight: 600;
  }
  body:not(.editor-page) .module-switch + .breadcrumb-sep,
  /* Sharing mode hides the trail: the separator before the page is then
     the first one shown, the divider. */
  html.sharing body:not(.editor-page) .module-switch ~ .trail-sep ~ .breadcrumb-sep:not(.trail-sep) {
    align-self: stretch; width: 1px; margin: .2rem .5rem;
    background: var(--border); opacity: 1; font-size: 0;
  }
}
/* The user button (with users): opens the menu of who is signed in and Sign
   out (js/chrome.js). */
.module-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .1rem .5rem; border: none; border-radius: 999px; background: none;
  color: inherit; font: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.module-switch .module-menu-btn svg { width: 1rem; height: 1rem; }
.module-menu-btn:focus-visible { outline: 2px solid var(--btn-primary); outline-offset: 1px; }
.module-menu-backdrop { position: fixed; inset: 0; z-index: 999; }
.module-menu-backdrop[hidden], .module-menu[hidden] { display: none !important; }
.module-menu .menu-icon { margin-right: .5rem; }
.groups-menu .groups-menu-all { margin-top: .2rem; padding-top: .5rem; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; color: var(--muted); }
/* Who is signed in and Sign out: desktop only (a phone has them in the page's top row). */
.module-menu .menu-who { padding: .35rem .8rem .45rem; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: .2rem; }
.module-menu .menu-who strong { color: var(--fg); }
.module-menu .menu-signout { margin: .2rem 0 0; padding-top: .2rem; border-top: 1px solid var(--border); }
.module-menu .menu-signout button { width: 100%; }
.module-menu a[aria-current] { font-weight: 600; }
/* The editor keeps its focus: the logo only, as the way home. */
.editor-page .module-link:not([data-module="wiki"]),
.editor-page .module-group + .module-group,
.editor-page .module-menu-btn,
.editor-page .module-label { display: none; }
.breadcrumb-sep { opacity: .5; }
/* The trail is added by js/chrome.js after the page is drawn: until then the
   crumbs after the switcher stay invisible (they keep their room), so they
   don't jump when it is inserted. Shown after a second should the script fail. */
.breadcrumb[data-slug]:not(.trail-ready) > :not(.breadcrumb-home, .breadcrumb-right) {
  visibility: hidden; animation: trail-show 0s 1s forwards;
}
@keyframes trail-show { to { visibility: visible; } }
/* The navigation trail holds up to 6 pages. It stays on one line, and the
   page titles shrink with an ellipsis instead of pushing the page wider than
   a phone (which also pushed the full-screen tasks modal's buttons off-screen). */
.breadcrumb > a:not(.breadcrumb-home),
.breadcrumb > span:not(.breadcrumb-sep):not(.breadcrumb-right) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb-home, .breadcrumb-sep, .breadcrumb-clear, .breadcrumb-right { flex-shrink: 0; }
/* The oldest pages of the trail, where the row has no room for them all
   (fitTrail in js/chrome.js). Sharing mode hides the trail its own way. */
html:not(.sharing) .breadcrumb > .trail-off { display: none; }
.breadcrumb-clear {
  margin-left: .25rem;
  padding: 0 .25rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: .8rem;
  opacity: .4;
  cursor: pointer;
  line-height: 1;
}
.breadcrumb-clear:hover { opacity: 1; }

.breadcrumb-right { margin-left: auto; position: relative; }
.bl-count {
  font-size: .75rem;
  color: var(--muted);
  text-decoration: none;
  opacity: .55;
  transition: opacity .15s;
}
.bl-count:hover { opacity: 1; text-decoration: none; }
.bl-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  padding-top: .3rem;
  z-index: 100;
}
.bl-tooltip > a {
  display: block;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  padding: .3rem .6rem;
  font-size: .75rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.bl-tooltip > a + a { border-top: none; }
.bl-tooltip > a:first-child { border-radius: .35rem .35rem 0 0; }
.bl-tooltip > a:last-child  { border-radius: 0 0 .35rem .35rem; }
.bl-tooltip > a:only-child  { border-radius: .35rem; }
.bl-tooltip > a:hover { background: var(--border); }
/* Hover opens the list only where hover exists: on touch, :hover sticks after
   a tap and would fight the tap toggle (.bl-open, set by zonewiki.js). */
@media (hover: hover) {
  .breadcrumb-right:hover .bl-count { opacity: 1; }
  .breadcrumb-right:hover .bl-tooltip { display: block; }
}
.breadcrumb-right.bl-open .bl-count { opacity: 1; }
.breadcrumb-right.bl-open .bl-tooltip { display: block; }
@media (pointer: coarse) {
  .bl-count { display: inline-block; padding: .35rem .5rem; margin: -.35rem -.5rem; }
  .bl-tooltip > a { padding: .6rem .8rem; font-size: .9rem; }
}

/* ── Task list checkboxes ────────────────────────────────────────────────────── */

.task-list-item { list-style: none; margin-left: -1.25rem; }
.task-list-item-checkbox { cursor: pointer; margin-right: .4rem; accent-color: var(--link); }

/* ── Task references ([[task:…]], taskRefHTML in go/render.go) ─────────────────── */

/* Inline: a small chip in the sentence. Alone in a list item: a checklist
   row (no box), so a list of references reads like a checklist. */
.task-ref {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .1rem .4rem;
  max-width: 100%;
  padding: 0 .45rem 0 .3rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  vertical-align: baseline;
}
.task-ref-check {
  align-self: center;
  margin: 0;
  cursor: pointer;
  accent-color: var(--link);
}
.task-ref-check:disabled { cursor: default; }
.page-content .task-ref-title { color: var(--fg); text-decoration: none; min-width: 0; }
.page-content .task-ref-title:hover { color: var(--link); text-decoration: underline; }
.task-ref-badge { font-size: .75em; color: var(--muted); white-space: nowrap; }
.task-ref-due.overdue { color: #dc2626; font-weight: 600; }
.task-ref-due.due-today { color: var(--btn-primary); font-weight: 600; }
.task-ref-start.start-today { color: #d97706; }
.task-ref-start.start-later { color: #4d7799; }   /* slate, as a later start on a card */
@media screen and (prefers-color-scheme: dark) { .task-ref-start.start-later { color: #8fb3d1; } }
.task-ref-list { font-family: var(--mono); }
.task-ref-done .task-ref-title,
.task-ref-wontdo .task-ref-title { color: var(--muted); text-decoration: line-through; }
.task-ref-missing { color: var(--link-missing); border-style: dashed; padding: 0 .45rem; font-size: .9em; }
.task-ref-item { list-style: none; margin-left: -1.25rem; }
.task-ref-item .task-ref { padding: 0; border: none; background: none; }
.task-ref-item .task-ref-check { margin-right: .05rem; }

.task-date {
  display: inline-block;
  margin-left: .5rem;
  font-size: .7rem;
  padding: .1em .45em;
  border-radius: 3px;
  vertical-align: middle;
  opacity: .7;
  font-family: var(--mono);
}
.task-date-created { background: var(--code-bg); color: var(--muted); }
.task-date-done    { background: color-mix(in srgb, var(--link) 15%, var(--bg)); color: var(--link); }

/* ── Backlinks ───────────────────────────────────────────────────────────────── */

.backlinks {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--muted) 60%, var(--border));
}
.backlinks + .backlinks {
  margin-top: .5rem;
  border-top: none;
  padding-top: 0;
}

/* Shared uppercase micro-label style (section labels across the UI) */
.backlinks h3,
.content-matches .section-label,
.modal-label,
.pane-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.backlinks h3 { margin-bottom: .4rem; }

.backlinks ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.backlinks li { font-size: .8rem; color: var(--muted); }
.backlinks li + li::before { content: ", "; }

.backlinks li a {
  font-size: .8rem;
  text-decoration: none;
  color: var(--muted);
}
.backlinks li a:hover { text-decoration: underline; }

/* ── Content matches (pages list search) ────────────────────────────────────── */

.content-matches {
  margin-top: .5rem;
}
.content-matches.hidden { display: none; }

.content-matches .section-label { margin-bottom: .6rem; }

.content-matches .search-result-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
.content-matches .search-result-card.active {
  background: var(--code-bg);
  border-radius: 6px;
  outline: none;
}

/* ── Dialogs (.modal) ───────────────────────────────────────────────────────────── */

.modal { width: min(400px, 92vw); }
.modal[open] { gap: .75rem; }
.modal form { display: flex; flex-direction: column; gap: .75rem; }

.url-name-href {
  font-size: .75rem;
  color: var(--muted);
  word-break: break-all;
  background: none;
  padding: 0;
}

.upload-conflict-msg {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

.modal-label { font-size: .75rem; margin: 0; }

.modal input[type="text"], .modal select { width: 100%; }

.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.modal-desc { font-size: .875rem; color: var(--muted); margin: 0; }
/* Who sees a page that isn't everyone's, in words, where its mark's tooltip can't show (no hover: a phone). */
.page-seen { display: none; font-size: .85rem; color: var(--muted); margin: -1rem 0 1rem; }
@media (hover: none) { .page-seen { display: block; } }
/* A rename to other readers asks first: who will see the page, who no longer will. */
.rename-ask { font-size: .875rem; color: var(--fg); }
.modal .rename-ask { margin: .6rem 0 0; }

/* ── Shortcuts modal ─────────────────────────────────────────────────────────── */

/* A cheat sheet: groups of keys flow into as many columns of 15rem as the
   screen is wide, so on a desktop the whole of it fits without scrolling;
   where it doesn't (a phone), the dialog scrolls inside the screen, its
   title and × staying on top. */
.shortcuts-modal {
  width: min(1480px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0 1.25rem .75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: .8rem;
  line-height: 1.35;
}
.shortcuts-modal[open] { gap: .4rem; }
.sc-top {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 0 .3rem;
  background: var(--surface);
}
.sc-top .modal-label { margin: 0; }
.sc-top form { margin: 0; }
.sc-close {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 1.3rem; line-height: 1; padding: .2rem .45rem; border-radius: 4px;
}
.sc-close:hover, .sc-close:focus-visible { color: var(--fg); background: var(--btn-bg); }
.sc-grid { columns: 15rem; column-gap: 1.5rem; }
.sc-top [autofocus]:focus { outline: none; }
.sc-group { break-inside: avoid; padding-bottom: .7rem; }
.sc-group h3 {
  margin: 0 0 .35rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 600;
  color: var(--accent);
}
.sc-group dl {
  display: grid;
  grid-template-columns: fit-content(52%) 1fr;
  gap: .18rem .6rem;
  margin: 0;
}
.sc-group dt { margin: 0; min-width: 4.5rem; text-align: right; }
.sc-group dd { margin: 0; color: var(--fg); }
.shortcuts-modal kbd { font-size: .72rem; padding: 0 .3rem; line-height: 1.5; white-space: nowrap; }
.shortcuts-modal code { font-size: .75rem; }
.sc-hint { font-family: var(--sans); font-size: .75rem; font-weight: normal; color: var(--muted); }
.sc-hint kbd { color: var(--fg); }
.sc-foot a { color: var(--link); }
.sc-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: .15rem 1.25rem; padding-top: .5rem; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .shortcuts-modal {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 0 1rem .75rem;
    font-size: .9rem;
  }
  .sc-foot { flex-direction: column; }
}
/* Version and commit, bottom left on big screens (layout.html), faint until
   hovered. */
.zone-build {
  position: fixed; left: .75rem; bottom: .6rem; z-index: 1;
  font: .7rem/1 "JetBrains Mono", "Fira Code", monospace;
  color: var(--muted); opacity: .55; white-space: nowrap;
}
.zone-build:hover { opacity: 1; }
body.editor-page .zone-build { display: none; }   /* the editor fills the screen */
/* Only where the margin beside the 720px column has room for it. */
@media (max-width: 1139px) { .zone-build { display: none; } }
@media print { .zone-build { display: none; } }

.zone-version { margin: 0; font-size: .75rem; opacity: .6; text-align: center; font-family: "JetBrains Mono", "Fira Code", monospace; }
kbd {
  display: inline-block;
  padding: .1rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .8rem;
  background: var(--code-bg);
}

/* ── Notes list (/notes) ───────────────────────────────────────────── */

.notes-list, .page-content .notes-list { list-style: none; padding: 0; margin-left: 0; }
.notes-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
}
.notes-list li:last-child { border-bottom: none; }
.note-date { font-size: .8rem; color: var(--muted); white-space: nowrap; }
/* The Notes page's filter (initNotesFilter in zonewiki.js). */
.notes-filter { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.notes-filter input {
  flex: 1; min-width: 0; padding: .4rem .65rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--fg); font: inherit; font-size: .9rem;
}
.notes-filter input:focus { outline: 2px solid var(--link); outline-offset: -1px; }
.notes-filter-count { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.notes-list li[hidden] { display: none; }
.notes-list li:has(.note-excerpt) { flex-wrap: wrap; row-gap: .15rem; }
.note-excerpt {
  flex-basis: 100%; font-size: .8rem; color: var(--muted); line-height: 1.45;
  overflow-wrap: anywhere;
}
.note-excerpt mark { background: color-mix(in srgb, #facc15 40%, transparent); color: inherit; border-radius: 2px; }
.notes-filter-empty { color: var(--muted); font-size: .9rem; }
@media (max-width: 640px) { .notes-filter input { font-size: 16px; } }
.deleted-page-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.deleted-page-title { font-weight: 500; }

/* ── Auth ────────────────────────────────────────────────────────────────────── */

.signout-form {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Who is signed in (with users), beside Sign out. */
/* On a phone the name (without users: three lines) opens the menu (Groups,
   Connect an assistant, Change password): the desktop's is behind the
   button at the top right. */
.signout-user { color: var(--muted); font-size: .85rem; background: none; border: 0; padding: .35rem .25rem; font-family: inherit; cursor: pointer; }
.signout-user:focus-visible { outline: 2px solid var(--btn-primary); outline-offset: 1px; border-radius: 4px; }
/* Desktop has the name and Sign out in the menu at the top right instead. */
@media (min-width: 641px) { .signout-form.signout-in-menu { display: none; } }
/* Without users the opener is three lines, not a name. */
.signout-menu { display: flex; align-items: center; }
.signout-admin { text-decoration: none; }

/* ── The admin page (admins; users.html, its Users tab) ──────────────────────── */

.admin-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: .5rem 0 1rem; }
.admin-tabs a { padding: .4rem .8rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tabs a:hover { color: var(--fg); }
.admin-tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--link); font-weight: 500; }

.users-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.users-table th, .users-table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.users-table th { font-size: .8rem; font-weight: 500; color: var(--muted); }
.users-table form { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.user-name { font-weight: 500; }
.user-you, .users-help { color: var(--muted); font-weight: normal; }
.groups-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.groups-list > li { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr 7rem; gap: .25rem 1rem; align-items: baseline; padding: .6rem 0; border-top: 1px solid var(--border); }
.groups-list a { color: var(--accent); text-decoration: none; }
.groups-list a:hover { text-decoration: underline; }
.groups-list .group-name { font-weight: 600; }
.groups-list + p, h1 + .users-help { margin-top: .5rem; }
.groups-list .group-who, .groups-list .group-pages { color: var(--muted); font-size: .9rem; }
/* Who manages a group (its owners): its people, owners and name, folded. */
.group-manage { grid-column: 1 / -1; }
.group-manage > summary { display: inline-block; font-size: .8rem; cursor: pointer; list-style: none; }
.group-manage > summary::-webkit-details-marker { display: none; }
.group-form { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; margin: .6rem 0 0; }
.group-form label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); flex: 1 1 14rem; }
.group-form input { flex: 1; min-width: 8rem; font: inherit; font-size: .9rem; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); }
.group-form .users-help { flex-basis: 100%; margin: 0; }
.groups-list .group-pages { text-align: right; }
.groups-page :is(.users-done, .users-error) { margin: .75rem 0; font-size: .95rem; }
.group-manage { margin-top: .25rem; }
.groups-none { color: var(--muted); }
@media (max-width: 640px) {
  .groups-list > li { grid-template-columns: 1fr auto; }
  .groups-list .group-who { grid-column: 1 / -1; grid-row: 2; }
  .groups-list .group-pages { grid-column: 2; grid-row: 1; }
  .group-manage { grid-row: 3; }
  .group-form input { font-size: 16px; }
}
.group-mark { text-decoration: none; white-space: nowrap; }
.group-mark-name { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: .6em; font-weight: 600; color: var(--muted); vertical-align: middle; }
.group-mark:hover .group-mark-name { color: var(--accent); }
@media (max-width: 640px) { .groups-list > li { grid-template-columns: 1fr; } }
/* New page and New list of a group: a row of their own, small as Manage… is. */
.group-new { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.group-new .btn { font-size: .8rem; }
@media (max-width: 640px) { .group-new { grid-row: 3; } .groups-list .group-manage { grid-row: 4; } }
/* Remove, at the foot of Manage…: set apart, its two answers a line each. */
.group-remove { margin-top: .9rem; padding-top: .2rem; border-top: 1px dashed var(--border); }
.group-remove .group-form { display: block; }
.group-remove .group-form .users-help { margin: .4rem 0; }
.group-form label.share-choice { display: flex; flex: none; align-items: baseline; margin: .45rem 0; font-size: .9rem; color: var(--fg); }
.group-form .share-choice input[type="radio"] { flex: none; min-width: 0; padding: 0; }
.group-form .share-choice input[type="text"] { flex: none; width: 9rem; min-width: 0; margin: 0 .15rem; }
.group-remove .btn { margin-top: .35rem; }
.share-form { display: flex; flex-direction: column; gap: .5rem; }
.share-choice { display: flex; gap: .5rem; align-items: baseline; cursor: pointer; }
.share-choice code { display: block; font-size: .8rem; color: var(--muted); background: none; padding: 0; }
/* A field that takes users or groups (js/namepick.js): the chosen as pills, a
   box to type in, the names there are in a menu under it. */
.pick {
  position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem;
  flex: 1; min-width: 10rem; padding: .2rem .3rem; cursor: text;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--fg);
}
.pick:focus-within { outline: 2px solid var(--link); outline-offset: -1px; }
.pick-pills { display: contents; }
.pick-pill {
  display: inline-flex; align-items: center; gap: .15rem; padding: .05rem .15rem .05rem .5rem;
  border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); font-size: .85rem; line-height: 1.5; white-space: nowrap;
}
.pick-remove {
  border: 0; background: none; color: var(--muted); font: inherit; line-height: 1; cursor: pointer;
  width: 1.2rem; height: 1.2rem; border-radius: 50%;
}
.pick-remove:hover { color: var(--fg); background: var(--border); }
.pick .pick-input {
  flex: 1 1 4rem; min-width: 4rem; border: 0; outline: 0; padding: .1rem .2rem; margin: 0;
  background: transparent; color: inherit; font: inherit; font-size: .9rem;
}
.pick .pick-input[aria-invalid] { color: var(--link-missing); text-decoration: underline wavy var(--link-missing); }
.pick-menu {
  position: absolute; top: calc(100% + 2px); left: -1px; z-index: 50; min-width: 12rem; max-width: 20rem;
  list-style: none; margin: 0; padding: .25rem 0; font-size: .9rem; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow);
}
.pick-option { padding: .3rem .7rem; cursor: pointer; color: var(--fg); }
.pick-option:hover, .pick-option[aria-selected="true"] { background: var(--code-bg); }
.pick-none { padding: .3rem .7rem; color: var(--muted); }
.group-form .pick { flex: 1; }
.users-table .pick { width: 15rem; max-width: 100%; }
.users-table .pick .pick-input { min-width: 2rem; flex-basis: 2rem; }
.users-help a { color: var(--link); }
@media (max-width: 640px) { .pick .pick-input { font-size: 16px; } }
/* The admin page's Save: there once the field beside it is edited (js/admin.js). */
.saves-when-edited:not(.edited) [type=submit] { visibility: hidden; }
.user-also { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.groups-new { margin-top: .75rem; }
.user-fact { font-size: .7rem; padding: 0 .3rem; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-weight: normal; }
.user-email { font-size: .8rem; color: var(--muted); font-weight: normal; }
.user-disabled .user-name { color: var(--muted); text-decoration: line-through; }
.user-tasks { font-size: .85rem; white-space: nowrap; }
.user-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: flex-start; }
.user-remove > summary { list-style: none; display: inline-block; line-height: normal; } /* as tall as the buttons beside it */
.user-remove > summary::-webkit-details-marker { display: none; }
.groups-list .group-via { font-weight: 600; }
.user-remove-body { margin-top: .4rem; max-width: 22rem; font-size: .9rem; }
.users-done, .users-error { padding: .5rem .75rem; border-radius: 6px; }
.users-done { background: var(--code-bg); }
.users-error { background: #fbeeee; color: #a33232; }   /* Zone CP's danger colours */
@media screen and (prefers-color-scheme: dark) { .users-error { background: #2f1c1c; color: #ec9a9a; } }
.users-help { font-size: .85rem; }
.users-link { display: block; padding: .5rem; background: var(--code-bg); border-radius: 6px; word-break: break-all; user-select: all; }
/* Change password (password.html): the three fields, one under the other. */
.password-form { display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; margin: 1rem 0; }
.password-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; color: var(--muted); width: 100%; max-width: 22rem; }
.password-form input { font: inherit; font-size: .9rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); }

/* An assistant asks to connect (oauth.html): the login's form, with two answers. */
.oauth-form p { margin: 0; }
/* What the assistant may do: two choices, each a line of its own with what it means. */
.oauth-may { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: .5rem; }
.oauth-may legend { padding: 0; margin-bottom: .35rem; font-weight: 600; }
.oauth-may label { display: flex; gap: .5rem; align-items: baseline; min-width: 0; font-size: .9rem; line-height: 1.45; }
.oauth-may label span { flex: 1; min-width: 0; }
.oauth-may + .oauth-may { margin-top: .25rem; }

.oauth-answers { display: flex; gap: .5rem; }
.oauth-answers .btn { flex: 1; }
.assistant-connections form { margin: 0; }

/* Connect an assistant (assistant.html). Its text has a page's rhythm:
   paragraphs apart, a section's heading well clear of the one before. */
.assistant p { margin: .6rem 0; }
.assistant h1 { margin-bottom: .75rem; }
.assistant h2 { margin: 2.25rem 0 .5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.assistant .users-help { margin: .35rem 0; line-height: 1.5; }
.assistant :is(.users-done, .users-error) { margin: 1rem 0; }
.assistant-lead { font-size: 1.05rem; }
/* The address a client is given: the one thing every way in needs. */
.assistant-address { margin: 1rem 0 0; }
.assistant-label { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: .25rem; }
/* A line to copy: a click selects it, its button copies it (js/copyline.js). */
.copy-line { display: flex; align-items: flex-start; gap: .5rem; padding: .5rem .5rem .5rem .75rem; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; }
.copy-line code { flex: 1; min-width: 0; padding: .1rem 0; background: none; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; user-select: all; }
.copy-line .copy-btn { flex: none; padding: .3rem .55rem; }
/* Hidden until its script is there (js/copyline.js): .btn's display would show it. */
.copy-line .copy-btn[hidden] { display: none; }
/* A token just made, shown once: set off in the accent, its lines on the page's colour. */
.assistant-token { margin: 1.25rem 0; padding: .6rem 1rem 1rem; border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.assistant-token p { margin: .7rem 0 .3rem; }
.assistant-token .copy-line { background: var(--bg); }
/* The ways to sign in: who, then how. */
.assistant-ways { display: grid; gap: .75rem; margin: 1rem 0; }
.assistant-ways > div { padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 10px; }
.assistant-ways dt { font-weight: 600; }
.assistant-ways dd p:first-child { margin-top: .2rem; }
.assistant-ways dd > :last-child { margin-bottom: 0; }
.assistant-ways .copy-line { margin: .5rem 0; }
.assistant-none { color: var(--muted); }
.assistant-connections td:first-child { font-weight: 500; }
.assistant-connections :is(th, td):last-child { text-align: right; }
.assistant-connections td { vertical-align: middle; }
.assistant-sees { display: block; font-size: .8rem; color: var(--muted); }
.assistant-conn-changes { display: block; font-size: .8rem; font-weight: normal; color: var(--link); }
.assistant-conn-actions { white-space: nowrap; }
.assistant-conn-actions form { display: inline-block; }
/* A connection's Change…: the choices Allow offered (partials/reach.html), in
   a dialog (js/assistant.js); without JavaScript they unfold in the row. */
.assistant-change { display: inline-block; vertical-align: top; }
.assistant-change > summary { list-style: none; }
.assistant-change > summary::-webkit-details-marker { display: none; }
.assistant-conn-actions .assistant-change-form { display: flex; flex-direction: column; gap: .75rem; margin: .5rem 0; text-align: left; white-space: normal; min-width: min(20rem, 80vw); }
/* Taller than most dialogs (a group a line): it scrolls inside the screen. */
.assistant-change-dialog { width: min(440px, 92vw); max-height: calc(100dvh - 2rem); margin: 12vh auto auto; overflow-y: auto; overscroll-behavior: contain; }
@media (max-height: 760px) { .assistant-change-dialog { margin: auto; } }
.assistant .assistant-change-dialog .modal-label { margin: 0; }
.assistant .assistant-change-form p { margin: 0; }
.assistant-change-form .oauth-may input { flex: none; width: auto; margin: 0; padding: 0; border: 0; accent-color: var(--accent); }
.assistant-change-password { display: flex; flex-direction: column; gap: .4rem; }
.assistant-change-password[hidden] { display: none; }
.assistant-change-password input { font: inherit; font-size: .9rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--fg); }
.assistant-change-password input:focus { border-color: var(--link); outline: none; }
/* The token: what there is and what to do about it, a row each, the action on the right. */
.assistant-rows { margin: 1rem 0 0; border: 1px solid var(--border); border-radius: 10px; }
.assistant-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; padding: .75rem 1rem; }
.assistant-row + .assistant-row { border-top: 1px solid var(--border); }
.assistant-row > :first-child { flex: 1 1 16rem; margin: 0; }
.assistant-row p { margin: 0; }
.assistant-row p + p { margin-top: .3rem; }
.assistant-state { display: inline-block; margin-right: .25rem; padding: 0 .45rem; border: 1px solid var(--border); border-radius: 999px; font-size: .75rem; font-weight: 500; color: var(--muted); vertical-align: .08em; }
.assistant-state-on { border-color: transparent; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.assistant-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.assistant-form input { font: inherit; font-size: .9rem; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); min-width: 11rem; }
@media (max-width: 640px) {
  /* A connection's dates say what they are, the table's head being gone. */
  .assistant-connections td:nth-child(2)::before { content: "Answers to "; color: var(--muted); }
  .assistant-connections td:nth-child(3)::before { content: "May: "; color: var(--muted); }
  .assistant-connections td:nth-child(4)::before { content: "Since "; color: var(--muted); }
  .assistant-connections td:nth-child(5)::before { content: "Last used "; color: var(--muted); }
  .assistant-connections :is(th, td):last-child { text-align: left; }
  .assistant-form, .assistant-form input { width: 100%; }
}
.users-invite { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 0; }
.users-invite input { font: inherit; font-size: .9rem; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); min-width: 12rem; }
.users-table select, .users-invite select { font: inherit; font-size: .85rem; padding: .2rem; }
@media (max-width: 640px) {
  .users-table thead { display: none; }
  .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
  .users-table tr { padding: .5rem 0; border-bottom: 1px solid var(--border); }
  .users-table td { border: none; padding: .2rem 0; }
}

/* The notice setting's line (layout.html): fixed across the top, and what
   is fixed at the top (the badges, the editor) moves down by its height. */
body { --notice-h: 0px; }
body.has-notice { --notice-h: 2rem; padding-top: var(--notice-h); }
.wiki-notice {
  position: fixed; inset: 0 0 auto; z-index: 300; height: var(--notice-h);
  padding: 0 1rem; line-height: var(--notice-h); text-align: center;
  background: var(--fg); color: var(--bg); font-size: .85rem;   /* ink on paper, turned round: plain in both schemes */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media print { .wiki-notice { display: none; } body.has-notice { padding-top: 0; } }

.top-badges {
  position: fixed;
  top: calc(.6rem + var(--notice-h));
  left: .6rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: .5rem;
}
/* The editor's breadcrumb starts at the window's left edge, where the
   badges would cover it; its right end is free. Every other view has them
   in its top row, left of the top actions (--top-actions-w), centred
   on the row, and the breadcrumb keeps their room free. */
@media (min-width: 641px) {
  body.editor-page .top-badges { left: auto; right: .6rem; }
  body.editor-page:has(.remote-badge) .top-badges { right: 2.4rem; }
  body.editor-page .remote-badge { position: fixed; top: calc(.6rem + var(--notice-h)); right: .6rem; z-index: 200; line-height: 24px; }
  /* 🌐 left of the module switcher, in the margin outside the content's
     edge, on the row's centre line. */
  body:not(.editor-page) main > .remote-badge {
    position: absolute; top: 1.5rem; height: 2.25rem; display: flex; align-items: center;
    left: calc(var(--main-pad) - 1.6rem);
  }
  body:not(.editor-page) main > .top-badges {
    position: absolute; left: auto; top: 1.5rem; height: 2.25rem;
    right: calc(var(--main-pad) + var(--top-actions-w) + .75rem);
  }
  main:has(> .top-badges > [style*="inline-flex"]) > .breadcrumb { padding-right: calc(var(--top-actions-w) + 5.75rem); }
}

.remote-badge {
  font-size: .9rem;
  pointer-events: auto;
  filter: sepia(1) saturate(8) hue-rotate(-10deg) brightness(1.1);
  cursor: default;
  transition: opacity .15s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
}

.remote-badge:hover {
  opacity: .6;
}

/* The uncommitted-changes badge. */
.uncommitted-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  height: 1.5rem;
  padding: 0 .5rem 0 .35rem;
  border-radius: 1rem;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1;
}
.uncommitted-badge svg { flex-shrink: 0; }

.uncommitted-badge {
  background: color-mix(in srgb, var(--muted) 15%, transparent);
  color: var(--muted);
}
.uncommitted-badge:hover {
  background: color-mix(in srgb, var(--muted) 25%, transparent);
  color: var(--fg);
}

@media screen and (prefers-color-scheme: dark) {
  .uncommitted-badge {
    background: color-mix(in srgb, var(--muted) 20%, transparent);
  }
  .uncommitted-badge:hover {
    background: color-mix(in srgb, var(--muted) 35%, transparent);
  }
}

.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 20vh;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: min(320px, 90vw);
}

.login-form h2 {
  margin: 0 0 .25rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-form input { width: 100%; }
.login-form .oauth-may input { flex: none; width: auto; margin: 0; padding: 0; border: 0; accent-color: var(--accent); }

.login-error {
  color: var(--link-missing);
  font-size: .875rem;
  margin: 0;
}

/* ── Editor layout ─────────────────────────────────────────────────────────── */

body.editor-page main {
  max-width: 100%;
  padding: 0;
}

.editor-wrap {
  display: flex;
  position: fixed;
  inset: var(--notice-h) 0 0;
  justify-content: center;
}

.editor-pane {
  flex: 1;
  max-width: 800px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--nav-bg);
}

.editor-more { display: contents; }

.slug-label {
  font-size: .8rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-right: auto;
  /* A long slug is cut off, never pushes the buttons (Done) off-screen. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-toolbar > :not(.slug-label) { flex-shrink: 0; }

.save-dot {
  font-size: .5rem;
  color: transparent;
  user-select: none;
  transition: color .3s;
}
.save-dot.unsaved { color: var(--muted); }
/* "Merged bob's changes", for a few seconds after a save merged (editor.js takeMerged). */
.merge-note {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.merge-note[hidden] { display: none; }

/* Formatting bar (templates/partials/format_bar.html, applyFormat in js/mdedit.js): one
   line of quiet buttons above the textarea; on a narrow screen it scrolls
   sideways instead of wrapping. */
.format-bar {
  display: flex;
  align-items: center;
  gap: .1rem;
  padding: .35rem .75rem 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.format-bar::-webkit-scrollbar { display: none; }
.fmt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 1.7rem;
  height: 2rem;
  padding: 0 .2rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
}
.fmt-btn:hover { color: var(--fg); background: var(--nav-bg); border-color: var(--border); }
.fmt-btn:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.fmt-wiki { font-family: var(--mono); font-size: .75rem; letter-spacing: -.05em; }
.fmt-sep { flex-shrink: 0; width: 1px; height: 1.1rem; margin: 0 .2rem; background: var(--border); }
@media (pointer: coarse) {
  .fmt-btn { min-width: 2.6rem; height: 2.6rem; }
}

.editor-pane form {
  flex: 1;
  display: flex;
  padding: .75rem;
  min-height: 0;
}
/* The formatting bar already spaces the textarea from the toolbar. */
.editor-pane .format-bar + form { padding-top: .2rem; }

#editor-textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.65;
  background: var(--surface);
  color: var(--fg);
  tab-size: 2;
  outline: none;
  transition: border-color .15s;
}
#editor-textarea:focus { border-color: var(--link); }

.preview-pane {
  flex: 1;
  max-width: 800px;
  min-width: 0;
  display: none;
}
.preview-pane.visible {
  display: block;
  overflow-y: auto;
  padding: 1.25rem 1.75rem;
}
/* Very wide screens: the preview grows (the writing pane keeps its width);
   its text keeps the reading width, wide tables, code and images use the
   rest, as on a page view's middle column. */
@media (min-width: 1800px) {
  .preview-pane { max-width: 1100px; }
  #editor-preview { container-type: inline-size; }
  #editor-preview > * { max-width: 46rem; }
  #editor-preview > :is(pre, table, p.img-block) {
    width: max-content; min-width: min(100cqw, 46rem); max-width: 100cqw;
  }
  #editor-preview > .tasks-app { max-width: none; }
}

#editor-preview .preview-hl {
  box-shadow: inset 3px 0 0 var(--link);
  background-color: color-mix(in srgb, var(--link) 8%, transparent);
  border-radius: 2px;
  transition: box-shadow .1s, background-color .1s;
}

.pane-label { margin-bottom: 1rem; }

/* ── Wikilink autocomplete ──────────────────────────────────────────────────── */

.wikilink-ac {
  position: fixed;
  z-index: 500;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  min-width: 180px;
  max-height: 200px;
  overflow-y: auto;
}

.wikilink-ac-item {
  padding: .35rem .75rem;
  cursor: pointer;
  font-size: .875rem;
  font-family: var(--mono);
  color: var(--fg);
  white-space: nowrap;
}

/* Tasks in the `[[task:` completion: long titles end in "…", the list and
   deadline follow, smaller. */
.wikilink-ac { max-width: min(30rem, calc(100vw - 1rem)); }
.wikilink-ac-item { overflow: hidden; text-overflow: ellipsis; }
.wikilink-ac-meta { margin-left: .6rem; font-size: .75rem; color: var(--muted); }

.wikilink-ac-item:hover,
.wikilink-ac-item.selected {
  background: var(--code-bg);
  color: var(--link);
}

/* ── Page header actions group ─────────────────────────────────────────────── */

.page-header-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.page-menu-btn { padding-left: .55rem; padding-right: .55rem; letter-spacing: .05em; }
/* The page's ⋯ menu: the task app's ⋯ menu look (.task-menu rules below, a
   bottom sheet on phones); links as items, shortcuts on the right. */
.page-menu[hidden], .page-menu-backdrop[hidden] { display: none !important; }
.page-menu [hidden] { display: none !important; }
.page-menu a {
  display: block; padding: .4rem .6rem; border-radius: 4px;
  color: var(--fg); font-size: .85rem; text-decoration: none;
}
.page-menu a:hover, .page-menu a:focus-visible { background: var(--code-bg); outline: none; }
#page-menu button { display: flex; align-items: baseline; gap: 1.5rem; }
/* A menu item that is a form's button (a list's Pin, Unpin): the form is no box of its own. */
.page-menu-form { display: contents; }
.modal .rename-error { margin: 0; }
/* Move to wiki (a note's ⋯ menu) */
.promote-field { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
.promote-check { display: flex; align-items: center; gap: .4rem; font-size: .875rem; }
/* New list…, Make shared…: who sees a list (a select beside its word, For). */
.list-for-field { display: flex; align-items: center; gap: .5rem; font-size: .875rem; margin-top: .5rem; }
.list-for-field > select { flex: 1; min-width: 0; }
/* A group's list: the people beside its name. */
.list-for { cursor: help; }
.promote-preview { margin: 0; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.promote-preview code { font-size: inherit; }
/* The editor's hint after Move to wiki: the link to paste. One row: icon,
   the message over the link (one line, cut off), Copy, ×. */
.paste-hint {
  display: flex; align-items: center; gap: .75rem;
  margin: .6rem .75rem 0; padding: .55rem .5rem .55rem .75rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--code-bg); font-size: .85rem; flex-shrink: 0;
}
.paste-hint-icon {
  width: 1.25rem; height: 1.25rem; flex-shrink: 0;
  fill: none; stroke: var(--btn-primary); stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}
.paste-hint-text { flex: 1; min-width: 0; }
.paste-hint-text p { margin: 0; line-height: 1.4; }
.paste-hint-text code {
  display: block; margin-top: .15rem; padding: 0; background: none;
  font-size: .75rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.paste-hint .paste-hint-copy { flex-shrink: 0; padding: .25rem .65rem; font-size: .8rem; }
.paste-hint-close {
  flex-shrink: 0; border: none; background: none; color: var(--muted);
  font-size: 1.15rem; line-height: 1; padding: .25rem .4rem; border-radius: 4px; cursor: pointer;
}
.paste-hint-close:hover { color: var(--fg); background: var(--btn-bg); }
.page-menu .menu-key {
  margin-left: auto; padding: 0; border: none; background: none;
  font-family: inherit; font-size: .75rem; color: var(--muted);
}
@media (hover: none) { .page-menu .menu-key { display: none; } }

/* ── History ───────────────────────────────────────────────────────────────── */

.hist-table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.hist-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .875rem; }
.hist-table tr:last-child td { border-bottom: none; }
.hist-date { white-space: nowrap; font-family: var(--mono); color: var(--fg); }
.hist-rel  { white-space: nowrap; color: var(--muted); }
/* Phones: the uncommitted list's date says when; the relative time would
   push the Diff/View buttons off the screen. */
@media (max-width: 640px) {
  .hist-table .hist-rel { display: none; }
  .hist-table td { padding-inline: .4rem; }
}
.hist-msg  { color: var(--fg); width: 100%; }
.hist-filepath { display: block; color: var(--muted); font-size: 0.85em; }
/* Page history (/history): one row per saved version, the row opening it,
   "Changes" what that save changed; the page as it is now marked Current. */
.hist-intro { color: var(--muted); font-size: .875rem; margin: .25rem 0 1rem; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-row { display: flex; align-items: center; gap: .75rem; border-bottom: 1px solid var(--border); }
.hist-row:last-child { border-bottom: none; }
.hist-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 1rem;
  padding: .6rem .5rem; margin: 0 -.5rem; border-radius: 6px;
  color: var(--fg); text-decoration: none;
}
.hist-main:hover { background: var(--code-bg); }
.hist-when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .875rem; }
.hist-when .hist-rel { margin-left: .6rem; }
.hist-what { flex: 1; min-width: 0; font-size: .875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-counts { white-space: nowrap; font-size: .8rem; font-variant-numeric: tabular-nums; }
.hist-add { color: #2e7048; }
.hist-del { color: #a33232; }
.hist-badge {
  padding: .05rem .45rem; border-radius: 99px; font-size: .72rem; font-weight: 600;
  color: var(--btn-primary-fg); background: var(--btn-primary);
}
.hist-current .hist-when { font-weight: 600; }
.hist-changes { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.hist-changes:hover { color: var(--fg); }
@media screen and (prefers-color-scheme: dark) { .hist-add { color: #8fcfa4; } .hist-del { color: #ec9a9a; } }
@media (max-width: 640px) {
  .hist-main { flex-wrap: wrap; row-gap: .1rem; }
  .hist-what { flex-basis: 100%; order: 3; }
}
.hist-empty { color: var(--muted); font-size: .875rem; margin-top: 1rem; }

/* Changes (/changes): the wiki's commits by day; a row is when, what (who,
   and an assistant's mark), then what it changed. */
.changes-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  margin: 0 0 1rem; font-size: .875rem; color: var(--muted);
}
.changes-filter select, .changes-filter input[type="text"], .changes-filter input[type="date"] {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: .2rem .4rem; max-width: 100%;
}
.changes-check { display: inline-flex; align-items: center; gap: .35rem; }
.changes-all { color: var(--link); }
.changes-day { font-size: 1rem; margin: 1.5rem 0 .25rem; }
.changes-row { align-items: baseline; flex-wrap: wrap; gap: .1rem 1rem; padding: .5rem 0; }
.changes-what { flex: 1 1 16rem; min-width: 0; font-size: .875rem; overflow-wrap: anywhere; }
.changes-what .hist-by { color: var(--muted); }
.changes-assistant {
  padding: .05rem .45rem; border-radius: 99px; font-size: .72rem; white-space: nowrap;
  color: var(--muted); border: 1px solid var(--border);
}
.changes-source { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.changes-items { flex: 0 1 auto; max-width: 100%; display: flex; flex-wrap: wrap; gap: .1rem .75rem; font-size: .8rem; overflow-wrap: anywhere; }
.changes-items a { color: var(--link); text-decoration: none; }
.changes-items a:hover { text-decoration: underline; }
.changes-items span { color: var(--muted); }
.changes-more { margin-top: 1rem; }
.changes-undo { display: flex; gap: .4rem; flex: 0 0 auto; }
.changes-undo form { margin: 0; }

/* ── Diff view ───────────────────────────────────────────────────────────────── */

.diff-view { font-size: .8rem; line-height: 1.5; overflow-x: auto; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.diff-view span { display: block; white-space: pre; }
/* Put in green, taken out brick, in Zone's palette. */
.diff-add  { color: #2e7048; background: #edf5ef; }
.diff-del  { color: #a33232; background: #fbeeee; }
.diff-hunk { color: var(--muted); font-weight: 600; }
.diff-ctx  { color: var(--fg); }
@media screen and (prefers-color-scheme: dark) {
  .diff-add { color: #8fcfa4; background: #1b2a20; }
  .diff-del { color: #ec9a9a; background: #2f1c1c; }
}

/* An old version, or what one save changed (/revision, /diff): where it
   stands, its actions, and ← Older · Newer → to step through versions. */
.version-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px;
  padding: .5rem .5rem .5rem .875rem; margin-bottom: 1.5rem; font-size: .875rem;
}
.version-where { margin: 0; flex: 1 1 16rem; color: var(--fg); }
.version-where code { font-size: .8125rem; }
.version-actions { display: flex; align-items: center; gap: .75rem; }
.version-restore { display: contents; }
.version-link { font-size: .8125rem; color: var(--muted); }
.version-link:hover { color: var(--fg); }
.version-nav { display: flex; gap: .25rem; }
.version-nav [aria-disabled="true"] { opacity: .4; cursor: default; }

/* ── Presentation mode ─────────────────────────────────────────────────────── */

/* Slides on a white sheet filling the screen (dark: the sheet's step
   lighter), larger type, serif headings with a short accent bar instead of a
   rule, and a quiet control bar with the progress in the accent. */
.presentation-overlay {
  --bg: var(--surface);
  position: fixed;
  inset: 0;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

.presentation-slide {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(2.5rem, 7vh, 5rem) 2rem 2rem;
}

.slide-body-wrap {
  width: 100%;
  max-width: 900px;
}

.slide-body {
  width: 100%;
  font-size: 1.35rem;
  line-height: 1.65;
}

.slide-body h1, .slide-body h2, .slide-body h3 {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 500;
  margin: 2rem 0 1.75rem;
  padding-bottom: 0;
  letter-spacing: -.015em;
  line-height: 1.15;
  border-bottom: none;
}
.slide-body :is(h1, h2, h3)::after {
  content: ""; display: block; width: 3rem; height: 3px; margin-top: .9rem;
  border-radius: 2px; background: var(--accent);
}
.slide-body h1:first-child,
.slide-body h2:first-child,
.slide-body h3:first-child { margin-top: 0; }
/* Section-header wrappers are invisible in slides — h2/h3 inside render normally */
.slide-body .section-header { display: contents; }
.slide-body .section-edit-btn { display: none; }
.slide-body h4 { font-size: 1.05em; }
/* Tables and code grow with the slide's type (the page's are sized in rem). */
.slide-body table { font-size: .85em; }
.slide-body pre { font-size: .75em; }
.slide-body p  { margin-bottom: 1rem; }
.slide-body ul, .slide-body ol { margin: .5rem 0 1rem 1.75rem; }

.presentation-controls {
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .6rem 1.25rem .9rem;
  border-top: none;
  background: transparent;
}

.slide-counter {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slide-progress {
  width: 160px;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.slide-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .2s ease;
}

.pres-edit-btn {
  position: absolute;
  bottom: .45rem;
  right: .9rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--fg);
  text-decoration: none;
  opacity: .2;
  padding: .2rem .3rem;
  border-radius: 4px;
  transition: opacity .15s, background .15s;
}
.pres-edit-btn:hover { opacity: .85; background: var(--border); }

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  /* 16px on phones too: smaller reads poorly held in the hand (iOS uses 17). */
  body { font-size: 16px; }

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

  /* The action bar becomes a bottom tab bar: Wiki, Notes, Tasks | New
     note, New task | Search, each an icon over its label,
     the current module in the accent colour. The breadcrumb's switcher
     shrinks to the logo. */
  .action-buttons {
    left: 0; right: 0; bottom: 0; gap: 0;
    padding: .2rem .25rem calc(.2rem + env(safe-area-inset-bottom));
    background: var(--nav-bg); border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  }
  .action-buttons .action-module, .action-buttons button {
    flex: 1 1 0; min-width: 0; width: auto; height: auto; min-height: 3.25rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
    position: relative; padding: .2rem 0;
    border: none; border-radius: .5rem; background: none; box-shadow: none;
    color: var(--muted); font: inherit; font-size: .7rem; line-height: 1.2;
    text-decoration: none; cursor: pointer;
  }
  .action-buttons button:hover { box-shadow: none; }
  /* Navigation, the "new" actions, Search: three groups, as on desktop. */
  .action-sep { display: block; flex: none; align-self: center; width: 1px; height: 2rem; margin: 0 .25rem; background: var(--border); }
  .action-buttons .action-module[aria-current] { color: var(--btn-primary); font-weight: 600; }
  .action-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  /* The Tasks tab's counts stand right of its icon, due above Focus, centred
     on the icon (which sits .45rem above the tab's centre, the label below
     it), so they never cover it. They may reach a little past the tab's edge,
     clear of the next tab's icon; the tabs keep one width, so the icons stay
     evenly spaced. */
  .action-buttons .module-counts {
    position: absolute; top: calc(50% - .45rem); left: calc(50% + .9rem); transform: translateY(-50%);
    flex-direction: column; align-items: flex-start; margin: 0; gap: .1rem; pointer-events: none;
  }
  .action-buttons :is(.module-due, .module-focus) {
    min-width: .9rem; height: .85rem; padding: 0 .2rem; font-size: .6rem;
  }
  /* Notes is private with users: a small lock at its icon's top right
     (Private's icon is a lock itself). */
  .action-lock {
    position: absolute; top: calc(50% - 1.3rem); left: calc(50% + .3rem);
    display: flex; padding: 1px; border-radius: 50%; background: var(--nav-bg); pointer-events: none;
  }
  .action-lock svg { width: .7rem; height: .7rem; }
  .breadcrumb .module-link:not([data-module="wiki"]), .breadcrumb .module-label,
  .breadcrumb .module-group + .module-group,
  .breadcrumb .module-menu-btn { display: none; }
  /* The account menu, opened by the name beside Sign out: what that row doesn't have. */
  .module-menu :is(.menu-who, .menu-signout, .menu-admin, .menu-sharing) { display: none; }
  .module-menu-backdrop { background: rgba(0, 0, 0, .35); }
  /* Keep the end of the page and the toasts clear of the bar. */
  body:has(.action-buttons) main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  body:has(.action-buttons) .raw-toast { bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
  /* While typing, the on-screen keyboard owns the bottom of the screen; the
     bar would otherwise ride on top of it. */
  body:has(:is(input, textarea, select, [contenteditable]):focus) .action-buttons { display: none; }
  /* Sign out, in the page's flow at the top, only goes out of sight: taken
     out, the page would jump as a field loses the focus, and a tap on a
     form's button right after typing would miss it. */
  body:has(:is(input, textarea, select, [contenteditable]):focus) .signout-form { visibility: hidden; }

  /* The status badges join the page flow instead of floating over the
     breadcrumb. 🌐 (remote access) goes: on a phone that is a given. Sign
     out sits in the same row, on the right: the bottom edge belongs to the
     bar. The row keeps its height whether the uncommitted badge shows or
     not: the badge comes with an answer after the page is drawn, and a row
     that appeared then moved the whole page down under the reader's
     finger. Only a page with nothing that could show there (a visitor
     without Sign in) has no row. */
  .top-badges { position: static; margin: 0; }
  .top-badges > * { margin-top: .1rem; }
  .top-badges:has(> *) { min-height: 1.6rem; }
  .remote-badge { display: none; }
  .signout-form { position: static; margin-left: auto; }
  .top-actions { display: none; }
  main:has(> .top-actions) > .breadcrumb { min-height: 0; padding-right: 0; }
  /* The badges' row already spaces the page from the top edge, so main's
     own top padding shrinks: always, not when the badge shows (that moved
     the page up as it came). */
  body:has(.top-badges > *) main { padding-top: .5rem; }

  /* Bigger touch targets */
  .btn { padding: .45rem 1rem; }

  /* Tables scroll horizontally instead of overflowing */
  .page-content table { display: block; overflow-x: auto; }

  /* Editor — full-screen; preview stacks under the textarea and is toggled
     with the toolbar's Preview button (.mobile-only) or F2. */
  .mobile-only { display: inline-block; }
  .editor-wrap { flex-direction: column; }
  .editor-pane { max-width: none; border: none; }
  .preview-pane.visible {
    max-width: none;
    border-top: 1px solid var(--border);
    padding: 1rem;
  }
  /* 16px stops iOS Safari from zooming in when the textarea gets focus */
  #editor-textarea { font-size: 16px; }
  /* Rename…/Delete live in the ⋯ dropdown so the toolbar fits one line. */
  .editor-toolbar { position: relative; }
  .editor-more {
    display: none; position: absolute; top: 100%; right: .75rem; z-index: 50;
    flex-direction: column; align-items: stretch; gap: .4rem; min-width: 10rem;
    padding: .5rem; background: var(--nav-bg);
    border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  }
  .editor-more.open { display: flex; }
  .editor-more .btn { text-align: left; }
}

/* ── Raw page ──────────────────────────────────────────────────────────────── */

.raw-hint {
  margin-top: 2rem;
  padding: .75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
}

.raw-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem 1rem;
  box-shadow: var(--shadow);
  font-size: .9rem;
  z-index: 9999;
  animation: raw-toast-in .2s ease;
}

.raw-toast a { color: var(--link); }
.raw-toast-error { border-color: var(--link-missing); color: var(--link-missing); }

@keyframes raw-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-undo-toast {
  display: flex; align-items: center; gap: .75rem;
  left: 50%; right: auto; transform: translateX(-50%);
}
.task-undo-btn {
  font-size: .8rem; padding: .2rem .6rem; font-weight: 600;
  color: var(--link); background: transparent; border: 1px solid var(--link);
  border-radius: 4px; cursor: pointer;
}
.task-undo-btn:hover { background: var(--link); color: var(--bg); }

/* ── Search highlights (page opened from a search result, ?hl=…) ─────────── */
mark.search-hl {
  background: color-mix(in srgb, #facc15 45%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 .05em;
}
mark.search-hl.current {
  background: #f59e0b;
  color: #111;
  outline: 2px solid #f59e0b;
}
.search-hl-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: .5rem;
  max-width: calc(100% - 2rem);
  padding: .35rem .5rem .35rem .8rem;
  background: var(--nav-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  font-size: .85rem;
}
.search-hl-terms {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.search-hl-count { color: var(--muted); white-space: nowrap; }
.search-hl-bar button {
  border: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: 999px;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  cursor: pointer;
  font-size: .95rem;
}
.search-hl-bar button:hover { background: var(--border); }
@media (max-width: 640px) {
  /* The bottom corners hold the New note/Search buttons and Sign out. */
  .search-hl-bar { top: .5rem; bottom: auto; width: calc(100% - 1rem); max-width: none; }
}


/* The welcome page (an invite or reset link; welcome.html), in the login's form. */
.welcome-note { margin: 0; font-size: .9rem; color: var(--muted); }

/* A public wiki's visitor (body[data-visitor], nobody signed in): Sign in
   is in the top actions on a desktop and in the page's top row on a phone
   and in the editor; the editor's bar has nothing of tasks or uploads. */
.top-signin { flex: none; text-decoration: none; }
.signin-link { text-decoration: none; }
@media (min-width: 641px) { body:not(.editor-page) .signin-link { display: none; } }
body[data-visitor] .version-restore { display: none; }
body[data-visitor] .fmt-btn:is([data-fmt="taskref"], [data-fmt="tasklist"], [data-fmt="maketask"], [data-fmt="attach"]) { display: none; }
/* A viewer (body[data-viewer]; view.html .read-only): nothing to make, edit or tick. */
body[data-viewer] :is(.action-new-note, .notes-new, .action-task, [id^="task-add-btn"], .task-comment-add, .task-comment-open, .task-comment-btn) { display: none; }
body[data-viewer] .action-sep:has(+ .action-new-note) { display: none; }
.read-only .section-edit-btn { display: none; }
.read-only .page-content input[type="checkbox"] { pointer-events: none; }

/* An image on another site, not loaded (the page policy): a link to it. */
a.external-image::before { content: "🖼 "; }

/* ── Print ─────────────────────────────────────────────────────────────────── */
/* A page on paper, and in the PDF the browser's print dialog saves (Export
   as PDF… in the page's ⋯ menu): the page alone, its title, tags, date and
   text, without Zone around it (the top row, the side columns, buttons,
   what links to it). Always light: the dark variables are for screens. */
@page { margin: 18mm 16mm; }
@media print {
  html, body { background: #fff; }
  :root { --bg: #fff; --surface: #fff; }
  /* A hair of room at the sides: a border on the sheet's very edge is cut off. */
  main, main.wide { max-width: none; margin: 0; padding: 0 1px; }
  .breadcrumb, .top-actions, .top-badges, .remote-badge, .action-buttons,
  .rail, .page-foot, .page-header-actions, .page-menu, .page-menu-backdrop,
  .commit-file-form, .section-edit-btn, .section-tasks, .raw-toast,
  .paste-hint { display: none !important; }
  .page-grid { display: block; }
  .page-col { max-width: none; width: auto; }
  /* No sheet on the paper: the paper is the sheet. */
  :is(.page-col:not(:has(> .sheet)), .sheet) {
    border: none; border-radius: 0; box-shadow: none; padding: 0; margin: 0; background: none;
  }
  .page-col > :is(.tasks-places, .page-header, .page-meta-wrapper, .page-tldr, .page-content) { max-width: none; }
  .page-col .page-content > :is(pre, table, p.img-block) { width: auto; max-width: 100%; position: static; translate: none; }
  /* The tldr is on the paper, not behind its switch. */
  .tldr-label { display: none; }
  .tldr-toggle ~ .page-tldr { display: block; margin: 0 0 1.5rem; }
  /* A task list: its tasks, without what works them. */
  .tasks-header, .tasks-footer, .tasks-selbar, .task-actions { display: none !important; }
  .page-content { max-width: none; }
  .page-content :is(h1, h2, h3, h4, h5, h6) { break-after: avoid; }
  .page-content :is(pre, blockquote, img, figure, tr, .markdown-alert, .mermaid-diagram, .math-display) { break-inside: avoid; }
  .page-content :is(p, li) { orphans: 3; widows: 3; }
  /* What scrolls sideways on a screen is cut off on paper: code wraps. */
  .page-content pre, .page-content pre code { white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
  .page-content a { text-decoration: none; }
}
