/* =====================================================================
   WiseEye – Trung tâm hướng dẫn (client)
   Phong cách Help Center chính hãng: dễ đọc, nhiều khoảng thở, ưu tiên điện thoại.
   Font: Be Vietnam Pro (thiết kế riêng cho tiếng Việt).
   ===================================================================== */

:root {
    --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    --topbar-h: 64px;
    --sidebar-w: 292px;
    --toc-w: 232px;
    --read-w: 740px;
    --radius: 14px;
    --radius-sm: 10px;
    --ease: cubic-bezier(.32, .72, 0, 1);

    /* Màu thương hiệu (xanh FingerTAS) */
    --brand: #1a56db;
    --brand-strong: #1442b0;
    --brand-deep: #0d2c7a;
    --brand-soft: #ebf2ff;
    --brand-softer: #f5f8ff;

    --bg: #ffffff;
    --bg-soft: #f7f8fb;
    --bg-muted: #eef1f6;
    --line: #e4e8ef;
    --line-strong: #d3d9e3;
    --text: #0f1728;
    --text-2: #3b4658;
    --text-3: #6b7588;
    --mark: #fff0a6;
    --shadow-sm: 0 1px 2px rgba(15, 23, 40, .05);
    --shadow: 0 1px 2px rgba(15, 23, 40, .04), 0 4px 16px -4px rgba(15, 23, 40, .08);
    --shadow-lg: 0 24px 60px -16px rgba(15, 23, 40, .3);
    --code-bg: #f4f6fa;

    --c-info: #1a56db; --c-info-bg: #eef4ff; --c-info-line: #c7d9ff;
    --c-tip: #0b8a5f; --c-tip-bg: #ecfbf4; --c-tip-line: #b4ecd3;
    --c-warn: #b45309; --c-warn-bg: #fff8eb; --c-warn-line: #fbdca4;
    --c-danger: #c81e1e; --c-danger-bg: #fff2f2; --c-danger-line: #f8c4c4;

    --t-blue: #1a56db; --t-blue-bg: #ebf2ff;
    --t-violet: #6d4ae6; --t-violet-bg: #f1edff;
    --t-teal: #0e8a83; --t-teal-bg: #e7f8f6;
    --t-green: #18864b; --t-green-bg: #e9f8ef;
    --t-amber: #c2620a; --t-amber-bg: #fff4e5;
    --t-red: #d22f2f; --t-red-bg: #ffefef;
    --t-pink: #c0307a; --t-pink-bg: #fdeef6;
    --t-slate: #475569; --t-slate-bg: #eef1f5;
    color-scheme: light;
}

[data-theme="dark"] {
    --brand: #6aa1ff;
    --brand-strong: #93bbff;
    --brand-deep: #0b1a3d;
    --brand-soft: rgba(106, 161, 255, .14);
    --brand-softer: rgba(106, 161, 255, .07);
    --bg: #0b1220;
    --bg-soft: #0f1727;
    --bg-muted: #172034;
    --line: #1f2a3e;
    --line-strong: #2b3850;
    --text: #e8edf6;
    --text-2: #c2cbda;
    --text-3: #8b97ab;
    --mark: rgba(250, 204, 21, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    --code-bg: #121b2c;
    --c-info: #7fb0ff; --c-info-bg: rgba(106, 161, 255, .1); --c-info-line: rgba(106, 161, 255, .3);
    --c-tip: #4ade9a; --c-tip-bg: rgba(74, 222, 154, .08); --c-tip-line: rgba(74, 222, 154, .28);
    --c-warn: #fbbf4b; --c-warn-bg: rgba(251, 191, 75, .08); --c-warn-line: rgba(251, 191, 75, .28);
    --c-danger: #ff8080; --c-danger-bg: rgba(255, 128, 128, .08); --c-danger-line: rgba(255, 128, 128, .28);
    --t-blue: #7fb0ff; --t-blue-bg: rgba(106, 161, 255, .14);
    --t-violet: #b39dff; --t-violet-bg: rgba(179, 157, 255, .14);
    --t-teal: #5fd6cc; --t-teal-bg: rgba(95, 214, 204, .12);
    --t-green: #63d68f; --t-green-bg: rgba(99, 214, 143, .12);
    --t-amber: #ffb35c; --t-amber-bg: rgba(255, 179, 92, .12);
    --t-red: #ff8a8a; --t-red-bg: rgba(255, 138, 138, .12);
    --t-pink: #ff8fc8; --t-pink-bg: rgba(255, 143, 200, .12);
    --t-slate: #aab6c8; --t-slate-bg: rgba(170, 182, 200, .12);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 20px); -webkit-tap-highlight-color: transparent; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; }
kbd { font-family: var(--font); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text-3); line-height: 1.4; }
.icon { flex-shrink: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; color: #fff; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.only-mobile, .icon-btn.only-mobile { display: none; }

/* Nút chung */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px;
    border: 1px solid transparent; border-radius: 12px;
    font-size: 15px; font-weight: 600; white-space: nowrap;
    transition: background .2s, border-color .2s, transform .15s var(--ease), color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); color: #fff; }
.btn-soft { background: var(--bg); border-color: var(--line-strong); color: var(--text); }
.btn-soft:hover { border-color: var(--brand); color: var(--brand); }
.btn-outline { background: var(--bg); border: 1px solid var(--line-strong); color: var(--text); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); flex-shrink: 0; transition: background .15s; }
.icon-btn:hover { background: var(--bg-muted); color: var(--text); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline-flex; }
[data-theme="dark"] .theme-icon-light { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); color: var(--text-2); font-size: 14px; font-weight: 500; transition: all .15s; }
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }

