/* Paper by day, graphite by night. Colour is for meaning (links, state),
   never for large surfaces. Themes override these variables only. */
:root {
  --bg: #fbfaf7;
  --bg-soft: #f3f2ee;
  --nav-bg: #f5f4f0;
  --fg: #1f2328;
  --muted: #61666d;
  --line: #e5e3dd;
  --accent: #1f5f73;
  --accent-soft: #e6eef0;
  --warn: #9a4a06;
  --warn-soft: #fbf0e3;
  --bad: #b42828;
  --good: #1f7a46;
  --code: #9a3b5d;
  --tag: #6e4bb0;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  --logo-height: 24px;
  color-scheme: light;
}
/* Dark by the system, unless the person chose light in Nastavení; or
   chosen outright. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #191a1c;
    --bg-soft: #222326;
    --nav-bg: #151618;
    --fg: #e4e3df;
    --muted: #a2a39e;
    --line: #2f3034;
    --accent: #8cc4d2;
    --accent-soft: #23323a;
    --warn: #f0a35c;
    --warn-soft: #33281c;
    --bad: #ef7f7f;
    --good: #6ccf94;
    --code: #e5a3ba;
    --tag: #c2a8f2;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #191a1c;
  --bg-soft: #222326;
  --nav-bg: #151618;
  --fg: #e4e3df;
  --muted: #a2a39e;
  --line: #2f3034;
  --accent: #8cc4d2;
  --accent-soft: #23323a;
  --warn: #f0a35c;
  --warn-soft: #33281c;
  --bad: #ef7f7f;
  --good: #6ccf94;
  --code: #e5a3ba;
  --tag: #c2a8f2;
  color-scheme: dark;
}
:root {
  --hover: color-mix(in srgb, var(--fg) 6%, transparent);
  --selected: color-mix(in srgb, var(--fg) 9%, transparent);
  --soft-line: color-mix(in srgb, var(--fg) 18%, transparent);
  --toolbar-h: 52px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: calc(var(--toolbar-h) + 24px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
}
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.broken { color: var(--bad); text-decoration: underline dashed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, pre, kbd, textarea { font-family: var(--mono); font-size: .86em; }
pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; overflow-x: auto; line-height: 1.6; }
:not(pre) > code { background: var(--hover); padding: .12em .38em; border-radius: 5px; color: var(--code); }
kbd { border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: 11px; line-height: 18px; color: var(--muted); background: var(--bg); }
table { border-collapse: separate; border-spacing: 0; margin: 1.8em 0; display: block; overflow-x: auto; max-width: 100%; width: max-content; border: 1px solid var(--line); border-radius: 10px; font-size: .94em; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; vertical-align: top; }
td + td, th + th { border-left: 1px solid var(--line); }
tr:last-child > td { border-bottom: 0; }
th { background: var(--bg-soft); font-weight: 600; }
/* Set by a <!-- table: ... --> comment above the table, in the page and the editor. */
.kb-nohead th { background: none; font-weight: inherit; }
.kb-headcol :is(td, th):first-child { background: var(--bg-soft); font-weight: 600; }
img { max-width: 100%; border-radius: var(--radius); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.75em 0; }
/* Markdown tables always have a header row; an empty one means none. */
thead:not(:has(th:not(:empty))) { display: none; }
blockquote { margin: 1.5em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--soft-line); color: color-mix(in srgb, var(--fg) 86%, var(--bg)); }
blockquote > :first-child, #page blockquote > :first-child { margin-top: 0; }
blockquote > :last-child, #page blockquote > :last-child { margin-bottom: 0; }
/* A run of quotes (Notion's "Co / Platí k / Souvisí" header) reads as one. */
blockquote:has(+ blockquote) { margin-bottom: 0; padding-bottom: 6px; }
blockquote + blockquote { margin-top: 0; padding-top: 6px; }
button {
  font: inherit; font-size: 14px; color: var(--fg); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
button:hover { border-color: var(--soft-line); }
button.primary { background: var(--fg); border-color: var(--fg); color: var(--bg); }
button.ghost { display: inline-flex; align-items: center; gap: 6px; background: transparent; border-color: transparent; color: var(--muted); padding: 5px 10px; }
button.ghost:hover { background: var(--hover); color: var(--fg); }
.muted { color: var(--muted); }

/* icons */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* shell: sidebar | document | context rail */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr) 272px; min-height: 100vh; }
.shell.wide { grid-template-columns: 280px minmax(0, 1fr); }
#nav { background: var(--nav-bg); border-right: 1px solid var(--line); padding: 16px 10px 20px; font-size: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
#nav .brand { display: block; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--fg); margin: 4px 10px 18px; }
#nav .brand:hover { text-decoration: none; }
#nav .brand img { display: block; height: var(--logo-height); width: auto; max-width: 100%; }
.search-btn { width: 100%; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 0 8px 0 10px; height: 34px; background: var(--bg); color: var(--muted); border-color: var(--line); }
.search-btn:hover { color: var(--fg); border-color: var(--soft-line); }
.search-btn kbd { margin-left: auto; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { flex: 1; }
.tree ul { padding-left: 14px; }
.tree li { margin: 1px 0; }
.tree a, .tree summary {
  display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 8px; border-radius: 6px;
  color: color-mix(in srgb, var(--fg) 84%, var(--nav-bg)); white-space: nowrap; line-height: 1.35;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.tree a:hover, .tree summary:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.tree .name, .tree summary a, .tree summary .dir { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree summary { cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary a { padding: 0; min-height: 0; color: inherit; display: block; }
.tree summary a:hover { background: none; }
.tree summary .dir { font-weight: 500; }
.tree .slot { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); }
.tree .slot > * { grid-area: 1 / 1; }
/* A folder shows its chevron before the icon all the time; pages leave its
   room empty so the icons line up. */
.tree .chev { flex: none; width: 14px; height: 18px; margin-right: -4px; display: grid; place-items: center; color: var(--muted); border-radius: 4px; }
.tree .chev::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(-45deg); transition: transform .15s var(--ease); }
.tree details[open] > summary .chev::before { transform: rotate(45deg) translate(-1px, -1px); }
.tree summary:hover .chev { color: var(--fg); }
.tree li > a { padding-left: 26px; }
.tree .count { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .12s; }
.tree summary:hover .count { opacity: 1; }
.tree a.active, .tree summary:has(> a.active) { background: var(--selected); color: var(--fg); font-weight: 600; }
.tree a.active .slot, .tree summary:has(> a.active) .slot { color: var(--fg); }
.tree summary a.active { background: none; }
.nav-foot { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.nav-foot a { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 8px; border-radius: 6px; color: var(--muted); font-size: 13.5px; }
.nav-foot a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.nav-foot + .nav-foot { margin-top: 12px; }
.nav-user { flex-direction: row; align-items: center; gap: 4px; }
.nav-user .who { flex: 1; min-width: 0; }
.nav-user .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user .act { flex: none; justify-content: center; width: 30px; padding: 0; }
main.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 48px 16px; }
.auth-card { width: min(100%, 26rem); }
.auth-brand { display: inline-block; margin-bottom: 40px; color: var(--fg); font-size: 20px; font-weight: 700; text-decoration: none; }
.auth-brand img { display: block; height: calc(var(--logo-height) * 1.5); width: auto; max-width: 100%; }
main.auth h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; }
main.auth p { margin: 0 0 16px; color: var(--muted); }
.auth-choose { display: grid; gap: 8px; margin-top: 28px; }
.auth-choose a.button { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius); background: var(--fg); color: var(--bg); font-weight: 600; text-decoration: none; }
.auth-choose a.button + a.button { background: none; border: 1px solid var(--line); color: var(--fg); }
.auth-choose a.button:hover { opacity: .9; }
main.auth form { display: flex; gap: 8px; margin-top: 16px; }
main.auth button { font: inherit; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--line, #ccc); background: none; cursor: pointer; }
main.auth button[value=allow] { background: var(--fg); border-color: transparent; color: var(--bg); }
main { padding: 0 0 140px; min-width: 0; }

/* top bar: where the page sits, and the one action */
.toolbar {
  position: sticky; top: 0; z-index: 10; height: var(--toolbar-h);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 20px 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  transition: box-shadow .2s var(--ease);
}
.scrolled .toolbar { box-shadow: 0 1px 0 var(--line); }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.crumbs a, .crumbs span { overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); flex: 0 1 auto; padding: 2px 4px; margin: 0 -4px; border-radius: 4px; }
.crumbs a:hover { color: var(--fg); background: var(--hover); text-decoration: none; }
.crumbs .sep { flex: none; color: var(--soft-line); }
.crumbs .here { color: var(--fg); font-weight: 500; }
.tools { display: flex; align-items: center; gap: 2px; flex: none; }
a.ghost { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius); color: var(--muted); font-size: 14px; }
a.ghost:hover { background: var(--hover); color: var(--fg); text-decoration: none; }

