/* ==========================================================================
   BC Ai Account — Reference Manual Stylesheet (/assets/reference-docs.css)
   - Faithful original global.css table density, colors & warehouse chips
   - Full-width 100% layout + collapsible & drag-resizable left sidebar
   - Strictly scoped under .bc-ref-* (zero clash with site styles.css)
   - Light & Dark mode via html[data-theme="dark"]
   ========================================================================== */

.bc-ref-page {
  --ref-bg: #f6f8f7;
  --ref-card: #ffffff;
  --ref-muted-bg: #f0f5f2;
  --ref-text: #14221b;
  --ref-text-muted: #4b6155;
  --ref-border: #d5e2da;
  --ref-primary: #0f766e;
  --ref-primary-soft: #e6f4f1;
  --ref-warn-bg: #fffbeb;
  --ref-warn-border: #f59e0b;
  --ref-warn-text: #92400e;
  --ref-bad-bg: #fef2f2;
  --ref-bad-border: #ef4444;
  --ref-bad-text: #991b1b;
  --ref-ok-bg: #ecfdf5;
  --ref-ok-border: #10b981;
  --ref-ok-text: #065f46;
  --ref-radius: 8px;
  --ref-sidebar-w: 252px;
  --ref-doc-scale: 1;
}

html[data-theme="dark"] .bc-ref-page {
  --ref-bg: #0d1512;
  --ref-card: #15211c;
  --ref-muted-bg: #1b2b24;
  --ref-text: #e6f2ec;
  --ref-text-muted: #9eb5a8;
  --ref-border: #2a3e34;
  --ref-primary: #2dd4bf;
  --ref-primary-soft: rgba(45, 212, 191, 0.14);
  --ref-warn-bg: rgba(245, 158, 11, 0.12);
  --ref-warn-border: #d97706;
  --ref-warn-text: #fcd34d;
  --ref-bad-bg: rgba(239, 68, 68, 0.12);
  --ref-bad-border: #f87171;
  --ref-bad-text: #fca5a5;
  --ref-ok-bg: rgba(16, 185, 129, 0.12);
  --ref-ok-border: #34d399;
  --ref-ok-text: #6ee7b7;
}

/* Keep Reference Manual top clean (prevent manual-chat hub card from shifting grid or crowding tables) */
.bc-ref-page--docs #main > .bc-manual-lux-hub {
  display: none !important;
}

.bc-ref-page--docs {
  background: var(--ref-bg);
}

/* Keep full-width header single-row on reference docs and keep right-edge table numbers readable */
.bc-ref-page--docs .site-header .nav {
  max-width: 100% !important;
  padding-inline: 14px;
}

.bc-ref-page--docs .bc-quick-dock {
  opacity: 0.25;
  transition: opacity 0.16s ease;
}
.bc-ref-page--docs .bc-quick-dock:hover,
.bc-ref-page--docs .bc-quick-dock:focus-within {
  opacity: 1;
}

