
/* ── Brand tokens (from CRMconnect platform) ─────────────── */
:root {
  --accent:         #7366ff;
  --accent-soft:    #f5f4ff;
  --accent-dark:    #5a4fcc;
  --red:            #e54b4b;
  --green:          #54ba4a;
  --warning:        #ffa941;
  --info:           #40b8f5;

  --bg:             #ffffff;
  --bg-soft:        #f7f9fc;
  --bg-side:        #0b0f19;
  --bg-side-soft:   #141924;
  --bg-side-active: #1e2538;

  --text:           #2f2f3b;
  --text-soft:      #6c7888;
  --text-on-dark:   #d8dde6;
  --text-on-dark-soft: #8b94a3;

  --border:         #e9edf1;
  --code-bg:        #f2f4f7;
  --shadow-sm:      0 1px 2px rgba(82,82,108,.06);
  --shadow:         0 1px 3px rgba(82,82,108,.08), 0 4px 16px rgba(82,82,108,.06);
  --radius-sm:      6px;
  --radius-md:      8px;
  --radius-lg:      10px;

  --top-bar-h: 56px;
  --side-w: 280px;

  --font-body: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 400 15px/1.65 var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ──────────────────────────────────────────────── */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: var(--top-bar-h);
  display: flex; align-items: center; gap: 0;
  padding: 0 16px 0 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.top-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  width: var(--side-w);
  padding: 0 16px;
  border-right: 1px solid var(--border);
  height: 100%;
}
.top-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.top-brand-name { font-size: 14px; font-weight: 700; color: var(--text); }
.top-brand-sub  { font-size: 11px; color: var(--text-soft); font-weight: 400; letter-spacing: .01em; }
.top-brand:hover .top-brand-name { color: var(--accent); }
.top-brand svg { flex-shrink: 0; }
.top-search {
  flex: 1; min-width: 0; position: relative;
  display: flex; align-items: center;
  padding: 0 16px;
}
.top-search-icon {
  position: absolute; left: 12px; color: var(--text-soft); font-size: 13px; pointer-events: none;
}
#search-input {
  width: 100%; padding: 8px 70px 8px 36px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: var(--font-body);
  background: var(--bg-soft); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(115,102,255,.12);
  background: var(--bg);
}
#search-input::placeholder { color: var(--text-soft); }
.top-search-kbd {
  position: absolute; right: 10px;
  font-size: 11px; color: var(--text-soft);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; pointer-events: none;
  font-family: var(--font-mono);
}
.top-bar-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
/* ── Language switcher ────────────────────────────────────── */
.lang-select {
  position: relative;
}
.lang-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color .15s, color .15s;
}
.lang-select-btn:hover,
.lang-select.open .lang-select-btn {
  border-color: var(--accent);
  color: var(--accent);
}
.lang-caret {
  font-size: 10px;
  transition: transform .2s;
}
.lang-select.open .lang-caret { transform: rotate(180deg); }
.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
}
.lang-select.open .lang-dropdown { display: block; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 7px;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
}
.lang-option .lang-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent);
  min-width: 24px;
}
.lang-option .lang-full {
  font-size: 13px;
  color: var(--text);
}
a.lang-option:hover { background: var(--hover); text-decoration: none; }
.lang-option.active {
  background: var(--hover);
  cursor: default;
}
.lang-option.active .lang-full { color: var(--text-soft); }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--top-bar-h); left: 0; bottom: 0;
  width: var(--side-w);
  background: var(--bg-side);
  color: var(--text-on-dark);
  overflow-y: auto;
  padding: 0 0 32px;
  border-right: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-body);
}
.side-nav { padding: 8px 8px 24px; }
.nav-link {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: var(--radius-md);
  color: rgba(216,221,230,0.75); font-size: 13.5px;
  text-decoration: none; transition: background .12s, color .12s;
}
.nav-link.sub { padding-left: 24px; font-size: 13px; color: var(--text-on-dark-soft); }
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.nav-link.is-current { background: var(--accent); color: #fff; font-weight: 500; }
.nav-link.is-current:hover { background: var(--accent-dark); }
.nav-link.ext { color: rgba(255,255,255,0.35); font-size: 12.5px; }
.nav-link.ext:hover { color: rgba(255,255,255,0.65); }
.sidebar-cta {
  margin: 12px 10px 16px;
  padding: 14px 14px 12px;
  background: linear-gradient(135deg, rgba(115,102,255,0.18) 0%, rgba(115,102,255,0.08) 100%);
  border: 1px solid rgba(115,102,255,0.35);
  border-radius: var(--radius-md);
}
.sidebar-cta-headline {
  margin: 0 0 4px;
  font-size: 13px; font-weight: 600; color: #fff; line-height: 1.3;
}
.sidebar-cta-sub {
  margin: 0 0 10px;
  font-size: 11.5px; color: rgba(255,255,255,0.55); line-height: 1.4;
}
.sidebar-cta-btn {
  display: block; text-align: center;
  padding: 7px 10px;
  background: var(--accent); color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  transition: background .15s, transform .1s;
}
.sidebar-cta-btn:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); text-decoration: none; }
.cap-intro { color: var(--text-soft); margin-bottom: 24px; font-size: 15px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 12px 0 32px; }
.cap-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.cap-name { font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.cap-benefit { font-size: 13px; color: var(--text-soft); margin: 0; line-height: 1.5; }
.divider { height: 1px; background: rgba(255,255,255,0.08); margin: 8px 10px; }
details.section { margin: 1px 0; }
details.section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: var(--radius-md);
  color: #d8dde6; font-size: 13.5px; font-weight: 500;
  transition: background .12s; user-select: none;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after {
  content: '›'; margin-left: auto; opacity: .5;
  transition: transform .15s ease; font-size: 16px; line-height: 1;
}
details.section[open] > summary::after { transform: rotate(90deg); }
details.section > summary:hover { background: rgba(255,255,255,0.07); color: #fff; }
.children { display: flex; flex-direction: column; gap: 0; padding: 2px 0 4px; }
.ico { font-size: 14px; line-height: 1; width: 16px; display: inline-block; opacity: .75; }
/* ── Track (L1) ─────────────────────────────────────── */
details.track { margin: 1px 0; }
details.track > summary.track-summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-md);
  color: rgba(255,255,255,0.55); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  transition: background .12s, color .12s; user-select: none;
}
details.track > summary.track-summary::-webkit-details-marker { display: none; }
details.track > summary.track-summary::after {
  content: '›'; margin-left: auto; opacity: .4;
  transition: transform .15s ease; font-size: 15px; line-height: 1;
}
details.track[open] > summary.track-summary::after { transform: rotate(90deg); }
details.track[open] > summary.track-summary { color: rgba(255,255,255,0.85); }
details.track > summary.track-summary:hover { background: rgba(255,255,255,0.05); color: #fff; }
.track-children { padding: 2px 0 2px 6px; }
.track-children details.section > summary { padding-left: 14px; font-size: 13px; }
.track-children .nav-link.sub { padding-left: 28px; }
/* ── Dept label within roles (between L2 and L3) ──── */
.nav-dept-label {
  display: block;
  padding: 6px 10px 2px 28px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.28); user-select: none; pointer-events: none;
}
.nav-link.sub2 { padding-left: 36px !important; font-size: 12px; }

