/* Trang hướng dẫn (/Docs/GuideLine) — độc lập với theme AdminSite để mở được khi chưa đăng nhập.
   Bố cục: thanh trên + mục lục trái cố định (≥ 1024 px) / mục lục gập (điện thoại) + một cột đọc. */
:root {
  --bg: #f5f7f6; --surface: #ffffff; --fg: #1d2623; --muted: #5b6a65; --line: #dde3e0;
  --brand: #24695c; --brand-soft: #e4f0ec; --accent: #d9822b;
  --tip-bg: #fff7e8; --tip-line: #f0c27a; --ok-bg: #e8f5ee; --ok-line: #7cc59c; --warn-bg: #fdeceb; --warn-line: #ee9a92;
  --same-bg: #e3f2ea; --same-fg: #1d6b43; --better-bg: #e2ecfb; --better-fg: #1f4f9a;
  --diff-bg: #fbf0dc; --diff-fg: #8a5a07; --missing-bg: #fbe4e2; --missing-fg: #9b2c22;
  --unknown-bg: #eceeed; --unknown-fg: #4f5955; --code-bg: #eef1ef;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; line-height: 1.65; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

/* Thanh trên */
.doc-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--brand); color: #fff; }
.doc-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.doc-brand img { background: #fff; border-radius: 6px; padding: 2px; }
.doc-top-link { color: #fff; font-weight: 600; font-size: 14px; border: 1px solid rgba(255,255,255,.6); border-radius: 999px; padding: 4px 14px; text-decoration: none; white-space: nowrap; }
.doc-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 16px; }

/* Trang danh sách */
.doc-home { max-width: 860px; margin: 0 auto; padding: 32px 16px; }
.doc-home h1, .doc-hero h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; margin: 0 0 10px; text-wrap: balance; }
.doc-lead { color: var(--muted); font-size: 17px; max-width: 70ch; margin: 0 0 20px; }
.doc-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.doc-module { display: flex; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--fg); text-decoration: none; }
a.doc-module:hover { border-color: var(--brand); }
.doc-module-icon { flex: 0 0 44px; height: 44px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; }
.doc-module-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.doc-module-body strong { font-size: 18px; }
.doc-module-body span { color: var(--muted); font-size: 14.5px; }
.doc-module-soon { opacity: .6; }
.doc-btn { display: inline-block; background: var(--brand); color: #fff; padding: 9px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; }

/* Khung đọc: mục lục trái + nội dung */
.doc-shell { display: grid; grid-template-columns: 1fr; max-width: 1280px; margin: 0 auto; }
.doc-side { display: none; }
.doc-main { min-width: 0; padding: 24px 16px 40px; }
@media (min-width: 1024px) {
  .doc-shell { grid-template-columns: 290px minmax(0, 1fr); gap: 8px; }
  .doc-side { display: block; position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 24px 8px 24px 20px; border-right: 1px solid var(--line); }
  .doc-main { padding: 28px 40px 48px; }
  .doc-toc-mobile { display: none; }
}
.doc-toc { display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; }
.doc-toc a { text-decoration: none; color: var(--fg); padding: 4px 10px; border-radius: 6px; }
.doc-toc a:hover { background: var(--brand-soft); }
.doc-toc .doc-toc-part { font-weight: 700; color: var(--brand); margin-top: 12px; }
.doc-toc .doc-toc-part:first-child { margin-top: 0; }
.doc-toc .doc-toc-article { padding-left: 22px; color: var(--muted); }
.doc-back { display: inline-block; margin-bottom: 14px; font-weight: 600; text-decoration: none; }
.doc-toc-mobile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 20px; }
.doc-toc-mobile summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: var(--brand); }
.doc-toc-mobile .doc-toc { padding: 0 8px 12px; max-height: 60vh; overflow-y: auto; }

.doc-hero { margin-bottom: 18px; }
.doc-compare-link a { font-weight: 600; }
.doc-roles { margin: 8px 0 32px; }
.doc-roles-title { font-size: 18px; margin: 0 0 10px; }
.doc-role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.doc-role { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--fg); }
.doc-role:hover { border-color: var(--brand); }
.doc-role span { color: var(--muted); font-size: 14px; }