/* Manual Mode Switcher Bar (shared on /manual and /manual/reference) */
.bc-manual-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  padding: 0.65rem 0.95rem;
  margin: 0 0 1rem;
  border-radius: 12px;
  border: 1px solid var(--line, #d8e1e5);
  background: var(--soft, #f2f6f7);
}

.bc-manual-switcher__tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.bc-manual-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line, #d8e1e5);
  background: var(--paper, #fbfcfc);
  color: var(--ink, #172633);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.bc-manual-tab:hover {
  border-color: var(--cyan, #198fbd);
  color: var(--cyan-dark, #0d6f99);
}

.bc-manual-tab[aria-current="page"],
.bc-manual-tab.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

.bc-manual-switcher__meta {
  font-size: 0.8rem;
  color: var(--muted, #52636f);
  line-height: 1.35;
}

html[data-theme="dark"] .bc-manual-switcher {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
}
html[data-theme="dark"] .bc-manual-tab {
  background: rgba(15, 29, 43, 0.9);
  border-color: rgba(255, 255, 255, 0.16);
  color: #e6f0f6;
}
html[data-theme="dark"] .bc-manual-tab[aria-current="page"],
html[data-theme="dark"] .bc-manual-tab.is-active {
  background: #0f766e;
  border-color: #2dd4bf;
  color: #ffffff;
}
html[data-theme="dark"] .bc-manual-switcher__meta {
  color: #9eb5c2;
}

/* ==========================================================================
   Full-Width 2-Column Reference Shell (Inside <main>, never directly on <main>)
   Left: Collapsible & Drag-Resizable Sidebar | Right: Full-Width Reference Doc
   ========================================================================== */
.bc-ref-shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 10px 14px 32px;
  display: grid;
  grid-template-columns: var(--ref-sidebar-w, 252px) 10px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.bc-ref-shell[data-width="boxed"] {
  max-width: 1060px;
}

.bc-ref-shell[data-sidebar="collapsed"] {
  grid-template-columns: minmax(0, 1fr);
}

.bc-ref-shell[data-sidebar="collapsed"] .bc-ref-sidebar,
.bc-ref-shell[data-sidebar="collapsed"] .bc-ref-resizer {
  display: none;
}

/* Drag-to-resize splitter between sidebar and main content */
.bc-ref-resizer {
  position: sticky;
  top: var(--ref-sticky-top, 76px);
  height: calc(100vh - var(--ref-sticky-top, 76px) - 16px);
  width: 10px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.bc-ref-resizer::after {
  content: "";
  width: 3px;
  height: 44px;
  border-radius: 999px;
  background: var(--ref-border);
  transition: background 0.15s ease, height 0.15s ease;
}

.bc-ref-resizer:hover::after,
.bc-ref-shell.is-resizing .bc-ref-resizer::after {
  background: var(--ref-primary);
  height: 72px;
}

.bc-ref-shell.is-resizing {
  user-select: none;
  cursor: col-resize;
}

@media (max-width: 960px) {
  .bc-ref-shell,
  .bc-ref-shell[data-width="boxed"] {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 10px 24px;
    gap: 10px;
  }
  .bc-ref-resizer {
    display: none !important;
  }
  .bc-ref-shell[data-sidebar="collapsed"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Sticky Left Reference Sidebar */
.bc-ref-sidebar {
  position: sticky;
  top: var(--ref-sticky-top, 76px);
  max-height: calc(100vh - var(--ref-sticky-top, 76px) - 14px);
  overflow-y: auto;
  background: var(--ref-card);
  border: 1px solid var(--ref-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  min-width: 0;
}

@media (max-width: 960px) {
  .bc-ref-sidebar {
    position: static;
    max-height: none;
  }
}

.bc-ref-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.bc-ref-sidebar__group + .bc-ref-sidebar__group {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--ref-border);
}

.bc-ref-sidebar__title {
  margin: 0 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ref-primary);
}

.bc-ref-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.bc-ref-nav a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--ref-text);
  text-decoration: none;
  line-height: 1.35;
  font-size: 12.5px;
  transition: background 0.14s ease, color 0.14s ease;
}

.bc-ref-nav a:hover {
  background: var(--ref-primary-soft);
  color: var(--ref-primary);
}

.bc-ref-nav a[aria-current="page"] {
  background: var(--ref-primary-soft);
  color: var(--ref-primary);
  font-weight: 700;
  border-left: 3px solid var(--ref-primary);
}

.bc-ref-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.bc-ref-toc-list a {
  display: block;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--ref-text-muted);
  text-decoration: none;
  font-size: 11.5px;
  line-height: 1.35;
}

.bc-ref-toc-list a:hover {
  background: var(--ref-muted-bg);
  color: var(--ref-primary);
}

.bc-ref-toc-list .toc-h2 > a {
  font-weight: 700;
  color: var(--ref-text);
  margin-top: 3px;
}

.bc-ref-toc-list .toc-h3 > a {
  padding-left: 12px;
}

/* Main Content Pane */
.bc-ref-main {
  min-width: 0;
  width: 100%;
  padding-left: 4px;
}

.bc-ref-shell[data-sidebar="collapsed"] .bc-ref-main {
  padding-left: 0;
}

/* Top Sticky Baseline-Aligned Reference Toolbar */
.bc-ref-toolbar {
  position: sticky;
  top: var(--ref-sticky-top, 76px);
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 7px 11px;
  margin: 0 0 8px;
  border-radius: 10px;
  border: 1px solid var(--ref-border);
  background: var(--ref-card);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.bc-ref-toolbar__left,
.bc-ref-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bc-ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 10px;
  border-radius: 7px;
  border: 1px solid var(--ref-border);
  background: var(--ref-muted-bg);
  color: var(--ref-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.bc-ref-btn:hover {
  border-color: var(--ref-primary);
  color: var(--ref-primary);
  background: var(--ref-primary-soft);
}

.bc-ref-btn[aria-pressed="true"],
.bc-ref-btn.is-active {
  background: var(--ref-primary);
  border-color: var(--ref-primary);
  color: #ffffff;
}

html[data-theme="dark"] .bc-ref-btn[aria-pressed="true"],
html[data-theme="dark"] .bc-ref-btn.is-active {
  color: #081512;
}

.bc-ref-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.bc-ref-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--ref-text-muted);
}

.bc-ref-breadcrumbs a {
  color: var(--ref-primary);
  text-decoration: none;
}
.bc-ref-breadcrumbs a:hover {
  text-decoration: underline;
}

/* Compact Direct Answer on Reference Pages */
.bc-ref-page--docs .bc-direct-answer {
  padding: 10px 14px;
  margin: 0 0 8px;
  border-radius: 10px;
}
.bc-ref-page--docs .bc-direct-answer__eyebrow {
  font-size: 10.5px;
  margin-bottom: 3px;
}
.bc-ref-page--docs .bc-direct-answer p {
  font-size: 12.5px;
  line-height: 1.5;
}

/* Hub Index Cards (/manual/reference) */
.bc-ref-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin: 14px 0 20px;
}

.bc-ref-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ref-card);
  border: 1px solid var(--ref-border);
  border-top: 4px solid var(--ref-primary);
  border-radius: 12px;
  padding: 16px 18px;
}

.bc-ref-card__badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--ref-primary-soft);
  color: var(--ref-primary);
}

