/* Ask the wiki -- styled after a standard Confluence space: top bar, page tree,
   breadcrumb, title, byline, page body, "On this page". System fonts, no framework. */
:root {
  --text: #172b4d;
  --subtle: #44546f;
  --muted: #626f86;
  --line: #dfe1e6;
  --line-soft: #ebecf0;
  --bg: #ffffff;
  --sidebar: #f7f8f9;
  --hover: #ebecf0;
  --selected-bg: #e9f2ff;
  --selected: #0c66e4;
  --link: #0c66e4;
  --brand: #0c66e4;
  --th: #f4f5f7;
  --info-bg: #e9f2ff;
  --info-line: #0c66e4;
  --warn-bg: #fff7d6;
  --warn-line: #e2b203;
  --banner-bg: #fff7d6;
  --banner-ink: #7f5f01;
  --answer-bg: #f3f0ff;
  --answer-line: #8270db;
  --error: #c9372c;
  --code-bg: #f4f5f7;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); }
button { font: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 1px rgba(9, 30, 66, .06);
}
.topbar-row { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 16px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; flex: none; }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
}
.logo-mark.small { width: 24px; height: 24px; font-size: 9px; border-radius: 4px; }
.logo-mark.big { width: 48px; height: 48px; font-size: 15px; border-radius: 10px; }
.logo-text { font-size: 17px; }

.ask {
  flex: 1; max-width: 640px; margin: 0 auto; display: flex; align-items: center;
  border: 2px solid var(--line); border-radius: 6px; background: var(--sidebar); padding-left: 10px;
}
.ask:focus-within { border-color: var(--brand); background: var(--bg); }
.ask-icon {
  width: 14px; height: 14px; border: 2px solid var(--muted); border-radius: 50%;
  position: relative; flex: none;
}
.ask-icon::after {
  content: ""; position: absolute; width: 2px; height: 7px; background: var(--muted);
  right: -4px; bottom: -6px; transform: rotate(-45deg);
}
.ask input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 8px 10px;
}
.ask-btn {
  border: 0; background: var(--brand); color: #fff; font-weight: 600; padding: 8px 16px;
  border-radius: 0 3px 3px 0; cursor: pointer; align-self: stretch;
}
.ask-btn:disabled { opacity: .6; }

.user { position: relative; flex: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: #5e4db2; color: #fff; font-weight: 700; font-size: 14px;
}
.user-menu {
  position: absolute; right: 0; top: 42px; min-width: 220px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 16px rgba(9, 30, 66, .2);
  padding: 8px 0;
}
.user-email { margin: 0; padding: 6px 16px 10px; color: var(--subtle); font-size: 14px;
  border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 16px; cursor: pointer; color: var(--text); }
.menu-item:hover { background: var(--hover); }

.icon-btn { border: 0; background: none; cursor: pointer; color: var(--subtle); }
.hamburger { width: 36px; height: 36px; position: relative; flex: none; display: none; border-radius: 4px; }
.hamburger:hover { background: var(--hover); }
.hamburger span, .hamburger span::before, .hamburger span::after {
  position: absolute; left: 9px; width: 18px; height: 2px; background: var(--subtle); content: "";
}
.hamburger span { top: 17px; }
.hamburger span::before { left: 0; top: -6px; }
.hamburger span::after { left: 0; top: 6px; }

.banner {
  background: var(--banner-bg); color: var(--banner-ink); text-align: center;
  font-size: 14px; font-weight: 600; padding: 6px 16px; border-bottom: 1px solid #f5e1a3;
}

/* ---------- sign-in ---------- */
.solo { padding: 48px 16px; }
.signin-card {
  max-width: 400px; margin: 0 auto; text-align: center; border: 1px solid var(--line);
  border-radius: 8px; padding: 32px 24px; box-shadow: 0 1px 3px rgba(9, 30, 66, .12);
}
.signin-card h1 { font-size: 22px; margin: 14px 0 8px; }
.gsi { display: flex; justify-content: center; margin: 20px 0 4px; min-height: 44px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
@media (min-width: 1200px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr) 240px; }
}

/* ---------- sidebar / page tree ---------- */
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 16px 8px 32px;
}
.space-home {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px;
  color: var(--text); font-weight: 650;
}
.space-home:hover { background: var(--hover); text-decoration: none; }
.space-home.current { background: var(--selected-bg); color: var(--selected); }
.filter {
  width: calc(100% - 16px); margin: 12px 8px 4px; padding: 6px 10px; font: inherit; font-size: 14px;
  border: 2px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--text);
}
.filter:focus { outline: 0; border-color: var(--brand); }
.tree-label, .toc-label {
  margin: 14px 8px 4px; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 16px; display: none; }
.tree li.open > ul { display: block; }
.row { display: flex; align-items: flex-start; border-radius: 4px; }
.row:hover { background: var(--hover); }
.twisty, .twisty-spacer { flex: none; width: 24px; height: 30px; }
.twisty { border: 0; background: none; cursor: pointer; position: relative; border-radius: 4px; }
.twisty::before {
  content: ""; position: absolute; left: 9px; top: 11px; border: 4px solid transparent;
  border-left: 6px solid var(--muted); transition: transform .12s;
}
li.open > .row > .twisty::before { transform: rotate(90deg); transform-origin: 3px 4px; }
.node { flex: 1; padding: 4px 6px 4px 2px; color: var(--subtle); font-size: 14px; line-height: 1.5; }
.node:hover { text-decoration: none; color: var(--text); }
.node[aria-current="page"] { color: var(--selected); font-weight: 600; }
.row:has(> .node[aria-current="page"]) { background: var(--selected-bg); box-shadow: inset 2px 0 0 var(--selected); }
.scrim { display: none; }

