/* Explorer plus contextual page outline form the documentation navigation. */
:root {
  --header-height: 64px;
  --content-gutter: clamp(20px, 3vw, 46px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 14px 38px rgba(29, 45, 72, 0.08);
  --accent-contrast: var(--accent);
}

/* Assistant is a separate workspace, not a selected Wiki page. */
body.assistant-active .app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
}
body.assistant-active .details-panel {
  display: none !important;
}
body.assistant-active .main-stage {
  overflow: hidden;
}
.assistant-workspace {
  height: 100%;
  min-height: 0;
}
.assistant-chat {
  overflow: hidden;
}
.assistant-messages {
  min-height: 0;
}
.assistant-composer {
  flex: 0 0 auto;
}
.assistant-side {
  min-width: 230px;
}
.assistant-launch,
.assistant-launch:hover,
.assistant-launch:focus-visible,
.assistant-launch.active {
  color: var(--accent);
}
.assistant-citations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
}
.assistant-citations > b {
  width: auto;
  margin-right: 2px;
}
.assistant-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
}
.assistant-source b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.assistant-source small {
  white-space: nowrap;
}
.assistant-source span {
  display: none;
}
.assistant-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 790px;
  margin: 0 0 18px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.assistant-thinking b,
.assistant-thinking small {
  display: block;
}
.assistant-thinking .compact {
  margin-left: auto;
  padding: 6px 9px;
  font-size: 11px;
}
.assistant-sources {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.assistant-sources summary {
  cursor: pointer;
  color: var(--muted);
}
.assistant-sources a {
  display: block;
  width: fit-content;
  margin: 6px 0 0;
  color: var(--accent);
}
.assistant-limitations {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.assistant-proposal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.assistant-thinking b {
  color: var(--ink);
  font-size: 12px;
}
.assistant-thinking small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}
.assistant-activity {
  align-items: flex-start;
}
.assistant-activity-copy {
  min-width: 0;
  flex: 1;
}
.assistant-activity-copy > small {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
}
.assistant-activity-copy > b {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}
.assistant-progress-preamble {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.assistant-orbit {
  display: inline-flex;
  gap: 4px;
}
.assistant-orbit i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: assistant-dot 1s ease-in-out infinite;
}
.assistant-orbit i:nth-child(2) {
  animation-delay: 0.14s;
}
.assistant-orbit i:nth-child(3) {
  animation-delay: 0.28s;
}
@keyframes assistant-dot {
  50% {
    opacity: 0.3;
    transform: translateY(-3px);
  }
}
.assistant-start {
  max-width: 620px;
  margin: 14vh auto;
  padding: 28px;
  border-left: 3px solid var(--accent);
}
.assistant-start h1 {
  margin: 10px 0;
  font: 500 30px/1.15 var(--doc-mono);
}
.assistant-start p {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.6;
}
html,
body {
  overflow: hidden;
}
body,
input,
button,
select,
textarea {
  font-family:
    "Inter Variable",
    "Segoe UI Variable Text",
    Inter,
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 68%, transparent);
  outline-offset: 2px;
}
.topbar {
  padding-inline: 18px;
  border-color: color-mix(in srgb, var(--line) 85%, transparent);
}
.brand {
  min-width: 248px;
}
.global-search {
  height: 40px;
  max-width: 640px;
  border-radius: 10px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}
.global-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
  background: var(--surface);
}
.icon-button,
.top-create,
.secondary,
.primary,
.user-chip {
  transition:
    background-color 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease,
    box-shadow 0.14s ease;
}
.top-create {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease;
}
.top-create:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
}
.top-create:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: 2px;
}
.nav-rail {
  display: none !important;
}
.mobile-menu {
  display: none !important;
}
.app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) 292px !important;
}
.details-collapsed .app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
}
.explorer {
  border-right: 0;
}
.explorer-head {
  padding-bottom: 7px;
}
.explorer-resizer {
  position: relative;
  z-index: 12;
  background: var(--bg);
  cursor: col-resize;
  touch-action: none;
  outline: 0;
}
.explorer-resizer::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 2px;
  width: 1px;
  background: var(--line);
  transition:
    width 0.14s ease,
    background-color 0.14s ease,
    box-shadow 0.14s ease;
}
.explorer-resizer:hover::before,
.explorer-resizer:focus-visible::before,
.explorer-resizing .explorer-resizer::before {
  width: 3px;
  background: var(--accent-contrast);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--accent-contrast) 12%, transparent);
}
.explorer-resizing,
.explorer-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* Pragmatic Drag and Drop keeps each Explorer row in the same visual and
   pointer coordinate system, including at non-default content scale. */
.tree {
  overflow-x: hidden;
  padding: 2px 0 48px;
}
.tree-list {
  min-height: 4px;
}
.tree-node-hidden,
.tree-drag-descendant {
  display: none !important;
}
.tree-node {
  position: relative;
  min-height: 36px;
}
.tree-row {
  width: calc(100% - var(--depth) * 24px);
  margin-left: calc(var(--depth) * 24px);
  padding-left: 2px;
  user-select: none;
  transition:
    background-color 0.14s ease,
    color 0.14s ease,
    transform 0.14s ease,
    box-shadow 0.14s ease,
    margin-left 0.1s cubic-bezier(0.2, 0.9, 0.2, 1),
    width 0.1s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.tree-row:hover {
  background: color-mix(in srgb, var(--accent-contrast) 8%, white);
  transform: translateX(2px);
}
.tree-row.selected {
  color: var(--accent-contrast);
  box-shadow: inset 3px 0 var(--accent-contrast);
}
.tree-row,
.tree-main {
  cursor: default !important;
}
.tree-chevron {
  width: 28px;
  height: 32px;
  border-radius: 7px;
  flex: 0 0 28px;
  position: relative;
  z-index: 2;
  cursor: default !important;
  transition:
    background-color 0.14s ease,
    color 0.14s ease;
}
.tree-chevron:hover {
  background: color-mix(in srgb, var(--accent-contrast) 12%, white);
  color: var(--accent-contrast);
}
.tree-chevron:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: -2px;
}
.tree-main {
  min-height: 34px;
  touch-action: pan-y;
}
.tree-icon {
  transition:
    transform 0.14s ease,
    color 0.14s ease;
}
.tree-main:hover .tree-icon,
.tree-pdd-source .tree-icon {
  transform: translateX(2px);
}
.tree-more:focus-visible,
.tree-row:focus-within .tree-more {
  opacity: 1;
}
.tree-pdd-source > .tree-row {
  opacity: 0.4;
  transform: none !important;
}
/* Pragmatic Drag and Drop's list-item hitbox supplies before/after/combine.
   The UI feedback remains in the Explorer coordinate space at every font size. */
.tree-drop-before::before,
.tree-drop-after::after {
  content: "";
  position: absolute;
  z-index: 4;
  left: calc(var(--depth) * 24px + 7px);
  right: 10px;
  height: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent-contrast);
  box-shadow: 0 0 0 1px
    color-mix(in srgb, var(--accent-contrast) 20%, transparent);
  pointer-events: none;
}
.tree-drop-before::after,
.tree-drop-after::before {
  content: "";
  position: absolute;
  z-index: 4;
  left: calc(var(--depth) * 24px + 3px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-contrast);
  pointer-events: none;
}
.tree-drop-before::before {
  top: -1px;
}
.tree-drop-before::after {
  top: -4px;
}
.tree-drop-after::after {
  bottom: -1px;
}
.tree-drop-after::before {
  bottom: -4px;
}
.tree-combine-target > .tree-row {
  background: color-mix(in srgb, var(--accent-contrast) 13%, var(--surface));
  outline: 1px solid
    color-mix(in srgb, var(--accent-contrast) 62%, var(--surface));
  outline-offset: -1px;
}
.tree-pdd-preview {
  box-sizing: border-box;
  max-width: 276px;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-contrast) 35%, var(--line));
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(30, 50, 82, 0.24);
  font: inherit;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-touch-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  margin: 0;
  opacity: 0.96;
}
.tree-drop-pending > .tree-row,
.tree-drop-confirmed > .tree-row {
  animation: tree-drop-confirm 0.42s ease-out;
}
@keyframes tree-drop-confirm {
  0% {
    background: color-mix(in srgb, var(--accent-contrast) 20%, var(--surface));
    box-shadow: inset 4px 0 var(--accent-contrast);
  }
  100% {
    background: transparent;
  }
}
.tree-drop-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.tree-dragging,
.tree-dragging * {
  cursor: default !important;
  user-select: none !important;
}
.tree-dragging .tree-row:hover {
  transform: none;
}
.tree-hint {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  padding: 3px 5px 13px;
  line-height: 1.2;
}
.tree-hint span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tree-hint span + span::before {
  content: "·";
  margin-right: 1px;
  color: var(--line);
}

