/* HQ-46: trang Hướng dẫn (#/huong-dan). Tiền tố gd-. Nội dung chương (registry window.GuideSections) dùng thẻ thường + các lớp gd-* bên dưới. */
.gd-page { max-width: 1240px; }
.gd-intro { margin: -8px 0 14px; }
.gd-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.gd-tools input[type=search] { flex: 1 1 320px; max-width: 520px; }
.gd-mine { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.gd-count { font-size: 12px; }
.gd-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 22px; align-items: start; }
.gd-toc { position: sticky; top: 0; max-height: calc(100vh - 110px); overflow-y: auto; padding: 4px 6px 12px 0; font-size: 13px; }
.gd-toc-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 14px 8px 4px; }
.gd-toc-group:first-child { margin-top: 2px; }
.gd-toc a { display: block; padding: 5px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; line-height: 1.35; }
.gd-toc a:hover { background: var(--hover); }
.gd-toc a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
:root[data-theme="dark"] .gd-toc a.active { color: var(--accent-text); }
.gd-toc-select { display: none; width: 100%; margin-bottom: 12px; }
.gd-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 6px 2px 8px; }
.gd-group + .gd-group { margin-top: 18px; }
.gd-sec { margin-bottom: 16px; scroll-margin-top: 12px; padding: 20px 24px; }
.gd-sec h2 { font-size: 20px; margin: 0 0 10px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 8px; }
.gd-anchor { color: var(--muted) !important; text-decoration: none; font-weight: 400; opacity: .55; }
.gd-anchor:hover { opacity: 1; }
.gd-placeholder { border-style: dashed; box-shadow: none; }
.gd-top { margin: 14px 0 0; font-size: 12px; text-align: right; }
.gd-top a { color: var(--muted); }

/* ---- Nội dung chương ---- */
.gd-body { max-width: 860px; line-height: 1.62; overflow-wrap: anywhere; }
.gd-body h3 { font-size: 16px; margin: 20px 0 8px; }
.gd-body h4 { font-size: 14px; margin: 14px 0 6px; }
.gd-body p { margin: 0 0 10px; }
.gd-body ol, .gd-body ul { margin: 0 0 12px; padding-left: 22px; }
.gd-body li { margin: 3px 0; }
.gd-body li > ul, .gd-body li > ol { margin: 4px 0; }
.gd-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.gd-body kbd { font-family: inherit; font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--btn-border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
.gd-body .badge { vertical-align: 1px; }
.gd-body .badge.warn { background: var(--warn-soft); color: var(--warn); }
.gd-body .badge.err { background: var(--err-soft); color: var(--err); }
.gd-body .badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.gd-body table.table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 13px; display: block; overflow-x: auto; }
.gd-body table.table th, .gd-body table.table td { text-align: left; padding: 7px 10px; border: 1px solid var(--line); vertical-align: top; }
.gd-body table.table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.gd-who { background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; }
.gd-btn { display: inline-block; font-size: 12.5px; font-weight: 600; line-height: 1.5; padding: 0 8px; border: 1px solid var(--btn-border); border-radius: 7px; background: var(--surface); white-space: nowrap; }
.gd-path { font-weight: 600; color: var(--brand-dark); }
:root[data-theme="dark"] .gd-path { color: var(--accent-text); }
.gd-tip, .gd-warn { border-radius: 10px; padding: 9px 12px; margin: 8px 0 12px; border-left: 4px solid; }
.gd-tip { background: var(--accent-soft); border-color: var(--accent); }
.gd-warn { background: var(--warn-soft); border-color: var(--warn); }
.gd-tip > :last-child, .gd-warn > :last-child, .gd-who:last-child { margin-bottom: 0; }
.gd-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 8px 0 12px; }
.gd-flow > span { position: relative; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.gd-flow > span:not(:last-child)::after { content: "→"; position: absolute; right: -16px; color: var(--muted); font-weight: 400; }
.gd-flow > span:not(:last-child) { margin-right: 18px; }
.gd-fig { margin: 10px 0 16px; }
.gd-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); cursor: zoom-in; background: var(--surface-2); }
.gd-fig figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Sơ đồ mô hình (chương Mô hình) */
.gd-model { display: grid; gap: 10px; margin: 10px 0 16px; }
.gd-model-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px 6px; }
.gd-node { flex: 1 1 130px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--surface); font-size: 13px; position: relative; }
.gd-node b { display: block; font-size: 13.5px; }
.gd-node small { color: var(--muted); display: block; line-height: 1.35; margin-top: 2px; }
.gd-node.center { border-color: var(--brand); background: var(--brand-soft); }
.gd-node.money-in { border-color: var(--accent); }
.gd-node.money-out { border-color: var(--warn); }
.gd-arrow { align-self: center; color: var(--muted); font-size: 16px; flex: none; }
.gd-model-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }

@media (max-width: 960px) { .gd-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 16px; } }
@media (max-width: 760px) {
  .gd-layout { display: block; }
  .gd-toc { display: none; }
  .gd-toc-select { display: block; position: sticky; top: 64px; z-index: 4; box-shadow: var(--shadow); }
  .gd-sec { padding: 16px; scroll-margin-top: 120px; }
  .gd-sec h2 { font-size: 18px; }
  .gd-tools input[type=search] { flex-basis: 100%; max-width: none; }
  .gd-arrow { transform: rotate(90deg); align-self: center; line-height: 1; }
  .gd-model-row { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
  .gd-node { flex-basis: auto; }
}

/* ---- In / Lưu PDF: chỉ nội dung hướng dẫn, nền trắng ---- */
@media print {
  :root, :root[data-theme="dark"] { --ink: #141A2E; --muted: #5A6382; --line: #E1E5EF; --surface: #fff; --surface-2: #F4F6FB; --brand-soft: #ECECFF; --brand-dark: #4545B5;
    --accent-soft: #E4F7F4; --accent-text: #087369; --warn-soft: #FEF6E7; --btn-border: #C8CEDD; color-scheme: light; }
  .gd-page ~ *, .topbar, .sidenav, .gd-tools, .gd-toc, .gd-toc-select, .gd-print, .gd-anchor, .gd-top, #toasts { display: none !important; }
  .gd-page .gd-head { display: flex !important; }
  html, body, #app, .layout, .main { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; background: #fff !important; }
  .main > * { animation: none !important; }
  .gd-page { max-width: none; color: #000; }
  .gd-layout { display: block; }
  .gd-sec { box-shadow: none; border: 0; padding: 0; margin: 0 0 18px; background: #fff; break-before: page; }
  .gd-group:first-child .gd-sec:first-of-type { break-before: auto; }
  .gd-sec h2 { break-after: avoid; }
  .gd-fig, .gd-body table.table, .gd-model { break-inside: avoid; }
  .gd-fig img { box-shadow: none; max-height: 120mm; width: auto; }
  .gd-body a { color: inherit; text-decoration: none; }
  @page { margin: 14mm; }
}

/* Nút "?" trên thanh trên cùng (app.js) — luôn hiện, kể cả màn hẹp */
.topbar .tb-help { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; font-weight: 700; text-decoration: none; color: var(--ink); }
:root[data-theme="dark"] .topbar .tb-help { color: var(--ink); }