/* the document */
#page { max-width: 45rem; margin: 0 auto; padding: 40px 48px 0; font-size: 17px; line-height: 1.72; }
#page > h1:first-of-type, #page > .warn + h1, #doc > h1:first-child {
  font-size: clamp(2.1rem, 1.5rem + 1.6vw, 2.85rem); font-weight: 700; line-height: 1.12; letter-spacing: -.032em;
  margin: 8px 0 14px; text-wrap: balance;
}
#page h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.028em; line-height: 1.18; margin: 1.6em 0 .5em; }
#page h2 { font-size: 1.5rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.3; margin: 2.3em 0 .55em; text-wrap: balance; }
#page h3 { font-size: 1.18rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.4; margin: 1.9em 0 .4em; }
#page h4 { font-size: 1rem; font-weight: 650; margin: 1.6em 0 .3em; }
#page :is(h2, h3, h4) .anchor { margin-left: .3em; color: var(--muted); opacity: 0; font-weight: 400; text-decoration: none; transition: opacity .15s var(--ease); }
#page :is(h2, h3, h4):hover .anchor, #page .anchor:focus-visible { opacity: .6; }
#page p { margin: 0 0 1.05em; }
#page ul, #page ol { padding-left: 1.4em; margin: 0 0 1.2em; }
#page li { margin: .32em 0; padding-left: .2em; }
#page li > ul, #page li > ol { margin: .32em 0 0; }
#page li::marker { color: var(--muted); }
#page strong { font-weight: 650; }
#page a:not(.anchor) {
  color: inherit; text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: 1px;
  text-decoration-color: var(--soft-line); transition: text-decoration-color .15s var(--ease), color .15s var(--ease);
}
#page a:not(.anchor):hover { color: var(--accent); text-decoration-color: currentColor; }
#page a.broken { color: var(--bad); text-decoration: underline dashed; }

