:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --panel-2: #f1efe8;
  --border: #e3e0d6;
  --text: #24221f;
  --muted: #7a766d;
  --accent: #c2613f;
  --accent-soft: #f6e3da;
  --user-bg: #efece3;
  --link: #2f6fb3;
  --add-bg: #e6f4ea;
  --add-fg: #1f6b35;
  --del-bg: #fdecea;
  --del-fg: #a3271c;
  --hunk: #6a5acd;
  --code-bg: #f6f8fa;
  --mark: #ffe58a;
  --mark-cur: #ff9f43;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --cat-shell: #3b82f6;
  --cat-edit: #16a34a;
  --cat-read: #8b5cf6;
  --cat-search: #0891b2;
  --cat-agent: #db2777;
  --cat-ask: #d97706;
  --cat-todo: #65a30d;
  --cat-web: #0ea5e9;
  --cat-mcp: #a855f7;
  --cat-other: #6b7280;
  --chat-bg: #efeae2;
  --bubble-user: #d9fdd3;
  --bubble-user-border: #c3e8bb;
  --bubble-ai: #ffffff;
  --bubble-time: #8696a0;
  --notice-bg: #fff6d9;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, Menlo, monospace;
  --sans: -apple-system, "Segoe UI", system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  --topbar-h: 52px;
}

[data-theme="dark"] {
  --bg: #1c1b19;
  --panel: #262523;
  --panel-2: #2e2d2a;
  --border: #3a3935;
  --text: #e9e6df;
  --muted: #9b968b;
  --accent: #e07a55;
  --accent-soft: #3d2a22;
  --user-bg: #32302c;
  --link: #6aa9ef;
  --add-bg: #17331f;
  --add-fg: #7ee09a;
  --del-bg: #3d1a17;
  --del-fg: #ff9b90;
  --hunk: #a99cf2;
  --code-bg: #161b22;
  --mark: #7a6420;
  --mark-cur: #c26b1a;
  --shadow: none;
  --chat-bg: #0b141a;
  --bubble-user: #005c4b;
  --bubble-user-border: #005c4b;
  --bubble-ai: #202c33;
  --bubble-time: #8696a0;
  --notice-bg: #182229;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); }
body { display: flex; min-height: 100vh; }
.app { flex: 1; min-width: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--accent); white-space: nowrap; }
.session-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { display: flex; align-items: center; gap: 4px; }
.search input {
  width: 240px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 13px;
}
.search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-count { font-size: 12px; color: var(--muted); min-width: 56px; text-align: right; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.toggle { font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; color: var(--muted); }
.btn, .icon-btn {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.icon-btn { padding: 4px 8px; }
.btn:hover, .icon-btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--del-fg); }
.btn.danger:hover { background: var(--del-bg); }
.no-session .search, .no-session #btn-expand, .no-session .toggle { display: none; }

/* ------------------------------------------------------------------ files panel */

