/* =============================================================================
   Cổng tin tức Ban CNTT — CSS thuần, không framework.
   Mục tiêu: Lighthouse Performance/SEO >= 90, tương phản đạt WCAG AA,
   không tải font ngoài (dùng font hệ thống) để không phát sinh request chặn render.
   ============================================================================= */

/* Màu và font theo Bộ nhận diện thương hiệu Đại học Trà Vinh
   (QĐ 10003/QĐ-ĐHTV ngày 14/11/2023). Giải thích từng token + bảng kiểm tra
   tương phản WCAG: docs/BRAND-TVU.md và docs/brand-tokens.css. */
:root {
    --brand:        #053384;   /* CHÍNH THỨC — xanh dương chủ đạo của Logo */
    --brand-dark:   #04296A;   /* phái sinh: tối 20%, dùng cho hover và tiêu đề */
    --brand-light:  #E6EBF3;   /* phái sinh: tint 10%, nền thẻ/tag */
    --accent:       #007500;   /* CHÍNH THỨC — xanh lá; 5,92:1 trên nền trắng */
    --brand-yellow: #FFFF00;   /* CHÍNH THỨC — vàng truyền thống, CHỈ dùng trên nền tối */
    /* Vạch 3 màu nhận diện TVU (header/chân trang/tiêu đề mục) — BẤT BIẾN trên mọi tenant/bộ giao diện (AI_RULES D.3 BR-9).
       KHÔNG được ghi đè --bb1/2/3 ở bất kỳ đâu (theme, SiteInfoProvider, CSS riêng đơn vị). */
    --bb1:          #053384;   /* xanh dương */
    --bb2:          #007500;   /* xanh lá */
    --bb3:          #F2C200;   /* vàng gold */
    --ink:          #0E1726;
    --ink-soft:     #51607A;
    --line:         #DAE0ED;
    --bg:           #FFFFFF;
    --bg-soft:      #F5F7FA;
    --radius:       10px;
    --shadow:       0 1px 2px rgb(16 32 48 / 6%), 0 8px 24px rgb(16 32 48 / 6%);
    --maxw:         1120px;
    /* UTM Futura trong bộ nhận diện KHÔNG được nhúng làm webfont (giấy phép phi
       thương mại). Roboto chỉ dùng nếu máy người đọc đã cài — không tải font ngoài. */
    --font: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial,
            "Noto Sans", "Liberation Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Chuyển trang mượt (bỏ "chớp" trắng): hòa mờ toàn trang khi điều hướng giữa các
   tài liệu. Không đặt tên riêng cho header/footer để tránh nháy menu khi trang đích
   nạp chậm. Thuần CSS; trình duyệt chưa hỗ trợ sẽ điều hướng như cũ. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--page-bg, var(--bg));
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }

.sr-only, .skip-link:not(:focus) {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link:focus {
    position: fixed; inset-block-start: 8px; inset-inline-start: 8px; z-index: 100;
    background: var(--bg); color: var(--brand); padding: 10px 16px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Header (dính khi cuộn) ---------- */
.site-header {
    background: var(--header-bg, var(--bg));
    /* Ảnh nền do quản trị đặt (Appearance.HeaderBackgroundUrl) truyền qua biến --header-bg-image (không dùng inline
       background-image) để media query mobile ghi đè được mà không cần !important. */
    background-image: var(--header-bg-image, none);
    background-size: var(--header-bg-size, cover);
    background-position: center;
    background-repeat: no-repeat;
    position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 8px rgb(16 32 48 / 6%);
}
/* Nền đầu trang có chuyển động: người dùng bật "giảm chuyển động" → bỏ ảnh nền động (nền màu/vạch 3 màu vẫn giữ). */
@media (prefers-reduced-motion: reduce) {
    .site-header[data-hbg-anim] { background-image: none !important; }
}
/* Vạch 3 màu nhận diện thương hiệu — đặt Ở TRÊN thanh menu (ranh giới dải logo và menu),
   gắn bằng CSS nên LUÔN hiển thị dù ảnh nền bị background-size:cover cắt, và áp dụng cho MỌI ảnh nền.
   KHÔNG đặt ở đáy header để tránh đè lên gạch vàng "mục đang chọn" của menu. */
.site-nav { position: relative; }
.site-nav::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; z-index: 3;
    background: linear-gradient(to right,
        var(--bb1) 0 36%, var(--bb2) 36% 68%, var(--bb3) 68% 100%);
}

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-block: 14px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { text-decoration: none; }

/* Ảnh tùy chọn BÊN PHẢI vùng logo (Appearance.HeaderRightImage*): chỉ khi đơn vị bật + chọn ảnh. Cao theo --hr-h (mặc định 72px),
   rộng theo tỷ lệ ảnh (object-fit: contain), tối đa ~46% bề ngang → không bao giờ làm tràn ngang. Di động: ẩn (mặc định) hoặc hiện nhỏ ≤ 40px. */
.header-right { display: flex; align-items: center; flex: 0 1 auto; margin-left: auto; min-width: 0; color: inherit; }
.header-right:hover { text-decoration: none; }
.header-right img { display: block; height: var(--hr-h, 72px); width: auto; max-width: min(46vw, 460px); object-fit: contain; }
.header-inner.has-right .brand { min-width: 0; }   /* chỉ khi có ảnh phải: logo/tên được co để nhường chỗ, không xuống dòng */
@media (max-width: 820px) {
    .header-right--hide { display: none; }
    .header-right--small img { height: min(var(--hr-h, 72px), 40px); max-width: 34vw; }
}

/* Vùng an toàn quanh logo: tài liệu không quy định con số, dùng khoảng cách
   bằng ~1/6 chiều cao logo cho tới phần chữ bên cạnh. */
/* Logo đầu trang: cao theo --header-logo-size, RỘNG tự do (object-fit contain) để nhận cả logo VUÔNG
   (giữ nguyên như cũ: width auto = height) lẫn logo NGANG dạng banner (vd logo "20 năm" có chữ) — co
   theo bề rộng màn hình (max-width) nên hiện TRỌN trên cả di động. */
.brand-logo { width: auto; height: var(--header-logo-size, 48px); max-width: min(72vw, 360px); object-fit: contain; flex: 0 0 auto; }

/* CHẾ ĐỘ BANNER đầu trang: ảnh nguyên khối hiện như <img> CO GIÃN đầy chiều ngang.
   max-height: 280px + object-fit:cover để ảnh to/vuông không chiếm hết màn hình.
   Ảnh mỏng đúng chuẩn (≥1600×80-180px) hiện nguyên tỷ lệ, ảnh quá cao bị cắt phần dưới. */
/* Banner hiện TẠI VỊ TRÍ LOGO (BannerImageSize=logo): giữ tỷ lệ ảnh, width = auto, height theo HeaderLogoSize. */
/* Banner ở vị trí logo: cao theo --banner-h (Appearance.BannerImageHeight, mặc định 72px), rộng tự theo tỷ lệ; không tràn khung. */
.brand .brand-logo.brand-banner-logo { width: auto; height: var(--banner-h, 72px); max-width: 100%; object-fit: contain; object-position: left center; }
/* Banner bung HẾT chiều rộng màn hình (bỏ giới hạn .container + lề) → không hở 2 dải hai bên trên desktop. */
.site-header .header-inner--banner { position: relative; padding: 0; display: block; max-width: none; width: 100%; }
.header-banner { display: block; width: 100%; line-height: 0; }
.header-banner img { width: 100%; height: auto; display: block; max-height: 280px; object-fit: cover; object-position: center top; }
.header-inner--banner .lang-switch, .header-inner--banner .langswitch { position: absolute; top: 50%; transform: translateY(-50%); right: 16px; z-index: 3; }
/* Ảnh nền header (Appearance.HeaderBackgroundUrl): MỘT bản duy nhất — background CSS của .site-header, nằm sau dải logo (thanh menu đặc che phần dưới).
   Desktop và mobile dùng CÙNG quy tắc (background-size theo cài đặt "cover/contain/stretch", mặc định cover) nên tự co theo bề ngang như nhau.
   Không có khối ảnh thứ hai dưới thanh menu (trước đây thêm khối đó nên ảnh hiện 2 lần, còn dải logo bị trắng). */
/* Icon kính lúp trong nav-inner — desktop; click mở panel bên dưới nav-bar */
.nav-inner > .nav-search-btn {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; flex-shrink: 0; width: 38px; height: 38px; align-self: center;
    cursor: pointer; color: var(--menu-text, #eaf2fb); border-radius: var(--radius);
    background: var(--menu-ctl-bg, rgb(255 255 255 / 12%)); border: 1px solid var(--menu-ctl-bd, rgb(255 255 255 / 20%));
    transition: background .15s, opacity .15s;
}
.nav-inner > .nav-search-btn:hover { background: var(--menu-hover, rgb(255 255 255 / 25%)); }
.nav-inner > .nav-search-btn svg { width: 17px; height: 17px; }
@media (max-width: 820px) {
    .nav-inner > .nav-search-btn { display: none; }  /* mobile dùng nav-mobile-search */
}
/* Menu TIÊU CHUẨN (không mega): icon tìm kiếm di động nằm sát mép phải thanh menu (mega đã có brand ở giữa nên không cần) */
@media (max-width: 820px) { .site-nav:not(.site-nav--mega) .nav-bar .nav-mobile-search { margin-left: auto; } }
/* Mobile search icon style (nav-mobile-search dùng .search-icon) */
.nav-bar .search-icon { width: 36px; height: 36px; background: var(--menu-ctl-bg, rgb(255 255 255 / 15%)); border-color: var(--menu-ctl-bd, rgb(255 255 255 / 25%)); color: var(--menu-ctl-fg, #eaf2fb); }
.nav-bar .search-icon:hover { background: var(--menu-hover, rgb(255 255 255 / 28%)); color: var(--menu-hover-text, #fff); }
.nav-bar .search-icon svg { width: 17px; height: 17px; }
.nav-bar .search-input { background: var(--menu-ctl-bg, rgb(255 255 255 / 10%)); color: var(--menu-ctl-fg, #fff); border-color: var(--menu-ctl-bd, rgb(255 255 255 / 30%)); }
.nav-bar .search-input::placeholder { color: var(--menu-ctl-ph, rgb(255 255 255 / 55%)); }
.nav-bar .search-input:focus { border-color: var(--menu-ctl-fg, rgb(255 255 255 / 70%)); }
.nav-bar .search-toggle:checked ~ .search-input { width: min(200px, 40vw); padding: 6px 10px; }
.nav-bar .search-toggle:checked ~ .search-go { width: 36px; height: 36px; }
.nav-bar .search-go svg { width: 17px; height: 17px; }
@media (max-width: 820px) {
    .nav-bar .search-toggle:checked ~ .search-input { width: min(180px, 50vw); }
}
/* === Panel tìm kiếm dropdown bên dưới nav-bar (desktop) — giống tvu.edu.vn === */
.nav-search-panel-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
/* Ô tìm kiếm GỌN thả xuống ngay dưới kính lúp (canh phải khung nội dung) — KHÔNG phải dải trắng tràn hết chiều ngang màn hình.
   Panel trong suốt + không bắt chuột; chỉ <form> bên trong là hộp nổi (pointer-events: auto). */
.nav-search-panel { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 40; pointer-events: none; }
.nav-search-panel-toggle:checked ~ .nav-search-panel { display: block; }
@media (max-width: 820px) { .nav-search-panel-toggle:checked ~ .nav-search-panel { display: none; } }
.nav-search-panel .container { display: flex; justify-content: flex-end; padding-block: 8px 0; }
.nav-search-panel form {
    pointer-events: auto; display: flex; align-items: center; gap: 8px;
    background: #fff; padding: 10px; border: 1px solid var(--line, #d6dbe3);
    border-top: 3px solid var(--menu-accent, var(--brand, #003087)); border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
}
.nav-search-panel-input {
    width: min(260px, 40vw); flex-shrink: 0;
    padding: 8px 12px; border: 1px solid #ccc; border-radius: var(--radius);
    font: inherit; font-size: 15px; color: var(--ink); background: #fff; outline: none;
}
.nav-search-panel-input:focus { border-color: var(--brand); }
.nav-search-panel-btn {
    flex-shrink: 0; padding: 9px 16px; border: none; border-radius: var(--radius);
    background: var(--brand, #003087); color: #fff;
    font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s;
}
.nav-search-panel-btn:hover { background: var(--brand-dark, #002070); }
/* Mobile brand inline trong nav-bar (BannerMode + mobile): ≡ | logo+tên | 🔍 — giống tvu.edu.vn */
/* Dùng selector .nav-bar .xxx để specificity cao hơn .search { display:flex } bên dưới */
.nav-bar .nav-mobile-brand { display: none; flex: 1 1 auto; }
.nav-bar .nav-mobile-search { display: none; }
@media (max-width: 820px) {
    /* BannerMode mobile: banner xuống dưới nav-bar, responsive — flex-column reorder */
    .site-header--banner { display: flex; flex-direction: column; }
    .site-header--banner > .site-nav { order: 1; }
    .site-header--banner > .header-inner--banner {
        order: 2; display: block; width: 100%;
        /* bỏ khoảng cách dọc; ảnh chiếm đầy chiều ngang */
    }
    /* Fallback: header KHÔNG phải banner-mode → ẩn như cũ */
    .site-header:not(.site-header--banner) .header-inner--banner { display: none; }
    .nav-bar .nav-mobile-brand {
        display: flex; align-items: center; gap: 8px;
        overflow: hidden; padding: 0 8px;
        color: var(--menu-text, #eaf2fb); text-decoration: none;
    }
    .nav-bar .nav-mobile-brand:hover { opacity: 0.9; text-decoration: none; }
    /* Cao 36px, rộng theo tỷ lệ thật (tối đa 120px): logo vuông vẫn 36×36, logo NGANG (lockup) không bị méo/cắt bởi khung tròn cũ. */
    .nav-bar .nav-mobile-brand img { width: auto; height: 36px; max-width: 120px; flex-shrink: 0; object-fit: contain; }
    .nav-mobile-brand-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .nav-bar .nav-mobile-search { display: flex; }
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 19px; color: var(--header-text, var(--brand-dark)); }
.brand-text small { font-size: var(--brand-sub-size, 13px); color: var(--brand-sub-color, var(--ink-soft));
    font-weight: 600; }

/* Header brand thu nhỏ trên mobile — không dùng nav-bar brand nữa, header-inner hiển thị cả hai nền */
@media (max-width: 820px) {
    .brand-logo { height: 40px; }
    /* Điện thoại: banner thu nhỏ tối đa 56px cao (vẫn theo cài đặt nếu nhỏ hơn) */
    .brand .brand-logo.brand-banner-logo { height: min(var(--banner-h, 72px), 56px); }
    .brand-text strong { font-size: 14px; }
    .brand-text small { font-size: 11px; }
    /* Ẩn slogan (dòng <small> cuối) trên mobile — dòng tên trường và tên đơn vị đủ rồi */
    .brand-text small:last-of-type { display: none; }
}

/* ---------- Ô tìm kiếm ---------- */
/* ---- Tìm kiếm thu gọn: icon kính lúp -> bấm mở ô nhập (thuần CSS) ---- */
.search { display: flex; align-items: center; gap: 8px; }
.search-toggle { position: absolute; opacity: 0; width: 0; height: 0; }   /* checkbox điều khiển, ẩn */

/* Icon kính lúp (nhãn bật/tắt) — trạng thái thu gọn mặc định */
.search-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg); color: var(--brand); cursor: pointer; transition: background .15s, color .15s;
}
.search-icon:hover { background: var(--brand); color: #fff; }
.search-icon svg { width: 20px; height: 20px; }

/* Ô nhập: thu gọn (rộng 0) mặc định, mở rộng khi checkbox được tick */
.search-input {
    width: 0; opacity: 0; padding: 0; margin: 0; border: 1px solid transparent;
    border-radius: var(--radius); font: inherit; min-width: 0; background: var(--bg); color: var(--ink);
    transition: width .25s ease, opacity .18s, padding .2s;
}
.search-go { display: none; }

.search-toggle:checked ~ .search-icon { display: none; }
.search-toggle:checked ~ .search-input {
    width: 240px; opacity: 1; padding: 10px 13px; border-color: var(--line);
}
.search-toggle:checked ~ .search-input:focus { border-color: var(--brand); }
.search-toggle:checked ~ .search-go {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: 0; border-radius: var(--radius);
    background: var(--brand); color: #fff; cursor: pointer;
}
.search-toggle:checked ~ .search-go:hover { background: var(--brand-dark); }
.search-go svg { width: 20px; height: 20px; }

/* Ô tìm kiếm trên trang kết quả (không thu gọn) */
.search-form { display: flex; gap: 8px; margin-bottom: 26px; }
.search-form input {
    padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--radius);
    font: inherit; min-width: 0; background: var(--bg); color: var(--ink); flex: 1 1 auto; max-width: 460px;
}
.search-form input:focus { border-color: var(--brand); }
.search-form button {
    padding: 9px 16px; border: 0; border-radius: var(--radius);
    background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.search-form button:hover { background: var(--brand-dark); }
.search-form button svg { display: block; }

@media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; }
    .search-toggle:checked ~ .search-input { width: 60vw; }
}

/* ---------- Bài liên quan ---------- */
.related { margin-top: 48px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Preloader: màn chờ tải trang (admin bật/tắt, chọn kiểu + màu) ---------- */
.preloader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    transition: opacity .45s ease, visibility .45s ease;
}
.preloader.is-hidden { opacity: 0; visibility: hidden; }
/* Vạch 3 màu thương hiệu mảnh dưới đáy màn chờ cho có nhận diện */
.preloader::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
    background: linear-gradient(to right, var(--bb1) 0 36%, var(--bb2) 36% 68%, var(--bb3) 68% 100%);
    opacity: .9;
}

/* Kiểu 1 — Vòng xoay (ring) */
.pl-ring {
    width: 54px; height: 54px; border-radius: 50%;
    border: 5px solid var(--line); border-top-color: var(--pl-color, #053384);
    animation: plSpin .8s linear infinite;
}
@keyframes plSpin { to { transform: rotate(360deg); } }

/* Kiểu 2 — Ba chấm nảy (dots) */
.pl-dots { display: flex; gap: 10px; }
.pl-dots span {
    width: 14px; height: 14px; border-radius: 50%; background: var(--pl-color, #053384);
    animation: plBounce 1.2s ease-in-out infinite;
}
.pl-dots span:nth-child(2) { animation-delay: .16s; }
.pl-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes plBounce { 0%, 80%, 100% { transform: scale(.5); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* Kiểu 3 — Thanh nhịp (bars) */
.pl-bars { display: flex; gap: 6px; align-items: flex-end; height: 44px; }
.pl-bars span {
    width: 8px; height: 100%; border-radius: 3px; background: var(--pl-color, #053384);
    transform-origin: bottom; animation: plBar 1s ease-in-out infinite;
}
.pl-bars span:nth-child(2) { animation-delay: .12s; }
.pl-bars span:nth-child(3) { animation-delay: .24s; }
.pl-bars span:nth-child(4) { animation-delay: .36s; }
@keyframes plBar { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* Kiểu 4 — Logo TVU đập nhẹ (logo) — cỡ do quản trị đặt qua --pl-logo-size (mặc định 60px) */
.pl-logo img { width: var(--pl-logo-size, 60px); height: var(--pl-logo-size, 60px); animation: plPulse 1.2s ease-in-out infinite; }
@keyframes plPulse { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.06); opacity: 1; } }

/* Kiểu 5 — Vòng xoay kép (dual): hai vòng xoay ngược chiều */
.pl-dual { position: relative; width: 54px; height: 54px; }
.pl-dual span { position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; }
.pl-dual span:nth-child(1) { border-top-color: var(--pl-color, #053384); animation: plSpin .9s linear infinite; }
.pl-dual span:nth-child(2) { border-bottom-color: var(--pl-color, #053384); opacity: .45; animation: plSpin 1.4s linear infinite reverse; }

/* Kiểu 6 — Gợn sóng (ripple): vòng tròn lan tỏa */
.pl-ripple { position: relative; width: 60px; height: 60px; }
.pl-ripple span { position: absolute; left: 50%; top: 50%; border: 3px solid var(--pl-color, #053384);
    border-radius: 50%; transform: translate(-50%, -50%); animation: plRipple 1.4s cubic-bezier(0, .2, .8, 1) infinite; }
.pl-ripple span:nth-child(2) { animation-delay: -.7s; }
@keyframes plRipple { 0% { width: 0; height: 0; opacity: .9; } 100% { width: 58px; height: 58px; opacity: 0; } }

/* Kiểu 7 — Nhịp tròn (pulse): chấm tròn phình rồi mờ dần */
.pl-pulse { width: 48px; height: 48px; border-radius: 50%; background: var(--pl-color, #053384); animation: plPulseScale 1s ease-in-out infinite; }
@keyframes plPulseScale { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

/* Kiểu 8 — Lưới chấm (grid): 9 ô nảy so le */
.pl-grid { display: grid; grid-template-columns: repeat(3, 12px); gap: 6px; }
.pl-grid span { width: 12px; height: 12px; border-radius: 3px; background: var(--pl-color, #053384); animation: plGrid 1.3s ease-in-out infinite; }
.pl-grid span:nth-child(1) { animation-delay: 0s; }
.pl-grid span:nth-child(2) { animation-delay: .1s; }
.pl-grid span:nth-child(3) { animation-delay: .2s; }
.pl-grid span:nth-child(4) { animation-delay: .1s; }
.pl-grid span:nth-child(5) { animation-delay: .2s; }
.pl-grid span:nth-child(6) { animation-delay: .3s; }
.pl-grid span:nth-child(7) { animation-delay: .2s; }
.pl-grid span:nth-child(8) { animation-delay: .3s; }
.pl-grid span:nth-child(9) { animation-delay: .4s; }
@keyframes plGrid { 0%, 70%, 100% { transform: scale(.4); opacity: .4; } 35% { transform: scale(1); opacity: 1; } }

/* Kiểu 9 — Sóng chấm (wave): 5 chấm nhấp nhô */
.pl-wave { display: flex; gap: 7px; align-items: center; height: 44px; }
.pl-wave span { width: 10px; height: 10px; border-radius: 50%; background: var(--pl-color, #053384); animation: plWave 1s ease-in-out infinite; }
.pl-wave span:nth-child(2) { animation-delay: .1s; }
.pl-wave span:nth-child(3) { animation-delay: .2s; }
.pl-wave span:nth-child(4) { animation-delay: .3s; }
.pl-wave span:nth-child(5) { animation-delay: .4s; }
@keyframes plWave { 0%, 100% { transform: translateY(6px); opacity: .5; } 50% { transform: translateY(-10px); opacity: 1; } }

/* Kiểu 10 — Quỹ đạo (orbit): chấm chạy quanh vòng mờ */
.pl-orbit { position: relative; width: 54px; height: 54px; animation: plSpin 1s linear infinite; }
.pl-orbit::before { content: ""; position: absolute; inset: 2px; border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--pl-color, #053384) 22%, transparent); }
.pl-orbit span { position: absolute; top: 0; left: 50%; width: 12px; height: 12px; margin-left: -6px;
    border-radius: 50%; background: var(--pl-color, #053384); }

/* Kiểu 11 — Logo TVU trong vòng xoay + dải 3 màu (nhận diện thương hiệu) */
.pl-logoring { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pl-logoring .plr-logo { position: relative; display: grid; place-items: center;
    width: calc(var(--pl-logo-size, 60px) + 30px); height: calc(var(--pl-logo-size, 60px) + 30px); }
.pl-logoring .plr-logo img { width: var(--pl-logo-size, 60px); height: var(--pl-logo-size, 60px); animation: plPulse 1.4s ease-in-out infinite; }
.pl-logoring .plr-ring { position: absolute; inset: 0; border-radius: 50%;
    border: 4px solid var(--line, #e5e9f0); border-top-color: var(--pl-color, #053384); animation: plSpin .9s linear infinite; }
.pl-logoring .plr-bar { width: 132px; height: 3px; border-radius: 3px; opacity: .85;
    background: linear-gradient(to right, var(--bb1) 0 36%, var(--bb2) 36% 68%, var(--bb3) 68% 100%); }

@media (prefers-reduced-motion: reduce) {
    .preloader *, .preloader *::before, .preloader *::after { animation: none !important; }
}

/* ---------- Dải thông báo "Có gì mới" ---------- */
.announce-bar { background: linear-gradient(90deg, var(--brand-dark), var(--brand)); color: #fff; font-size: 14px; }
.announce-inner { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.announce-badge {
    background: var(--brand-yellow); color: #3a2e00; font-weight: 700; font-size: 12px;
    padding: 2px 9px; border-radius: 999px; flex: 0 0 auto;
}
.announce-msg { flex: 1 1 auto; min-width: 0; }
.announce-msg strong { color: var(--brand-yellow); }
.announce-link { color: #fff; font-weight: 600; text-decoration: underline; white-space: nowrap; flex: 0 0 auto; }
.announce-link:hover { color: var(--brand-yellow); }
.announce-close {
    background: transparent; border: 0; color: #dbe6f5; font-size: 16px; line-height: 1;
    cursor: pointer; padding: 2px 6px; flex: 0 0 auto;
}
.announce-close:hover { color: #fff; }

/* ---------- Dải thông báo TOÀN HỆ THỐNG (trang mẹ đẩy xuống, bắt buộc, không đóng) ---------- */
.sysannounce-bar { color: #fff; font-size: 14px; }
.sysannounce-inner { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.sysannounce-badge { font-size: 16px; line-height: 1; flex: 0 0 auto; }
.sysannounce-msg { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.sysannounce-link { color: #fff; font-weight: 700; text-decoration: underline; white-space: nowrap; flex: 0 0 auto; }
.sysannounce-link:hover { opacity: .85; }
/* Sắc thái theo mức — mã màu cố định (độc lập bộ giao diện) để tín hiệu hệ thống luôn nhận ra được */
.sysannounce-info     { background: linear-gradient(90deg, #0b3d91, #1657c7); }
.sysannounce-warning  { background: linear-gradient(90deg, #8a5a00, #c98a00); }
.sysannounce-critical { background: linear-gradient(90deg, #8e1f1f, #c62828); }
/* Chạy chữ (marquee/ticker) — nội dung cuộn ngang liên tục; rê chuột để tạm dừng */
.sysannounce-marquee { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.sysannounce-marquee .sysannounce-track { display: inline-flex; gap: 3rem; white-space: nowrap; will-change: transform; animation: sys-ticker 22s linear infinite; }
.sysannounce-marquee:hover .sysannounce-track { animation-play-state: paused; }
.sysannounce-marquee .sysannounce-msg { flex: 0 0 auto; }
@keyframes sys-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
    .sysannounce-marquee { overflow: visible; }
    .sysannounce-marquee .sysannounce-track { animation: none; white-space: normal; }
    .sysannounce-marquee .sysannounce-track .sysannounce-msg[aria-hidden="true"] { display: none; }
}

/* ---------- Nav chuyên mục ---------- */
/* Nền menu chính: theo màu bộ giao diện (--menu-bg); chưa đặt = màu thương hiệu như cũ. */
.site-nav { background: var(--menu-bg, var(--brand)); }

.nav-bar { display: flex; align-items: center; flex-wrap: wrap; }

/* Checkbox điều khiển menu di động (chỉ giữ trạng thái, không hiển thị) */
.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; }

/* Nút hamburger — ẩn trên desktop, hiện trên di động */
.nav-burger { display: none; flex-direction: column; gap: 5px; padding: 12px 14px; cursor: pointer; }
.nav-burger span { display: block; width: 24px; height: 2px; background: var(--menu-ctl-fg, #eaf2fb); border-radius: 2px; }

/* Không đặt overflow trên thanh nav: overflow-x:auto sẽ khiến overflow-y tính là
   'auto' theo chuẩn CSS, biến .nav-inner thành khung cuộn cắt mất menu con thả
   xuống (định vị absolute) và sinh thanh cuộn dọc. Cho item xuống dòng thay vì cuộn. */
.nav-inner {
    display: flex; gap: 4px; flex-wrap: wrap; flex: 1 1 auto; justify-content: var(--menu-justify, flex-start);
}

.nav-inner a {
    color: var(--menu-text, #eaf2fb); padding: 12px 10px; white-space: nowrap;
    font-weight: 500; font-size: 15px;
}

/* Hover/focus dùng LỚP PHỦ SÁNG bán trong suốt → nổi rõ trên MỌI nền menu (kể cả bộ giao diện đổi màu),
   và quan trọng: menu con (dropdown) có nền = --brand-dark nên trước đây hover trùng nền → không thấy;
   lớp phủ này áp cho cả mục cấp 1 lẫn mục con nên hover luôn có phản hồi rõ ràng. */
.nav-inner a:hover, .nav-inner a:focus-visible {
    background: var(--menu-hover, rgb(255 255 255 / 16%)); color: var(--menu-hover-text, #fff); text-decoration: none;
}
/* Menu con nổi hơn một chút + thanh nhấn màu vàng thương hiệu bên trái khi hover/focus */
.nav-dropdown a:hover, .nav-dropdown a:focus-visible {
    background: var(--menu-hover, rgb(255 255 255 / 18%)); color: var(--menu-hover-text, #fff);
    box-shadow: inset 3px 0 0 0 var(--menu-accent, var(--brand-yellow));
}

/* Vòng focus mặc định (--accent xanh lá) chỉ đạt 1,95:1 trên nền xanh thương hiệu.
   Trên thanh nav phải đổi sang vàng thương hiệu (10,79:1). */
.site-nav :focus-visible { outline-color: var(--brand-yellow); }

/* Chuyên mục đang xem: gạch chân vàng — ngữ cảnh dùng màu vàng đúng chuẩn nhất
   trên toàn site (nền tối, tương phản 10,79:1). */
.nav-inner a.is-active {
    color: var(--menu-hover-text, #fff);
    box-shadow: inset 0 -3px 0 0 var(--menu-accent, var(--brand-yellow));
}

/* Cảm ứng: bỏ độ trễ/zoom đúp khi chạm vào mục menu và nhãn mở/đóng */
.site-nav a, .site-nav label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Menu con dạng thả xuống (menu hai cấp) */
/* Nhãn menu cha là <a> nằm trong .nav-group (không phải flex-item trực tiếp của .nav-inner)
   nên mặc định là display:inline — padding dọc của inline "tràn" ra trên/dưới dòng, khiến ô
   nền khi rê chuột cao hơn và lệch lên so với các mục phẳng. Cho .nav-group là flex và nhãn
   là flex canh giữa để cao/căn khớp hệt các mục còn lại. */
.nav-group { position: relative; display: flex; align-items: stretch; }
.nav-group > a { display: flex; align-items: center; }
.nav-dropdown {
    position: absolute; top: 100%; left: 0; z-index: 20; min-width: 220px;
    background: var(--menu-pop-bg, var(--brand-dark)); border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow); display: none; flex-direction: column; padding: 6px 0;
}
/* Thả xuống: CHỈ rê chuột (thiết bị có chuột) / focus bàn phím trên màn hình rộng. Trên di động/cảm ứng KHÔNG dùng :hover/:focus-within —
   trình duyệt cảm ứng "dính" :hover sau cú chạm làm menu con tự bung/đẩy bố cục ngay lúc chạm → cú chạm trượt sang mục khác
   (nhảy vào "Giới thiệu"/Trang chủ) và trạng thái kẹt lại khi quay về trang. Mở/đóng bằng checkbox + mũi tên (mọi thiết bị). */
.nav-group-toggle:checked ~ .nav-dropdown { display: flex; }
@media (min-width: 821px) { .nav-group:focus-within .nav-dropdown { display: flex; } }
@media (hover: hover) and (min-width: 821px) { .nav-group:hover .nav-dropdown { display: flex; } }
.nav-dropdown a { padding: 10px 18px; white-space: nowrap; }
/* Mũi tên chỉ báo nhóm; trên desktop chỉ là biểu tượng (thả xuống theo hover). */
.nav-group-caret {
    display: flex; align-items: center; padding: 0 12px 0 2px; color: var(--menu-hover-text, #eaf2fb);
    cursor: pointer; font-size: 12px; transition: transform .18s ease;
}

/* ---------- Menu CẤP 3 (menu con của menu con) — desktop bay ngang sang phải ---------- */
.nav-subgroup { position: relative; display: flex; align-items: stretch; justify-content: space-between; }
.nav-subgroup > .nav-sub-label { flex: 1 1 auto; }
.nav-sub-caret { display: flex; align-items: center; padding: 0 14px; color: var(--menu-hover-text, #eaf2fb); cursor: pointer; font-size: 11px; transition: transform .18s ease; }
.nav-subdropdown {
    position: absolute; top: -6px; left: 100%; z-index: 21; min-width: 220px;
    background: var(--menu-pop-bg, var(--brand-dark)); border-radius: 0 var(--radius) var(--radius) var(--radius);
    box-shadow: var(--shadow); display: none; flex-direction: column; padding: 6px 0;
}
.nav-subgroup-toggle:checked ~ .nav-subdropdown { display: flex; }
@media (min-width: 821px) { .nav-subgroup:focus-within > .nav-subdropdown { display: flex; } }
@media (hover: hover) and (min-width: 821px) { .nav-subgroup:hover > .nav-subdropdown { display: flex; } }

/* ---------- Menu di động (hamburger, thuần CSS) ---------- */
@media (max-width: 820px) {
    .nav-burger { display: flex; }
    /* Ẩn menu mặc định; hiện khi bấm hamburger (checkbox được tick) */
    .nav-inner {
        display: none; flex-direction: column; width: 100%; overflow: visible; gap: 0;
        border-top: 1px solid var(--menu-line, rgb(255 255 255 / 12%));
    }
    .nav-toggle:checked ~ .nav-inner { display: flex; }
    /* Menu mở dài hơn màn hình (nhiều mục + menu con đã xổ) mà đầu trang đang sticky → phần cuối KHÔNG cuộn tới được.
       Giới hạn chiều cao theo khung nhìn (JS tinh chỉnh chính xác --nav-max) và cho cuộn bên trong thân menu. */
    .nav-inner { max-height: var(--nav-max, calc(100vh - 170px)); max-height: var(--nav-max, calc(100dvh - 170px)); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .nav-inner > a, .nav-group > .nav-group-label { padding: 13px 16px; border-bottom: 1px solid var(--menu-line, rgb(255 255 255 / 8%)); }
    /* Mục đang xem trên di động: dùng thanh dọc bên trái (ngắn gọn) thay vì gạch chân dài hết hàng */
    .nav-inner a.is-active { box-shadow: inset 4px 0 0 0 var(--menu-accent, var(--brand-yellow)); }
    /* Di động: menu cha + menu con xếp DỌC; menu con GẬP mặc định, chạm mũi tên để thu/mở. */
    .nav-group { position: relative; display: block; }
    .nav-group > a { display: block; }
    .nav-dropdown {
        position: static; display: none; box-shadow: none; min-width: 0;
        background: var(--menu-sub-bg, var(--brand-dark)); border-radius: 0; padding: 0;
    }
    /* Checkbox ẩn (được nhãn mũi tên bật/tắt) điều khiển hiển thị — thuần CSS, không cần JavaScript. */
    .nav-group-toggle:checked ~ .nav-dropdown { display: flex; }
    .nav-group-caret {
        position: absolute; right: 0; top: 0; padding: 13px 18px; font-size: 14px;
        border-bottom: 1px solid var(--menu-line, rgb(255 255 255 / 8%));
    }
    .nav-group-toggle:checked ~ .nav-group-caret { transform: rotate(180deg); }
    .nav-dropdown a { padding: 11px 28px; }
    /* Cấp 3 trên di động: xổ DỌC, thụt sâu hơn cấp 2; chạm mũi tên để thu/mở. */
    .nav-subgroup { position: relative; display: block; }
    .nav-subdropdown { position: static; display: none; box-shadow: none; min-width: 0; padding: 0; border-radius: 0; }
    .nav-subgroup-toggle:checked ~ .nav-subdropdown { display: flex; }
    .nav-sub-caret { position: absolute; right: 0; top: 0; padding: 11px 18px; border-bottom: 1px solid var(--menu-line, rgb(255 255 255 / 8%)); }
    .nav-subgroup-toggle:checked ~ .nav-sub-caret { transform: rotate(90deg); }
    .nav-subdropdown a { padding: 11px 42px; }
}

/* ============================================================================
   MENU HỖN HỢP (site-nav--mega) — dùng chung .site-nav/.nav-bar/.nav-inner/.nav-burger.
   Mỗi mục cấp 1 TỰ CHỌN: .is-mega = bảng nhiều cột trải ngang · .is-plain = thả xuống gọn.
   Bảng/menu con dùng NỀN SÁNG (card trắng) cho nhẹ nhàng, dễ đọc — thay vì panel tối nặng nề.
   Thuần CSS: hover/focus desktop · checkbox di động.
   ============================================================================ */
.site-nav--mega .mega-item.is-mega { position: static; }      /* panel mega trải theo .site-nav (full-width) */
.site-nav--mega .mega-item.is-plain { position: relative; }   /* dropdown gọn neo theo mục */
.site-nav--mega .mega-item { display: flex; align-items: stretch; }
.site-nav--mega .mega-top { display: flex; align-items: center; }

/* ----- Panel dùng chung (card sáng) ----- */
.site-nav--mega .mega-panel,
.site-nav--mega .plain-panel {
    position: absolute; top: 100%; z-index: 30; display: none;
    background: #fff; box-shadow: 0 16px 40px rgb(6 20 54 / 18%);
    border: 1px solid var(--line, #dae0ed); border-top: 3px solid var(--bb3, var(--brand-yellow));
}
/* Hover + focus-within CHỈ dùng trên desktop; mobile dùng checkbox toggle (tránh giữ panel mở sau khi uncheck). */
@media (min-width: 821px) {
    .site-nav--mega .mega-item:hover > .mega-panel,
    .site-nav--mega .mega-item:focus-within > .mega-panel,
    .site-nav--mega .mega-item:hover > .plain-panel,
    .site-nav--mega .mega-item:focus-within > .plain-panel { display: block; }
}

/* ----- Dropdown gọn (.is-plain) ----- */
.site-nav--mega .plain-panel { left: 0; min-width: 260px; max-width: 340px; padding: 8px 0; border-radius: 0 0 10px 10px; }
.site-nav--mega .plain-link {
    display: block; padding: 9px 18px; color: var(--ink, #17233b); font-size: 14px; font-weight: 500; white-space: normal;
}
.site-nav--mega .plain-link:hover, .site-nav--mega .plain-link:focus-visible {
    background: var(--brand-light, #e6ebf3); color: var(--brand, #053384);
    box-shadow: inset 3px 0 0 0 var(--bb3, var(--brand-yellow)); text-decoration: none;
}
.site-nav--mega .plain-sub { padding-left: 34px; font-size: 13px; color: var(--ink-soft, #51607a); font-weight: 400; }
/* Cấp 3 trong dropdown gọn: GẬP mặc định, xổ khi rê chuột/focus (desktop) hoặc chạm ▸ (checkbox, mọi thiết bị). */
.site-nav--mega .plain-group { position: relative; }
.site-nav--mega .plain-group > .plain-has-sub { padding-right: 46px; }
.site-nav--mega .plain-caret {
    position: absolute; right: 0; top: 0; padding: 9px 16px; display: flex; align-items: center; cursor: pointer;
    color: var(--ink-soft, #51607a); font-size: 11px; line-height: 1.6; transition: transform .18s ease;
}
.site-nav--mega .plain-caret:hover, .site-nav--mega .plain-caret:focus-visible { color: var(--brand, #053384); }
.site-nav--mega .plain-subs { display: none; }
.site-nav--mega .plain-group-toggle:checked ~ .plain-subs { display: block; }
.site-nav--mega .plain-group-toggle:checked ~ .plain-caret { transform: rotate(90deg); }
@media (hover: hover) and (min-width: 821px) {
    .site-nav--mega .plain-group:hover > .plain-subs, .site-nav--mega .plain-group:focus-within > .plain-subs { display: block; }
    .site-nav--mega .plain-group:hover > .plain-caret, .site-nav--mega .plain-group:focus-within > .plain-caret { transform: rotate(90deg); }
}

/* ----- Bảng mega (.is-mega) ----- */
.site-nav--mega .mega-panel { left: 0; right: 0; }
.site-nav--mega .mega-cols {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 6px 30px; padding: 24px 0 28px; align-items: start;
}
.site-nav--mega .mega-col { break-inside: avoid; min-width: 0; }
.site-nav--mega .mega-col-title {
    display: block; color: var(--brand, #053384); font-weight: 700; font-size: 14.5px;
    padding: 4px 0 7px; margin: 0 0 6px; white-space: normal;
    border-bottom: 2px solid var(--brand-light, #e6ebf3);
}
.site-nav--mega .mega-col-list { list-style: none; margin: 0; padding: 0; }
.site-nav--mega .mega-col-list a {
    display: block; color: var(--ink-soft, #51607a); padding: 6px 10px; font-size: 13.5px;
    white-space: normal; font-weight: 400; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; padding-left: 9px;
    transition: background .12s, color .12s, border-color .12s;
}
/* Rê chuột/điều hướng bàn phím: NỔI BẬT rõ như dropdown — nền nhạt + chữ thương hiệu + vạch vàng bên trái. */
.site-nav--mega .mega-col-list a:hover, .site-nav--mega .mega-col-list a:focus-visible {
    background: var(--brand-light, #e6ebf3); color: var(--brand, #053384);
    border-left-color: var(--bb3, var(--brand-yellow)); text-decoration: none;
}
/* Tiêu đề cột (mục cấp 2 bấm được) cũng có phản hồi rê chuột rõ. */
/* Có vạch trái (trong suốt khi nghỉ → vàng khi hover/focus) như dropdown và danh sách cấp 3, để mọi mục mega đều có cùng phản hồi.
   Chừa sẵn 3px bên trái ngay từ đầu nên chữ KHÔNG bị xô khi hover. */
.site-nav--mega .mega-col-title { border-radius: 0 6px 6px 0; border-left: 3px solid transparent; padding-left: 9px; transition: background .12s, color .12s, border-color .12s; }
.site-nav--mega .mega-col-title:hover, .site-nav--mega .mega-col-title:focus-visible {
    background: var(--brand-light, #e6ebf3); color: var(--brand, #053384); border-left-color: var(--bb3, var(--brand-yellow)); text-decoration: none;
}
/* Mục cấp 2 KHÔNG có mục con trong mega: hiện như một liên kết thường (không viền tiêu đề). */
.site-nav--mega .mega-col:not(:has(.mega-col-list)) .mega-col-title { border-bottom: 0; font-weight: 600; margin: 0; }

@media (max-width: 820px) {
    /* Di động: mọi panel xổ DỌC trong thân menu; mở/đóng bằng checkbox .nav-group-toggle + caret. */
    .site-nav--mega .mega-item, .site-nav--mega .mega-item.is-mega, .site-nav--mega .mega-item.is-plain { position: relative; display: block; }
    .site-nav--mega .mega-top { display: block; }
    .site-nav--mega .mega-panel, .site-nav--mega .plain-panel {
        position: static; display: none; box-shadow: none; border: 0; border-radius: 0;
        background: var(--menu-sub-bg, rgb(255 255 255 / 6%)); min-width: 0; max-width: none;
    }
    .site-nav--mega .nav-group-toggle:checked ~ .mega-panel,
    .site-nav--mega .nav-group-toggle:checked ~ .plain-panel { display: block; }
    .site-nav--mega .mega-cols { grid-template-columns: 1fr; gap: 0; padding: 4px 0 8px; }
    .site-nav--mega .mega-col-title { color: var(--menu-hover-text, #fff); border-bottom: 1px solid var(--menu-line, rgb(255 255 255 / 10%)); margin: 0; padding: 12px 28px; border-radius: 0; border-left: 0; }
    .site-nav--mega .mega-col-list a { color: var(--menu-text, #cfe0f5); padding: 11px 40px; border-left: 0; border-radius: 0; }
    .site-nav--mega .plain-link { color: var(--menu-text, #cfe0f5); padding: 12px 28px; }
    /* Di động: rê chuột/CHẠM làm nổi bật bằng LỚP PHỦ SÁNG (chữ trắng) — KHÔNG dùng nền xanh nhạt
       của desktop vì chữ trắng sẽ chìm. Áp đồng nhất cho cả mega lẫn dropdown; có phản hồi khi chạm (:active). */
    .site-nav--mega .mega-col-title:hover, .site-nav--mega .mega-col-title:focus-visible,
    .site-nav--mega .mega-col-list a:hover, .site-nav--mega .mega-col-list a:focus-visible,
    .site-nav--mega .plain-link:hover, .site-nav--mega .plain-link:focus-visible {
        background: var(--menu-hover, rgb(255 255 255 / 12%)); color: var(--menu-hover-text, #fff); box-shadow: none;
    }
    .site-nav--mega .mega-col-title:active, .site-nav--mega .mega-col-list a:active,
    .site-nav--mega .plain-link:active { background: var(--menu-hover, rgb(255 255 255 / 22%)); color: var(--menu-hover-text, #fff); }
    .site-nav--mega .plain-sub { padding-left: 40px; }
    .site-nav--mega .plain-caret { color: var(--menu-text, #cfe0f5); padding: 12px 18px; }
    .site-nav--mega .plain-group > .plain-has-sub { padding-right: 52px; }
}

/* ---------- Nút lên đầu trang ---------- */
.back-to-top {
    position: fixed; right: 18px; bottom: 18px; z-index: 60;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--brand); color: #fff; display: grid; place-items: center;
    font-size: 24px; line-height: 1; box-shadow: 0 4px 14px rgb(16 32 48 / 28%);
    transition: opacity .2s, transform .2s;
}
.back-to-top:hover { background: var(--brand-dark); color: #fff; text-decoration: none; transform: translateY(-2px); }
/* Khi ở gần đầu trang (JS thêm lớp này) thì ẩn đi; không có JS thì luôn hiện — vẫn dùng được */
.back-to-top.near-top { opacity: 0; visibility: hidden; }

/* ---------- Nội dung ---------- */
.site-main { padding-block: 32px 56px; min-height: 60vh; }
/* Có Theme.PageBg: nền trang màu + khung nội dung trắng nổi lên (biến --panel-bg chỉ được phát khi đặt nền trang). */
.site-main { background: var(--panel-bg, transparent); }

.page-title { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 0 0 8px; color: var(--brand-dark); }
.page-lead  { margin: 0 0 28px; color: var(--ink-soft); max-width: 68ch; }

/* Tiêu đề mục: chữ đậm + thanh màu dọc bên trái + gạch chân NGẮN (chỉ dưới chữ) cho gọn mắt. */
.section-title {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: clamp(20px, 2.4vw, 26px); font-weight: 800;
    margin: 36px 0 18px; padding: 0 0 8px 14px; color: var(--brand-dark);
    border-bottom: 3px solid var(--brand); position: relative;
}
.section-title::before {
    content: ""; position: absolute; left: 0; top: 3px; bottom: 10px; width: 5px;
    border-radius: 3px; background: var(--brand);
}
/* Icon chuyên mục (quản trị chọn trong cấu hình khối) — tô màu xanh thương hiệu */
.section-icon { display: inline-flex; flex: 0 0 auto; color: var(--brand); }
.section-icon svg { width: 26px; height: 26px; display: block; }
.section-title-text { line-height: 1.2; }
/* Gạch chân 3 màu nhận diện thương hiệu (bật/tắt theo cấu hình khối): xanh dương → xanh lá → vàng */
.section-title--brand3 { border-bottom: none; }
.section-title--brand3::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 3px;
    background: linear-gradient(90deg,
        var(--bb1) 0 34%, var(--bb2) 34% 67%, var(--bb3) 67% 100%);
}

.empty-state {
    background: var(--bg-soft); border: 1px dashed var(--line);
    border-radius: var(--radius); padding: 28px; color: var(--ink-soft);
}

/* ---------- Thẻ bài viết ---------- */
.card-grid {
    display: grid; gap: 22px;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.card {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-light); }

/* Cột dọc: thân thẻ giãn đầy → ngày đăng luôn nằm sát đáy, các thẻ cùng hàng thẳng hàng dù tiêu đề dài ngắn khác nhau. */
.card-link { display: flex; flex-direction: column; color: inherit; height: 100%; }
.card-link:hover { text-decoration: none; }

/* Bọc ảnh để đặt badge chuyên mục đè lên góc */
.card-media { position: relative; }

/* object-position lệch lên trên: ảnh chụp người/sự kiện bị cắt về 16:9 vẫn giữ đầu người thay vì cắt ngang trán. */
.card-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 28%; background: var(--brand-light); }

.card-image-empty {
    display: grid; place-items: center;
    color: var(--brand); font-weight: 600; font-size: 15px;
}

/* Badge chuyên mục — pill màu thương hiệu, nổi trên ảnh */
.card-badge {
    position: absolute; left: 12px; top: 12px; z-index: 1;
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    background: var(--brand); color: #fff;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.25); max-width: calc(100% - 24px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.card-body { padding: 16px 18px 18px; flex: 1 1 auto; display: flex; flex-direction: column; }

/* Tiêu đề tối đa 3 dòng, tóm tắt 3 dòng: lưới đều, không có thẻ dài thòng. */
.card-title { margin: 0 0 8px; font-size: 18px; line-height: 1.35; color: var(--brand-dark);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.card-summary { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.card-date { margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--ink-soft); }

/* Bài nổi bật trên trang chủ */
.lead-section { margin-bottom: 8px; }

.card-featured { border-color: var(--brand-light); }
.card-featured .card-link { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.card-featured .card-media { height: 100%; }
.card-featured .card-image { height: 100%; aspect-ratio: auto; min-height: 280px; }
.card-featured .card-body { align-self: center; padding: 26px 30px; }
.card-featured .card-title { font-size: clamp(22px, 2.6vw, 28px); -webkit-line-clamp: 4; line-clamp: 4; }
.card-featured .card-summary { -webkit-line-clamp: 5; line-clamp: 5; }
.card-featured .card-date { margin-top: 12px; }
.card-featured .card-summary { font-size: 16px; }
.card-featured .card-badge { font-size: 12.5px; padding: 5px 12px; left: 16px; top: 16px; }

/* Ẩn NHÃN tên chuyên mục trên ảnh bìa khi quản trị tắt (Cấu hình → "Hiện tên chuyên mục trên ảnh bìa").
   Chỉ ẩn nhãn đè trên ảnh; nền màu nhận diện của thẻ KHÔNG ảnh (.card-image-empty) vẫn giữ tên để đỡ trống. */
body.hide-cat-badge .card-badge { display: none; }

@media (max-width: 720px) {
    .card-featured .card-link { grid-template-columns: 1fr; }
    .card-featured .card-media { height: auto; }
    .card-featured .card-image { min-height: 0; aspect-ratio: 16 / 9; }
}

/* ---------- Trang chi tiết ---------- */
.breadcrumb { display: flex; gap: 8px; font-size: 14px; color: var(--ink-soft); margin-bottom: 16px; }

/* Căn giữa cột bài viết trong vùng nội dung (.site-main rộng tối đa 1120px) để hai
   bên đều lề, tránh dồn về nửa trái. Trên màn nhỏ tự về full-width theo padding container. */
/* Bài viết hiển thị 1 cột FULL chiều rộng vùng nội dung (.site-main tối đa 1120px). */
.article { max-width: none; margin-inline: 0; }
.article-title { font-size: clamp(26px, 4vw, 38px); line-height: 1.22; margin: 0 0 12px; color: var(--brand-dark); }
.article-meta { font-size: 14px; color: var(--ink-soft); margin: 0 0 20px; }
.article-updated { margin-left: 6px; }

.article-cover {
    width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 28%;
    border-radius: var(--radius); margin: 0 0 22px; background: var(--brand-light);
}

.article-summary {
    font-size: 18px; font-weight: 500; color: var(--ink);
    border-left: 4px solid var(--brand); padding-left: 16px; margin: 0 0 24px;
}

.article-body { font-size: 17px; }
.article-body h2 { font-size: 24px; margin: 32px 0 12px; color: var(--brand-dark); }
.article-body h3 { font-size: 20px; margin: 26px 0 10px; }
.article-body p { margin: 0 0 18px; }
.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body img { border-radius: var(--radius); margin-block: 8px; }
.article-body figure { margin: 24px 0; }
.article-body figcaption { font-size: 14px; color: var(--ink-soft); text-align: center; margin-top: 8px; }

.article-body blockquote {
    margin: 24px 0; padding: 14px 20px;
    background: var(--bg-soft); border-left: 4px solid var(--brand-light);
    color: var(--ink-soft);
}

.article-body pre {
    background: #10202f; color: #e6edf3; padding: 16px; border-radius: var(--radius);
    overflow-x: auto; font-size: 14px;
}

/* Bảng RỘNG (nhập từ trang cũ, nhiều cột) cuộn ngang TRONG khung nội dung thay vì tràn ra ngoài trên điện thoại. */
.article-body table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; margin: 24px 0; font-size: 15px; }
.article-body { overflow-wrap: break-word; }
.article-body td, .article-body th { overflow-wrap: normal; }
.article-body iframe, .article-body video, .article-body embed, .article-body object { max-width: 100%; }
.article-body img { max-width: 100%; height: auto; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.article-body th { background: var(--bg-soft); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 32px 0 0; }

.tag-list a {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    background: var(--brand-light); color: var(--brand-dark); font-size: 14px;
}

.tag-list a:hover { background: var(--brand); color: #fff; text-decoration: none; }

/* ---------- Phân trang ---------- */
.pager { margin-top: 36px; }

.btn {
    display: inline-block; padding: 11px 20px; border-radius: var(--radius);
    background: var(--brand); color: #fff; font-weight: 600;
}

.btn:hover, .btn:focus-visible { background: var(--brand-dark); color: #fff; text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--footer-bg, var(--bg-soft)); color: var(--footer-text, inherit); margin-top: 48px; }

/* Vạch 3 màu nhận diện thương hiệu ở chân trang (admin bật/tắt) — làm nổi bật footer. */
.footer-brandbar {
    height: 4px; border-radius: 2px; margin: 4px 0 6px;
    background: linear-gradient(to right, var(--bb1) 0 36%, var(--bb2) 36% 68%, var(--bb3) 68% 100%);
}

/* ---------- Widget: Bộ đếm truy cập (từng DÒNG gọn: nhãn trái · số phải) ---------- */
.vcount-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; }
.vcount-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 2px; border-bottom: 1px dashed var(--line);
}
.vcount-item:last-child { border-bottom: 0; }
.vcount-label { font-size: 14px; color: var(--ink-soft); display: inline-flex; align-items: center; }
.vcount-num { font-size: 18px; font-weight: 800; color: var(--brand-dark); line-height: 1; white-space: nowrap; }
/* Dòng "Tổng" nổi bật hơn */
.vcount-total { margin-top: 2px; padding-top: 11px; border-top: 2px solid var(--line); }
.vcount-total .vcount-label { font-weight: 600; color: var(--ink); }
.vcount-total .vcount-num { font-size: 20px; color: var(--brand); }
.vcount-online .vcount-num { color: var(--accent); }
.vcount-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    margin-right: 7px; flex: 0 0 auto; animation: vcPulse 1.6s ease-in-out infinite;
}
@keyframes vcPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .vcount-dot { animation: none; } }

/* Bộ đếm gọn ở chân trang (một dòng) */
.footer-visits { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--footer-text, var(--ink-soft)); margin-top: 10px; }
.footer-visits b { color: var(--footer-text, var(--brand-dark)); }
.footer-visits .vcount-dot { width: 8px; height: 8px; }

/* ---------- Widget: Lịch tháng ---------- */
.wcal-head { text-align: center; margin: 6px 0 8px; color: var(--brand-dark); }
.wcal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.wcal-grid th { font-size: 12px; color: var(--ink-soft); font-weight: 600; padding: 4px 0; }
.wcal-grid th.wcal-we { color: var(--brand); }
.wcal-grid td { text-align: center; padding: 2px 0; height: 34px; vertical-align: middle; }
.wcal-num { font-size: 13.5px; color: var(--ink); }
.wcal-today .wcal-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700;
}
.wcal-has-ev .wcal-num { font-weight: 700; color: var(--brand-dark); }
.wcal-grid .wcal-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 1px auto 0; animation: none; }
.wcal-legend { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.wcal-legend .wcal-dot { margin: 0; width: 8px; height: 8px; }

/* Chân trang nhiều cột: Thương hiệu (rộng) | Liên kết nhanh | Chuyên mục | Liên hệ.
   Dùng flex-wrap để TỰ xếp lại số cột theo số cột đang bật + theo bề rộng thiết bị:
   desktop 1 hàng, tablet 2 cột, điện thoại xếp dọc. */
.footer-inner {
    display: flex; flex-wrap: wrap; gap: 24px 40px; padding-block: 32px; align-items: flex-start;
}
.footer-inner > * { flex: 1 1 190px; min-width: 0; }
.footer-inner > :first-child { flex: 1.8 1 260px; }   /* cột thương hiệu rộng hơn */

@media (max-width: 900px) {
    .footer-inner > * { flex: 1 1 42%; }
    .footer-inner > :first-child { flex: 1 1 100%; }    /* tablet: thương hiệu chiếm cả hàng, còn lại 2 cột */
}
@media (max-width: 560px) {
    .footer-inner > *, .footer-inner > :first-child { flex: 1 1 100%; }   /* điện thoại: xếp dọc */
}

.footer-title { margin: 0 0 6px; font-weight: 700; color: var(--footer-text, var(--brand-dark)); }
.footer-muted { margin: 0; color: var(--footer-text, var(--ink-soft)); max-width: 52ch; }
.footer-col { display: flex; flex-direction: column; }
.footer-col-title { margin: 0 0 10px; font-weight: 600; font-size: 15px; color: var(--footer-text, var(--brand-dark)); }
.footer-link { color: var(--footer-text, var(--ink-soft)); padding: 3px 0; font-size: 14px; }
.footer-link:hover { color: var(--brand); text-decoration: underline; }
.footer-contact { font-style: normal; color: var(--footer-text, var(--ink-soft)); font-size: 15px; }
.footer-contact p { margin: 0 0 4px; }
.footer-contact a { color: var(--footer-text, var(--brand)); }

.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    padding-block: 16px; /*border-top: 1px solid var(--line);*/
    font-size: 14px; color: var(--footer-text, var(--ink-soft));
    flex-wrap: wrap; gap: 8px 16px;
}

/* Menu liên kết ở chân trang (do quản trị đặt) */
.footer-menu { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.footer-menu a { color: var(--footer-text, var(--ink-soft)); }
.footer-menu a:hover { color: var(--brand); text-decoration: underline; }

/* Icon mạng xã hội ở chân trang */
.footer-social { display: flex; gap: 10px; margin-top: 12px; }
.social-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--brand-light); color: var(--brand);
}
.social-icon:hover { background: var(--brand); color: #fff; }

/* Thanh menu trên cùng (top bar) — thu gọn không gian cho menu chính */
.topbar { background: var(--top-bg, var(--brand-dark)); }
.topbar-inner {
    display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
    justify-content: flex-end; padding-block: 7px; min-height: 0;
}
.topbar-inner a { color: var(--top-text, #dbe3f2); font-size: 13.5px; font-weight: 700;}
.topbar-inner a:hover { color: #fff; text-decoration: underline; }
.topbar-inner :focus-visible { outline-color: var(--brand-yellow); }

/* ============================================================
   Khối "Giới thiệu (Landing)" — AboutLandingBlock
   Bố cục thẻ/lưới trong khung .container (max 1120px), responsive,
   dùng đúng bảng màu thương hiệu. Không cần JavaScript.
   ============================================================ */
.about-landing { display: block; }

/* ---- Hero: bảng gradient thương hiệu bo góc ---- */
.about-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 70%);
    color: #fff; border-radius: 16px; padding: 44px 36px; margin: 4px 0 30px;
}
.about-hero::after {
    content: ""; position: absolute; right: -80px; top: -80px;
    width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgb(255 255 255 / 12%), transparent 70%);
    pointer-events: none;
}
.about-hero-inner { position: relative; z-index: 1; }
.about-eyebrow {
    text-transform: uppercase; letter-spacing: .09em; font-size: 13px;
    font-weight: 700; color: var(--brand-yellow); margin: 0 0 10px;
}
.about-title { font-size: clamp(28px, 4vw, 44px); line-height: 1.12; margin: 0 0 14px; color: #fff; }
.about-lead { font-size: clamp(16px, 2vw, 19px); line-height: 1.6; max-width: 64ch; margin: 0; color: rgb(255 255 255 / 90%); }

/* ---- Dải số liệu ---- */
.about-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.about-stat {
    background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 12px; padding: 16px 12px; text-align: center;
}
.about-stat-value { display: block; font-size: clamp(24px, 3vw, 34px); font-weight: 800; line-height: 1; color: #fff; }
.about-stat-label { display: block; margin-top: 7px; font-size: 13px; color: rgb(255 255 255 / 85%); }

/* ---- Các mục ---- */
.about-section { margin: 34px 0; }
.about-h2 {
    font-size: clamp(20px, 2.4vw, 26px); color: var(--brand-dark);
    margin: 0 0 18px; padding-bottom: 10px; position: relative;
}
.about-h2::after {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 48px; height: 3px; background: var(--accent); border-radius: 2px;
}
.about-function-text { font-size: 17px; line-height: 1.75; color: var(--ink); max-width: 82ch; margin: 0; }

/* ---- Lưới thẻ dùng chung ---- */
.about-grid { display: grid; gap: 16px; }
.about-grid-pillars { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.about-grid-leaders { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.about-grid-teams { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.about-card {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.about-card-title { font-size: 17px; color: var(--brand-dark); margin: 0 0 6px; }
.about-card-text { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); margin: 0; }

/* ---- Nhiệm vụ (pillars) ---- */
.about-pillar { border-top: 3px solid var(--brand); }
.about-pillar-icon { display: block; font-size: 30px; line-height: 1; margin-bottom: 12px; }

/* ---- Ban lãnh đạo ---- */
.about-leader { text-align: center; }
.about-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 66px; height: 66px; border-radius: 50%;
    background: var(--brand-light); color: var(--brand-dark);
    font-weight: 800; font-size: 22px; margin-bottom: 12px; letter-spacing: .02em;
}
.about-leader-name { font-size: 16px; margin: 0 0 4px; color: var(--ink); }
.about-leader-title { font-size: 14px; font-weight: 600; color: var(--accent); margin: 0; }

/* ---- Liên hệ ---- */
.about-contact { background: var(--bg-soft); border-radius: var(--radius); padding: 24px; }
.about-contact-row { display: flex; flex-wrap: wrap; gap: 12px; }
.about-contact-item {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 10px 18px; font-weight: 600; color: var(--brand);
}
.about-contact-item:hover { border-color: var(--brand); }
.about-contact-ico { font-size: 16px; }

@media (max-width: 640px) {
    .about-hero { padding: 30px 22px; }
    .about-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Tài liệu đính kèm bài viết (ArticlePage)
   ============================================================ */
.article-attachments { margin: 28px 0; padding: 18px 20px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.attachments-title { font-size: 17px; color: var(--brand-dark); margin: 0 0 12px; }
.attachment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attachment-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    color: var(--ink); font-weight: 600;
}
.attachment-item:hover { border-color: var(--brand); background: var(--brand-light); }
.attachment-ico { font-size: 22px; line-height: 1; flex: 0 0 auto; }
.attachment-name { flex: 1 1 auto; word-break: break-word; color: var(--brand); }
.attachment-size { flex: 0 0 auto; font-size: 13px; font-weight: 500; color: var(--ink-soft); }

/* Trình xem PDF nội tuyến trong bài viết (pdf-embed) */
.pdf-viewers { margin: 28px 0; display: flex; flex-direction: column; gap: 24px; }
.pdf-embed { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.pdf-embed-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--brand-dark); color: #fff;
}
.pdf-embed-title { flex: 1 1 auto; font-weight: 700; word-break: break-word; }
.pdf-embed-download {
    flex: 0 0 auto; font-size: 14px; font-weight: 600; color: #fff;
    padding: 6px 14px; border: 1px solid rgba(255,255,255,.5); border-radius: 6px;
}
.pdf-embed-download:hover { background: rgba(255,255,255,.15); }
.pdf-frame { display: block; width: 100%; height: 82vh; min-height: 520px; border: 0; }
@media (max-width: 640px) { .pdf-frame { height: 70vh; min-height: 420px; } }

/* ============================================================
   Lịch trực (trang chỉ xem) — LichTrucPage
   ============================================================ */
.duty-head { margin: 4px 0 14px; }
.duty-title { font-size: clamp(22px, 3vw, 30px); color: var(--brand-dark); margin: 0 0 4px; }
.duty-sub { margin: 0; color: var(--ink-soft); font-size: 14px; }

.duty-filter { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end;
    justify-content: space-between; padding: 14px 16px; background: var(--bg-soft);
    border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.duty-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.duty-pick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.duty-pick label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.duty-pick select, .duty-pick input {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; max-width: 260px; }
.duty-pick input[type=number] { width: 84px; }
.btn-sm { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--brand); font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; }
.btn-sm:hover { border-color: var(--brand); background: var(--brand-light); }
.btn-go { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-go:hover { background: var(--brand-dark); }

/* ===== Lịch trực tháng — gọn, sáng (kiểu lịch chuyên nghiệp) =================
   Mỗi người trực là một HÀNG gọn: chấm màu theo vai trò + tên + ca; ghi chú in nghiêng;
   liên hệ nhỏ, mờ. KHÔNG khung hộp/viền dày/biểu tượng to → nhẹ mắt, xem nhanh. */
.duty-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 10px; font-size: 12px; color: var(--ink-soft); }
.duty-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.duty-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--brand); }
.duty-legend .lg.r-hotro .dot { background: var(--accent); }
.duty-legend .lg.r-khac  .dot { background: #7c3aed; }
.duty-legend .lg.r-day   .dot { background: #0284c7; }
.duty-legend-note { color: var(--ink-soft); font-weight: 400; }

/* Badge tròn (giữ để nơi khác còn dùng — lịch không dùng nữa) */
.duty-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.7; }
.b-chinh { background: var(--brand-light); color: var(--brand-dark); }
.b-hotro { background: #e2f5e2; color: var(--accent); }
.b-khac  { background: #ede9fe; color: #6d28d9; }
.b-day   { background: #e0f2fe; color: #0369a1; }

.duty-grid-wrap { overflow-x: auto; }
.duty-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 1px;
    background: #e8ecf1; border: 1px solid #e8ecf1; border-radius: 12px; overflow: hidden; }
.duty-dow { background: #f8fafc; color: var(--ink-soft); font-weight: 700; font-size: 11px;
    letter-spacing: .03em; text-transform: uppercase; text-align: left; padding: 8px 10px; }
.duty-cell { background: #fff; min-height: 104px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.duty-weekend { background: #fbfcfe; }
/* Ngày THÁNG KHÁC (trước/sau): nền hơi ngả, chữ mờ nhất — "không thuộc tháng này". */
.duty-other { background: #fafbfc; }
.duty-other .duty-daynum { opacity: .5; }
.duty-other .duty-item, .duty-other .duty-more { opacity: .5; }
.duty-other:hover .duty-item, .duty-other:hover .duty-more { opacity: 1; }
/* Ngày ĐÃ QUA trong tháng đang xem: giữ nền trắng, chỉ mờ nhẹ nội dung để hôm nay/sắp tới nổi hơn. */
.duty-past { background: #fff; }
.duty-past .duty-daynum { color: var(--ink-soft); }
.duty-past .duty-item, .duty-past .duty-more { opacity: .6; }
.duty-past:hover .duty-item, .duty-past:hover .duty-more { opacity: 1; }

/* Số ngày ở góc trái; HÔM NAY = số trong vòng tròn thương hiệu (kiểu Google Calendar). */
.duty-daynum { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.duty-daynum .d-num { font-weight: 700; font-size: 13px; color: var(--ink);
    min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.d-full { display: none; }
.duty-today { box-shadow: inset 0 0 0 2px var(--brand); }
.duty-today .duty-daynum .d-num { background: var(--brand); color: #fff; border-radius: 50%; }
.d-today { font-size: 10px; font-weight: 700; color: var(--brand); background: var(--brand-light); border-radius: 999px; padding: 1px 7px; }

/* Thu gọn/mở rộng khi ngày có > 2 người (thẻ <details>, không cần JavaScript). */
.duty-more { display: flex; flex-direction: column; gap: 2px; margin-top: 1px; }
.duty-more > summary {
    list-style: none; cursor: pointer; font-size: 11px; font-weight: 600;
    color: var(--brand); border-radius: 6px; padding: 2px 6px;
}
.duty-more > summary::-webkit-details-marker { display: none; }
.duty-more > summary:hover { background: var(--brand-light); }
.duty-more > summary .sum-open { display: none; }
.duty-more[open] > summary .sum-closed { display: none; }
.duty-more[open] > summary .sum-open { display: inline; }

/* Mục người trực: hàng gọn, chấm màu theo vai trò — KHÔNG khung hộp. */
.duty-item { display: flex; flex-direction: column; gap: 0; padding: 3px 5px; border-radius: 6px; transition: background .12s; }
.duty-item:hover { background: var(--bg-soft); }
.duty-line { display: flex; align-items: center; gap: 7px; }
.duty-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--brand); }
.r-hotro .duty-dot { background: var(--accent); }
.r-khac  .duty-dot { background: #7c3aed; }
.r-day   .duty-dot { background: #0284c7; }
/* Họ tên nhuộm theo TONE MÀU của nhóm vai trò (khớp chấm màu + chú thích) — đồng bộ bộ màu giao diện. */
.duty-name { font-weight: 600; font-size: 12.5px; color: var(--brand-dark); line-height: 1.3; }
.r-hotro .duty-name { color: var(--accent); }
.r-khac  .duty-name { color: #6d28d9; }
.r-day   .duty-name { color: #0369a1; }
.duty-when { font-size: 10.5px; color: var(--ink-soft); white-space: nowrap; margin-left: auto; }
.duty-note { margin: 1px 0 0; padding-left: 15px; font-size: 11px; color: var(--ink-soft); font-style: italic; line-height: 1.35; }
.duty-contact { display: flex; flex-wrap: wrap; gap: 1px 8px; padding-left: 15px; margin-top: 1px; font-size: 10.5px; }
.c-phone, .c-ext, .c-email { color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.c-email { white-space: normal; word-break: break-all; }
a.c-phone:hover, a.c-email:hover { color: var(--brand); text-decoration: underline; }
.duty-foot { margin-top: 10px; font-size: 11.5px; }

/* Di động: chuyển lịch thành danh sách agenda — chỉ hiện ngày CÓ trực, mỗi ngày một hàng đầy đủ. */
@media (max-width: 760px) {
    .duty-filter { flex-direction: column; align-items: stretch; }
    .duty-grid-wrap { overflow-x: visible; }
    .duty-grid { grid-template-columns: 1fr; gap: 0; border-radius: 10px; }
    .duty-dow { display: none; }
    .duty-cell { min-height: 0; padding: 10px 12px; border-bottom: 1px solid #e8ecf1; }
    .duty-cell:not(.has-duty) { display: none; }
    /* Agenda: hiện đủ Thứ + ngày thay cho số đơn lẻ. */
    .duty-today { box-shadow: inset 3px 0 0 0 var(--brand); }
    .duty-daynum .d-num { display: none; }
    .duty-today .duty-daynum .d-num { background: none; color: var(--brand); }
    .d-full { display: inline; font-weight: 700; color: var(--ink); }
}

/* Trang chủ sự kiện (Landing) — khung toàn màn hình, không giới hạn bề rộng như .container */
.landing-main { display: block; width: 100%; min-height: 100vh; margin: 0; padding: 0; }
.landing-main > * { max-width: none; }
.landing-missing { max-width: 640px; margin: 12vh auto; padding: 0 20px; text-align: center; }
.landing-missing h1 { margin: 0 0 8px; }

/* ===== Bộ chọn ngôn ngữ (đa ngôn ngữ) ===== */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; margin-left: 10px; flex: none; }
.lang-switch .lang-opt {
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 30px;
    padding: 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .3px; line-height: 1;
    color: var(--top-text, #334155); text-decoration: none; border: 1px solid var(--line, #d9e1ec);
    border-radius: 8px; background: rgba(255,255,255,.6);
}
.lang-switch .lang-opt:hover { border-color: var(--brand, #053384); color: var(--brand, #053384); }
.lang-switch .lang-opt.is-active { background: var(--brand, #053384); border-color: var(--brand, #053384); color: #fff; }
@media (max-width: 640px) { .lang-switch { margin-left: 6px; } .lang-switch .lang-opt { min-width: 30px; height: 28px; padding: 0 6px; } }

/* ===== Cờ + biến thể bộ chọn ngôn ngữ ===== */
.langflag { display: inline-flex; }
.langflag svg { width: 20px; height: 13px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); display: block; }
.lang-switch .lang-opt { gap: 5px; }
.lang-switch.lang-flag .lang-opt { min-width: 0; padding: 0 6px; }   /* chỉ cờ: gọn */
.lang-switch.lang-text .langflag { display: none; }                 /* chỉ chữ */
.lang-code { line-height: 1; }
/* Bộ chọn ngôn ngữ đặt trong THANH TRÊN (nền tối) */
.topbar-lang { display: inline-flex; align-items: center; }
.topbar-lang.at-right { margin-left: auto; }
.topbar .lang-switch { margin-left: 0; gap: 4px; }
.topbar .lang-switch .lang-opt { height: 24px; min-width: 0; padding: 0 7px; font-size: 11px;
    background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.30); color: #fff; }
.topbar .lang-switch .lang-opt:hover { background: rgba(255,255,255,.24); color: #fff; }
.topbar .lang-switch .lang-opt.is-active { background: #fff; border-color: #fff; color: var(--brand, #053384); }

/* Hỗ trợ bàn phím: vòng focus rõ ràng cho các nút mở/đóng menu (label + checkbox ẩn) */
label[data-kb]:focus-visible,
.site-nav a:focus-visible {
    outline: 2px solid var(--brand-yellow, #f5b800);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Tiếng Trung (zh): chữ Hán không có dấu cách → cho ngắt dòng theo ký tự, và nêu rõ phông CJK dự phòng để Windows/macOS/Android hiển thị đồng nhất
   (chữ Latin/Việt vẫn dùng phông đơn vị chọn; chỉ ký tự thiếu glyph mới rơi xuống các phông CJK). */
html:lang(zh) body { font-family: var(--font), "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; line-break: strict; overflow-wrap: anywhere; }