/* context rail */
#aside { background: var(--nav-bg); border-left: 1px solid var(--line); padding: 6px 0 32px; font-size: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
#aside h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
#aside h3 svg.i { width: 14px; height: 14px; }
#aside h3 .n { font-weight: 500; font-size: 11.5px; line-height: 18px; padding: 0 6px; border-radius: 9px; background: var(--hover); font-variant-numeric: tabular-nums; }
#aside section { margin-bottom: 32px; }
#aside ul { margin: 0; padding: 0; list-style: none; }
#aside .side [hidden] { display: none; }
#aside .empty { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.toc ul { border-left: 1px solid var(--line); margin-left: 7px !important; }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); font-size: 13.5px; line-height: 1.45; transition: color .15s var(--ease), border-color .15s var(--ease); }
.toc li.h3 a { padding-left: 26px; font-size: 13px; }
.toc li a:hover { color: var(--fg); text-decoration: none; }
.toc li a.on { color: var(--fg); border-left-color: var(--fg); }
.refs li a { display: block; padding: 7px 10px; margin: 0 -10px; border-radius: 8px; color: var(--fg); transition: background-color .12s var(--ease); }
.refs li a:hover { background: var(--hover); text-decoration: none; }
.refs .t { display: block; font-weight: 500; line-height: 1.35; }
.refs .w { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.actions { display: flex; flex-direction: column; gap: 1px; padding-top: 16px; border-top: 1px solid var(--line); }
.actions a, .actions button, .actions .file { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; margin: 0 -10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13.5px; text-align: left; }
.actions a:hover, .actions button:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.actions .file { font-family: var(--mono); font-size: 12px; word-break: break-all; line-height: 1.4; padding-top: 6px; padding-bottom: 6px; }
.share { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; word-break: break-all; }
.share.off { background: var(--warn-soft); }

div.graph { position: relative; width: 100%; }
div.graph.local { height: 240px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); }
div.graph .empty { padding: 12px; margin: 0; }

/* graph page: the graph fills the room, controls float on glass */
.graph-main { padding: 0; position: relative; height: 100vh; overflow: hidden; background: var(--bg); }
div.graph.global { position: absolute; inset: 0; height: auto; }
div.graph.g3::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 75% 70% at 55% 50%, transparent 55%, color-mix(in srgb, var(--bg) 70%, transparent)); }
.glass, .graph-find, .graph-bar .seg, .graph-bar > button, .graph-stats, .graph-legend, .g3-panel, .g3-tip {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px -12px rgb(0 0 0 / .18);
}
.graph-bar { position: absolute; z-index: 3; top: 14px; left: 16px; right: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; pointer-events: none; }
.graph-bar > * { pointer-events: auto; }
.graph-find { font: inherit; font-size: 14px; width: 280px; max-width: 100%; height: 34px; padding: 0 12px; border-radius: 9px; color: var(--fg); }
.graph-find:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.graph-bar > button { height: 34px; border-radius: 9px; padding: 0 12px; color: var(--muted); }
.graph-bar > button:hover { color: var(--fg); }
.graph-stats { margin-left: auto; font-size: 12.5px; color: var(--muted); height: 34px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 9px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; height: 34px; }
.seg button { border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 0 11px; font-size: 13.5px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--fg); background: transparent; }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .08); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.graph-legend { position: absolute; z-index: 3; left: 16px; bottom: 16px; width: 200px; display: flex; flex-direction: column; gap: 1px; padding: 6px; border-radius: 12px; max-height: min(calc(100vh - 100px), 360px); overflow-y: auto; scrollbar-width: thin; transition: opacity .3s var(--ease); }
.graph-legend:empty { display: none; }
/* An open page panel takes over; the legend steps aside so the view can shift left. */
.graph-main:has(.g3-panel:not([hidden])) .graph-legend { opacity: 0; pointer-events: none; }
.graph-legend .chip { display: flex; align-items: center; gap: 9px; min-height: 27px; padding: 3px 8px; border: 0; border-radius: 7px; background: transparent; font-size: 13px; line-height: 1.3; text-align: left; color: var(--fg); transition: background .15s, opacity .15s; }
.graph-legend .nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.graph-legend .chip:hover { background: var(--hover); }
.graph-legend .chip small { color: var(--muted); margin-left: auto; padding-left: 8px; font-variant-numeric: tabular-nums; }
.graph-legend .dot, .g3 .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.graph-legend.picking .chip:not(.on) { opacity: .4; }
.graph-legend .chip.on { background: var(--selected); }

/* 3D: hover card, page panel, hint */
.g3-tip { position: absolute; z-index: 2; left: 0; top: 0; width: 280px; margin: 18px 0 0 18px; padding: 12px 14px; border-radius: 12px; pointer-events: none; font-size: 13px; line-height: 1.45; }
.g3-tip strong { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; margin-top: 4px; color: var(--fg); }
.g3-tip p { margin: 6px 0 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.g3-topic { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); }
.g3-panel { position: absolute; z-index: 3; top: 62px; right: 16px; bottom: 16px; width: 340px; padding: 22px 22px 18px; border-radius: 14px; overflow-y: auto; animation: g3-in .22s var(--ease, ease-out); }
.g3-panel[hidden] { display: none; }
@keyframes g3-in { from { opacity: 0; transform: translateX(10px); } }
.g3-panel h2 { margin: 10px 0 0; font-size: 22px; line-height: 1.22; letter-spacing: -.022em; font-weight: 700; color: var(--fg); }
.g3-excerpt { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.g3-open { display: flex; align-items: center; justify-content: center; height: 38px; margin: 18px 0 0; border-radius: 9px; background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 600; text-decoration: none; transition: opacity .15s; }
.g3-open:hover { opacity: .88; text-decoration: none; color: var(--bg); }
.g3-panel h3 { display: flex; align-items: center; gap: 8px; margin: 24px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.g3-panel h3 .n { font-weight: 500; font-variant-numeric: tabular-nums; }
.g3-panel ul { list-style: none; margin: 0 -8px; padding: 0; }
.g3-panel li button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 7px; background: none; color: var(--fg); font-size: 13.5px; line-height: 1.35; text-align: left; }
.g3-panel li button:hover { background: var(--hover); }
.g3-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.g3-close:hover { background: var(--hover); color: var(--fg); }
.g3-hint { position: absolute; z-index: 2; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0; padding: 7px 14px; border-radius: 99px; font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap; pointer-events: none; transition: opacity .6s; }
.g3-hint.gone, .g3-hint.off { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .g3-panel { animation: none; } }

@media (max-width: 1180px) {
  .editing main { grid-template-columns: minmax(0, 1fr); }
  #editor { position: static; height: 65vh; }
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  #aside { grid-column: 2; position: static; height: auto; padding: 32px 24px; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 40px; }
  #aside .toc { display: none; }
  .actions { border-top: 0; padding-top: 0; }
}
@media (max-width: 720px) {
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); }
  #nav { position: static; height: auto; max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  #aside { grid-column: 1; padding: 24px 0; }
  .toolbar { padding: 0 12px 0 20px; }
  #page { padding: 20px 20px 0; font-size: 16.5px; }
  main { padding-bottom: 60px; }
  .editing .shell { grid-template-columns: minmax(0, 1fr); }
  .graph-main { height: 80vh; }
  .graph-legend { width: auto; right: 16px; max-height: 26vh; }
  .graph-stats, .g3-hint { display: none; }
  .g3-panel { top: auto; left: 16px; width: auto; max-height: 55%; }
}

