:root {
  --blue: #9bcce7;
  --blue-light: #dceef7;
  --blue-muted: rgba(155, 204, 231, 0.45);
  --blue-glow: rgba(155, 204, 231, 0.18);
  --black: #080808;
  --gray-900: #111111;
  --gray-800: #1c1c1c;
  --gray-700: #4a4a4a;
  --gray-500: #767676;
  --gray-400: #9a9a9a;
  --gray-300: #d4d4d4;
  --gray-100: #f5f5f5;
  --white: #ffffff;
  --surface-dark: #0a0a0a;
  --surface-dark-border: #1e1e1e;
  --font-sans: "Inter", system-ui, sans-serif;
  --line: 1px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--black);
  background: var(--white);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.wordmark {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--black);
}

.wordmark--small {
  font-size: 1rem;
}

.wordmark--sidebar {
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.sidebar-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
  min-width: 0;
}

.etch-logo--sidebar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

/* ── Chat ─────────────────────────────────────────────── */

.page-chat {
  background: var(--white);
  height: 100vh;
  overflow: hidden;
}

.chat-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar-backdrop {
  display: none;
}

.chat-sidebar {
  flex: 0 0 auto;
  width: 260px;
  overflow: hidden;
  border-right: var(--line) solid var(--gray-300);
  background: var(--gray-100);
  transition:
    width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-sidebar__inner {
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.75rem;
  opacity: 1;
  transition: opacity 0.22s ease;
}

.chat-shell--sidebar-collapsed .chat-sidebar {
  width: 0;
  border-right-color: transparent;
}

.chat-shell--sidebar-collapsed .chat-sidebar__inner {
  opacity: 0;
}

.sidebar-toggle--expand {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  pointer-events: none;
  transition:
    opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.28s;
}

.chat-shell--sidebar-collapsed .sidebar-toggle--expand {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.chat-sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem 1rem;
}

.chat-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.25rem 1rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray-900);
}

.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-link--active {
  background: var(--white);
  border: var(--line) solid var(--gray-300);
}

.sidebar-link--muted {
  color: var(--gray-500);
  cursor: default;
}

.chat-sidebar__section {
  flex: 1;
  overflow: auto;
  padding: 0 0.25rem;
}

.sidebar-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin: 0 0 0.5rem 0.65rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-item {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.recent-item--active {
  background: var(--white);
  color: var(--black);
}

.recent-item--empty {
  color: var(--gray-500);
  font-style: italic;
}

.chat-sidebar__footer {
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: var(--line) solid var(--gray-300);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  border: var(--line) solid var(--blue-muted);
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.user-chip__label {
  font-size: 0.88rem;
  font-weight: 500;
}

.user-chip__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.user-chip__org {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--gray-400);
  line-height: 1.3;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0.5rem;
  border-bottom: var(--line) solid transparent;
}

.chat-header__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-700);
}

.chat-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 25vh;
  gap: 2rem;
}

.chat-empty__greeting {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-empty__greeting .etch-logo--lg {
  width: 96px;
  height: 96px;
}

.chat-empty__greeting h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 500;
}

.etch-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--black);
  line-height: 0;
}

.etch-logo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.etch-logo--sm {
  width: 36px;
  height: 36px;
}

.etch-logo--lg {
  width: 48px;
  height: 48px;
}

.etch-logo .etch-inner {
  color: var(--black);
}

.msg__tail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.msg__logo {
  margin: 0 0 0 -0.2rem;
  flex-shrink: 0;
}

.msg__logo .etch-logo--sm {
  width: 72px;
  height: 72px;
}

.msg__copy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0;
  flex-shrink: 0;
}

.msg__copy-btn {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--gray-500);
  background: transparent;
  border: var(--line) solid var(--gray-300);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.msg__copy-btn:hover:not(:disabled) {
  color: var(--black);
  border-color: var(--gray-400);
  background: var(--gray-100);
}

.msg__copy-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-thread {
  flex: 1;
  overflow: auto;
}