/* ===================== THANH TRÊN ===================== */
.read-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 3px; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #4f8bff); border-radius: 0 3px 3px 0; transition: width .1s linear; }
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: var(--topbar-h); max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-logo { height: 30px; width: auto; display: block; }
[data-theme="dark"] .brand-logo { background: #fff; border-radius: 6px; padding: 3px 5px; height: 32px; }
.brand-divider { width: 1px; height: 24px; background: var(--line-strong); }
.brand-text { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand-short { display: none; }
.topbar-search {
    display: flex; align-items: center; gap: 10px;
    flex: 1; max-width: 440px; height: 42px; margin-left: auto;
    padding: 0 10px 0 14px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--bg-soft); color: var(--text-3); font-size: 14.5px;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.topbar-search:hover { border-color: var(--line-strong); background: var(--bg); box-shadow: var(--shadow-sm); }
.topbar-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Link đầu trang: co lại theo chỗ trống (ô tìm kiếm giữ tối thiểu 240px), phần không vừa → menu "Thêm" */
.topbar-search { min-width: 280px; }
.topbar-links { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
.topbar-links-row { display: flex; gap: 2px; min-width: 0; overflow: hidden; }
.topbar-links a, .topbar-more-btn { padding: 8px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.topbar-links a:hover, .topbar-more-btn:hover, .topbar-more-btn[aria-expanded="true"] { background: var(--bg-muted); color: var(--text); }
.topbar-more { position: relative; flex-shrink: 0; }
.topbar-more-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; font-family: inherit; }
.topbar-more-btn svg { transition: transform .2s; }
.topbar-more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.topbar-more-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
    min-width: 220px; max-width: min(320px, 90vw); max-height: min(70vh, 480px); overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    animation: more-in .16s ease-out;
}
.topbar-more-menu[hidden] { display: none; }
.topbar-more-menu a { padding: 10px 12px; border-radius: 9px; white-space: normal; line-height: 1.35; }
@keyframes more-in { from { opacity: 0; transform: translateY(-4px); } }
.topbar-actions { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.menu-btn { display: none; }

/* ===================== KHUNG ===================== */
.shell { flex: 1; display: flex; width: 100%; max-width: 1440px; margin: 0 auto; }
.main { flex: 1; min-width: 0; }
.is-home .shell { max-width: none; }

/* ===================== DANH MỤC (sidebar / ngăn kéo) ===================== */
.sidebar {
    position: sticky; top: var(--topbar-h);
    width: var(--sidebar-w); height: calc(100vh - var(--topbar-h));
    flex-shrink: 0;
    display: flex; flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--bg);
}
.is-home .sidebar, .is-home .drawer-backdrop { display: none; }
.drawer-head { display: none; }
.nav-filter { display: flex; align-items: center; gap: 8px; margin: 18px 16px 6px; padding: 0 12px; height: 38px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-3); }
.nav-filter input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text); }
.nav-filter:focus-within { border-color: var(--brand); background: var(--bg); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px 12px 40px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.nav-home { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 4px; border-radius: 9px; font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.nav-home:hover { background: var(--bg-soft); color: var(--text); }
.nav-home.is-active { color: var(--brand); background: var(--brand-soft); }
.nav-tree, .nav-children { list-style: none; margin: 0; padding: 0; }
.nav-children { display: none; margin: 2px 0 6px 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-item.is-open > .nav-children { display: block; }
.nav-item.is-root { margin-top: 4px; }
.nav-row { display: flex; align-items: center; border-radius: 9px; transition: background .12s; }
.nav-row:hover { background: var(--bg-soft); }
.nav-link { flex: 1; min-width: 0; padding: 7px 12px; font-size: 14.5px; line-height: 1.45; color: var(--text-2); border-radius: 9px; }
.nav-link:hover { color: var(--text); }
.nav-item.is-root.is-group > .nav-row > .nav-link { font-weight: 650; color: var(--text); }
.nav-item.is-group:not(.is-root) > .nav-row > .nav-link { font-weight: 550; }
.nav-item.is-active > .nav-row { background: var(--brand-soft); }
.nav-item.is-active > .nav-row > .nav-link { color: var(--brand); font-weight: 650; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-right: 2px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); flex-shrink: 0; }
.nav-toggle:hover { background: var(--bg-muted); color: var(--text); }
.nav-toggle .icon { transition: transform .22s var(--ease); }
.nav-item.is-open > .nav-row > .nav-toggle .icon { transform: rotate(90deg); }
.nav-item.is-filtered-out { display: none; }
.sidebar.is-filtering .nav-children { display: block; }
/* Lọc danh mục / sơ đồ trang: tô vàng chữ khớp (giống kết quả tìm kiếm) */
.nav-link mark, [data-sm-label] mark, [data-sm-item] > a mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.nav-empty { padding: 20px 12px; color: var(--text-3); font-size: 14px; }
.drawer-links { display: none; }
.drawer-backdrop { display: none; }

/* ===================== BÀI VIẾT ===================== */
.doc-layout { display: grid; grid-template-columns: minmax(0, var(--read-w)); justify-content: center; gap: 64px; padding: 40px 48px 80px; }
.doc-layout.has-toc { grid-template-columns: minmax(0, var(--read-w)) var(--toc-w); }
.doc { min-width: 0; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 18px; font-size: 14px; }
.crumbs a { color: var(--text-3); font-weight: 500; }
.crumbs a:hover { color: var(--brand); }
.crumb-sep { color: var(--line-strong); }

.doc-head { margin-bottom: 32px; }
.doc-title { margin: 0; font-size: 36px; line-height: 1.22; font-weight: 750; letter-spacing: -.025em; color: var(--text); text-wrap: balance; }
.doc-lead { margin: 14px 0 0; font-size: 18.5px; line-height: 1.6; color: var(--text-2); }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 16px; font-size: 14px; color: var(--text-3); }
.doc-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.preview-banner { display: flex; align-items: center; gap: 8px; padding: 12px 16px; margin-bottom: 20px; border-radius: 12px; background: var(--c-warn-bg); color: var(--c-warn); border: 1px solid var(--c-warn-line); font-size: 14.5px; font-weight: 500; }
.empty-note { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-radius: var(--radius); background: var(--bg-soft); color: var(--text-3); }

/* ----- Nội dung bài ----- */
.prose { font-size: 17px; line-height: 1.75; color: var(--text-2); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose strong { color: var(--text); font-weight: 650; }
.prose a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
/* Khoảng đệm khi cuộn tới tiêu đề lấy từ html { scroll-padding-top } – không đặt thêm scroll-margin kẻo bị cộng đôi */
.prose h2, .prose h3, .prose h4, .prose h5 { color: var(--text); letter-spacing: -.015em; position: relative; text-wrap: balance; }
.prose h2 { font-size: 26px; line-height: 1.3; font-weight: 750; margin: 2.4em 0 .75em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.prose > h2:first-child { border-top: 0; padding-top: 0; }
.prose h3 { font-size: 20.5px; line-height: 1.38; font-weight: 700; margin: 2em 0 .6em; }
.prose h4 { font-size: 17.5px; line-height: 1.45; font-weight: 700; margin: 1.7em 0 .5em; }
.prose h5 { font-size: 16px; font-weight: 700; margin: 1.5em 0 .4em; }
/* Tiêu đề kiểu "Bước 1" */
.prose .step-heading { display: flex; align-items: baseline; gap: 12px; }
.prose .step-no {
    flex-shrink: 0; display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .01em; transform: translateY(-2px);
    text-transform: none;
}
.prose h4.step-heading .step-no { height: 24px; font-size: 12px; padding: 0 9px; }
.heading-anchor { margin-left: 8px; color: var(--text-3); opacity: 0; font-weight: 500; text-decoration: none !important; transition: opacity .15s; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .prose h4:hover .heading-anchor { opacity: .7; }
.heading-anchor:hover { color: var(--brand); opacity: 1 !important; }

.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.prose li { margin: .4em 0; padding-left: .2em; }
.prose li::marker { color: var(--text-3); }
.prose ol > li::marker { color: var(--brand); font-weight: 700; }
.prose li > ul, .prose li > ol { margin: .4em 0; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--brand); color: var(--text-2); font-style: normal; }
.prose blockquote > :last-child { margin-bottom: 0; }

.prose img {
    display: block; height: auto; margin: 1.6em auto;
    border-radius: 12px; border: 1px solid var(--line);
    box-shadow: var(--shadow);
    background: #fff; cursor: zoom-in;
    transition: transform .25s var(--ease), box-shadow .25s;
}
.prose img:hover { box-shadow: 0 2px 4px rgba(15, 23, 40, .06), 0 12px 32px -8px rgba(15, 23, 40, .18); }
.prose p > img:only-child, .prose p > picture:only-child > img { margin: .6em auto; }
.prose picture { display: contents; } /* bọc bản WebP – bố cục như ảnh thường */
.prose figure { margin: 1.8em 0; }
.prose figcaption { margin-top: .6em; text-align: center; font-size: 14px; color: var(--text-3); }

.prose code { font-family: var(--mono); font-size: .86em; padding: .15em .45em; border-radius: 6px; background: var(--code-bg); border: 1px solid var(--line); color: var(--text); }
.prose pre { position: relative; margin: 1.6em 0; padding: 18px 20px; overflow-x: auto; border-radius: var(--radius); background: #0f1728; color: #e6ebf5; font-family: var(--mono); font-size: 14px; line-height: 1.65; border: 1px solid #1d2840; }
.prose pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }
.copy-btn { position: absolute; top: 10px; right: 10px; padding: 5px 10px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px; background: rgba(255, 255, 255, .08); color: #cfd8e6; font-size: 12.5px; font-weight: 500; opacity: 0; transition: opacity .15s; }
.prose pre:hover .copy-btn, .copy-btn:focus { opacity: 1; }

.table-wrap { margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.6; }
.prose th, .prose td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.prose thead th, .prose tr:first-child th { background: var(--bg-soft); color: var(--text); font-weight: 650; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td > :last-child, .prose th > :last-child { margin-bottom: 0; }
.prose td img { margin: .4em 0; }

.embed { position: relative; margin: 1.8em 0; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bg-muted); box-shadow: var(--shadow); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose video { display: block; max-width: 100%; margin: 1.6em auto; border-radius: var(--radius); }
.prose mark { background: var(--mark); color: inherit; padding: 0 .2em; border-radius: 4px; }

/* Khối ghi chú */
.prose .callout { position: relative; margin: 1.6em 0; padding: 16px 20px 16px 54px; border-radius: var(--radius); border: 1px solid var(--cl); background: var(--cb); color: var(--text-2); }
.prose .callout::before {
    content: ""; position: absolute; left: 18px; top: 18px; width: 22px; height: 22px;
    background: var(--cc);
    -webkit-mask: var(--ci) center / contain no-repeat; mask: var(--ci) center / contain no-repeat;
}
.prose .callout > :last-child { margin-bottom: 0; }
.prose .callout p { margin-bottom: .5em; }
.prose .callout ul, .prose .callout ol { margin-bottom: 0; }
.prose .callout-info { --cc: var(--c-info); --cb: var(--c-info-bg); --cl: var(--c-info-line); --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.prose .callout-tip, .prose .callout-success { --cc: var(--c-tip); --cb: var(--c-tip-bg); --cl: var(--c-tip-line); --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 22h4M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14'/%3E%3C/svg%3E"); }
.prose .callout-warning { --cc: var(--c-warn); --cb: var(--c-warn-bg); --cl: var(--c-warn-line); --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.prose .callout-danger { --cc: var(--c-danger); --cb: var(--c-danger-bg); --cl: var(--c-danger-line); --ci: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E"); }

/* Màu chữ người soạn chọn: dịu lại cho đỡ chói, sáng hơn trong dark mode */
.prose [style*="color:"]:not([style*="background"]) { font-weight: 600; }
[data-theme="dark"] .prose [style*="color:"]:not([style*="background"]) { filter: brightness(1.5) saturate(.85); }
[data-theme="dark"] .prose [style*="background-color"] { color: #111 !important; }

/* ----- Đánh giá, bài liên quan, chuyển bài ----- */
.feedback { margin-top: 56px; padding: 22px 24px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--line); }
.feedback-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; font-weight: 600; font-size: 16px; color: var(--text); }
.feedback-buttons { display: flex; gap: 10px; }
.feedback-buttons .btn { min-height: 40px; padding: 0 16px; }
.feedback-buttons .btn.is-chosen { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.feedback-thanks { display: flex; align-items: center; gap: 10px; color: var(--c-tip); font-weight: 600; }
.feedback-more { display: grid; gap: 14px; animation: fade .25s ease; }
.feedback-more-title { font-weight: 650; font-size: 16px; color: var(--text); }
.feedback-reasons { display: flex; flex-wrap: wrap; gap: 8px; border-radius: 12px; transition: box-shadow .2s; }
.feedback-reasons.is-required { box-shadow: 0 0 0 2px var(--bg-soft), 0 0 0 4px #f59e0b; }
.reason-chip { position: relative; cursor: pointer; }
.reason-chip input { position: absolute; opacity: 0; pointer-events: none; }
.reason-chip span { display: inline-flex; align-items: center; min-height: 38px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); color: var(--text-2); font-size: 14.5px; line-height: 1.35; transition: all .15s; }
.reason-chip:hover span { border-color: var(--brand); color: var(--brand); }
.reason-chip input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 600; }
.reason-chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.feedback-more textarea { width: 100%; min-height: 84px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.55; resize: vertical; transition: border-color .15s, box-shadow .15s; }
.feedback-more textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.feedback-more-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.feedback-more-note { margin-right: auto; font-size: 13px; color: var(--text-3); }
.feedback-more-actions .btn { min-height: 40px; padding: 0 16px; }
.feedback-more-actions .btn:disabled { opacity: .6; pointer-events: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.pager-link { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); transition: border-color .15s, box-shadow .2s, transform .2s var(--ease); }
.pager-link:hover { border-color: var(--brand); color: var(--text); box-shadow: var(--shadow); }
.pager-link.next { grid-column: 2; text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 500; color: var(--text-3); }
.pager-title { font-weight: 650; line-height: 1.45; color: var(--brand); }

.related { margin-top: 40px; }
.related h2, .support h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.related a { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; color: var(--text-2); font-size: 15px; line-height: 1.5; border-bottom: 1px solid var(--line); }
.related a .icon { margin-top: 3px; color: var(--text-3); }
.related a:hover { color: var(--brand); }

.support { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; margin-top: 48px; padding: 26px 28px; border-radius: 18px; background: linear-gradient(135deg, var(--brand-soft), var(--brand-softer)); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }
.support-text { display: flex; gap: 16px; align-items: flex-start; flex: 1; min-width: 260px; }
.support-text h2 { margin-bottom: 4px; }
.support-text p { margin: 0; color: var(--text-2); font-size: 15px; }
.support-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand); color: #fff; flex-shrink: 0; }
.support-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ----- Mục lục bên phải ----- */
.toc { position: relative; }
.toc-inner { position: sticky; top: calc(var(--topbar-h) + 40px); max-height: calc(100vh - var(--topbar-h) - 64px); overflow-y: auto; scrollbar-width: thin; }
.toc-title { margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--text); }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-list a { display: block; margin-left: -1px; padding: 6px 0 6px 16px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.45; color: var(--text-3); transition: color .15s, border-color .15s; }
.toc-list .toc-l3 a { padding-left: 28px; font-size: 13px; }
.toc-list a:hover { color: var(--text); }
.toc-list a.is-active { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }
.toc-top { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 0; border: 0; background: none; font-size: 13px; color: var(--text-3); }
.toc-top:hover { color: var(--brand); }
.toc-fab, .toc-sheet { display: none; }

/* ===================== TRANG NHÓM ===================== */
.group-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 32px; }
.article-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.article-list li + li { border-top: 1px solid var(--line); }
.article-item { display: flex; align-items: center; gap: 16px; padding: 18px 20px; color: var(--text); transition: background .15s; }
.article-item:hover { background: var(--bg-soft); color: var(--text); }
.article-no { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.article-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.article-title { font-weight: 600; line-height: 1.45; }
.article-desc { font-size: 14px; color: var(--text-3); line-height: 1.5; }
.article-arrow { color: var(--text-3); transition: transform .2s var(--ease); }
.article-item:hover .article-arrow { transform: translateX(3px); color: var(--brand); }

/* ===================== TRANG CHỦ ===================== */
.hero {
    position: relative;
    overflow: hidden;
    padding: 72px 24px 64px;
    color: #fff;
    background:
        radial-gradient(800px 360px at 85% -10%, rgba(120, 170, 255, .45), transparent 65%),
        radial-gradient(700px 400px at 0% 120%, rgba(56, 120, 255, .45), transparent 60%),
        linear-gradient(160deg, #0d2c7a 0%, #1a46b8 55%, #1a56db 100%);
}
.hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .14;
    background-image: radial-gradient(rgba(255, 255, 255, .7) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
    mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; text-align: center; }
.hero-kicker { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; margin-bottom: 18px; border-radius: 999px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); font-size: 13.5px; font-weight: 600; letter-spacing: .01em; }
.hero-title { margin: 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.15; font-weight: 800; letter-spacing: -.03em; }
.hero-intro { margin: 16px auto 0; max-width: 600px; font-size: 18px; line-height: 1.6; color: rgba(255, 255, 255, .85); }
.hero-search {
    display: flex; align-items: center; gap: 14px; width: 100%; max-width: 640px; height: 60px; margin: 32px auto 0; padding: 0 14px 0 22px;
    border: 0; border-radius: 16px; background: #fff; color: #6b7588; font-size: 16.5px; text-align: left;
    box-shadow: 0 20px 50px -12px rgba(5, 20, 60, .55), 0 0 0 6px rgba(255, 255, 255, .12);
    transition: transform .2s var(--ease), box-shadow .2s;
}
.hero-search:hover { transform: translateY(-1px); box-shadow: 0 24px 56px -12px rgba(5, 20, 60, .6), 0 0 0 6px rgba(255, 255, 255, .18); }
.hero-search .icon { color: var(--brand); }
[data-theme="dark"] .hero-search { background: #0f1727; color: #8b97ab; }
.hero-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; font-size: 14px; color: rgba(255, 255, 255, .75); }
.chip-on-dark { height: 32px; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .08); color: #fff; }
.chip-on-dark:hover { border-color: #fff; background: rgba(255, 255, 255, .18); color: #fff; }

.home { max-width: 1200px; margin: 0 auto; padding: 0 24px 80px; }
.start-card { position: relative; z-index: 2; display: flex; align-items: center; gap: 18px; margin: -32px auto 0; max-width: 860px; padding: 20px 24px; border-radius: 18px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-lg); color: var(--text); transition: transform .2s var(--ease); }
.start-card:hover { color: var(--text); transform: translateY(-2px); }
.start-icon { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 14px; background: linear-gradient(135deg, #ffb020, #ff7a1a); color: #fff; flex-shrink: 0; }
.start-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.start-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #e06a0c; }
.start-title { font-size: 18px; font-weight: 700; }
.start-desc { font-size: 14.5px; color: var(--text-3); }
.start-arrow { color: var(--brand); }

.home-section { margin-top: 64px; }
.sec-head { margin-bottom: 22px; }
.sec-head h2 { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.sec-head p { margin: 6px 0 0; color: var(--text-3); }

.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.topic-card { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); color: var(--text); position: relative; transition: border-color .2s, box-shadow .25s, transform .25s var(--ease); }
.topic-card:hover { color: var(--text); border-color: transparent; box-shadow: 0 0 0 1.5px var(--tc), var(--shadow); transform: translateY(-3px); }
.topic-icon { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 14px; background: var(--tb); color: var(--tc); flex-shrink: 0; }
.topic-icon.lg { width: 60px; height: 60px; border-radius: 16px; }
.topic-body { display: flex; flex-direction: column; gap: 4px; }
.topic-title { font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; }
.topic-count { font-size: 13.5px; font-weight: 600; color: var(--tc); }
.topic-preview { margin-top: 6px; font-size: 14.5px; line-height: 1.55; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-arrow { position: absolute; top: 26px; right: 22px; color: var(--text-3); transition: transform .2s var(--ease), color .2s; }
.topic-card:hover .topic-arrow { transform: translateX(3px); color: var(--tc); }
.tone-blue { --tc: var(--t-blue); --tb: var(--t-blue-bg); }
.tone-violet { --tc: var(--t-violet); --tb: var(--t-violet-bg); }
.tone-teal { --tc: var(--t-teal); --tb: var(--t-teal-bg); }
.tone-green { --tc: var(--t-green); --tb: var(--t-green-bg); }
.tone-amber { --tc: var(--t-amber); --tb: var(--t-amber-bg); }
.tone-red { --tc: var(--t-red); --tb: var(--t-red-bg); }
.tone-pink { --tc: var(--t-pink); --tb: var(--t-pink-bg); }
.tone-slate { --tc: var(--t-slate); --tb: var(--t-slate-bg); }

.home-split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
.popular-list, .recent-list { list-style: none; margin: 0; padding: 0; counter-reset: pop; }
.popular-list li, .recent-list li { border-bottom: 1px solid var(--line); }
.popular-list a, .recent-list a { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; color: var(--text); }
.popular-list li { counter-increment: pop; }
.popular-list a::before { content: counter(pop, decimal-leading-zero); font-size: 14px; font-weight: 700; color: var(--brand); min-width: 26px; padding-top: 1px; font-variant-numeric: tabular-nums; }
.popular-list a > span, .recent-list a > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.popular-title { font-weight: 600; line-height: 1.45; }
.popular-list a:hover .popular-title, .recent-list a:hover .popular-title { color: var(--brand); }
.popular-meta { font-size: 13.5px; color: var(--text-3); }
.recent-dot { width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--t-green); box-shadow: 0 0 0 4px var(--t-green-bg); flex-shrink: 0; }
.home .support { margin-top: 64px; }

/* ===================== TÌM KIẾM ===================== */
.search-modal { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(8, 14, 30, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .18s ease; }
.search-dialog { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 680px; max-height: 76vh; border-radius: 18px; background: var(--bg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; animation: pop .22s var(--ease); }
.search-box { display: flex; flex-shrink: 0; align-items: center; gap: 12px; height: 62px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); color: var(--brand); }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: var(--text); }
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-cancel { border: 0; background: var(--bg-muted); color: var(--text-2); height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; }
.search-results { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px; overscroll-behavior: contain; }
.search-hint { padding: 10px 10px 14px; }
.search-hint-title { margin-bottom: 10px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.search-empty { padding: 36px 16px; text-align: center; color: var(--text-3); line-height: 1.6; }
.search-hit { display: block; padding: 12px 14px; border-radius: 12px; color: var(--text); }
.search-hit + .search-hit { margin-top: 2px; }
.search-hit.is-selected, .search-hit:hover { background: var(--brand-soft); color: var(--text); }
.hit-crumb { display: block; margin-bottom: 2px; font-size: 12.5px; color: var(--text-3); }
.hit-title { display: block; font-weight: 650; font-size: 15.5px; line-height: 1.45; }
.search-hit.is-selected .hit-title { color: var(--brand); }
.hit-snippet { display: -webkit-box; margin-top: 4px; font-size: 14px; line-height: 1.55; color: var(--text-2); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hit-snippet mark, .hit-title mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-foot { display: flex; flex-shrink: 0; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: 12.5px; color: var(--text-3); }
.search-foot kbd { margin-right: 3px; }
.search-count { margin-left: auto; }

.search-page-box { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 8px 0 18px; margin-bottom: 18px; border: 1px solid var(--line-strong); border-radius: 14px; color: var(--text-3); }
.search-page-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-page-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16.5px; color: var(--text); }
.search-page-box .btn { min-height: 42px; }
.search-count-line { color: var(--text-3); }
.result-list { display: grid; gap: 12px; }
.result-item { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); transition: border-color .15s, box-shadow .2s; }
.result-item:hover { border-color: var(--brand); color: var(--text); box-shadow: var(--shadow); }
.result-item .hit-title { color: var(--brand); margin: 2px 0 4px; }

/* ===================== LỖI (404 / 410 / 500) ===================== */
.error-page { max-width: 760px; margin: 0 auto; padding: 56px 24px 80px; text-align: center; }
.error-art { display: flex; justify-content: center; margin-bottom: 8px; }
.error-art svg { max-width: 100%; height: auto; animation: ea-float 5s ease-in-out infinite; }
@keyframes ea-float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .error-art svg { animation: none; } }
.ea-shadow { fill: var(--bg-muted); }
.ea-paper { fill: var(--bg); stroke: var(--line-strong); stroke-width: 2; }
.ea-line { fill: var(--bg-muted); } .ea-line.strong { fill: var(--brand-soft); }
.ea-lens { fill: color-mix(in srgb, var(--brand) 10%, var(--bg)); }
.ea-ring { fill: none; stroke: var(--brand); stroke-width: 7; }
.ea-handle { stroke: var(--brand); stroke-width: 11; stroke-linecap: round; }
.ea-mark { fill: var(--brand); font-size: 30px; font-weight: 800; font-family: inherit; }
.ea-dot { fill: var(--brand); opacity: .25; }
.error-badge { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.error-page h1 { margin: 14px 0 10px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.02em; line-height: 1.2; }
.error-desc { max-width: 520px; margin: 0 auto; color: var(--text-2); font-size: 16px; line-height: 1.6; }
.error-search { display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 28px auto 0; padding: 6px 6px 6px 16px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--bg); box-shadow: 0 10px 30px -18px rgba(15, 23, 40, .35); color: var(--text-3); }
.error-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.error-search input { flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; }
.error-search .btn { min-height: 42px; }
.error-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.error-block { margin-top: 44px; text-align: left; }
.error-block h2 { margin: 0 0 14px; font-size: 17px; font-weight: 700; text-align: center; color: var(--text); }
.error-suggest { display: grid; gap: 8px; }
.error-hit { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; }
.error-hit:hover { border-color: var(--brand); color: var(--text); transform: translateY(-1px); box-shadow: 0 10px 24px -18px rgba(26, 86, 219, .5); }
.error-hit-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.error-hit-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.error-hit-body small { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-hit-body strong { font-size: 15.5px; font-weight: 650; }
.error-hit-arrow { color: var(--text-3); }
.error-hit:hover .error-hit-arrow { color: var(--brand); }
.error-topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.error-topic { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font-weight: 600; font-size: 14.5px; line-height: 1.35; transition: border-color .2s, transform .2s var(--ease); }
.error-topic:hover { border-color: var(--brand); color: var(--text); transform: translateY(-1px); }
.error-topic .topic-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; }
@media (max-width: 720px) {
    .error-page { padding: 32px 16px 56px; }
    .error-art svg { width: 190px; }
    .error-topics { grid-template-columns: 1fr 1fr; }
    .error-actions .btn { flex: 1 1 auto; }
}

/* ===================== CHÂN TRANG ===================== */
.footer { border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px 48px; max-width: 1200px; margin: 0 auto; padding: 40px 24px calc(32px + env(safe-area-inset-bottom)); }
.footer-logo { height: 28px; width: auto; }
[data-theme="dark"] .footer-logo { background: #fff; border-radius: 6px; padding: 3px 5px; }
.footer-brand p { margin: 12px 0 0; max-width: 460px; font-size: 14.5px; color: var(--text-3); }
.footer-links { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px 24px; justify-content: flex-end; }
.footer-links a { font-size: 14.5px; color: var(--text-2); }
.footer-links a:hover { color: var(--brand); }
.footer-copy { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-3); }

/* ===================== LIGHTBOX ===================== */
.lightbox { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 10, 20, .92); cursor: zoom-out; animation: fade .18s ease; touch-action: pinch-zoom; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: pop .25s var(--ease); }
.lightbox-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: inline-flex; align-items: center; justify-content: center; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes slide-in { from { transform: translateX(-100%); } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1279px) {
    .doc-layout.has-toc { grid-template-columns: minmax(0, var(--read-w)); }
    .toc { display: none; }
    .toc-fab {
        display: inline-flex; align-items: center; gap: 8px;
        position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 40;
        height: 46px; padding: 0 18px; border: 0; border-radius: 999px;
        background: var(--text); color: var(--bg); font-weight: 600; font-size: 14.5px;
        box-shadow: 0 10px 30px -8px rgba(15, 23, 40, .5);
        transition: transform .3s var(--ease), opacity .3s;
    }
    .toc-fab.is-hidden { transform: translateY(90px); opacity: 0; }
    .toc-sheet { display: block; position: fixed; inset: 0; z-index: 110; }
    .toc-sheet[hidden] { display: none !important; }
    .toc-sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 14, 30, .45); animation: fade .2s ease; }
    .toc-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 75vh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; background: var(--bg); box-shadow: var(--shadow-lg); animation: sheet-up .35s var(--ease); padding-bottom: env(safe-area-inset-bottom); max-width: 640px; margin: 0 auto; }
    .toc-sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; }
    .toc-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 22px; font-weight: 700; font-size: 17px; border-bottom: 1px solid var(--line); }
    .toc-sheet-list { list-style: none; margin: 0; padding: 8px 10px 16px; overflow-y: auto; }
    .toc-sheet-list a { display: block; padding: 12px 14px; border-radius: 10px; color: var(--text-2); font-size: 15.5px; line-height: 1.45; }
    .toc-sheet-list .toc-l3 a { padding-left: 30px; font-size: 14.5px; color: var(--text-3); }
    .toc-sheet-list a.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
    .topic-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
    .topbar-links { display: none; }
}

/* Máy tính bảng & điện thoại: danh mục thành ngăn kéo */
@media (max-width: 1023px) {
    .menu-btn { display: inline-flex; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
        width: min(340px, 88vw); height: 100%;
        border-right: 0;
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%); visibility: hidden;
        transition: transform .32s var(--ease), visibility .32s;
        padding-top: env(safe-area-inset-top);
    }
    .is-home .sidebar { display: flex; }
    body.drawer-open .sidebar { transform: none; visibility: visible; }
    body.drawer-open { overflow: hidden; }
    .drawer-head { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 8px 0 20px; border-bottom: 1px solid var(--line); }
    .drawer-title { font-weight: 700; font-size: 17px; }
    .nav-filter { margin: 14px 14px 4px; height: 42px; }
    .nav-filter input { font-size: 16px; }
    .nav-link { padding: 10px 12px; font-size: 15.5px; }
    .nav-toggle { width: 38px; height: 38px; }
    .drawer-links { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
    .drawer-links a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 9px; color: var(--text-2); font-size: 15px; }
    .drawer-backdrop, .is-home .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(8, 14, 30, .45); opacity: 0; pointer-events: none; transition: opacity .3s; }
    body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
    .doc-layout { padding: 32px 32px 72px; }
    .home-split { grid-template-columns: 1fr; gap: 40px; }
}