.bc-ref-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ref-text);
}

.bc-ref-card h2 a {
  color: inherit;
  text-decoration: none;
}
.bc-ref-card h2 a:hover {
  color: var(--ref-primary);
}

.bc-ref-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ref-text-muted);
}

.bc-ref-card__topics {
  margin: 2px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ref-text);
}

.bc-ref-card__actions {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   Faithful Original global.css Technical Reference Content (.bc-ref-doc)
   Matches d:\bcaiaccount\docs\global.css density, typography & color coding
   ========================================================================== */
.bc-ref-doc {
  --text: var(--ref-text);
  --text-muted: var(--ref-text-muted);
  --border: var(--ref-border);
  --primary: var(--ref-primary);
  --card: var(--ref-card);
  --muted-bg: var(--ref-muted-bg);
  font-family: "Sarabun", "Anuphan", "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
  font-size: calc(11.5px * var(--ref-doc-scale, 1));
  line-height: 1.45;
  color: var(--ref-text);
  width: 100%;
  min-width: 0;
}

.bc-ref-doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--ref-muted-bg);
  border: 1px solid var(--ref-border);
  color: var(--ref-text);
}

.bc-ref-doc .ref-doc-header {
  background: var(--ref-card);
  border: 1px solid var(--ref-border);
  border-top: 4px solid var(--ref-primary);
  border-radius: var(--ref-radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.bc-ref-page .bc-ref-doc .ref-doc-header h1 {
  margin: 0 0 4px !important;
  font-family: inherit !important;
  font-size: calc(17px * var(--ref-doc-scale, 1)) !important;
  line-height: 1.28 !important;
  color: var(--ref-text);
}

.bc-ref-doc .ref-doc-header p {
  margin: 0;
  color: var(--ref-text-muted);
}

.bc-ref-doc .ref-doc-header ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.bc-ref-doc > section {
  background: var(--ref-card);
  border: 1px solid var(--ref-border);
  border-radius: var(--ref-radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.bc-ref-page .bc-ref-doc > section > h2 {
  margin: 0 0 8px !important;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ref-border);
  font-family: inherit !important;
  font-size: calc(14px * var(--ref-doc-scale, 1)) !important;
  line-height: 1.32 !important;
  color: var(--ref-primary);
  scroll-margin-top: 84px;
}

.bc-ref-page .bc-ref-doc h3 {
  margin: 8px 0 4px !important;
  font-family: inherit !important;
  font-size: calc(12.25px * var(--ref-doc-scale, 1)) !important;
  line-height: 1.35 !important;
  color: var(--ref-text);
  scroll-margin-top: 84px;
}

.bc-ref-doc p {
  margin: 0 0 5px;
}

.bc-ref-doc ul,
.bc-ref-doc ol {
  margin: 0 0 6px;
  padding-left: 18px;
}

.bc-ref-doc li + li {
  margin-top: 2px;
}

.bc-ref-doc .grid-1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.bc-ref-doc .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 780px) {
  .bc-ref-doc .grid-2 {
    grid-template-columns: 1fr;
  }
}

.bc-ref-doc article {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  background: var(--ref-muted-bg);
  border: 1px solid var(--ref-border);
  border-radius: var(--ref-radius);
  padding: 8px 10px;
}

.bc-ref-doc article h3 {
  margin-top: 0 !important;
}

/* Callouts */
.bc-ref-doc aside {
  border: 1px solid var(--ref-border);
  border-left: 4px solid var(--ref-primary);
  background: var(--ref-muted-bg);
  border-radius: var(--ref-radius);
  padding: 7px 10px;
  margin: 6px 0;
}

.bc-ref-doc aside strong {
  display: block;
  margin-bottom: 2px;
}

.bc-ref-doc aside.warn {
  background: var(--ref-warn-bg);
  border-color: var(--ref-warn-border);
  color: var(--ref-warn-text);
}

.bc-ref-doc aside.bad {
  background: var(--ref-bad-bg);
  border-color: var(--ref-bad-border);
  color: var(--ref-bad-text);
}

.bc-ref-doc aside.ok {
  background: var(--ref-ok-bg);
  border-color: var(--ref-ok-border);
  color: var(--ref-ok-text);
}

/* Original High-Density Tables (immune to global styles.css main table rules) */
.bc-ref-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 5px 0 7px;
}

.bc-ref-page .bc-ref-doc table {
  display: table !important;
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: calc(10.5px * var(--ref-doc-scale, 1));
  line-height: 1.35;
  background: var(--ref-card);
}

.bc-ref-page .bc-ref-doc th,
.bc-ref-page .bc-ref-doc td {
  min-width: 0 !important;
  border: 1px solid var(--ref-border);
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.bc-ref-page .bc-ref-doc th {
  background: var(--ref-card);
  font-weight: 700;
  white-space: normal;
  line-height: 1.25;
  color: var(--ref-text);
}

.bc-ref-doc .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bc-ref-doc td.center,
.bc-ref-doc .center {
  text-align: center;
  white-space: nowrap;
}

.bc-ref-doc th.num,
.bc-ref-doc th.center {
  white-space: normal;
}

/* Stacked Multi-Warehouse & Location Balance Cell (exact original global.css) */
.bc-ref-doc td.bal-cell {
  text-align: right;
  vertical-align: middle;
  white-space: normal;
  min-width: 0 !important;
  padding: 4px 5px;
}

.bc-ref-doc .bal-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  font-size: calc(13px * var(--ref-doc-scale, 1));
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ref-text);
  margin-bottom: 4px;
}