/* page content */
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13.5px; line-height: 1.5; margin: 0 0 36px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; color: var(--fg); }
.warn, .render-error { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; font-size: 14px; }
.render-error { color: var(--bad); }
li:has(> input[type=checkbox]) { list-style: none; margin-left: -1.3em; }
input.task { accent-color: var(--accent); margin-right: 6px; }
input.task:not(:disabled) { cursor: pointer; }
li.done, li:has(> input.task:checked) { color: var(--muted); }

/* editor: source left, live preview right */
.editing .shell { grid-template-columns: 280px minmax(0, 1fr); }
.editing #aside { display: none; }
.editing main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; padding: 0 24px 40px 0; }
.editing #editor { margin-left: 24px; top: calc(var(--toolbar-h) + 12px); height: calc(100vh - var(--toolbar-h) - 40px); }
.editing .toolbar { grid-column: 1 / -1; max-width: none; }
.editing #page { max-width: none; padding: 8px 0 0; }
#editor { display: flex; flex-direction: column; position: sticky; top: 12px; height: calc(100vh - 70px); min-width: 0; }
#editor[hidden] { display: none; }
.cm-host { flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: 0 0 6px 6px; overflow: hidden; }
.cm-host:focus-within { border-color: var(--accent); }
.editor-tools { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--bg); }
.editor-tools .tool { border-color: transparent; background: transparent; min-width: 30px; padding: 2px 8px; font-size: 13px; }
.editor-tools .tool:hover { background: var(--bg-soft); border-color: var(--line); }
.editor-tools .tool-bold { font-weight: 700; }
.editor-tools .tool-italic { font-style: italic; }
.editor-tools .tool-strike { text-decoration: line-through; }
.editor-tools .tool-code { font-family: var(--mono); }
.editor-tools .sep { width: 1px; background: var(--line); margin: 3px 4px; }
.editor-bar { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; }
.editor-bar .status { color: var(--muted); margin-left: auto; }
.banner { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.banner .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.banner pre { max-height: 260px; overflow: auto; font-size: 12px; margin: 8px 0 0; }
.editor-tools .modes { margin-left: auto; display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--bg-soft); }
.editor-tools .modes button { border: 0; background: transparent; padding: 2px 10px; font-size: 13px; color: var(--muted); border-radius: 5px; }
.editor-tools .modes button[aria-pressed=true] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / .1); }
.table-tools { display: contents; }
.table-tools[hidden] { display: none; }

/* visual editor: the page itself is editable, tools stick above it and
   saving floats at the bottom */
