:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --fg: #1b1f24;
  --muted: #5d6673;
  --border: #e2e5ea;
  --accent: #1f4fd1;
  --accent-soft: #e8eefc;
  --danger: #b42318;
  --mark: #fff1a8;
  --note: #1f4fd1;
  --tip: #1a7f37;
  --important: #8250df;
  --warning: #9a6700;
  --caution: #cf222e;
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --bg-soft: #181c22;
    --fg: #e6e8eb;
    --muted: #9aa3ae;
    --border: #2a3039;
    --accent: #7ea2ff;
    --accent-soft: #1d2740;
    --danger: #ff7b72;
    --mark: #5a4b00;
    --note: #7ea2ff;
    --tip: #56d364;
    --important: #c297ff;
    --warning: #e3b341;
    --caution: #ff7b72;
  }
}
@font-face { font-family: "Lato"; font-style: normal; font-weight: 300; font-display: swap; src: url("/fonts/lato-latin-300.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/lato-latin-700.woff2") format("woff2"); }
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--bg); padding: 8px; }
.muted { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--fg); text-decoration: none; white-space: nowrap; }
/* Same wordmark as the Agnos sidebar: Lato, uppercase, light with a bold "A". */
.wordmark { font-family: "Lato", var(--font); font-weight: 300; text-transform: uppercase; font-size: 24px; line-height: 1; letter-spacing: .01em; }
.wordmark strong { font-weight: 700; }
.brand-sub { font-size: 15px; font-weight: 500; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--border); line-height: 1.2; }
.search { flex: 1; max-width: 520px; display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); color: var(--fg); font: inherit; }
.search.big { max-width: none; margin: 16px 0 24px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; }
.top-actions form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.sidebar { position: sticky; top: 57px; align-self: start; max-height: calc(100vh - 57px); overflow-y: auto; padding: 20px 12px 40px 20px; border-right: 1px solid var(--border); font-size: 14px; }
.sidebar ul { list-style: none; margin: 0 0 8px; padding: 0; }
.nav-section summary { cursor: pointer; padding: 6px 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.nav-link { display: block; padding: 5px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.nav-link:hover { background: var(--bg-soft); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { padding: 28px 40px 60px; min-width: 0; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; }
article { max-width: 780px; }
.shell.wide article { max-width: none; }
.toc { position: sticky; top: 85px; align-self: start; font-size: 13px; }
.toc-title { font-weight: 600; margin: 0 0 8px; }
.toc ul { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 3px 10px; color: var(--muted); text-decoration: none; }
.toc li a:hover { color: var(--accent); }
.toc .toc-h3 a { padding-left: 22px; }

h1 { font-size: 32px; line-height: 1.2; margin: 4px 0 8px; }
.lead { font-size: 18px; color: var(--muted); margin-top: 0; }
.page-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.crumb { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.editor-actions { display: flex; gap: 8px; }
.updated { font-size: 13px; margin-top: 32px; }

.prose h2 { font-size: 23px; margin: 36px 0 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.prose h3 { font-size: 18px; margin: 26px 0 8px; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.prose pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }
.prose img { display: block; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.prose blockquote { margin: 16px 0; padding: 4px 16px; border-left: 4px solid var(--border); color: var(--muted); }
.prose kbd { font-family: var(--mono); font-size: .85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; }

.callout { color: var(--fg) !important; background: var(--bg-soft); border-left-color: var(--note) !important; border-radius: 0 var(--radius) var(--radius) 0; }
.callout::before { content: attr(data-label); display: block; font-weight: 650; margin-top: 8px; color: var(--note); }
.callout-tip { border-left-color: var(--tip) !important; } .callout-tip::before { color: var(--tip); }
.callout-important { border-left-color: var(--important) !important; } .callout-important::before { color: var(--important); }
.callout-warning { border-left-color: var(--warning) !important; } .callout-warning::before { color: var(--warning); }
.callout-caution { border-left-color: var(--caution) !important; } .callout-caution::before { color: var(--caution); }

.help-box { margin-top: 40px; padding: 20px 24px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.help-box h2 { margin: 0 0 8px; font-size: 18px; border: 0; padding: 0; }
.help-box ol { margin: 0; padding-left: 20px; }
.help-box li { margin: 6px 0; }

.results { list-style: none; padding: 0; }
.results li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.results a { font-weight: 600; font-size: 17px; }
.snippet { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; }

.button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button.small { padding: 4px 12px; font-size: 14px; }
.button.ghost { background: transparent; color: var(--accent); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.error { color: var(--danger); font-weight: 600; }
.notice { padding: 12px 16px; border: 1px solid var(--border); background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 16px; }
.notice form { display: flex; gap: 8px; }

.editor form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.fields .span-all { grid-column: 1 / -1; }
.editor label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.editor input:not([type=checkbox]), .editor textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg); }
.editor textarea { font-family: var(--mono); font-size: 14px; line-height: 1.5; min-height: 480px; resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.upload { cursor: pointer; }
.preview { min-height: 480px; padding: 8px 4px; }
.actions { display: flex; gap: 8px; }
.danger-zone { margin-top: 48px; padding: 16px; border: 1px solid var(--danger); border-radius: var(--radius); flex-direction: column; gap: 8px; }
.danger-zone .confirm { flex-direction: row; align-items: center; font-weight: 400; }

.footer { border-top: 1px solid var(--border); padding: 24px 20px; text-align: center; font-size: 14px; }
.footer p { margin: 4px 0; }

@media (max-width: 1080px) { .content-grid { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  main { padding: 20px 16px 48px; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  h1 { font-size: 26px; }
}

.editors section { margin-top: 28px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.inline-form input, .editors select { font: inherit; font-weight: 400; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg); }
.inline-form input { min-width: 280px; }
.row-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.editors td { vertical-align: middle; }
