/* light-md web app. The "Editor View" theme: macOS-like neutral chrome, a
   sidebar tree, a quiet editor area with Markdown set in IBM Plex Mono, and a
   side inspector. Every color comes from the tokens below (named after the
   design tokens); light and dark follow prefers-color-scheme. */

@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/vendor/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/vendor/fonts/IBMPlexMono-Bold-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/vendor/fonts/IBMPlexMono-Italic-Latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }

:root {
  color-scheme: light dark;
  --bg-chrome: #F0F0F0; --bg-tab-inactive: #E4E4E4; --bg-sidebar: #E9E9E9; --bg-sidebar-selected: #D5D5D5;
  --bg-list: #FAFAFA; --bg-card-selected: #E2E2E2; --bg-editor: #FFFFFF; --bg-inspector: #F5F5F5; --bg-button-active: #DCDCDE;
  --border-default: #D6D6D6; --border-subtle: #E6E6E6;
  --text-primary: #1D1D1F; --text-secondary: #3C3C43; --text-muted: #A0A0A5; --text-comment: #D33A2C;
  --text-heading: #1D1D1F; --text-heading-mark: #A0A0A5; --text-on-selected: #1D1D1F;
  --icon-default: #6E6E73; --status-green: #34C759;
  --tag-orange: #F29B38; --tag-orange-bg: #FDEBD0; --tag-green: #4CAF50; --tag-green-bg: #DDF3D9;
  --tag-blue: #2F7BD8; --tag-blue-bg: #D9E8FB; --tag-red: #E5484D; --tag-red-bg: #FCDADB;
  --tag-purple: #8B6BD9; --tag-purple-bg: #E8E0FA;
  --shadow: 0 8px 28px rgba(0, 0, 0, .12);

  /* Derived: tag colors pulled toward the text color so they read as text. */
  --tag-green-fg: color-mix(in srgb, var(--tag-green) 60%, var(--text-primary));
  --tag-red-fg: color-mix(in srgb, var(--tag-red) 70%, var(--text-primary));
  --tag-orange-fg: color-mix(in srgb, var(--tag-orange) 55%, var(--text-primary));

  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --column: 760px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-chrome: #1C1C1F; --bg-tab-inactive: #141416; --bg-sidebar: #26262A; --bg-sidebar-selected: #5E5CE6;
    --bg-list: #202023; --bg-card-selected: #3A3A3F; --bg-editor: #1A1A1D; --bg-inspector: #202023; --bg-button-active: #3A3A3F;
    --border-default: #38383D; --border-subtle: #2C2C30;
    --text-primary: #ECECEF; --text-secondary: #C7C7CC; --text-muted: #77777F; --text-comment: #FF6B5E;
    --text-heading: #F5A623; --text-heading-mark: #6E6CE0; --text-on-selected: #FFFFFF;
    --icon-default: #A1A1A8; --status-green: #30D158;
    --tag-orange: #F5A623; --tag-orange-bg: #3D2E16; --tag-green: #4CD964; --tag-green-bg: #1E3522;
    --tag-blue: #4C9BFF; --tag-blue-bg: #1A2B44; --tag-red: #FF6B6B; --tag-red-bg: #42201F;
    --tag-purple: #9F8CFF; --tag-purple-bg: #2E2747;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { background: var(--bg-editor); }
body { margin: 0; min-height: 100vh; position: relative; color: var(--text-primary); font: 13px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .92em; }
a { color: inherit; }
a:hover { color: var(--text-secondary); }
:focus-visible { outline: 2px solid var(--icon-default); outline-offset: 2px; border-radius: 4px; }
.muted, .msg { color: var(--icon-default); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.pad { padding: 4px 10px; }
#app { position: relative; }

/* controls */
.brand { font-weight: 600; font-size: 15px; color: var(--text-primary); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--text-primary); }
.brand span { font-family: var(--mono); font-weight: 700; font-size: .9em; color: var(--text-heading); background: var(--bg-button-active); padding: 1px 5px; border-radius: 5px; margin-left: 3px; }
.brand.big { font-size: 22px; }
.button { display: inline-flex; align-items: center; font: 500 13px var(--sans); padding: 4px 11px; border-radius: 6px; border: 1px solid var(--border-default);
  background: var(--bg-editor); color: var(--text-primary); cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--bg-button-active); color: var(--text-primary); }
