/* Bố cục admin JX2 (30/10/2026): sidebar trái + thanh trên mỏng + chip máy chủ + đầu trang + khối Hướng dẫn.
   Chỉ dùng màu/biến Bootstrap 5.3; nạp SAU bootstrap.min.css. Khối <style> .trang-tra-cuu vẫn ở layout (test bám). */
:root {
    --sb-rong: 230px;
    /* Hướng A (30/10/2026): sidebar navy, mục active xanh sáng; mỗi nhóm một màu (icon sidebar + vạch tiêu đề + viền card). */
    --sb-nen: #1e2a44; --sb-chu: #c9d3e6; --sb-chu-mo: #8a98b8; --sb-active: #2f6fed; --sb-vien: rgba(255,255,255,.08);
    --mau-tongquan: #2f6fed; --mau-tracuu: #3b82f6; --mau-thu: #a855f7; --mau-sukien: #f59e0b; --mau-hethong: #ef4444;
    --mau-trang: var(--mau-tongquan);
}

/* ---- khung ---- */
.khung-admin { display: flex; min-height: 100vh; align-items: stretch; }
.sb-noi-dung { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sb-noi-dung > main { flex: 1 1 auto; }

/* ---- sidebar (offcanvas-lg: < 992px là offcanvas của Bootstrap, >= 992px là cột cố định) ---- */
.sb { width: var(--sb-rong); }
@media (min-width: 992px) {
    .sb.offcanvas-lg { position: sticky; top: 0; height: 100vh; flex: 0 0 var(--sb-rong); overflow-y: auto; }
    /* offcanvas-lg ép aside/offcanvas-body nền trong suốt + cao auto ⇒ nền trắng ở .sb-than phải tự cao đủ màn hình
       (menu ngắn hơn màn hình vẫn trắng + viền tới đáy; review toàn nhánh 30/10/2026). */
    .sb.offcanvas-lg { background-color: var(--sb-nen) !important; }   /* đè transparent !important của .offcanvas-lg ⇒ cột navy tới đáy dù menu ngắn */
    .sb.offcanvas-lg .sb-than { min-height: 100vh; }                    /* ⛔ phải nặng hơn rule .sb-than gốc ở dưới (cùng selector thì rule sau thắng — lỗi 30/10 14:30) */
}
.sb-than { width: 100%; min-height: 100%; background: var(--sb-nen); color: var(--sb-chu); padding-bottom: 1rem; display: flex; flex-direction: column; }
.sb-menu { flex: 1 1 auto; }
.sb .offcanvas-header { background: var(--sb-nen); color: #fff; border-bottom: 1px solid var(--sb-vien); }
.sb-brand { display: flex; align-items: center; gap: .5rem; padding: .85rem 1.1rem; font-weight: 600; font-size: 1.05rem; color: #fff; text-decoration: none; border-bottom: 1px solid var(--sb-vien); }
.sb-brand .bi { color: #5aa9ff; }
.sb-brand:hover { color: #fff; background: rgba(255,255,255,.04); }
.sb-nhom { padding: .9rem 1.1rem .25rem; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--sb-chu-mo); display: flex; justify-content: space-between; align-items: center; }
.sb-nhom.active { color: #fff; }
.sb-muc { display: flex; align-items: center; gap: .6rem; padding: .42rem 1.1rem .42rem .9rem; color: var(--sb-chu); text-decoration: none; font-size: .92rem; border-left: 3px solid transparent; }
.sb-muc:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-muc.active { background: var(--sb-active); color: #fff; border-left-color: #fff; font-weight: 500; }
.sb-muc .bi { font-size: 1rem; width: 1.15rem; text-align: center; flex: 0 0 auto; }
.sb-khoi[data-nhom="tongquan"] .sb-muc .bi { color: #5aa9ff; }
.sb-khoi[data-nhom="tracuu"] .sb-muc .bi { color: #5aa9ff; }
.sb-khoi[data-nhom="thu"] .sb-muc .bi { color: #c59bff; }
.sb-khoi[data-nhom="sukien"] .sb-muc .bi { color: #ffb454; }
.sb-khoi[data-nhom="hethong"] .sb-muc .bi { color: #ff7a7a; }
/* Đặt SAU các dòng màu nhóm và có .sb-khoi: .sb-khoi[data-nhom] .sb-muc .bi nặng 0,4,0 sẽ đè .sb-muc.active .bi (0,3,0). */
.sb-khoi .sb-muc.active .bi { color: #fff; }
.sb-muc .badge { margin-left: auto; }
/* Khối tài khoản cuối sidebar (mẫu 30/10/2026): avatar chữ cái đầu + tên + vai trò; bấm mở dropup "Đăng xuất". */
.sb-nguoi { border-top: 1px solid var(--sb-vien); padding: .6rem .9rem; }
.sb-nguoi-nut { display: flex; align-items: center; gap: .6rem; width: 100%; background: none; border: 0; color: var(--sb-chu); padding: .35rem .4rem; border-radius: .5rem; text-align: left; }
.sb-nguoi-nut:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; background: #2f6fed; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; }
.sb-nguoi-chu { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.sb-nguoi-ten { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nguoi-vai { align-self: flex-start; font-size: .68rem; font-weight: 500; background: rgba(255,255,255,.12) !important; color: var(--sb-chu); }

/* ---- thanh trên ---- */
.thanh-tren { background: #fff; border-bottom: 1px solid #dee2e6; padding: .45rem 1rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1010; }
/* Breadcrumb "🏠 › Quản trị › Tên trang" (mẫu 30/10/2026); khung breadcrumb là khoảng đệm đẩy nút ? / máy chủ / chip sang phải. */
.ten-trang-khung { margin-right: auto; min-width: 0; }
.thanh-tren .breadcrumb { font-size: .9rem; --bs-breadcrumb-divider: '›'; flex-wrap: nowrap; }
.thanh-tren .breadcrumb-item a { color: #6c757d; }
.thanh-tren .breadcrumb-item.active { min-width: 0; }
.thanh-tren .ten-trang { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thanh-tren .breadcrumb-item.active .ten-trang { font-weight: 600; color: #212529; }
.thanh-tren .form-select-sm { min-width: 9rem; }
.nut-tro-giup-trang { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
/* Chip trạng thái máy chủ đang chọn: đọc JSON cron (ThongKeOnline) — xanh = số mới, vàng = số cũ > 20 phút, xám = chưa có. */
.chip-tt { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; padding: .25rem .7rem; border-radius: 1rem; white-space: nowrap; }
.chip-tt .bi { font-size: .5rem; }
.chip-tt-ok { background: #e6f7ef; color: #0f6e56; }
.chip-tt-cu { background: #fff3cd; color: #664d03; }
.chip-tt-khong { background: #f1f3f5; color: #6c757d; }
/* Màn hẹp (< 768px): thanh trên không tràn ngang — breadcrumb chỉ còn tên trang (co giãn, cắt "…");
   chip trạng thái ẩn (nút ? và ô máy chủ giữ); nhãn "Máy chủ" ẩn kiểu visually-hidden (trình đọc màn hình vẫn đọc);
   ô chọn máy chủ co lại. */
@media (max-width: 767.98px) {
    .thanh-tren { gap: .5rem; }
    .thanh-tren .ten-trang-khung { flex: 1 1 0; min-width: 0; }
    .thanh-tren .breadcrumb-item:not(.active) { display: none; }
    .thanh-tren .breadcrumb-item.active { padding-left: 0; }
    .thanh-tren .breadcrumb-item.active::before { display: none; }   /* mục trước đã ẩn nhưng vẫn là anh em ⇒ bỏ dấu › thừa */
    .thanh-tren .chip-tt { display: none; }
    .thanh-tren label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
    .thanh-tren .form-select-sm { min-width: 0; max-width: 11rem; }
}

/* ---- màu theo nhóm trên nội dung ---- */
.sb-noi-dung { background: #f3f5f9; }
main[data-nhom="tracuu"]  { --mau-trang: var(--mau-tracuu); }
main[data-nhom="thu"]     { --mau-trang: var(--mau-thu); }
main[data-nhom="sukien"]  { --mau-trang: var(--mau-sukien); }
main[data-nhom="hethong"] { --mau-trang: var(--mau-hethong); }
.dau-trang h3 { border-left: 4px solid var(--mau-trang); padding-left: .6rem; line-height: 1.15; }
/* main[data-nhom] .card (0,2,1) chứ không phải .card: dòng ".card { border-color: … }" ở cuối file cùng độ nặng, đứng sau, sẽ trả viền trên về xám. */
main[data-nhom] .card { border-top: 3px solid var(--mau-trang); }
main[data-nhom] .card.bg-primary-subtle, main[data-nhom] .card.bg-info-subtle, main[data-nhom] .card.bg-success-subtle, main[data-nhom] .card.bg-danger-subtle, main[data-nhom] .card.bg-warning-subtle { border-top-width: 1px; }
.nut-huong-dan { color: #495057; border-color: #ced4da; }
.nut-huong-dan:hover, .nut-huong-dan[aria-expanded="true"] { background: #fff3cd; border-color: #ffe69c; color: #664d03; }

/* ---- chip máy chủ (thay 3 dải thông báo cũ) ---- */
.chip-sv { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: #6c757d; padding: .15rem .65rem; border-radius: 1rem; margin-bottom: .75rem; background: #f1f3f5; max-width: 100%; }
.chip-sv-xanh { background: #e0ecff; color: #1d4ed8; }
.chip-sv strong { font-weight: 600; }

/* ---- đầu trang ---- */
.dau-trang { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem .75rem; margin-bottom: 1rem; }
.dau-trang h3 { font-weight: 600; }
.dau-trang-nut { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip-phu { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; background: #f1f3f5; color: #495057; border-radius: 1rem; padding: .15rem .6rem; text-decoration: none; }
.chip-phu:hover { background: #e2e6ea; color: #0d6efd; }

/* ---- khối Hướng dẫn + icon trợ giúp ---- */
.huong-dan { margin-bottom: 1rem; }
.huong-dan-than { background: #fffbe6; border: 1px solid #ffe69c; border-radius: .5rem; padding: .75rem 1rem; font-size: .875rem; color: #3d3d3d; }
.huong-dan-than ul { margin-bottom: 0; padding-left: 1.2rem; }
.huong-dan-than li + li { margin-top: .3rem; }
.huong-dan-than .form-text { font-size: inherit; color: inherit; margin: 0; }
.tro-giup { color: #6c757d; cursor: help; margin-left: .25rem; font-size: .9rem; vertical-align: middle; }
.tro-giup:hover, .tro-giup:focus { color: #0d6efd; outline: none; }

/* ---- ô thống kê Tổng quan ---- */
.chi-tiet-o summary { cursor: pointer; color: #6c757d; font-size: .78rem; list-style: none; }
.chi-tiet-o summary::before { content: '▸ '; }
.chi-tiet-o[open] summary::before { content: '▾ '; }
.chi-tiet-o .small { margin-top: .25rem; }

/* ---- Tổng quan ---- */
.the-so-icon { width: 44px; height: 44px; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: 0 0 auto; }
.the-so-icon-xanh { background: #e0ecff; color: #2f6fed; }
.the-so-icon-la { background: #e6f7ef; color: #1d9e75; }
.the-so-icon-duong { background: #e8f0fe; color: #3b5bdb; }
.the-so-icon-cam { background: #fff1e0; color: #d97706; }
.the-so-nhan { font-size: .85rem; color: #495057; }
.the-so-gia-tri { font-size: 1.9rem; font-weight: 700; line-height: 1.15; color: #1e2a44; }
.the-so-phu { font-size: .8rem; color: #6c757d; }
.tt-sv { display: flex; align-items: center; gap: .6rem; border: 1px solid #e4e7ea; border-radius: .5rem; padding: .55rem .75rem; margin-bottom: .5rem; }
.tt-ma { font-weight: 600; width: 2rem; }
.tt-cham { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.tt-cham-ok { background: #1d9e75; }
.tt-cham-cu { background: #f59e0b; }
.tt-cham-khong { background: #adb5bd; }

/* ---- làm nhẹ card/bảng chung ---- */
.card { border-color: #e4e7ea; }
.card-header { background: #f8f9fa; font-weight: 500; }
