/* ── Tokens (dark-first) ─────────────────────────────────── */

:root {
  --ok: #5cdd8b;
  --ok-dim: #1f6f43;
  --ok-bg: rgba(92, 221, 139, .12);
  --warn: #f8a306;
  --warn-dim: #9c6600;
  --warn-bg: rgba(248, 163, 6, .13);
  --danger: #dc3545;
  --danger-dim: #7a1f29;
  --danger-bg: rgba(220, 53, 69, .13);
  --info: #1747f5;
  --info-dim: #2d4a8a;
  --info-bg: rgba(23, 71, 245, .13);
  --purple: #a371f7;
  --purple-bg: rgba(163, 113, 247, .14);

  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2330;
  --line: #2a313c;
  --line-soft: #222831;

  --ink: #e6edf3;
  --ink-2: #9aa7b4;
  --ink-3: #6b7785;

  --r-sm: var(--r);
  --r: 12px;
  --r-lg: 20px;
  --r-pill: 999px;
  --bg-code: #0a0e14;
  --ink-code: #c9d4e0;
  --shadow: 0 4px 16px rgba(44, 29, 29, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", "Roboto Mono", Menlo, monospace;

  /* App aliases — some consumed in Jinja templates rather than CSS */
  --max-width: 940px;
  --font-body: var(--font);
  --font-mono: var(--mono);
  --color-text: var(--ink);
  --color-text-light: var(--ink-2);
  --color-link: var(--ink-2);
  --color-border: var(--line);
  --color-bg: var(--bg);
  --color-bg-alt: var(--surface);
  --color-field-bg: var(--surface-2);
  --color-success: var(--ok);
  --color-error: var(--danger);
  /* text-safe info tint (lighter than --info, which is for borders/bg) */
  --color-info: #7e9bff;

  color-scheme: dark;
}

/* Light theme opt-in */
[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eef0f3;
  --line: #dfe3e8;
  --line-soft: #eceef1;
  --ink: #1a1f26;
  --ink-2: #4a5560;
  --ink-3: #8893a0;
  --ok: #1f9d57;
  --ok-dim: #14613a;
  --ok-bg: rgba(31, 157, 87, .10);
  --warn: #d97706;
  --warn-dim: #92400e;
  --warn-bg: rgba(217, 119, 6, .10);
  --danger: #dc3545;
  --danger-dim: #9b1c2a;
  --danger-bg: rgba(220, 53, 69, .10);
  --info: #2563eb;
  --info-dim: #1d4ed8;
  --info-bg: rgba(37, 99, 235, .10);
  --purple: #7c3aed;
  --purple-bg: rgba(124, 58, 237, .10);
  --shadow: 0 4px 16px rgba(20, 30, 40, .10);
  --shadow-lg: 0 16px 48px rgba(20, 30, 40, .18);
  --color-info: #2563eb;
  color-scheme: light;
}

/* Forest theme */
[data-site-theme="forest"] {
  --bg: #0c1410;
  --surface: #141f18;
  --surface-2: #1a2820;
  --line: #253328;
  --line-soft: #1e2b22;
  --ink: #d8ebe0;
  --ink-2: #8aad96;
  --ink-3: #5a7a66;
}

[data-site-theme="forest"][data-theme="light"] {
  --bg: #f4f8f5;
  --surface: #e8f0eb;
  --surface-2: #dce8df;
  --line: #b8d0be;
  --line-soft: #ccddd0;
  --ink: #1a2e20;
  --ink-2: #3d6147;
  --ink-3: #6b9275;
}

/* Sepia theme */
[data-site-theme="sepia"] {
  --bg: #1a1410;
  --surface: #231c17;
  --surface-2: #2c2318;
  --line: #3d3022;
  --line-soft: #332819;
  --ink: #f0e6d3;
  --ink-2: #b8a080;
  --ink-3: #7d6850;
}

[data-site-theme="sepia"][data-theme="light"] {
  --bg: #faf6ef;
  --surface: #f3ece0;
  --surface-2: #ece0d0;
  --line: #d4bfa0;
  --line-soft: #ddd0b8;
  --ink: #2a1f14;
  --ink-2: #5c4530;
  --ink-3: #8c7060;
}

/* Midnight theme */
[data-site-theme="midnight"] {
  --bg: #080c16;
  --surface: #0e1424;
  --surface-2: #141c30;
  --line: #1e2a44;
  --line-soft: #192238;
  --ink: #d0daf8;
  --ink-2: #7c90c8;
  --ink-3: #4e62a0;
}

[data-site-theme="midnight"][data-theme="light"] {
  --bg: #f0f4ff;
  --surface: #e4ecff;
  --surface-2: #d8e4ff;
  --line: #b0c4ee;
  --line-soft: #c4d4f4;
  --ink: #0c1840;
  --ink-2: #2c4480;
  --ink-3: #5068a8;
}

/* Stone theme */
[data-site-theme="stone"] {
  --bg: #111110;
  --surface: #1a1917;
  --surface-2: #222120;
  --line: #333230;
  --line-soft: #2a2926;
  --ink: #ece8e0;
  --ink-2: #9e9890;
  --ink-3: #6e6860;
}

[data-site-theme="stone"][data-theme="light"] {
  --bg: #faf8f5;
  --surface: #f2efe8;
  --surface-2: #e8e4d8;
  --line: #c8c0b0;
  --line-soft: #d8d2c4;
  --ink: #1e1c18;
  --ink-2: #4a4640;
  --ink-3: #7a7468;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink-2);
  text-decoration: none
}

a:hover {
  text-decoration: underline;
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--surface-2);
  border-color: var(--ink-2) !important
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.15;
  margin: .5em 0 .35em
}