.button.primary { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-editor); font-weight: 600; }
.button.primary:hover { background: var(--text-secondary); border-color: var(--text-secondary); color: var(--bg-editor); }
.button.ghost { border-color: transparent; background: none; color: var(--icon-default); }
.button.ghost:hover, .button.ghost[aria-pressed="true"] { background: var(--bg-button-active); color: var(--text-primary); }
.button:disabled { opacity: .55; cursor: progress; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--icon-default); cursor: pointer; }
button.link:hover { color: var(--text-primary); text-decoration: underline; }
input { font: 13px var(--sans); padding: 4px 9px; border: 1px solid var(--border-default); border-radius: 6px; background: var(--bg-editor); color: var(--text-primary); min-width: 0; }
input::placeholder { color: var(--text-muted); }
input:focus { outline: none; border-color: var(--icon-default); box-shadow: 0 0 0 3px var(--bg-button-active); }
kbd { font-size: 11px; color: var(--icon-default); border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--bg-editor); }
.tag, .pill { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 18px; vertical-align: 1px; }
.tag { background: var(--bg-button-active); color: var(--text-secondary); }
.pill { background: var(--tag-green-bg); color: var(--tag-green-fg); font-weight: 600; }
.who b { font-weight: 600; }
.switch { display: inline-flex; padding: 0; gap: 4px; background: none; border: 0; }
.switch button { font: 500 12px var(--sans); padding: 3px 10px; border: 0; border-radius: 6px; background: none; color: var(--icon-default); cursor: pointer; }
.switch button:hover { color: var(--text-primary); }
.switch button[aria-pressed="true"] { background: var(--bg-button-active); color: var(--text-primary); }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 8px); z-index: 20; opacity: 0; pointer-events: none;
  background: var(--text-primary); color: var(--bg-editor); font-size: 13px; padding: 7px 14px; border-radius: 8px; transition: opacity .15s, transform .15s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* live dot (sidebar footer) */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--icon-default); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.live[data-state="live"] i { background: var(--status-green); }
.live[data-state="connecting"] i { background: var(--tag-orange); }

/* landing and home */
.landing, .home { max-width: 720px; margin-left: max(0px, 9vw); padding: 13vh 32px 64px; }
.home { max-width: 760px; padding-top: 56px; }
.landing h1 { font: 700 40px/1.12 var(--mono); letter-spacing: -.02em; margin: 40px 0 16px; max-width: 16em; color: var(--text-heading); }
.home h1 { font: 700 30px/1.2 var(--mono); margin: 0 0 6px; color: var(--text-heading); }
.lede { color: var(--text-secondary); font-size: 16px; max-width: 58ch; margin: 0 0 28px; }
.lede b { color: var(--text-primary); }
.landing .button { font-size: 14px; padding: 7px 16px; }
.points { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 8px; color: var(--text-secondary); font-size: 14px; }
.points b { color: var(--text-primary); }
.orgs { display: grid; gap: 16px; margin: 0 0 28px; }
.org { background: var(--bg-list); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 14px 10px 14px; }
.org h2 { font-size: 14px; font-weight: 600; margin: 0 8px 8px; }
/* projects read like the doc-list cards: semibold title, muted line under it */
.projects { list-style: none; padding: 0; margin: 0 0 4px; }
.projects li + li { border-top: 1px solid var(--border-subtle); }
.projects a { display: flex; align-items: baseline; gap: 12px; padding: 9px 8px; border-radius: 6px; text-decoration: none; }
.projects a:hover { background: var(--bg-card-selected); color: inherit; }
.projects .name { font-weight: 600; font-size: 13px; }
.projects .muted { font-size: 12px; margin-left: auto; }
form.inline { display: flex; gap: 8px; align-items: center; margin: 10px 8px 0; }
form.inline label { font-size: 13px; color: var(--icon-default); margin-right: 4px; }