/* Điện thoại */
@media (max-width: 720px) {
    :root { --topbar-h: 58px; }
    .only-mobile, .icon-btn.only-mobile { display: inline-flex; }
    .doc-meta .opt { display: none; }
    .topbar-inner { gap: 6px; padding: 0 8px 0 16px; }
    .topbar-search { display: none; }
    .brand { gap: 10px; flex: 1; }
    .brand-logo { height: 26px; }
    .brand-full { display: none; }
    .brand-short { display: inline; }
    .brand-text { font-size: 15px; color: var(--text-2); font-weight: 600; }
    .brand-divider { height: 20px; }
    .topbar-actions { margin-left: 0; }

    .doc-layout { padding: 20px 18px 96px; }
    .crumbs { margin-bottom: 12px; font-size: 13.5px; }
    .doc-head { margin-bottom: 26px; }
    .doc-title { font-size: 28px; line-height: 1.25; }
    .doc-lead { font-size: 17px; }
    .doc-meta { font-size: 13.5px; margin-top: 12px; }

    .prose { font-size: 16.5px; line-height: 1.72; }
    .prose p { margin-bottom: 1em; }
    .prose h2 { font-size: 22px; margin-top: 2em; padding-top: 1em; }
    .prose h3 { font-size: 18.5px; margin-top: 1.8em; }
    .prose h4 { font-size: 16.5px; }
    .prose .step-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
    .prose .step-no { transform: none; height: 26px; font-size: 12.5px; }
    .prose ul, .prose ol { padding-left: 1.3em; }
    .prose img { margin: 1.2em auto; border-radius: 10px; }
    .prose .callout { padding: 14px 16px 14px 46px; }
    .prose .callout::before { left: 14px; top: 16px; width: 20px; height: 20px; }
    .prose pre { margin-left: -18px; margin-right: -18px; border-radius: 0; border-left: 0; border-right: 0; }
    .table-wrap { margin-left: -18px; margin-right: -18px; border-radius: 0; border-left: 0; border-right: 0; }
    .prose th, .prose td { padding: 10px 12px; font-size: 14.5px; }

    .feedback { margin-top: 40px; padding: 18px; }
    .feedback-ask { flex-direction: column; align-items: stretch; text-align: center; }
    .feedback-buttons { justify-content: center; }
    .feedback-buttons .btn { flex: 1; }
    .feedback-more-note { width: 100%; order: 3; text-align: center; }
    .feedback-more-actions .btn { flex: 1; }
    .reason-chip span { font-size: 14px; }
    .pager { grid-template-columns: 1fr; gap: 10px; }
    .pager-link.next { grid-column: auto; }
    .related ul { grid-template-columns: 1fr; }
    .support { padding: 20px; margin-top: 36px; }
    .support-actions { width: 100%; }
    .support-actions .btn { flex: 1; }

    .hero { padding: 44px 18px 60px; }
    .hero-kicker { font-size: 12.5px; margin-bottom: 14px; }
    .hero-intro { font-size: 16px; }
    .hero-search { height: 54px; margin-top: 24px; padding: 0 16px; font-size: 15.5px; border-radius: 14px; }
    .hero-search kbd { display: none; }
    .hero-chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin: 18px -18px 0; padding: 0 18px 4px; scrollbar-width: none; }
    .hero-chips::-webkit-scrollbar { display: none; }
    .hero-chips > span { flex-shrink: 0; }
    .hero-chips .chip { flex-shrink: 0; }
    .home { padding: 0 16px 64px; }
    .start-card { margin-top: -28px; padding: 16px; gap: 14px; border-radius: 16px; }
    .start-icon { width: 44px; height: 44px; }
    .start-title { font-size: 16.5px; }
    .start-desc { display: none; }
    .home-section { margin-top: 44px; }
    .sec-head h2 { font-size: 22px; }
    .topic-grid { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
    .topic-card { flex-direction: row; align-items: center; gap: 14px; padding: 16px; border: 0; border-radius: 0; }
    .topic-card + .topic-card { border-top: 1px solid var(--line); }
    .topic-card:hover { transform: none; box-shadow: none; background: var(--bg-soft); }
    .topic-icon { width: 44px; height: 44px; border-radius: 12px; }
    .topic-body { flex: 1; min-width: 0; gap: 1px; }
    .topic-title { font-size: 16px; }
    .topic-count { font-size: 13px; }
    .topic-preview { display: none; }
    .topic-arrow { position: static; }
    .article-item { padding: 14px 16px; gap: 12px; }
    .group-head { flex-direction: column; gap: 14px; }
    .topic-icon.lg { width: 50px; height: 50px; }

    .search-modal { padding: 0; align-items: stretch; }
    .search-dialog { max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); }
    .search-box { height: 60px; padding: 0 10px 0 16px; }
    .search-box input { font-size: 16.5px; }
    .search-foot { display: none; }
    .footer-inner { grid-template-columns: 1fr; padding-top: 32px; }
    .footer-links { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
    .topbar, .sidebar, .toc, .toc-fab, .pager, .feedback, .support, .related, .footer, .read-progress { display: none !important; }
    .doc-layout { display: block; padding: 0; }
    .prose img { box-shadow: none; }
}