.auth-page h1,
.admin-page h1 {
  font-size: 1.5rem;
  letter-spacing: -.3px;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.2;
  margin: .6em 0 .3em
}

h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.25;
  margin: .6em 0 .3em
}

h4 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin: .5em 0 .25em
}

/* Kill the top-margin when a heading opens the page */
h1:first-child,
h2:first-child,
h3:first-child {
  margin-top: 0
}

code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px
}

code.inl,
.inl {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px
}

img {
  max-width: 100%;
}

/* ── Header ──────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.5rem;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 0.4rem 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.2px;
  line-height: normal;
  display: flex;
}

a.site-title:hover {
  text-decoration: none
}

.site-nav {
  display: flex;
  gap: 1rem;
  line-height: 1;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--ink-2);
  transition: color .12s;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: none
}

.site-nav a.active {
  color: var(--ink);

}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 1.125rem;
  line-height: 1;
  margin-left: auto;
  cursor: pointer;
}

.nav-toggle[aria-expanded="true"] .toc-icon-plus,
.nav-toggle[aria-expanded="false"] .toc-icon-minus {
  display: none;
}

.site-search {
  margin-left: auto
}

.site-search input {
  font-size: 0.875rem;
  font-family: var(--font);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  width: 12rem;
}

.site-search input::placeholder {
  color: var(--ink-3)
}

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

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem;
  margin-top: 3rem;
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.footer-main {
  flex: 1
}

.footer-text {
  font-size: 0.875rem;
  color: var(--ink-3);
  margin: 0;
  text-align: center;
}

.footer-text-below-subscribe {
  margin-top: 1rem
}

.footer-subscribe {
  margin-top: 0.5rem
}

.subscribe-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.subscribe-form label {
  font-size: 0.875rem;
  color: var(--ink-2)
}


/* ── Toast messages ──────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 22rem;
  width: calc(100vw - 2rem);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  opacity: 0;
  transform: translateX(0.75rem);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}

.toast-error {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.toast-info {
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 40%, transparent);
}

.toast-warn {
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

.toast-ic {
  font-size: 16px;
  line-height: 1.4;
  flex: none;
}

.toast-message {
  flex: 1;
}

.toast-message b {
  color: var(--ink);
}

.toast-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: .5;
  color: inherit;
  padding: 0;
  flex: none;
}

.toast-close:hover {
  opacity: 1;
}

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

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 0;
  border-radius: 8px;
  padding: 0.875rem 1rem 1rem;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: .12s ease;
  line-height: normal;
  text-decoration: none;
  background: var(--surface-2);
  color: var(--ink);
}

.btn:hover {
  border-color: var(--ink-3);
  text-decoration: none;
  transform: translateY(-1px)
}

.btn:active {
  transform: translateY(0)
}

.btn-primary {
  background: var(--ink-2);
  color: var(--bg);
  border-color: transparent
}

.btn-primary:hover {
  filter: brightness(1.08);
  border-color: transparent
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line)
}

.btn-secondary:hover {
  border-color: var(--ink-3)
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: transparent
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent
}

.btn-danger:hover {
  filter: brightness(1.07);
  border-color: transparent
}

.btn-xs {
  padding: 6px 11px;
  font-size: 12.5px
}

.btn-lg {
  padding: 12px 22px;
  font-size: 15.5px
}

.btn-pill {
  border-radius: var(--r-pill)
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--ink-3)
}

.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.4rem !important;
  font-size: 0.875rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-3);
  text-decoration: none;
  transition: .12s ease;
  line-height: 1;
}

.btn-small:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
  text-decoration: none
}

.btn-small.btn-danger {
  color: var(--danger)
}

.btn-small.btn-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-dim)
}

.inline-form {
  display: inline
}

/* ── Admin action wraps ──────────────────────────────────── */

.admin-actions-wrap {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap
}

.admin-actions-wrap .btn-small i {
  font-size: 1rem
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  line-height: 1;
  white-space: nowrap;
}

/* Auto dot (from styleguide): tints itself to the badge's colour, so badge
   markup needs no explicit .dot span. Add `.plain` to suppress it. */
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}

.badge.plain::before {
  display: none;
}

/* Avoid a double dot when an explicit .dot child is also present. */
.badge:has(.dot)::before {
  display: none;
}

/* Dot indicator inside badges */
.badge .dot,
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none
}

/* Live/published pulsing dot */
.dot.live {
  position: relative
}

.dot.live::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--ok);
  animation: pl-ping 1.6s ease-out infinite
}

@keyframes pl-ping {
  0% {
    transform: scale(.6);
    opacity: .9
  }

  100% {
    transform: scale(2.2);
    opacity: 0
  }
}

.badge-published {
  background: var(--ok-bg);
  color: var(--ok)
}

.badge-published .dot {
  background: var(--ok)
}

.badge-draft {
  background: var(--surface-2);
  color: var(--ink-2)
}

.badge-draft .dot {
  background: var(--ink-3)
}

.badge-review {
  background: var(--warn-bg);
  color: var(--warn)
}

.badge-review .dot {
  background: var(--warn)
}

.badge-scheduled {
  background: var(--info-bg);
  color: var(--color-info)
}

.badge-scheduled .dot {
  background: var(--info)
}

.badge-info {
  background: var(--info-bg);
  color: var(--color-info)
}

.badge-warning {
  background: var(--warn-bg);
  color: var(--warn)
}

.badge-warning .dot {
  background: var(--warn)
}

.badge-purple {
  background: var(--purple-bg);
  color: var(--purple)
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger)
}

/* ── Global fieldset/legend reset ────────────────────────── */