.messages {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.msg--user {
  align-items: flex-end;
}

.msg__bubble {
  max-width: min(85%, 32rem);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.84rem;
  background: var(--gray-100);
  border: var(--line) solid var(--gray-300);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--assistant .msg__body {
  font-size: 0.84rem;
  line-height: 1.65;
  word-break: break-word;
}

.msg__thinking {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--gray-500);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

@keyframes thinking-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.msg__thinking--active {
  background: linear-gradient(
    90deg,
    var(--gray-500) 0%,
    var(--black)    25%,
    var(--blue)     50%,
    var(--black)    75%,
    var(--gray-500) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: thinking-shimmer 2.2s ease-in-out infinite;
  font-size: 0.95rem;
}

.msg__status {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-style: italic;
}

.msg__status::before {
  content: "· ";
  color: var(--blue);
}

.msg__expert {
  margin-bottom: 0.35rem;
}

.msg__expert-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--gray-500);
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
}

.msg__expert-toggle::after {
  content: "▸";
  font-size: 0.72rem;
  color: var(--gray-400);
  transition: transform 0.15s ease;
}

.msg__expert--expanded .msg__expert-toggle::after {
  transform: rotate(90deg);
}

.msg__expert-toggle--active {
  background: linear-gradient(
    90deg,
    var(--gray-500) 0%,
    var(--black)    25%,
    var(--blue)     50%,
    var(--black)    75%,
    var(--gray-500) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: thinking-shimmer 2.2s ease-in-out infinite;
  font-size: 0.95rem;
}

.msg__expert-toggle:hover {
  color: var(--black);
}

.msg__expert-panel {
  margin-top: 0.45rem;
  padding-left: 0.15rem;
}

.msg__expert-stream {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 16rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.msg__expert-reason {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--gray-500);
}

.msg__expert-reason p {
  margin: 0;
}

.msg__expert-reason-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--gray-500);
}

.msg__expert-tool--etch {
  border-left-color: var(--violet, #7c3aed);
}

.msg__expert-tool {
  border-left: 2px solid var(--gray-300);
  padding-left: 0.65rem;
}

.msg__expert-tool--result {
  border-left-color: var(--blue);
}

.msg__expert-tool-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 0.2rem;
}

.msg__expert-tool-body {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--gray-500);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg__expert--live .msg__expert-stream {
  max-height: 24rem;
}

.msg__expert-stats {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  color: var(--gray-400);
}

.msg__expert--live .msg__expert-stats {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.chat-bottom {
  padding: 0 1.5rem 0.75rem;
}

.composer {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
}

.composer--center {
  width: min(100%, 42rem);
}

.composer__box {
  border: var(--line) solid var(--gray-300);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

.composer__box:focus-within {
  border-color: var(--blue-muted);
  box-shadow: 0 8px 28px rgba(155, 204, 231, 0.12);
}

.composer__box textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 1rem 1.1rem 0.5rem;
  min-height: 52px;
  max-height: 200px;
  background: transparent;
  line-height: 1.5;
}

.composer__toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.35rem 0.65rem 0.65rem;
}

.composer__right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.model-picker {
  position: relative;
}

.model-picker__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  border: var(--line) solid var(--gray-300);
  border-radius: 999px;
  background: var(--white);
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.model-picker__trigger:hover:not(:disabled) {
  border-color: var(--blue-muted);
  color: var(--black);
}

.model-picker__trigger[aria-expanded="true"] {
  border-color: var(--blue);
  background: var(--blue-glow);
  color: var(--black);
}

.model-picker--disabled .model-picker__trigger {
  opacity: 0.55;
  cursor: default;
}

.model-picker--disabled .model-picker__chevron {
  display: none;
}

.model-picker__trigger-text {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  min-width: 0;
}

.model-picker__label {
  font-weight: 500;
  color: var(--black);
}

.model-picker__tagline {
  color: var(--gray-500);
  font-size: 0.78rem;
  white-space: nowrap;
}

.model-picker__chevron {
  flex-shrink: 0;
  color: var(--gray-500);
  transition: transform 0.18s ease;
}

.model-picker__trigger[aria-expanded="true"] .model-picker__chevron {
  transform: rotate(180deg);
  color: var(--gray-700);
}

.model-picker__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 30;
  min-width: 15rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: var(--line) solid var(--gray-300);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.1);
}

.model-picker__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  border: none;
  border-radius: 10px;
  background: transparent;
  padding: 0.55rem 0.7rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.model-picker__option:hover:not(:disabled) {
  background: var(--gray-100);
}

.model-picker__option--selected {
  background: var(--blue-glow);
}

.model-picker__option--selected:hover:not(:disabled) {
  background: rgba(155, 204, 231, 0.22);
}

.model-picker__option:disabled {
  opacity: 0.45;
  cursor: default;
}

.model-picker__option-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--black);
}