.files-panel {
  position: sticky; top: 0; align-self: flex-start;
  width: 270px; height: 100vh; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--panel-2); border-right: 1px solid var(--border);
  font-size: 13px;
}
.files-collapsed .files-panel { display: none; }
.files-head {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.files-heading { font-weight: 700; }
.files-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.files-controls input, .files-controls select {
  width: 100%; padding: 6px 10px; border-radius: 8px; font: inherit;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.files-controls input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.files-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.files-buttons .btn { padding: 5px 4px; font-size: 12px; }
.files-buttons .btn[hidden] { display: none; }
.file-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.files-empty { color: var(--muted); padding: 12px 6px; line-height: 1.5; }
.file-item {
  position: relative; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border);
}
.file-item:hover { border-color: var(--muted); }
.file-item:focus-visible { outline: 2px solid var(--accent); }
.file-item.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.file-row { display: flex; align-items: flex-start; gap: 6px; }
.file-title {
  flex: 1; min-width: 0; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.file-close {
  flex-shrink: 0; width: 20px; height: 20px; padding: 0; line-height: 18px; border-radius: 4px;
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; opacity: 0;
}
.file-item:hover .file-close, .file-item.active .file-close { opacity: 1; }
.file-close:hover { background: var(--del-bg); color: var(--del-fg); }
.file-sub { margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { margin-top: 4px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; }
.file-meta .chip { font-size: 10px; line-height: 16px; padding: 0 6px; }
.file-hits {
  margin-top: 6px; padding-top: 5px; border-top: 1px dashed var(--border);
  font-size: 12px; font-weight: 600; color: var(--accent);
}
.file-hits.muted { color: var(--muted); font-weight: 400; }
.files-search-status { font-size: 12px; color: var(--muted); }
.files-search-status[hidden] { display: none; }

/* ------------------------------------------------------------------ layout */

.layout { display: flex; }
.sidebar {
  position: sticky; top: var(--topbar-h);
  width: 280px; flex-shrink: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px 24px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
}
.no-session .sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 24px 24px 120px; background: var(--chat-bg); min-height: calc(100vh - var(--topbar-h)); }
.no-session .main { background: var(--bg); }
.conversation { max-width: 1040px; margin: 0 auto; }

.info-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.info-badges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.info-row { display: flex; gap: 8px; padding: 2px 0; }
.info-label { width: 72px; flex-shrink: 0; color: var(--muted); }
.info-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-head { margin: 18px 0 6px; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.outline { display: flex; flex-direction: column; gap: 1px; }
.outline-item { display: flex; gap: 8px; padding: 5px 8px; border-radius: 6px; color: var(--text); }
.outline-item:hover { background: var(--panel-2); text-decoration: none; }
.outline-item.active { background: var(--accent-soft); }
.o-idx { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.o-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ welcome */

.welcome { display: none; }
.no-session .welcome { display: flex; justify-content: center; padding-top: 12vh; }
.drop-card {
  max-width: 640px; padding: 32px 36px; border: 2px dashed var(--border); border-radius: 16px; background: var(--panel);
}
.drop-card h1 { margin-top: 0; font-size: 24px; }
.drop-overlay {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--accent);
  border: 4px dashed var(--accent);
}
.dragging .drop-overlay { display: flex; }

/* ------------------------------------------------------------------ messages */

.msg { display: flex; gap: 10px; margin: 18px 0; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; margin-top: 2px;
}
.avatar.user { background: #5b6170; }
.avatar.assistant { background: var(--accent); }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg.user .msg-main { align-items: flex-end; }
.msg-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 4px; font-size: 12px; color: var(--muted); }
.msg-head .who { color: var(--text); }
.who { font-weight: 700; }
.idx { color: var(--muted); }
.time { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.chip {
  display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 11px; line-height: 18px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.chip.model { color: var(--accent); }
.chip.claude { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.cursor { background: #e0e7ff; color: #3730a3; border-color: transparent; }
.chip.copilot { background: #dcfce7; color: #166534; border-color: transparent; }

.bubble {
  position: relative; min-width: 120px; max-width: 100%;
  padding: 8px 12px 6px; border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
.bubble::before {
  content: ""; position: absolute; top: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 10px 10px 0;
}
.msg.user .bubble {
  max-width: 78%; background: var(--bubble-user); border-top-right-radius: 0;
}
.msg.user .bubble::before { right: -9px; border-width: 0 0 10px 10px; border-color: transparent transparent transparent var(--bubble-user); }
.msg.assistant .bubble {
  width: fit-content; max-width: 88%; background: var(--bubble-ai); border-top-left-radius: 0;
}
.msg.assistant .bubble::before { left: -9px; border-color: transparent var(--bubble-ai) transparent transparent; }
.bubble-time {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 4px; font-size: 11px; color: var(--bubble-time); white-space: nowrap;
}
.turn-dur::before { content: "⏱ "; }
[data-theme="dark"] .msg.user .bubble { color: #e9edef; }
[data-theme="dark"] .msg.user .bubble .md code { background: rgba(0, 0, 0, .25); }
.command { font-family: var(--mono); font-size: 13px; }
.cmd-name { color: var(--accent); font-weight: 700; }
.sidechain { border-left: 3px solid var(--cat-agent); padding-left: 10px; }

.turn-body > * + * { margin-top: 8px; }
.msg.user .md code { background: rgba(0, 0, 0, .06); }

/* ------------------------------------------------------------------ markdown */

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .5em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .4em; line-height: 1.3; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.1em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.5em; margin: .4em 0; }
.md li + li { margin-top: .15em; }
.md blockquote { margin: .5em 0; padding: .2em 1em; border-left: 3px solid var(--border); color: var(--muted); }
.md code { background: var(--panel-2); padding: .1em .35em; border-radius: 4px; font-size: .88em; }
.md pre { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow: auto; }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md pre code.hljs { padding: 0; background: transparent; }
.md table { border-collapse: collapse; margin: .6em 0; display: block; overflow-x: auto; font-size: 14px; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.md img { max-width: 100%; }

/* ------------------------------------------------------------------ tools */

.tool-group { display: flex; flex-direction: column; gap: 4px; }
.bubble .tool { background: color-mix(in srgb, var(--bubble-ai) 94%, var(--text)); box-shadow: none; }
.tool, .ctx, .thinking {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow);
}
.tool > summary, .ctx > summary, .thinking > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; font-size: 13px; min-width: 0;
}
.tool > summary::-webkit-details-marker, .ctx > summary::-webkit-details-marker, .thinking > summary::-webkit-details-marker { display: none; }
.tool > summary::before, .ctx > summary::before, .thinking > summary::before {
  content: "▸"; color: var(--muted); font-size: 11px; transition: transform .12s; flex-shrink: 0;
}
.tool[open] > summary::before, .ctx[open] > summary::before, .thinking[open] > summary::before { transform: rotate(90deg); }
.tool > summary:hover { background: var(--panel-2); border-radius: 10px; }
.tool[open] > summary { border-bottom: 1px solid var(--border); }
.tool-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--cat-other); }
.cat-shell .tool-dot { background: var(--cat-shell); }
.cat-edit .tool-dot { background: var(--cat-edit); }
.cat-read .tool-dot { background: var(--cat-read); }
.cat-search .tool-dot { background: var(--cat-search); }
.cat-agent .tool-dot { background: var(--cat-agent); }
.cat-ask .tool-dot { background: var(--cat-ask); }
.cat-todo .tool-dot { background: var(--cat-todo); }
.cat-web .tool-dot { background: var(--cat-web); }
.cat-mcp .tool-dot { background: var(--cat-mcp); }
.tool-name { font-weight: 600; white-space: nowrap; }
.tool-sum { color: var(--muted); min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.tool-stats { display: flex; gap: 6px; font-family: var(--mono); font-size: 12px; }
.stat.add { color: var(--add-fg); }
.stat.del { color: var(--del-fg); }
.tool-status { color: var(--add-fg); font-weight: 700; }
.tool.error { border-color: color-mix(in srgb, var(--del-fg) 45%, var(--border)); }
.tool.error .tool-status { color: var(--del-fg); }
.tool-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.tool-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; word-break: break-all; }

pre.code {
  position: relative; margin: 0; max-height: 480px; overflow: auto;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  white-space: pre-wrap; word-break: break-word;
}
pre.code code.hljs { padding: 0; background: transparent; }
.copy-btn {
  position: sticky; float: right; top: 0; margin: -4px -6px 0 8px;
  font: 11px var(--sans); padding: 2px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted); opacity: 0; transition: opacity .1s;
}
pre:hover > .copy-btn { opacity: 1; }
.link-btn { margin-top: 4px; background: none; border: none; color: var(--link); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }

.diff { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diff-file { padding: 4px 10px; font-family: var(--mono); font-size: 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); word-break: break-all; }
.diff-body { margin: 0; max-height: 560px; overflow: auto; background: var(--code-bg); font-size: 12.5px; line-height: 1.5; }
.dl { display: block; padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
.dl.add { background: var(--add-bg); color: var(--add-fg); }
.dl.del { background: var(--del-bg); color: var(--del-fg); }
.dl.hunk { color: var(--hunk); background: var(--panel-2); }

.todos { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.todo-box {
  width: 16px; height: 16px; flex-shrink: 0; border: 1.5px solid var(--muted); border-radius: 4px;
  font-size: 11px; line-height: 13px; text-align: center; transform: translateY(2px);
}
.todo.completed { color: var(--muted); text-decoration: line-through; }
.todo.completed .todo-box { background: var(--cat-todo); border-color: var(--cat-todo); color: #fff; }
.todo.in_progress .todo-box { color: var(--accent); border-color: var(--accent); }
.todo.in_progress { font-weight: 600; }

.question { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.q-head { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 6px; }
.q-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.q-options li { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); }
.q-options li.chosen { border-color: var(--accent); background: var(--accent-soft); }
.q-options li.chosen .q-label::before { content: "✓ "; color: var(--accent); }
.q-label { font-weight: 600; }
.q-desc { display: block; color: var(--muted); font-size: 13px; }

.thinking > summary { color: var(--muted); font-style: italic; }
.thinking > .md { padding: 4px 14px 10px; color: var(--muted); font-size: 14px; }
.inline-img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 6px; }

/* ------------------------------------------------------------------ context */

.ctx { background: transparent; box-shadow: none; border-style: dashed; }
.ctx > summary { padding: 3px 10px; font-size: 12px; }
.ctx-label { font-weight: 600; color: var(--muted); white-space: nowrap; }
.ctx-sum { color: var(--muted); opacity: .8; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; }
.ctx > pre.code, .ctx > .code-wrap { margin: 0 10px 10px; }
.ctx-group { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ctx-group.top { margin: 8px auto; max-width: 76%; }

body:not(.show-context) .ctx,
body:not(.show-context) .ctx-group.top { display: none; }
body.hide-tools .tool { display: none; }

/* ------------------------------------------------------------------ events */

.event { margin: 14px auto; max-width: 76%; font-size: 13px; }
.event.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; max-width: 60%; }
.event.divider::before, .event.divider::after { content: ""; flex: 1; border-top: 1px dashed var(--muted); opacity: .5; }
.event.divider > span { background: var(--notice-bg); padding: 2px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.event.interrupt { color: var(--del-fg); }
.event.pr {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content;
  background: var(--notice-bg); padding: 4px 12px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.event.output { width: fit-content; min-width: 40%; }
.event.output .event-title { justify-content: center; }
.event.card {
  border: none; border-top: 3px solid var(--muted); border-radius: 8px; padding: 8px 14px;
  background: var(--notice-bg); box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.event.card.recap { border-top-color: var(--cat-ask); }
.event.card.notification { border-top-color: var(--cat-agent); }
.event.card.error { border-top-color: var(--del-fg); }
.event-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.event-details > summary { cursor: pointer; color: var(--link); font-size: 13px; }
.event-details > .md { margin-top: 6px; }
.event.output .event-title { color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------------ reload */

.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font: 600 14px var(--sans);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  transition: transform .1s, filter .1s;
}
.fab:hover { filter: brightness(1.08); transform: translateY(-1px); }
.fab-icon { display: inline-block; font-size: 18px; line-height: 1; }
.fab.spinning .fab-icon { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.no-session .fab { display: none; }

.toast {
  position: fixed; right: 24px; bottom: 80px; z-index: 30; max-width: 360px;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  background: var(--text); color: var(--bg); box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--del-fg); color: #fff; }
/* ------------------------------------------------------------------ search */

mark.hit { background: var(--mark); color: inherit; border-radius: 2px; padding: 0; }
mark.hit.current { background: var(--mark-cur); color: #000; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .sidebar { display: none; }
  .search input { width: 160px; }
}
@media (max-width: 760px) {
  .session-title, .brand { display: none; }
  .main { padding: 12px; }
  .event, .ctx-group.top { max-width: 100%; }
  .msg.user .bubble, .msg.assistant .bubble { max-width: 100%; }
  .avatar { display: none; }
}

@media print {
  .topbar, .sidebar, .files-panel, .fab { display: none; }
  .tool, .ctx { break-inside: avoid; }
}
