:root {
  --pink: #ff2d87;
  --pink-2: #ff5ca3;
  --pink-soft: rgba(255, 45, 135, .12);
  --pink-hl: rgba(255, 45, 135, .22);
  --bg: #000;
  --bg-2: #0b0b0d;
  --surface: #121215;
  --surface-2: #1a1a1f;
  --line: #26262c;
  --line-2: #34343c;
  --text: #f4f4f6;
  --text-2: #b4b4bd;
  --text-3: #7c7c87;
  --viewer-bg: #08080a;
  --shadow: 0 20px 60px rgba(0,0,0,.6);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --surface: #f4f4f6;
  --surface-2: #ececf0;
  --line: #e6e6ea;
  --line-2: #d6d6dc;
  --text: #0b0b0d;
  --text-2: #4a4a55;
  --text-3: #8a8a95;
  --viewer-bg: #eeeef1;
  --pink: #e8106f;
  --pink-soft: rgba(232, 16, 111, .08);
  --pink-hl: rgba(255, 45, 135, .2);
  --shadow: 0 20px 50px rgba(20,20,30,.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14.5px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .88em; }
[hidden] { display: none !important; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; border-radius: 10px; }
.brand:hover .brand-title { color: var(--pink); }
.brand:hover .brand-title em { color: inherit; }
.mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none; height: 34px;
  color: var(--pink); font-weight: 800; font-size: 36px; line-height: 1; letter-spacing: -.02em;
  transform: translateY(-1px);
}
.brand-title { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand-title em { font-style: normal; color: var(--pink); }
.source-chip {
  margin-left: 8px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2);
  max-width: 460px; min-width: 0; color: var(--text-2); transition: border-color .15s;
}
.source-chip:hover { border-color: var(--line-2); color: var(--text); }
.source-chip #sourceName { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chip .sep { width: 1px; height: 14px; background: var(--line-2); }
.muted { color: var(--text-3); white-space: nowrap; }
.sync-badge {
  font-size: 12px; color: var(--pink); display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.sync-badge::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--pink); border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: transparent; border: 0; color: var(--text-2); text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; font-size: 17px; }
.icon-btn.spinning .ico { animation: spin 1s linear infinite; }
/* theme button: shows the chosen mode (auto / light / dark) */
#themeBtn .ico { display: none; }
:root[data-theme-mode="auto"] #themeBtn .auto,
:root[data-theme-mode="light"] #themeBtn .sun,
:root[data-theme-mode="dark"] #themeBtn .moon { display: block; }
:root[data-theme-mode="auto"] #themeBtn { color: var(--pink); }
.account { background: none; border: 0; padding: 0 0 0 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; border: 1px solid var(--line-2);
}
.avatar.on { background: var(--pink); color: #000; border-color: transparent; }

/* ---------- split ---------- */
.split { flex: 1; display: flex; min-height: 0; }
.chat-pane { flex: 0 1 var(--chat-w, 46%); min-width: 340px; display: flex; flex-direction: column; min-height: 0; }
.gutter { width: 6px; flex: none; cursor: col-resize; position: relative; background: var(--bg); }
.gutter::after { content: ""; position: absolute; inset: 0 2px; background: var(--line); transition: background .15s; }
.gutter:hover::after, .gutter.drag::after { background: var(--pink); }
.viewer-pane { flex: 1; min-width: 320px; display: flex; flex-direction: column; background: var(--viewer-bg); min-height: 0; }

/* ---------- chat ---------- */
.scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-inner { max-width: 760px; margin: 0 auto; padding: 28px 24px 24px; }
.welcome { padding: 6vh 0 12px; }
.welcome-mark { font-size: 56px; font-weight: 700; line-height: 1; color: var(--pink); margin-bottom: 14px; }
.welcome h1 { font-size: 34px; letter-spacing: -.03em; line-height: 1.1; margin: 0 0 12px; }
.lead { color: var(--text-2); font-size: 15.5px; max-width: 540px; margin: 0 0 28px; }

.connect-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden; margin-bottom: 24px; }
.step { display: flex; gap: 14px; padding: 18px; }
.step + .step { border-top: 1px solid var(--line); }
.step.done .step-num { background: var(--pink); color: #000; border-color: transparent; }
.step.done .step-num { font-size: 0; }
.step.done .step-num::after { content: "✓"; font-size: 13px; }
.step.locked { opacity: .45; pointer-events: none; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 600; margin-bottom: 2px; }
.step-text { color: var(--text-2); font-size: 13.5px; margin-bottom: 12px; }
.device-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; color: var(--text-2); font-size: 13px; }
.device-code code { font-size: 20px; letter-spacing: .12em; color: var(--text); background: var(--surface); padding: 4px 10px; border-radius: 8px; }
.folder-form { display: flex; gap: 8px; }
.folder-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg); outline: none;
}
.folder-form input:focus { border-color: var(--pink); }
.form-error { color: #ff6b6b; font-size: 13px; margin-top: 8px; }

.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--pink); color: #000;
  font-weight: 600; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
  transition: filter .15s, transform .05s;
}
:root[data-theme="light"] .btn { color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text); }
:root[data-theme="light"] .btn.ghost { color: var(--text); }
.btn.ghost:hover { border-color: var(--text-3); filter: none; }

.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.suggestion {
  text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text-2); font-size: 13.5px; transition: border-color .15s, color .15s;
}
.suggestion:hover { border-color: var(--pink); color: var(--text); }
.suggestion b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

