@import url("theme.css");

:root {
  --bg: var(--folio-bg);
  --surface: var(--folio-surface);
  --raised: var(--folio-raised);
  --border: var(--folio-border);
  --border-strong: var(--folio-border-strong);
  --text: var(--folio-text);
  --muted: var(--folio-muted);
  --faint: var(--folio-faint);
  --accent: var(--folio-accent);
  --doc-link: var(--folio-doc-link);
  --accent-text: var(--folio-accent-text);
  --mark: var(--folio-mark);
  --gold: var(--folio-gold);
  --gold-soft: var(--folio-gold-soft);
  --radius: var(--folio-radius);
  --font: var(--folio-font);
  --mono: var(--folio-mono);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
code { font-family: var(--mono); font-size: .88em; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.warn { color: var(--accent); }

/* header */
.top { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1040px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 22px; }
.brand { font-weight: 650; font-size: 17px; text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.brand .mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); display: inline-block; transform: rotate(8deg); }
.top nav { display: flex; gap: 16px; }
.top nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
.top nav a:hover { color: var(--text); }
.search { margin-left: auto; }
.search input, .search-big input, .search-big select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid transparent; border-radius: 8px; padding: 6px 12px; width: 240px; outline: none;
}
.search input:focus, .search-big input:focus { border-color: var(--border-strong); background: var(--raised); }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; }
.icon-btn:hover { color: var(--text); background: var(--surface); }