.bc-ref-doc .bal-pack {
  font-size: calc(9.75px * var(--ref-doc-scale, 1));
  font-weight: 700;
  color: var(--ref-primary);
  margin-top: -2px;
  margin-bottom: 4px;
}

.bc-ref-doc .bal-pack.is-neg {
  color: var(--ref-bad-text);
}

.bc-ref-doc .bal-total.is-zero {
  color: var(--ref-text-muted);
}

.bc-ref-doc .bal-delta {
  font-size: calc(9.5px * var(--ref-doc-scale, 1));
  font-weight: 800;
  padding: 0 4px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.bc-ref-doc .bal-delta.in {
  background: var(--ref-ok-bg);
  color: var(--ref-ok-text);
  border: 1px solid var(--ref-ok-border);
}

.bc-ref-doc .bal-delta.out {
  background: var(--ref-bad-bg);
  color: var(--ref-bad-text);
  border: 1px solid var(--ref-bad-border);
}

.bc-ref-doc .bal-delta.adj {
  background: var(--ref-warn-bg);
  color: var(--ref-warn-text);
  border: 1px solid var(--ref-warn-border);
}

.bc-ref-doc .bal-breakdown {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 4px;
  border-top: 1px dashed var(--ref-border);
}

.bc-ref-doc .bal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: calc(9px * var(--ref-doc-scale, 1));
  line-height: 1.2;
}