/* Phần + bài */
.doc-part { margin-top: 40px; }
.doc-part-head { border-bottom: 3px solid var(--brand); padding-bottom: 10px; margin-bottom: 8px; }
.doc-part-head h2 { font-size: clamp(22px, 4vw, 28px); line-height: 1.25; margin: 0 0 4px; text-wrap: balance; }
.doc-part-for { margin: 0; font-weight: 600; color: var(--brand); }
.doc-part-updated { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.doc-article { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 18px; margin-top: 18px; }
@media (min-width: 720px) { .doc-article { padding: 24px 28px; } }
.doc-article h3 { font-size: 21px; line-height: 1.3; margin: 0 0 6px; text-wrap: balance; }
.doc-article h4 { font-size: 17px; margin: 22px 0 6px; }
.doc-article p, .doc-article li { max-width: 72ch; }
.doc-article > p.doc-what { margin: 0 0 12px; font-size: 16.5px; }
.doc-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; padding: 10px 14px; background: var(--brand-soft); border-radius: 8px; font-size: 15px; }
.doc-meta dt { font-weight: 700; color: var(--brand); }
.doc-meta dd { margin: 0; min-width: 0; }
@media (max-width: 480px) { .doc-meta { grid-template-columns: 1fr; } .doc-meta dd { margin-bottom: 6px; } }
.doc-steps { counter-reset: step; list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.doc-steps > li { counter-increment: step; position: relative; padding-left: 42px; min-height: 30px; }
.doc-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 15px; display: grid; place-items: center; }
.doc-ui { font-weight: 700; background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; overflow-wrap: anywhere; }
.doc-shot { margin: 14px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.doc-shot a { display: block; max-width: 100%; }
.doc-shot img { display: block; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px rgba(20,40,35,.08); background: var(--surface); }
.doc-shot.is-phone img { max-width: min(100%, 340px); }
.doc-shot.is-desktop img { width: 100%; }
.doc-shot figcaption { font-size: 14px; color: var(--muted); }
.doc-shots { display: flex; flex-wrap: wrap; gap: 16px; }
.doc-shots .doc-shot { flex: 1 1 260px; min-width: 0; }
.doc-result, .doc-tip, .doc-warn { border-left: 4px solid; border-radius: 8px; padding: 10px 14px; margin: 14px 0 0; }
.doc-result { background: var(--ok-bg); border-color: var(--ok-line); }
.doc-tip { background: var(--tip-bg); border-color: var(--tip-line); }
.doc-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.doc-result > :first-child, .doc-tip > :first-child, .doc-warn > :first-child { margin-top: 0; }
.doc-result > :last-child, .doc-tip > :last-child, .doc-warn > :last-child { margin-bottom: 0; }
.doc-table-wrap { overflow-x: auto; margin: 12px 0; }
.doc-article table, .doc-md table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc-article th, .doc-article td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.doc-article th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.doc-faq dt { font-weight: 700; margin-top: 14px; }
.doc-faq dd { margin: 4px 0 0; }

/* Trang so sánh (render từ markdown) */
.doc-filter { position: sticky; top: 52px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.doc-filter[hidden] { display: none; }
.doc-filter-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.doc-chip { font: 600 13px var(--f-body); border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.doc-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.doc-filter-count { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-md { overflow-wrap: anywhere; }
.doc-md h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.25; margin: 0 0 8px; }
.doc-md h2 { font-size: 21px; margin: 34px 0 10px; }
.doc-md p, .doc-md li { max-width: 85ch; }
.doc-md table { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: block; overflow-x: auto; font-size: 14.5px; }
.doc-md th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc-md td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; min-width: 120px; }
.doc-md td:first-child { font-weight: 600; min-width: 150px; }
.doc-md td:nth-child(2), .doc-md td:nth-child(3) { min-width: 240px; }
.doc-md tr.is-hidden { display: none; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.p-same { background: var(--same-bg); color: var(--same-fg); } .p-better { background: var(--better-bg); color: var(--better-fg); }
.p-diff { background: var(--diff-bg); color: var(--diff-fg); } .p-missing { background: var(--missing-bg); color: var(--missing-fg); }
.p-unknown { background: var(--unknown-bg); color: var(--unknown-fg); }
@media (max-width: 640px) {
  .doc-md table.is-cards, .doc-md table.is-cards tbody, .doc-md table.is-cards tr, .doc-md table.is-cards td { display: block; width: 100%; border: 0; }
  .doc-md table.is-cards { background: transparent; }
  .doc-md table.is-cards thead { display: none; }
  .doc-md table.is-cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 0; }
  .doc-md table.is-cards tr.is-hidden { display: none; }
  .doc-md table.is-cards td { padding: 4px 14px; min-width: 0; }
  .doc-md table.is-cards td::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .doc-md table.is-cards td:first-child::before { display: none; }
}
