:root {
  --bg: #f3f6fa;
  --aside: #eef2f8;
  --surface: #ffffff;
  --text: #1b2230;
  --muted: #5e6878;
  --danger: #c23d3d;
  --line: #e2e8f0;
  --focus: #3b4de6;
  --hover: #e8eef6;
  --selected: #dde6f6;
  --fill: #2f3fd4;
  --fill-text: #ffffff;
  --code: #eef2f7;
  --radius: 4px;
  --aside-w: 240px;
  --thread-max: 720px;
  --page-max: 880px;
  --font: -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --composer-shadow: 0 2px 12px rgba(36, 56, 140, 0.08);
  --brand-ink: #2a38c8;
  --brand-word-from: #1294aa;
  --brand-word-via: #2c3bd4;
  --tooltip-bg: #1c212b;
  --tooltip-fg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141c;
    --aside: #0e1218;
    --surface: #171c26;
    --text: #eef1f6;
    --muted: #8b94a7;
    --danger: #ff8a8a;
    --line: #2a3240;
    --focus: #8b9bff;
    --hover: #1c2330;
    --selected: #243049;
    --fill: #4d63f0;
    --fill-text: #ffffff;
    --code: #1c2330;
    --composer-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
    --brand-ink: #c5d2ff;
    --brand-word-from: #6aeaf4;
    --brand-word-via: #9aacff;
    --tooltip-bg: #eef1f6;
    --tooltip-fg: #1b2230;
  }
}

:root[data-theme="dark"] {
  --bg: #10141c;
  --aside: #0e1218;
  --surface: #171c26;
  --text: #eef1f6;
  --muted: #8b94a7;
  --danger: #ff8a8a;
  --line: #2a3240;
  --focus: #8b9bff;
  --hover: #1c2330;
  --selected: #243049;
  --fill: #4d63f0;
  --fill-text: #ffffff;
  --code: #1c2330;
  --composer-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  --brand-ink: #c5d2ff;
  --brand-word-from: #6aeaf4;
  --brand-word-via: #9aacff;
  --tooltip-bg: #eef1f6;
  --tooltip-fg: #1b2230;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
}
a, a:link, a:visited { color: inherit; text-decoration: none; }
a:hover, a:focus { text-decoration: none; }
button, input, textarea, select {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
button { cursor: pointer; padding: 6px 12px; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
h1 { font-size: 16px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
code, pre, .mono { font-family: var(--mono); }
.tabular { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover { background: var(--hover); }
.btn-primary {
  background: var(--fill);
  color: var(--fill-text);
  border-color: var(--fill);
}
a.btn, a.btn:link, a.btn:visited { color: var(--text); text-decoration: none; }
a.btn-primary, a.btn-primary:link, a.btn-primary:visited { color: var(--fill-text); }
.btn-primary:hover { opacity: 0.92; background: var(--fill); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  padding: 6px 8px;
}
.btn-ghost:hover { background: var(--hover); }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { padding: 8px; width: 100%; }

.app-shell {
  display: grid;
  grid-template-columns: var(--aside-w) minmax(0, 1fr);
  height: 100%;
  min-height: 100vh;
  width: 100%;
}
.app-aside {
  display: flex;
  flex-direction: column;
  width: var(--aside-w);
  min-width: var(--aside-w);
  max-width: var(--aside-w);
  min-height: 0;
  background: var(--aside);
  border-right: 1px solid var(--line);
}
.app-aside-top { padding: 12px 12px 4px; flex-shrink: 0; }
.app-brand {
  display: block;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-aside-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 8px 12px;
}
.app-aside-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 8px;
}
.app-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--bg);
}
.aside-label {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 8px 4px;
}
.conv-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  position: relative;
}
.conv-link:hover { background: var(--hover); }
.conv-link.is-current {
  background: var(--selected);
  font-weight: 600;
}
.conv-link.is-current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--fill);
  border-radius: 1px;
}
.conv-link .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.conv-link-main {
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
.conv-del {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: pointer;
}
.conv-del svg {
  width: 16px;
  height: 16px;
  display: block;
}
.conv-link:hover .conv-del,
.conv-link:focus-within .conv-del,
.conv-link.is-current .conv-del {
  opacity: 1;
}
.conv-link:hover .conv-del:disabled,
.conv-link:focus-within .conv-del:disabled,
.conv-link.is-current .conv-del:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.conv-del:hover:not(:disabled) {
  color: var(--text);
  background: var(--selected);
}
.conv-link .muted { flex-shrink: 0; }
.nav-link {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link:hover { background: var(--hover); }
.nav-link.is-current { background: var(--selected); font-weight: 600; }
.nav-link.is-current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--fill);
}
.user-menu { position: relative; }
.user-menu-pop {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 100%;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  z-index: 20;
}
.user-menu-pop button, .user-menu-pop a {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.user-menu-pop button:hover, .user-menu-pop a:hover { background: var(--hover); }

.thread-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.thread-scroll {
  flex: 1;
  overflow: auto;
  padding: 28px 16px 40px;
  min-height: 0;
  overflow-anchor: none;
  overscroll-behavior: contain;
}
.thread-col {
  width: 100%;
  max-width: var(--thread-max);
  margin: 0 auto;
}
.thread-welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 24px 0 48px;
}
.composer-dock {
  flex-shrink: 0;
  padding: 8px 16px 20px;
  background: var(--bg);
}
.composer-dock .thread-col { position: relative; }
.jump-new {
  position: absolute;
  left: 50%;
  top: -40px;
  transform: translateX(-50%);
  z-index: 2;
}

