/* Hướng dẫn CRM Bảo Sơn — stylesheet kiểu help.sapo.vn */
:root {
  --main: #046840;
  --main-dark: #03532f;
  --main-soft: #e6f2ec;
  --text: #212b36;
  --text-2: #637381;
  --border: #e5e8eb;
  --bg: #f7f8fa;
  --warn-bg: #fff7e6;
  --warn-text: #8a5a00;
  --info-bg: #f0f4f8;
  --code-bg: #1e2a33;
  --radius: 10px;
  --header-h: 60px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--main); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: var(--header-h);
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: none;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 8px; cursor: pointer; color: var(--text);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-badge {
  background: var(--main); color: #fff; font-weight: 800; font-size: 13px;
  padding: 5px 9px; border-radius: 8px; letter-spacing: .5px;
}
.brand-name { font-weight: 700; font-size: 16px; color: var(--text); }

.search-wrap { position: relative; margin-left: auto; width: min(420px, 45vw); }
.search-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
#searchBox {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 999px;
  padding: 0 16px 0 36px; font-size: 14px; outline: none; background: var(--bg);
}
#searchBox:focus { border-color: var(--main); background: #fff; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.search-results a {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--main-soft); text-decoration: none; }
.search-results .r-title { font-weight: 600; color: var(--text); }
.search-results .r-meta { font-size: 12px; color: var(--main); }
.search-results .r-ex { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.search-results .r-none { padding: 12px 14px; color: var(--text-2); font-size: 14px; }

/* ---------- Layout ---------- */
.page { display: flex; max-width: 1280px; margin: 0 auto; }
.sidebar {
  width: 288px; flex-shrink: 0;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 8px 40px 12px;
  border-right: 1px solid var(--border);
  background: #fff;
}
.content { flex: 1; min-width: 0; padding: 24px 32px 60px; }

/* ---------- Sidenav ---------- */
.nav-cat { margin-bottom: 4px; }
.nav-cat-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 12px; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--text); border-radius: 8px; text-align: left;
}
.nav-cat-btn:hover { background: var(--bg); }
.nav-cat .chev { transition: transform .18s; color: var(--text-2); }
.nav-cat.open .chev { transform: rotate(90deg); }
.nav-list { display: none; list-style: none; margin: 0; padding: 0 0 6px; }
.nav-cat.open .nav-list { display: block; }
.nav-list a {
  display: block; padding: 7px 12px 7px 24px; font-size: 14px; color: var(--text-2);
  border-left: 2px solid var(--border); margin-left: 14px; border-radius: 0 8px 8px 0;
}
.nav-list a:hover { color: var(--main); text-decoration: none; background: var(--bg); }
.nav-list a.active {
  color: var(--main); font-weight: 600; border-left-color: var(--main); background: var(--main-soft);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 13px; color: var(--text-2); margin-bottom: 14px;
}
.breadcrumb b { color: var(--text); font-weight: 600; }

/* ---------- Article ---------- */
.article {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 36px; max-width: 880px;
}
.article h1 { margin: 0 0 16px; font-size: 26px; line-height: 1.3; }
.article h2 { margin: 28px 0 10px; font-size: 19px; padding-top: 8px; border-top: 1px solid var(--border); }
.article h3 { margin: 20px 0 8px; font-size: 16px; }
.article p { margin: 10px 0; }
.article ul, .article ol { margin: 10px 0; padding-left: 26px; }
.article li { margin: 5px 0; }
.article img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; }
.article code {
  background: var(--info-bg); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  word-break: break-all;
}
.article pre {
  background: var(--code-bg); color: #e8eef2; border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.55;
  position: relative;
}
.article pre code { background: none; border: 0; padding: 0; color: inherit; word-break: normal; }
.article table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.article th { background: var(--bg); font-weight: 600; }
.article tr:nth-child(even) td { background: #fbfcfd; }

/* Callouts */
.callout { border-radius: 8px; padding: 12px 16px; margin: 12px 0; font-size: 14px; }
.callout.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid #f5dfae; }
.callout.info { background: var(--info-bg); color: var(--text); border: 1px solid var(--border); }
.callout.tip  { background: var(--main-soft); color: var(--main-dark); border: 1px solid #bcd9cc; }

/* Nhãn đối tượng: bài dành cho Admin / Đại sứ */
.audience { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px; margin-bottom: 16px; }
.audience.admin { background: #eef2ff; color: #3538cd; border: 1px solid #c7d2fe; }
.audience.affiliate { background: var(--main-soft); color: var(--main-dark); border: 1px solid #bcd9cc; }
.audience.both { background: #f4f4f5; color: #52525b; border: 1px solid var(--border); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #eef2ff; color: #3538cd; border: 1px solid #c7d2fe; vertical-align: middle; }

/* Steps — đánh số to kiểu Sapo */
.article ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
.article ol.steps > li {
  counter-increment: step; position: relative; padding: 4px 0 4px 42px; margin: 8px 0;
}
.article ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 4px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--main-soft); color: var(--main); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Prev/Next ---------- */
.prevnext { display: flex; justify-content: space-between; gap: 12px; max-width: 880px; margin-top: 18px; }
.pn {
  flex: 1; max-width: 48%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 2px;
}
.pn:hover { border-color: var(--main); text-decoration: none; }
.pn span { font-size: 12px; color: var(--text-2); }
.pn b { color: var(--text); font-size: 14px; }
.pn.next { text-align: right; margin-left: auto; }

/* ---------- Home ---------- */
.home-lead { font-size: 16px; color: var(--text-2); max-width: 760px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 18px; }
.home-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.home-card h2 { margin: 0 0 8px; font-size: 16px; border: 0; padding: 0; color: var(--main); }
.home-card ul { list-style: none; margin: 0; padding: 0; }
.home-card li { margin: 6px 0; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 880px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .brand-name { display: none; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s; width: 290px;
    box-shadow: 4px 0 24px rgba(0,0,0,.08);
  }
  .sidebar.show { transform: translateX(0); }
  .content { padding: 18px 14px 50px; }
  .article { padding: 20px 18px; }
  .prevnext { flex-direction: column; }
  .pn { max-width: 100%; }
}
