/* ASD – ruhiges Werkzeug-Design: dunkle Seitenleiste, Papier-Fläche, violett = Claude */
:root {
  --bg: #fbfaf8; --panel: #f3f1ed; --panel-2: #ebe8e2; --line: #e0dcd4; --text: #23262b; --muted: #7b7f86;
  --accent: #1971c2; --accent-soft: #e3effa; --claude: #7048e8; --claude-soft: #efeafe; --danger: #d6336c;
  --side: #1d2025; --side-text: #c9cdd3; --side-muted: #7e858f; --side-hover: #2a2e35; --side-active: #343944;
  --grid: rgba(35, 38, 43, 0.09); --canvas: #fdfcfa; --shadow: 0 8px 28px rgba(20, 22, 26, 0.12), 0 1px 3px rgba(20, 22, 26, 0.08);
  --mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1d21; --panel: #22252a; --panel-2: #2a2e34; --line: #33373e; --text: #e4e6e9; --muted: #8b9098;
  --accent: #4dabf7; --accent-soft: #1d3247; --claude: #9775fa; --claude-soft: #2a2343; --danger: #f06595;
  --side: #141619; --side-text: #c9cdd3; --side-muted: #6f7680; --side-hover: #1f2226; --side-active: #2a2e35;
  --grid: rgba(228, 230, 233, 0.07); --canvas: #1b1d21; --shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
code { font-family: var(--mono); font-size: 0.88em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.55; }

/* Buttons & Inputs */
.btn { background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.btn:hover { opacity: 0.88; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; color: inherit; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel-2); opacity: 1; }
.btn.danger { background: var(--danger); color: #fff; }
.input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.input.big { font-size: 18px; padding: 14px 16px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); position: relative; font-size: 16px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn .count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--claude); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.icon-btn .count:empty { display: none; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--side); }
.login-card { width: min(340px, 90vw); display: grid; gap: 12px; padding: 32px; border-radius: 16px; background: var(--bg); box-shadow: var(--shadow); }
.login-card .brand { color: var(--text); }
.err { color: var(--danger); min-height: 1em; margin: 0; font-size: 13px; }

/* Layout */
.app { display: grid; grid-template-columns: 264px 1fr 0; height: 100dvh; transition: grid-template-columns 0.2s ease; }
body.comments-open .app { grid-template-columns: 264px 1fr 340px; }