.composer {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
}
.composer textarea {
  width: 100%;
  border: 0;
  padding: 4px 0;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  background: transparent;
  outline: none;
}
.composer textarea:focus { outline: none; }
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.msg { margin-bottom: 28px; }
.msg-role { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg-user .msg-role { text-align: right; }
.msg-user-body {
  display: inline-block;
  max-width: 85%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  white-space: pre-wrap;
  text-align: left;
}
.msg-asst { padding: 0; }
.msg-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.msg-user .msg-toolbar { justify-content: flex-end; }
.msg-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.msg-tool svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.msg-tool-tip {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 40;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
  box-shadow: 0 6px 16px rgba(28, 33, 43, 0.18);
}
.msg-user .msg-tool-tip {
  left: auto;
  right: 0;
  transform: none;
}
.msg-tool:hover,
.msg-tool:focus-visible,
.msg-tool[aria-expanded="true"] { color: var(--text); background: var(--hover); }
.msg-tool:hover .msg-tool-tip,
.msg-tool:focus-visible .msg-tool-tip {
  opacity: 1;
  visibility: visible;
}
.msg-tool[aria-expanded="true"] .msg-tool-tip,
.msg-tool:disabled .msg-tool-tip {
  opacity: 0;
  visibility: hidden;
}
.msg-toolbar .branch-switch button,
.linkish {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  cursor: pointer;
}
.msg-toolbar .branch-switch button:hover,
.linkish:hover { color: var(--text); }
.msg-tool:disabled,
.msg-toolbar .branch-switch button:disabled {
  cursor: default;
  opacity: 0.4;
}
.fork-wrap { position: relative; display: inline-flex; }
.fork-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  min-width: 132px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  z-index: 20;
}
.msg-user .fork-pop {
  left: auto;
  right: 0;
}
.fork-pop button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
}
.fork-pop button:hover { background: var(--hover); color: var(--text); }
.branch-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.thread-notice {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}
.kb-thread-scope {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.working { margin: 0 0 12px; }
.working-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.working-toggle:hover { color: var(--text); background: transparent; text-decoration: none; }
.working-chevron {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor;
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}
.working-chevron.is-open { transform: rotate(90deg); }
.working-body { padding: 6px 0 4px 14px; border-left: 1px solid var(--line); margin: 6px 0 4px 3px; }
.working-row { color: var(--muted); font-size: 12px; margin-top: 6px; }
.working-step { margin-top: 6px; }
.working-step-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.working-step-toggle:hover { color: var(--text); }
.working details.working-step > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.working details.working-step > summary::-webkit-details-marker,
.working details.working-step > summary::marker { display: none; content: none; }
.working details.working-step[open] > summary .working-chevron { transform: rotate(90deg); }
.working details.working-step > summary:hover { color: var(--text); }
.working pre { white-space: pre-wrap; font-size: 12px; margin: 6px 0 0; font-family: var(--font); }
.working-reason-body {
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 6px 0 2px 14px;
  max-height: 12.5em;
  overflow: auto;
}
.working-step-body { margin: 4px 0 2px 14px; }
.working-step-body pre + pre { margin-top: 10px; }
.working-body > :first-child { margin-top: 0; }

.cite-ref {
  display: inline;
  padding: 0 1px;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  vertical-align: super;
  line-height: 0;
}
.cite-ref:hover { color: var(--brand-ink); text-decoration: underline; }
.cite-ref.cite-mismatch,
.cites-btn.is-mismatch { color: var(--muted); opacity: 0.55; }
.cite-ref:focus { outline-offset: 0; }

.markdown { line-height: 1.65; overflow-wrap: anywhere; }
.markdown-process {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 12px;
}
.markdown-process h1,
.markdown-process h2,
.markdown-process h3,
.markdown-process h4 {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.markdown-process p { margin: 0 0 6px; }
.markdown-process .cite-ref { color: var(--muted); }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin: 16px 0 8px;
}
.markdown h1:first-child, .markdown h2:first-child, .markdown h3:first-child, .markdown h4:first-child { margin-top: 0; }
.markdown p { margin: 0 0 10px; }
.markdown p:last-child { margin-bottom: 0; }
.markdown a { color: var(--brand-ink); text-decoration: underline; }
.markdown ul, .markdown ol { margin: 0 0 10px; padding-left: 1.3em; }
.markdown li { margin: 0 0 4px; }
.markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.markdown pre, .markdown .md-code {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow: auto;
  font-size: 12px;
}
.markdown code { font-family: var(--mono); font-size: 0.92em; }
.markdown :not(pre) > code {
  background: var(--code);
  padding: 1px 4px;
  border-radius: var(--radius);
}
.markdown table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.markdown th { font-weight: 600; background: var(--hover); }
.markdown blockquote {
  margin: 0 0 10px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.cites {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.cites-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cites-item { margin-bottom: 2px; }
.cites-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cites-btn {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.cites-btn:hover { color: var(--text); background: transparent; }
.cites-num { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.cites-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cites-snippet {
  margin: 0 0 8px 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cites-snippet a { text-decoration: underline; word-break: break-all; }
.cites-open {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.cites-open:hover { color: var(--text); text-decoration: underline; }

.page {
  height: 100%;
  overflow: auto;
  padding: 32px 40px 64px;
  min-width: 0;
}
.page-col { width: 100%; max-width: var(--page-max); margin: 0 auto; min-width: 0; }
.page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-bottom: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.page-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  flex-wrap: wrap;
}
.page-header-main > :first-child { min-width: 0; }
.page-header .crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.page-header .crumb a:hover { text-decoration: underline; }
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: flex-start;
  margin: -4px 0 8px -8px;
  padding: 6px 10px 6px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  text-decoration: none;
}
.page-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.page-back:hover {
  color: var(--text);
  background: var(--hover);
  text-decoration: none;
}
.page-lead {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.empty { color: var(--muted); margin-top: 24px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}
.table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
.table tr:hover td { background: var(--hover); }
.table tr.is-link { cursor: pointer; }
.table a:hover { text-decoration: underline; }

.tabs { display: flex; flex-wrap: nowrap; gap: 16px; border-bottom: 1px solid var(--line); margin: 8px 0 16px; }
.tab {
  border: 0;
  background: transparent;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
}
.tab.is-on { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.chunk-list { display: flex; flex-direction: column; gap: 12px; }
.chunk-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.canonical {
  white-space: pre-wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  max-height: 70vh;
  overflow: auto;
  font-family: inherit;
  line-height: 1.6;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.doc-actions { align-items: flex-start; }
.doc-more { position: relative; }
.doc-more-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 132px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  z-index: 5;
  display: flex;
  flex-direction: column;
}
.doc-more-pop button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius);
}
.doc-more-pop button:hover { background: var(--hover); }
.doc-note {
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--muted);
}
.doc-archive {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px 16px;
  margin-bottom: 16px;
}
.doc-archive .field { margin-top: 0; }
.doc-archive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.doc-archive-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.doc-filters {
  display: flex;
  gap: 8px;
  margin: -4px 0 14px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}
.chip.is-on {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}
.chunk-group { display: flex; flex-direction: column; gap: 8px; }
.chunk-group-title {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.chunk-kicker { font-size: 12px; color: var(--muted); }
.chunk-item.is-obsolete,
.chunk-item.is-obsolete .chunk-kicker,
.chunk-item.is-obsolete .chunk-body,
.chunk-item.is-obsolete .markdown,
.chunk-item.is-obsolete .markdown :is(h1, h2, h3, h4, p, li, td, th, a) { color: var(--danger); }
.doc-meta .is-obsolete { color: var(--danger); }
.chunk-body { margin-top: 6px; }
.chunk-body.markdown p { white-space: pre-line; }
.chunk-item.is-parent { background: transparent; }
.canon-doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 20px;
  max-height: 70vh;
  overflow: auto;
}
.canon-h { margin: 18px 0 8px; font-weight: 600; line-height: 1.35; }
.canon-h1 { font-size: 16px; margin-top: 0; }
.canon-h2 { font-size: 15px; }
.canon-h3 { font-size: 14px; }
.canon-p { margin: 0 0 12px; line-height: 1.7; }
.canon-caption { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.canon-table-wrap { margin: 8px 0 16px; overflow: auto; }
.canon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.canon-table th, .canon-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.canon-table th { background: var(--hover); font-weight: 600; }
@media (max-width: 720px) {
  .doc-archive-grid { grid-template-columns: 1fr; }
}
.kb-preview { max-width: 720px; }
.kb-preview .page-back { margin-bottom: 18px; }
.kb-preview-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.kb-preview-titlebar h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.kb-preview-lib {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}
.kb-preview-lib select {
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--text);
}
.kb-preview-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 8px 8px 16px;
  box-shadow: var(--composer-shadow);
}
.kb-preview-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 15px;
  outline: none;
}
.kb-preview-search input:focus { outline: none; }
.kb-preview-search .btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 10px;
}
@media (max-width: 560px) {
  .kb-preview-search { flex-wrap: wrap; }
  .kb-preview-search .btn { width: 100%; }
}
.kb-preview-opt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}
.kb-preview-opt input {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.kb-preview-body { margin-top: 28px; }
.kb-preview-idle {
  margin: 40px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.kb-preview-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.kb-preview-hits {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kb-preview-hits li {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.kb-preview-hits li:last-child { border-bottom: 0; }
.kb-preview-hit-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.kb-preview-hit-title { font-weight: 500; min-width: 0; color: inherit; text-decoration: none; }
a.kb-preview-hit-title:hover { text-decoration: underline; }
.kb-preview-hit-page {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
}
.kb-preview-hit-snippet {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.kb-preview-explain {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--code);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 40vh;
  overflow: auto;
}
.section { margin-top: 28px; }
.section h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}
.section-head h2 { margin: 0; }
.section-head a:hover { text-decoration: underline; }
.row-actions { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; flex-shrink: 0; }
.dropzone {
  border: 1px dashed var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 16px;
  text-align: center;
  cursor: pointer;
}
.dropzone-hint { margin-top: 6px; font-size: 12px; }
.dropzone.is-off { opacity: 0.55; cursor: not-allowed; }
.dropzone.is-over { background: var(--hover); border-color: var(--text); }
.space-ingest { margin: 4px 0 20px; }
.space-add {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.space-add.is-over {
  border-color: var(--focus);
  background: var(--hover);
}
.space-add-icon {
  width: 28px;
  height: 28px;
  color: var(--fill);
  flex-shrink: 0;
}
.space-add-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.space-add-copy strong { font-weight: 600; }
.space-add-copy span { font-size: 13px; color: var(--muted); }
.space-add-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 40px 24px 20px;
  cursor: pointer;
  width: 100%;
}
.space-add-hero .space-add-copy { max-width: 28em; }
.space-add-hero .space-add-icon { width: 36px; height: 36px; }
.space-add-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.space-add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 4px;
  min-width: 0;
}
.space-add-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
.space-add-drop:hover { background: var(--hover); }
.space-add-drop .space-add-copy { flex-direction: row; flex-wrap: nowrap; align-items: baseline; gap: 8px 12px; min-width: 0; }
.space-add-drop .space-add-copy strong { font-size: 14px; flex-shrink: 0; }
.space-add-drop .space-add-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-add-footer {
  display: flex;
  justify-content: center;
  padding: 0 16px 12px;
}
.space-ingest.is-compact .space-add-footer { justify-content: flex-start; padding: 0 16px 10px; }
.space-add-toggle {
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 12px;
  color: var(--muted);
}
.space-add-toggle:hover,
.space-add-toggle.is-on { color: var(--text); text-decoration: underline; }
.space-add-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 0 16px 14px;
  align-items: end;
}
.space-add-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}
.space-add-field input { padding: 8px 10px; }
.space-add-meta-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.space-tasks { margin-top: 8px; }
.space-rename { margin: 0; }
.space-docs-panel { margin-top: 8px; }
.space-docs-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}
.space-docs-tools input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
}
.space-docs-tools select {
  padding: 8px 10px;
  flex-shrink: 0;
}
.space-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.space-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.space-doc:hover { background: var(--hover); margin: 0 -12px; padding-left: 16px; padding-right: 16px; }
.space-doc-main { min-width: 0; flex: 1; }
.space-doc-main a { font-weight: 500; }
.space-doc-main a:hover { text-decoration: underline; }
.space-doc-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.space-doc.is-obsolete .space-doc-main a,
.space-doc.is-obsolete .space-doc-meta { color: var(--danger); }
.space-doc-del { opacity: 0; flex-shrink: 0; }
.space-doc:hover .space-doc-del,
.space-doc:focus-within .space-doc-del { opacity: 1; }
.kb-scope {
  margin: 12px 0 4px;
}
.kb-scope-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.kb-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.kb-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.7;
  background: transparent;
  font-weight: 400;
}
.kb-scope-chip.is-on {
  opacity: 1;
  border-color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}