fieldset {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.5rem;
  margin: 0 0 1.5rem;
  background: var(--surface);
}

legend {
  font-size: 16px;
  letter-spacing: -.2px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 0.35rem;
}

/* ── Forms ───────────────────────────────────────────────── */

/* Brand-colored native controls in modern browsers */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--ink-2);
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0;
}

label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}

.field-hint {
  font-weight: 400;
  color: var(--ink-3);
  font-size: 0.8125rem;
  margin-top: 0;
}

/* Invalid field state */
.field.error input,
.field.error textarea,
.field.error select {
  border-color: var(--danger);
}

.field.error .field-hint {
  color: var(--danger);
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  appearance: none;
  font-size: 15px;
  padding: 0.875rem 1rem 1rem;
  background: var(--bg);
  background-color: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  color-scheme: inherit;
}

.input-xs,
.field input[name="registration_domain"] {
  margin-left: 0.4rem;
  border: none !important;
  border-bottom: 1px solid var(--ink-3) !important;
  border-radius: 0 !important;
  padding: 0 0 4px 0 !important;
  background-color: inherit !important;
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

.input-xs:focus-visible,
.field input[name="registration_domain"]:focus-visible {
  background-color: inherit !important;
  outline: 0 !important;
  box-shadow: none !important;
}

textarea {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.6;
}

#custom_footer_html,
#custom_head_html,
#custom_css {
  font-family: var(--mono);
  font-size: 14px;
}

/* ── Unified focus ring ──────────────────────────────────── */

.site-search input:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.editor-area textarea:focus-visible,
.icon-picker-search:focus-visible,
.link-dialog-input:focus-visible,
.inline-input:focus-visible {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px var(--surface-2);
  background-color: var(--surface-2);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-3)
}

/* Custom select arrow — two versions so it stays readable in both themes */
select {
  appearance: none;
  /* Default arrow for dark mode */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239aa7b4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 10px 6px;
  padding-right: 2rem;
  cursor: pointer;
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a5560'/%3E%3C/svg%3E");
}

.field-inline {
  flex-direction: row;
  align-items: center
}

.field-inline label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  cursor: pointer;
}

.field-row {
  display: flex;
  gap: 1rem
}

.field-row .field {
  flex: 1
}

.field-row .field-small {
  flex: 0 0 6rem
}

.bulk-actions {
  margin: 1rem 0.75rem
}

.bulk-actions span {
  font-size: 0.8125rem;
  color: var(--ink-3)
}

/* ── Index page ──────────────────────────────────────────── */

.index-page h1 {
  margin-bottom: 1rem
}

/* A–Z index rail (alpha jump) */
.az {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 2.5rem;

}

.az a {
  min-width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 6px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none;
}

.az a:hover {
  border-color: var(--ink-3);
  color: var(--ink);
  text-decoration: none;
}

.az a.off {
  opacity: .3;
  pointer-events: none;
}

.index-letter {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink-2);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 2rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}

.index-list .index-letter:first-of-type {
  margin-top: 0.75rem
}

.index-entry a {
  color: var(--ink);
  font-weight: 600;
}

.index-list ul {
  list-style: none;
  padding: 0;
  margin: 0
}

.index-entry {
  margin: 0.25rem 0;
}

.recent-entry:last-of-type,
.index-entry:last-of-type {
  border-bottom: 0
}

.recent-entry:last-of-type {
  padding-bottom: 0
}

.entry-is-child .parent,
.index-see {
  font-size: 0.8125rem;
  color: var(--ink-3)
}

.index-see {
  margin-left: 0.25rem;
}

.index-summary {
  color: var(--ink-2);
  font-size: 0.875rem
}

.index-children {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0 0 0 1.5rem;
}

.index-children .index-entry {
  padding: 0;
  border-bottom: none;
}

.index-child {
  margin-right: 0.25rem;
}


/* ── Notes timeline ──────────────────────────────────────── */

.timeline-hint {
  color: var(--ink-3);
  font-size: 0.8125rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

.notes-page .heatmap-section {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.notes-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.timeline-item.timeline-note {
  display: block;
}

.timeline-item:last-of-type {
  border-bottom: 0;
}

.timeline-date {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-3);
  font-family: var(--mono);
  margin-bottom: 0.25rem;
}

.timeline-status .timeline-date {
  flex-shrink: 0;
  min-width: 64px;
  margin-bottom: 0;
}

.timeline-note .timeline-body {
  color: var(--ink);
}

.timeline-status .timeline-body {
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-family: var(--mono);
}

.timeline-status a {
  color: var(--ink);
  font-weight: 600;
}

.timeline-changelog {
  color: var(--ink-3);
}

.timeline-date-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.timeline-date-line .timeline-date {
  display: inline;
  margin-bottom: 0;
}

.timeline-date-line a {
  color: var(--ink-3);
  font-family: inherit;
  font-size: inherit;
}

.timeline-date-line a:hover {
  color: var(--ink-2);
}

.timeline-sep {
  color: var(--ink-3);
}

.timeline-empty {
  color: var(--ink-3);
}

.timeline-pagination {
  margin-top: 2rem;
}

.timeline-pagination a {
  padding: 0 0.85rem;
}


/* ── Activity heatmap ────────────────────────────────────── */

.heatmap-section {
  margin-top: 4rem;
}

.heatmap-outer {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.heatmap-day-labels {
  display: grid;
  grid-template-rows: 18px repeat(7, 13px);
  font-size: 9px;
  color: var(--ink-3);
  text-align: right;
  padding-right: 4px;
  user-select: none;
  flex-shrink: 0;
}

.heatmap-scroll {
  overflow-x: auto;
}

.heatmap-months {
  position: relative;
  height: 18px;
  font-size: 9px;
  color: var(--ink-3);
  user-select: none;
}

.heatmap-months span {
  position: absolute;
  white-space: nowrap;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  grid-auto-columns: 11px;
  gap: 2px;
}

.heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--surface-2);
}