/* ── Main content ─────────────────────────────────────────── */
.content {
  margin-left: var(--side-w);
  max-width: calc(100vw - var(--side-w));
  padding: calc(var(--top-bar-h) + 28px) 48px 80px;
}
.breadcrumbs {
  font-size: 13px; color: var(--text-soft); margin-bottom: 18px;
}
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 4px; opacity: .5; }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

.doc {
  max-width: 900px; margin: 0 auto;
  font-family: var(--font-body);
}
.doc h1 {
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  margin: 4px 0 20px; color: var(--text);
  font-family: var(--font-body);
}
.doc h2 {
  font-size: 20px; font-weight: 600; margin-top: 40px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
  color: var(--text); font-family: var(--font-body);
}
.doc h3 {
  font-size: 16px; font-weight: 600; margin-top: 24px; margin-bottom: 8px;
  color: var(--text);
}
.doc h4 { font-size: 14.5px; font-weight: 600; margin-top: 16px; color: var(--text-soft); }
.doc p { margin: 10px 0; line-height: 1.7; }
.doc ul, .doc ol { margin: 10px 0; padding-left: 22px; }
.doc li { margin: 5px 0; line-height: 1.65; }
.doc strong { font-weight: 600; color: var(--text); }
.doc code {
  background: var(--code-bg); padding: 2px 6px; border-radius: var(--radius-sm);
  font: 12.5px/1.5 var(--font-mono);
  border: 1px solid var(--border); color: #c0392b;
}
.doc pre {
  background: #1e2538;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md); padding: 16px 18px;
  overflow-x: auto; margin: 16px 0;
}
.doc pre code {
  background: transparent; border: none; padding: 0;
  font-size: 13px; color: #a8b4cc;
}
.doc blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  margin: 16px 0; padding: 10px 16px; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text);
}
.doc blockquote p:first-child { margin-top: 0; }
.doc blockquote p:last-child  { margin-bottom: 0; }