/* page sections */
.page-head { padding: 36px 0 18px; }
.page-head .lede, .doc-head .lede { color: var(--muted); margin: 8px 0 0; max-width: 70ch; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.section { margin: 28px 0 8px; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 8px; }
.label a { text-decoration: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 3px 0; }
.plain a { text-decoration: none; }
.count { color: var(--faint); font-size: 12px; margin-left: 4px; }
.empty { color: var(--muted); padding: 18px 0; list-style: none; }
.filter { color: var(--muted); font-size: 14px; }
.hash { color: var(--faint); font-weight: 400; margin-right: 2px; }

/* rows */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 550; text-decoration: none; }
.row-desc, .snippet { color: var(--muted); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.snippet mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.row-meta .crumb { text-decoration: none; color: var(--faint); }
.row-time { color: var(--faint); font-size: 13px; white-space: nowrap; padding-top: 1px; }
.sha { color: var(--accent); padding-top: 2px; }

/* golden record: pinned first in its project, starred everywhere */
.golden-star { color: var(--gold); margin-right: 6px; font-size: 1.05em; line-height: 1; }
h1 .golden-star { margin-right: 10px; }
.pinned .rows { border-top: 0; }
.pinned .row.golden { background: var(--gold-soft); border-bottom: 0; border-radius: var(--radius); padding: 11px 12px; }
.pin-sep { border: 0; border-top: 1px solid var(--border-strong); margin: 14px 0; }

/* topics inside a project (decision 0012): a card per topic, leaves indented under its title,
   subtopics as labelled bands with a guide line */
.topics-bar { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 0 8px; }
.topics-bar .label { margin: 0; }
.topics-bar .link-btn { font-size: 13px; }
.topics { display: flex; flex-direction: column; gap: 8px; }
.topic { border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised); scroll-margin-top: 72px; }
.topic > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius);
}
.topic > summary::-webkit-details-marker { display: none; }
.topic > summary::marker { content: ""; }
.topic > summary:hover { background: var(--surface); }
.topic > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.topic > summary .chev { color: var(--faint); transition: transform .15s; }
.topic[open] > summary .chev { transform: rotate(90deg); }
.topic[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.topic-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.topic-title { font-weight: 600; font-size: 15.5px; }
.topic-count {
  font-size: 12px; color: var(--muted); background: var(--border); border-radius: 999px;
  padding: 0 8px; font-variant-numeric: tabular-nums;
}
.topic-subs { color: var(--faint); font-size: 12.5px; }
.topic-subs span::before { content: "› "; }
.topic-subs span + span { margin-left: 8px; }
.topic-time { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.topic-desc { grid-column: 2; color: var(--muted); font-size: 13.5px; line-height: 1.45; margin-top: 1px; }
.topic-body { padding: 2px 0; }
.leaves { list-style: none; margin: 0; padding: 0; }
.leaf { display: flex; align-items: flex-start; gap: 10px; padding: 7px 14px 7px 38px; }
.leaf + .leaf { border-top: 1px solid var(--border); }
.leaf .badge { width: 34px; padding: 4px 0; font-size: 9.5px; margin-top: 2px; }
.leaf-main { flex: 1; min-width: 0; }
.leaf-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; }
.leaf-title { font-weight: 550; font-size: 14.5px; text-decoration: none; }
.leaf .tag { font-size: 11px; padding: 0 7px; background: var(--border); }
.leaf-desc {
  color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 1px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.leaf .row-time { font-size: 12px; padding-top: 2px; }
.topic.sub { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.topic.sub > summary { padding: 8px 14px 8px 38px; border-radius: 0; }
.topic.sub[open] > summary { border-bottom: 0; }
.topic.sub .topic-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.topic.sub .leaves { margin: 0 0 6px 44px; border-left: 2px solid var(--border); }
.topic.sub .leaf { padding-left: 16px; }
.topic.sub .topic-desc { font-size: 13px; }
.topic.unsorted { border-style: dashed; background: transparent; }

.badge {
  font: 600 10px/1 var(--font); letter-spacing: .04em; padding: 5px 0; width: 38px; text-align: center;
  border-radius: 5px; background: var(--surface); color: var(--muted); flex: none; margin-top: 2px;
}
.badge.t-html { color: #b05730; } .badge.t-markdown { color: #5b6b3a; } .badge.t-image { color: #7a5aa6; } .badge.t-pdf { color: #a6463f; }
:root[data-theme=dark] .badge { filter: brightness(1.5); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .badge { filter: brightness(1.5); } }

.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag {
  font-size: 12px; text-decoration: none; color: var(--muted); background: var(--surface);
  border-radius: 999px; padding: 1px 9px; white-space: nowrap;
}
a.tag:hover { color: var(--accent); }
.cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.cloud .tag { font-size: 13px; padding: 3px 11px; }
.cloud .tag span { color: var(--faint); margin-left: 3px; }

/* cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--raised); }
.card-title { font-weight: 600; text-decoration: none; }
.card .row-desc { margin: 4px 0 0; }

/* buttons */
.btn, .link-btn, .search-big button {
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block;
  border: 1px solid var(--border-strong); background: var(--raised); color: var(--text); border-radius: 8px; padding: 5px 12px;
}
.btn:hover, .search-big button:hover { border-color: var(--faint); color: var(--text); }
.btn.primary, .search-big button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover, .search-big button:hover { filter: brightness(1.06); color: var(--accent-text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent); }
.btn.copied, .link-btn.copied { color: #4a7a3a; }
.btn.primary.copied { background: #5a8a4a; border-color: #5a8a4a; color: #fff; }

.search-big { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.search-big input { width: min(460px, 100%); padding: 8px 14px; font-size: 15px; }
.search-big select { width: auto; padding: 8px 10px; }

/* menu */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 20;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(20, 20, 19, .10); padding: 6px; display: flex; flex-direction: column;
}
.menu-list a, .menu-list button {
  font: inherit; font-size: 14px; text-align: left; background: none; border: 0; color: var(--text);
  padding: 7px 10px; border-radius: 6px; text-decoration: none; cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface); color: var(--text); }
.menu-list code { color: var(--muted); }

/* document page */
.doc-head { padding-top: 28px; padding-bottom: 16px; }
.doc-title-row { display: flex; align-items: flex-start; gap: 16px; }
.doc-title-row h1 { flex: 1; }
.actions { display: flex; gap: 8px; align-items: center; flex: none; }
.banner { background: var(--surface); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 14px 0 0; }
.files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 16px; }
.files a { font-size: 13px; font-family: var(--mono); text-decoration: none; padding: 3px 9px; border-radius: 6px; color: var(--muted); }
.files a:hover { background: var(--surface); color: var(--text); }
.files a.on { background: var(--surface); color: var(--text); }
.viewer { border-top: 1px solid var(--border); }
.wrap-prose { max-width: 760px; margin: 0 auto; padding: 28px 24px 72px; }

/* contents: sticky in the left column on wide screens, a floating pill on narrow ones */
.viewer.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr); }
.has-toc > .toc { grid-column: 1; grid-row: 1; }
.has-toc > .prose { grid-column: 2; grid-row: 1; width: 100%; }
.toc {
  position: sticky; top: 72px; align-self: start; justify-self: end;
  width: min(300px, 100%); max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
  margin-top: 30px; padding: 0 8px 24px 24px; font-size: 13.5px; line-height: 1.4; scrollbar-width: none;
}
.toc summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 3px 0 3px 12px;
  user-select: none; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::marker { content: ""; }
.toc summary:hover { color: var(--text); }
.toc summary svg { flex: none; transition: transform .15s; }
.toc[open] summary svg { transform: rotate(90deg); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc > nav > ul { margin-top: 8px; }
.toc a {
  display: flex; gap: .45em; padding: 4px 0 4px 10px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; text-wrap: pretty; overflow-wrap: anywhere; transition: color .12s;
}
.toc a .n { flex: none; min-width: 1.2em; color: color-mix(in srgb, var(--accent) 65%, var(--faint)); font-variant-numeric: tabular-nums; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); border-left-color: var(--accent); }
.toc a.on .n { color: var(--accent); }
/* deeper levels: smaller, fainter, indented under a hairline guide */
.toc li ul { margin: 1px 0 5px 12px; border-left: 1px solid var(--border); }
.toc li li a { margin-left: -1px; padding: 3px 0 3px 11px; font-size: 12.5px; color: var(--faint); }
.toc li li a:hover, .toc li li a.on { color: var(--text); }
@media (max-width: 1279px) {
  .viewer.has-toc { display: block; }
  .toc {
    position: fixed; left: 16px; bottom: 16px; top: auto; z-index: 20; margin: 0; padding: 0;
    width: auto; max-height: none; overflow: visible;
  }
  .toc summary {
    padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted);
    background: var(--raised); box-shadow: 0 2px 10px rgba(0,0,0,.08);
  }
  .toc[open] summary { color: var(--text); }
  .toc[open] summary svg { transform: rotate(-90deg); }
  .toc nav {
    position: absolute; left: 0; bottom: calc(100% + 8px); width: min(340px, calc(100vw - 32px));
    max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px 10px 6px;
    background: var(--raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
  }
  .toc > nav > ul { margin-top: 0; }
}
/* backlinks: a count beside the tags, and the linking documents under the document */
.linked-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.linked-chip svg { flex: none; }
.backlinks {
  width: 100%; max-width: 1040px; margin: 0 auto; padding: 26px 24px 30px; scroll-margin-top: 64px;
  border-top: 1px solid var(--border);
}
.mode-prose .backlinks { max-width: 760px; padding-bottom: 0; }
.mode-prose .viewer:has(+ .backlinks) .wrap-prose { padding-bottom: 44px; }
.backlinks .label { margin-bottom: 10px; }
.backlinks .rows { border-top: 0; }
.backlinks .row:last-child { border-bottom: 0; }
.mention {
  display: block; margin-top: 5px; padding-left: 10px; border-left: 2px solid var(--border);
  color: var(--muted); font-size: 14px; text-decoration: none; overflow-wrap: anywhere;
}
.mention:hover { color: var(--text); border-left-color: var(--accent); }
.mention-sec { display: block; font-size: 12px; color: var(--faint); }
.mention mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.mention-more { color: var(--faint); font-size: 13px; margin-top: 5px; }
/* comments (decision 0010): a sidebar on wide screens, a bottom sheet on narrow ones */
:root { --c-w: 380px; --c-progress: #b8860b; --c-done: #4a7a3a; }
.c-count { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.c-badge {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 650; line-height: 17px; text-align: center;
}
.c-badge[hidden] { display: none; }
.c-toggle[aria-expanded=true] { background: var(--surface); }
.c-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; align-items: center; padding: 8px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--raised); color: var(--muted);
  box-shadow: 0 2px 10px rgba(0,0,0,.08); cursor: pointer;
}
.c-fab:hover { color: var(--text); }
.c-fab .c-badge { margin-left: 5px; }
body.c-open .c-fab { display: none; }
.c-panel { position: fixed; z-index: 30; background: var(--bg); display: flex; flex-direction: column; font-size: 14px; }
.c-panel[hidden] { display: none; }
@media (min-width: 1100px) {
  .c-panel { top: var(--c-top, 57px); right: 0; bottom: 0; width: var(--c-w); border-left: 1px solid var(--border); }
  body.c-open main, body.c-open .foot { margin-right: var(--c-w); }
}
@media (max-width: 1099px) {
  .c-panel {
    left: 0; right: 0; bottom: 0; max-height: 78vh; border-top: 1px solid var(--border-strong);
    border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.16);
  }
}
.c-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px 16px; }
.c-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.c-tabs { display: flex; gap: 2px; background: var(--surface); border-radius: 8px; padding: 2px; }
.c-tabs button { font: inherit; font-size: 12.5px; border: 0; background: none; color: var(--muted); padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.c-tabs button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.c-tabs .n { color: var(--faint); margin-left: 2px; }
.c-grow { flex: 1; }
.c-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 2px 16px 10px; border-bottom: 1px solid var(--border); }
.c-tools .btn, .c-row .btn { font-size: 12.5px; padding: 4px 10px; }
.c-pinbtn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.c-hint { color: var(--faint); font-size: 12.5px; }
.c-err { margin: 8px 16px 0; padding: 7px 10px; border-radius: 8px; background: var(--mark); font-size: 13px; }
.c-composer { padding: 12px 16px 0; }
.c-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 28px; display: flex; flex-direction: column; gap: 10px; }
.c-empty { color: var(--muted); font-size: 13.5px; margin: 4px 0; }
.c-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised); padding: 10px 12px; scroll-margin: 12px; }
.c-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.c-card.collapsed { cursor: pointer; opacity: .78; }
.c-card.collapsed:hover { opacity: 1; }
.c-card-head { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); min-width: 0; }
.c-num {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px 11px 11px 3px; border: 0;
  background: var(--accent); color: #fff; font: 650 11.5px/1 var(--font); cursor: pointer;
}
.c-num.s-in_progress { background: var(--c-progress); } .c-num.s-resolved { background: var(--c-done); } .c-num.s-closed { background: var(--faint); }
.c-status { font-weight: 600; white-space: nowrap; }
.c-status.s-new { color: var(--accent); } .c-status.s-in_progress { color: var(--c-progress); }
.c-status.s-resolved { color: var(--c-done); } .c-status.s-closed { color: var(--faint); }
.c-wait { background: var(--mark); color: var(--text); border-radius: 999px; padding: 0 7px; font-size: 11.5px; white-space: nowrap; }
.c-sec { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.c-quote {
  margin: 8px 0 2px; padding: 1px 0 1px 10px; border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.c-where { margin: 8px 0 2px; color: var(--faint); font-size: 12.5px; font-style: italic; overflow-wrap: anywhere; }
.c-note { display: block; font-size: 12px; color: var(--faint); margin-top: 4px; }
.c-note.warn { color: var(--accent); }
.c-msgs { margin-top: 9px; display: flex; flex-direction: column; gap: 9px; }
.c-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.c-role {
  font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
}
.c-msg.r-agent { padding-left: 10px; border-left: 2px solid var(--border-strong); }
.c-body { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.c-body p { margin: 3px 0; }
.c-body code { background: var(--surface); padding: 0 4px; border-radius: 4px; }
.c-body pre { background: var(--surface); padding: 8px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; }
.c-body ul, .c-body ol { margin: 3px 0; padding-left: 20px; }
.c-msg-tools { margin-left: auto; display: none; gap: 8px; }
.c-msg:hover .c-msg-tools, .c-msg:focus-within .c-msg-tools { display: flex; }
.c-msg-tools .link-btn { font-size: 12px; }
.c-event { font-size: 12.5px; color: var(--muted); }
.c-set { font-size: 12px; font-weight: 600; margin-top: 2px; }
.c-set.s-resolved { color: var(--c-done); } .c-set.s-closed { color: var(--faint); }
.c-set.s-in_progress { color: var(--c-progress); } .c-set.s-new { color: var(--accent); }
.c-fix { font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.c-reply, .c-edit { margin-top: 10px; }
/* who is answering (decision 0011) */
.c-role.run { color: var(--c-progress); border-color: color-mix(in srgb, var(--c-progress) 40%, transparent); }
.c-handling { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.c-handling.warn { color: var(--accent); }
.c-handling { flex-wrap: nowrap; align-items: baseline; }
.c-handling .c-dot { align-self: center; }
.c-handling-text { flex: 1 1 auto; min-width: 0; }
.c-handling .c-ask { flex: none; align-self: flex-end; }
.c-handling:has(.c-ask) { flex-wrap: wrap; }
.c-handling:has(.c-ask) .c-handling-text { flex-basis: calc(100% - 20px); }
.c-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.c-handling.live .c-dot, .c-dot.s-listening { background: var(--c-done); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-done) 22%, transparent); }
.c-dot.s-resumable { background: var(--c-done); opacity: .55; }
.c-dot.s-cache-cold { background: var(--accent); opacity: .45; }
.c-handling .c-who-hint { flex-basis: 100%; }            /* the cost of a resume picked under "Try again with" */
.c-handling.live .c-dot { animation: c-pulse 1.6s ease-in-out infinite; }
.c-handling.warn .c-dot { background: var(--accent); }
@keyframes c-pulse { 50% { opacity: .35; } }
.c-ask { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.c-ask .link-btn { font-size: 12.5px; }
.c-model { font: inherit; font-size: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 4px; }
.c-who { margin-top: 7px; }
.c-who[hidden] { display: none; }
.c-who-row { margin-top: 0; gap: 7px; font-size: 12.5px; color: var(--muted); }
.c-who-row .c-model { flex: 1; min-width: 0; font-size: 12.5px; padding: 3px 6px; }
.c-who-hint { margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--faint); }
.c-who-hint.warn { color: var(--accent); }
.c-owners { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.c-owners[hidden] { display: none; }
.c-owner { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.c-owner .link-btn { font-size: 12px; }
.c-panel textarea {
  display: block; width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 9px; resize: vertical; min-height: 34px;
}
.c-panel textarea:focus { outline: none; border-color: var(--accent); }
.c-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.c-name { font: inherit; font-size: 12.5px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; width: 130px; }
.c-menu .menu-list { top: auto; bottom: calc(100% + 6px); right: 0; min-width: 200px; }
.c-menu summary.btn { padding: 4px 9px; }
.code-view { padding-top: 18px; padding-bottom: 48px; }
.code-view .hl { font-size: 13px; overflow-x: auto; }
.code-view .hltable { width: 100%; border-collapse: collapse; }
.code-view .linenos { color: var(--faint); user-select: none; padding-right: 12px; text-align: right; }
.frame { display: block; width: 100%; height: calc(100vh - 150px); min-height: 520px; border: 0; background: #fff; }
.frame.auto { min-height: 120px; }  /* height set from the page's own size (app.js) */
.image-view { padding: 24px; text-align: center; background: var(--surface); }
.image-view img { max-width: 100%; max-height: 82vh; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.download-view { padding-top: 40px; padding-bottom: 60px; color: var(--muted); }

/* footer */
.foot { color: var(--faint); font-size: 12.5px; padding: 26px 0 30px; border-top: 1px solid var(--border); margin-top: 48px; }
.mode-frame .foot, .mode-image .foot { margin-top: 0; }
.foot a { color: inherit; }

@media (max-width: 760px) {
  .top-inner { gap: 12px; flex-wrap: wrap; }
  .top nav { order: 3; width: 100%; }
  .search input { width: 160px; }
  .grid3 { grid-template-columns: 1fr; }
  .doc-title-row { flex-direction: column; }
  .row-time { display: none; }
  .topic > summary { padding: 10px 12px; }
  .leaf { padding: 7px 12px 7px 36px; }
  .topic.sub > summary { padding-left: 24px; }
  .topic.sub .leaves { margin-left: 30px; }
  .topic.sub .leaf { padding-left: 12px; }
}
@media print {
  .top, .foot, .actions, .files, .banner, .crumbs, .toc, .header-anchor, .backlinks, .linked-chip,
  .c-panel, .c-fab, .folio-c-layer { display: none !important; }
  body.c-open main { margin-right: 0 !important; }
  .viewer.has-toc { display: block; }
  body { background: #fff; color: #000; }
  .viewer { border: 0; }
  .wrap-prose { padding: 0; max-width: none; }
}
