:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f6f8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.assistant-link {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
}
.assistant-link:hover {
  background: #e0e7ff;
  text-decoration: none;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid #d9dee8;
  background: #eef1f5;
  padding: 18px 14px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 18px;
}
.brand a { color: #172033; }
.search-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  color: #6b7280;
}
.search-input {
  width: 100%;
  height: 38px;
  border: 1px solid #d2d7e1;
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: #172033;
}
.search-results {
  margin-top: 8px;
  border: 1px solid #d2d7e1;
  background: #fff;
}
.search-result {
  display: block;
  padding: 9px 10px;
  border-bottom: 1px solid #eceff4;
}
.search-result:last-child { border-bottom: 0; }
.search-result strong { display: block; color: #172033; font-size: 13px; }
.search-result span { display: block; color: #6b7280; font-size: 12px; margin-top: 3px; }
.tree { margin-top: 18px; }
.tree-group { margin-bottom: 18px; }
.tree-group h2 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tree-link {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  color: #374151;
  font-size: 13px;
  line-height: 1.35;
}
.tree-link:hover,
.tree-link.active {
  background: #dfe8f7;
  color: #1d4ed8;
  text-decoration: none;
}
.content {
  min-width: 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 80px;
  background: #fff;
}
.page-path {
  margin-bottom: 22px;
  color: #7b8494;
  font-size: 13px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 14px;
}
.wiki-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -10px 0 18px;
}
.wiki-action {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  cursor: pointer;
}
.wiki-action:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  text-decoration: none;
}
.markdown {
  line-height: 1.72;
  font-size: 16px;
}
.markdown h1,
.markdown h2,
.markdown h3 {
  line-height: 1.25;
  color: #111827;
}
.markdown h1 { font-size: 32px; margin: 0 0 24px; }
.markdown h2 { font-size: 23px; margin-top: 36px; padding-bottom: 6px; border-bottom: 1px solid #e5e7eb; }
.markdown h3 { font-size: 18px; margin-top: 28px; }
.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre,
.markdown table { margin: 14px 0; }
.markdown code {
  padding: 2px 5px;
  border-radius: 3px;
  background: #f3f4f6;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .92em;
}
.markdown pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid #d9dee8;
  background: #f8fafc;
}
.markdown pre code { padding: 0; background: transparent; }
.markdown blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 14px;
  color: #4b5563;
}
.markdown table {
  border-collapse: collapse;
  width: 100%;
}
.markdown th,
.markdown td {
  border: 1px solid #d9dee8;
  padding: 8px 10px;
}
.wikilink-dead { color: #9ca3af; }
.comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(420px, 100vw);
  height: 100vh;
  overflow: auto;
  border-left: 1px solid #d9dee8;
  background: #fff;
  padding: 16px;
  box-shadow: -10px 0 30px rgba(15, 23, 42, .08);
}
.comments-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.comments-panel__header span,
.comments-panel__hint {
  display: block;
  color: #6b7280;
  font-size: 13px;
}
.comments-panel__header button,
.comments-panel__save,
.comment-card button {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  padding: 7px 10px;
  cursor: pointer;
}
.comments-panel textarea {
  width: 100%;
  margin: 10px 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 10px;
  font: inherit;
  resize: vertical;
}
.comments-panel__save {
  width: 100%;
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}
.comment-card {
  margin-top: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 10px;
  background: #f8fafc;
}
.comment-card blockquote {
  margin: 0 0 8px;
  padding-left: 10px;
  border-left: 3px solid #93c5fd;
  color: #475569;
}
.comment-card p {
  margin: 0 0 10px;
  white-space: pre-wrap;
}
.comment-card__actions {
  display: flex;
  gap: 8px;
}
.comment-card.is-resolved {
  opacity: .62;
}
.assistant-page {
  display: block;
  min-height: 100vh;
  background: #f5f6f8;
}
.back-link {
  color: #4b5563;
  font-size: 14px;
}
.assistant-workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 300px minmax(0, 1fr);
  gap: 12px;
  padding: 28px;
}
.assistant-file-tree,
.assistant-conversations,
.assistant-thread {
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
}
.assistant-file-tree,
.assistant-conversations {
  min-height: calc(100vh - 56px);
  padding: 16px;
  overflow: auto;
}
.assistant-file-tree__tabs {
  display: inline-flex;
  margin: 14px 0;
  padding: 3px;
  border-radius: 8px;
  background: #f1f5f9;
}
.assistant-file-tree__tabs button,
.chat-composer__scope button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
}
.assistant-file-tree__tabs button.is-active,
.chat-composer__scope button.is-active {
  background: #fff;
  color: #4f46e5;
}
.assistant-page-list {
  margin-top: 14px;
}
.assistant-page-list a {
  display: block;
  padding: 7px 8px;
  border-radius: 4px;
  color: #4b5563;
}
.assistant-page-list a:hover {
  background: #eef2ff;
  text-decoration: none;
}
.assistant-conversations .btn-primary {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #6d5dfc;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.assistant-conversation-list {
  margin-top: 18px;
}
.assistant-conversation-item {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.assistant-conversation-item.is-active {
  border-color: #8b5cf6;
  background: #f5f3ff;
}
.assistant-conversation-item strong,
.assistant-conversation-item span {
  display: block;
}
.assistant-conversation-item span {
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-thread {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.assistant-thread__header {
  padding: 28px 32px;
  border-bottom: 1px solid #e5e7eb;
}
.assistant-thread__header h1 {
  margin: 8px 0 14px;
}
.assistant-runtime-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  width: fit-content;
  max-width: 560px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.assistant-runtime-card span {
  color: #6b7280;
}
.assistant-messages {
  overflow: auto;
  background: #fff;
  padding: 32px;
}
.assistant-message {
  max-width: 820px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  white-space: pre-wrap;
  line-height: 1.65;
}
.assistant-message-user {
  margin-left: auto;
  background: #eef2ff;
  border-color: #c7d2fe;
}
.assistant-message-assistant {
  background: #f8fafc;
}
.assistant-form {
  padding: 20px 32px 28px;
  border-top: 1px solid #e5e7eb;
}
.chat-composer__controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.chat-composer__controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chat-composer__controls select {
  min-width: 260px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
}
.chat-composer__scope {
  display: inline-flex;
  gap: 8px;
}
.assistant-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.5;
}
.assistant-form > button[type="submit"] {
  float: right;
  width: 92px;
  height: 42px;
  margin-top: 12px;
  border: 1px solid #1d4ed8;
  border-radius: 4px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 600;
}
.assistant-form > button[type="submit"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.chat-empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: #6b7280;
  text-align: center;
}
.chat-empty-state strong,
.chat-empty-state span {
  display: block;
}
@media (max-width: 760px) {
  body { display: block; }
  .sidebar {
    position: static;
    height: auto;
    max-height: 45vh;
    border-right: 0;
    border-bottom: 1px solid #d9dee8;
  }
  .content { padding: 24px 18px 64px; }
  .markdown h1 { font-size: 26px; }
  .assistant-link {
    top: 10px;
    right: 10px;
  }
  .assistant-workspace {
    display: block;
    padding: 10px;
  }
  .assistant-file-tree,
  .assistant-conversations,
  .assistant-thread {
    min-height: auto;
    margin-bottom: 10px;
  }
  .chat-composer__controls,
  .assistant-form {
    grid-template-columns: 1fr;
    display: grid;
  }
  .assistant-form > button[type="submit"] {
    width: 100%;
    height: 42px;
  }
}