.msg { margin: 0 0 26px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--surface-2); padding: 10px 15px; border-radius: 16px 16px 4px 16px; max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.bot .who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.msg.bot .who .dot { color: var(--pink); font-weight: 800; font-size: 17px; line-height: 1; }
.answer { word-wrap: break-word; }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p, .answer ul, .answer ol { margin: 0 0 10px; }
.answer ul, .answer ol { padding-left: 20px; }
.answer li { margin: 3px 0; }
.answer h1, .answer h2, .answer h3 { font-size: 15.5px; margin: 16px 0 6px; letter-spacing: -.01em; }
.answer strong { font-weight: 600; }
.answer table { border-collapse: collapse; margin: 8px 0 12px; font-size: 13.5px; width: 100%; display: block; overflow-x: auto; }
.answer th, .answer td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.answer th { background: var(--surface); font-weight: 600; }
.answer code { background: var(--surface); padding: 1px 5px; border-radius: 5px; }
.answer.streaming > :last-child::after {
  content: ""; display: inline-block; width: 7px; height: 15px; background: var(--pink);
  margin-left: 3px; vertical-align: -2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; gap: 5px; padding: 6px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); animation: bounce 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

.pill {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin: 0 1px;
  border-radius: 6px; background: var(--pink-soft); color: var(--pink); border: 1px solid transparent;
  font: 600 11px/1 var(--mono); vertical-align: 2px; cursor: pointer; transition: all .12s;
}
.pill:hover, .pill.active { background: var(--pink); color: #000; }
:root[data-theme="light"] .pill:hover, :root[data-theme="light"] .pill.active { color: #fff; }
.pill.demo { cursor: default; }

.sources { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.sources:empty { display: none; }
.src-toggle { align-self: flex-start; display: flex; align-items: center; gap: 8px; max-width: 100%; height: 32px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); font-size: 12.5px; cursor: pointer;
  transition: border-color .15s, color .15s; }
.src-toggle:hover, .sources.open .src-toggle { border-color: var(--pink); color: var(--text); }
.src-toggle .ico { width: 14px; height: 14px; flex: none; }
.src-toggle b { font-weight: 600; color: var(--text); }
.src-toggle .chev { transition: transform .15s; color: var(--text-3); }
.sources.open .src-toggle .chev { transform: rotate(180deg); }
.st-count { color: var(--text-3); white-space: nowrap; }
.st-names { display: flex; gap: 4px; min-width: 0; overflow: hidden; }
.st-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; padding: 1px 7px;
  border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.sources.open .st-names { display: none; }
.src-list { display: flex; flex-direction: column; gap: 4px; padding: 8px 0 2px; animation: fade .15s; }
.src-list[hidden] { display: none; }
.conv[hidden] { display: none; }
.run-pill { align-self: center; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; margin: 0 auto 8px;
  border-radius: 15px; border: 1px solid var(--pink); background: var(--pink-soft); color: var(--text); font-size: 12.5px; cursor: pointer; }
.run-pill[hidden] { display: none; }
.run-pill i, .h-item.running .h-title::before { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--pink);
  border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
.h-item.running .h-title::before { content: ""; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.h-item.unread .h-title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); margin-left: 6px; vertical-align: 1px; }
.toast-btn { margin-left: 12px; height: 26px; padding: 0 10px; border-radius: 7px; border: 0; background: var(--pink); color: #000; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.src-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 2px; }
.src-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 0; }
.src-row .src { flex: 0 1 auto; min-width: 0; }
.src-path { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-path .ico { width: 13px; height: 13px; flex: none; }
a.src-path { text-decoration: none; }
a.src-path:hover { color: var(--pink); text-decoration: underline; text-underline-offset: 3px; }
.sync-btn {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px; margin-right: 6px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2);
}
.sync-btn:hover:not(:disabled) { border-color: var(--pink); color: var(--text); }
.sync-btn:disabled { cursor: default; }
.sync-btn.spinning { border-color: var(--pink); color: var(--pink); }
.sync-btn.spinning .ico { animation: spin 1s linear infinite; }
.sync-label { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.sync-label b { font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.sync-label small { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.sync-label small:empty { display: none; }
.src-links { display: flex; gap: 4px; flex: none; }
.src-links a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); text-decoration: none;
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; }
.src-links a:hover { border-color: var(--pink); color: var(--pink); }
.src-links .ico { width: 12px; height: 12px; }
.src-more { align-self: flex-start; }
.src {
  display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 10px 5px 5px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-2); font-size: 12.5px; color: var(--text-2);
  transition: border-color .12s, color .12s;
}
.src:hover, .src.active { border-color: var(--pink); color: var(--text); }
.src .n { font: 600 11px/1 var(--mono); background: var(--surface-2); color: var(--text); border-radius: 5px; padding: 4px 6px; }
.src.active .n { background: var(--pink); color: #000; }
.src .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.src .pg { color: var(--text-3); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.src-more { background: none; border: 0; color: var(--text-3); font-size: 12.5px; padding: 5px 6px; }
.src-more:hover { color: var(--pink); }
.err { color: #ff6b6b; }

/* composer */
.composer { padding: 10px 24px 14px; max-width: 808px; width: 100%; margin: 0 auto; }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 8px 8px 8px 16px; border-radius: 16px;
  border: 1px solid var(--line-2); background: var(--bg-2); transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: var(--pink); box-shadow: 0 0 0 4px var(--pink-soft); }
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; max-height: 200px;
  padding: 8px 0; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--text-3); }
.send {
  width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--pink); color: #000; display: grid; place-items: center; flex: none;
}
:root[data-theme="light"] .send { color: #fff; }
.send:disabled { background: var(--surface-2); color: var(--text-3); cursor: default; }
.send .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.scope {
  flex-basis: 100%; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); padding-top: 2px;
}
.scope #scopeName { color: var(--pink); background: var(--pink-soft); padding: 2px 8px; border-radius: 6px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope button { border: 0; background: none; color: var(--text-3); font-size: 16px; line-height: 1; padding: 0 4px; }
.composer-hint { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--text-3); padding: 7px 6px 0; }