.kb-scope-chip input { margin: 0; }
.kb-scope-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.kb-scope-chip.is-on .kb-scope-count { color: var(--text); }
.kb-scope-warn {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--text) 28%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-dialog {
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow: var(--composer-shadow);
}
.confirm-dialog h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.confirm-dialog p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.kb-create {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.kb-create input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
}
.kb-space-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kb-space {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--line);
}
.kb-space:hover { background: var(--hover); }
.kb-space-name { font-weight: 500; }
.kb-space-note { font-size: 12px; color: var(--muted); }
.kb-space-count { font-size: 12px; color: var(--muted); }
.wf-page .page-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
}
.wf-app-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 340px));
  gap: 12px;
}
.wf-app {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.wf-app:hover {
  background: var(--hover);
  border-color: var(--selected);
}
.wf-app:hover .wf-app-go {
  color: var(--text);
  opacity: 1;
}
.wf-app:active {
  background: var(--selected);
}
.wf-app-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--selected);
  color: var(--fill);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.wf-app-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-app-go {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.72;
}
.task-list { margin: 0; padding: 0; list-style: none; }
.task-item { border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: 0; }
.task-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.task-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-name a:hover { text-decoration: underline; }
.task-meta {
  flex-shrink: 0;
  font: inherit;
  font-size: 13px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
}
.task-meta.is-bad { color: var(--text); cursor: pointer; }
.task-meta.is-bad:hover { text-decoration: underline; }
.task-error {
  padding: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}
