/* Elastio Ask. Indigo, so it is never mistaken for coverage (teal) or the registry (amber). */
:root {
  --bg: #f7f7fb; --panel: #ffffff; --text: #1d1d2b; --muted: #62647a; --line: #e3e4ee;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-soft: #eef0ff;
  --user: #4f46e5; --user-ink: #ffffff;
  --warn-bg: #fff6e0; --warn-ink: #7a4b00; --err-bg: #fdecec; --err-ink: #9b1c1c;
  --code-bg: #f1f2f8;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
}
html.dark {
    --bg: #12121a; --panel: #1b1b26; --text: #e8e8f2; --muted: #9a9cb3; --line: #2c2d3d;
    --accent: #8b85ff; --accent-ink: #12121a; --accent-soft: #24234a;
    --user: #3b36a8; --user-ink: #ffffff;
    --warn-bg: #3a2c0c; --warn-ink: #f4cf7a; --err-bg: #3d1717; --err-ink: #f3a3a3;
    --code-bg: #232333;
  }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.top nav a.on, .top nav a:hover { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }

.button { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.button:disabled { opacity: .5; cursor: wait; }
.button.block { display: block; text-align: center; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link.danger { color: var(--err-ink); }
.inline { display: inline; }
.row { display: flex; gap: 8px; align-items: center; }
.notice { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 14px; border-radius: 8px; }
.notice.error { background: var(--err-bg); color: var(--err-ink); }

/* chat */
.chat-layout { flex: 1; display: grid; grid-template-columns: 260px 1fr; min-height: 0; }
.convs { border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; background: var(--panel); }
.convs ul { list-style: none; padding: 0; margin: 14px 0 0; }
.convs li a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.convs li a:hover, .convs li a.on { background: var(--accent-soft); }
.chat { display: flex; flex-direction: column; min-height: 0; }
.thread { flex: 1; overflow-y: auto; padding: 24px max(20px, calc((100% - 820px) / 2)); }
.empty { margin-top: 6vh; }
.empty h1 { font-size: 26px; margin: 0 0 8px; }
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.example { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.example:hover { border-color: var(--accent); }
.msg { margin: 0 0 18px; }
.msg.user { display: flex; justify-content: flex-end; }
.bubble { background: var(--user); color: var(--user-ink); padding: 10px 14px; border-radius: 14px 14px 4px 14px; max-width: 80%; white-space: pre-wrap; }
.msg.assistant { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.msg.pending .status { color: var(--muted); }
.msg.pending .status::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .25; } to { opacity: 1; } }
.sources { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.sources summary { color: var(--muted); cursor: pointer; }
.sources ul { list-style: none; padding: 0; margin: 8px 0 0; }
.sources li { padding: 3px 0; }
.kind { display: inline-block; min-width: 82px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.age { color: var(--muted); font-size: 12px; }
.age.stale { color: var(--warn-ink); }
.actions { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; }
.vote[aria-pressed="true"] { font-weight: 700; text-decoration: underline; }
.composer { display: flex; gap: 10px; padding: 14px max(20px, calc((100% - 820px) / 2)); border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea { flex: 1; resize: vertical; min-height: 48px; max-height: 40vh; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* prose */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { line-height: 1.3; margin: 1.2em 0 .5em; }
.prose h1 { font-size: 22px; } .prose h2 { font-size: 18px; } .prose h3 { font-size: 16px; }
.prose code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.prose pre { background: var(--code-bg); padding: 12px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose blockquote { margin: 1em 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }

/* pages */
/* The page itself scrolls (scrollbar at the window edge); the column is made
   by padding rather than max-width so it stays centred. */
.page, .narrow { flex: 1; width: 100%; overflow-y: auto; padding: 28px max(20px, calc((100% - 860px) / 2)); }
.narrow { padding-left: max(20px, calc((100% - 440px) / 2)); padding-right: max(20px, calc((100% - 440px) / 2)); }
.center { text-align: center; margin-top: 10vh; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.crumbs { margin: 0 0 6px; font-size: 13px; }
.search { display: flex; gap: 8px; margin: 16px 0; }
.search input, .editor input, .editor textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.editor { display: flex; flex-direction: column; gap: 14px; }
.editor label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }
.pages { list-style: none; padding: 0; }
.pages li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pages li a { font-weight: 600; margin-right: 10px; }
.pages p { margin: 4px 0 0; }
.danger-zone { margin-top: 36px; }
.version { border-bottom: 1px solid var(--line); padding: 10px 0; }
.raw-text { white-space: pre-wrap; background: var(--code-bg); padding: 12px; border-radius: 8px; font-size: 13px; }

@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .convs { display: none; }
  .examples { grid-template-columns: 1fr; }
  .who span { display: none; }
  .top { gap: 12px; padding: 10px 16px; }
  .thread, .composer { padding-left: 16px; padding-right: 16px; }
}

/* go-wiki editor and go-draw embeds */
.field { display: flex; flex-direction: column; gap: 6px; }
.field .label { font-weight: 600; }
.godraw-embed { margin: 1em 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.prose .md-ul { list-style: disc; } .prose .md-ol { list-style: decimal; }
.prose .md-quote { margin: 1em 0; padding: 8px 14px; border-left: 3px solid var(--line); background: var(--code-bg); }

.theme-toggle { font-size: 13px; color: var(--muted); }
.top .spacer { flex: 1; }

/* go-wiki's light defaults are bright white; keep its editor on this site's
   palette in both themes so it never looks pasted in from another app. */
.gw-editor-toolbar { background: var(--panel) !important; border-color: var(--line) !important; }
.gw-editor-toolbar .gw-btn { background: transparent !important; color: var(--text) !important; border-color: transparent !important; }
.gw-editor-toolbar .gw-btn:hover { background: var(--accent-soft) !important; color: var(--accent) !important; }
.gw-editor-toolbar .gw-sep { background: var(--line) !important; }
#gw-editor { background: var(--bg) !important; color: var(--text) !important; border-color: var(--line) !important; }
.gw-seg-btn { background: var(--panel) !important; color: var(--text) !important; }
.gw-seg-btn.active { background: var(--accent) !important; color: var(--accent-ink) !important; }
.gw-seg-opt { color: var(--muted) !important; }
.gw-btn-fullscreen { background: var(--accent) !important; background-image: none !important; box-shadow: none !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; }