.heatmap-cell[data-future] {
  background: transparent;
}

.heatmap-cell[data-level="0"] {
  background: var(--surface-2);
}

.heatmap-cell[data-level="1"] {
  background: color-mix(in srgb, var(--ok) 30%, var(--surface-2));
}

.heatmap-cell[data-level="2"] {
  background: color-mix(in srgb, var(--ok) 55%, var(--surface-2));
}

.heatmap-cell[data-level="3"] {
  background: color-mix(in srgb, var(--ok) 80%, var(--surface-2));
}

.heatmap-cell[data-level="4"] {
  background: var(--ok);
}

.heatmap-cell[data-entries] {
  cursor: pointer;
}

.heatmap-tip {
  position: absolute;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  max-width: 280px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.heatmap-tip-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 0.35rem;
}

.heatmap-tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.heatmap-tip-list a {
  color: var(--ink);
  font-weight: 500;
}

.heatmap-tip-new {
  font-size: 0.7rem;
  color: var(--ok);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.heatmap-tip-log {
  color: var(--ink-3);
  font-size: 0.8rem;
}

/* ── Entry page ──────────────────────────────────────────── */

.entry-header {
  margin-bottom: 2rem
}

.entry-title {
  margin-bottom: 0
}

.entry-aliases {
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-top: 0.5rem;
}

.entry-breadcrumb {
  color: var(--ink);
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.entry-breadcrumb a {
  color: var(--ink)
}

.entry-breadcrumb a:hover {
  color: var(--ink-2)
}

.entry-toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.25rem;
  margin: 0 0 2rem 2rem;
  font-size: 0.875rem;
  float: right;
  width: 300px;
}

/* Eyebrow / section-label pattern — used in panels and sidebars */
.entry-toc strong,
.heatmap-section h2,
.entry-backlinks h2,
.entry-children h2,
.entry-toc summary,
.entry-footnotes h2,
.invite-form h2,
.invite-pending h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 700;
}

.entry-toc strong {
  display: block;
  margin-bottom: 0.5rem;
}

.entry-toc summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.entry-toc summary::-webkit-details-marker {
  display: none;
}

.entry-toc summary::marker {
  content: "";
}

.toc-toggle-icon {
  flex-shrink: 0;
  color: var(--ink-3);
}

.entry-toc details:not([open]) .toc-icon-minus,
.entry-toc details[open] .toc-icon-plus {
  display: none;
}

.entry-toc ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

.entry-toc li {
  margin: 0.5rem 0
}

.entry-toc a {
  color: var(--ink-2)
}

.entry-toc a:hover {
  color: var(--ink)
}

.entry-toc .toc-h4 {
  padding-left: 1rem;
}

.entry-body h2,
.entry-body h3,
.entry-body h4 {
  margin-top: 2rem
}

.entry-body h2 {
  font-size: 1.35rem;
  letter-spacing: -.3px
}

.entry-body h3 {
  font-size: 1.1rem
}

.entry-body blockquote {
  border-left: 3px solid var(--ink-2);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--ink-2);
}

.entry-body code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
}

.entry-body a {
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.entry-body a:hover {
  color: var(--ink);
  text-decoration: none;
}

.entry-body a.missing {
  color: var(--danger);
  border-bottom: 1px dashed var(--danger);
  text-decoration: none;
  cursor: help;
}

/* Category label (mono, brand-colored, uppercase) */
.cat {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-2);
  font-weight: 600
}

/* Tag chips */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 11px
}

.tag:hover {
  border-color: var(--ink-3)
}

.tag .x {
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 700
}

/* Callouts (used in entry body) */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  margin: 1.4em 0;
  border: 1px solid;
  align-items: flex-start
}

.callout .ic {
  flex: none;
  font-weight: 700
}

.callout b {
  display: block;
  margin-bottom: 1px
}

.callout p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2)
}

.callout-info {
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 40%, transparent)
}

.callout-info .ic {
  color: var(--color-info)
}

.callout-warn {
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent)
}

.callout-warn .ic {
  color: var(--warn)
}

.callout-ok {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent)
}

.callout-ok .ic {
  color: var(--ok)
}

.callout-danger {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent)
}

.callout-danger .ic {
  color: var(--danger)
}

/* Shared code-block container */
.entry-body pre,
.ProseMirror pre {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
}

.entry-body pre {
  padding: 1rem 1.125rem;
  margin: 1.25em 0;
}

/* Shared pre > code reset */
.entry-body pre code,
.ProseMirror pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-code);
}

.entry-body pre code {
  display: block;
  font-size: 0.8125rem;
}

.entry-body table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
  font-size: 0.9375rem
}

.entry-body th,
.entry-body td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--line)
}

.entry-body th {
  font-weight: 700;
  border-bottom: 2px solid var(--line);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3)
}

.entry-link-missing {
  color: var(--danger);
  border-bottom: 1px dashed var(--danger);
  text-decoration: none !important;
}

.entry-link-missing:hover {
  cursor: not-allowed !important
}

.entry-link-stub {
  border-bottom: 1px dashed var(--warn);
  text-decoration: none !important;
}

.entry-footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem
}

.entry-footnotes h2 {
  margin-top: 0;
  margin-bottom: 0.5rem
}

.footnote-ref {
  position: relative
}

.footnote-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.4rem 0.8rem;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  max-width: 20rem;
  white-space: normal;
  z-index: 10;
  box-shadow: var(--shadow);
}

