:root { --text: #1f2430; --dim: #6b7080; --line: #e5e7eb; --soft: #f6f7f9; --accent: #e8590c; --accent-soft: #fff4e6; --code: #f1f3f5; --ok: #2f9e44; --bad: #e03131; }
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--text); background: #fff; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, textarea.json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: #1e2230; color: #e6e8ee; padding: 14px 16px; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; color: inherit; }

.top { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; display: block; }
.muted { color: var(--dim); font-weight: 500; }
.top-links { display: flex; gap: 20px; font-size: 14px; }
.top-links a { color: var(--dim); }

.wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr) 220px; gap: 40px; max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.side, .toc { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 28px 0; }
.nav-group { margin-bottom: 20px; }
.nav-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 0 0 6px 10px; }
.side a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--text); font-size: 14px; }
.side a:hover { background: var(--soft); text-decoration: none; }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc a { display: block; color: var(--dim); font-size: 13px; padding: 3px 0 3px 10px; border-left: 1px solid var(--line); }
.toc a.l3 { padding-left: 22px; }
.toc a:hover { color: var(--text); text-decoration: none; }

main { padding: 28px 0 80px; min-width: 0; }
main.wide { grid-column: 2 / 4; }
h1 { font-size: 32px; line-height: 1.2; margin: 8px 0 18px; letter-spacing: -.01em; }
h2 { font-size: 22px; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
h3 { font-size: 17px; margin: 28px 0 8px; }
h2 a.anchor, h3 a.anchor, h4 a.anchor { color: inherit; }
.lead { font-size: 16px; color: var(--dim); }
.table { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { background: var(--soft); font-weight: 600; }
blockquote { margin: 14px 0; padding: 4px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; }
li { margin: 3px 0; }
li.task { list-style: none; margin-left: -20px; }
.check { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--dim); border-radius: 3px; margin-right: 8px; vertical-align: -2px; }
.pager { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-weight: 500; }

/* Manifest generator */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 20px; }
.gen-form { min-width: 0; }
.gen-out { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.gen-out pre { margin: 0; max-height: calc(100vh - 230px); overflow: auto; font-size: 12.5px; }
.status { padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.status.ok { background: #ebfbee; color: var(--ok); }
.status.bad { background: #fff5f5; color: var(--bad); }
.status.wait { background: var(--soft); color: var(--dim); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 16px 14px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; }
.hint { color: var(--dim); font-size: 13px; margin: 2px 0 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0; }
.row > label { flex: 1 1 160px; }
label { display: block; font-size: 13px; font-weight: 500; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; flex: 0 0 auto; }
input[type=text], input[type=number], select, textarea { width: 100%; margin-top: 3px; padding: 6px 9px; border: 1px solid #ced4da; border-radius: 6px; font: inherit; font-size: 14px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffd8a8; border-color: var(--accent); }
textarea.json { min-height: 140px; }
button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 6px; border: 1px solid #ced4da; background: #fff; color: var(--text); cursor: pointer; }
button:hover { background: var(--soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #d9480f; }
button.x { padding: 4px 9px; color: var(--dim); }
button.add { margin-top: 4px; }
.item { border: 1px dashed var(--line); border-radius: 8px; padding: 4px 12px 10px; margin: 10px 0; background: #fcfcfd; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-weight: 600; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1100px) { .wrap { grid-template-columns: 220px minmax(0, 1fr); } .toc { display: none; } main.wide { grid-column: 2; } .gen { grid-template-columns: 1fr; } .gen-out { position: static; } }
@media (max-width: 760px) { .wrap { grid-template-columns: 1fr; } .side { position: static; max-height: none; padding-bottom: 0; } main.wide { grid-column: 1; } .top-links a:last-child { display: none; } }

/* Code highlighting (Shiki, rendered at build time with both themes as CSS variables). Code blocks are always dark. */
pre.shiki { background: #1e2230 !important; }
pre.shiki span { color: var(--shiki-dark); font-style: var(--shiki-dark-font-style); font-weight: var(--shiki-dark-font-weight); }
pre[data-lang]:not([data-lang="text"]) { position: relative; }
pre[data-lang]:not([data-lang="text"])::before { content: attr(data-lang); position: absolute; top: 6px; right: 10px; font-size: 11px; color: #8b92a5; text-transform: uppercase; letter-spacing: .04em; }

/* Mermaid diagrams (pele SVG, rendered at build time). */
figure.diagram { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow-x: auto; text-align: center; }
figure.diagram svg { max-width: 100%; height: auto; }
.pele { --pele-bg: #fff; --pele-fg: var(--text); --pele-muted: var(--dim); --pele-line: #8b92a5; --pele-surface: var(--soft); --pele-surface-alt: #eef0f3; --pele-border: #d0d4db; --pele-accent: var(--accent); --pele-font: inherit; --pele-radius: 6px; }