.visual #editor { position: static; height: auto; margin: 0 auto; width: min(100%, calc(45rem + 96px)); padding: 0 48px; }
.visual #editor :is(.editor-tools, .cm-host) { display: none; }
.visual .banner { margin: 16px 0 0; }
.visual .editor-bar { display: none; }
[data-new].visual .editor-bar { display: flex; position: fixed; z-index: 5; right: 24px; bottom: 20px; margin: 0; padding: 6px 6px 6px 14px; flex-direction: row-reverse; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px -12px rgb(0 0 0 / .25); }
[data-new].visual .editor-bar :is(.status, .to-visual) { display: none; }
.visual #page > .meta { display: none; }
.save-state { margin-right: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.save-state:empty { display: none; }
.save-state.dirty::before, .save-state.busy::before, .save-state.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; background: var(--muted); }
.save-state.busy::before { background: var(--accent); }
.save-state.ok::before { background: var(--good); }
.save-state.bad { color: var(--bad); }
.kb-visual { outline: none; white-space: pre-wrap; word-wrap: break-word; min-height: 50vh; padding-bottom: 30vh; caret-color: var(--accent); }
.kb-visual > h1:first-child { font-size: clamp(2.1rem, 1.5rem + 1.6vw, 2.85rem); line-height: 1.12; letter-spacing: -.032em; margin: 8px 0 14px; }
#page .kb-visual li > p { margin: 0; }
.kb-visual li[data-item-type=task] { list-style: none; position: relative; }
.kb-visual li[data-item-type=task]::before { content: ""; position: absolute; left: -1.25em; top: .42em; width: .9em; height: .9em; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 3px; cursor: pointer; }
.kb-visual li[data-checked=true]::before { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8'/%3E%3C/svg%3E") center / 100% no-repeat; }
#page .kb-visual li[data-checked=true] > p { color: var(--muted); }
.kb-visual span[data-type=html] { font: .82em var(--mono); color: var(--tag); background: var(--bg-soft); border-radius: 4px; padding: 1px 4px; white-space: pre-wrap; }
.kb-visual img { max-width: 100%; }
.kb-visual td, .kb-visual th { position: relative; min-width: 7rem; }
.kb-visual .selectedCell::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 15%, transparent); pointer-events: none; }
.kb-visual .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; background: var(--accent); pointer-events: none; }
.kb-visual { --picked: color-mix(in srgb, var(--fg) 9%, transparent); }
.kb-visual .ProseMirror-selectednode { outline: none; border-radius: 6px; background: var(--picked); box-shadow: 0 0 0 4px var(--picked); }
.kb-visual :is(td, th).ProseMirror-selectednode { border-radius: 0; box-shadow: none; }
.kb-visual hr.ProseMirror-selectednode { background: none; box-shadow: 0 0 0 10px var(--picked); }
.kb-visual .kb-tmark { display: none; }
.ProseMirror-hideselection *::selection { background: transparent; }
.kb-visual .kb-empty::before { content: "Piš, nebo / pro bloky"; position: absolute; color: var(--muted); opacity: .6; pointer-events: none; }
#page .milkdown { position: relative; }
.kb-block { position: absolute; z-index: 5; display: flex; align-items: center; gap: 1px; transition: opacity .12s; }
.kb-block[data-show=false] { opacity: 0; pointer-events: none; }
.kb-block button, .kb-block .grip { display: grid; place-items: center; width: 20px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); font: 16px/1 var(--font); cursor: pointer; }
.kb-block .grip { cursor: grab; font-size: 14px; }
.kb-block button:hover, .kb-block .grip:hover { background: var(--hover); color: var(--fg); }
.kb-visual[data-dragging=true] .kb-block { opacity: 0; }
.ProseMirror-dropcursor, .prosemirror-dropcursor-block { background: var(--accent) !important; }
.milkdown-table-block { display: block; position: relative; margin: 1em 0; }
.milkdown-table-block .table-wrapper { position: relative; overflow-x: auto; }
.milkdown-table-block table.children { margin: 0; }
#page .milkdown-table-block :is(td, th) > p { margin: 0; }
.milkdown-table-block .handle { position: absolute; z-index: 6; }
.milkdown-table-block .handle[data-show=false] { display: none; }
.milkdown-table-block .cell-handle { display: grid; place-items: center; left: -999px; top: -999px; height: 16px; min-width: 24px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); cursor: grab; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.milkdown-table-block .cell-handle[data-role=col-drag-handle] { transform: translateY(50%); }
.milkdown-table-block .cell-handle[data-role=row-drag-handle] { height: 24px; min-width: 16px; transform: translateX(50%); }
.milkdown-table-block .cell-handle:hover { color: var(--fg); border-color: var(--soft-line); }
.milkdown-table-block .milkdown-icon { display: grid; place-items: center; }
.milkdown-table-block .button-group { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); display: flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px -8px rgb(0 0 0 / .25); }
.milkdown-table-block .button-group[data-show=false] { display: none; }
.milkdown-table-block .button-group button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.milkdown-table-block .button-group button:hover { background: var(--hover); color: var(--fg); }
.milkdown-table-block .line-handle[data-role=x-line-drag-handle] { height: 2px; left: 0; }
.milkdown-table-block .line-handle[data-role=y-line-drag-handle] { width: 2px; top: 0; }
.milkdown-table-block .line-handle[data-display-type=indicator] { background: var(--accent); }
.milkdown-table-block .line-handle .add-button { position: absolute; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--accent); cursor: pointer; }
.milkdown-table-block .line-handle[data-role=x-line-drag-handle] .add-button { left: -26px; top: -10px; }
.milkdown-table-block .line-handle[data-role=y-line-drag-handle] .add-button { top: -26px; left: -10px; }
.milkdown-table-block .line-handle[data-display-type=indicator] .add-button { display: none; }
.milkdown-table-block .line-handle[data-display-type=tool] { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.milkdown-table-block .drag-preview { position: absolute; z-index: 7; opacity: .5; pointer-events: none; background: var(--bg); }
.milkdown-table-block .drag-preview[data-show=false] { display: none; }
.milkdown-table-block .drag-preview table { margin: 0; }
.props { display: grid; gap: 1px; margin: 0 -8px; font-size: 13.5px; }
.props .prop { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) auto; align-items: center; gap: 4px; min-height: 30px; padding-left: 8px; }
.props .prop > label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props input[type=text], .props input[type=date] { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; background: none; color: inherit; font: inherit; }
.props input[type=text]:hover, .props input[type=date]:hover { background: var(--hover); }
.props input[type=text]:focus, .props input[type=date]:focus { outline: none; border-color: var(--soft-line); background: var(--bg); }
.props .check { display: flex; align-items: center; gap: 8px; padding: 0 8px; cursor: pointer; }
.props .check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.props-view .prop > span { padding: 5px 8px; overflow-wrap: anywhere; }
.props-view .empty { padding-left: 8px; }
.props .del { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; opacity: 0; }
.props .prop:hover .del, .props .del:focus-visible { opacity: 1; }
.props .del:hover { background: var(--hover); color: var(--bad); }
.props .add { justify-self: start; margin-top: 4px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.props .add:hover { background: var(--hover); color: var(--fg); }
.pm-suggest { position: fixed; z-index: 50; min-width: 260px; max-width: 420px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px -12px rgb(0 0 0 / .25); font-size: 14px; }
.pm-suggest .row { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.pm-suggest .row.on { background: var(--accent-soft); }
.pm-suggest .p { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the table's own add and delete buttons give way to the handle menus */
.milkdown-table-block .button-group, .milkdown-table-block .line-handle[data-display-type=tool] { display: none !important; }
.kb-drop { z-index: 30; background: var(--accent); border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.kb-visual .kb-dragging { opacity: .3; }
.kb-ghost { position: fixed; z-index: 100; pointer-events: none; padding: 6px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px -10px rgb(0 0 0 / .35); max-height: 180px; overflow: hidden; font-size: 15px; opacity: .92; }
.kb-ghost > * { margin: 0 !important; }
.kb-menu { position: fixed; z-index: 60; width: 300px; max-height: min(380px, 60vh); overflow-y: auto; padding: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px -14px rgb(0 0 0 / .35); font-size: 14px; }
.kb-menu .head { padding: 8px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.kb-menu .head:empty { margin: 4px 0; padding: 0; border-top: 1px solid var(--line); }
.kb-menu .head:first-child:empty { display: none; }
.kb-menu .row { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.kb-menu .row.sel { background: var(--hover); }
.kb-menu .ic { grid-row: 1 / 3; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: 600 12px/1 var(--font); }
.kb-menu .l { color: var(--fg); }
.kb-menu .h { color: var(--muted); font-size: 12px; }
.kb-menu .h:empty { display: none; }
.kb-menu .row:has(.h:empty) .ic { grid-row: 1; width: 22px; height: 22px; border: 0; }
.kb-menu .row.on .l::after { content: "✓"; margin-left: 8px; color: var(--accent); }
.kb-menu .row.danger .l, .kb-menu .row.danger .ic { color: var(--bad); }
.kb-bar { position: fixed; z-index: 55; display: flex; align-items: center; gap: 1px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 10px 28px -12px rgb(0 0 0 / .35); font-size: 13.5px; }
.kb-bar button { display: inline-flex; align-items: center; gap: 4px; min-width: 28px; height: 28px; padding: 0 7px; justify-content: center; border: 0; border-radius: 6px; background: none; color: var(--fg); font: inherit; cursor: pointer; white-space: nowrap; }
.kb-bar button:hover { background: var(--hover); }
.kb-bar button.on { color: var(--accent); background: var(--accent-soft); }
.kb-bar button.danger:hover { color: var(--bad); }
.kb-bar .turn { font-weight: 500; }
.kb-bar [hidden] { display: none; }
.kb-bar i { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
@media (max-width: 720px) {
  .visual #editor { padding: 0 16px; }
  [data-new].visual .editor-bar { right: 12px; bottom: 12px; }
  .props .prop { grid-template-columns: 6.5rem 1fr auto; }
  .props .del { opacity: 1; }
}
.diff .add { color: var(--good); }
.diff .del { color: var(--bad); }
.suggest { position: absolute; z-index: 20; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 260px; max-width: 420px; font-size: 14px; }
.suggest div { padding: 5px 10px; cursor: pointer; }
.suggest div small { color: var(--muted); margin-left: 6px; }
.suggest div.sel { background: var(--accent-soft); }
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: var(--radius); font-size: 14px; z-index: 50; }

/* palette */
.palette-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; }
.palette { width: 100%; max-width: 600px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.palette input { width: 100%; font: inherit; font-size: 17px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg); color: var(--fg); outline: none; }
.palette .results { max-height: 50vh; overflow-y: auto; }
.palette .item { display: block; padding: 8px 16px; color: var(--fg); text-decoration: none; }
.palette .item.sel { background: var(--accent-soft); }
.palette .item small { display: block; color: var(--muted); font-size: 12px; }
.palette .item .snip { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* shared page */
.shared { padding: 0 0 120px; }
.shared-head { max-width: 45rem; margin: 0 auto; padding: 28px 48px 0; }
.shared-head img { height: 28px; display: block; }
@media (max-width: 720px) { .shared-head { padding: 20px 16px 0; } }

/* Embedded HTML app (frontmatter `app:`) */
figure.app { margin: 20px 0; }
figure.app iframe { width: 100%; height: 80vh; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; resize: vertical; }
figure.app figcaption { margin-top: 6px; font-size: 13px; text-align: right; }

/* change view: one commit per row, the diff under it */
.changes .lede { color: var(--muted); margin: 0 0 28px; }
.commits { list-style: none; margin: 0 0 40px; padding: 0; border-top: 1px solid var(--line); }
#page .commits li { margin: 0; padding: 0; }
.commit { border-bottom: 1px solid var(--line); }
.commit summary {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "av who time" "av subj stat";
  column-gap: 12px; row-gap: 0; align-items: baseline; padding: 14px 4px; cursor: pointer; list-style: none; line-height: 1.45;
}
.commit summary::-webkit-details-marker { display: none; }
.commit summary:hover { background: var(--hover); }
.commit .avatar {
  grid-area: av; align-self: start; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; margin-top: 2px;
}
.commit .who { grid-area: who; font-size: 15px; min-width: 0; }
.commit .login { color: var(--muted); font-size: 13.5px; }
.commit .subject { grid-area: subj; font-size: 14.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commit[open] .subject, .commit details[open] .subject { white-space: normal; }
.commit time { grid-area: time; font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.commit .stat { grid-area: stat; justify-self: end; font: 12.5px var(--mono); white-space: nowrap; }
.commit .stat .add { color: var(--good); }
.commit .stat .del { color: var(--bad); }
.commit .body { margin: 0 0 12px 48px; font-size: 14.5px; color: var(--muted); white-space: pre-line; }
.commit .moved { margin: 0 0 12px 48px; font-size: 14.5px; }
.commit .sha { margin: 8px 0 16px 48px; font-size: 13px; color: var(--muted); }
.commit .sha a { color: var(--muted); }
.commit .sha a:hover { color: var(--accent); }
.diff { margin: 0 0 0 48px; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; background: var(--bg); }
#page .diff table { display: table; width: 100%; margin: 0; border: 0; border-radius: 0; font: 12.5px/1.55 var(--mono); }
#page .diff td { border: 0; padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
#page .diff td.ln { width: 1%; padding: 0 6px; text-align: right; color: var(--muted); opacity: .7; user-select: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
#page .diff td + td { border-left: 0; }
.diff tr.add { background: color-mix(in srgb, var(--good) 13%, transparent); }
.diff tr.del { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.diff tr.add .code::before { content: "+"; margin-left: -9px; color: var(--good); }
.diff tr.del .code::before { content: "−"; margin-left: -9px; color: var(--bad); }
#page .diff tr.hunk td, #page .diff tr.note td { background: var(--bg-soft); color: var(--muted); padding: 3px 10px; font-size: 12px; }
@media (max-width: 720px) {
  .commit .body, .commit .moved, .commit .sha, .diff { margin-left: 0; }
}

.props input.new-prop[type=text] { margin-top: 6px; border-color: var(--soft-line); background: var(--bg); }
.kb-ask { position: fixed; z-index: 60; display: flex; flex-wrap: wrap; gap: 6px; width: 340px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px -12px rgb(0 0 0 / .35); }
.kb-ask input { flex: 1; min-width: 0; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-soft); color: var(--fg); font: 14px var(--font); outline: none; }
.kb-ask input:focus { border-color: var(--accent); }
.kb-ask button { height: 30px; padding: 0 11px; border: 0; border-radius: 7px; background: var(--accent); color: var(--on-accent, #fff); font: 500 13.5px var(--font); cursor: pointer; }
.kb-ask small { width: 100%; color: var(--muted); font-size: 12px; }

/* Side panel: sections fold, a line between them; the actions stay below. */
/* Sections run edge to edge so the lines between them do too. */
#aside > * { padding-left: 24px; padding-right: 24px; }
#aside details.side { margin: 0; padding-top: 14px; padding-bottom: 14px; }
#aside details.side:not([hidden]) ~ details.side { border-top: 1px solid var(--line); }
#aside details.side > summary { list-style: none; cursor: pointer; border-radius: 6px; margin: 0 -8px; padding: 4px 8px; }
#aside details.side > summary::-webkit-details-marker { display: none; }
#aside details.side > summary:hover { background: var(--hover); }
#aside details.side > summary h3 { margin: 0; }
#aside details.side > summary h3::after { content: ""; margin-left: auto; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s var(--ease); opacity: .7; }
#aside details.side[open] > summary h3::after { transform: rotate(45deg); }
#aside details.side[open] > summary { margin-bottom: 10px; }
#aside details.side h4 { margin: 12px 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
#aside details.side h4:first-of-type { margin-top: 0; }
#aside details.side + section, #aside details.side + .actions { border-top: 1px solid var(--line); padding-top: 20px; }
#aside .share { margin-top: 8px; }
.props .props-sep { margin: 10px 0 2px 8px; font-size: 12px; color: var(--muted); }
.props input.icon-in[type=text] { font-size: 16px; }
/* The icon is the title's first character; without a title it sits above. */
h1 > .emo, .kb-emo { margin-right: .3em; font-weight: 400; }
.page-icon, .kb-emo.alone { display: block; margin: 1.6em 0 -.6em; font-size: 2.6rem; line-height: 1; }
.tree .slot .emo { font-size: 14px; line-height: 1; }

/* Attachments: in the side panel, and links to them in the page. */
.files li a { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; margin: 0 -10px; border-radius: 8px; color: var(--fg); }
.files li a:hover { background: var(--hover); text-decoration: none; }
.files .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.files .w { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.files li { position: relative; }
.files li .del { position: absolute; right: -6px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: var(--bg); color: var(--muted); cursor: pointer; opacity: 0; }
.files li:hover .del, .files li .del:focus-visible { opacity: 1; }
.files li .del:hover { color: var(--bad); }
@media (hover: none) { .files li .del { opacity: 1; } }
.files .add-file { margin-top: 8px; padding: 5px 10px; border: 1px dashed var(--line); border-radius: 6px; background: none; color: var(--muted); font-size: 13px; width: 100%; }
.files .add-file:hover { color: var(--fg); border-color: var(--muted); }
#doc a.file, .shared a.file, .kb-visual a[href*=".files/"]:not(:has(img), .kb-embed-tool) { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-soft); color: var(--fg); text-decoration: none; }
#doc a.file::before, .shared a.file::before, .kb-visual a[href*=".files/"]:not(:has(img), .kb-embed-tool)::before { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; opacity: .6; -webkit-mask: var(--clip) center / contain no-repeat; mask: var(--clip) center / contain no-repeat; }
#doc a.file:hover, .shared a.file:hover, .kb-visual a[href*=".files/"]:not(.kb-embed-tool):hover { border-color: var(--muted); }

/* Attachments shown in the page (![](x.pdf)) and image sizes: the title
   "small", "medium" or "full" of the markdown image. */
.kb-embed { display: block; }
.kb-embed > img { display: block; max-width: 100%; }
.kb-embed[class*="kb-size-"] > img { width: 100%; }
.kb-embed iframe, .kb-embed video { display: block; width: 100%; max-height: 85vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kb-embed.kb-pdf iframe { aspect-ratio: 3 / 4; }
.kb-embed.kb-html iframe { aspect-ratio: 16 / 10; }
.kb-embed video { background: #000; }
.kb-embed audio { display: block; width: 100%; }
.kb-embed > a.file { margin-top: 6px; font-size: .85em; }
.kb-embed { position: relative; }
/* Under the frame on the right, clear of the PDF viewer's own toolbar;
   the download chip, when there is one, sits on the left. */
.kb-embed:has(> .kb-embed-tools):not(:has(> a.file)) { padding-bottom: 34px; }
.kb-embed:has(> .kb-embed-tools) > a.file { min-height: 28px; }
.kb-embed-tools { position: absolute; right: 0; bottom: 0; display: flex; gap: 2px; }
.kb-embed-tool { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; text-decoration: none; }
.kb-embed-tool:hover { color: var(--fg); background: var(--bg-soft); border-color: var(--line); }
.kb-embed-modal .kb-embed-tool { color: #fff; }
.kb-embed-modal .kb-embed-tool:hover { background: rgb(255 255 255 / .12); border-color: transparent; }
.kb-embed-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-embed-modal { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: rgb(0 0 0 / .92); }
.kb-embed-modal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; font-size: 14px; }
.kb-embed-modal-bar .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-embed-modal iframe, .kb-embed-modal video { flex: 1; width: 100%; min-height: 0; border: 0; border-radius: 8px; background: #fff; }
.kb-embed-modal video { background: #000; }
.kb-embed.kb-size-small { width: 33%; min-width: 220px; }
.kb-embed.kb-size-medium { width: 66%; min-width: 280px; }
.kb-embed.kb-pdf.kb-size-small iframe, .kb-embed.kb-html.kb-size-small iframe { aspect-ratio: 4 / 3; }
img.kb-size-small { width: 33%; }
img.kb-size-medium { width: 66%; }
img.kb-size-full { width: 100%; }
.kb-visual .kb-embed a.file { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-soft); color: var(--fg); text-decoration: none; }
.kb-visual .ProseMirror-selectednode.kb-embed, .kb-visual img.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
@media (max-width: 640px) { .kb-embed.kb-size-small, .kb-embed.kb-size-medium, img.kb-size-small, img.kb-size-medium { width: 100%; min-width: 0; } }
:root { --clip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551'/%3E%3C/svg%3E"); }

/* Profil a Nastavení: pracovní stránky, hustší než text wiki. */
#page.app { max-width: 820px; font-size: 14.5px; }
#page.app > h1 { font-size: 1.9rem; margin: 0 0 18px; }
#page.app > h1::after { margin-top: 10px; }
#page.app h2 { font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.4; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
#page.app p { margin: 0 0 10px; }
#page.app .lead { margin-bottom: 16px; font-size: 13.5px; }
#page.app .panel { margin: 0 0 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
#page.app .panel > .muted { font-size: 13.5px; }
#page.app .panel > :last-child { margin-bottom: 0; }
#page.app .count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--bg-soft); color: var(--muted); font-size: 12px; font-weight: 500; text-align: center; }
#page.app .tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
#page.app .tabs a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; text-decoration: none; }
#page.app .tabs a[aria-current] { border-bottom-color: var(--accent); color: var(--fg); font-weight: 500; }
#page.app .rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 10px 0 12px; }
#page.app .rows dt { color: var(--muted); }
#page.app .rows dd { margin: 0; }
#page.app a .i { margin-right: 6px; vertical-align: -2px; }
.app .choice { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.app .choice label { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; }
.app .choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.app .choice + .muted { font-size: 13px; margin: 0; }
.help section { margin: 28px 0; }
.help dt { font-weight: 600; margin-top: 12px; }
.help dd { margin: 4px 0 0; }

/* Lidé a skupiny */
.people .entry-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
#page.people .entries { display: contents; list-style: none; margin: 0; padding: 0; }
#page.people .entries li { margin: 0; display: inline-flex; align-items: center; gap: 2px; padding: 1px 3px 1px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg-soft); font-size: 13px; line-height: 22px; }
.people .entries li:not(:has(button)) { padding-right: 9px; }
.people .entries button { padding: 2px; border-radius: 99px; }
.people .entries .i { width: 13px; height: 13px; }
.people .add-entry { display: contents; }
.people form input { min-width: 0; height: 26px; padding: 0 10px; border: 1px dashed var(--line); border-radius: 99px; background: transparent; color: var(--fg); font: inherit; font-size: 13px; }
.people .add-entry input { width: 230px; }
.people form input:focus { outline: none; border-style: solid; border-color: var(--accent); }
.people .groups { margin-top: 10px; border-top: 1px solid var(--line); }
.people .group { display: grid; grid-template-columns: 170px 1fr auto; gap: 4px 14px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people .group .entry-box { margin-top: 0; }
.people .group-name { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.people .group-name strong { font-weight: 600; }
.people .uses { font-size: 12.5px; overflow-wrap: anywhere; }
#page.people .uses a { color: inherit; }
.people .del { padding: 4px; color: var(--muted); }
.people .del[data-uses] { opacity: .45; }
.people .new-group { display: flex; gap: 8px; margin-top: 12px; }
.people .new-group input { flex: 1; max-width: 320px; height: 32px; border-radius: 8px; }
@media (max-width: 640px) { .people .group { grid-template-columns: 1fr auto; } .people .group .entry-box { grid-column: 1 / -1; grid-row: 2; } }