/* ---------- content ---------- */
.content { padding: 24px 40px 64px; max-width: 900px; width: 100%; }
.breadcrumb { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.breadcrumb:empty { display: none; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--link); }
.breadcrumb .sep { color: #b3b9c4; margin: 0 2px; }
.page-title { font-size: 29px; line-height: 1.25; font-weight: 650; margin: 10px 0 6px; letter-spacing: -.01em; }
.byline { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.byline .dot { margin: 0 8px; }

/* ---------- answer panel ---------- */
.answer-panel {
  background: var(--answer-bg); border: 1px solid #dfd8fd; border-left: 4px solid var(--answer-line);
  border-radius: 6px; padding: 14px 18px 12px; margin: 0 0 24px;
}
.answer-head { display: flex; align-items: center; justify-content: space-between; }
.answer-badge { font-size: 12px; font-weight: 700; color: #5e4db2; text-transform: uppercase; letter-spacing: .05em; }
.close { font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 4px; }
.close:hover { background: rgba(9, 30, 66, .08); }
.answer-q { font-weight: 650; font-size: 17px; margin: 4px 0 8px; overflow-wrap: anywhere; }
.thinking { font-style: italic; }
.answer-body > :first-child { margin-top: 0; }
.sources { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.source {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text); font-size: 14px; font-weight: 600;
}
.source:hover { border-color: var(--brand); color: var(--link); text-decoration: none; }
.source-icon {
  width: 12px; height: 15px; border: 2px solid var(--brand); border-radius: 2px; flex: none;
}
.answer-foot { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* ---------- page body: Confluence-like typography ---------- */
.wiki { overflow-wrap: break-word; }
.wiki h1, .wiki h2, .wiki h3, .wiki h4 { color: var(--text); line-height: 1.3; scroll-margin-top: 72px; }
.wiki h1 { font-size: 24px; margin: 32px 0 8px; }
.wiki h2 { font-size: 21px; font-weight: 650; margin: 32px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.wiki h3 { font-size: 17px; font-weight: 650; margin: 24px 0 6px; }
.wiki h4, .wiki h5, .wiki h6 { font-size: 15px; font-weight: 650; margin: 18px 0 4px; }
.wiki p { margin: 10px 0; }
.wiki ul, .wiki ol { padding-left: 24px; margin: 8px 0; }
.wiki li { margin: 3px 0; }
.wiki code { background: var(--code-bg); padding: 1px 5px; border-radius: 3px; font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wiki pre { background: var(--code-bg); padding: 12px; border-radius: 4px; overflow-x: auto; }
.wiki pre code { background: none; padding: 0; }
.wiki blockquote { margin: 12px 0; padding: 2px 16px; border-left: 2px solid var(--line); color: var(--subtle); }
.wiki .table-wrap { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.wiki table { border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.wiki .table-wrap table { margin: 0; }
.wiki th, .wiki td { border: 1px solid #c1c7d0; padding: 7px 10px; text-align: left; vertical-align: top; min-width: 90px; }
.wiki th { background: var(--th); font-weight: 650; }
.wiki .note, .wiki .warning, .wiki .info, .wiki .tip {
  position: relative; margin: 14px 0; padding: 10px 14px 10px 44px; border-radius: 4px;
}
.wiki .note > :first-child, .wiki .warning > :first-child { margin-top: 0; }
.wiki .note > :last-child, .wiki .warning > :last-child { margin-bottom: 0; }
.wiki .note, .wiki .info, .wiki .tip { background: var(--info-bg); }
.wiki .warning { background: var(--warn-bg); }
.wiki .note::before, .wiki .info::before, .wiki .tip::before, .wiki .warning::before {
  position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 800; line-height: 18px; text-align: center;
}
.wiki .note::before, .wiki .info::before, .wiki .tip::before { content: "i"; background: var(--info-line); }
.wiki .warning::before { content: "!"; background: var(--warn-line); color: #172b4d; }
.wiki figure { margin: 16px 0; }
.wiki figure img, .wiki img {
  max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; display: block;
}
.wiki figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }
.wiki .picture-note { color: var(--muted); font-size: 14px; font-style: italic; }
.wiki ul.children { list-style: none; padding: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 4px; }
.wiki ul.children li { margin: 0; border-bottom: 1px solid var(--line-soft); }
.wiki ul.children li:last-child { border-bottom: 0; }
.wiki ul.children a { display: block; padding: 8px 12px; }

/* ---------- on this page ---------- */
.toc {
  position: sticky; top: calc(var(--topbar-h) + 24px); align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; padding: 24px 16px 24px 0;
  display: none;
}
@media (min-width: 1200px) { .toc:not([hidden]) { display: block; } }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line-soft); }
.toc li a { display: block; padding: 3px 12px; font-size: 13px; color: var(--subtle); line-height: 1.4; }
.toc li.lvl3 a { padding-left: 24px; }
.toc li a:hover { color: var(--link); text-decoration: none; }

/* ---------- phone / narrow ---------- */
@media (max-width: 899px) {
  .hamburger { display: block; }
  .topbar-row { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; }
  .logo { margin-right: auto; }
  .ask { order: 3; flex-basis: 100%; max-width: none; }
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(320px, 86vw); z-index: 50;
    transform: translateX(-102%); transition: transform .18s ease, visibility .18s; visibility: hidden;
  }
  body.drawer-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 24px rgba(9, 30, 66, .25); }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(9, 30, 66, .45); z-index: 40; }
  .content { padding: 16px 16px 48px; }
  .page-title { font-size: 24px; }
  .node { font-size: 15px; padding: 6px 6px 6px 2px; }
  .twisty, .twisty-spacer { height: 36px; }
  .twisty::before { top: 14px; }
}
.source-label { color: var(--muted); font-weight: 500; margin-right: -2px; }