/* Editor uses the full center workspace instead of a fixed 1200px island. */
.editor-shell {
  width: 100%;
  max-width: none;
  padding: 22px 16px 24px;
}
.editor-top,
.editor-title-row,
.editor-tabs,
.editor-grid {
  align-self: stretch;
  max-width: none !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.editor-title-row {
  margin-top: 24px;
}
.editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.editor-grid > * {
  width: 100%;
  min-width: 0;
}
.editor-control-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.editor-control-row .editor-tabs {
  flex: 0 0 auto;
  width: auto !important;
  border: 0;
  margin: 0;
}
.markdown-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 0;
  overflow: visible;
}
.markdown-toolbar button {
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: default;
}
.markdown-toolbar button:hover,
.markdown-toolbar button:focus-visible {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  color: var(--accent-contrast);
  outline: 0;
}
.markdown-toolbar > span {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 3px;
}
.markdown-toolbar #editor-wiki-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: auto;
}
.editor-code {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: inset 0 1px 4px rgba(34, 54, 87, 0.03);
}
.editor-code:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.editor-code .cm-editor {
  height: 100%;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
}
.editor-code .cm-scroller {
  padding: 14px 7px;
  font-family:
    ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.7;
}
.editor-code .cm-gutters {
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
  color: var(--muted);
}
.editor-code .cm-activeLine,
.editor-code .cm-activeLineGutter {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.editor-grid.preview .editor-code,
.editor-grid.write .preview {
  display: none;
}
.editor-grid.write .editor-code {
  display: block;
}
.editor-fullscreen .topbar,
.editor-fullscreen .explorer,
.editor-fullscreen .explorer-resizer,
.editor-fullscreen .page-outline {
  display: none !important;
}
.editor-fullscreen .app-body,
.editor-fullscreen.editor-active .app-body {
  grid-template-columns: minmax(0, 1fr) !important;
  height: 100vh;
}
.editor-fullscreen .main-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.editor-fullscreen .editor-shell {
  padding: 18px clamp(18px, 3vw, 56px);
}
.wide-input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.wiki-link-results {
  max-height: 440px;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.wiki-link-results button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.wiki-link-results button:last-child {
  border-bottom: 0;
}
.wiki-link-results button:hover,
.wiki-link-results button:focus-visible {
  background: var(--accent-soft);
  outline: 0;
}
.wiki-link-results span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.wiki-link-results small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-layout {
  display: block;
}
.page-toc {
  display: none !important;
}
.page-outline {
  display: none;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 25px 15px 36px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 76%, var(--bg));
}
.outline-visible .page-outline {
  display: block;
}
.page-outline-head {
  display: grid;
  gap: 5px;
  padding: 0 7px 15px;
  border-bottom: 1px solid var(--line);
}
.page-outline-head strong {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.page-outline-links {
  display: grid;
  gap: 3px;
  padding-top: 13px;
}
.page-outline-links a {
  position: relative;
  overflow: hidden;
  padding: 7px 8px 7px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: normal;
}
.page-outline-links a::before {
  content: "";
  position: absolute;
  inset: 7px auto 7px 0;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}
.page-outline-links a:hover,
.page-outline-links a:focus-visible,
.page-outline-links a.active {
  background: var(--accent-soft);
  color: var(--accent-contrast);
}
.page-outline-links a.active {
  font-weight: 700;
}
.page-outline-links a.active::before {
  background: var(--accent-contrast);
}
.page-outline-links .outline-h3 {
  padding-left: 21px;
}
.page-outline-links .outline-h4 {
  padding-left: 32px;
  color: var(--faint);
  font-size: 12px;
}
.markdown :is(h2, h3, h4) {
  scroll-margin-top: 24px;
}
.backlink-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.backlink-list button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: default;
}
.backlink-list button:last-child {
  border-bottom: 0;
}
.backlink-list button:hover {
  background: var(--accent-soft);
}
.backlink-list span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.backlink-list small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-grid textarea,
.preview {
  border-radius: 9px;
}
.editor-active .app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
}
.outline-visible .app-body {
  grid-template-columns:
    var(--explorer-width, 294px) 6px 218px minmax(0, 1fr)
    292px !important;
}
.outline-visible.details-collapsed .app-body,
.editor-active.outline-visible .app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px 218px minmax(0, 1fr) !important;
}
.editor-active .details-panel {
  display: none !important;
}
.editor-active .editor-shell {
  padding-inline: clamp(18px, 2.5vw, 38px);
}
.editor-grid textarea {
  font-size: 13.5px;
  line-height: 1.7;
  padding: 22px;
}
.preview {
  padding: 26px 30px;
}
.preview .split-preview-active {
  box-shadow: inset 3px 0 0 var(--accent);
  scroll-margin-top: 12px;
}
html[data-theme="dark"] .editor-code .cm-cursor,
html[data-theme="dark"] .editor-code .cm-dropCursor {
  border-left-color: var(--ink) !important;
}

@media (max-width: 1500px) {
  .outline-visible .page-outline {
    display: none;
  }
  .outline-visible .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) 292px !important;
  }
  .outline-visible.details-collapsed .app-body,
  .editor-active.outline-visible .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
  }
}

/* A roomy document canvas that still preserves readable line length. */
.content-wrap {
  width: calc(100% - 2 * var(--content-gutter));
  max-width: 1180px;
  margin: 0 auto;
  padding: 25px 0 52px;
}
html[data-contentWidth="focused"] .content-wrap {
  max-width: 900px;
}
.content-top {
  min-width: 0;
}
.breadcrumbs {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.breadcrumbs a,
.breadcrumbs strong {
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumbs a:hover {
  color: var(--accent);
}
.breadcrumb-separator {
  color: var(--faint);
  flex: 0 0 auto;
}
.article {
  padding: clamp(36px, 4vw, 54px) clamp(30px, 4vw, 58px) clamp(46px, 5vw, 66px);
  margin-top: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.article h1 {
  font-size: clamp(34px, 3.1vw, 44px);
  text-wrap: balance;
}
.article-rule {
  margin: 24px 0 28px;
}
.markdown {
  max-width: 850px;
  font-size: 15.5px;
  line-height: 1.66;
  overflow-wrap: anywhere;
}
.markdown p {
  margin-bottom: 1.15em;
}
.markdown img {
  max-width: 100%;
  height: auto;
}
.markdown pre {
  max-width: 100%;
  overflow: auto;
}
.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.markdown :is(h1, h2, h3, h4, h5, h6) {
  position: relative;
}
.heading-anchor {
  display: inline-block;
  margin-left: 8px;
  color: var(--faint) !important;
  text-decoration: none !important;
  font-size: 0.68em;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-1px);
  transition:
    opacity 0.14s ease,
    color 0.14s ease;
}
.markdown :is(h1, h2, h3, h4, h5, h6):hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
  color: var(--accent) !important;
}
.markdown pre {
  position: relative;
  padding-top: 42px;
}
.markdown pre[data-language]::before {
  content: attr(data-language);
  position: absolute;
  top: 13px;
  left: 17px;
  color: #8292a2;
  font:
    700 10px/1 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #aebbd0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
}
.code-copy:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.hljs-comment,
.hljs-quote {
  color: #8292a2;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in {
  color: #ff7ab2;
}
.hljs-string,
.hljs-attr,
.hljs-symbol {
  color: #a6e3a1;
}
.hljs-number,
.hljs-literal {
  color: #c6a0f6;
}
.hljs-title,
.hljs-section,
.hljs-function {
  color: #89dceb;
}
.hljs-variable,
.hljs-template-variable {
  color: #f5a97f;
}
.hljs-meta {
  color: #eed49f;
}
.article-footer {
  padding-top: 14px;
}
.details-reopen {
  display: none !important;
}
.details-collapsed .details-reopen {
  display: grid !important;
}

/* Faster folder management and lower-priority metadata. */
.folder-hero-copy {
  min-width: 0;
  flex: 1;
}
.folder-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.folder-title-line h1 {
  margin-right: 0;
}
.inline-edit {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  opacity: 0.55;
  transition: 0.15s;
}
.folder-title-line:hover .inline-edit,
.inline-edit:focus-visible {
  opacity: 1;
  background: var(--accent-soft);
  color: var(--accent);
}
.details-actions {
  margin-top: 20px;
}
.details-metadata {
  margin-top: 18px;
  padding-top: 10px;
}
.details-metadata > div {
  padding: 7px 0;
}
.folder-hero {
  padding: 24px 26px;
  margin-top: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.folder-hero-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--folder-accent) 12%, var(--surface));
}
.folder-hero h1 {
  font-size: clamp(27px, 2.5vw, 34px);
}
.child-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.child-card {
  min-height: 72px;
  background: var(--surface);
  text-decoration: none;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(29, 45, 72, 0.025);
}
.child-card:hover {
  box-shadow: 0 9px 25px rgba(29, 45, 72, 0.09);
}
.child-card-icon,
.detail-icon {
  background: color-mix(in srgb, var(--node-color) 12%, var(--surface));
}

/* Mobile Explorer is a true drawer with a dismissible backdrop. */
.mobile-scrim {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0;
  background: rgba(13, 22, 36, 0.38);
  backdrop-filter: blur(2px);
  z-index: 23;
  border: 0;
}