/* Tables */
.doc table {
  border-collapse: collapse; margin: 16px 0; width: 100%;
  font-size: 13.5px; border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.doc th, .doc td {
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
.doc th {
  background: var(--bg-soft); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-soft); white-space: nowrap;
}
.doc tr:last-child td { border-bottom: none; }
.doc tr:hover td { background: rgba(115,102,255,0.03); }
.doc td code { background: var(--bg-soft); color: #c0392b; }

/* Images */
.img-link {
  display: block; margin: 16px 0;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow);
  background: #fff;
}
.img-link img { display: block; width: 100%; height: auto; }
.img-link:hover { border-color: var(--accent); }


/* Mobile */
.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-soft); font-size: 18px; padding: 8px 10px; line-height: 1;
  flex-shrink: 0;
}
.nav-toggle:hover { color: var(--text); }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; z-index: 400; top: var(--top-bar-h); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: calc(var(--top-bar-h) + 20px) 20px 60px; max-width: 100vw; }
  .nav-toggle { display: flex; align-items: center; }
  .top-brand { display: block; }
}

/* Cards on home */
/* ── Homepage track blocks ───────────────────────────── */
.home-track-block { margin-bottom: 32px; }
.home-track-heading {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-soft);
  margin: 0 0 12px; padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
}
.home-track-heading .fas { font-size: 12px; color: var(--accent); }
.quick-links {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.quick-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.quick-links a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-links a .fas { font-size: 11px; opacity: .7; }
html.dark .quick-links a { background: #161c2a; border-color: rgba(255,255,255,0.1); color: #c9d0db; }
html.dark .quick-links a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.section-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin: 18px 0 28px;
}
.section-card {
  display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); text-decoration: none; transition: .15s ease;
}
.section-card:hover { background: #fff; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.section-card .h { font-weight: 600; margin-bottom: 4px; }
.section-card .d { color: var(--text-soft); font-size: 13.5px; }
.section-card .ico { font-size: 22px; margin-bottom: 8px; display: block; width: 28px; }
.section-card .ico .fas { font-size: 20px; color: var(--accent); }
.section-card .count { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); font-weight: 600; }

