/* =====================================================================================================================
   hcbaiviet.css — engine BÀI VIẾT (HcBaiViet.js): màn HƯỚNG DẪN SỬ DỤNG + nội dung Markdown + nút "?" topbar.
   Tiền tố lớp hcbv- (CSS nạp toàn cục — CLAUDE.md mục 9).
   ===================================================================================================================== */
.hcbv-hd { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 120px);
    background: #fff; border: 1px solid #dfe4eb; border-radius: 10px; overflow: hidden; }
.hcbv-cho, .hcbv-trongtim { padding: 16px; color: #667085; font-size: 14px; }
.hcbv-loi { margin: 16px; padding: 10px 14px; border-left: 4px solid #b91c1c; background: #fef2f2; border-radius: 6px; }

/* ---- cây mục ---- */
.hcbv-trai { border-right: 1px solid #dfe4eb; background: #fbfcfe; display: flex; flex-direction: column;
    position: sticky; top: 0; max-height: calc(100vh - 120px); }
.hcbv-tim { padding: 12px; border-bottom: 1px solid #eef1f5; display: grid; gap: 8px; }
.hcbv-tim .hc-input { width: 100%; }
.hcbv-loc { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #667085; margin: 0; }
.hcbv-loc select { flex: 1; }
.hcbv-cay { overflow-y: auto; padding: 6px 6px 18px; flex: 1; }
.hcbv-nhan { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-weight: 600; color: #1e3a8a; cursor: pointer;
    border-radius: 6px; user-select: none; font-size: 14px; }
.hcbv-nhan:hover { background: #eef3fb; }
.hcbv-nhan > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcbv-nhan .ti-chevron-right { font-size: 14px; color: #667085; transition: transform .15s; flex: none; }
.hcbv-nhom.mo > .hcbv-nhan .ti-chevron-right { transform: rotate(90deg); }
/* mục con bắt đầu ĐÚNG chỗ biểu tượng/chữ của nhóm cha (mũi tên 14px + khe 6px) — không lùi ra trái hơn cha */
.hcbv-con { display: none; padding-left: 20px; }
.hcbv-nhom.mo > .hcbv-con { display: block; }
.hcbv-muc { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; color: #1f2937; text-decoration: none; font-size: 14px; }
.hcbv-muc:hover { background: #eef3fb; color: #1f2937; }
.hcbv-muc.dang { background: #dbe7ff; color: #1d4ed8; font-weight: 600; }
.hcbv-muc.nhap { color: #9a6b00; }
.hcbv-muc .ti { font-size: 14px; flex: none; }
/* MỘT DÒNG: dài thì "…", di chuột vào hiện đủ tên (title) */
.hcbv-muc > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcbv-kqtim .hcbv-muc { align-items: flex-start; }
.hcbv-kqtim .hcbv-muc .ti { margin-top: 4px; }
.hcbv-kqtim .hcbv-muc > span { white-space: normal; }
.hcbv-muc small { display: block; font-size: 12px; color: #667085; font-weight: 400; }

/* ---- bài ---- */
.hcbv-bai { padding: 18px 30px 60px; min-width: 0; max-width: 900px; }
.hcbv-dau { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 4px; }
.hcbv-nutcay { display: none; }
.hcbv-vet { font-size: 13px; color: #667085; }
.hcbv-bai h1 { font-size: 26px; line-height: 1.3; margin: 2px 0 10px; color: #0f172a; }
.hcbv-the { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hcbv-the span { border: 1px solid #dfe4eb; border-radius: 20px; padding: 1px 11px; font-size: 13px; color: #334155; background: #fff; }
.hcbv-the .hcbv-nhapnhan { background: #fff4e5; border-color: #f5c27a; color: #9a5a00; }
.hcbv-tomtat { font-size: 15.5px; color: #334155; }
.hcbv-noidung, .hcbv-bai { font-size: 15px; line-height: 1.65; }
.hcbv-bai h2 { font-size: 18px; margin: 26px 0 8px; color: #1e3a8a; }
.hcbv-bai h3 { font-size: 16px; margin: 18px 0 6px; color: #1e3a8a; }
.hcbv-noidung ul { padding-left: 22px; }
.hcbv-noidung code { background: #eef2f7; border-radius: 4px; padding: 0 5px; font-size: 13.5px; }
.hcbv-noidung hr { border: 0; border-top: 1px solid #dfe4eb; margin: 22px 0; }
/* danh sách BƯỚC: vòng tròn đánh số + đường dọc nối các bước */
ol.hcbv-buoc { list-style: none; counter-reset: hcbvb; padding: 0; margin: 8px 0; }
ol.hcbv-buoc > li { counter-increment: hcbvb; position: relative; padding: 0 0 16px 44px; }
ol.hcbv-buoc > li::before { content: counter(hcbvb); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
    background: #03045e; color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
ol.hcbv-buoc > li::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 4px; width: 2px; background: #dde3ec; }
ol.hcbv-buoc > li:last-child::after { display: none; }
.hcbv-anh { margin: 10px 0 6px; border: 1px solid #c9d2df; border-radius: 8px; overflow: hidden; background: #fff; }
.hcbv-anh img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.hcbv-bang { margin: 10px 0 14px; overflow-x: auto; }
.hcbv-bang table { border-collapse: collapse; min-width: 60%; font-size: 15px; }
.hcbv-bang th, .hcbv-bang td { border: 1px solid #c9d2df; padding: 7px 12px; }
.hcbv-bang thead th { background: #eef3fa; font-weight: 600; }
.hcbv-bang tbody tr:nth-child(even) td { background: #f8fafc; }
.hcbv-anh figcaption { font-size: 13px; color: #667085; padding: 6px 10px; border-top: 1px solid #eef1f5; }
.hcbv-hop { padding: 9px 14px; border-radius: 6px; margin: 10px 0; border-left: 4px solid; }
.hcbv-hop > :first-child { margin-top: 0; } .hcbv-hop > :last-child { margin-bottom: 0; }
.hcbv-luu { border-color: #b45309; background: #fff4e5; }
.hcbv-meo { border-color: #047857; background: #ecfdf5; }
.hcbv-loi.hcbv-hop, .hcbv-hop.hcbv-loi { border-color: #b91c1c; background: #fef2f2; margin: 10px 0; }
.hcbv-nutpm { display: inline-block; border: 1px solid #c9d2df; border-radius: 6px; padding: 0 7px; font-size: 13px; background: #fff; white-space: nowrap; line-height: 1.6; }
.hcbv-so { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #e11d48; color: #fff;
    font-size: 12px; font-weight: 700; vertical-align: 1px; }
.hcbv-lien { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.hcbv-lien a, .hcbv-o a { display: block; border: 1px solid #dfe4eb; border-radius: 8px; padding: 8px 12px; text-decoration: none; color: #1f2937; font-size: 14px; background: #fff; }
.hcbv-lien a:hover, .hcbv-o a:hover { border-color: #1d4ed8; }
.hcbv-chan { margin-top: 30px; padding-top: 12px; border-top: 1px solid #dfe4eb; display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: space-between; color: #667085; font-size: 13px; }
/* trang đầu: mỗi chuyên mục gốc một ô */
.hcbv-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.hcbv-o { border: 1px solid #dfe4eb; border-radius: 10px; padding: 12px 14px; background: #fbfcfe; display: grid; gap: 6px; align-content: start; }
.hcbv-o h3 { margin: 0 0 2px; }
.hcbv-them { font-size: 13px; color: #667085; }

/* ---- nút "?" topbar: có bài riêng cho màn này thì tô xanh ---- */
#tb-hoi.co-bai { color: #1d4ed8; }

/* ---- điện thoại: cây mục thành ngăn bật/tắt bằng nút "Mục lục" ---- */
@media (max-width: 640px) {
    .hcbv-hd { display: block; border: 0; border-radius: 0; min-height: 0; }
    .hcbv-trai { display: none; position: static; max-height: none; border-right: 0; border-bottom: 1px solid #dfe4eb; }
    .hcbv-hd.hcbv-mocay .hcbv-trai { display: flex; }
    .hcbv-nutcay { display: inline-flex; margin-right: auto; }
    .hcbv-bai { padding: 10px 2px 40px; }
    .hcbv-bai h1 { font-size: 22px; }
    ol.hcbv-buoc > li { padding-left: 38px; }
}

/* ---- in bài: chỉ in nội dung ---- */
@media print {
    .hcbv-trai, .hcbv-dau, .hcbv-chan { display: none !important; }
    .hcbv-hd { display: block; border: 0; }
}