/* Searchable Lucide icon library. */
.appearance-modal {
  width: min(760px, 100%);
}
.icon-picker {
  margin-top: 17px;
}
.icon-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 9px;
}
.icon-picker-head b,
.icon-picker-head small {
  display: block;
}
.icon-picker-head b {
  color: #4f5e75;
  font-size: 12px;
}
.icon-picker-head small {
  color: #99a5b5;
  font-size: 11px;
  margin-top: 2px;
}
.icon-picker > input {
  margin: 0 !important;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  max-height: 300px;
  overflow: auto;
  padding: 9px 2px 2px;
  margin-top: 4px;
}
.icon-choice {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 4px;
  transition: 0.14s;
}
.icon-choice span {
  max-width: 100%;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-choice:hover,
.icon-choice.selected {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Light, dark and system appearance. */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1520;
  --surface: #151e2b;
  --surface-2: #1b2636;
  --ink: #e6edf7;
  --muted: #98a6ba;
  --faint: #718096;
  --line: #2a3749;
  --accent-contrast: color-mix(in srgb, var(--accent) 42%, #dbe7f6 58%);
  --accent-soft: color-mix(in srgb, var(--accent-contrast) 20%, #151e2b);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] .explorer {
  background: #111a27;
}
html[data-theme="dark"]
  :is(
    .topbar,
    .details-panel,
    .article,
    .folder-hero,
    .child-card,
    .modal-card,
    .preview,
    .editor-grid textarea,
    .secondary,
    .icon-button.outlined,
    .global-search kbd,
    .icon-choice,
    .search-popover,
    .search-result
  ) {
  background: var(--surface);
  color: var(--ink);
}
html[data-theme="dark"] .top-create {
  background: var(--surface);
  color: var(--ink);
}
html[data-theme="dark"]
  :is(
    .global-search,
    .modal-body input,
    .modal-body textarea,
    .modal-body select,
    .settings-section select
  ) {
  background: var(--surface-2);
  color: var(--ink);
}
html[data-theme="dark"]
  :is(
    .article h1,
    .markdown h1,
    .markdown h2,
    .markdown h3,
    .folder-hero h1,
    .detail-title,
    .settings-section b,
    .icon-picker-head b
  ) {
  color: var(--ink);
}
html[data-theme="dark"] .markdown code {
  background: #222f42;
  color: #d8e5f5;
}
html[data-theme="dark"] .markdown {
  color: #c8d2df;
}
html[data-theme="dark"]
  :is(
    .tree-row,
    .action-row,
    .detail-path,
    .detail-list b,
    .folder-hero p,
    .child-card small,
    .settings-section small
  ) {
  color: var(--muted);
}
html[data-theme="dark"] .markdown th {
  color: var(--ink);
}
html[data-theme="dark"] :is(.tree-icon, .child-card-icon, .detail-icon) {
  color: var(--muted);
  color: color-mix(in srgb, var(--node-color, var(--accent)) 42%, #dbe7f6 58%);
}
html[data-theme="dark"] .folder-hero-icon {
  color: var(--muted);
  color: color-mix(
    in srgb,
    var(--folder-accent, var(--accent)) 42%,
    #dbe7f6 58%
  );
}
html[data-theme="dark"] .empty-card,
html[data-theme="dark"] .empty-state {
  background: rgba(21, 30, 43, 0.65);
}
html[data-theme="dark"]
  :is(.tree-row:hover, .tree-chevron:hover, .tree-combine-target > .tree-row) {
  background: color-mix(in srgb, var(--accent-contrast) 16%, var(--surface));
}
html[data-theme="dark"] :is(.action-row.danger:hover, .confirm-danger > span) {
  background: color-mix(in srgb, var(--danger) 17%, var(--surface));
}
html[data-theme="dark"]
  :is(.trash-row b, .confirm-danger b, .detail-list b, .token-row b) {
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #0e1520;
    --surface: #151e2b;
    --surface-2: #1b2636;
    --ink: #e6edf7;
    --muted: #98a6ba;
    --faint: #718096;
    --line: #2a3749;
    --accent-contrast: color-mix(in srgb, var(--accent) 42%, #dbe7f6 58%);
    --accent-soft: color-mix(in srgb, var(--accent-contrast) 20%, #151e2b);
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  }
  html[data-theme="system"] .explorer {
    background: #111a27;
  }
  html[data-theme="system"]
    :is(
      .topbar,
      .details-panel,
      .article,
      .folder-hero,
      .child-card,
      .modal-card,
      .preview,
      .editor-grid textarea,
      .secondary,
      .icon-button.outlined,
      .global-search kbd,
      .icon-choice,
      .search-popover,
      .search-result
    ) {
    background: var(--surface);
    color: var(--ink);
  }
  html[data-theme="system"]
    :is(
      .global-search,
      .modal-body input,
      .modal-body textarea,
      .modal-body select,
      .settings-section select
    ) {
    background: var(--surface-2);
    color: var(--ink);
  }
  html[data-theme="system"]
    :is(
      .article h1,
      .markdown h1,
      .markdown h2,
      .markdown h3,
      .folder-hero h1,
      .detail-title,
      .settings-section b,
      .icon-picker-head b
    ) {
    color: var(--ink);
  }
  html[data-theme="system"] .markdown code {
    background: #222f42;
    color: #d8e5f5;
  }
  html[data-theme="system"] .markdown {
    color: #c8d2df;
  }
  html[data-theme="system"]
    :is(
      .tree-row,
      .action-row,
      .detail-path,
      .detail-list b,
      .folder-hero p,
      .child-card small,
      .settings-section small
    ) {
    color: var(--muted);
  }
  html[data-theme="system"] .markdown th {
    color: var(--ink);
  }
  html[data-theme="system"] :is(.tree-icon, .child-card-icon, .detail-icon) {
    color: var(--muted);
    color: color-mix(
      in srgb,
      var(--node-color, var(--accent)) 42%,
      #dbe7f6 58%
    );
  }
  html[data-theme="system"] .folder-hero-icon {
    color: var(--muted);
    color: color-mix(
      in srgb,
      var(--folder-accent, var(--accent)) 42%,
      #dbe7f6 58%
    );
  }
  html[data-theme="system"] .empty-card,
  html[data-theme="system"] .empty-state {
    background: rgba(21, 30, 43, 0.65);
  }
  html[data-theme="system"]
    :is(.tree-row:hover, .tree-chevron:hover, .tree-combine-target > .tree-row) {
    background: color-mix(in srgb, var(--accent-contrast) 16%, var(--surface));
  }
}

/* The application chrome follows KronForge's fixed brand accent. Folder and
   page presentation colors remain independent metadata; they do not replace
   the navigation, link, or focus accent. !important deliberately wins over
   stale browser-local appearance values from earlier visual profiles. */
:root {
  --accent: #e8590c !important;
}

:is(
  .tree-row:hover,
  .tree-row.selected,
  .tree-combine-target > .tree-row
) {
  background: color-mix(in srgb, #e8590c 14%, var(--surface)) !important;
  box-shadow: inset 3px 0 #e8590c !important;
}

:is(
    .tree-row:hover,
    .tree-row.selected,
    .tree-combine-target > .tree-row
  )
  :is(.tree-main, .tree-name, .tree-rev, .tree-icon) {
  color: #e8590c !important;
}

:is(
  .markdown a:hover,
  .breadcrumbs a:hover,
  .page-outline-links a:hover,
  .page-outline-links a:focus-visible,
  .page-outline-links a.active,
  .top-nav-item:hover,
  .top-nav-item:focus-visible,
  .top-nav-item.active,
  .article-utility:hover,
  .article-utility:focus-visible,
  .tree-more:hover,
  .tree-more:focus-visible
) {
  color: #e8590c !important;
}

/* Recoverable trash workflow. */
.trash-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.trash-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.trash-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.trash-row > div {
  flex: 1;
  min-width: 0;
}
.trash-row b,
.trash-row small {
  display: block;
}
.trash-row b {
  color: #4c5c74;
}
.trash-row small {
  color: #96a2b3;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}
.trash-loading {
  padding: 26px;
  text-align: center;
  color: var(--muted);
}
.empty-card.compact {
  padding: 28px;
}
.confirm-danger {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 8px 0 2px;
}

/* Daytona-inspired developer documentation profile. The Explorer remains the
   source of truth; this layer changes only presentation and page navigation. */
:root {
  --bg: #f9faf9;
  --surface: #ffffff;
  --surface-2: #f3f4f3;
  --ink: #1c1e20;
  --muted: #74777b;
  --faint: #a4a7aa;
  --line: #e2e4e2;
  --accent: #e8590c;
  --accent-deep: #d14b08;
  --doc-mono:
    "Berkeley Mono", "Cascadia Mono", "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;
  --doc-sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --shadow: none;
}

body,
input,
button,
select,
textarea {
  font-family: var(--doc-sans);
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--ink);
}

.topbar {
  height: 92px;
  padding-inline: 22px;
  gap: 18px;
  background: var(--surface);
  border-bottom-color: var(--line);
}

.brand {
  min-width: 0;
  gap: 14px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.brand-mark {
  width: 47px;
  height: 47px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
}

.brand-text {
  color: var(--ink);
  font-family: var(--doc-sans);
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.brand-text b {
  color: var(--muted);
  font-weight: 500;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: max-content;
}

.top-nav::before {
  content: "/";
  margin-right: 11px;
  color: var(--muted);
  font: 500 18px/1 var(--doc-mono);
}

.top-nav-item {
  height: 32px;
  padding: 0 8px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 700 12px/1 var(--doc-mono);
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.top-nav-item:hover,
.top-nav-item:focus-visible,
.top-nav-item.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--ink);
  outline: 0;
}

.assistant-launch {
  height: 32px;
  margin-left: 0;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font: 750 12px/1 var(--doc-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.assistant-launch:hover,
.assistant-launch:focus-visible,
.assistant-launch.active {
  background: color-mix(in srgb, var(--accent) 17%, var(--surface));
  outline: 0;
}

.global-search {
  flex: 0 1 350px;
  height: 38px;
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: none;
}

.top-search-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Keep Search in the right-side action cluster. Only its leading text-size
     control belongs immediately before it; this container must not consume
     the open space between navigation and Search. */
  flex: 0 1 760px;
  width: min(760px, 100%);
  min-width: 0;
  margin-left: auto;
}

.top-search-tools .global-search {
  flex: 1 1 350px;
  min-width: 0;
  margin-left: 0;
}

.global-search kbd {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0 0 0 8px;
  background: transparent;
  font-family: var(--doc-mono);
}

.top-actions {
  margin-left: 0;
  gap: 5px;
}

.top-actions > :is(#activity, #attachments, #api-docs) {
  display: none;
}

.top-create {
  height: 34px;
  border-radius: 5px;
  border-color: var(--line);
  font: 700 12px/1 var(--doc-mono);
  letter-spacing: 0.02em;
}

.explorer {
  padding: 20px 14px 14px;
  background: var(--surface);
}

.explorer-head {
  padding: 0 5px 10px;
}

.explorer h2,
.eyebrow,
.tree-name,
.tree-hint,
.page-outline-head strong {
  font-family: var(--doc-mono);
}

.explorer h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.055em;
}

.eyebrow {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.explorer-head .eyebrow {
  display: none;
}

.tree-hint {
  gap: 6px;
  padding: 5px 6px 16px;
  color: var(--faint);
  font-size: 10px;
}

.tree-context-menu {
  position: fixed;
  z-index: 1200;
  width: 194px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
}

.tree-context-action {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: 600 12px/1 var(--doc-sans);
}

.tree-context-action:hover,
.tree-context-action:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--ink);
  outline: none;
}

.tree-context-action.danger {
  color: var(--danger);
}

.tree-context-action.danger:hover,
.tree-context-action.danger:focus-visible {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
}

.tree-context-separator {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

.tree-row {
  min-height: 33px;
  border-radius: 5px;
}

.tree-name {
  font-size: 12.5px;
  letter-spacing: -0.02em;
}

.tree-row:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  transform: none;
}

.tree-row.selected,
.tree-pdd-source > .tree-row {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: inset 2px 0 var(--accent);
}

.main-stage {
  background: var(--bg);
}

.content-wrap {
  width: calc(100% - 2 * clamp(24px, 4vw, 62px));
  max-width: 1060px;
  padding: 32px 0 70px;
}

html[data-contentWidth="focused"] .content-wrap {
  max-width: 820px;
}

.breadcrumbs,
.page-actions {
  font-size: 11px;
}

.page-actions .page-edit-button {
  width: 36px;
  height: 36px;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
}

.page-actions .page-edit-button .ico {
  stroke-width: 2.35;
}

.page-actions .page-edit-button:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.breadcrumbs {
  font-family: var(--doc-mono);
}

.secondary,
.primary,
.icon-button.outlined {
  border-radius: 5px;
  box-shadow: none;
}

.article {
  margin-top: 26px;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.article-kicker {
  color: var(--accent);
  font-family: var(--doc-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.article h1 {
  margin: 18px 0 14px;
  color: var(--ink);
  font-family: var(--doc-mono);
  font-size: clamp(32px, 2.25vw, 38px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1.14;
}

.article-meta {
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.article-utilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 21px;
}

.article-utility {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 700 11px/1 var(--doc-sans);
}

.article-utility:hover,
.article-utility:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  outline: 0;
}

.article-rule {
  margin: 18px 0 27px;
  background: var(--line);
}

.article-footer {
  display: none;
}

.markdown {
  max-width: 790px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  color: var(--ink);
  font-family: var(--doc-mono);
  font-weight: 550;
  letter-spacing: -0.065em;
}

.markdown h1 {
  margin-top: 1.65em;
  font-size: 30px;
  line-height: 1.18;
}

/* The leading H1 is the page title; it starts the document without a duplicate app title. */
.markdown > h1:first-child {
  margin-top: 0;
  font-size: clamp(32px, 2.25vw, 38px);
  line-height: 1.14;
}

.markdown h2 {
  margin-top: 2em;
  border-bottom: 0;
  padding-bottom: 0;
  font-size: 25px;
  line-height: 1.24;
}

.markdown h3 {
  margin-top: 1.8em;
  font-size: 20px;
  line-height: 1.3;
}

.markdown h4 {
  margin-top: 1.7em;
  font-size: 17px;
  line-height: 1.35;
}

.markdown a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.markdown a:hover {
  color: var(--accent);
}

.markdown code {
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: color-mix(in srgb, var(--accent) 78%, var(--ink));
  font-family: var(--doc-mono);
}

.markdown pre {
  border: 1px solid #2a2d2f;
  border-radius: 6px;
  background: #101112;
  box-shadow: none;
}

.page-outline {
  padding: 42px 17px 32px;
  border-right: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.page-outline-head {
  padding: 0 4px 14px;
  border-bottom-color: var(--line);
}

.page-outline-head strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.page-outline-links {
  gap: 1px;
  padding-top: 13px;
}

.page-outline-links a {
  padding: 7px 7px 7px 10px;
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--doc-sans);
  font-size: 12px;
}

.page-outline-links a:hover,
.page-outline-links a:focus-visible,
.page-outline-links a.active {
  background: transparent;
  color: var(--ink);
}

.page-outline-links a.active::before {
  width: 2px;
  background: var(--accent);
}

.outline-visible .app-body {
  grid-template-columns:
    var(--explorer-width, 294px) 6px minmax(0, 1fr)
    226px 292px !important;
}

.outline-visible.details-collapsed .app-body,
.editor-active.outline-visible .app-body {
  grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) 226px !important;
}

.details-panel {
  padding: 27px 18px;
  background: var(--surface);
}

.details-head h3,
.detail-title {
  font-family: var(--doc-mono);
  letter-spacing: -0.045em;
}

.action-row {
  border-radius: 5px;
}

html[data-theme="dark"] {
  --bg: #090a0b;
  --surface: #0e1011;
  --surface-2: #151718;
  --ink: #f0f1ef;
  --muted: #a1a5a5;
  --faint: #707477;
  --line: #282b2d;
  --accent-contrast: color-mix(in srgb, var(--accent) 68%, #f0f1ef 32%);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --shadow: none;
}

html[data-theme="dark"] :is(.topbar, .explorer, .page-outline, .details-panel) {
  background: var(--surface);
}

html[data-theme="dark"] .article {
  border: 0;
  background: transparent !important;
  box-shadow: none;
}

html[data-theme="dark"] .markdown {
  color: #d0d3d1;
}

html[data-theme="dark"] .markdown code {
  background: color-mix(in srgb, var(--accent) 11%, #151718);
  color: color-mix(in srgb, var(--accent) 78%, #e7f1ec);
}

html[data-theme="dark"] .tree-row:hover,
html[data-theme="dark"] .tree-row.selected {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #090a0b;
    --surface: #0e1011;
    --surface-2: #151718;
    --ink: #f0f1ef;
    --muted: #a1a5a5;
    --faint: #707477;
    --line: #282b2d;
    --accent-contrast: color-mix(in srgb, var(--accent) 68%, #f0f1ef 32%);
    --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
    --shadow: none;
  }

  html[data-theme="system"]
    :is(.topbar, .explorer, .page-outline, .details-panel) {
    background: var(--surface);
  }

  html[data-theme="system"] .article {
    border: 0;
    background: transparent !important;
    box-shadow: none;
  }

  html[data-theme="system"] .markdown {
    color: #d0d3d1;
  }
}

@media (max-width: 1500px) {
  .outline-visible .page-outline {
    display: none;
  }

  .outline-visible .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) 292px !important;
  }

  .outline-visible.details-collapsed .app-body,
  .editor-active.outline-visible .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
  }
}

@media (max-width: 1120px) {
  .top-nav {
    display: none;
  }

  .global-search {
    flex: 1;
  }
}
.confirm-danger > span {
  width: 43px;
  height: 43px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: #fff0f2;
  flex: 0 0 auto;
}
.confirm-danger b {
  display: block;
  color: #3d4d65;
  font-size: 15px;
}
.confirm-danger p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.danger-button {
  background: var(--danger) !important;
  box-shadow: 0 5px 13px rgba(217, 95, 112, 0.22) !important;
}
button:disabled {
  opacity: 0.58;
  cursor: not-allowed !important;
  transform: none !important;
}

@media (max-width: 1180px) {
  .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) 256px !important;
  }
}
@media (max-width: 930px) {
  .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
  }
  .details-panel {
    display: none !important;
  }
  .details-collapsed .app-body {
    grid-template-columns: var(--explorer-width, 294px) 6px minmax(0, 1fr) !important;
  }
}
@media (max-width: 1050px) {
  .top-create {
    width: 34px;
    padding: 0;
  }
  .top-create span {
    display: none;
  }
}
@media (max-width: 700px) {
  :root {
    --content-gutter: 13px;
  }
  .topbar {
    gap: 6px;
    padding-inline: 10px;
  }
  .topbar .brand {
    display: none;
  }
  .global-search {
    min-width: 0;
  }
  .top-search-tools {
    gap: 5px;
  }
  .content-font-controls {
    display: none;
  }
  .global-search kbd {
    display: none;
  }
  .top-actions {
    gap: 4px;
    flex: 0 0 auto;
  }
  .user-chip {
    width: 37px;
    padding: 0 4px;
  }
  .user-chip > .ico {
    display: none;
  }
  .mobile-menu {
    display: grid !important;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex: 0 0 auto;
  }
  .app-body {
    display: block !important;
  }
  .explorer-resizer {
    display: none !important;
  }
  .explorer {
    position: fixed;
    z-index: 24;
    left: 0;
    top: 64px;
    bottom: 0;
    width: min(86vw, 330px);
    transform: translateX(-105%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 24px 70px rgba(10, 20, 35, 0.28);
  }
  body.mobile-open .explorer {
    transform: translateX(0) !important;
  }
  .mobile-open .mobile-scrim {
    display: block;
  }
  .content-wrap {
    width: calc(100% - 2 * var(--content-gutter));
    max-width: none;
    margin: 0 auto;
    padding-top: 16px;
  }
  .content-top {
    gap: 10px;
  }
  .breadcrumbs {
    font-size: 11px;
  }
  .page-actions {
    gap: 6px;
  }
  .article {
    padding: 30px 22px 40px;
    margin-top: 15px;
    border-radius: 12px;
  }
  .article h1 {
    font-size: 29px;
  }
  .article-meta {
    gap: 10px;
    font-size: 11px;
  }
  .article-rule {
    margin: 22px 0;
  }
  .markdown {
    font-size: 15px;
  }
  .folder-hero {
    padding: 20px 18px;
    gap: 14px;
  }
  .folder-hero-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  .folder-hero p {
    font-size: 13px;
  }
  .child-grid {
    grid-template-columns: 1fr;
  }
  .child-card {
    min-height: 66px;
  }
  .icon-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .modal {
    padding: 10px;
    place-items: end center;
  }
  .modal-card {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 16px 16px 12px 12px;
  }
  .editor-top {
    align-items: flex-start;
  }
  .editor-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .editor-actions .secondary,
  .editor-actions .primary {
    height: 33px;
    padding-inline: 9px;
  }
  .editor-actions kbd {
    display: none;
  }
}

/* Professional knowledge-management workflows */
.editor-status[data-kind="saving"] .status-dot {
  background: #e6a340;
  box-shadow: 0 0 0 4px #fff4dc;
}
.editor-status[data-kind="local"] .status-dot {
  background: #8190a6;
  box-shadow: none;
}
.editor-status[data-kind="saved"] .status-dot {
  background: #44b882;
}
.search-popover:empty {
  display: none;
}
.search-popover {
  max-height: min(560px, calc(100vh - 90px));
  overflow: auto;
}
.search-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.search-tools button {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}
.search-modal {
  width: min(780px, 100%);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.advanced-result-list {
  max-height: 390px;
  overflow: auto;
  border-top: 1px solid var(--line);
  margin-top: 18px;
}
.revision-modal {
  width: min(760px, 100%);
}
.compare-bar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 9px;
  align-items: end;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 9px;
  margin-bottom: 12px;
}
.compare-bar label {
  margin: 0;
}
.compare-bar select {
  margin-top: 4px;
}
.diff-modal {
  width: min(1120px, 96vw);
  height: min(820px, 92vh);
}
.diff-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.diff-tabs button {
  height: 35px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.diff-tabs button.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.diff-inline,
.diff-split {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 650px;
  background: var(--surface);
}
.diff-line {
  display: grid;
  grid-template-columns: 30px 1fr;
  min-height: 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.diff-line > span {
  padding: 2px 8px;
  text-align: center;
  color: var(--muted);
  user-select: none;
}
.diff-line code,
.diff-cell code {
  font:
    12px/1.5 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre-wrap;
  padding: 2px 8px;
  color: var(--ink);
}
.diff-line.added,
.diff-cell.added {
  background: #e9f8ef;
}
.diff-line.removed,
.diff-cell.removed {
  background: #ffedef;
}
.diff-line.added > span {
  color: #188552;
}
.diff-line.removed > span {
  color: #bd344c;
}
.diff-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.diff-head b {
  padding: 8px 12px;
}
.diff-head b + b {
  border-left: 1px solid var(--line);
}
.diff-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 0 0 8px 8px;
}
.diff-cell {
  display: flex;
  min-height: 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  min-width: 0;
}
.diff-cell:nth-child(even) {
  border-left: 1px solid var(--line);
}
.diff-cell.blank {
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-2),
    var(--surface-2) 3px,
    var(--surface) 3px,
    var(--surface) 6px
  );
}
.library-modal {
  width: min(960px, 96vw);
}
.library-toolbar {
  display: grid;
  grid-template-columns: auto 1fr 150px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.library-toolbar > input,
.library-toolbar > select {
  margin: 0;
}
.upload-button {
  height: 38px !important;
  margin: 0 !important;
  padding: 0 12px;
  display: flex !important;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff !important;
  cursor: pointer;
}
.upload-button input {
  display: none !important;
}
.attachment-list {
  display: flex;
  flex-direction: column;
  max-height: 590px;
  overflow: auto;
}
.attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}
.attachment-preview {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  overflow: hidden;
  background: var(--surface-2);
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attachment-copy {
  flex: 1;
  min-width: 0;
}
.attachment-copy b,
.attachment-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-copy small {
  font-size: 11px;
  color: var(--muted);
}
.activity-modal {
  width: min(760px, 96vw);
}
.activity-filters {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.activity-filters button {
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 7px;
  padding: 7px 10px;
}
.activity-filters button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.activity-list {
  display: flex;
  flex-direction: column;
  max-height: 590px;
  overflow: auto;
}
.activity-row {
  display: flex;
  gap: 11px;
  align-items: center;
  text-align: left;
  background: transparent;
  padding: 12px 5px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.activity-row:hover {
  background: var(--accent-soft);
}
.activity-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--accent);
}
.activity-row > span:last-child {
  min-width: 0;
}
.activity-row b,
.activity-row small {
  display: block;
}
.activity-row small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme="dark"] :is(.diff-inline, .diff-split, .attachment-preview) {
  background: var(--surface);
  color: var(--ink);
}
html[data-theme="dark"] :is(.diff-line.added, .diff-cell.added) {
  background: #173b2b;
}
html[data-theme="dark"] :is(.diff-line.removed, .diff-cell.removed) {
  background: #44232b;
}
@media (max-width: 700px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .compare-bar {
    grid-template-columns: 1fr;
  }
  .library-toolbar {
    grid-template-columns: 1fr;
  }
  .diff-modal {
    width: 100%;
    height: 95vh;
  }
  .diff-line code,
  .diff-cell code {
    font-size: 10px;
  }
  .editor-actions #editor-attachments {
    display: none;
  }
}

/* KronForge brand and dark-theme parity. Keep component states on the same
   token palette so a dark surface never inherits a light-only foreground. */
:root {
  --accent: #e8590c;
  --accent-deep: #d14b08;
  --accent-line: color-mix(in srgb, var(--accent) 30%, transparent);
}

::selection {
  background: color-mix(in srgb, var(--accent) 70%, transparent);
  color: #fff7f2;
}

.tree-row.selected .tree-main,
.tree-row.selected .tree-name,
.tree-row.selected .tree-rev,
.tree-row:hover .tree-main,
.tree-row:hover .tree-name,
.tree-row:hover .tree-rev {
  color: var(--accent);
}

.tree-row.selected .tree-icon,
.tree-row:hover .tree-icon,
.tree-more:hover,
.tree-more:focus-visible {
  color: var(--accent);
}

.markdown li::marker,
.markdown ol > li::marker {
  color: var(--accent);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a0b;
  --surface: #101112;
  --surface-2: #17191a;
  --ink: #f3f1ed;
  --muted: #aaa7a1;
  --faint: #777670;
  --line: #303132;
  --accent-contrast: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  --code-bg: #111213;
  --code-ink: #f3eee8;
  --code-muted: #aba69f;
}

html[data-theme="dark"]
  :is(
    .topbar,
    .explorer,
    .page-outline,
    .details-panel,
    .modal-card,
    .search-popover,
    .folder-hero,
    .child-card,
    .empty-card,
    .empty-state,
    .preview,
    .editor-grid textarea,
    .secondary,
    .icon-button.outlined,
    .tree-context-menu
  ) {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"]
  :is(
    .global-search,
    .global-search kbd,
    .modal-body input,
    .modal-body textarea,
    .modal-body select,
    .settings-section select,
    .compare-bar,
    .activity-filters button,
    .attachment-preview
  ) {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"]
  :is(
    .tree-row:hover,
    .tree-row.selected,
    .tree-combine-target > .tree-row,
    .action-row:hover,
    .search-result:hover,
    .child-card:hover,
    .menu-action:hover,
    .activity-row:hover
  ) {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

html[data-theme="dark"]
  :is(
    .tree-row.selected,
    .tree-combine-target > .tree-row
  ) {
  box-shadow: inset 3px 0 var(--accent);
}

html[data-theme="dark"]
  :is(
    .top-nav-item:hover,
    .top-nav-item:focus-visible,
    .top-nav-item.active,
    .article-utility:hover,
    .article-utility:focus-visible,
    .page-outline-links a:hover,
    .page-outline-links a:focus-visible,
    .page-outline-links a.active,
    .action-row:hover,
    .action-row:focus-visible
  ) {
  color: var(--accent);
}

html[data-theme="dark"] :is(.tree-icon, .child-card-icon, .detail-icon) {
  color: var(--node-color, var(--accent));
}

html[data-theme="dark"] .folder-hero-icon {
  color: var(--folder-accent, var(--accent));
}

html[data-theme="dark"] .markdown {
  color: #d9d6d0;
}

html[data-theme="dark"] .markdown :is(h1, h2, h3, h4, h5, h6, th) {
  color: var(--ink);
}

html[data-theme="dark"] .markdown a {
  text-decoration-color: color-mix(in srgb, var(--accent) 75%, transparent);
}

html[data-theme="dark"] .markdown a:hover {
  color: var(--accent);
}

html[data-theme="dark"] .markdown blockquote {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: #d9d6d0;
}

html[data-theme="dark"] .markdown code {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  color: var(--accent);
}

html[data-theme="dark"] .markdown pre {
  border-color: var(--line);
  background: var(--code-bg);
  color: var(--code-ink);
}

html[data-theme="dark"] .markdown pre code {
  border: 0;
  background: transparent;
  color: var(--code-ink);
}

html[data-theme="dark"] .markdown pre[data-language]::before {
  color: var(--code-muted);
}

html[data-theme="dark"] .code-copy {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--code-bg));
  color: #f7c3a5;
}

html[data-theme="dark"] .code-copy:hover,
html[data-theme="dark"] .code-copy:focus-visible {
  background: color-mix(in srgb, var(--accent) 24%, var(--code-bg));
  color: #fff7f2;
}

html[data-theme="dark"]
  :is(.confirm-danger > span, .diff-line.removed, .diff-cell.removed) {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
}

html[data-theme="dark"] .confirm-danger b {
  color: var(--ink);
}

html[data-theme="dark"] :is(.diff-line.added, .diff-cell.added) {
  background: color-mix(in srgb, #2aa36b 17%, var(--surface));
}

/* Governed Assistant workspace */
.assistant-workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: calc(100vh - 94px);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.assistant-history,
.assistant-side {
  padding: 22px 16px;
  background: var(--surface);
}
.assistant-history {
  border-right: 1px solid var(--line);
}
.assistant-history-modes {
  width: 100%;
  margin: 2px 0 16px;
}
.assistant-history-modes button {
  flex: 1 1 0;
  padding: 10px 8px;
}
.assistant-side {
  border-left: 1px solid var(--line);
  overflow: auto;
}
.assistant-history .full {
  width: 100%;
  margin: 12px 0 14px;
}
.assistant-history-list {
  display: grid;
  gap: 5px;
}
.assistant-history-selection {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 12px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--muted);
  font-size: 11px;
}
.assistant-history-selection span {
  margin-right: auto;
}
.assistant-history-selection .compact {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 10px;
}
.assistant-history-item {
  display: grid;
  gap: 3px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  padding: 9px;
  background: transparent;
  color: var(--ink);
}
.assistant-history-item:hover,
.assistant-history-item.active {
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent);
}
.assistant-history-item.selected {
  box-shadow: inset 3px 0 0 var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
}
.assistant-history-item.active.selected {
  background: color-mix(in srgb, var(--accent) 21%, var(--surface));
}
.assistant-history-item b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 650 12px/1.3 var(--doc-sans);
}
.assistant-history-item small,
.assistant-material small,
.assistant-operation small,
.assistant-source small {
  color: var(--muted);
  font-size: 10px;
}
.assistant-chat {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}
.assistant-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 25px max(30px, 5vw) 18px;
  border-bottom: 1px solid var(--line);
}
.assistant-header h1 {
  margin: 6px 0;
  font: 500 29px/1.08 var(--doc-mono);
  color: var(--ink);
}
.assistant-header p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.assistant-source-region {
  flex: 0 0 auto;
  padding: 0 max(30px, 5vw) 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.assistant-source-region .assistant-source-material {
  max-width: 790px;
  margin-top: 0;
}
.assistant-modes {
  display: flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.assistant-modes button {
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 11px;
  background: var(--surface);
  color: var(--muted);
  font: 700 11px/1 var(--doc-mono);
}
.assistant-modes button:last-child {
  border-right: 0;
}
.assistant-modes button.active {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent);
}
.assistant-messages {
  flex: 1;
  overflow: auto;
  padding: 24px max(30px, 5vw);
}
.assistant-welcome {
  max-width: 670px;
  margin: 58px 0;
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 20px;
}
.assistant-welcome h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font: 500 22px/1.2 var(--doc-mono);
}
.assistant-welcome p {
  color: var(--muted);
  line-height: 1.65;
}
.assistant-message {
  position: relative;
  max-width: 790px;
  margin: 0 0 30px;
  padding: 12px 0 14px 18px;
  border-left: 3px solid transparent;
}
.assistant-message.assistant {
  margin-right: max(24px, 3vw);
  border-left-color: var(--accent);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 7%, var(--surface)),
    transparent 72%
  );
}
.assistant-message.user {
  margin-left: clamp(18px, 3vw, 42px);
  padding-right: 16px;
  border-left-color: color-mix(in srgb, var(--ink) 34%, var(--line));
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}
.assistant-message-role {
  margin-bottom: 7px;
  color: var(--accent);
  font: 800 10px/1 var(--doc-mono);
  letter-spacing: 0.08em;
}
.assistant-message.user .assistant-message-role {
  color: color-mix(in srgb, var(--ink) 72%, var(--muted));
}
.assistant-message-copy {
  color: var(--ink);
  line-height: 1.7;
  white-space: normal;
}
.assistant-markdown > :first-child,
.assistant-proposal-markdown > :first-child {
  margin-top: 0;
}
.assistant-markdown > :last-child,
.assistant-proposal-markdown > :last-child {
  margin-bottom: 0;
}
.assistant-markdown h1,
.assistant-markdown h2,
.assistant-markdown h3,
.assistant-markdown h4,
.assistant-proposal-markdown h1,
.assistant-proposal-markdown h2,
.assistant-proposal-markdown h3,
.assistant-proposal-markdown h4 {
  color: var(--ink);
  line-height: 1.22;
}
.assistant-markdown h1,
.assistant-proposal-markdown h1 {
  font-size: 1.45em;
}
.assistant-markdown h2,
.assistant-proposal-markdown h2 {
  font-size: 1.27em;
}
.assistant-markdown h3,
.assistant-proposal-markdown h3 {
  font-size: 1.13em;
}
.assistant-markdown p,
.assistant-proposal-markdown p {
  margin: 0.75em 0;
}
.assistant-markdown ul,
.assistant-markdown ol,
.assistant-proposal-markdown ul,
.assistant-proposal-markdown ol {
  padding-left: 1.45em;
}
.assistant-markdown li + li,
.assistant-proposal-markdown li + li {
  margin-top: 0.25em;
}
.assistant-markdown blockquote,
.assistant-proposal-markdown blockquote {
  margin: 1em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.assistant-markdown hr,
.assistant-proposal-markdown hr {
  margin: 1.25em 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.assistant-markdown :not(pre) > code,
.assistant-proposal-markdown :not(pre) > code {
  padding: 0.12em 0.32em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--accent);
  font: 0.9em/1.25 var(--doc-mono);
}
.assistant-markdown pre,
.assistant-proposal-markdown pre {
  position: relative;
  overflow: auto;
  margin: 1em 0;
  padding: 1em 4.8em 1em 1em;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--page-bg));
}
.assistant-markdown pre code,
.assistant-proposal-markdown pre code {
  display: block;
  color: var(--ink);
  font: 12px/1.6 var(--doc-mono);
  white-space: pre;
}
.assistant-code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: 700 10px/1 var(--doc-mono);
}
.assistant-code-copy:hover,
.assistant-code-copy:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: 0;
}
.assistant-markdown table,
.assistant-proposal-markdown table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 1em 0;
  border-collapse: collapse;
}
.assistant-markdown th,
.assistant-markdown td,
.assistant-proposal-markdown th,
.assistant-proposal-markdown td {
  min-width: 120px;
  padding: 0.55em 0.7em;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.assistant-markdown th,
.assistant-proposal-markdown th {
  background: var(--surface-2);
  color: var(--ink);
}
.assistant-inline-source {
  display: inline-block;
  margin: 0 1px;
  padding: 0 3px;
  border-radius: 3px;
  color: var(--accent);
  font: 700 0.88em/1.25 var(--doc-mono);
  text-decoration: none;
  text-decoration: underline dotted
    color-mix(in srgb, var(--accent) 64%, transparent);
  text-underline-offset: 3px;
}
.assistant-inline-source:hover,
.assistant-inline-source:focus-visible {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent);
  outline: 0;
}
.assistant-message.user .assistant-message-copy {
  border-left: 0;
  padding-left: 0;
}
.assistant-citations {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.assistant-citations > b,
.assistant-note b {
  color: var(--muted);
  font: 750 10px/1 var(--doc-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.assistant-source {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  text-decoration: none;
}
.assistant-source:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.assistant-source span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.assistant-note {
  margin-top: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-radius: 5px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
}
.assistant-composer {
  padding: 20px calc(max(30px, 5vw) + 15px)
    calc(34px + env(safe-area-inset-bottom, 0px)) max(30px, 5vw);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.assistant-composer-inner {
  max-width: 790px;
  margin: 0;
}
.assistant-prompt-wrap {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}
.assistant-prompt-wrap:focus-within {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}
.assistant-composer textarea {
  box-sizing: border-box;
  width: 100%;
  resize: vertical;
  min-height: 82px;
  border: 0;
  border-radius: 0;
  padding: 11px;
  background: transparent;
  color: var(--ink);
  font: 13px/1.55 var(--doc-sans);
}
.assistant-prompt-wrap textarea {
  padding-right: 46px;
}
.assistant-prompt-wrap textarea:focus-visible {
  outline: 0;
}
.assistant-composer-attachments,
.assistant-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.assistant-composer-attachments {
  padding: 10px 10px 0;
}
.assistant-composer-attachments.empty {
  display: none;
}
.assistant-message-attachments {
  margin: 0 0 10px;
}
.assistant-composer-image,
.assistant-composer-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.assistant-composer-image {
  overflow: hidden;
  width: 74px;
  height: 58px;
}
.assistant-composer-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.assistant-composer-file {
  gap: 7px;
  max-width: min(280px, 100%);
  min-height: 38px;
  padding: 8px 30px 8px 9px;
  font-size: 11px;
}
.assistant-composer-file svg {
  flex: 0 0 auto;
  color: var(--accent);
}
.assistant-composer-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assistant-attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--ink);
}
.assistant-composer-file .assistant-attachment-remove {
  top: 8px;
  right: 7px;
}
.assistant-attachment-remove:hover,
.assistant-attachment-remove:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: 0;
}
.assistant-dictation {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: var(--muted);
}
.assistant-dictation:hover,
.assistant-dictation:focus-visible,
.assistant-dictation.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}
.assistant-dictation.active {
  animation: assistant-dictation-pulse 1.2s ease-in-out infinite;
}
@keyframes assistant-dictation-pulse {
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
  }
}
.assistant-drop-target {
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}
.assistant-drop-target.assistant-drop-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.assistant-source-material {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.assistant-source-material textarea {
  min-height: 66px;
  background: var(--surface);
}
.assistant-compose-row,
.assistant-compose-tools,
.assistant-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.assistant-compose-row {
  margin-top: 10px;
  flex-wrap: wrap;
}
.assistant-compose-tools {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.assistant-compose-tools small {
  color: var(--muted);
  font-size: 10px;
}
.assistant-compose-actions {
  margin-left: auto;
  justify-content: flex-end;
}
.assistant-enter-hint {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
}
.assistant-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.assistant-attachment-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 100%;
  flex-wrap: wrap;
}
.assistant-attachment-chips > span:first-child {
  color: var(--muted);
  font: 700 10px/1 var(--doc-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.assistant-attachment-chip {
  display: inline-flex;
  align-items: center;
  max-width: 230px;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 10px;
}
.assistant-attachment-chip svg {
  flex: 0 0 auto;
  color: var(--accent);
}
.assistant-attachment-chip .icon-button {
  width: 17px;
  height: 17px;
  padding: 1px;
}
.assistant-material-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.assistant-material {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.assistant-material > span {
  color: var(--accent);
}
.assistant-material > div {
  display: grid;
  min-width: 0;
  gap: 2px;
  flex: 1;
}
.assistant-material b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.assistant-empty {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.assistant-change-set {
  max-width: 790px;
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.assistant-change-set h3 {
  margin: 5px 0 8px;
  color: var(--ink);
  font: 500 17px/1.25 var(--doc-mono);
}
.assistant-change-set p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.assistant-operation {
  display: grid;
  gap: 3px;
  margin: 8px 0;
  padding: 8px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.assistant-operation b {
  color: var(--ink);
  font-size: 11px;
  text-transform: capitalize;
}
.assistant-operation .assistant-appearance-change {
  display: block;
}
.assistant-operation details,
.assistant-page-previews details {
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.assistant-operation summary,
.assistant-page-previews summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--accent);
  font: 600 11px/1.35 var(--doc-sans);
}
.assistant-operation summary small,
.assistant-page-previews summary small {
  color: var(--muted);
  font-weight: 400;
}
.assistant-operation > pre,
.assistant-page-previews > pre {
  max-height: 390px;
  margin: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 88%, var(--page-bg));
  font: 12px/1.55 var(--doc-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-page-previews {
  max-width: 790px;
  margin-top: 18px;
}
.assistant-page-previews .eyebrow {
  margin-bottom: 7px;
}
.assistant-change-set .primary {
  margin-top: 12px;
}
.assistant-bulk-warning {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  border-left: 3px solid var(--danger);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  font-size: 12px;
  line-height: 1.5;
}
.assistant-bulk-warning b {
  color: var(--danger);
}
.assistant-review-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.assistant-review-actions .primary {
  margin-top: 0;
}
@media (max-width: 1120px) {
  .assistant-workspace {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .assistant-side {
    display: none;
  }
}
@media (max-width: 760px) {
  .assistant-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .assistant-history {
    display: none;
  }
  .assistant-header,
  .assistant-composer,
  .assistant-source-region {
    padding-left: 16px;
    padding-right: 16px;
  }
  .assistant-header {
    display: grid;
  }
  .assistant-messages {
    padding: 18px 16px;
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --bg: #090a0b;
    --surface: #101112;
    --surface-2: #17191a;
    --ink: #f3f1ed;
    --muted: #aaa7a1;
    --faint: #777670;
    --line: #303132;
    --accent-contrast: var(--accent);
    --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
    --code-bg: #111213;
    --code-ink: #f3eee8;
    --code-muted: #aba69f;
  }

  html[data-theme="system"] .markdown pre {
    border-color: var(--line);
    background: var(--code-bg);
    color: var(--code-ink);
  }

  html[data-theme="system"] .markdown pre code {
    border: 0;
    background: transparent;
    color: var(--code-ink);
  }

  html[data-theme="system"] .markdown code {
    border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
    color: var(--accent);
  }
}

/* Final Assistant layout and compact source treatment. */
body.assistant-active .assistant-workspace {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
body.assistant-active .assistant-chat {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body.assistant-active .assistant-messages {
  min-height: 0;
}
body.assistant-active .assistant-citations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
}
body.assistant-active .assistant-citations > b {
  width: auto;
  margin-right: 2px;
}
body.assistant-active .assistant-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
}
body.assistant-active .assistant-source b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
body.assistant-active .assistant-source small {
  white-space: nowrap;
}
body.assistant-active .assistant-source span {
  display: none;
}

/* A compact, header-level control scales the working surface without changing navigation branding. */
:root {
  --content-font-scale: 1;
}

/* The sign-in screen is a separate branded entry experience, not a reduced workspace. */
#app:has(.auth-screen) {
  min-height: 100dvh;
  padding-top: 0;
  overflow: auto;
}

.auth-screen {
  --auth-ink: #13233c;
  --auth-muted: #65738c;
  --auth-line: #dce3ef;
  --auth-surface: #ffffff;
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  padding: clamp(44px, 8vh, 88px) 24px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fbfbfc;
  color: var(--auth-ink);
  overflow: hidden;
}

.auth-glow {
  inset: 20% auto auto 50%;
  width: 32rem;
  height: 24rem;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 4%, transparent),
    transparent 69%
  );
  z-index: -1;
}

.auth-brand-lockup {
  display: grid;
  justify-items: center;
  width: min(460px, 100%);
  margin: 0 0 30px;
  text-align: center;
}

.auth-mark {
  width: 68px;
  height: 68px;
  margin: 0 0 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.auth-mark img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.auth-site-name {
  font: 750 clamp(25px, 2.5vw, 30px) / 1.08 var(--ui-font);
  letter-spacing: -0.045em;
  color: var(--auth-ink);
}

.auth-brand-lockup p {
  max-width: 440px;
  margin: 7px 0 0;
  color: var(--auth-muted);
  font-size: 16px;
  font-style: italic;
  line-height: 1.45;
}

.auth-card {
  width: min(460px, 100%);
  padding: 34px 42px 30px;
  border: 1px solid #e2e5ea;
  border-radius: 16px;
  background: var(--auth-surface);
  box-shadow: 0 21px 44px rgba(26, 42, 72, 0.12);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(
    90deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 36%, #6d7690)
  );
}

.auth-card h1 {
  margin: 0;
  color: var(--auth-ink);
  font: 730 23px / 1.2 var(--ui-font);
  letter-spacing: -0.025em;
}

.auth-card .auth-card-intro {
  margin: 7px 0 22px;
  color: var(--auth-muted);
  font-size: 15px;
  line-height: 1.5;
}

.auth-card label {
  margin: 15px 0;
  color: var(--auth-muted);
  font-size: 15px;
  font-weight: 650;
}

.auth-card label span {
  display: block;
}

.auth-card input {
  height: 50px;
  margin-top: 9px;
  padding: 0 16px;
  border-color: var(--auth-line);
  border-radius: 11px;
  background: #edf3ff;
  color: var(--auth-ink);
  font-size: 16px;
}

.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--auth-ink);
  caret-color: var(--auth-ink);
  -webkit-box-shadow: 0 0 0 100px #edf3ff inset;
  box-shadow: 0 0 0 100px #edf3ff inset;
}

.auth-card .primary.full {
  width: 100%;
  height: 52px;
  margin-top: 9px;
  border-radius: 11px;
  font-size: 17px;
  box-shadow: none;
}

.auth-private-note {
  margin: 20px 0 0;
  color: var(--auth-muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 600px) {
  .auth-screen {
    padding: 42px 18px 36px;
  }

  .auth-brand-lockup {
    margin-bottom: 30px;
  }

  .auth-card {
    padding: 30px 24px 26px;
  }
}

#app {
  overflow: hidden;
  padding-top: 92px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  width: 100%;
  z-index: 100;
}

.content-font-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: stretch;
  height: 32px;
  margin-left: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.content-font-controls button {
  min-width: 33px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--doc-mono);
  font-weight: 700;
  line-height: 1;
}

.content-font-controls button + button {
  border-left: 1px solid var(--line);
}

.content-font-button {
  padding: 0 7px;
  font-size: 12px;
}

.content-font-reset {
  min-width: 44px !important;
  padding: 0 7px;
  font-size: 10px;
  letter-spacing: -0.025em;
}

.content-font-controls button:hover:not(:disabled),
.content-font-controls button:focus-visible:not(:disabled) {
  outline: 0;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
}

.content-font-controls button:disabled {
  cursor: default;
  opacity: 0.42;
}

.app-body {
  transform: scale(var(--content-font-scale));
  transform-origin: top left;
  width: calc(100% / var(--content-font-scale));
  height: calc((100vh - 92px) / var(--content-font-scale));
  grid-template-columns:
    calc(var(--explorer-width, 294px) / var(--content-font-scale))
    calc(6px / var(--content-font-scale)) minmax(0, 1fr)
    calc(292px / var(--content-font-scale)) !important;
}

.details-collapsed .app-body,
body.assistant-active .app-body {
  grid-template-columns:
    calc(var(--explorer-width, 294px) / var(--content-font-scale))
    calc(6px / var(--content-font-scale)) minmax(0, 1fr) !important;
}

.outline-visible .app-body {
  grid-template-columns:
    calc(var(--explorer-width, 294px) / var(--content-font-scale))
    calc(6px / var(--content-font-scale)) minmax(0, 1fr)
    calc(226px / var(--content-font-scale))
    calc(292px / var(--content-font-scale)) !important;
}

.outline-visible.details-collapsed .app-body,
.editor-active.outline-visible .app-body {
  grid-template-columns:
    calc(var(--explorer-width, 294px) / var(--content-font-scale))
    calc(6px / var(--content-font-scale)) minmax(0, 1fr)
    calc(226px / var(--content-font-scale)) !important;
}

.page-outline-head strong,
.page-outline-links a {
  font-size: 12.5px;
}

.assistant-policy-modal {
  width: min(780px, 100%);
}

.assistant-policy-document {
  max-height: min(68vh, 680px);
  margin: 0;
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 13px/1.65 var(--mono);
}

.assistant-run-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 20px;
  padding: 10px 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--danger, #c74357) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger, #c74357) 34%, var(--line));
  border-radius: 8px;
}

.assistant-run-status b {
  color: var(--ink);
}

.assistant-run-status > div:first-child {
  flex: 1;
  min-width: 0;
}

.assistant-run-status small {
  flex: 1;
  min-width: 0;
}

.assistant-run-status .compact {
  flex: 0 0 auto;
  white-space: nowrap;
}

.assistant-run-status-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* Dense folder contents complement the Explorer instead of repeating it. */
.folder-hero-compact {
  display: flex;
  align-items: center;
  min-height: 0;
  gap: 14px;
  padding: 15px 18px;
  margin-top: 16px;
  box-shadow: none;
}

.folder-hero-compact .folder-hero-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.folder-hero-compact h1 {
  margin: 1px 0 0;
  font-size: clamp(24px, 2vw, 30px);
}

.folder-contents {
  margin-top: 14px;
}

.folder-contents-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px 9px;
  color: var(--muted);
  font-size: 12px;
}

.folder-contents-bar strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
}