/* Search results overlay */
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1e2330; color: var(--text-on-dark); border: 1px solid #ffffff18;
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.45);
  max-height: 70vh; overflow-y: auto; display: none; z-index: 100;
}
.search-results.open { display: block; }
.sr-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid #ffffff0d;
  color: var(--text-on-dark); text-decoration: none; cursor: pointer;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.sr-active { background: #2a3044; text-decoration: none; }
.sr-title { font-size: 13.5px; font-weight: 600; color: #e8ecf4; margin-bottom: 2px; }
.sr-meta  { font-size: 11.5px; color: #6b7585; margin-bottom: 4px; }
.sr-snippet { font-size: 12px; color: #8b94a3; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark { background: #4a3f82; color: #c9b8ff; padding: 0 2px; border-radius: 2px; }
.sr-empty { padding: 12px 14px; font-size: 13px; color: #6b7585; }

/* ── Heading anchors ──────────────────────────────────────── */
.doc h1, .doc h2, .doc h3, .doc h4 { position: relative; }
.ha {
  display: inline-block;
  width: 1em; height: 1em;
  margin-left: 6px;
  opacity: 0;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.75em;
  vertical-align: middle;
  transition: opacity .15s;
}
.ha::before { content: '#'; }
.doc h1:hover .ha, .doc h2:hover .ha,
.doc h3:hover .ha, .doc h4:hover .ha { opacity: 1; }
.ha:hover { color: var(--accent); text-decoration: none; }

/* ── Copy code button ─────────────────────────────────────── */
.doc pre { position: relative; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 10px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-body);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  cursor: pointer; opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  line-height: 1.4;
}
.doc pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

/* ── Prev / Next navigation ───────────────────────────────── */
.prev-next {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 48px 0 0;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.pn-btn {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 18px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.pn-btn:hover { border-color: var(--accent); background: var(--bg); text-decoration: none; }
.pn-right { align-items: flex-end; grid-column: 2; }
.pn-dir { font-size: 11px; color: var(--text-soft); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.pn-title { font-size: 13.5px; font-weight: 500; color: var(--accent); }

/* ── Role-based quick-start cards (home page) ─────────────── */
.role-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin: 14px 0 32px;
}
.role-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg-soft);
  color: var(--text); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: .15s ease;
}
.role-card:hover { border-color: var(--accent); background: #fff; text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.role-card .ri { font-size: 20px; flex-shrink: 0; width: 22px; text-align: center; }
.role-card .ri .fas { font-size: 18px; color: var(--accent); }

/* ── Page body layout (article + TOC side-by-side) ──────────── */
.page-body {
  display: flex; gap: 40px; align-items: flex-start;
}
.doc-col { flex: 1; min-width: 0; }
.doc { width: 100%; }

/* ── "On this page" TOC ─────────────────────────────────────── */
.toc {
  width: 210px; flex-shrink: 0;
  position: sticky; top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto; scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }
.toc-inner { padding: 2px 0 24px; }
.toc-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-soft); margin: 0 0 8px;
}
.toc-link {
  display: block; font-size: 12.5px; padding: 3px 6px 3px 12px;
  border-left: 2px solid var(--border);
  color: var(--text-soft); text-decoration: none;
  line-height: 1.5; transition: color .12s, border-color .12s;
  word-break: break-word;
}
.toc-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.toc-link.toc-h3 { padding-left: 22px; font-size: 11.5px; }
.toc-link.toc-active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
@media (max-width: 1280px) { .toc { display: none; } }

/* ── Dark mode toggle ────────────────────────────────────────── */
.dark-btn {
  width: 30px; height: 22px;
  background: none; border: 1.5px solid var(--border);
  border-radius: 20px; cursor: pointer;
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s;
  padding: 0; color: var(--text);
}
.dark-btn:hover { border-color: var(--accent); }

/* ── Dark mode overrides ─────────────────────────────────────── */
html.dark {
  --bg:         #0f1117;
  --bg-soft:    #161c2a;
  --text:       #dde3f0;
  --text-soft:  #8494b0;
  --border:     #2a3148;
  --code-bg:    #161c2a;
  --accent-soft:#1e1a3f;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
  --shadow:     0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}
html.dark body { background: var(--bg); color: var(--text); }
html.dark .top-bar { background: #0f1421; border-color: rgba(255,255,255,.08); }
html.dark #search-input { background: #1a2035; border-color: #2a3148; color: #d8dde6; }
html.dark #search-input:focus { background: #1e2640; }
html.dark #search-input::placeholder { color: #5a6478; }
html.dark .top-search-kbd { background: #1a2035; border-color: #2a3148; }
html.dark .top-search-icon { color: #5a6478; }
html.dark .doc pre  { background: #0d1117; border-color: #252e45; }
html.dark .doc code { background: #1a2035; border-color: #2a3148; color: #e07070; }
html.dark .doc th   { background: #161c2a; }
html.dark .doc tr:hover td { background: rgba(115,102,255,.06); }
html.dark .doc blockquote  { background: #1e1a3f; }
html.dark .doc table { border-color: #2a3148; }
html.dark .doc th, html.dark .doc td { border-color: #2a3148; }
html.dark .section-card, html.dark .role-card, html.dark .pn-btn { background: #161c2a; }
html.dark .section-card:hover, html.dark .role-card:hover, html.dark .pn-btn:hover { background: #1e2538; }
html.dark .img-link { background: #161c2a; border-color: #2a3148; }
html.dark .toc-link { border-color: #2a3148; }
html.dark .search-results { background: #0f1117; }
html.dark .sr-item:hover, html.dark .sr-item.sr-active { background: #1e2538; }
html.dark .copy-btn { background: rgba(255,255,255,0.06); }
html.dark .breadcrumbs a { color: var(--text-soft); }

/* ── Back to top button ──────────────────────────────────────── */
.back-to-top {
  position: fixed; bottom: 28px; right: 28px; z-index: 50;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 18px; line-height: 1; cursor: pointer;
  opacity: 0; transform: translateY(10px);
  transition: opacity .2s, transform .2s, background .15s;
  box-shadow: 0 2px 12px rgba(115,102,255,.4);
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-dark); }
@media (max-width: 900px) { .back-to-top { bottom: 16px; right: 16px; } }

/* ── Reading time ────────────────────────────────────────────── */
.reading-time {
  display: block; font-size: 12px; color: var(--text-soft);
  margin: -12px 0 22px; font-weight: 400;
}

/* ── Interactive checkboxes ──────────────────────────────────── */
.doc input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent); cursor: pointer;
  vertical-align: middle; margin-right: 6px; flex-shrink: 0;
}
.doc li:has(> input[type="checkbox"]:checked) {
  text-decoration: line-through; opacity: .55;
  transition: opacity .2s;
}

/* ── Font Awesome icon integration ─────────────────────────── */
/* Section icons in sidebar */
.ico .fas, .ico .far, .ico .fab {
  width: 18px; text-align: center; font-size: 13px;
  color: rgba(255,255,255,.6);
}
/* Nav link icons */
.nav-ico {
  width: 16px; text-align: center; font-size: 11.5px;
  margin-right: 5px; opacity: .65; flex-shrink: 0;
  transition: opacity .15s;
}
.nav-link:hover .nav-ico,
.nav-link.is-current .nav-ico { opacity: 1; }


/* Dark toggle icon swap: moon/sun via FA */
.dark-btn .fa-moon  { display: inline-block; }
.dark-btn .fa-sun   { display: none; }
html.dark .dark-btn .fa-moon { display: none; }
html.dark .dark-btn .fa-sun  { display: inline-block; }

/* Copy button icon */
.copy-btn { display: inline-flex; align-items: center; gap: 5px; }
.copy-btn .fas { font-size: 11px; }

/* Open-in-platform button icon */
.oip-btn .fas { font-size: 12px; }

/* ── Open-in-platform bar ───────────────────────────────────── */
.oip-bar { margin: -8px 0 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.oip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s; text-decoration: none;
}
.oip-btn:hover { background: var(--accent-dark); }
.oip-change { font-size: 12px; color: var(--text-soft); text-decoration: underline; cursor: pointer; }
.oip-change:hover { color: var(--accent); }

/* ── Modal overlay ──────────────────────────────────────────── */
.oip-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  align-items: center; justify-content: center;
}
.oip-overlay.oip-visible { display: flex; }
.oip-modal {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.oip-label { margin: 0 0 10px; font-weight: 600; font-size: 15px; color: var(--text); }
.oip-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--bg);
  outline: none;
}
.oip-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(115,102,255,.18); }
.oip-err { margin: 6px 0 0; font-size: 12px; color: var(--red); }
.oip-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.oip-cancel {
  padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer; font-size: 13px; font-family: inherit;
}
.oip-cancel:hover { background: var(--bg-soft); }
.oip-confirm {
  padding: 8px 18px; border-radius: 6px; border: none;
  background: var(--accent); color: #fff; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
}
.oip-confirm:hover { background: var(--accent-dark); }
html.dark .oip-modal { border-color: #2a3148; }
html.dark .oip-input { border-color: #2a3148; background: #111827; color: #e2e8f0; }
html.dark .oip-cancel { border-color: #2a3148; color: #e2e8f0; }
html.dark .oip-cancel:hover { background: #1a2035; }

/* ── Callout / Admonition boxes ─────────────────────────────── */
.callout {
  border-radius: 8px; padding: 14px 16px; margin: 20px 0;
  border-left: 4px solid; display: flex; flex-direction: column; gap: 6px;
}
.callout-head {
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px;
}
.callout-head .fas { font-size: 13px; }
.callout-body > *:first-child { margin-top: 0; }
.callout-body > *:last-child  { margin-bottom: 0; }
.callout-body p { margin: 6px 0; font-size: 14px; }

.callout-note, .callout-info {
  background: #eef6ff; border-color: #3b82f6; color: #1e3a5f; }
.callout-note .callout-head, .callout-info .callout-head { color: #2563eb; }

.callout-tip {
  background: #f0fdf4; border-color: #22c55e; color: #14532d; }
.callout-tip .callout-head { color: #16a34a; }

.callout-warning {
  background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.callout-warning .callout-head { color: #d97706; }

.callout-danger {
  background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }
.callout-danger .callout-head { color: #dc2626; }

.callout-important {
  background: #faf5ff; border-color: #a855f7; color: #3b0764; }
.callout-important .callout-head { color: #9333ea; }

html.dark .callout-note, html.dark .callout-info   { background: #0d1e35; color: #93c5fd; border-color: #3b82f6; }
html.dark .callout-note .callout-head,
html.dark .callout-info .callout-head               { color: #60a5fa; }
html.dark .callout-tip    { background: #0d2318; color: #86efac; border-color: #22c55e; }
html.dark .callout-tip .callout-head { color: #4ade80; }
html.dark .callout-warning { background: #2a1e06; color: #fcd34d; border-color: #f59e0b; }
html.dark .callout-warning .callout-head { color: #fbbf24; }
html.dark .callout-danger  { background: #2a0a0a; color: #fca5a5; border-color: #ef4444; }
html.dark .callout-danger .callout-head { color: #f87171; }
html.dark .callout-important { background: #1e0a2e; color: #d8b4fe; border-color: #a855f7; }
html.dark .callout-important .callout-head { color: #c084fc; }

/* ── Toast notification ──────────────────────────────────────── */
.toast-msg {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15,20,35,.9); color: #fff;
  padding: 8px 18px; border-radius: 20px;
  font-size: 13px; z-index: 9998; opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none; white-space: nowrap;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Screenshot lightbox ─────────────────────────────────────── */
.lb-overlay {
  display: none; position: fixed; inset: 0; z-index: 9995;
  background: rgba(0,0,0,.88); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lb-overlay.lb-open { display: flex; }
.lb-img {
  max-width: 92vw; max-height: 88vh; border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6); cursor: default;
}
.lb-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,.25); }

/* ── Last updated ────────────────────────────────────────────── */
.last-updated {
  font-size: 12px; color: var(--text-soft); margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
.last-updated .fas { font-size: 11px; }

/* ── Search results page ──────────────────────────────────── */
.sr-page-count { color: var(--text-soft); font-size: 14px; margin-bottom: 24px; }
.sr-page-empty { color: var(--text-soft); font-size: 16px; margin-top: 32px; text-align: center; }
.sr-page-item {
  display: block; padding: 16px 20px; border-radius: 10px;
  border: 1.5px solid var(--border); margin-bottom: 12px;
  text-decoration: none; transition: border-color .12s, box-shadow .12s;
}
.sr-page-item:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(115,102,255,.1); text-decoration: none; }
.sr-page-item .sr-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.sr-page-item .sr-meta  { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.sr-page-item .sr-snippet { font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.sr-page-item mark { background: rgba(115,102,255,.15); color: var(--accent); border-radius: 2px; padding: 0 2px; }
html.dark .sr-page-item { border-color: #2a3148; }
html.dark .sr-page-item:hover { border-color: var(--accent); }

/* ── Print button (screen only) ───────────────────────────── */
.print-actions {
  display: flex; justify-content: flex-end; margin-bottom: 20px;
}
.print-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px; font-size: 13px; font-weight: 500;
  font-family: inherit; line-height: 1;
  color: var(--accent); background-color: transparent;
  border: 1.5px solid var(--accent); border-radius: 7px;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.print-btn i { font-size: 12px; }
.print-btn:hover {
  background-color: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: 0 3px 12px rgba(115,102,255,.25);
}
.print-btn:active { transform: translateY(1px); box-shadow: none; }
.print-actions, .print-brand-header, .print-footer { }
.print-brand-header, .print-footer { display: none; }

/* ── Print styles ─────────────────────────────────────────── */
@media print {
  .sidebar, .nav-toggle, .top-bar, .back-to-top, .prev-next, .toc,
  .search, .search-results, .copy-btn, .breadcrumbs, #dark-toggle,
  .oip-bar, .oip-overlay, .print-actions { display: none !important; }
  body { background: #fff; color: #111; font-family: Arial, sans-serif; }
  .content { margin: 0; padding: 0; max-width: 100%; }
  .doc { max-width: 100%; padding: 0; }
  .page-body { display: block; }
  .doc-col { width: 100%; }
  .doc h1 { font-size: 20pt; margin-top: 0; }
  .doc h2 { font-size: 15pt; page-break-after: avoid; border-bottom: 1.5px solid #ccc; padding-bottom: 4px; }
  .doc h3 { font-size: 12pt; page-break-after: avoid; }
  .doc pre, .doc table, .doc blockquote { page-break-inside: avoid; }
  .doc table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .doc th, .doc td { border: 1px solid #ccc; padding: 4px 6px; }
  .doc th { background: #f0f0f0; font-weight: bold; }
  .doc img { max-width: 100%; height: auto; }
  .doc a { color: #333; }
  .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #666; }
  .print-brand-header {
    display: flex !important; justify-content: space-between; align-items: center;
    padding: 10px 0 10px; margin-bottom: 18px;
    border-bottom: 2.5px solid #7366ff;
  }
  .print-brand-logo {
    display: flex; align-items: center; gap: 10px;
  }
  .print-brand-logo svg { width: 32px; height: 32px; }
  .print-brand-name {
    font-size: 13pt; font-weight: 700; color: #7366ff; letter-spacing: -.3px;
  }
  .print-brand-sub {
    font-size: 10pt; color: #555; margin-top: 1px;
  }
  .print-brand-meta {
    text-align: right; font-size: 9pt; color: #666; line-height: 1.6;
  }
  .print-footer {
    display: block !important; margin-top: 32px; padding-top: 10px;
    border-top: 1px solid #ccc; font-size: 8pt; color: #777;
    text-align: center;
  }
  @page {
    margin: 18mm 15mm 18mm 15mm;
    @top-left     { content: none; }
    @top-center   { content: none; }
    @top-right    { content: none; }
    @bottom-left  { content: none; }
    @bottom-center{ content: none; }
    @bottom-right { content: none; }
  }
}