.model-picker__option-desc {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.35;
}

.model-picker__option-desc--muted {
  font-style: italic;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-700);
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  background: var(--gray-100);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.85rem;
}

.pill {
  border: var(--line) solid var(--gray-300);
  background: var(--white);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  color: var(--gray-700);
  cursor: pointer;
}

.pill:hover {
  border-color: var(--blue-muted);
  color: var(--black);
}

.chat-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin: 0.65rem 0 0;
}

/* ── Markdown output ──────────────────────────────────── */

.msg--assistant .msg__body {
  font-size: 0.84rem;
  line-height: 1.7;
}

.msg--assistant .msg__body > *:first-child { margin-top: 0; }
.msg--assistant .msg__body > *:last-child  { margin-bottom: 0; }

.msg--assistant .msg__body p {
  margin: 0 0 0.8em;
}

.msg--assistant .msg__body h1,
.msg--assistant .msg__body h2,
.msg--assistant .msg__body h3,
.msg--assistant .msg__body h4,
.msg--assistant .msg__body h5,
.msg--assistant .msg__body h6 {
  font-weight: 600;
  line-height: 1.3;
  margin: 1.2em 0 0.4em;
}

.msg--assistant .msg__body h1 { font-size: 1.3em; }
.msg--assistant .msg__body h2 { font-size: 1.15em; }
.msg--assistant .msg__body h3 { font-size: 1.05em; }
.msg--assistant .msg__body h4 { font-size: 1em; }

.msg--assistant .msg__body ul,
.msg--assistant .msg__body ol {
  margin: 0.4em 0 0.8em;
  padding-left: 1.6em;
}

.msg--assistant .msg__body li {
  margin-bottom: 0.3em;
}

.msg--assistant .msg__body li > p {
  margin: 0;
}

/* Inline code */
.msg--assistant .msg__body :not(pre) > code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.875em;
  background: var(--gray-100);
  border: var(--line) solid var(--gray-300);
  border-radius: 4px;
  padding: 0.12em 0.38em;
}

/* Code blocks */
.msg--assistant .msg__body pre {
  position: relative;
  background: var(--gray-100);
  border: var(--line) solid var(--gray-300);
  border-radius: 10px;
  overflow-x: auto;
  margin: 0.8em 0;
  padding: 0;
}

.msg--assistant .msg__body pre code {
  display: block;
  border-radius: 10px;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  padding: 1em 1.15em;
  background: transparent;
  overflow-x: auto;
  white-space: pre;
}

.msg--assistant .msg__body pre code.hljs {
  border-radius: 10px;
  font-size: 0.84rem;
  padding: 1em 1.15em;
  background: transparent;
  overflow-x: auto;
}

/* Copy button */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.18em 0.55em;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  background: var(--white);
  border: var(--line) solid var(--gray-300);
  border-radius: 5px;
  cursor: pointer;
  color: var(--gray-600, var(--gray-700));
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.msg--assistant .msg__body pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: var(--gray-100);
}

/* Blockquote */
.msg--assistant .msg__body blockquote {
  border-left: 3px solid var(--blue);
  margin: 0.8em 0;
  padding: 0.2em 0.85em;
  color: var(--gray-700);
}

.msg--assistant .msg__body blockquote p {
  margin: 0;
}

/* Tables */
.msg--assistant .msg__body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8em 0;
  font-size: 0.92em;
}

.msg--assistant .msg__body th,
.msg--assistant .msg__body td {
  border: var(--line) solid var(--gray-300);
  padding: 0.45em 0.8em;
  text-align: left;
}

.msg--assistant .msg__body th {
  background: var(--gray-100);
  font-weight: 600;
}

.msg--assistant .msg__body tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* Links */
.msg--assistant .msg__body a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg--assistant .msg__body a:hover {
  color: var(--gray-700);
}

/* HR */
.msg--assistant .msg__body hr {
  border: none;
  border-top: var(--line) solid var(--gray-300);
  margin: 1em 0;
}

/* KaTeX display math */
.msg--assistant .msg__body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0.8em 0;
  padding: 0.25em 0;
}

@media (max-width: 900px) {
  .chat-shell--sidebar-collapsed .chat-sidebar {
    transform: translateX(-100%);
    width: min(280px, 85vw);
    border-right-color: var(--gray-300);
  }

  .chat-shell--sidebar-collapsed .chat-sidebar__inner {
    opacity: 1;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .chat-shell:not(.chat-shell--sidebar-collapsed) .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(280px, 85vw);
    transform: translateX(0);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.1);
  }

  .chat-sidebar__inner {
    width: min(280px, 85vw);
  }

  .chat-main {
    width: 100%;
  }
}