/* Seitenleiste */
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; min-height: 0; padding: 12px 10px; gap: 8px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: var(--side-text); }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 750; letter-spacing: 0.06em; font-size: 15px; }
.brand.big { font-size: 26px; }
.logo { color: var(--claude); font-size: 1.2em; }
.live { color: var(--claude); opacity: 0; transition: opacity 0.3s; font-size: 13px; }
.live.on { opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.search-btn { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--side-hover); color: var(--side-muted); font-size: 13.5px; }
.search-btn:hover { color: var(--side-text); }
.side-scroll { flex: 1; overflow: auto; margin: 0 -4px; padding: 0 4px 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--side-muted); padding: 14px 6px 4px 8px; border-radius: 6px; }
.section-head.drop, .project-row.drop { outline: 1.5px dashed var(--claude); outline-offset: -1px; background: var(--side-hover); }
.row-btn { width: 22px; height: 22px; border-radius: 6px; color: var(--side-muted); flex: none; font-size: 15px; line-height: 1; display: grid; place-items: center; }
.row-btn:hover { background: var(--side-active); color: #fff; }
.tree { display: grid; gap: 1px; }
#pages.drop { outline: 1.5px dashed var(--claude); border-radius: 7px; }
.project-row { display: flex; align-items: center; gap: 4px; border-radius: 7px; padding: 2px 4px 2px 0; color: var(--side-text); font-size: 14px; font-weight: 600; cursor: default; }
.project-row:hover { background: var(--side-hover); }
.project-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.project-row .ico { width: 18px; text-align: center; font-size: 13px; }
.project-row .cnt { color: var(--side-muted); font-size: 11px; font-weight: 500; }
.project-row .row-btn { opacity: 0; }
.project-row:hover .row-btn { opacity: 1; }
.project-pages { position: relative; margin-left: 13px; padding-left: 6px; border-left: 1px solid #2f343c; }
.empty-row { color: var(--side-muted); font-size: 12.5px; padding: 4px 8px; font-style: italic; }
.tree-item { display: flex; align-items: center; border-radius: 7px; position: relative; padding-left: 6px; }
.tree-item:hover { background: var(--side-hover); }
.tree-item.active { background: var(--side-active); }
.tree-item.active .tree-link { color: #fff; }
.twisty { width: 20px; height: 26px; display: grid; place-items: center; color: var(--side-muted); flex: none; }
.twisty svg { transition: transform 0.15s; }
.twisty.open svg { transform: rotate(90deg); }
.tree-link { flex: 1; display: flex; align-items: center; gap: 7px; padding: 4px 6px 4px 0; color: var(--side-text); min-width: 0; font-size: 14px; }
.tree-link .ico { width: 18px; text-align: center; flex: none; opacity: 0.8; font-size: 13px; }
.tree-link .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-link .mixed { font-size: 10px; color: var(--side-muted); }
.badge { margin-left: auto; background: var(--claude); color: #fff; border-radius: 9px; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; }
.side-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-top: 1px solid #2a2e35; padding-top: 8px; }
.foot-btn { text-align: left; padding: 7px 8px; border-radius: 7px; color: var(--side-muted); font-size: 13px; }
.foot-btn:hover, .foot-btn.active { background: var(--side-hover); color: var(--side-text); }

/* Hauptbereich */
.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.page-head { padding: 12px 28px 0; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 3; }
.page-head:not(:has(.tabbar)) { padding-bottom: 10px; }
.small-note { font-size: 13px; margin-left: 8px; }
.tabbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 6px; }
.tabs { display: flex; align-items: flex-end; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 8px; border-radius: 9px 9px 0 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; position: relative; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.on { color: var(--text); background: var(--bg); border-color: var(--line); font-weight: 600; }
.tab.on::after { content: ''; position: absolute; left: 10px; right: 10px; top: -1px; height: 2px; border-radius: 2px; background: var(--claude); }
.tab .ti { font-size: 12px; opacity: 0.75; }
.tab .tab-menu { font-size: 10px; color: var(--muted); padding: 0 2px; border-radius: 4px; }
.tab .tab-menu:hover { background: var(--panel-2); color: var(--text); }
.tab.add { color: var(--muted); padding: 6px 10px 8px; font-size: 15px; }
.tab-input { font: inherit; font-weight: 600; border: 0; outline: 1.5px solid var(--accent); border-radius: 4px; background: var(--bg); color: var(--text); padding: 0 4px; }
.tabbar .seg { margin: 0 0 6px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chips .anchor { margin: 0; }
.tab-chip { font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 6px; padding: 2px 8px; }
.tab-chip:hover { color: var(--text); }
.graph-host { position: absolute; inset: 0; background: var(--canvas); overflow: hidden; touch-action: none; }
.graph-canvas { display: block; }
.graph-legend { position: absolute; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; max-width: 60%; }
.graph-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.graph-legend i.loose { background: #6c737c; }
.graph-tools { position: absolute; right: 14px; top: 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--muted); }
.graph-tools .chip { padding: 3px 9px; border-radius: 6px; background: var(--panel); color: var(--text); }
.embed.broken img { display: none; }
.embed.broken::before { content: 'Kein Canvas-Tab gefunden'; display: block; padding: 20px; color: var(--muted); font-size: 13px; }
.qs-res em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.crumbs { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sl { margin: 0 6px; opacity: 0.5; }
.head-row { display: flex; align-items: center; gap: 10px; }
.page-icon { font-size: 22px; width: 40px; height: 40px; color: var(--text); }
.title { flex: 1; min-width: 0; font: 700 26px/1.2 var(--sans); letter-spacing: -0.015em; border: 0; background: transparent; color: var(--text); padding: 4px 0; outline: none; margin: 0; }
.title:focus { box-shadow: 0 2px 0 var(--accent); }
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.head-actions { display: flex; align-items: center; gap: 4px; }
.seg { display: inline-flex; background: var(--panel); border-radius: 9px; padding: 3px; margin-right: 6px; }
.seg button { padding: 4px 10px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.page-body { flex: 1; min-height: 0; position: relative; }

/* Dokumente */
.page-body { overflow: hidden; }
.page-body.doc { display: grid; grid-template-columns: 1fr 1fr; }
.page-body.doc[data-mode="edit"] { grid-template-columns: 1fr; }
.page-body.doc[data-mode="edit"] .doc-read { display: none; }
.page-body.doc[data-mode="read"] { grid-template-columns: 1fr; }
.page-body.doc[data-mode="read"] .doc-edit { display: none; }
.doc-edit { position: relative; border-right: 1px solid var(--line); min-height: 0; background: var(--panel); }
.doc-edit textarea { width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 28px 32px 40vh; background: transparent; color: var(--text); font: 14.5px/1.7 var(--mono); tab-size: 2; }
.page-body[data-mode="edit"] .doc-edit textarea { max-width: 860px; margin: 0 auto; display: block; }
.page-body[data-mode="edit"] .doc-edit { background: var(--bg); }
.doc-read { overflow: auto; min-height: 0; }
.trash { max-width: 860px; margin: 0 auto; padding: 24px 32px; }
.trash-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trash-item span:first-child { flex: 1; }
.ac { position: absolute; left: 24px; bottom: 16px; width: min(380px, 80%); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; z-index: 5; }
.ac button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 14px; }
.ac button.on, .ac button:hover { background: var(--accent-soft); }

/* Markdown */
.md { max-width: 760px; margin: 0 auto; padding: 28px 40px 24px; font: 16.5px/1.7 var(--serif); }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--sans); letter-spacing: -0.01em; line-height: 1.25; margin: 1.6em 0 0.5em; }
.md h1 { font-size: 1.75em; } .md h2 { font-size: 1.35em; padding-bottom: 0.2em; border-bottom: 1px solid var(--line); } .md h3 { font-size: 1.12em; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0.7em 0; }
.md ul, .md ol { padding-left: 1.5em; margin: 0.5em 0; }
.md li { margin: 0.2em 0; }
.md li.task { list-style: none; margin-left: -1.4em; }
.md li.task input { margin-right: 6px; accent-color: var(--claude); transform: translateY(1px); }
.md li.task.done > span { color: var(--muted); text-decoration: line-through; }
.md code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--panel); border: 1px solid var(--line); padding: 14px 16px; border-radius: 10px; overflow: auto; font-size: 13.5px; line-height: 1.55; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0.8em 0; padding: 0.1em 1em; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.md img { max-width: 100%; border-radius: 8px; }
.md mark { background: #ffec99; color: inherit; padding: 0 2px; border-radius: 3px; }
:root[data-theme="dark"] .md mark { background: #5c4a00; }
.md mark.cmark { background: var(--claude-soft); border-bottom: 2px solid var(--claude); cursor: pointer; }
.md .table-wrap { overflow-x: auto; }
.md table { border-collapse: collapse; font: 14px/1.5 var(--sans); margin: 1em 0; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; }
.md th { background: var(--panel); text-align: left; }
.md .tag { color: var(--claude); font: 600 0.85em var(--sans); }
.wikilink { color: var(--claude); font-family: var(--sans); font-size: 0.95em; font-weight: 550; border-bottom: 1px solid color-mix(in srgb, var(--claude) 35%, transparent); }
.wikilink.missing { color: var(--muted); border-bottom-style: dashed; }
.callout { border-radius: 10px; padding: 10px 16px; margin: 1em 0; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.callout-title { font: 650 14px var(--sans); margin-bottom: 4px; }
.callout-warning, .callout-caution { background: #fff4e6; border-color: #e8590c; }
.callout-tip, .callout-success { background: #ebfbee; border-color: #2f9e44; }
:root[data-theme="dark"] .callout-warning { background: #3a2a14; } :root[data-theme="dark"] .callout-tip { background: #183020; }
.embed-block { margin: 1.2em 0; }
.embed { display: block; position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--canvas); }
.embed img { display: block; width: 100%; max-height: 480px; object-fit: contain; border-radius: 0; }
.embed-label { position: absolute; left: 10px; bottom: 8px; font: 600 12px var(--sans); background: var(--bg); color: var(--muted); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); }
.embed:hover { border-color: var(--claude); }
.backlinks { max-width: 760px; margin: 0 auto 60px; padding: 0 40px; }
.backlinks h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 0 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.backlinks .bl { display: inline-block; margin: 0 8px 6px 0; padding: 3px 10px; border-radius: 6px; background: var(--panel); font-size: 13.5px; color: var(--text); }

/* Canvas */
.page-body.canvas { overflow: hidden; }
.canvas-host { position: absolute; inset: 0; }
.cv { background-color: var(--canvas); background-image: radial-gradient(circle, var(--grid) 1.2px, transparent 1.3px); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.cv-svg { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; touch-action: none; }
.cv-pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; pointer-events: auto; transform: translate(-30%, -70%); min-width: 24px; height: 24px; border-radius: 12px 12px 12px 2px; background: var(--accent); color: #fff; font: 700 11px var(--sans); box-shadow: var(--shadow); padding: 0 6px; }
.pin.claude { background: var(--claude); }
.cv-toolbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 2; }
.cv-toolbar button { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); position: relative; }
.cv-toolbar button:hover { background: var(--panel-2); color: var(--text); }
.cv-toolbar button.active { background: var(--accent-soft); color: var(--accent); }
.cv-toolbar kbd { position: absolute; right: 2px; bottom: 1px; border: 0; font-size: 9px; padding: 0; opacity: 0.5; }
.cv-style { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; max-width: calc(100% - 28px); overflow-x: auto; scrollbar-width: none; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 5px 8px; z-index: 2; font-size: 12.5px; white-space: nowrap; }
.cv-style .row { display: flex; gap: 3px; align-items: center; flex: none; }
.cv-style .row + .row { border-left: 1px solid var(--line); padding-left: 7px; margin-left: 4px; }
.cv-style .lbl { display: none; }
.cv-style .sw { width: 20px; height: 20px; border-radius: 6px; background: var(--c); border: 2px solid transparent; outline: 1px solid var(--line); flex: none; }
.cv-style .sw.on { border-color: var(--bg); outline: 2px solid var(--c); }
.cv-style .chip { padding: 2px 7px; border-radius: 6px; background: var(--panel); min-width: 28px; height: 26px; display: inline-grid; place-items: center; }
.cv-style .chip.on { background: var(--accent-soft); color: var(--accent); }
.cv-style .chip:hover { background: var(--panel-2); }
.cv-style .chip.danger:hover { background: var(--danger); color: #fff; }
.cv-style .meta { color: var(--muted); font-size: 11.5px; flex: none; border-left: 1px solid var(--line); padding-left: 8px; margin-left: 4px; }
.cv-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 2; font-size: 13px; }
.cv-zoom button { min-width: 32px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); padding: 0 6px; }
.cv-zoom button:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.cv-zoom button:disabled { opacity: 0.35; cursor: default; }
.cv-zoom .zoomlabel { min-width: 52px; font-variant-numeric: tabular-nums; }
.cv-zoom .sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
.cv-zoom .claude-toggle { font-weight: 600; }
.cv-zoom .claude-toggle.on { color: var(--claude); background: var(--claude-soft); }
.cv-textedit { position: absolute; z-index: 4; border: 0; outline: 2px solid var(--accent); border-radius: 4px; background: transparent; resize: none; overflow: hidden; padding: 4px; font-family: var(--sans); line-height: 1.3; color: var(--text); min-width: 40px; }
.cv-textedit.t-note { padding: 12px; }
.cv-textedit.t-arrow, .cv-textedit.t-line { background: var(--bg); }

/* Kommentare */
.comments { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.comments-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.comments-list { flex: 1; overflow: auto; padding: 10px; }
.thread { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; transition: box-shadow 0.2s, border-color 0.2s; }
.thread.by-claude { border-left: 3px solid var(--claude); }
.thread.resolved { opacity: 0.65; }
.thread.related, .thread.flash { border-color: var(--claude); box-shadow: 0 0 0 3px var(--claude-soft); }
.msg + .msg { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.who { font-weight: 700; }
.who.claude { color: var(--claude); }
.time { color: var(--muted); }
.mini { margin-left: auto; color: var(--muted); font-size: 11px; opacity: 0; }
.msg:hover .mini { opacity: 1; }
.msg-body { font-size: 14px; }
.msg-body p { margin: 4px 0; }
.msg-body pre { white-space: pre-wrap; background: var(--panel); padding: 6px 8px; border-radius: 6px; font-size: 12.5px; }
.anchor { font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; margin-bottom: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anchor-quote { margin: 0 0 6px; padding: 2px 8px; border-left: 3px solid var(--claude); color: var(--muted); font-size: 12.5px; font-style: italic; }
.thread-actions { display: flex; gap: 6px; margin-top: 6px; }
.mini-btn { font-size: 12px; color: var(--muted); padding: 2px 6px; border-radius: 5px; }
.mini-btn:hover { background: var(--panel-2); color: var(--text); }
.reply textarea, .composer textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 14px/1.45 var(--sans); background: var(--bg); color: var(--text); resize: vertical; outline: none; }
.reply textarea:focus, .composer textarea:focus { border-color: var(--accent); }
.reply .row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.done-list summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 4px; }
.composer { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; background: var(--panel); }
.composer .btn { justify-self: end; }
.chip-anchor { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--claude-soft); color: var(--claude); padding: 3px 4px 3px 9px; border-radius: 6px; max-width: 100%; }
.chip-anchor button { color: inherit; font-size: 11px; padding: 0 4px; }
.quote-btn { position: fixed; z-index: 30; background: var(--text); color: var(--bg); padding: 6px 12px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }

/* Popup, Modal, Toasts */
.popup { position: fixed; z-index: 40; min-width: 210px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; max-height: 70vh; overflow: auto; }
.popup button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 14px; color: var(--text); }
.popup button:hover { background: var(--panel-2); }
.popup hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 17, 20, 0.45); display: grid; place-items: start center; padding: 12vh 16px 16px; backdrop-filter: blur(2px); }
.modal-card { width: min(620px, 100%); background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 22px; max-height: 76vh; overflow: auto; }
.modal-card h3 { margin: 0 0 12px; }
.modal-card h4 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.modal-card pre { background: var(--panel); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.qs-res { margin-top: 8px; max-height: 50vh; overflow: auto; }
.qs-res a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); }
.qs-res a.on, .qs-res a:hover { background: var(--accent-soft); }
.qs-res small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rev-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 12px; }
.rev-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.rev-list button { display: block; width: 100%; text-align: left; padding: 6px 8px; border-radius: 7px; font-size: 13px; }
.rev-list button.on, .rev-list button:hover { background: var(--panel-2); }
.rev-list small { display: block; color: var(--muted); }
.rev-preview { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: tin 0.2s ease-out; transition: opacity 0.4s, transform 0.4s; }
.toast.claude { background: var(--claude); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: #e8590c; color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.empty { margin: auto; text-align: center; padding: 40px; }
.empty .row { display: flex; gap: 10px; justify-content: center; }
.nav-toggle, .scrim { display: none; }

/* Mobil */
@media (max-width: 900px) {
  .app, body.comments-open .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform 0.2s; }
  body.nav-open .sidebar { transform: none; }
  .comments { position: fixed; inset: auto 0 0 0; height: 72dvh; z-index: 30; border-radius: 16px 16px 0 0; transform: translateY(100%); transition: transform 0.2s; border: 1px solid var(--line); }
  body.comments-open .comments { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 25; }
  body.nav-open .scrim, body.comments-open-mobile .scrim { display: block; }
  .nav-toggle { display: grid; place-items: center; position: fixed; top: 12px; left: 10px; width: 38px; height: 38px; border-radius: 9px; background: var(--panel); z-index: 20; font-size: 18px; }
  .page-head { padding: 10px 12px 0 56px; }
  .tabbar { margin-left: -44px; }
  .graph-legend { max-width: calc(100% - 28px); }
  .title { font-size: 20px; }
  .page-icon { display: none; }
  .seg span, .hide-mobile { display: none; }
  .md { padding: 18px 18px 24px; font-size: 16px; }
  .doc-edit textarea { padding: 18px 16px 40vh; }
  .backlinks { padding: 0 18px; }
  .cv-toolbar { top: auto; bottom: 12px; max-width: calc(100% - 20px); overflow-x: auto; }
  .cv-toolbar kbd { display: none; }
  .cv-zoom { bottom: auto; top: 10px; right: 10px; }
  .cv-style { top: auto; bottom: 66px; }
  .rev-wrap { grid-template-columns: 1fr; }
}