/* project: sidebar | editor | inspector */
.project { display: grid; grid-template-columns: 240px minmax(0, 1fr) 280px; min-height: 100vh; }
.tree, #side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 12px 10px 40px; }
.tree { background: var(--bg-sidebar); border-right: 1px solid var(--border-default); display: flex; flex-direction: column; padding-bottom: 0; }
.tree-list { flex: 1 0 auto; padding-bottom: 24px; }
/* sidebar top: org / project, back to all projects (like the org row in the design) */
.tree-head { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.2'%3E%3Ccircle cx='6' cy='5.5' r='2.3'/%3E%3Cpath d='M1.8 13.2c.4-2.4 2.1-3.7 4.2-3.7s3.8 1.3 4.2 3.7'/%3E%3Cpath d='M10.4 3.4a2.2 2.2 0 1 1 .6 4.3M12 9.7c1.3.4 2 1.6 2.2 3.5'/%3E%3C/svg%3E");
  display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 8px; margin: 0 0 8px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--text-primary); }
.tree-head::before { content: ""; flex: none; width: 14px; height: 14px; background: var(--icon-default); -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.tree-head:hover { background: color-mix(in srgb, var(--bg-sidebar-selected) 45%, transparent); color: var(--text-primary); }
.tree-head .in-org { color: var(--text-secondary); }
.tree-head .sep { color: var(--text-muted); }
.tree-head .in-proj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* sidebar bottom: live dot, who is signed in, Sign out */
.tree-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; margin: 0 -10px; padding: 8px 18px; font-size: 12px;
  background: var(--bg-sidebar); border-top: 1px solid var(--border-default); }
.tree-foot .me { font-weight: 500; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tree-foot .link { font-size: 12px; flex: none; }
#side { background: var(--bg-inspector); border-left: 1px solid var(--border-default); padding-inline: 12px; }
#doc { padding: 28px 56px 80px; min-width: 0; background: var(--bg-editor); }
.tree-tools { position: relative; margin: 0 0 6px; }
.tree-tools input { width: 100%; background: var(--bg-editor); font-size: 12px; }
.tree-tools kbd { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); line-height: 14px; pointer-events: none; }
.tree-new { padding: 2px 8px 10px; font-size: 13px; }
.tree-new input { width: 100%; font: 12px var(--mono); }
.hint { margin: 6px 2px 0; font-size: 11.5px; color: var(--icon-default); }
.hint.error { color: var(--tag-red-fg); }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree .group { margin: 0 0 6px; }
.tree .dir, .tree a.doc { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.2'%3E%3Crect x='3' y='1.6' width='10' height='12.8' rx='1.6'/%3E%3Cpath d='M5.6 5.4h4.8M5.6 8h4.8M5.6 10.6h3'/%3E%3C/svg%3E"); }
.tree .dir { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.2'%3E%3Cpath d='M1.8 4.2c0-.7.5-1.2 1.2-1.2h3.1l1.4 1.5H13c.7 0 1.2.5 1.2 1.2v6.4c0 .7-.5 1.2-1.2 1.2H3c-.7 0-1.2-.5-1.2-1.2z'/%3E%3C/svg%3E");
  display: flex; align-items: center; gap: 6px; padding: 5px 8px 3px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.tree .dir::before, .tree a.doc::before { content: ""; flex: none; width: 14px; height: 14px; background: var(--icon-default);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.tree a.doc { display: flex; align-items: center; gap: 6px; padding: 3px 8px; min-height: 24px; border-radius: 6px; text-decoration: none; font-size: 13px; color: var(--text-primary); }
.tree .dir + ul a.doc { padding-left: 22px; }
.tree a.doc:hover { background: color-mix(in srgb, var(--bg-sidebar-selected) 45%, transparent); color: var(--text-primary); }
.tree a.doc[aria-current="page"] { background: var(--bg-sidebar-selected); color: var(--text-on-selected); }
.tree a.doc[aria-current="page"]::before { background: currentColor; }
.tree .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editing { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex: none; font-size: 11px; font-weight: 500; color: var(--tag-green-fg);
  background: var(--tag-green-bg); border-radius: 999px; padding: 0 7px; line-height: 18px; }
.editing i { width: 6px; height: 6px; border-radius: 50%; background: var(--status-green); flex: none; }
.banner .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tag-orange); flex: none; }

/* doc header and banners */
.doc-head, .banners, .empty, .diff-sum, .diff { max-width: var(--column); margin-inline: auto; }
.doc-head .row { display: flex; align-items: center; gap: 10px; min-height: 30px; flex-wrap: wrap; }
.path { font-size: 12px; color: var(--icon-default); }
.ver { font: 11px var(--mono); color: var(--icon-default); background: var(--bg-button-active); padding: 1px 6px; border-radius: 5px; }
.meta { margin: 2px 0 0; font-size: 12px; color: var(--icon-default); }
.meta b { color: var(--text-primary); }
.banner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 7px 12px; font-size: 13px;
  background: var(--tag-orange-bg); border: 1px solid color-mix(in srgb, var(--tag-orange) 45%, transparent); border-radius: 8px; }
