/* Truehands docs. One stylesheet, no build step. Colors: navy top bar, blue accent, ink text on white. */
:root {
  --navy: #142433;
  --navy-2: #1c3044;
  --accent: #2563EB;
  --accent-ink: #1d4ed8;
  --accent-soft: #eef3fe;
  --ink: #0f1b2a;
  --ink-2: #2a3a4d;
  --muted: #5b6b7f;
  --line: #e2e8f0;
  --line-2: #d3dbe6;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --code-bg: #0f1b2a;
  --code-ink: #e6edf5;
  --code-muted: #8fa3ba;
  --ok: #0f7b4b; --ok-bg: #e5f5ec;
  --part: #8a5300; --part-bg: #fff3d6;
  --rev: #1d4ed8; --rev-bg: #e8efff;
  --bad: #b42318; --bad-bg: #fdeae7;
  --off: #4a5a6d; --off-bg: #edf1f6;
  --topbar-h: 56px;
  --sidebar-w: 272px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.65 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: rgba(37, 99, 235, .35); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.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; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--bg); color: var(--ink); padding: 8px 12px; border-radius: 6px; box-shadow: 0 2px 10px rgba(15, 27, 42, .2); }
.skip:focus { top: 8px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); background: var(--navy); color: #fff; border-bottom: 1px solid #0b1722; }
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 650; letter-spacing: -.01em; }
.brand .mark { width: 30px; height: 18px; flex: none; }
.brand-name { font-size: 18px; }
.brand-docs { font-size: 13px; font-weight: 500; color: #b9c7d8; padding: 2px 8px; border: 1px solid #33485e; border-radius: 999px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.version { font: 500 12px/1 var(--mono); color: #9fb1c6; padding: 6px 8px; }
.topbar-link, .back { color: #dbe5f0; text-decoration: none; font-size: 14px; font-weight: 500; padding: 7px 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.topbar-link:hover, .back:hover { background: var(--navy-2); color: #fff; }
.back svg { width: 16px; height: 16px; }
.back { border: 1px solid #2e4358; }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.menu-toggle:hover { background: var(--navy-2); }
.menu-toggle svg { width: 22px; height: 22px; }
.menu-toggle .i-close { display: none; }
body.nav-open .menu-toggle .i-open { display: none; }
body.nav-open .menu-toggle .i-close { display: block; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar { position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto; background: var(--bg-soft); border-right: 1px solid var(--line); padding: 22px 14px 28px; display: flex; flex-direction: column; }
.nav-group + .nav-group { margin-top: 20px; }
.nav-title { margin: 0 0 6px; padding: 0 10px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; line-height: 1.4; }
.sidebar li a:hover { background: #e9eef5; color: var(--ink); }
.sidebar li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-foot { margin: auto 0 0; padding: 24px 10px 0; font-size: 13px; color: var(--muted); }
.sidebar-foot a { color: var(--muted); }
.scrim { display: none; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 224px; gap: 56px; padding: 40px 48px 64px; max-width: 1180px; outline: none; }
.doc { min-width: 0; max-width: 800px; }
.toc { position: sticky; top: calc(var(--topbar-h) + 32px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 64px); overflow-y: auto; font-size: 13px; border-left: 1px solid var(--line); padding-left: 14px; }
.toc-title { margin: 0 0 8px; font-weight: 650; color: var(--ink); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover, .toc a.active { color: var(--accent-ink); }
.toc .toc-l3 a { padding-left: 12px; font-size: 12.5px; }

/* ---------- type ---------- */
.crumbs { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-ink); }
.doc h1 { margin: 0 0 14px; font-size: 36px; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; }
.doc h2 { margin: 52px 0 12px; padding-top: 28px; border-top: 1px solid var(--line); font-size: 25px; line-height: 1.25; letter-spacing: -.015em; font-weight: 680; }
.doc h3 { margin: 34px 0 8px; font-size: 19px; line-height: 1.35; letter-spacing: -.01em; font-weight: 650; }
.doc h4 { margin: 26px 0 6px; font-size: 16px; font-weight: 650; }
.doc h1 + p, .doc .lead { font-size: 18.5px; line-height: 1.6; color: var(--ink-2); }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0 6px; }
.doc strong { font-weight: 650; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.anchor { margin-left: 8px; color: var(--line-2); text-decoration: none; font-weight: 500; opacity: 0; transition: opacity .12s; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { color: var(--accent); }
.doc code { font-family: var(--mono); font-size: .86em; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: .08em .36em; color: var(--ink); overflow-wrap: anywhere; }
.doc a code { color: var(--accent-ink); }
.doc h2 code, .doc h3 code { font-size: .9em; }
.source-note { margin-top: -4px; font-size: 13px; color: var(--muted); }
.source-note code { font-size: 12px; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ---------- code blocks ---------- */
.code { margin: 0 0 18px; border-radius: 10px; background: var(--code-bg); overflow: hidden; border: 1px solid #0b1520; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 0 8px 0 14px; border-bottom: 1px solid #1d2d40; background: #13233a; }
.code-lang { font: 500 12px/1 var(--font); color: var(--code-muted); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code pre { margin: 0; padding: 14px 16px; overflow: auto; max-height: 640px; }
.cmd-ref .code pre { max-height: none; }
.code pre:focus-visible { outline-offset: -2px; }
.code code { font: 400 13.5px/1.62 var(--mono); color: var(--code-ink); background: none; border: 0; padding: 0; white-space: pre; overflow-wrap: normal; }
.code .c { color: var(--code-muted); font-style: normal; }
.copy { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid #2c4057; border-radius: 6px; background: transparent; color: #c5d3e2; font: 500 12px/1 var(--font); cursor: pointer; }
.copy:hover { background: #1c3048; color: #fff; }
.copy svg { width: 14px; height: 14px; }
.copy[data-state="done"] { color: #8fe0b6; border-color: #2f6b4f; }

/* ---------- tables ---------- */
.table-wrap { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap:focus-visible { outline-offset: 1px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.doc th { text-align: left; font-weight: 620; color: var(--ink); background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 9px 12px; white-space: nowrap; }
.doc td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.doc tbody tr:first-child td { border-top: 0; }
.doc td.t-right, .doc th.t-right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc td.t-center, .doc th.t-center { text-align: center; }
.doc td code { font-size: 12.5px; white-space: nowrap; overflow-wrap: normal; }
.doc td:first-child { white-space: normal; }
table.args td:first-child, table.endpoints td:nth-child(2) { min-width: 210px; }
table.args td:nth-child(2) { white-space: nowrap; }
table.reasons td:first-child { width: 31%; min-width: 190px; }
table.reasons td:nth-child(2) { width: 24%; min-width: 150px; }
table.reasons td:last-child { min-width: 240px; }
table.reasons .pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
table.reasons td:nth-child(2) > .sub { margin-top: 8px; }
table.reasons .stage { margin-top: 8px; }
table.reasons tr:target td { background: #fffbe8; }
.stage { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }

.pill { display: inline-block; font: 600 12px/1 var(--font); padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.pill-accept { color: var(--ok); background: var(--ok-bg); }
.pill-partial { color: var(--part); background: var(--part-bg); }
.pill-review { color: var(--rev); background: var(--rev-bg); }
.pill-reject { color: var(--bad); background: var(--bad-bg); }
.pill-ignore { color: var(--off); background: var(--off-bg); }
.tag-locked { display: inline-block; margin-left: 6px; font: 600 11px/1 var(--font); color: var(--muted); border: 1px solid var(--line-2); padding: 3px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em; }
.method { display: inline-block; min-width: 56px; text-align: center; font: 600 11.5px/1 var(--mono); padding: 5px 6px; border-radius: 5px; }
.method-get { color: var(--ok); background: var(--ok-bg); }
.method-post { color: var(--rev); background: var(--rev-bg); }
.method-put, .method-patch { color: var(--part); background: var(--part-bg); }
.method-delete { color: var(--bad); background: var(--bad-bg); }
table.endpoints td a { text-decoration: none; }
table.endpoints td:first-child { width: 72px; }

/* ---------- callouts ---------- */
.callout { margin: 0 0 18px; padding: 12px 16px 2px; border: 1px solid #cfdcfb; border-left: 3px solid var(--accent); border-radius: 8px; background: #f5f8ff; }
.callout-title { margin: 0 0 4px !important; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); }
.callout-warning { border-color: #f3d39b; border-left-color: #c27803; background: #fffaf0; }
.callout-warning .callout-title { color: #8a5300; }
.callout-draft { border-color: #f3d39b; border-left-color: #c27803; background: #fffaf0; }
.callout-draft .callout-title { color: #8a5300; }
.callout-tip { border-color: #bfe5cf; border-left-color: var(--ok); background: #f3fbf6; }
.callout-tip .callout-title { color: var(--ok); }
.callout p:last-child { margin-bottom: 10px; }

/* ---------- index page ---------- */
.hero { margin: 4px 0 28px; }
.hero .eyebrow { display: inline-block; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 28px; }
.card { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: #b8c8ee; box-shadow: 0 4px 14px rgba(15, 27, 42, .06); }
.card strong { display: block; margin-bottom: 4px; font-size: 16px; color: var(--ink); }
.card span { display: block; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.card .go { color: var(--accent-ink); font-weight: 600; font-size: 14px; margin-top: 8px; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 22px; padding: 0; list-style: none; }
.flow li { margin: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); font-size: 14px; font-weight: 550; }
.flow li.arrow { border: 0; background: none; padding: 0 2px; color: var(--muted); font-weight: 400; }
.status-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.status-row .box { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-soft); }
.status-row .box h3 { margin: 0 0 4px; font-size: 17px; }
.status-row .box p { margin: 0 0 6px; font-size: 15px; color: var(--ink-2); }
.badge { display: inline-block; font: 600 11.5px/1 var(--font); padding: 4px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-pilot { color: var(--part); background: var(--part-bg); }

/* ---------- CLI reference ---------- */
.cmd-ref { margin: 0 0 8px; padding-top: 4px; }
.cmd-ref h3 { margin-top: 30px; }
.cmd-ref .lede { color: var(--ink-2); }
.exits { font-size: 14.5px; color: var(--ink-2); }
h4.cmd { margin-top: 22px; }

/* ---------- prev / next, footer ---------- */
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.pn { display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.pn span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.pn:hover { border-color: #b8c8ee; }
.pn-next { text-align: right; grid-column: 2; }
.footer { border-top: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); font-size: 14px; }
.footer-inner { padding: 22px 48px; display: flex; flex-wrap: wrap; gap: 6px 28px; justify-content: space-between; margin-left: var(--sidebar-w); }
.footer p { margin: 0; }
.brand-small { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ink); margin-right: 6px; }
.brand-small .mark { width: 20px; height: 12px; }
.footer a { color: var(--muted); }

/* ---------- API reference page ---------- */
.page-api-reference .menu-toggle { display: inline-flex; }
.sidebar-overlay { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 45; width: min(320px, 86vw); height: auto; transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 10px 30px rgba(15, 27, 42, .18); }
body.nav-open .sidebar-overlay { transform: none; }
.ref-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.ref-bar p { margin: 0; font-size: 13.5px; }
.ref-bar a { color: var(--accent-ink); }
.ref-main { outline: none; }
.ref-fallback { max-width: 760px; margin: 0 auto; padding: 48px 20px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .main { grid-template-columns: minmax(0, 1fr); padding: 36px 40px 56px; }
  .toc { display: none; }
}
@media (max-width: 960px) {
  .menu-toggle { display: inline-flex; }
  .shell { display: block; }
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 45; width: min(320px, 86vw); height: auto; transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 10px 30px rgba(15, 27, 42, .18); visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .main { padding: 28px 24px 48px; }
  .footer-inner { margin-left: 0; padding: 20px 24px; }
  .version { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .sidebar-overlay { transition: none; } }
.page-api-reference .sidebar-overlay { visibility: hidden; }
body.nav-open.page-api-reference .sidebar-overlay { visibility: visible; }
body.nav-open .scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 40; background: rgba(15, 27, 42, .38); }
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .topbar-inner { padding: 0 12px 0 16px; gap: 8px; }
  .topbar-link { display: none; }
  .back { padding: 7px 9px; }
  .brand-docs { display: none; }
  .main { padding: 22px 16px 40px; }
  .doc h1 { font-size: 29px; }
  .doc h2 { font-size: 22px; margin-top: 40px; padding-top: 22px; }
  .doc h3 { font-size: 17.5px; }
  .doc h1 + p, .doc .lead { font-size: 17px; }
  .cards, .status-row { grid-template-columns: minmax(0, 1fr); }
  .prev-next { grid-template-columns: minmax(0, 1fr); }
  .pn-next { grid-column: 1; }
  .code code { font-size: 12.5px; }
  .code pre { padding: 12px 14px; }
  .doc table { font-size: 14px; }
  .footer-inner { padding: 18px 16px; }
}
@media (max-width: 380px) {
  .back span { display: none; }
  .back { padding: 7px; }
}
@media print {
  .topbar, .sidebar, .toc, .prev-next, .footer, .copy { display: none !important; }
  .shell, .main { display: block; padding: 0; }
  .code { border: 1px solid #ccc; background: #fff; }
  .code code { color: #000; }
}

/* ---------- details ---------- */
.doc details { margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.doc details > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 15px; color: var(--ink-2); list-style-position: inside; }
.doc details > summary:hover { color: var(--accent-ink); }
.doc details[open] > summary { border-bottom: 1px solid var(--line); }
.doc details .table-wrap { margin: 0; border: 0; border-radius: 0 0 10px 10px; }

/* ---------- stacked tables on narrow screens ---------- */
@media (max-width: 720px) {
  table.reasons thead, table.args thead, table.endpoints thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.reasons, table.reasons tbody, table.reasons tr, table.reasons td,
  table.args, table.args tbody, table.args tr, table.args td,
  table.endpoints, table.endpoints tbody, table.endpoints tr, table.endpoints td { display: block; width: auto !important; min-width: 0 !important; }
  table.reasons tr, table.args tr, table.endpoints tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  table.reasons tr:first-child, table.args tr:first-child, table.endpoints tr:first-child { border-top: 0; }
  table.reasons td, table.args td, table.endpoints td { padding: 0; border: 0; }
  table.reasons td + td, table.args td + td { margin-top: 8px; }
  table.reasons td:nth-child(2) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  table.reasons td:nth-child(2) > .sub { margin: 0; }
  table.reasons .pills { margin: 0; }
  table.args td:nth-child(2):empty { display: none; }
  table.args td:nth-child(2):not(:empty)::before { content: "Default "; color: var(--muted); font-size: 13px; }
  table.args td:first-child code { white-space: normal; overflow-wrap: anywhere; }
  table.endpoints td:first-child, table.endpoints td:nth-child(2) { display: inline-block; vertical-align: middle; margin-right: 6px; }
  table.endpoints td:nth-child(2) code { white-space: normal; overflow-wrap: anywhere; }
  table.endpoints td:last-child { margin-top: 6px; color: var(--ink-2); }
  .doc td code { white-space: normal; overflow-wrap: anywhere; }
}