/* ---------- viewer ---------- */
.viewer-bar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.vb-title { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.vb-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vb-path { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vb-nav { display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; }
.cite-pos { font: 500 11.5px var(--mono); color: var(--pink); padding: 0 4px; min-width: 38px; text-align: center; }
.vb-tools { display: flex; align-items: center; gap: 2px; }
.page-ind { font: 500 12px var(--mono); color: var(--text-2); padding: 0 8px; white-space: nowrap; }
.viewer-scroll { flex: 1; overflow: auto; position: relative; }
.viewer-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--text-3); text-align: center; padding: 24px; font-size: 13.5px;
}
.viewer-empty p { max-width: 300px; margin: 0; }
.doc-illu { width: 76px; height: 76px; fill: none; stroke: var(--line-2); stroke-width: 2; }
.doc-illu .hl { fill: var(--pink-hl); stroke: var(--pink); }
.pages { padding: 20px 0 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.page {
  position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.18);
  border-radius: 2px; flex: none;
}
.page canvas { display: block; width: 100%; height: 100%; border-radius: 2px; }
.page .pno { position: absolute; left: -38px; top: 4px; font: 500 11px var(--mono); color: var(--text-3); }
.hl-box {
  position: absolute; background: var(--pink-hl); border-radius: 3px; mix-blend-mode: multiply;
  box-shadow: 0 0 0 1.5px rgba(255, 45, 135, .55); pointer-events: none;
}
.hl-box.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 1.5px rgba(255,45,135,.55), 0 0 0 0 rgba(255,45,135,.55); } 40% { box-shadow: 0 0 0 1.5px rgba(255,45,135,.8), 0 0 0 10px rgba(255,45,135,0); } }
.hl-label {
  position: absolute; transform: translate(calc(-100% - 6px), 0); background: var(--pink); color: #000;
  font: 600 10.5px/1 var(--mono); padding: 4px 5px; border-radius: 5px; pointer-events: none;
}
.page-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #999; font-size: 12px; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(420px, 92vw); background: var(--bg); z-index: 41;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: var(--shadow);
  transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 12px 10px 18px; }