.folder-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.folder-list-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(132px, 0.35fr) minmax(105px, 0.2fr) minmax(78px, 0.14fr);
  align-items: center;
  gap: 16px;
  min-height: 42px;
  padding: 0 15px;
}

.folder-list-header {
  min-height: 34px;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.folder-list-item {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.folder-list-item:last-child {
  border-bottom: 0;
}

.folder-list-item:hover,
.folder-list-item:focus-visible {
  color: var(--ink);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  outline: 0;
}

.folder-list-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.folder-list-name b {
  overflow: visible;
  min-width: 0;
  color: inherit;
  font-weight: 650;
  white-space: normal;
  overflow-wrap: anywhere;
}

.folder-list-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--node-color);
}

.folder-list-type,
.folder-list-updated,
.folder-list-revision {
  color: var(--muted);
  font-size: 12px;
}

.folder-list-folder .folder-list-type {
  color: var(--ink);
  font-weight: 600;
}

.folder-empty {
  margin-top: 14px;
}

@media (max-width: 760px) {
  .folder-list-row {
    grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
    gap: 10px;
    padding: 0 12px;
  }

  .folder-list-type,
  .folder-list-header span:nth-child(2),
  .folder-list-header span:nth-child(4),
  .folder-list-revision {
    display: none;
  }

  .folder-contents-bar > span {
    display: none;
  }
}