.banner .muted { color: var(--text-secondary); }
.banner.warn { background: var(--tag-red-bg); border-color: color-mix(in srgb, var(--tag-red) 45%, transparent); }
.empty { margin-top: 8vh; }
.empty h1 { font: 700 30px/1.2 var(--mono); color: var(--text-heading); margin: 6px 0; }

/* rendered Markdown: styled like source, in Plex Mono, with hanging heading marks */
article.md { max-width: var(--column); margin: 36px auto 0; padding: 0; font: 18px/38px var(--mono); color: var(--text-primary); overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md :is(h1, h2, h3, h4, h5, h6) { font-family: var(--mono); font-weight: 700; color: var(--text-heading); line-height: 1.3; letter-spacing: -.01em; margin: 1.5em 0 .55em; position: relative; scroll-margin-top: 16px; }
.md [data-section] { cursor: pointer; }
.md h1 { font-size: 34px; margin-top: .3em; }
.md h2 { font-size: 26px; }
.md h3 { font-size: 21px; }
.md :is(h4, h5, h6) { font-size: 18px; }
.md :is(h1, h2, h3, h4, h5, h6)::before { position: absolute; right: 100%; margin-right: 10px; top: 50%; transform: translateY(-50%);
  font: 400 13px/1 var(--mono); letter-spacing: 0; color: var(--text-heading-mark); white-space: nowrap; }
.md h1::before { content: "#"; }
.md h2::before { content: "##"; }
.md h3::before { content: "###"; }
.md h4::before { content: "####"; }
.md :is(h5, h6)::before { content: "#####"; }
.md [data-section]:is(:hover, :focus-visible)::before { color: var(--text-primary); }
.md :is(p, ul, ol, blockquote, pre, table) { margin: 0 0 22px; }
.md :is(ul, ol) { padding-left: 1.6em; }
.md li { margin: 0; }
.md li > p { margin: 0; }
.md li:has(> input) { list-style: none; }
.md li > input { margin: 0 .5em 0 -1.4em; accent-color: var(--bg-sidebar-selected); }
.md a { color: var(--text-primary); text-decoration-color: var(--text-heading-mark); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.md a:hover { color: var(--text-secondary); text-decoration-color: currentColor; }
.md strong { font-weight: 700; }
.md code { background: var(--bg-button-active); padding: .1em .35em; border-radius: 4px; font-size: .86em; }
.md pre { background: var(--bg-inspector); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 12px 16px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.md pre code { background: none; padding: 0; font-size: inherit; }
.md blockquote { margin-left: 0; padding-left: 16px; border-left: 3px solid var(--border-default); color: var(--text-secondary); }
.md hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 2em 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14.5px; line-height: 1.5; }
.md :is(th, td) { border: 1px solid var(--border-default); padding: 6px 12px; text-align: left; }
.md th { background: var(--bg-inspector); font-weight: 700; }
.md img { max-width: 100%; }
.md .flash { animation: flash 1.8s ease-out; border-radius: 4px; }
@keyframes flash { from { background: var(--tag-orange-bg); box-shadow: 0 0 0 4px var(--tag-orange-bg); } }

/* editing: the Visual editor, the rendered doc at full editor size */
#doc:has(.panes) { display: flex; flex-direction: column; height: 100vh; padding-bottom: 16px; }
#doc:has(.panes) > :is(.doc-head, .banners) { width: 100%; }
.panes { position: relative; display: grid; flex: 1 1 auto; margin: 16px -56px 0; background: var(--bg-editor); border-block: 1px solid var(--border-subtle);
  overflow: hidden; min-height: 320px; }
.panes article.md { position: relative; margin: 0; max-width: none; overflow-y: auto; scrollbar-gutter: stable both-edges; padding: 40px 64px;
  font-size: 18px; line-height: 38px; background: var(--bg-editor); }
/* the text column keeps its reading width; a classic scrollbar must not narrow it */
.panes article.md > :not(.slash-menu) { max-width: calc(var(--column) + 20px); margin-inline: auto; }
.panes article.md > :not(.vblock, .rblock, .slash-menu) { max-width: var(--column); }
.edit-bar { display: flex; gap: 8px; margin: 12px auto 0; width: 100%; max-width: var(--column); }
.edit-bar input { flex: 1; }

/* history: line diff */
.diff-sum { margin-block: 18px 8px; font-size: 12px; color: var(--icon-default); }
.add { color: var(--tag-green-fg); font-weight: 600; }
.del { color: var(--tag-red-fg); font-weight: 600; }
.diff { background: var(--bg-editor); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 8px 0; font: 13px/1.7 var(--mono); overflow: hidden; }
.diff .l { display: flex; white-space: pre-wrap; word-break: break-word; }
.diff .g { flex: none; width: 30px; text-align: center; color: var(--text-muted); user-select: none; }
.diff .t { flex: 1; padding-right: 16px; }
.diff .l.add { background: var(--tag-green-bg); color: inherit; font-weight: inherit; }
.diff .l.del { background: var(--tag-red-bg); color: inherit; font-weight: inherit; }
.diff .add .g { color: var(--tag-green-fg); }
.diff .del .g { color: var(--tag-red-fg); }
.diff .del .t { text-decoration: line-through color-mix(in srgb, var(--tag-red) 55%, transparent); }
.diff-more { display: block; width: 100%; text-align: left; font: inherit; font-size: 11.5px; color: var(--icon-default); background: var(--bg-inspector); border: 0; border-block: 1px solid var(--border-subtle); padding: 2px 30px; margin: 2px 0; cursor: pointer; }
.diff-more:hover { color: var(--text-primary); }
#doc > div > article.md { margin-top: 20px; }

/* inspector: activity and history */
#side .switch { margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); display: flex; }
.feed { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--text-secondary); }
.feed li { padding: 8px 6px; border-top: 1px solid var(--border-subtle); }
.feed li:first-child { border-top: 0; }
.feed .who b { color: var(--text-primary); }
.feed .docref { font-weight: 500; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-default); }
.feed span.docref { font: 11px var(--mono); border: 0; color: var(--icon-default); }
.feed .msg { margin-top: 2px; font-size: 12px; color: var(--icon-default); }
.feed .msg::before { content: "“"; }
.feed .msg::after { content: "”"; }
.feed .meta { font-size: 11px; color: var(--text-muted); }
.feed .mono { font-size: 11px; }
/* history rows read like doc-list cards; the open version is the selected card */
.history li { padding: 0; border-radius: 6px; }
.history li + li { border-top: 1px solid var(--border-subtle); }
.history li:is(:hover, .on) + li, .history li + li:is(:hover, .on) { border-top-color: transparent; }
.history .vrow { display: block; width: 100%; text-align: left; font: inherit; background: none; border: 0; padding: 8px 8px 0; color: inherit; cursor: pointer; }
.history .vrow .mono { font-weight: 600; color: var(--text-primary); }
.history div.vrow { cursor: default; }
.history li > :is(.msg, .meta) { padding: 0 8px; }
.history li > .meta { padding-bottom: 8px; }
.history li:hover { background: color-mix(in srgb, var(--bg-card-selected) 55%, transparent); }
.history li.on { background: var(--bg-card-selected); }