.bc-ref-doc .bal-lbl {
  color: var(--ref-text-muted);
  font-weight: 700;
  margin-right: 1px;
}

.bc-ref-doc .bal-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--ref-border);
  background: var(--ref-card);
  color: var(--ref-text-muted);
  opacity: 0.65;
  white-space: nowrap;
}

.bc-ref-doc .bal-chip.loc {
  background: var(--ref-muted-bg);
}

.bc-ref-doc .bal-chip.is-zero {
  opacity: 0.48;
}

.bc-ref-doc .bal-chip.is-neg {
  background: var(--ref-bad-bg);
  border-color: var(--ref-bad-border);
  color: var(--ref-bad-text);
  font-weight: 800;
  opacity: 1;
}

.bc-ref-doc .bal-chip.is-hit-in {
  opacity: 1;
  background: var(--ref-ok-bg);
  border: 1.5px solid var(--ref-ok-border);
  color: var(--ref-ok-text);
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.16);
}

.bc-ref-doc .bal-chip.is-hit-out {
  opacity: 1;
  background: var(--ref-bad-bg);
  border: 1.5px solid var(--ref-bad-border);
  color: var(--ref-bad-text);
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16);
}

.bc-ref-doc .bal-chip.is-hit-avg {
  opacity: 1;
  background: var(--ref-warn-bg);
  border: 1.5px solid var(--ref-warn-border);
  color: var(--ref-warn-text);
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.16);
}

.bc-ref-doc .bal-chip .chg {
  font-size: calc(9px * var(--ref-doc-scale, 1));
  font-weight: 800;
}

.bc-ref-doc td.cost strong {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--ref-warn-bg);
  color: var(--ref-warn-text);
  border: 1px solid var(--ref-warn-border);
}

.bc-ref-doc tr.sub-wh td,
.bc-ref-doc tr.sub-wh th {
  background: var(--ref-primary-soft) !important;
  color: var(--ref-primary);
  font-weight: 700;
  border-top: 1.5px solid var(--ref-border);
}

.bc-ref-doc tfoot th,
.bc-ref-doc tfoot td {
  background: var(--ref-card) !important;
  font-weight: 800;
  border-top: 2px solid var(--ref-primary);
}