/* Breadcrumbs keep the root, nearest parent, and current location legible.
   Older middle ancestors collapse into a focused overflow menu instead of
   squeezing every path label into an unreadable strip. */
.content-top .breadcrumbs {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.breadcrumb-trail,
.breadcrumb-segment {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.breadcrumb-trail {
  max-width: 100%;
  gap: 8px;
}

.breadcrumb-segment {
  flex: 0 0 auto;
  gap: 8px;
}

.breadcrumb-item {
  display: inline-flex;
  min-width: 0;
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb-current .breadcrumb-item {
  color: var(--ink);
  font-weight: 650;
}

.breadcrumb-label {
  display: block;
  min-width: 0;
  white-space: nowrap;
}

.breadcrumb-truncatable {
  flex: 1 1 auto;
}

.breadcrumb-truncatable .breadcrumb-item,
.breadcrumb-truncatable .breadcrumb-label {
  min-width: 0;
}

.breadcrumb-truncatable .breadcrumb-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-overflow-button {
  display: inline-grid;
  width: 25px;
  height: 25px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font: 700 16px/1 var(--doc-mono);
  cursor: pointer;
}

.breadcrumb-segment[hidden] {
  display: none;
}

.breadcrumb-overflow-button:hover,
.breadcrumb-overflow-button:focus-visible {
  border-color: var(--line);
  color: var(--accent);
  background: var(--accent-soft);
  outline: 0;
}

.breadcrumb-overflow-menu {
  position: fixed;
  z-index: 1200;
  display: grid;
  min-width: 190px;
  max-width: min(360px, calc(100vw - 16px));
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.breadcrumb-overflow-menu a {
  overflow: hidden;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--ink);
  font: 600 12px/1.35 var(--doc-mono);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-overflow-menu a:hover,
.breadcrumb-overflow-menu a:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  outline: 0;
}