/* narrower screens */
@media (max-width: 1180px) {
  .project { grid-template-columns: 224px minmax(0, 1fr); }
  #side { grid-column: 2; position: static; height: auto; border: 0; border-top: 1px solid var(--border-default); padding: 20px 32px 60px; }
  #side > * { max-width: var(--column); margin-inline: auto; }
  #side > .switch { width: auto; margin: 0 auto 12px; }
}
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; }
  .tree { position: static; height: auto; max-height: 34vh; border: 0; border-bottom: 1px solid var(--border-default); }
  #side { grid-column: 1; padding: 20px 16px 60px; }
  #doc { padding: 16px 16px 40px 36px; }
  article.md { margin-top: 20px; font-size: 16px; line-height: 30px; }
  .md h1 { font-size: 27px; }
  .md h2 { font-size: 22px; }
  .md h3 { font-size: 19px; }
  .md :is(h1, h2, h3, h4, h5, h6)::before { font-size: 11px; margin-right: 6px; }
  #doc:has(.panes) { display: block; height: auto; }
  .panes { height: auto; margin-inline: -36px -16px; }
  .panes article.md { min-height: 60vh; }
  .landing { margin: 0; padding: 10vh 24px 48px; }
  .landing h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .md .flash { animation: none; background: var(--tag-orange-bg); }
  #toast { transition: none; }
}