.drawer-title { font-weight: 600; font-size: 16px; }
.drawer-sub { font-size: 12px; color: var(--text-3); text-decoration: none; }
.drawer-sub[href]:hover { color: var(--pink); }
.drawer-progress { padding: 0 18px 10px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--pink); transition: width .3s; }
.progress-text { font-size: 11.5px; color: var(--text-3); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-search {
  margin: 0 14px 8px; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); outline: 0;
}
.drawer-search:focus { border-color: var(--pink); }
.doc-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.doc {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px;
  border: 0; background: none; text-align: left;
}
.doc:hover { background: var(--surface); }
.doc .ext {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font: 600 9.5px var(--mono); text-transform: uppercase; background: var(--surface-2); color: var(--text-2);
}
.doc .ext.pdf { color: #ff6b6b; } .doc .ext.docx, .doc .ext.doc { color: #5b9cff; }
.doc .ext.xlsx, .doc .ext.xls, .doc .ext.csv { color: #3ecf8e; } .doc .ext.pptx, .doc .ext.ppt { color: #ff9f43; }
.doc .meta { min-width: 0; flex: 1; }
.doc .dn { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .dp { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .st { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.doc .st.error, .doc .st.empty { color: #ffb02e; }
.doc-actions { display: flex; gap: 2px; opacity: 0; }
.doc:hover .doc-actions { opacity: 1; }
.doc-actions span { font-size: 11px; padding: 3px 7px; border-radius: 6px; color: var(--text-2); border: 1px solid var(--line-2); }
.doc-actions span:hover { border-color: var(--pink); color: var(--pink); }
.doc-empty { color: var(--text-3); font-size: 13px; padding: 20px 12px; text-align: center; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }

/* menu + toast */
.menu {
  position: fixed; top: 52px; right: 12px; z-index: 50; min-width: 220px; background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; animation: fade .12s;
}
.menu { min-width: 260px; }
.menu-head { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 1px; }
.menu-head b { font-weight: 600; font-size: 14px; }
.menu-head span { font-size: 12.5px; color: var(--text-3); word-break: break-all; }
.menu-item { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; }
.menu-item .ico { width: 16px; height: 16px; color: var(--text-2); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 10px 0; }
.menu-sub { font-size: 12.5px; color: var(--text-2); padding: 2px 10px 4px; word-break: break-all; }
body:not(.is-admin) .admin-only { display: none !important; }

/* ---------- left pane ---------- */
.side { flex: 0 0 var(--side-w, 300px); width: var(--side-w, 300px); min-width: 0; display: flex; flex-direction: column;
  background: var(--bg); min-height: 0; transition: margin-left .2s ease; }
body.side-collapsed .side-gutter { display: none; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
body.resizing iframe, body.resizing canvas { pointer-events: none; }
.side-rail { display: none; flex: 0 0 52px; flex-direction: column; align-items: center; gap: 4px; padding-top: 10px;
  border-right: 1px solid var(--line); background: var(--bg); position: relative; }
body.side-collapsed .side { display: none; }
body.side-collapsed .side-rail { display: flex; }
.rail-badge { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--pink);
  color: #000; font: 600 10px/16px var(--mono); text-align: center; padding: 0 4px; }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 10px 8px 8px 10px; border-bottom: 1px solid var(--line); }
.side-tab { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 0;
  background: none; color: var(--text-2); font-size: 13px; font-weight: 500; }
.side-tab .ico { width: 15px; height: 15px; }
.side-tab:hover { color: var(--text); background: var(--surface); }
.side-tab.on { color: var(--text); background: var(--surface-2); }
.side-collapse { margin-left: auto; }
.side-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-panel[hidden] { display: none; }
.side-head { padding: 12px 14px 6px; }
.side-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .drawer-search { margin: 6px 10px 6px; }
.side .drawer-progress { padding: 4px 14px 8px; }
.sel-bar { margin: 0 10px 6px; padding: 7px 10px; border-radius: 9px; background: var(--pink-soft); color: var(--pink);
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.sel-bar button { margin-left: auto; background: none; border: 0; color: var(--text-2); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.sel-hint { margin: 0 14px 6px; font-size: 11.5px; color: var(--text-3); }
.tree { flex: 1; overflow: auto; padding: 2px 6px 10px; }
.tn { flex: none; display: flex; align-items: center; gap: 6px; height: 30px; padding-left: calc(4px + var(--d) * 16px); padding-right: 8px;
  border-radius: 7px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-2); }
.tn:hover { background: var(--surface); color: var(--text); }
.tn.sel { color: var(--text); }
.tn.current { background: var(--surface-2); color: var(--text); }
.tn .tw { width: 18px; height: 18px; display: grid; place-items: center; border: 0; background: none; padding: 0; color: var(--text-3); flex: none; }
.tn .tw .ico { width: 13px; height: 13px; transition: transform .15s; }
.tn .tw.open .ico { transform: rotate(90deg); }
.tn .tw-sp { width: 18px; flex: none; }
.tn .cb { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--pink); cursor: pointer; }
.tn .cb:disabled { opacity: .55; cursor: default; }
.tn .fico { width: 15px; height: 15px; flex: none; color: var(--text-3); }
.tn.folder .tn-name { font-weight: 500; }
.tn.folder.sel .fico { color: var(--pink); }
.tn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-n { font: 500 10.5px var(--mono); color: var(--text-3); }
.tn .ext { width: 30px; height: 18px; border-radius: 4px; font-size: 8.5px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 600; text-transform: uppercase; background: var(--surface-2); color: var(--text-2); }
.tn .ext.pdf { color: #ff6b6b; } .tn .ext.docx, .tn .ext.doc { color: #5b9cff; }
.tn .ext.xlsx, .tn .ext.xls, .tn .ext.csv { color: #3ecf8e; } .tn .ext.pptx, .tn .ext.ppt { color: #ff9f43; }
.tn .st { font-size: 10.5px; color: #ffb02e; white-space: nowrap; }
.tn .st.ocr { color: var(--text-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; font: 600 9.5px var(--mono); }
.side .drawer-foot { margin-top: auto; }

/* quick questions */
.q-cats { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 10px 10px; border-bottom: 1px solid var(--line); }
.q-cat { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: none; color: var(--text-2); font-size: 12.5px; }
.q-cat:hover { border-color: var(--text-3); color: var(--text); }
.q-cat.on { border-color: var(--pink); background: var(--pink-soft); color: var(--pink); }
.q-ico { font-size: 12px; width: 14px; text-align: center; }
.q-head { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px 4px; font-size: 11.5px; color: var(--text-3); }
.q-head span:first-child { color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.q-list { flex: 1; overflow-y: auto; padding: 4px 8px 14px; display: flex; flex-direction: column; gap: 6px; }
.q-item { flex: none; display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); overflow: hidden; }
.q-item:hover { border-color: var(--pink); }
.q-ask { flex: 1; text-align: left; background: none; border: 0; padding: 9px 10px; font-size: 13px; line-height: 1.45; color: var(--text); }
.q-edit { flex: none; width: 34px; background: none; border: 0; border-left: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.q-edit:hover { color: var(--pink); background: var(--surface); }

.q-n { font: 500 10px var(--mono); color: var(--text-3); margin-left: 2px; }
.q-cat.on .q-n { color: var(--pink); }
.q-tools { padding: 8px 10px 0; }
.q-tools .drawer-search { margin: 0; width: 100%; }
.q-group { flex: none; display: flex; justify-content: space-between; padding: 12px 6px 4px; font-size: 11px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; position: sticky; top: -4px; background: var(--bg); z-index: 1; }
.q-group span { color: var(--text-3); font-weight: 500; }
.q-ask { display: flex; flex-direction: column; gap: 4px; }
.q-id { font: 600 10.5px var(--mono); color: var(--pink); }
.q-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.q-st, .q-cov { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); }
.q-st.ok { color: #3ecf8e; } .q-st.open { color: #ffb02e; } .q-st.na { color: var(--text-3); }
.q-cov.warn { color: #ffb02e; }
.q-foot { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.q-src { flex: 1; min-width: 0; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-foot .btn { cursor: pointer; }

/* chat history */
.h-tools { display: flex; flex-direction: column; gap: 8px; padding: 12px 10px 6px; }
.h-tools .drawer-search { margin: 0; width: 100%; }
.h-new { justify-content: center; }
.h-new .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.h-list { flex: 1; overflow-y: auto; padding: 0 6px 10px; }
.h-group { padding: 12px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.h-item { display: flex; align-items: center; border-radius: 8px; position: relative; }
.h-item:hover, .h-item.current { background: var(--surface); }
.h-item.current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--pink); }
.h-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.h-title { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-meta { font-size: 11px; color: var(--text-3); }
.h-act { display: flex; gap: 2px; padding-right: 6px; opacity: 0; }
.h-item:hover .h-act, .h-item.current .h-act { opacity: 1; }
.h-act button { height: 24px; min-width: 24px; padding: 0 6px; border-radius: 6px; border: 0; background: none; color: var(--text-3); font-size: 12px; }
.h-act button:hover { background: var(--surface-2); color: var(--text); }
.h-act button.confirm { color: #ff6b6b; background: rgba(255,107,107,.12); }
.h-rename { margin: 6px 8px; flex: 1; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--pink); background: var(--bg); outline: 0; font-size: 13px; }
.h-foot { padding: 8px 14px 12px; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--line); }
.h-when { margin-left: auto; font-size: 11px; color: var(--text-3); }
.msg.bot .who { display: flex; }
.side-tab { padding: 0 10px; }

/* sync progress popover */
.sync-pop { right: 120px; width: 340px; }
.sp-steps { list-style: none; margin: 4px 0 0; padding: 4px 10px 0; display: flex; flex-direction: column; gap: 10px; }
.sp-step { display: flex; gap: 10px; font-size: 13px; color: var(--text-3); }
.sp-step b { display: block; font-weight: 500; }
.sp-step small { display: block; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 270px; }
.sp-step .bar { margin-top: 6px; width: 270px; }
.sp-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; margin-top: 4px; }
.sp-step.done { color: var(--text-2); }
.sp-step.done .sp-dot { background: var(--pink); border-color: var(--pink); }
.sp-step.live { color: var(--text); }
.sp-step.live .sp-dot { border-color: var(--pink); border-right-color: transparent; animation: spin .8s linear infinite; }
.sp-note { margin: 12px 10px 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }

/* answer from the request list (shown instantly) */
.req-card { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--pink); background: var(--pink-soft); }
.rc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rc-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--pink); }
.rc-ans { font-size: 14px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.rc-adv { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.rc-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rc-file { font-size: 12px; padding: 3px 8px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line-2); color: var(--text-2); }
button.rc-file.ok { color: #3ecf8e; cursor: pointer; }
button.rc-file.ok:hover { border-color: #3ecf8e; }
.rc-file.miss { color: #ffb02e; }
.rc-foot { margin-top: 10px; font-size: 11.5px; color: var(--text-3); }

/* web research */
.web-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 4px 8px; font-size: 12px; color: var(--text-3); }
.web-hints button { height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); font-size: 12px; }
.web-hints button:hover { border-color: var(--pink); color: var(--pink); }
.src.web { text-decoration: none; }
.src.web .n { display: grid; place-items: center; padding: 3px 5px; }
.src.web .n .ico { width: 12px; height: 12px; }
.src-head.web-head { margin-top: 8px; }
.src.note .pg { font-family: inherit; color: var(--pink); }

/* notes */
.note-view { padding: 32px 28px; }
.note-card { max-width: 640px; margin: 0 auto; background: var(--bg); border: 1px solid var(--pink); border-radius: 14px; padding: 22px 24px; }
.nc-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--pink); display: flex; align-items: center; gap: 6px; }
.note-card h3 { margin: 10px 0 8px; font-size: 18px; }
.note-card p { margin: 0; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.nc-meta { margin-top: 14px; font-size: 12px; color: var(--text-3); }
.nt-add { display: flex; flex-direction: column; gap: 8px; padding: 0 22px 14px; }
.nt-add input, .nt-add textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); outline: 0; resize: vertical; }
.nt-add input:focus, .nt-add textarea:focus { border-color: var(--pink); }
.nt-actions { display: flex; gap: 8px; }
.nt-list { overflow-y: auto; border-top: 1px solid var(--line); padding: 8px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.nt-item { border: 1px solid var(--line); border-left: 3px solid var(--pink); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); }
.nt-t { font-weight: 600; font-size: 14px; }
.nt-x { margin-top: 4px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; }
.nt-m { margin-top: 8px; font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.nt-act { margin-left: auto; display: flex; gap: 4px; }
.nt-act button { height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-2); background: none; font-size: 12px; color: var(--text-2); }
.nt-act button:hover { border-color: var(--pink); color: var(--text); }
.nt-act button.confirm { border-color: #ff6b6b; color: #ff6b6b; }
.brief-notes { margin: 14px 0 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--pink); background: var(--pink-soft); }
.bn-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--pink); margin-bottom: 6px; }
.bn-i { font-size: 13.5px; line-height: 1.55; margin-top: 4px; }

/* downloads */
.dl-wrap { position: relative; }
.dl-menu { position: absolute; top: 34px; right: 0; left: auto; min-width: 190px; padding: 6px; }
.dl-menu .menu-item { text-decoration: none; color: var(--text); font-size: 13px; }
.dl-menu .menu-item small { color: var(--text-3); margin-left: 4px; }
.dl-menu .menu-item[hidden] { display: none; }
.tn-dl { display: none; width: 22px; height: 22px; place-items: center; border-radius: 6px; color: var(--text-3); flex: none; }
.tn-dl .ico { width: 14px; height: 14px; }
.tn.file:hover .tn-dl { display: grid; }
.tn-dl:hover { color: var(--pink); background: var(--surface-2); }
.dl-log { overflow: auto; border-top: 1px solid var(--line); padding: 6px 16px 16px; }
.dl-log table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dl-log th, .dl-log td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dl-log th { color: var(--text-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.dl-log td:nth-child(3) { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

/* research trace */
.trace { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); font-size: 12.5px; }
.trace summary { list-style: none; cursor: pointer; padding: 8px 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary::before { content: "▸"; font-size: 10px; color: var(--text-3); transition: transform .15s; margin-right: 4px; }
.trace[open] summary::before { transform: rotate(90deg); }
.trace-title { font-weight: 600; color: var(--text); }
.trace-sum { color: var(--text-3); }
.trace-plan { padding: 0 12px 4px 30px; display: flex; flex-direction: column; gap: 4px; }
.trace-plan:empty { display: none; }
.plan-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.plan-k { color: var(--text-3); width: 52px; flex: none; }
.chip { display: inline-block; padding: 1px 8px; margin: 0 4px 2px 0; border-radius: 6px; background: var(--pink-soft); color: var(--pink); font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; margin-left: 6px; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.link-btn:hover { color: var(--pink); }
.trace-steps { margin: 0; padding: 4px 12px 10px 30px; list-style: none; display: flex; flex-direction: column; gap: 3px; color: var(--text-2); }
.trace-steps:empty { display: none; }
.trace-steps li { position: relative; padding-left: 16px; }
.trace-steps li::before { content: ""; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.trace-steps li.live { color: var(--text); }
.trace-steps li.live::before { background: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); animation: blink 1s infinite; }
.deep-tag { color: var(--pink); font-weight: 600; }

/* composer: deep toggle */
.deep-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 9px; flex: none;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-3); font-size: 12.5px; font-weight: 500; align-self: center; }
.deep-btn .ico { width: 14px; height: 14px; }
.deep-btn:hover { color: var(--text); border-color: var(--text-3); }
.deep-btn.on { color: var(--pink); border-color: var(--pink); background: var(--pink-soft); }

/* header: analysis button */
.brief-btn { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; margin-right: 6px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.brief-btn:hover { border-color: var(--pink); color: var(--text); }

/* drawer folder groups */
.doc-group { display: flex; align-items: center; gap: 8px; padding: 14px 10px 4px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.dg-name { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.dg-n { font-size: 11px; color: var(--text-3); }
.dg-ask { margin-left: auto; font-size: 11.5px; background: none; border: 1px solid var(--line-2); border-radius: 7px; padding: 2px 8px; color: var(--text-2); }
.dg-ask:hover { border-color: var(--pink); color: var(--pink); }

/* analysis modal */
.brief-modal { width: min(980px, 100%); max-height: calc(100vh - 32px); }
.brief-actions { display: flex; align-items: center; gap: 6px; }
.brief-stats { display: flex; gap: 10px; padding: 0 22px 12px; flex-wrap: wrap; }
.brief-stats:empty { display: none; }
.bstat { display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; color: var(--text-2); }
.bstat b { font-size: 18px; color: var(--pink); }
.brief-body { overflow-y: auto; padding: 4px 22px 24px; border-top: 1px solid var(--line); font-size: 14px; }
.brief-body h2 { font-size: 16px; margin: 22px 0 8px; padding-top: 4px; }
.brief-body h3 { font-size: 14px; margin: 14px 0 6px; color: var(--text-2); }
.brief-body a.doc-link { color: var(--pink); text-decoration: none; background: var(--pink-soft); border-radius: 5px; padding: 0 6px;
  font-size: 11.5px; white-space: nowrap; display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; vertical-align: -3px; }
.brief-body a.doc-link:hover { background: var(--pink); color: #000; }
.brief-empty { padding: 40px 0; text-align: center; color: var(--text-2); }

/* users modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  width: min(760px, 100%); max-height: min(760px, calc(100vh - 32px)); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); animation: rise .2s;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 16px 14px 22px; }
.modal-title { font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.modal-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.um-add { display: flex; gap: 8px; padding: 0 22px 14px; flex-wrap: wrap; }
.um-add input, .um-add select {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); outline: 0;
}
.um-add input:focus, .um-add select:focus { border-color: var(--pink); }
.um-add #umEmail { flex: 2 1 220px; } .um-add #umName { flex: 1 1 140px; } .um-add select { flex: 0 0 110px; }
.um-note { margin: 0 22px 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--text-2); background: var(--surface); }
.um-link { margin: 0 22px 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--pink); background: var(--pink-soft); display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.um-link div { grid-column: 1 / -1; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.um-link div span { color: var(--text-3); font-size: 12px; }
.um-link code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.um-list { overflow-y: auto; border-top: 1px solid var(--line); padding: 6px 10px 12px; }
.um-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.um-row:hover { background: var(--bg-2); }
.um-row.inactive { opacity: .5; }
.um-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }
.um-row.admin .um-av { background: var(--pink); color: #000; }
.um-who { flex: 1; min-width: 0; }
.um-who b { display: block; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-who > span { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.um-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; text-align: right; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); margin-left: 6px; vertical-align: 1px; }
.badge.pink { background: var(--pink-soft); color: var(--pink); }
.um-actions { display: flex; gap: 4px; flex: none; }
.um-actions button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: none; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.um-actions button:hover { border-color: var(--pink); color: var(--text); }
.um-actions button.danger:hover, .um-actions button.confirm { border-color: #ff6b6b; color: #ff6b6b; }
.setup-pending { border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius); padding: 18px; color: var(--text-2); margin-bottom: 24px; }
.menu-item:hover { background: var(--surface); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); animation: rise .2s;
}

.mobile-only { display: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand-title { display: none; }
  .source-chip { margin-left: 0; max-width: none; flex: 1; }
  .source-chip .sep, #docCount { display: none; }
  #themeBtn, #newChatBtn { display: none; }
  .chat-pane { flex: 1; min-width: 0; }
  .gutter { display: none; }
  .viewer-pane {
    position: fixed; inset: 0; z-index: 30; min-width: 0; transform: translateY(100%);
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
  }
  .viewer-pane.open { transform: none; }
  .mobile-only { display: grid; }
  .chat-inner { padding: 20px 16px; }
  .composer { padding: 8px 12px 12px; }
  .suggestions { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 28px; }
  .folder-form { flex-direction: column; }
  .page .pno { display: none; }
  .composer-hint span:last-child { display: none; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(340px, 88vw); z-index: 41; box-shadow: var(--shadow);
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,.8,.2,1); display: flex !important; }
  body.side-open .side { transform: none; }
  .side-rail, body.side-collapsed .side-rail { display: none; }
  .brief-btn span { display: none; } .brief-btn { padding: 0 9px; margin-right: 0; }
  .deep-btn { padding: 0 8px; font-size: 0; gap: 0; } .deep-btn .ico { width: 16px; height: 16px; }
  .sync-label { display: none; } .sync-btn { padding: 0 9px; margin-right: 0; }
  .src-row { flex-wrap: wrap; gap: 4px 8px; } .src-path { flex-basis: 100%; order: 3; padding-left: 4px; }
  .um-row { flex-wrap: wrap; } .um-meta { display: none; } .um-actions { width: 100%; padding-left: 46px; flex-wrap: wrap; }
  #zoomIn, #zoomOut, .vb-path { display: none; }
  .viewer-bar { gap: 6px; padding: 0 6px; }
}


/* ---------------- "Für ahead& merken" ---------------- */
.count-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pink); color: #000;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.count-badge[hidden] { display: none; }
.msg-actions { display: flex; gap: 6px; margin-top: 10px; }
.save-q { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: none; color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s; }
.save-q .ico { width: 14px; height: 14px; }
.save-q:hover { border-color: var(--pink); color: var(--text); }
.save-q.on { border-color: var(--pink); background: var(--pink-soft); color: var(--text); }
.save-q.on .ico { fill: var(--pink); stroke: var(--pink); }
.msg.bot.flash { animation: svflash 1.8s ease; border-radius: 12px; }
@keyframes svflash { 0%, 40% { box-shadow: 0 0 0 2px var(--pink); } 100% { box-shadow: 0 0 0 2px transparent; } }

.shared-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 18px; border-radius: 12px;
  border: 1px solid var(--pink); background: var(--pink-soft); font-size: 13px; }
.shared-banner > .ico { width: 18px; height: 18px; fill: var(--pink); stroke: var(--pink); flex: none; }
.shared-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shared-banner span { color: var(--text-2); font-size: 12.5px; }
.shared-banner .btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.shared-banner .btn .ico { width: 14px; height: 14px; }

.saved-page { position: fixed; inset: 56px 0 0 0; z-index: 60; background: var(--bg); overflow-y: auto; animation: fade .15s; }
.saved-page[hidden] { display: none; }
.sv-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 60px; }
.sv-top { display: flex; flex-direction: column; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.sv-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sv-kicker { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); }
.sv-title { font-size: 30px; letter-spacing: -.02em; margin: 4px 0 6px; }
.sv-sub { margin: 0; color: var(--text-2); font-size: 14px; max-width: 720px; line-height: 1.55; }
.sv-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 10px; }
.sv-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); font-size: 12.5px; text-align: left; cursor: pointer; }
.sv-stat b { font-size: 24px; color: var(--text); letter-spacing: -.02em; }
.sv-stat:hover { border-color: var(--text-3); }
.sv-stat.on { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); }
.sv-stat.warn b { color: var(--pink); }
.sv-tools-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sv-search { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; max-width: 460px; height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); }
.sv-search:focus-within { border-color: var(--pink); }
.sv-search .ico { width: 15px; height: 15px; color: var(--text-3); }
.sv-search input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 13.5px; color: var(--text); }
.sv-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line-2); background: none; color: var(--text-2);
  font-size: 12.5px; cursor: pointer; }
.chip-btn span { color: var(--text-3); margin-left: 3px; }
.chip-btn:hover { color: var(--text); border-color: var(--text-3); }
.chip-btn.on { border-color: var(--pink); background: var(--pink-soft); color: var(--text); }
.sv-editors { font-size: 12.5px; color: var(--text-3); }
.sv-group { margin-top: 26px; }
.sv-gh { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sv-gname { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sv-gn { font-size: 11.5px; color: var(--text-3); }
.sv-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.15fr); border-top: 1px solid var(--line); }
.sv-row > div { padding: 14px 16px; min-width: 0; }
.sv-row > div + div { border-left: 1px solid var(--line); }
.sv-head { border-top: 0; background: var(--bg-2); }
.sv-head > div { padding: 9px 16px; font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.sv-head small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-3); }
.sv-open { cursor: pointer; transition: background .12s; }
.sv-row:not(.sv-head):hover .sv-open { background: var(--surface); }
.sv-qt { font-weight: 600; font-size: 14px; line-height: 1.45; }
.sv-meta { margin-top: 8px; font-size: 11.5px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.sv-chat { display: inline-flex; align-items: center; gap: 3px; color: var(--pink); font-weight: 600; opacity: 0; transition: opacity .12s; }
.sv-chat .ico { width: 12px; height: 12px; }
.sv-row:hover .sv-chat { opacity: 1; }
.sv-a { font-size: 13.5px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; }
.sv-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-style: italic; }
.sv-wait i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--pink); border-right-color: transparent; animation: spin .8s linear infinite; }
.sv-r { display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--pink) 3%, transparent); }
.sv-r.has { background: color-mix(in srgb, var(--pink) 7%, transparent); box-shadow: inset 3px 0 0 var(--pink); }
.sv-remark { width: 100%; min-height: 54px; resize: none; padding: 8px 10px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.5; outline: 0; }
.sv-remark:hover { border-color: var(--line-2); background: var(--bg); }
.sv-remark:focus { border-color: var(--pink); background: var(--bg); }
.sv-remark-ro { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.sv-rmeta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); min-height: 24px; }
.sv-saved { color: var(--pink); font-weight: 600; }
.sv-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; opacity: .0; transition: opacity .12s; }
.sv-row:hover .sv-tools, .sv-tools:focus-within { opacity: 1; }
.sv-cat { height: 26px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text-2); font-size: 11.5px; padding: 0 6px; }
.sv-del { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line-2); background: none; color: var(--text-3); cursor: pointer; }
.sv-del .ico { width: 13px; height: 13px; }
.sv-del:hover, .sv-del.confirm { border-color: #ff6b6b; color: #ff6b6b; }
.sv-empty { padding: 60px 20px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sv-empty .ico { width: 30px; height: 30px; color: var(--pink); }
.sv-empty p { max-width: 520px; margin: 0; line-height: 1.55; font-size: 14px; }
@media (max-width: 900px) {
  .sv-wrap { padding: 18px 16px 40px; }
  .sv-title { font-size: 24px; }
  .sv-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sv-row { grid-template-columns: 1fr; }
  .sv-row > div + div { border-left: 0; border-top: 1px dashed var(--line); }
  .sv-head { display: none; }
  .sv-tools { opacity: 1; }
  #savedBtn span { display: none; }
}
.st-num { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--pink); color: #000;
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }

/* charts in answers */
.chart-card { margin: 14px 0; padding: 14px 16px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg-2); }
.chart-card.chart-wait { color: var(--text-3); font-size: 13px; padding: 18px 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.chart-title { font-weight: 600; font-size: 14px; }
.chart-unit { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.chart-act { display: flex; gap: 6px; flex: none; }
.chart-btn { height: 28px; min-width: 28px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 7px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text-2); font-size: 12px; cursor: pointer; }
.chart-btn .ico { width: 14px; height: 14px; }
.chart-btn:hover, .chart-btn.on { border-color: var(--pink); color: var(--text); }
.chart-box { position: relative; height: 300px; }
.chart-box.round { height: 280px; }
.chart-table { margin-top: 10px; overflow-x: auto; }
.chart-table table { margin: 0; }
.chart-src { margin-top: 8px; font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
@media (max-width: 900px) { .chart-box { height: 240px; } }

/* stop / continue */
.send.stop { background: var(--text); color: var(--bg); }
.send.stop[hidden] { display: none; }
.send.stop .ico rect { fill: currentColor; stroke: none; }
:root[data-theme="light"] .send.stop { color: #fff; }
.stopped-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px dashed var(--line-2); font-size: 12.5px; color: var(--text-2); }
.stopped-note b { color: var(--text); font-weight: 600; margin-right: 4px; }
.stopped-note button { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.stopped-note button:hover { border-color: var(--pink); }
.stopped-note button.primary { background: var(--pink); border-color: var(--pink); color: #000; font-weight: 600; }
:root[data-theme="light"] .stopped-note button.primary { color: #fff; }
.chart-btn.on { background: var(--pink-soft); }

.brief-status { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.brief-status > div { display: flex; flex-direction: column; gap: 2px; }
.brief-status span { color: var(--text-2); }
.brief-status.live { border: 1px solid var(--pink); background: var(--pink-soft); }
.brief-status.err { border: 1px solid #ff6b6b; background: rgba(255, 107, 107, .08); }
.brief-status.err b { color: #ff6b6b; }
.brief-cov { margin: 10px 0 4px; font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; gap: 2px; }
.brief-cov .bad { color: #ff6b6b; font-weight: 600; }
.brief-cov small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* spreadsheet viewer */
.grid-view { --gv-fs: 13px; min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.grid-view[hidden] { display: none; }
.gv-wrap { flex: 1; }
.gv-table { border-collapse: separate; border-spacing: 0; font-size: var(--gv-fs); font-variant-numeric: tabular-nums;
  table-layout: auto; min-width: 100%; }
.gv-table th, .gv-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .28em .6em;
  white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; height: 1.9em; color: var(--text); }
.gv-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-2); color: var(--text-3); font-weight: 500;
  font-size: .85em; text-align: center; border-bottom: 1px solid var(--line-2); }
.gv-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg-2); color: var(--text-3); font-weight: 500;
  font-size: .82em; text-align: right; min-width: 38px; border-right: 1px solid var(--line-2); }
.gv-table .gv-corner { left: 0; z-index: 3; }
.gv-table td.n { text-align: right; }
.gv-table td.b { font-weight: 650; }
.gv-table tr.hl td { background: var(--pink-soft); }
.gv-table tr.hl th { background: var(--pink); color: #000; }
.gv-table td.hit { background: var(--pink) !important; color: #000; font-weight: 650; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
:root[data-theme="light"] .gv-table td.hit, :root[data-theme="light"] .gv-table tr.hl th { color: #fff; }
.gv-more { padding: 10px 14px; font-size: 12px; color: var(--text-3); }
.gv-tabs { position: sticky; bottom: 0; left: 0; display: flex; gap: 2px; padding: 6px 8px; background: var(--bg-2);
  border-top: 1px solid var(--line-2); overflow-x: auto; z-index: 4; }
.gv-tab { flex: none; height: 28px; padding: 0 12px; border-radius: 7px; border: 1px solid transparent; background: none;
  color: var(--text-2); font-size: 12.5px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gv-tab:hover { color: var(--text); background: var(--surface); }
.gv-tab.on { color: var(--text); background: var(--bg); border-color: var(--line-2); box-shadow: inset 0 -2px 0 var(--pink); font-weight: 600; }
.gv-tab.hid { font-style: italic; opacity: .7; }
.view-toggle { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--text-2); font-size: 12px; cursor: pointer; white-space: nowrap; }
.view-toggle:hover { border-color: var(--pink); color: var(--text); }
.view-toggle[hidden], .page-ind[hidden] { display: none; }