/* ===================== ĐIỀU HƯỚNG MƯỢT ===================== */
/* Thanh tải mảnh chạy dưới thanh trên khi đang lấy trang mới */
body.is-navigating { cursor: progress; }
.topbar::after {
    content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    background-size: 40% 100%; background-repeat: no-repeat;
    opacity: 0; transition: opacity .2s;
}
body.is-navigating .topbar::after { opacity: 1; animation: nav-loading 1s linear infinite; }
@keyframes nav-loading { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* Chỉ phần nội dung chuyển cảnh; thanh trên & danh mục đứng yên */
.main { view-transition-name: doc-main; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
::view-transition-old(doc-main) { animation: vt-out .14s ease both; }
::view-transition-new(doc-main) { animation: vt-in .3s cubic-bezier(.32, .72, 0, 1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }
#main h1:focus { outline: none; }

/* Gợi ý sửa lỗi gõ khi tìm kiếm */
.search-suggest { margin: 2px 4px 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-soft); color: var(--text-2); font-size: 14.5px; }
.search-suggest strong { color: var(--text); }
.search-suggest button, .search-suggest a { border: 0; padding: 0; background: none; font: inherit; font-weight: 700; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.doc .search-suggest { margin: 0 0 14px; }

/* ===================== NÚT LIÊN HỆ NỔI ===================== */
.contact-fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 45; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.contact-btn {
    display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 50%;
    background: var(--brand); color: #fff; cursor: pointer;
    box-shadow: 0 12px 30px -10px rgba(26, 86, 219, .7), 0 2px 6px rgba(15, 23, 40, .15);
    transition: transform .25s var(--ease), box-shadow .25s;
}
.contact-btn:hover { transform: translateY(-2px) scale(1.04); }
.contact-btn:active { transform: scale(.94); }
.contact-btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 3px; }
.contact-btn > span { grid-area: 1 / 1; display: grid; place-items: center; transition: transform .3s var(--ease), opacity .2s; }
.contact-btn .cb-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.contact-fab.is-open .contact-btn .cb-open { opacity: 0; transform: rotate(90deg) scale(.6); }
.contact-fab.is-open .contact-btn .cb-close { opacity: 1; transform: none; }
.contact-menu {
    width: min(300px, calc(100vw - 40px)); padding: 8px; border-radius: 18px; background: var(--bg);
    border: 1px solid var(--line); box-shadow: var(--shadow-lg); transform-origin: bottom right;
    animation: contact-in .25s var(--ease);
}
@keyframes contact-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.contact-head { display: grid; gap: 2px; padding: 8px 10px 10px; }
.contact-head strong { font-size: 15.5px; color: var(--text); }
.contact-head span { font-size: 13px; color: var(--text-3); line-height: 1.45; }
.contact-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--text); }
.contact-item:hover { background: var(--bg-soft); color: var(--text); }
.contact-item b { display: block; font-size: 14.5px; font-weight: 650; }
.contact-item small { display: block; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ci-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; color: #fff; }
.ci-icon.zalo { background: #0068ff; }
.ci-icon.phone { background: #18864b; }
.ci-icon.mail { background: #6d4ae6; }
@media (max-width: 1279px) {
    /* Trang bài có nút "Mục lục" nổi ở cùng góc → đẩy nút liên hệ lên trên */
    body:has(.toc-fab) .contact-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
    .contact-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
    body:has(.toc-fab) .contact-fab { bottom: calc(70px + env(safe-area-inset-bottom)); }
    .contact-btn { width: 52px; height: 52px; }
}
@media print { .contact-fab { display: none !important; } }

/* ===================== CHỌN PHẦN MỀM ĐANG DÙNG ===================== */
.product-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pp-label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chips button {
    height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg);
    color: var(--text-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.pp-chips button:hover { border-color: var(--brand); color: var(--brand); }
.pp-chips button[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pp-chips button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Trang chủ – trên nền hero xanh */
.pp-hero { justify-content: center; margin-top: 22px; }
.pp-hero .pp-label { color: rgba(255, 255, 255, .85); }
.pp-hero .pp-chips button { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .3); color: #fff; }
.pp-hero .pp-chips button:hover { background: rgba(255, 255, 255, .18); border-color: #fff; color: #fff; }
.pp-hero .pp-chips button[aria-checked="true"] { background: #fff; border-color: #fff; color: var(--brand); }
/* Trong hộp tìm kiếm */
.pp-modal { flex-wrap: nowrap; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.pp-modal::-webkit-scrollbar { display: none; }
.pp-modal .pp-label { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.pp-modal .pp-chips { flex-wrap: nowrap; }
.pp-modal .pp-chips button { height: 30px; padding: 0 12px; font-size: 13.5px; white-space: nowrap; }
/* Trang /tim-kiem */
.pp-page { margin: -6px 0 18px; }
.search-filter-line { margin: -4px 0 14px; font-size: 14.5px; color: var(--text-2); }
/* Trong bài */
.doc-applies { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; color: var(--text-3); }
.product-notice { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: #fff7e6; border: 1px solid #f5d38a; color: #6b4a00; font-size: 15px; line-height: 1.6; }
.product-notice > svg { flex-shrink: 0; margin-top: 3px; color: #c2620a; }
.product-notice strong { color: #4a3300; }
.product-notice button { display: inline; margin-left: 4px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] .product-notice { background: rgba(255, 179, 92, .1); border-color: rgba(255, 179, 92, .35); color: #ffd9a8; }
[data-theme="dark"] .product-notice strong { color: #ffe7c7; }
@media (max-width: 720px) {
    .pp-hero { margin-top: 18px; }
    .pp-hero .pp-label { width: 100%; text-align: center; }
    .pp-hero .pp-chips { justify-content: center; }
}

/* ===== Hiệu ứng khi khách chọn phần mềm đang dùng ===== */
.pp-status { width: 100%; margin: 4px 0 0; font-size: 14px; color: rgba(255, 255, 255, .92); text-align: center; animation: fade .25s ease; }
.pp-status strong { color: #fff; }
.topic-card { transition: opacity .25s, transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.topic-card.is-for-product { order: -1; border-color: var(--tc); box-shadow: 0 0 0 1px var(--tc), var(--shadow); }
.topic-card.is-other-product { order: 2; opacity: .45; }
.topic-card.is-other-product:hover { opacity: .85; }
.topic-for { display: inline-flex; align-self: flex-start; width: max-content; margin-bottom: 6px; padding: 2px 9px; border-radius: 999px; background: var(--tb); color: var(--tc); font-size: 12px; font-weight: 700; }
.popular-list:not(.is-js-limited) > li:nth-child(n+9), .recent-list:not(.is-js-limited) > li:nth-child(n+7) { display: none; }
.is-js-limited > li:not(.is-visible) { display: none; }
.nav-item.is-other-product > .nav-row { opacity: .42; }
.nav-item.is-other-product > .nav-row:hover { opacity: .8; }
.hit-for { display: inline-flex; align-items: center; margin-right: 8px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 700; vertical-align: 1px; }

/* ===================== IN / LƯU PDF ===================== */
.meta-print, .meta-share { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.meta-print:hover, .meta-share:hover { color: var(--brand); }
.print-head { display: none; }
@media print {
    @page { margin: 14mm 14mm 16mm; }
    html, body { background: #fff !important; color: #111 !important; }
    [data-theme="dark"] { --bg: #fff; --text: #111; --text-2: #333; --text-3: #555; --line: #ddd; --bg-soft: #f6f6f6; }
    .contact-fab, .product-notice, .heading-anchor, .crumbs, .meta-print, .meta-share, .doc-meta .dot.opt, .toc-sheet, .search-modal, .lightbox { display: none !important; }
    .main, .doc, .prose { max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; }
    .print-head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; margin-bottom: 18px; border-bottom: 1px solid #ccc; }
    .print-head img { height: 30px; width: auto; box-shadow: none; border: 0; margin: 0; }
    .print-head span { display: grid; }
    .print-head b { font-size: 12pt; }
    .print-head small { font-size: 9pt; color: #555; }
    .doc-title { font-size: 22pt; }
    .prose { font-size: 11pt; line-height: 1.55; }
    .prose h2, .prose h3, .prose h4 { break-after: avoid; page-break-after: avoid; }
    .prose img, .prose figure, .prose table, .prose pre, .prose .callout, .prose details { break-inside: avoid; page-break-inside: avoid; }
    .prose img { max-height: 120mm; width: auto; border: 1px solid #ddd; }
    .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8.5pt; color: #555; word-break: break-all; }
    .prose .table-wrap { overflow: visible !important; }
}

/* ===================== KHỐI HỎI – ĐÁP (details) ===================== */
.prose details { margin: 1em 0; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); transition: box-shadow .2s, border-color .2s; }
.prose details[open] { padding-bottom: 16px; }
.prose details + details { margin-top: -4px; }
.prose details[open] { border-color: var(--line-strong); box-shadow: var(--shadow); }
.prose details > summary {
    position: relative; display: block; margin: 0 -18px; padding: 15px 52px 15px 18px; list-style: none; cursor: pointer;
    font-weight: 650; color: var(--text); border-radius: 14px; -webkit-tap-highlight-color: transparent;
}
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -6px;
    border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .25s var(--ease), margin .25s;
}
.prose details[open] > summary::after { transform: rotate(225deg); margin-top: -2px; }
.prose details > summary:hover { color: var(--brand); }
.prose details > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.prose details > :last-child:not(summary) { margin-bottom: 0; }
.prose details > summary + * { margin-top: 2px; }

/* ===================== THUẬT NGỮ ===================== */
.prose abbr.term {
    text-decoration: underline dotted; text-decoration-color: var(--brand); text-decoration-thickness: 1.5px; text-underline-offset: 4px;
    cursor: help; border-radius: 4px; transition: background .15s;
}
.prose abbr.term:hover, .prose abbr.term:focus-visible { background: var(--brand-soft); outline: none; }
.term-pop {
    position: fixed; z-index: 120; max-width: min(340px, calc(100vw - 20px)); padding: 12px 14px; border-radius: 12px;
    background: var(--text); color: var(--bg); box-shadow: 0 12px 34px -8px rgba(15, 23, 40, .45);
    font-size: 14px; line-height: 1.55; animation: fade .15s ease;
}
.term-pop b { display: block; margin-bottom: 3px; font-size: 13.5px; }
.term-pop p { margin: 0; opacity: .92; }
.term-pop::after {
    content: ""; position: absolute; left: var(--arrow-x, 50%); bottom: -6px; width: 12px; height: 12px; margin-left: -6px;
    background: inherit; transform: rotate(45deg); border-radius: 2px;
}
.term-pop.below::after { bottom: auto; top: -6px; }
@media print { .term-pop { display: none !important; } .prose abbr.term { text-decoration: none; } }

/* ----- Chia sẻ bài ----- */
.meta-share.is-done { color: var(--c-tip, #16a34a); }
@media print { .doc-meta .meta-share + .dot, .doc-meta .dot:has(+ .meta-share) { display: none !important; } }

/* ----- Tìm gần đây (lưu trên máy khách) ----- */
.search-recent { margin-bottom: 18px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; }
.recent-head button { border: 0; background: none; padding: 2px 4px; font: inherit; font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--brand); cursor: pointer; }
.recent-row { display: flex; align-items: center; border-radius: 10px; }
.recent-row:hover { background: var(--bg-soft); }
.recent-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; font: inherit; font-size: 15px; color: var(--text); text-align: left; cursor: pointer; }
.recent-item svg { flex-shrink: 0; color: var(--text-3); }
.recent-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-del { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.recent-del:hover { background: var(--bg-muted); color: var(--text); }

/* ----- Tìm không ra → liên hệ kỹ thuật ----- */
.search-empty.has-contact { padding-bottom: 18px; }
.search-contact { display: flex; gap: 14px; align-items: flex-start; margin: 4px 6px 10px; padding: 16px 18px; border-radius: 14px; background: linear-gradient(135deg, var(--brand-soft), var(--brand-softer)); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }
.search-contact .sc-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; flex-shrink: 0; }
.search-contact .sc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-contact .sc-body > span { color: var(--text-2); font-size: 14.5px; }
.search-contact .sc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.search-contact .btn { min-height: 38px; height: 38px; padding: 0 14px; font-size: 14.5px; }
.result-list + .search-contact, .search-count-line + .result-list:empty + .search-contact { margin: 18px 0 0; }

/* ----- Thanh thông báo đầu trang (admin bật ở Cài đặt) ----- */
.announce { --ann: #1a56db; position: relative; z-index: 51; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 7px 48px; background: var(--ann); color: #fff; font-size: 14.5px; line-height: 1.45; overflow: hidden; transition: height .25s var(--ease), min-height .25s var(--ease), padding .25s var(--ease), opacity .2s; }
.announce.tone-green { --ann: #13795b; }
.announce.tone-orange { --ann: #b45309; }
.announce.tone-red { --ann: #c62828; }
.announce.is-closing { height: 0 !important; min-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.announce-off .announce { display: none; }
.announce-inner { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 14px; margin: 0; text-align: center; }
.announce-text { font-weight: 500; }
.announce-link { color: #fff; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; white-space: nowrap; }
.announce-link:hover { color: #fff; text-decoration-thickness: 2.5px; }
.announce-close { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #fff; opacity: .85; cursor: pointer; }
.announce-close:hover { opacity: 1; background: rgba(255, 255, 255, .16); }
.announce-close:focus-visible, .announce-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 640px) { .announce { padding: 8px 44px 8px 16px; font-size: 13.5px; justify-content: flex-start; } .announce-inner { justify-content: flex-start; text-align: left; } }
@media print { .announce { display: none !important; } }

/* ----- Có gì mới (/moi-cap-nhat) ----- */
.sec-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-more { display: inline-flex; align-items: center; gap: 4px; font-size: 14.5px; font-weight: 600; color: var(--brand); white-space: nowrap; }
.sec-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.wn-month + .wn-month { margin-top: 36px; }
.wn-month h2 { margin: 0 0 6px; font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.wn-list { list-style: none; margin: 0; padding: 0; }
.wn-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.wn-date { flex: 0 0 48px; padding-top: 2px; font-size: 14px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wn-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.wn-badge.is-new { background: color-mix(in srgb, #16a34a 14%, transparent); color: #15803d; }
.wn-badge.is-update { background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .wn-badge.is-new { color: #4ade80; }
.wn-title { font-size: 16.5px; font-weight: 650; line-height: 1.45; color: var(--text); }
.wn-title:hover { color: var(--brand); }
.wn-note { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.wn-crumb { font-size: 13px; color: var(--text-3); }
.doc-change { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--brand-softer, var(--brand-soft)); color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.doc-change svg { flex-shrink: 0; margin-top: 3px; color: var(--brand); }
.doc-change b { color: var(--text); font-weight: 650; }
@media (max-width: 640px) { .wn-item { gap: 12px; } .wn-date { flex-basis: 40px; font-size: 13px; } }

/* ----- Sơ đồ trang (/so-do-trang) ----- */
.footer-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; }
.footer-meta a { color: var(--text-2); }
.footer-meta a:hover { color: var(--brand); }
.sm-filter { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; margin-bottom: 24px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--text-3); cursor: text; }
.sm-filter:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sm-filter input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15.5px; color: var(--text); }
.sm-filter input::-webkit-search-cancel-button { cursor: pointer; }
.sm-filter-count { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.sm-grid { columns: 2 320px; column-gap: 20px; }
.sm-card { break-inside: avoid; margin-bottom: 20px; padding: 18px 20px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.sm-general { margin-bottom: 20px; }
.sm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sm-head .topic-icon { width: 42px; height: 42px; border-radius: 12px; }
.sm-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--text); }
a.sm-title:hover { color: var(--brand); }
.sm-count { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); }
.sm-list { list-style: none; margin: 0; padding: 0; }
.sm-list li { position: relative; }
.sm-list > li[data-sm-item] > a { display: block; padding: 6px 0 6px 18px; font-size: 15px; line-height: 1.45; color: var(--text-2); }
.sm-list > li[data-sm-item] > a::before { content: ""; position: absolute; left: 4px; top: 15px; width: 5px; height: 5px; border-radius: 50%; background: var(--tc, var(--brand)); opacity: .6; }
.sm-list > li[data-sm-item] > a:hover { color: var(--brand); }
.sm-sub { margin: 6px 0 8px; padding-top: 6px; }
.sm-subtitle { display: inline; font-size: 15px; font-weight: 650; line-height: 1.45; color: var(--text); }
.sm-subtitle:hover { color: var(--brand); }
.sm-n { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--bg-muted); font-size: 12px; font-weight: 600; color: var(--text-3); }
.sm-sub > .sm-list { margin: 6px 0 0 4px; padding-left: 12px; border-left: 2px solid var(--line); }
.sm-empty { margin-top: 4px; }
@media print { .sm-filter { display: none; } .sm-grid { columns: 2; } }

/* ===== Trợ lý AI cho khách: link trong ô tìm kiếm, nút nổi, khung chat, trang /hoi-ai ===== */
.search-ai-link { display: flex; align-items: center; gap: 8px; width: calc(100% - 8px); margin: 8px 4px 6px; padding: 10px 14px; border: 1px dashed color-mix(in srgb, var(--brand) 35%, transparent); border-radius: 12px; background: none; color: var(--brand); font: inherit; font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer; }
.search-ai-link > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-ai-link:hover, .search-ai-link:focus-visible { background: var(--brand-softer); border-style: solid; }
.search-ai-link.is-strong { background: linear-gradient(135deg, var(--brand-soft), var(--brand-softer)); border-style: solid; margin-bottom: 12px; }
.search-ai-go { font-weight: 700; }

.ai-fab-btn { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); border-radius: 999px; background: var(--bg); color: var(--brand); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 10px 26px -12px rgba(26, 86, 219, .55), 0 2px 6px rgba(15, 23, 40, .1); transition: transform .25s var(--ease); }
.ai-fab-btn:hover { transform: translateY(-2px); }
.ai-fab-btn[aria-expanded="true"] { background: var(--brand); color: #fff; }
body.ai-panel-open .contact-menu { display: none; }

.ai-panel { position: fixed; right: 20px; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 46; width: min(400px, calc(100vw - 40px)); height: min(600px, calc(100vh - 230px)); display: flex; flex-direction: column; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; animation: contact-in .25s var(--ease); }
.ai-panel[hidden] { display: none; }
body:not(:has(.contact-btn)) .ai-panel { bottom: calc(84px + env(safe-area-inset-bottom)); }
.ai-panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-bottom: 1px solid var(--line); }
.ai-panel-head .grow { flex: 1; min-width: 0; display: grid; }
.ai-panel-head strong { font-size: 15.5px; color: var(--text); }
.ai-panel-head small { font-size: 12.5px; color: var(--text-3); }
.aic-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 34px; padding: 0 8px; border: 0; border-radius: 10px; background: none; color: var(--text-3); font: inherit; font-size: 14px; cursor: pointer; }
.aic-icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.aic-icon-btn[hidden] { display: none; }
.aic-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #6d4ae6); color: #fff; }
.aic-list { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.aic-msg { display: flex; gap: 8px; }
.aic-user { justify-content: flex-end; }
.aic-user .aic-bubble { max-width: 85%; padding: 9px 14px; border-radius: 16px 16px 4px 16px; background: var(--brand); color: #fff; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.aic-ai .aic-main { flex: 1; min-width: 0; }
.aic-ai .aic-bubble { padding: 10px 14px; border-radius: 4px 16px 16px 16px; background: var(--bg-soft); font-size: 15px; line-height: 1.6; color: var(--text); word-break: break-word; }
.aic-bubble p { margin: 0 0 .55em; } .aic-bubble p:last-child { margin-bottom: 0; }
.aic-bubble ol, .aic-bubble ul { margin: .2em 0 .55em; padding-left: 1.35em; } .aic-bubble li { margin: .2em 0; }
.aic-error { color: var(--text-2); }
.aic-typing { display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); font-size: 14px; }
.aic-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: aic-dot 1.2s infinite ease-in-out; }
.aic-typing i:nth-child(2) { animation-delay: .15s; } .aic-typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes aic-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-caret { display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--brand); border-radius: 2px; animation: ai-blink 1s steps(2) infinite; }
@keyframes ai-blink { 50% { opacity: 0; } }
.ai-cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 6px; background: var(--brand); color: #fff !important; font-size: 11.5px; font-weight: 700; text-decoration: none; vertical-align: 1px; flex-shrink: 0; }
.aic-sources { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.aic-source { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 14px; line-height: 1.35; }
.aic-source:hover { border-color: var(--brand); color: var(--brand); }
.aic-contact { margin-top: 8px; }
.aic-contact .search-contact { margin: 0; }
.aic-welcome { margin: auto 0; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 10px 6px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.aic-welcome strong { color: var(--text); font-size: 16px; }
.aic-welcome-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), #6d4ae6); color: #fff; margin-bottom: 4px; }
.aic-welcome .chips { justify-content: center; margin-top: 8px; }
.aic-compose { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.aic-compose:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.aic-input { flex: 1; min-height: 24px; max-height: 140px; overflow-y: hidden; padding: 7px 0; border: 0; outline: 0; resize: none; background: none; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.45; }
.aic-send { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border: 0; border-radius: 12px; background: var(--brand); color: #fff; cursor: pointer; }
.aic-send:disabled { opacity: .45; cursor: default; }
.aic-note { padding: 6px 14px 10px; font-size: 12px; color: var(--text-3); text-align: center; }

/* Trang /hoi-ai */
.ai-page-wrap { max-width: 820px; margin: 0 auto; padding: 28px 20px 40px; }
.ai-page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.ai-page-head > div { flex: 1; }
.ai-page-head h1 { margin: 0 0 4px; font-size: 28px; }
.ai-page-head p { margin: 0; color: var(--text-2); line-height: 1.55; }
.ai-page-icon { display: grid; place-items: center; width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; background: linear-gradient(135deg, var(--brand), #6d4ae6); color: #fff; }
.ai-page { display: flex; flex-direction: column; height: min(70vh, 720px); border: 1px solid var(--line); border-radius: 20px; background: var(--bg); box-shadow: var(--shadow-lg); overflow: hidden; padding-top: 4px; }
.ai-page .aic-list { padding: 20px; }
.ai-page .aic-compose { margin: 0 16px; }

@media (max-width: 720px) {
    .ai-fab-label { display: none; }
    .ai-fab-btn { width: 52px; height: 52px; padding: 0; justify-content: center; }
    .ai-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; z-index: 60; }
    body.ai-panel-open { overflow: hidden; }
    .ai-page-wrap { padding: 18px 12px 24px; }
    .ai-page-head h1 { font-size: 23px; }
    .ai-page { height: calc(100dvh - 210px); min-height: 420px; }
}
@media print { .ai-panel { display: none !important; } }
.aic-input::placeholder { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