.footnote-tooltip.visible {
  display: block
}

.footnote-backref {
  text-decoration: none;
  margin-left: 0.3rem
}

.entry-backlinks {
  margin-top: 2.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--line);
}

.heatmap-section h2,
.entry-backlinks h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.entry-backlinks a {
  color: var(--ink);
  font-weight: 500;
}

.entry-backlinks ul {
  list-style: none;
  padding: 0;
  margin: 0
}

.entry-backlinks li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft)
}

.entry-backlinks li:last-child {
  border-bottom: none;
  padding-bottom: 0
}

.backlink-summary {
  color: var(--ink-2)
}

.entry-meta {
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
}

.entry-meta .btn-small {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
}

.entry-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem
}

.copy-link-btn {
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.copy-link-btn:hover {
  color: var(--ink);
}

.entry-back {
  margin-top: 2rem;
  font-size: 0.875rem;
}

.entry-back a {
  color: var(--ink-3);
}

.entry-back a:hover {
  color: var(--ink);
  text-decoration: none;
}

/* ── Link preview card ───────────────────────────────────── */

.link-preview-card {
  position: fixed;
  z-index: 200;
  max-width: 22rem;
  width: max-content;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}

.link-preview-card.lpc-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lpc-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.lpc-summary {
  font-size: 0.8125rem;
  color: var(--ink-2);
  margin: 0.25rem 0 0;
  line-height: 1.5;
}

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

.search-result-count {
  font-size: 0.875rem;
  color: var(--ink-3);
  margin-bottom: 0.5rem
}

.search-results ul {
  list-style: none;
  padding: 0;
  margin: 0
}

.search-result-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line-soft)
}

.search-result-item a {
  font-size: 1.0625rem;
  color: var(--ink);
  font-weight: 600;
}

.search-result-summary {
  color: var(--ink-2);
  margin: 0.35rem 0 0;
  font-size: 0.875rem
}

.search-result-excerpt {
  font-size: 0.875rem;
  margin: 0.35rem 0 0
}

.search-result-item mark {
  background: var(--line);
  color: var(--ink);
  padding: 0 0.1em;
  border-radius: 2px;
}

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

.editor-page {
  display: block
}

.editor-heading {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.editor-heading h1 {
  margin: 0;
  font-size: 1.35rem
}

.editor-view-link {
  font-size: 0.8125rem;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.editor-view-link:hover {
  color: var(--ink-2);
  text-decoration: none
}

.editor-author {
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-left: auto
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-meta-top {
  display: flex;
  flex-direction: column;
  gap: 1rem
}

.editor-meta-top .field-hint {
  margin: 0;
}

.slug-input-wrapper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
}

.slug-input-wrapper:focus-within {
  box-shadow: 0 0 0 3px var(--surface-2);
  border-color: var(--ink-2);
}

.slug-prefix {
  display: flex;
  align-items: center;
  padding: 0.875rem 0 1rem 1rem;
  color: var(--ink-3);
  white-space: nowrap;
  font-size: 15px;
  user-select: none;
  pointer-events: none;
}

.slug-input-wrapper input[type="text"] {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
  padding-left: 0 !important;
}

.slug-copy-btn {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: transparent;
  border: none;
  border-left: 1px solid var(--line);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color .12s, background .12s;
  flex-shrink: 0;
}

.slug-copy-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.slug-input-wrapper input[type="text"]:focus-visible {
  box-shadow: none !important;
  border-color: transparent !important;
}

.slug-input-wrapper:focus-within {
  border-color: var(--ink-2) !important;
  box-shadow: 0 0 0 3px var(--surface-2) !important;
  background-color: var(--surface-2) !important;
}

.editor-toolbar {
  display: flex;
  gap: 0.2rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}

.editor-toolbar button {
  width: auto;
  min-width: 30px;
  max-width: 48px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 0;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: .12s;
}

.editor-toolbar button .bi-list-ul,
.editor-toolbar button .bi-list-ol {
  font-size: 18px;
}

.editor-toolbar button:hover {
  background: var(--surface);
  color: var(--ink)
}

.editor-toolbar button.active {
  background: var(--surface-2);
  color: var(--ink-2)
}

.editor-area {
  margin-top: 0.8rem;
}

.editor-area textarea {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0;
  resize: vertical;
  width: 100%;
  min-height: 20rem;
  background: var(--bg);
  color: var(--ink);
}

.editor-preview {
  padding: 1rem;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0;
  min-height: 20rem;
  line-height: 1.75;
  background: var(--surface);
}

.editor-stats {
  font-size: 0.75rem;
  color: var(--ink-3);
  padding-bottom: 0.25rem;
  top: -.25rem;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-meta-bottom {
  display: flex;
  flex-direction: column;
  gap: 1rem
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between
}

.editor-actions-left {
  display: flex;
  align-items: center;
  gap: 0.75rem
}

/* ── Toolbar separator ───────────────────────────────────── */

.toolbar-sep {
  width: 1px;
  background: var(--line);
  margin: 0.2rem 0.15rem
}

/* ── ProseMirror ─────────────────────────────────────────── */

.ProseMirror-container {
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--surface);
}

.ProseMirror {
  padding: 1rem;
  min-height: 20rem;
  outline: none;
  line-height: 1.75;
  font-size: 0.9375rem;
  color: var(--ink);
}

.ProseMirror p {
  margin: 0 0 0.75rem
}
.ProseMirror li p,
.ProseMirror li ul,
.ProseMirror li ol {
  margin: 0;
}

.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4 {
  margin: 1.5rem 0 0.5rem
}

.ProseMirror blockquote {
  border-left: 3px solid var(--ink-2);
  margin: 0 0 0.75rem;
  padding-left: 1rem;
  color: var(--ink-2);
  font-style: italic;
}

.ProseMirror ul,
.ProseMirror ol {
  margin: 0 0 0.75rem;
  padding-left: 1.5rem
}

.ProseMirror code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
}

.ProseMirror pre {
  padding: 0.75rem 1rem;
}

.ProseMirror hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0
}

