/* Field Ascend Public Help Centre — self-contained, zero external assets */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-alt: #f5f5f4;
  --text: #1c1917;
  --text-muted: #57534e;
  --border: #e7e5e4;
  --accent: #059669;
  --accent-dark: #047857;
  --accent-soft: #ecfdf5;
  --navy: #0f172a;
  --radius: 10px;
  --header-h: 64px;
  --sidebar-w: 272px;
  --toc-w: 230px;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0c0a09; --surface: #1c1917; --surface-alt: #292524;
    --text: #f5f5f4; --text-muted: #a8a29e; --border: #292524;
    --accent: #10b981; --accent-dark: #34d399; --accent-soft: #064e3b;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0a09; --surface: #1c1917; --surface-alt: #292524;
  --text: #f5f5f4; --text-muted: #a8a29e; --border: #292524;
  --accent: #10b981; --accent-dark: #34d399; --accent-soft: #064e3b;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.65;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand img { height: 28px; width: auto; display: block; }
.brand .pill { background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.search-box { position: relative; flex: 1; max-width: 440px; }
.search-box input {
  width: 100%; height: 38px; padding: 0 12px 0 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); font-size: 14px;
}
.search-box input:focus { outline: 2px solid var(--accent); background: var(--surface); }
.search-box .search-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 14px; }
.search-results {
  position: absolute; left: 0; right: 0; top: 44px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.14);
  max-height: 420px; overflow-y: auto; display: none; z-index: 60;
}
.search-results.open { display: block; }
.search-hit { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover { background: var(--surface-alt); text-decoration: none; }
.search-hit .hit-title { font-weight: 600; font-size: 14px; display: block; }
.search-hit .hit-meta { font-size: 12px; color: var(--accent-dark); }
.search-hit .hit-excerpt { font-size: 12.5px; color: var(--text-muted); display: block; margin-top: 2px; }
.top-links { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 14px; white-space: nowrap; }
.top-links a { color: var(--text-muted); font-weight: 500; }
.top-links a:hover { color: var(--text); }
.btn-cta { background: var(--accent); color: #fff !important; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.btn-cta:hover { background: var(--accent-dark); text-decoration: none; }
.menu-btn { display: none; background: var(--surface-alt); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 14px; cursor: pointer; }
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); max-width: 1440px; margin: 0 auto; min-height: calc(100vh - var(--header-h)); }
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
  border-right: 1px solid var(--border); padding: 18px 14px 40px; background: var(--surface);
}
.nav-portal { margin-bottom: 14px; }
.nav-portal > summary {
  list-style: none; cursor: pointer; font-weight: 700; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); padding: 6px 8px; border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-portal > summary:hover { background: var(--surface-alt); color: var(--text); }
.nav-group-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); padding: 10px 8px 4px; text-transform: uppercase; letter-spacing: .03em; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 5px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-list a:hover { background: var(--surface-alt); text-decoration: none; }
.nav-list a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.main { padding: 32px 44px 64px; max-width: 860px; width: 100%; }
.main.wide { max-width: 1040px; }
.crumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-muted); }
.doc-head { border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 24px; }
.doc-head h1 { margin: 0 0 10px; font-size: 32px; line-height: 1.2; letter-spacing: -.02em; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-muted); align-items: center; }
.doc-meta .badge { background: var(--surface-alt); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; font-weight: 500; }
.doc-meta .md-link { margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.prose h2 { margin: 32px 0 12px; font-size: 22px; line-height: 1.3; padding-top: 8px; border-top: 1px solid var(--border); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { margin: 24px 0 8px; font-size: 17.5px; line-height: 1.35; }
.prose h4 { margin: 18px 0 6px; font-size: 15.5px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 24px; }
.prose li { margin: 5px 0; }
.prose code { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: .88em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.prose pre { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; overflow-x: auto; margin: 0 0 16px; }
.prose pre code { background: none; border: 0; padding: 0; font-size: 13.5px; }
.prose blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--surface-alt); border-radius: 0 8px 8px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: 8px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-alt); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }
.toc { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 28px 16px; font-size: 13px; }
.toc-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 4px 0 4px 12px; color: var(--text-muted); line-height: 1.35; }
.toc li.l3 a { padding-left: 22px; font-size: 12.5px; }
.toc li a:hover { color: var(--accent-dark); text-decoration: none; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin: 22px 0 32px; }
.portal-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; color: var(--text); transition: border-color .15s;
}
.portal-card:hover { border-color: var(--accent); text-decoration: none; }
.portal-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.portal-card p { margin: 0 0 10px; font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.portal-card .count { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 12px 0 28px; }
.doc-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px; color: var(--text); }
.doc-card:hover { border-color: var(--accent); text-decoration: none; }
.doc-card strong { display: block; font-size: 14.5px; margin-bottom: 4px; }
.doc-card span { display: block; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.update-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.update-card .u-date { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); margin-bottom: 4px; }
.update-card h2 { margin: 0 0 8px; font-size: 19px; border: 0; padding: 0; }
.footer { border-top: 1px solid var(--border); margin-top: 44px; padding-top: 20px; font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
@media (max-width: 1120px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .menu-btn { display: inline-flex; }
  .top-links .hide-sm { display: none; }
  .layout, .layout.no-toc { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 50; height: calc(100vh - var(--header-h)); }
  .sidebar.open { display: block; }
  .main { padding: 22px 18px 48px; }
}
