/* Bảng màu và các khối của trang: xanh đậm, trắng, một màu nhấn. Nạp sau cùng nên ghi đè biến cũ. */
:root {
  --giay: #f5f7fc;
  --muc: #0f172a;
  --muc-nhat: #1e293b;
  --mo: #5b6b82;
  --rat-mo: #5f6f86;
  --ke: #e2e8f0;
  --ke-dam: #cbd5e1;
  --loi: #1d4ed8;
  --loi-sang: #3b82f6;
  --loi-nhat: #dbeafe;
  --f-phan-mem: #2563eb;
  --f-ai: #7c3aed;
  --f-blockchain: #0891b2;
  --f-giao-duc: #c2410c;
  --f-phan-mem-nen: #dbeafe;
  --f-ai-nen: #ede9fe;
  --f-blockchain-nen: #cffafe;
  --f-giao-duc-nen: #ffedd5;
  --bo: 8px;
  --bo-nho: 6px;
  --bong: 0 1px 3px rgba(15, 23, 42, .1);
  --bong-cao: 0 28px 56px -20px rgba(15, 23, 42, .4);
  --dem: #0a1730;
  --dem-2: #0f2147;
  --lam: #22d3ee;
  --ma: inherit;
}

.dau-trang { background: rgba(255, 255, 255, .88); }
.nut { border-radius: 6px; }
.nut-chinh, .nut-loi { background: var(--loi); border-color: var(--loi); color: #fff; }
.nut-chinh:hover, .nut-loi:hover { background: var(--loi); border-color: var(--loi); filter: brightness(.88); }
.manh-trang { background: #fff; }
.manh-nhat { background: var(--giay); border-block: 0; }
.manh-sau { background: var(--dem); }
.manh-sau a { color: #93c5fd; }
.chan-trang { background: var(--dem); }
.dieu-huong a:hover { background: #eef2fb; }
.dieu-huong a[aria-current="page"] { background: #e3ebff; color: #1d4ed8; }

/* ------------------------------------------------------------ mở đầu */
.mo-dau { position: relative; border-bottom: 0; color: #e6ebf5; background: var(--dem-2); }
.mo-dau h1 { color: #fff; max-width: 18ch; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.2rem); line-height: 1.15; }
.mo-dau .cau-dinh-vi { color: #c5cfe3; }
.mo-dau .nut-chinh { background: #fff; border-color: #fff; color: var(--dem-2); }
.mo-dau .nut-chinh:hover { background: #e6ebf5; border-color: #e6ebf5; filter: none; }
.mo-dau .nut:not(.nut-chinh) { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.mo-dau .nut:not(.nut-chinh):hover { background: rgba(255, 255, 255, .1); }

/* Tin mới ở đầu trang chủ: danh sách thật thay cho hình trang trí */
.tin-dau { width: min(100%, 420px); background: #fff; color: var(--muc); border-radius: 8px; padding: 22px 24px 18px; }
.tin-dau h2 { margin: 0 0 6px; font-size: .95rem; color: var(--mo); font-weight: 600; }
.tin-dau ul { list-style: none; margin: 0; padding: 0; }
.tin-dau li + li { border-top: 1px solid var(--ke); }
.tin-dau li a { display: grid; gap: 3px; padding: 13px 0; text-decoration: none; color: var(--muc); }
.tin-dau time { font-size: .8rem; color: var(--mo); }
.tin-dau li span { font-weight: 600; line-height: 1.4; }
.tin-dau li a:hover span { color: var(--loi); text-decoration: underline; }
.tin-dau-het { display: inline-block; margin-top: 8px; font-size: .9rem; font-weight: 600; color: var(--loi); }

/* Dải báo chí ngay dưới đầu trang */
.dai-bao { background: var(--dem); color: #c3cde6; border-top: 1px solid rgba(255, 255, 255, .08); }
.dai-bao h2 { color: #8ea0c8; }
.dai-bao a { color: #e8eeff; }

/* ------------------------------------------------------------ thẻ */
.the-linh-vuc > a, .the-du-an > a, .the-bai-viet > a { border-radius: 8px; border-color: var(--ke); }
.the-linh-vuc > a { border-top-width: 3px; padding: 20px 20px 22px; }
.the-linh-vuc > a:hover, .the-du-an > a:hover, .the-bai-viet > a:hover { transform: none; box-shadow: none; border-color: var(--ke-dam); }
.the-linh-vuc.lv-cong-nghe-phan-mem > a:hover { border-top-color: var(--f-phan-mem); }
.the-linh-vuc.lv-tri-tue-nhan-tao > a:hover { border-top-color: var(--f-ai); }
.the-linh-vuc.lv-blockchain > a:hover { border-top-color: var(--f-blockchain); }
.the-linh-vuc.lv-giao-duc-cong-nghe > a:hover { border-top-color: var(--f-giao-duc); }
.the-linh-vuc > a:hover h3, .the-bai-viet > a:hover h3 { color: var(--loi); text-decoration: underline; }
.phong-su { background: var(--dem); }
.nut-phat { background: var(--loi); }
.dau-muc h2 { letter-spacing: -.02em; }
.nhan.vien { background: var(--f-blockchain-nen); color: #0e7490; }

/* ------------------------------------------- đầu trang của các trang trong */
.dau-chi-tiet { color: #e6ebf5; border-bottom: 0; background: var(--dem-2); }
.dau-chi-tiet .khung { padding-block: 8px 40px; }
.dau-chi-tiet h1 { color: #fff; max-width: 26ch; font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.9rem); line-height: 1.15; }
.dau-chi-tiet .tom-dau { color: #c3cde6; }
.dau-chi-tiet .dong-phep { color: #8ea0c8; border-left-color: rgba(255, 255, 255, .22); margin: 0; }
.dau-chi-tiet .duong-dan, .dau-chi-tiet .duong-dan a { color: #9fb0d4; }
.dau-chi-tiet .duong-dan a:hover { color: #fff; }
.dau-chi-tiet .duong-dan [aria-current] { color: #fff; }
.dau-chi-tiet .duong-dan li:not(:last-child)::after { color: #5b6e96; }
.dau-chi-tiet .the-nhan, .dau-chi-tiet .nhan { background: rgba(255, 255, 255, .1); color: #e8eeff; }
.dau-chi-tiet a:not(.nut) { color: #93c5fd; }

/* ------------------------------------------------------ hai việc của Viện */
.luoi-tru { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
.tru { border-top: 3px solid var(--muc); padding-top: 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.tru h3 { margin: 0; font-size: 1.3rem; line-height: 1.3; }
.tru p { margin: 0; line-height: 1.7; color: var(--muc-nhat); max-width: 54ch; }
.tru .lien-tiep { justify-self: start; margin-top: 4px; color: var(--loi); }
@media (max-width: 760px) { .luoi-tru { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

/* ------------------------------------------------------- lời mời cuối trang */
.manh-mong.manh-trang { background: var(--giay); border-top: 1px solid var(--ke) !important; }

/* Trang quản trị dùng cùng bảng màu */
.dau-qt { background: var(--dem); }
.le-qt a:hover { background: #e7edfb; }
.le-qt a[aria-current="page"] { background: var(--loi); }
.bang-qt, .khoi-mau, .the-so-qt > a { border-radius: 8px; }

/* Menu trên điện thoại: một cột, không bị luật flex của thanh đầu trang chi phối */
.dau-trang .ngan-keo-trong { display: grid; gap: 0; align-items: stretch; min-height: 0; padding: 6px 24px 14px; }
.ngan-keo-trong a { padding: 14px 4px; font-size: 1.02rem; }
.ngan-keo-trong a[aria-current="page"] { color: #1d4ed8; }

/* Logo thật: chữ hiệu xếp hai dòng, đứng cạnh một vạch và dòng tên Viện */
.hieu { gap: 14px; }
.hieu-chu { display: flex; align-items: center; gap: 14px; }
.hieu-chu-anh { height: 40px !important; width: auto; margin: 0 !important; }
.hieu-chu-anh + span { max-width: 150px; padding-left: 14px; border-left: 1px solid var(--ke); font-size: .72rem; line-height: 1.35; }
.chan-gioi-thieu .hieu-chu-anh { height: 46px !important; }
.chan-gioi-thieu .hieu-chu-anh + span { border-color: rgba(255,255,255,.2); }
@media (max-width: 720px) { .hieu-chu-anh { height: 34px !important; } }

/* Không để lộ dải nền sáng giữa lời mời cuối trang và chân trang */
main:has(> .manh-trang:last-child) + .chan-trang { margin-top: 0; }

/* Ảnh đầu trang chủ do quản trị tải lên */
.mo-dau .anh-dau { margin: 0; position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3.4; background: var(--dem); }
.mo-dau .anh-dau img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mo-dau .anh-dau figcaption { position: absolute; inset: auto 0 0 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 38px 16px 16px; background: linear-gradient(to top, rgba(5,12,31,.92), rgba(5,12,31,0)); }
.mo-dau .anh-dau figcaption span { font-size: .76rem; font-weight: 600; color: #fff; padding: 5px 11px; border-radius: 4px; background: rgba(10,23,48,.7); }

/* Ảnh hoạt động */
.luoi-hoat-dong { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.luoi-hoat-dong figure { margin: 0; position: relative; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--ke); }
.luoi-hoat-dong img { width: 100%; height: 100%; object-fit: cover; display: block; }
.luoi-hoat-dong figcaption { position: absolute; inset: auto 0 0 0; padding: 30px 16px 14px; font-size: .88rem; font-weight: 500; color: #fff; background: linear-gradient(to top, rgba(5,12,31,.85), rgba(5,12,31,0)); }
.luoi-hoat-dong.n1 { grid-template-columns: 1fr; } .luoi-hoat-dong.n1 figure { aspect-ratio: 16 / 7; }
.luoi-hoat-dong.n2 { grid-template-columns: repeat(2, 1fr); }
.luoi-hoat-dong.n4 li:first-child { grid-column: span 2; } .luoi-hoat-dong.n4 li:first-child figure { aspect-ratio: 16 / 7.5; }
@media (max-width: 720px) {
  .luoi-hoat-dong, .luoi-hoat-dong.n2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .luoi-hoat-dong.n1, .luoi-hoat-dong.n1 { grid-template-columns: 1fr; }
  .luoi-hoat-dong.n4 li:first-child { grid-column: span 2; }
}

/* Trang quản trị hình ảnh */
.luoi-anh-qt { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.anh-qt { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--ke); display: block; }
@media (max-width: 720px) { .luoi-anh-qt { grid-template-columns: 1fr; } }
.luoi-anh-qt { align-items: start; }

/* Trang Nghiên cứu khi chưa có bài */
.nc-chua-co { border: 1px solid var(--ke); border-radius: 8px; background: #fff; padding: 28px; display: grid; gap: 24px; }
.nc-chua-co-dau { display: flex; gap: 18px; align-items: flex-start; }
.nc-chua-co-dau > svg { flex: none; color: var(--loi); margin-top: 3px; }
.nc-chua-co h3 { margin: 0 0 6px; font-size: 1.25rem; }
.nc-chua-co p { margin: 0; color: var(--mo); max-width: 62ch; line-height: 1.7; }
.nc-cam-ket { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.nc-cam-ket li { display: grid; gap: 6px; padding: 16px 0 0; border-top: 1px solid var(--ke); }
.nc-cam-ket li > svg { color: var(--loi); }
.nc-cam-ket span { font-size: .9rem; color: var(--mo); line-height: 1.55; }
@media (max-width: 720px) { .nc-cam-ket { grid-template-columns: 1fr; } .nc-chua-co { padding: 20px; } }

/* Chữ số: cùng phông với chữ thường, chỉ canh đều cột */
.ma { font-family: inherit; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.nhan { border-radius: 4px; }
.the, .o-rail, .rong { border-radius: 8px; }
.lien-tiep { color: var(--loi); }
.luoi-ps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .luoi-ps { grid-template-columns: minmax(0, 1fr); } }
.dau-chi-tiet .dong-tin, .dau-chi-tiet .dong-tin span { color: #b4c0d9; }

/* Quản trị: sắp thứ tự khối và chọn màu */
.bang-khoi { display: grid; gap: 8px; }
.dong-khoi { display: flex; align-items: center; gap: 14px; }
.dong-khoi input[type="number"] { width: 68px; }
.o-mau { display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--mo); }
.o-mau input[type="color"] { width: 56px; height: 36px; padding: 2px; border: 1px solid var(--ke-dam); border-radius: 6px; background: #fff; }

/* Dòng nhấn mạnh phi lợi nhuận ở đầu trang chủ */
.mo-dau .dong-phi-loi-nhuan { margin: 16px 0 26px; padding-left: 14px; border-left: 3px solid #fff; color: #fff; font-weight: 600; max-width: 52ch; line-height: 1.5; }