.ProseMirror a {
  color: var(--ink-2);
  text-decoration: underline
}

.ProseMirror .footnote-ref {
  font-size: 0.8em;
  vertical-align: super;
  color: var(--ink-2);
  cursor: default;
}

.ProseMirror-focused {
  outline: none !important;
  box-shadow: none !important;
}

.ProseMirror .ProseMirror-gapcursor {
  position: relative
}

.ProseMirror .ProseMirror-gapcursor::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid var(--ink);
  animation: ProseMirror-cursor-blink 1.1s steps(2) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden
  }
}

/* ── Admin ───────────────────────────────────────────────── */

.admin-page {
  max-width: var(--max-width)
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-title .nav-toggle {
  order: 1;
  margin-left: 0;
}

.admin-nav {
  margin-bottom: 2rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.admin-nav-links {
  display: flex;
  gap: 2px;
}

.admin-nav a {
  padding: 0.5625rem 0.875rem;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 600;
  transition: color .12s;
}

.admin-nav a:hover {
  color: var(--ink);
  text-decoration: none
}

.admin-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--ink-2)
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0;
}

.invite-section .admin-table {
  border: none;
}

.admin-table th {
  text-align: left;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  font-weight: 700;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table tr:hover td {
  background: var(--surface-2)
}

.admin-table tr:last-child td {
  border-bottom: none
}

.col-primary {
  width: 100%;
}

.entry-child-arrow {
  color: var(--ink-3);
  margin-right: 0.35rem;
}

.entry-lock-icon {
  font-size: inherit;
  color: var(--ink-3);
  margin-left: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.entry-stub-label {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin-left: 0.35rem;
}

.col-nowrap {
  white-space: nowrap
}

.col-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 24rem
}

.col-mono {
  font-family: var(--mono);
  font-size: 0.8125em
}

.sort-link {
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.sort-link:hover {
  color: var(--ink);
  text-decoration: none
}

/* ── Pagination ──────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.25rem;
  font-size: 0.8125rem
}

.pagination a,
.pagination-gap {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line);
}

.pagination a:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  text-decoration: none;
  color: var(--ink)
}

.pagination-active {
  background: var(--ink-2) !important;
  color: var(--bg) !important;
  border-color: var(--ink-2) !important;
  font-weight: 600
}

.pagination-gap {
  color: var(--ink-3);
  border-color: transparent
}

.pagination-count {
  margin-left: 0.5rem;
  color: var(--ink-3);
  font-size: 0.8125rem
}

/* ── Settings ────────────────────────────────────────────── */

.settings-form {
  margin: 1.5rem 0
}

/* Accordion / disclosure */
details.disclosure {
  border: 1px solid var(--line);
  margin: 2rem 0;
  border-radius: 0;
  background: var(--surface);
  overflow: hidden;
}

details.disclosure summary {
  cursor: pointer;
  padding: 0.8rem 1rem;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.2px;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

details.disclosure summary::before {
  content: "›";
  color: var(--ink-3);
  font-size: 18px;
  transition: transform .15s ease;
  top: -1px;
  position: relative;
}

details.disclosure[open] summary::before {
  transform: rotate(90deg);
}

details.disclosure .inner {
  padding: 0 1.5rem 1.5rem;
}

.settings-form .field {
  margin-bottom: 1rem
}

.settings-form .field:last-of-type {
  margin-bottom: 0;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem
}

.radio-group label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink)
}

.radio-with-input {
  flex-wrap: wrap
}

.inline-input {
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  width: 12rem;
  font-family: inherit;
}

.settings-disabled {
  opacity: .4;
  pointer-events: none
}

.role-form select {
  font-size: 0.8125rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

.auth-alt {
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-top: 0.5rem
}

/* ── Integrations ────────────────────────────────────────── */

.webhook-secret-row {
  display: flex;
  gap: 0.5rem;
  align-items: center
}

.webhook-secret-input {
  font-family: var(--mono);
  font-size: 0.8125rem;
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.4rem 0.65rem;
}

.webhook-payload-example {
  margin-top: 0.75rem
}

.webhook-payload-code {
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--ink);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 0;
  font-family: var(--mono);
}

.test-data-section {
  margin-top: 2rem
}

.test-data-actions {
  margin-top: 0.75rem
}

.data-subheading {
  font-size: 0.9375rem;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  font-weight: 600
}

.data-subheading:first-of-type {
  margin-top: 0
}

.import-forms {
  /* display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem; */
}

.import-form {
  margin: 0.8rem 0;
}

.import-form:last-of-type {
  margin-bottom: 0;
}


.import-filename {
  font-size: 0.8125rem;
  color: var(--ink-3);
  width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Site icon / image ───────────────────────────────────── */

.site-icon {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 0.5rem
}

.site-icon svg {
  vertical-align: middle
}

.site-image-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 4px;
  flex-wrap: wrap
}

.site-image-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem
}

.site-image-thumb {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-sm)
}

.site-image-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap
}

/* ── Icon picker ─────────────────────────────────────────── */

.icon-picker-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem
}

.icon-picker-current i {
  font-size: 1.5rem
}

.icon-picker {
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.75rem;
  background: var(--surface);
}

.icon-picker-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem
}

.icon-picker-search {
  flex: 1;
  padding: 0.3rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
}

