:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #222;
  background: #fff;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { outline-offset: 2px; }
:focus-visible { outline: 2px solid #555; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: #333; text-underline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 28px; padding: 3px 9px; border: 1px solid #bbb; border-radius: 3px; background: #fff; text-decoration: none; white-space: nowrap; }
.button:hover { background: #eee; border-color: #888; }
.button.primary { background: #333; border-color: #333; color: #fff; }
.button.primary:hover { background: #111; }
.button.quiet { border-color: transparent; background: transparent; color: #555; }
.button.quiet:hover { background: #eee; color: #222; }
input, textarea, select { border: 1px solid #bbb; border-radius: 3px; background: #fff; padding: 5px 7px; }
input::placeholder, textarea::placeholder { color: #777; }
code, pre, .entry-select { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.boot { height: 100%; display: grid; place-content: center; color: #555; }
.brand { font-size: 16px; font-weight: 650; letter-spacing: -.4px; }
.layout { display: grid; grid-template-columns: 166px minmax(0, 1fr); grid-template-rows: 40px minmax(0, 1fr); height: 100dvh; }
.app-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 22px; padding: 0 14px; border-bottom: 1px solid #ccc; background: #f5f5f5; }
.app-header a { text-decoration: none; }
.app-header a:hover { text-decoration: underline; }
.account-email { margin-left: auto; color: #555; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar { grid-column: 1; grid-row: 2; min-height: 0; overflow-y: auto; border-right: 1px solid #ddd; background: #f7f7f7; padding: 12px 7px; }
.sidebar h2 { padding: 0 7px 8px; font-size: 12px; font-weight: 600; color: #555; }
.project-nav { display: flex; flex-direction: column; gap: 2px; }
.project-button { display: block; width: 100%; padding: 7px; border: 0; border-radius: 3px; background: transparent; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-button:hover { background: #e9e9e9; }
.project-button.active { background: #dedede; font-weight: 550; }
.main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; }
.workspace { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px; }
.workspace-toolbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; min-height: 28px; gap: 12px; margin-bottom: 10px; }
.workspace-toolbar h1 { font-size: 17px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.query-bar { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.query-bar input { flex: 1; min-width: 0; height: 32px; font-size: 14px; }
.query-bar .button { height: 32px; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; flex-shrink: 0; padding: 8px 0 10px; }
.filter select { padding: 3px 23px 3px 6px; max-width: 200px; min-height: 27px; font-size: 12px; }
.reset-filters { border: 0; padding: 4px; background: none; text-decoration: underline; color: #555; font-size: 12px; }
.browser { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; border-top: 1px solid #ccc; }
.browser.has-selection { grid-template-columns: minmax(300px, 1fr) minmax(320px, 42%); }
/* Contain the absolutely positioned accessibility caption within this scroll pane. */
.results-panel { position: relative; min-width: 0; min-height: 0; height: 100%; overflow: auto; }
.results-toolbar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; gap: 12px; border-bottom: 1px solid #ddd; color: #555; font-size: 12px; }
.results-toolbar strong { font-weight: 500; }
.result-list { min-width: 0; }
.entry-table, .project-table { border-collapse: collapse; width: 100%; text-align: left; }
.entry-table { min-width: 660px; table-layout: fixed; }
.entry-table th, .project-table th { position: sticky; top: 0; z-index: 1; padding: 6px 8px; border-bottom: 1px solid #bbb; background: #f5f5f5; font-size: 12px; font-weight: 600; }
.entry-table th:nth-child(1) { width: 25%; }
.entry-table th:nth-child(3) { width: 90px; }
.entry-table th:nth-child(4) { width: 88px; }
.entry-table th:nth-child(5) { width: 104px; }
.browser.has-selection .entry-table { min-width: 0; }
.browser.has-selection .entry-table th:nth-child(1) { width: 34%; }
.browser.has-selection .entry-table th:nth-child(3),
.browser.has-selection .entry-table td:nth-child(3),
.browser.has-selection .entry-table th:nth-child(5),
.browser.has-selection .entry-table td:nth-child(5) { display: none; }
.entry-table td, .project-table td { padding: 7px 8px; border-bottom: 1px solid #e7e7e7; vertical-align: top; line-height: 1.4; }
.entry-row { cursor: pointer; }
.entry-row:hover td { background: #f4f4f4; }
.entry-row.active td { background: #e8e8e8; }
.entry-row:focus-within td { background: #eee; }
.entry-select { display: block; width: 100%; border: 0; padding: 0; background: none; text-align: left; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 2px; }
.summary-cell { overflow-wrap: anywhere; }
.date-cell { white-space: nowrap; font-size: 12px; }
.linked-label { display: block; margin-top: 3px; color: #666; font-size: 11px; }
.load-more { display: block; margin: 10px auto; }
.project-table-wrap { overflow: auto; }
.project-table { max-width: 850px; }
.project-table th:last-child { width: 110px; }
.loading { display: flex; align-items: center; gap: 8px; padding: 12px 8px; color: #555; }
.spinner { width: 14px; height: 14px; flex: none; border: 2px solid #ccc; border-top-color: #333; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.empty-state { padding: 24px 8px; color: #555; }
.empty-state strong { display: block; font-size: 13px; font-weight: 500; }
.empty-state p { margin-top: 6px; }
.answer-panel { padding: 0 10px 10px 0; border-bottom: 1px solid #ccc; }
.answer-actions { display: flex; justify-content: flex-end; height: 27px; margin: 3px 0; }
.answer-actions .button { min-height: 24px; font-size: 12px; padding: 2px 5px; }
.answer-body { max-width: 76ch; font-size: 14px; line-height: 1.55; }
.answer-body p { margin-bottom: 9px; }
.answer-body p:last-child { margin-bottom: 0; }
.answer-body strong { font-weight: 600; }
.answer-body code { padding: 1px 3px; background: #f2f2f2; }
.citation { padding: 0 4px; margin: 0 1px; border: 1px solid #ccc; border-radius: 2px; background: #f5f5f5; font-size: 10px; line-height: 1.3; vertical-align: super; }
.citation:hover { background: #ddd; border-color: #999; }
.answer-sources { margin-top: 8px; font-size: 12px; max-width: 76ch; }
.answer-sources summary, .entry-metadata summary { cursor: pointer; color: #555; }
.answer-sources ol { padding-left: 22px; margin: 6px 0 0; }
.answer-sources li { margin: 3px 0; }
.source-reference { border: 0; background: none; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.detail-panel { display: none; min-width: 0; min-height: 0; overflow-y: auto; border-left: 1px solid #ccc; scrollbar-width: thin; }
.browser.has-selection .detail-panel { display: block; }
.detail-scroll { padding: 10px 12px 20px; }
.detail-toolbar { display: flex; align-items: center; gap: 5px; padding-bottom: 9px; margin-bottom: 12px; border-bottom: 1px solid #ddd; }
.detail-toolbar strong { margin-right: auto; font-weight: 600; }
.detail-scroll h2 { font-size: 16px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; margin-bottom: 6px; }
.entry-id { display: flex; align-items: flex-start; gap: 5px; margin-bottom: 12px; }
.entry-id code { flex: 1; overflow-wrap: anywhere; padding-top: 4px; }
.entry-id .button { font-size: 11px; min-height: 24px; }
.entry-meta { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 5px 8px; margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid #ddd; font-size: 12px; }
.entry-meta dt { color: #666; }
.entry-meta dd { margin: 0; overflow-wrap: anywhere; }
.prose { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.prose p { margin-bottom: 10px; }
.prose h3 { font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
.prose h4 { font-size: 13px; margin: 12px 0 6px; }
.prose ul, .prose ol { padding-left: 21px; margin: 6px 0 12px; }
.prose li { margin: 3px 0; }
.prose code { background: #f2f2f2; padding: 1px 3px; }
.prose pre, .current-version { overflow: auto; padding: 9px; margin: 10px 0; background: #f5f5f5; border: 1px solid #ddd; white-space: pre-wrap; line-height: 1.5; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { border-left: 2px solid #bbb; padding-left: 10px; margin: 10px 0; color: #555; }
.detail-label { font-size: 12px; font-weight: 600; margin: 14px 0 6px; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-button { padding: 2px 6px; border: 1px solid #ccc; border-radius: 2px; background: #fafafa; font-size: 12px; }
.tag-button:hover { background: #eee; }
.links { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.entry-link { border: 0; padding: 0; background: none; text-align: left; text-decoration: underline; }
.entry-link small { display: block; margin-top: 2px; color: #666; font-size: 11px; text-decoration: none; overflow-wrap: anywhere; }
.entry-metadata { margin: 16px 0; font-size: 12px; }
.entry-metadata .entry-meta { margin-top: 8px; }
.mobile-back { display: none; }
.editor label, .login-form label { display: block; margin: 10px 0 4px; font-size: 12px; color: #444; }
.editor input, .editor textarea, .editor select, .login-form input { display: block; width: 100%; }
.editor textarea { resize: vertical; min-height: 180px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.5; }
.editor .summary-input { min-height: 64px; font-family: inherit; font-size: 13px; }
.editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.success-note, .draft-note { color: #555; font-size: 12px; }
.draft-note { margin: 8px 0; }
.current-version { max-height: 240px; font-size: 12px; }
.error-box { padding: 9px; margin: 10px 0; border: 1px solid #999; background: #f5f5f5; font-size: 12px; line-height: 1.5; }
.error-box .button { margin-top: 6px; }
.login-page, .login-main { min-height: 100dvh; }
.login-main { display: grid; place-items: center; padding: 24px; }
.login-form { width: 100%; max-width: 320px; }
.login-header { margin-bottom: 28px; }
.login-header .brand { font-size: 28px; margin-bottom: 8px; }
.login-tagline { font-size: 14px; color: #555; }
.login-form h2 { font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.login-form input { min-height: 35px; }
.login-form .button { width: 100%; margin-top: 18px; min-height: 35px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 8px 12px; border: 1px solid #555; border-radius: 3px; background: #333; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 140px minmax(0, 1fr); }
  .workspace { padding: 10px; }
  .browser.has-selection { grid-template-columns: minmax(240px, 1fr) minmax(300px, 43%); }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 40px 34px minmax(0, 1fr); }
  .app-header { gap: 14px; padding: 0 10px; }
  .account-email { max-width: 130px; font-size: 11px; }
  .sidebar { grid-row: 2; display: flex; align-items: center; overflow: hidden; padding: 0 6px; border-right: 0; border-bottom: 1px solid #ddd; }
  .sidebar h2 { display: none; }
  .project-nav { flex-direction: row; overflow-x: auto; width: 100%; }
  .project-button { width: auto; flex-shrink: 0; padding: 5px 8px; }
  .main { grid-column: 1; grid-row: 3; }
  .workspace { padding: 8px; }
  .workspace-toolbar { margin-bottom: 7px; }
  .workspace-toolbar h1 { font-size: 15px; }
  .filters { padding: 6px 0 8px; gap: 5px; }
  .filter select { max-width: 150px; font-size: 11px; }
  .browser.has-selection { grid-template-columns: minmax(0, 1fr); }
  .browser.has-selection .detail-panel { display: none; }
  .browser.show-detail .results-panel { display: none; }
  .browser.show-detail .detail-panel { display: block; border-left: 0; }
  .mobile-back { display: inline-flex; align-items: center; gap: 3px; border: 0; padding: 3px 5px 3px 0; background: none; font-size: 12px; }
  .detail-scroll { padding: 8px 4px 16px; }
  .answer-panel { padding-right: 0; }
  .answer-body { font-size: 13px; }
  .entry-table { min-width: 620px; }
  .editor-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* Project explorer */
:root { --tree-width: 280px; }
.explorer-shell { display: grid; grid-template-columns: var(--tree-width) 5px minmax(0,1fr); grid-template-rows: 40px minmax(0,1fr); height: 100dvh; }
.app-header { gap: 24px; }
#breadcrumbs { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; overflow: auto; white-space: nowrap; }
.crumb-separator { color: #aaa; }
#breadcrumbs span[aria-current] { color: #555; }
.explorer-sidebar { grid-column: 1; grid-row: 2; min-height: 0; overflow: auto; background: #f7f7f7; padding: 10px 0; }
.tree-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: #666; font-weight: 600; padding: 2px 8px 9px 12px; }
.tree-heading .button { font-size: 11px; font-weight: 400; padding: 3px 5px; }
.project-dialog { width: min(440px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 12px 40px #0003; }
.project-dialog::backdrop { background: #0005; }
.project-dialog form { display: flex; flex-direction: column; gap: 12px; }
.project-dialog h2 { font-size: 18px; }
.project-dialog p { overflow-wrap: anywhere; }
.project-dialog label { font-weight: 600; }
.project-dialog input { width: 100%; }
#project-name-help { font-size: 12px; color: #666; }
.project-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#tree { padding-bottom: 24px; }
.tree-item { outline: none; }
.tree-line { display: flex; align-items: center; gap: 5px; height: 29px; padding: 0 10px 0 calc((var(--level) - 1) * 17px + 6px); cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.tree-line:hover { background: #ececec; }
.tree-line.selected { background: #dedede; }
.tree-item:focus > .tree-line { border-color: #888; }
.tree-item[aria-level="1"] > .tree-line { font-weight: 600; }
.tree-toggle, .tree-spacer { flex: 0 0 16px; width: 16px; height: 20px; }
.tree-toggle { display: grid; place-content: center; border: 0; padding: 0; background: none; color: #777; }
.tree-toggle svg { width: 12px; height: 12px; }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-icon { display: grid; align-items: center; flex: 0 0 16px; color: #777; }
.tree-label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 15px; }
.tree-count { font-size: 10px; color: #888; font-variant-numeric: tabular-nums; font-weight: 400; padding-left: 5px; }
.tree-stale { font-size: 10px; color: #888; }
.tree-more { border: 0; background: none; font-size: 11px; text-decoration: underline; padding: 7px 10px 7px calc((var(--level) - 1) * 17px + 28px); }
#splitter { grid-column: 2; grid-row: 2; cursor: col-resize; border-left: 1px solid #ddd; background: #fff; outline-offset: -1px; }
#splitter:hover, #splitter:focus-visible { background: #ccc; }
.resizing, .resizing * { cursor: col-resize !important; user-select: none !important; }
.explorer-main { grid-column: 3; grid-row: 2; min-width: 0; min-height: 0; }
.workspace { padding: 12px 18px; }
.workspace-toolbar { margin-bottom: 10px; }
.workspace-project { font-size: 12px; color: #777; }
.browse-bar { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.browse-bar input { width: 330px; max-width: 65%; height: 30px; }
.browse-bar .button { margin-left: auto; font-size: 12px; }
.filters select { min-height: 27px; font-size: 12px; padding: 3px 24px 3px 7px; max-width: 230px; }
.results-toolbar { min-height: 31px; font-variant-numeric: tabular-nums; }
.entry-table th:first-child { width: 31%; }
.entry-table td { padding-top: 9px; padding-bottom: 9px; }
.entry-table th:nth-child(3) { width: 100px; }
.column-sort { border: 0; background: none; font: inherit; padding: 0; text-align: left; cursor: pointer; }
.column-sort:hover { text-decoration: underline; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 10px 8px; font-size: 12px; color: #555; }
.pagination:empty { display: none; }
.pagination span { margin-right: auto; }
.pagination .button { font-size: 12px; }
.entry-tag { border: 1px solid #ddd; padding: 2px 6px; border-radius: 2px; background: #fafafa; font-size: 12px; }
.detail-toolbar .button { font-size: 12px; }
.detail-scroll { padding-top: 9px; }
.answer-panel { padding-left: 8px; }
.answer-body { max-width: 90ch; }
@media (max-width: 1100px) {
  .explorer-shell { --tree-width: 235px; }
  .workspace { padding: 10px 12px; }
  .browser.has-selection { grid-template-columns: minmax(250px,1fr) minmax(320px,46%); }
}
@media (max-width: 950px) {
  .browser.has-selection { grid-template-columns: minmax(0,1fr); }
  .browser.has-selection .results-panel { display: none; }
  .browser.has-selection .detail-panel { display: block; border-left: 0; }
}
@media (max-width: 650px) {
  .explorer-shell { --tree-width: 190px; }
  .app-header { gap: 15px; padding: 0 10px; }
  .tree-line { gap: 3px; padding-right: 5px; }
  .tree-count { display: none; }
  .workspace { padding: 9px; }
  .workspace-project, [data-collapse-tree] { display: none; }
  .browse-bar input { width: 100%; max-width: 100%; }
  .filters { gap: 5px; }
  .filters select { max-width: 100%; }
  .query-bar { flex-wrap: wrap; }
  .query-bar input { flex-basis: 100%; }
  .entry-table { min-width: 650px; }
}

.workspace-toolbar .workspace-project { margin-left:auto; }
.tree-status,.tree-error { margin:4px 10px 4px 36px; font-size:11px; color:#666; }
.tree-status { display:flex; align-items:center; gap:6px; }
.tree-error .tree-more { display:block; padding:5px 0; }