.agent-shell { --aside-w: 260px; }
.agent-shell .app-aside {
  background: var(--aside);
  border-right: none;
}
.agent-shell .app-main { background: var(--surface); }
.agent-shell .app-aside-foot { border-top: none; padding: 10px 10px 14px; }
.agent-shell .app-aside-scroll { padding: 0 10px 12px; }
.agent-aside-top { padding: 16px 10px 8px; }
.agent-aside-tools { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: nowrap; }
.agent-aside-tools-right { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 6px 0 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--brand-ink);
  text-decoration: none;
}
.brand-word {
  background-image: linear-gradient(118deg, var(--brand-word-from) 0%, var(--brand-word-via) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
a.brand-mark:link,
a.brand-mark:visited { color: var(--brand-ink); }
a.brand-mark:link .brand-word,
a.brand-mark:visited .brand-word { color: transparent; }
.agent-shell .brand-mark:hover { opacity: 0.82; }
.agent-shell .icon-btn:hover,
.agent-shell .icon-btn.is-on {
  background: var(--hover);
}
.agent-shell .nav-link,
.agent-shell .conv-link {
  border-radius: 12px;
  padding: 8px 12px;
}
.agent-shell .nav-link.is-current::before,
.agent-shell .conv-link.is-current::before { display: none; }
.agent-shell .nav-link.is-current,
.agent-shell .conv-link.is-current {
  background: var(--selected);
  font-weight: 500;
}
.agent-search {
  width: 100%;
  margin: 8px 0 4px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.agent-user { position: relative; }
.agent-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 12px;
  text-align: left;
}
.agent-user-btn:hover { background: var(--hover); }
.agent-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--fill-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.agent-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-welcome {
  align-items: stretch;
  max-width: 768px;
  text-align: center;
}
.welcome-hello {
  margin: 0 0 28px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--text);
}
.welcome-composer { text-align: left; }
.msg-file {
  display: inline-flex;
  margin: 8px 0 0;
  font-size: 12px;
}
.msg-user .msg-file { align-self: flex-end; }
.msg-file a {
  color: inherit;
  border: 1px solid var(--line);
  background: var(--hover);
  border-radius: 999px;
  padding: 4px 10px;
  text-decoration: none;
}
.msg-file a:hover { background: var(--selected); }
.starter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  text-align: left;
}
.starter-row {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text);
}
.starter-row:hover,
.starter-row.is-on { background: var(--hover); }
.composer.is-pill {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
  border-radius: 12px;
  padding: 8px 8px 8px 14px;
  box-shadow: var(--composer-shadow);
}
.composer.is-pill.is-over { background: var(--hover); }
.composer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.composer-plus,
.composer-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.composer-plus {
  background: transparent;
  color: var(--muted);
}
.composer-plus svg {
  width: 18px;
  height: 18px;
  display: block;
}
.composer-plus:hover { background: var(--hover); color: var(--text); }
.composer-send {
  background: var(--fill);
  color: var(--fill-text);
  font-size: 16px;
}
.composer-send svg {
  width: 12px;
  height: 12px;
  display: block;
}
.composer-send:disabled { opacity: 0.35; }
.composer-send.is-stop {
  background: var(--fill);
  color: var(--fill-text);
  border: 0;
}
.composer-context {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.composer-context svg {
  width: 20px;
  height: 20px;
  display: block;
}
.composer-context.is-warn { color: #c47b16; }
.composer-context.is-low { color: #c23d3d; }
.composer-context-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 40;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.composer-context:hover,
.composer-context:focus,
.composer-context:focus-visible { color: var(--text); background: var(--hover); }
.composer-context:hover .composer-context-tip,
.composer-context:focus .composer-context-tip,
.composer-context:focus-visible .composer-context-tip {
  opacity: 1;
  visibility: visible;
}
.composer-main { flex: 1; min-width: 0; padding: 4px 0; }
.composer.is-pill textarea {
  min-height: 28px;
  max-height: 200px;
  padding: 4px 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.composer-warn {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 6px;
}
.composer-chip {
  border: 1px solid var(--line);
  background: var(--hover);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}
.composer-queue {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}
.composer-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 4px;
  font-size: 12px;
  color: var(--muted);
}
.composer-queue-list {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.composer-queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--hover);
  cursor: grab;
}
.composer-queue-item.is-over { outline: 1px dashed var(--line); }
.composer-queue-idx {
  flex-shrink: 0;
  width: 18px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.composer-queue-body {
  flex: 1;
  min-width: 0;
}
.composer-queue-text {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-queue-files {
  display: block;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-queue-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  opacity: 0.55;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.composer-queue-remove:hover { background: var(--bg); opacity: 1; }
.composer-dock { background: var(--surface); }
.agent-shell .msg-user-body { border-radius: 12px; background: var(--hover); border: 0; }
.btn.is-on { background: var(--surface); }

.hitl-banner {
  border: 1px solid var(--line);
  background: var(--hover);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}
.hitl-banner p { margin: 0 0 8px; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 24px 32px;
}
.login-card h1 { margin: 12px 0 4px; }
.login-brand { margin-bottom: 4px; }
.login-alt {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
}
.linkish:hover { color: var(--text); text-decoration: underline; }
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table th, .users-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.users-table th { font-size: 12px; color: var(--muted); font-weight: 500; }
.users-invite {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.users-invite input,
.users-invite select {
  padding: 8px 10px;
}
.users-invite input[type="email"] { flex: 1; min-width: 180px; }
.invite-once {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--hover);
  border-radius: var(--radius);
  word-break: break-all;
}

.settings-page { max-width: 640px; }
.settings-page .page-header {
  border-bottom: 0;
  margin-bottom: 4px;
  padding-bottom: 8px;
}
.settings-page h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.set-account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.set-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--fill-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.set-account-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.set-account-copy strong {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-account-copy span {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-card {
  margin-top: 12px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.set-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.set-card-head p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}
.set-row > span {
  font-size: 14px;
  color: var(--text);
}
.settings-page select,
.settings-page .field input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--bg);
}
.set-row select {
  width: min(280px, 58%);
  padding-right: 36px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235e6878' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.set-themes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.set-theme {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  text-align: left;
}
.set-theme:hover { background: var(--hover); }
.set-theme.is-on {
  border-color: var(--fill);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--fill);
}
.set-swatch {
  position: relative;
  height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(27, 34, 48, 0.08);
  overflow: hidden;
  padding: 8px;
}
.set-swatch-light { background: #f4f7fb; }
.set-swatch-dark { background: #171c26; border-color: #2a3240; }
.set-swatch-system {
  background: linear-gradient(90deg, #f4f7fb 50%, #171c26 50%);
}
.set-swatch-bar,
.set-swatch-line {
  display: block;
  border-radius: 99px;
}
.set-swatch-bar {
  width: 46%;
  height: 7px;
  margin-bottom: 8px;
  background: #d5dce8;
}
.set-swatch-line {
  width: 78%;
  height: 5px;
  margin-top: 5px;
  background: #e3e8f0;
}
.set-swatch-line.short { width: 52%; }
.set-swatch-dark .set-swatch-bar { background: #3a4558; }
.set-swatch-dark .set-swatch-line { background: #2c3544; }
.set-swatch-system .set-swatch-bar,
.set-swatch-system .set-swatch-line {
  background: linear-gradient(90deg, #d5dce8 50%, #3a4558 50%);
}
.set-swatch-system .set-swatch-line {
  background: linear-gradient(90deg, #e3e8f0 50%, #2c3544 50%);
}
.set-theme-label {
  font-size: 13px;
  text-align: center;
  color: var(--text);
}
.set-theme.is-on .set-theme-label { font-weight: 600; }
.settings-page .field { margin-top: 14px; }
.settings-page .field > span { font-size: 12px; }
.set-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.set-actions .btn { min-height: 36px; padding: 0 14px; border-radius: 10px; }
.set-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.set-actions .set-note { margin: 0; }
.set-note.is-ok { color: #1d7a45; }
.set-note.is-bad { color: var(--danger); }
:root[data-theme="dark"] .set-note.is-ok { color: #7dcea0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .set-note.is-ok { color: #7dcea0; }
}
.set-import {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
}
.set-import:hover,
.set-import.is-over {
  border-color: var(--focus);
  background: var(--hover);
}
.set-import input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.set-import-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.set-import-mark svg { width: 18px; height: 18px; }
.set-import-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.set-import-copy strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-import-copy span { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .set-row { flex-direction: column; align-items: stretch; }
  .set-row select { width: 100%; }
  .set-themes { grid-template-columns: 1fr; }
  .set-actions { flex-direction: column; align-items: stretch; }
  .set-actions .btn { width: 100%; }
}