/* Editor: the "/" menu */
.slash-menu { position: absolute; z-index: 20; min-width: 220px; padding: 4px; font-family: var(--sans); line-height: 1.4; background: var(--bg-inspector); border: 1px solid var(--border-default); border-radius: 10px; box-shadow: var(--shadow); }
.slash-menu button { display: flex; width: 100%; justify-content: space-between; gap: 16px; font: inherit; font-size: 13px; text-align: left; border: 0; background: none; color: var(--text-primary); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.slash-menu button[aria-selected="true"] { background: var(--bg-sidebar-selected); color: var(--text-on-selected); }
.slash-menu button[aria-selected="true"] kbd { color: inherit; }
.slash-menu kbd { font: 11.5px var(--mono); color: var(--icon-default); border: 0; background: none; }

/* Visual blocks: rendered and editable; code, HTML and the like open a Markdown box */
.vblock { border-radius: 6px; margin: 0 -10px; padding: 0 10px; outline: none; min-height: 1.6em; }
/* keep heading top margins so a block looks the same as when reading; they collapse through the block */
.vblock > :first-child:not(h1, h2, h3, h4, h5, h6) { margin-top: 0; }
.vblock > :last-child { margin-bottom: 22px; }
.vblock:focus { background: color-mix(in srgb, var(--bg-button-active) 45%, transparent); }
.vblock:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.vblock:empty { padding-bottom: 14px; }
.vblock:not(:focus):empty::before { content: ""; }
.rblock { border-radius: 6px; margin: 0 -10px; padding: 0 10px; cursor: text; }
.rblock:hover { background: color-mix(in srgb, var(--bg-button-active) 35%, transparent); }
.rblock > :first-child:not(h1, h2, h3, h4, h5, h6) { margin-top: 0; }
.rblock > :last-child { margin-bottom: 22px; }
.rblock-src { display: block; width: 100%; box-sizing: border-box; margin: 0 0 14px; padding: 6px 10px; resize: none; overflow: hidden;
  font: 16px/1.9 var(--mono); color: var(--text-primary); background: var(--bg-inspector); border: 1px solid var(--border-default); border-radius: 6px; outline: none; }
.rich-end { min-height: 120px; cursor: text; }
@media (max-width: 860px) { .panes article.md { padding: 18px 16px 30px 36px; font-size: 16px; line-height: 30px; } }

.vblock .table-tools { display: none; gap: 6px; margin: -8px 0 14px; user-select: none; font-family: var(--sans); line-height: 1.4; }
.vblock:focus-within .table-tools { display: flex; }
.table-tools button { font: inherit; font-size: 12px; color: var(--icon-default); background: var(--bg-editor); border: 1px solid var(--border-default); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.table-tools button:hover { color: var(--text-primary); background: var(--bg-button-active); }
.vblock td, .vblock th { min-width: 80px; }