.icon-picker-search::placeholder {
  color: var(--ink-3)
}

.icon-picker-count {
  white-space: nowrap;
  font-size: 0.8125rem;
  color: var(--ink-3)
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
  gap: 2px;
  max-height: 16rem;
  overflow-y: auto;
}

.icon-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--ink-2);
}

.icon-picker-item:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink)
}

.icon-picker-selected {
  background: var(--surface-2) !important;
  color: var(--ink-2) !important;
  border-color: var(--ink-2) !important
}

.icon-picker-selected:hover {
  background: var(--surface-2) !important;
  color: var(--ink-2) !important
}

#icon-label {
  display: none
}

#icon-pick-btn {
  padding: 0.2rem 0
}

/* ── Error pages ─────────────────────────────────────────── */

.error-page {
  max-width: 24rem;
  margin: 3rem auto;
  text-align: center
}

.error-page h1 {
  margin-bottom: 0.5rem
}

.error-page p {
  color: var(--ink-2);
  margin-bottom: 1.5rem
}

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

.auth-page {
  max-width: 24rem;
  margin: 0 auto
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem
}

/* ── Invite form ─────────────────────────────────────────── */

.invite-section {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.invite-form h2 {
  margin: 0 0 0.5rem;
}

.invite-form .field-row {
  align-items: flex-end
}

.invite-pending {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line)
}

.invite-pending h3 {
  margin: 0 0 0.5rem;
}

.invite-pending .admin-table td {
  padding: 0.3rem 0.5rem;
  border-bottom-color: var(--line-soft)
}

.invite-pending .admin-table td:first-child {
  padding-left: 0
}

.invite-pending .admin-table td:last-child {
  padding-right: 0
}

.invite-pending .admin-table tr:last-child td {
  border-bottom: none
}

/* ── Preview / stub banners ──────────────────────────────── */

.preview-banner {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8125rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.stub-banner {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8125rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}


/* ── Author bio popup ────────────────────────────────────── */

.author-name[data-bio] {
  cursor: pointer;
  text-decoration: underline dotted
}

.bio-popup {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.6rem 1rem;
  border-radius: var(--r-sm);
  position: absolute;
  z-index: 20;
  max-width: 20rem;
  min-width: 150px;
  font-size: 0.8125rem;
  line-height: 1.5;
  box-shadow: var(--shadow);
  animation: bio-popup-in 0.14s ease;
}

.bio-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: var(--arrow-left, 1rem);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom: none;
  border-top-color: var(--line);
}

.bio-popup-text+.bio-popup-link {
  margin-top: 0.25rem;
}

.bio-popup-link {
  display: block;
  color: var(--ink-2);
  word-break: break-all;
}