/* ── Documentation sidebar tree & pages ── */

.docs-tree-wrap {
  padding-top: 0.25rem;
}

.docs-tree {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.docs-tree__group {
  margin-bottom: 0.15rem;
}

.docs-tree__toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
}

.docs-tree__toggle:hover {
  color: var(--gray-700);
  background: rgba(0, 0, 0, 0.03);
}

.docs-tree__chevron {
  flex-shrink: 0;
  transition: transform 0.15s ease;
  transform: rotate(90deg);
}

.docs-tree__group--collapsed .docs-tree__chevron {
  transform: rotate(0deg);
}

.docs-tree__group--collapsed .docs-tree__items {
  display: none;
}

.docs-tree__items {
  list-style: none;
  margin: 0.1rem 0 0.35rem 0;
  padding: 0 0 0 0.35rem;
  border-left: 1px solid var(--gray-300);
}

.docs-tree__items li {
  margin: 0;
}

.docs-tree__link {
  display: block;
  padding: 0.38rem 0.55rem;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--gray-700);
  line-height: 1.35;
}

.docs-tree__link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--gray-900);
}

.docs-tree__link--active {
  background: var(--white);
  color: var(--black);
  border: var(--line) solid var(--gray-300);
  font-weight: 500;
}

.docs-tree__link--llms {
  margin-top: 0.5rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
}

.docs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  background: var(--white);
}

.docs-header {
  flex-shrink: 0;
}

.docs-content {
  flex: 1;
  overflow: auto;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--gray-800);
}

.docs-lede {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--gray-900);
  margin: 0 0 1.75rem;
}

.docs-h2 {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  color: var(--black);
}

.docs-h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  margin: 1.75rem 0 0.65rem;
  color: var(--black);
}

.docs-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}

.docs-list li {
  margin-bottom: 0.45rem;
}

.docs-note {
  font-size: 0.85rem;
  color: var(--gray-600);
  font-style: italic;
  margin-top: 0.75rem;
}

.docs-diagram {
  margin: 1.25rem 0 1.75rem;
  padding: 0;
}

.docs-diagram__pre {
  margin: 0;
  padding: 1rem 1.15rem;
  background: var(--gray-100);
  border: var(--line) solid var(--gray-300);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
}

.docs-table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.docs-table th,
.docs-table td {
  padding: 0.55rem 0.75rem;
  border: var(--line) solid var(--gray-300);
  text-align: left;
  vertical-align: top;
}

.docs-table th {
  background: var(--gray-100);
  font-weight: 600;
  font-size: 0.8rem;
}

.docs-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.expert-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.expert-card {
  padding: 1rem 1.15rem;
  border: var(--line) solid var(--gray-300);
  border-radius: 10px;
  background: var(--gray-100);
}

.expert-card__title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

.expert-card__tag {
  font-size: 0.78rem;
  color: var(--gray-600);
  margin: 0 0 0.65rem;
}

.expert-card p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.trace-metrics {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  background: var(--blue-light);
  border: var(--line) solid var(--blue-muted);
  border-radius: 10px;
}

.trace-metrics__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}

.trace-metrics__grid div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.trace-metrics__grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
  margin: 0;
}

.trace-metrics__grid dd {
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--blue);
}

.trace-stream {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.trace-event {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.trace-event--reasoning {
  background: var(--gray-100);
  border-left: 3px solid var(--gray-400);
  color: var(--gray-800);
}

.trace-event--tool {
  background: var(--white);
  border: var(--line) solid var(--gray-300);
}

.trace-event--result {
  background: rgba(34, 139, 34, 0.06);
  border-left: 3px solid #2d8a2d;
}

.trace-event__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.trace-event__args {
  margin: 0.45rem 0 0;
  padding: 0.5rem 0.65rem;
  background: var(--gray-100);
  border-radius: 6px;
  font-size: 0.78rem;
  overflow-x: auto;
}

.trace-handoff {
  margin: 0.5rem 0 1.5rem;
  padding: 1rem;
  background: var(--gray-100);
  border: var(--line) solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
}

.docs-content a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-content code {
  font-family: ui-monospace, monospace;
  font-size: 0.86em;
  background: var(--gray-100);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