/* Semantic Movement & Cost Colors (exact original global.css) */
.bc-ref-doc tr.row-in td { background: #eff6ff; }
.bc-ref-doc tr.row-out td { background: #fef2f2; }
.bc-ref-doc tr.row-adj td { background: #f5f3ff; }
.bc-ref-doc tr.row-trf td { background: #f0fdfa; }

.bc-ref-doc td.in, .bc-ref-doc .in { color: #1e3a8a; font-weight: 700; }
.bc-ref-doc td.out, .bc-ref-doc .out { color: #b91c1c; font-weight: 700; }
.bc-ref-doc td.cost, .bc-ref-doc .cost { color: #047857; background: #ecfdf5 !important; font-weight: 700; }
.bc-ref-doc td.neg, .bc-ref-doc .neg { color: #dc2626; background: #fee2e2 !important; font-weight: 800; }
.bc-ref-doc td.pl, .bc-ref-doc .pl { color: #b45309; background: #fef3c7 !important; font-weight: 800; }
.bc-ref-doc td.adj, .bc-ref-doc .adj { color: #6d28d9; font-weight: 700; }
.bc-ref-doc td.trf, .bc-ref-doc .trf { color: #0f766e; font-weight: 700; }

html[data-theme="dark"] .bc-ref-doc tr.row-in td { background: rgba(37, 99, 235, 0.14); }
html[data-theme="dark"] .bc-ref-doc tr.row-out td { background: rgba(220, 38, 38, 0.14); }
html[data-theme="dark"] .bc-ref-doc tr.row-adj td { background: rgba(124, 58, 237, 0.15); }
html[data-theme="dark"] .bc-ref-doc tr.row-trf td { background: rgba(15, 118, 110, 0.16); }
html[data-theme="dark"] .bc-ref-doc td.in, html[data-theme="dark"] .bc-ref-doc .in { color: #93c5fd; }
html[data-theme="dark"] .bc-ref-doc td.out, html[data-theme="dark"] .bc-ref-doc .out { color: #fca5a5; }
html[data-theme="dark"] .bc-ref-doc td.cost, html[data-theme="dark"] .bc-ref-doc .cost { color: #6ee7b7; background: rgba(16, 185, 129, 0.18) !important; }
html[data-theme="dark"] .bc-ref-doc td.neg, html[data-theme="dark"] .bc-ref-doc .neg { color: #fecaca; background: rgba(239, 68, 68, 0.28) !important; }
html[data-theme="dark"] .bc-ref-doc td.pl, html[data-theme="dark"] .bc-ref-doc .pl { color: #fde68a; background: rgba(245, 158, 11, 0.24) !important; }
html[data-theme="dark"] .bc-ref-doc td.adj, html[data-theme="dark"] .bc-ref-doc .adj { color: #c4b5fd; }
html[data-theme="dark"] .bc-ref-doc td.trf, html[data-theme="dark"] .bc-ref-doc .trf { color: #5eead4; }

.bc-ref-doc td.yes,
.bc-ref-doc td.no {
  font-size: 0;
  line-height: 0;
  vertical-align: middle;
}

.bc-ref-doc td.yes::before,
.bc-ref-doc td.no::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.bc-ref-doc td.yes::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23dcfce7' stroke='%2316a34a' stroke-width='2'/%3E%3Cpath d='M7.5 12.5l3 3 6-6.5' fill='none' stroke='%2315803d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.bc-ref-doc td.no::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23fee2e2' stroke='%23dc2626' stroke-width='2'/%3E%3Cpath d='M8.5 8.5l7 7M15.5 8.5l-7 7' fill='none' stroke='%23b91c1c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Flow & Result Pills */
.bc-ref-doc .flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 5px 0;
}

.bc-ref-doc .flow span {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ref-card);
  border: 1px solid var(--ref-border);
  font-weight: 700;
}

.bc-ref-doc .result {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--ref-primary-soft);
  border: 1px solid var(--ref-primary);
  color: var(--ref-primary);
  font-weight: 700;
  margin-top: 3px;
}

/* Bottom prev/next nav */
.bc-ref-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--ref-border);
}

.bc-ref-pager a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid var(--ref-border);
  background: var(--ref-card);
  color: var(--ref-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.bc-ref-pager a:hover {
  border-color: var(--ref-primary);
  background: var(--ref-primary-soft);
}

/* Sidebar collapsible TOC summary */
.bc-ref-sidebar details.bc-ref-toc-details {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}
.bc-ref-sidebar details.bc-ref-toc-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 0 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ref-primary);
}
.bc-ref-sidebar details.bc-ref-toc-details > summary::before {
  display: none;
}

@media print {
  .bc-ref-sidebar,
  .bc-ref-resizer,
  .bc-ref-toolbar,
  .bc-manual-switcher,
  .bc-ref-pager {
    display: none !important;
  }
  .bc-ref-shell {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 0;
  }
}