@keyframes bio-popup-in {
  from {
    opacity: 0;
    transform: translateY(-4px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* ── Floating search popups ──────────────────────────────────
   Shared look for anchored search/create dropdowns: the link-insert
   popup, the wiki-link typeahead, and the parent-entry field below
   all use the same border/shadow/row recipe. ── */

.link-dialog {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  width: 300px;
  max-width: calc(100vw - 16px);
}

.link-dialog-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.9375rem;
  border: 1px solid var(--line);
  border-radius: 0;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
}

.link-dialog-input::placeholder {
  color: var(--ink-3)
}

.link-dialog-results {
  max-height: 12rem;
  overflow-y: auto;
  margin-top: 0.5rem
}

.link-result {
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font-size: 0.875rem
}

.link-result:hover,
.link-result.selected {
  background: var(--surface-2)
}

.link-result-summary {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-top: 0.15rem
}

.link-result-empty {
  padding: 0.5rem 0.65rem;
  color: var(--ink-3);
  font-size: 0.8125rem
}

.link-result-create {
  color: var(--ink-2);
  border-top: 1px solid var(--line);
}

/* ── Wiki-link typeahead popup ───────────────────────────── */

.wikilink-popup {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 240px;
  max-width: 340px;
  max-height: 220px;
  overflow-y: auto;
}

.wikilink-result {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wikilink-result:hover,
.wikilink-result.selected {
  background: var(--surface-2);
}

.wikilink-result strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.wikilink-summary {
  font-size: 0.75rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wikilink-empty {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.wikilink-result-create {
  color: var(--ink-2);
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
}

/* ── Confirm dialog ──────────────────────────────────────── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: confirm-fade-in 0.12s ease;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5)
}

.confirm-bubble {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  max-width: 22rem;
  width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: confirm-bubble-in 0.15s ease;
}

.confirm-message {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem
}

@keyframes confirm-fade-in {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes confirm-bubble-in {
  from {
    opacity: 0;
    transform: scale(.95) translateY(6px)
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0)
  }
}

/* ── Theme toggle ────────────────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3)
}

/* Dark is default — sun icon shown to offer switch to light */
.theme-toggle .icon-sun {
  display: inline
}

.theme-toggle .icon-moon {
  display: none
}

/* Explicit dark */
html[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none
}

/* Explicit light */
html[data-theme="light"] .theme-toggle .icon-sun {
  display: none
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: inline
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .site-search {
    margin-left: 0;
    width: 100%
  }

  .site-search input {
    width: 100%
  }

  .entry-toc {
    width: 100%;
  }

  .field-row {
    flex-direction: column
  }

  .invite-form .field-row {
    flex-direction: row
  }

  .entry-meta .entry-updated {
    display: none;
  }

}

@media screen and (max-width: 768px) {
  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
  }

  .col-title {
    max-width: 180px
  }
}

@media (max-width: 700px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;

    flex-direction: column;
    gap: 0;
    width: 100%;
    order: 2;
  }

  .site-nav.open {
    display: flex;
    margin-top: 0.6rem;
    margin-bottom: -0.85rem;
  }

  .site-nav a {
    display: block;
    padding: 1rem 1.5rem;
    margin-left: calc(50% - 50vw);
    width: 100vw;
    border-top: 1px solid var(--line);
  }

  .site-search {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .site-search input {
    width: 100%;
  }

  .admin-nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .admin-nav-links.open {
    display: flex;
  }

  .admin-nav a {
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav .admin-nav-links.open a.active {
    border-bottom: 1px solid var(--line);
  }
}

/* ── Print ───────────────────────────────────────────────── */

@media print {

  .site-header,
  .site-footer,
  .flash-messages,
  .preview-banner,
  .stub-banner,
  .entry-breadcrumb,
  .entry-actions,
  .admin-nav {
    display: none !important
  }

  body {
    font-size: 11pt;
    line-height: 1.6;
    color: #000;
    background: #fff
  }

  .site-main {
    max-width: 100%;
    padding: 0;
    margin: 0
  }

  a {
    color: #1a5fa0
  }

  a[href]::after {
    content: none !important
  }

  * {
    box-shadow: none !important
  }

  .entry-toc {
    border: 1pt solid #ccc;
    background: none;
    float: right;
    margin: 0 0 1rem 2rem
  }

  .entry-meta {
    color: #555;
    font-size: 9pt;
    border-top: 1pt solid #eee;
    padding-top: .5rem;
    margin-top: 1.5rem
  }

  .entry-backlinks {
    border: 1pt solid #ccc;
    background: none;
    margin-top: 1.5rem
  }

  h1,
  h2,
  h3,
  h4 {
    page-break-after: avoid
  }

  p,
  li {
    orphans: 3;
    widows: 3
  }

  .entry-backlinks,
  .entry-footnotes {
    page-break-inside: avoid
  }
}

/* ── Utilities ───────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.entry-breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.entry-breadcrumb li {
  display: flex;
  align-items: center;
}

.entry-breadcrumb li+li::before {
  content: '/';
  margin: 0 0.35em;
  color: var(--ink-3);
}

.pagination ul {
  display: contents;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination li {
  display: contents;
}

.field-hint-mt {
  margin-top: 0.5rem;
}

.mb-0 {
  margin-bottom: 0;
}

/* ── Arrow nav ───────────────────────────────────────────── */

.entry-nav-arrows {
  display: block;
  text-align: center;
  margin-top: 2.5rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-2);
}

.entry-nav-arrows a {
  color: var(--ink-2);
}

.entry-nav-arrows a:hover {
  color: var(--ink);
}

.entry-nav-arrows ul {
  list-style: none;
  padding: 0;
}

.entry-nav-center {
  color: var(--ink-3);
}

/* ── Children section ────────────────────────────────────── */

.entry-children {
  margin-top: 2.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 0;
  border: 1px solid var(--line);
}

.entry-children h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.entry-children ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.entry-children li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.entry-children li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Parent field ────────────────────────────────────────── */

.parent-field-wrap {
  position: relative;
}

.parent-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

.parent-result {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.parent-result:hover,
.parent-result.selected {
  background: var(--surface-2);
}

.parent-result strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.parent-result-summary {
  font-size: 0.75rem;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parent-result-create {
  color: var(--ink-2);
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
}

/* ── Theme picker ────────────────────────────────────────── */

.theme-picker {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s;
  min-width: 70px;
}

.theme-card:hover {
  border-color: var(--ink-3);
}

.theme-card.active {
  border-color: var(--ink-2);
}

.theme-swatches {
  display: flex;
  width: 52px;
  height: 28px;
  overflow: hidden;
}

.theme-swatches span {
  flex: 1;
}

.theme-swatches span+span {
  border-left: 1px solid rgba(0, 0, 0, .15);
}

.theme-name {
  font-size: 0.75rem;
  color: var(--ink-2);
}

/* ── Revision history / diff ─────────────────────────────── */

.revision-row {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}

.revision-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.revision-date {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.revision-author {
  font-size: 0.875rem;
}

.revision-changelog {
  flex: 1;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--ink-2);
}

.char-delta-add {
  color: var(--ok);
  font-size: 0.8125rem;
  font-family: var(--mono);
}

.char-delta-del {
  color: var(--danger);
  font-size: 0.8125rem;
  font-family: var(--mono);
}

.char-delta-neu {
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-family: var(--mono);
}

.revision-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.revision-diff {
  display: none;
  margin-top: 0.75rem;
  overflow-x: auto;
}

.revision-diff.open {
  display: block;
}

.diff-table {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  border-collapse: collapse;
}

.diff-table td {
  padding: 1px 0.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-table td:first-child {
  width: 1.5rem;
  text-align: center;
  user-select: none;
  color: var(--ink-3);
}

.diff-add {
  background: var(--ok-bg);
  color: var(--ok);
}

.diff-del {
  background: var(--danger-bg);
  color: var(--danger);
}

.diff-ctx {
  color: var(--ink-3);
}

.diff-toggle {
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--ink-2);
  background: none;
  border: none;
  padding: 0;
}

.diff-toggle:hover {
  text-decoration: underline;
}

/* ── Section with background accent ────────────────────────────────────── */

.background-accent {
  margin-top: 2.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-radius: 0;
  border: 1px solid var(--line);
}

.background-accent h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.background-accent ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.background-accent li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.background-accent li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.entry-nav-arrows li {
  text-align: center;
}

.entry-nav-arrows li:first-of-type {
  padding-top: 0 !important;
}

.entry-nav-arrows li:last-of-type {
  padding-bottom: 0 !important;
}