/* WCAG.win – giao diện tự đạt WCAG 2.2 AA: tương phản ≥ 4.5:1, viền focus rõ, vùng bấm ≥ 24px, co giãn đến 320px */
:root {
  --bg: #f6f8fb;
  --mat: #ffffff;
  --chu: #16202c;
  --chu-phu: #4a5566;
  --vien: #d5dce6;
  --chinh: #0a4fa3;
  --chinh-dam: #083d80;
  --chinh-nhat: #e6eefa;
  --nhan: #9a4a00;
  --nhan-nhat: #fdf1e3;
  --tot: #17663a;
  --tot-nhat: #e3f3e9;
  --xau: #a8221a;
  --xau-nhat: #fbe8e6;
  --focus: #0a4fa3;
  --bong: 0 1px 2px rgb(15 23 42 / 6%), 0 4px 14px rgb(15 23 42 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --mat: #171e28; --chu: #e8edf3; --chu-phu: #aab4c2; --vien: #2c3644;
    --chinh: #7fb3ff; --chinh-dam: #a9cbff; --chinh-nhat: #18263a; --nhan: #f3b46a; --nhan-nhat: #2e2214;
    --tot: #7ed6a0; --tot-nhat: #14281c; --xau: #ff9d94; --xau-nhat: #34191a; --focus: #a9cbff;
    --bong: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --mat: #171e28; --chu: #e8edf3; --chu-phu: #aab4c2; --vien: #2c3644;
  --chinh: #7fb3ff; --chinh-dam: #a9cbff; --chinh-nhat: #18263a; --nhan: #f3b46a; --nhan-nhat: #2e2214;
  --tot: #7ed6a0; --tot-nhat: #14281c; --xau: #ff9d94; --xau-nhat: #34191a; --focus: #a9cbff;
  --bong: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--chu);
  font: 1.0625rem/1.65 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--chinh); text-underline-offset: 0.18em; }
a:hover { color: var(--chinh-dam); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); margin-top: 2.2rem; }
h3 { font-size: 1.15rem; margin-top: 1.4rem; }
p { margin: 0 0 1em; }
code, pre { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 0.92em; }
pre { background: var(--chinh-nhat); padding: 0.8rem 1rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.an-di { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Liên kết bỏ qua */
.bo-qua { position: absolute; left: 0.75rem; top: -4rem; z-index: 100; background: var(--chinh); color: #fff; padding: 0.7rem 1rem; border-radius: 6px; font-weight: 600; text-decoration: none; }
.bo-qua:focus { top: 0.75rem; color: #fff; }

/* Khung trang */
.khung { width: min(1100px, 100% - 2rem); margin-inline: auto; }
header.dau {
  background: var(--mat); border-bottom: 1px solid var(--vien);
}
.dau .khung { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 0.75rem; }
.logo { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.3rem; color: var(--chu); text-decoration: none; letter-spacing: -0.01em; min-height: 44px; }
.logo svg { width: 32px; height: 32px; flex: none; }
.logo b { color: var(--chinh); }
nav.menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
nav.menu a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.25rem; color: var(--chu); text-decoration: none; font-weight: 500; }
nav.menu a:hover { color: var(--chinh); text-decoration: underline; }
nav.menu a[aria-current="page"] { color: var(--chinh); text-decoration: underline; text-decoration-thickness: 2px; }

main { display: block; padding-bottom: 3rem; }
footer.chan { border-top: 1px solid var(--vien); background: var(--mat); color: var(--chu-phu); font-size: 0.95rem; }
.chan .khung { padding-block: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; }
.chan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.chan a { color: var(--chu-phu); display: inline-block; min-height: 24px; }

/* Trang chủ */
.hero { background: linear-gradient(180deg, var(--chinh-nhat), transparent); padding-block: clamp(2rem, 5vw, 4rem) 2rem; }
.khau-hieu { font-size: clamp(1.1rem, 1rem + 0.6vw, 1.35rem); font-weight: 600; color: var(--nhan); margin-bottom: 0.4rem; }
.dinh-vi { color: var(--chu-phu); font-size: 1.1rem; max-width: 46rem; }
form.o-quet { margin-top: 1.5rem; background: var(--mat); border: 1px solid var(--vien); border-radius: 14px; padding: 1.25rem; box-shadow: var(--bong); max-width: 46rem; }
.o-quet label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.hang-nhap { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.hang-nhap input {
  flex: 1 1 16rem; min-height: 48px; padding: 0.6rem 0.85rem; font: inherit; color: var(--chu);
  background: var(--bg); border: 2px solid #6b7686; border-radius: 10px;
}
.hang-nhap input[aria-invalid="true"] { border-color: var(--xau); }
.nut {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 48px; padding: 0.6rem 1.25rem;
  font: inherit; font-weight: 700; color: #fff; background: var(--chinh); border: 2px solid var(--chinh); border-radius: 10px; cursor: pointer; text-decoration: none;
}
.nut:hover { background: var(--chinh-dam); border-color: var(--chinh-dam); color: #fff; }
.nut[disabled] { opacity: 0.7; cursor: progress; }
.nut.phu { background: transparent; color: var(--chinh); }
.nut.phu:hover { background: var(--chinh-nhat); color: var(--chinh-dam); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nut { color: #0b1626; } :root:not([data-theme="light"]) .nut.phu { color: var(--chinh); } }
.goi-y { color: var(--chu-phu); font-size: 0.95rem; margin: 0.6rem 0 0; }
.xac-minh { margin-top: 0.75rem; min-height: 0; }
.bao-loi { color: var(--xau); font-weight: 600; margin: 0.6rem 0 0; }
.bao-loi:empty { display: none; }

.luoi { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.the { background: var(--mat); border: 1px solid var(--vien); border-radius: 12px; padding: 1.1rem 1.2rem; box-shadow: var(--bong); }
.the h3 { margin-top: 0; }
.the p:last-child { margin-bottom: 0; }
.chu-y { border-left: 4px solid var(--nhan); background: var(--nhan-nhat); padding: 0.9rem 1.1rem; border-radius: 8px; margin: 1rem 0; }
.chu-y.xanh { border-left-color: var(--chinh); background: var(--chinh-nhat); }
.chu-y.do { border-left-color: var(--xau); background: var(--xau-nhat); }

/* Trang kết quả */
.tien-do ol { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.35rem; }
.tien-do li { display: flex; align-items: center; gap: 0.6rem; color: var(--chu-phu); }
.tien-do li::before { content: ""; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--vien); flex: none; }
.tien-do li.xong { color: var(--chu); }
.tien-do li.xong::before { background: var(--tot); border-color: var(--tot); }
.tien-do li.dang { color: var(--chu); font-weight: 600; }
.tien-do li.dang::before { border-color: var(--chinh); border-right-color: transparent; animation: quay 0.9s linear infinite; }
@keyframes quay { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tien-do li.dang::before { animation: none; background: var(--chinh); } }

.so-lieu { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0; }
.so-lieu .the { text-align: left; }
.so { display: block; font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.so.tot { color: var(--tot); } .so.vua { color: var(--nhan); } .so.xau { color: var(--xau); }
.nhan-muc { display: inline-block; font-size: 0.85rem; font-weight: 700; padding: 0.05rem 0.6rem; border-radius: 99px; white-space: nowrap; }
.nhan-muc.xau { background: var(--xau-nhat); color: var(--xau); }
.nhan-muc.vua { background: var(--nhan-nhat); color: var(--nhan); }
.nhan-muc.tot { background: var(--tot-nhat); color: var(--tot); }
.nhan-muc.xam { background: var(--chinh-nhat); color: var(--chu-phu); }

details.loi { background: var(--mat); border: 1px solid var(--vien); border-radius: 12px; margin: 0.7rem 0; }
details.loi > summary { cursor: pointer; padding: 0.8rem 1rem; list-style-position: outside; margin-left: 1rem; min-height: 44px; }
details.loi > summary h3 { display: inline; font-size: 1.05rem; margin: 0; }
details.loi .noi-dung { padding: 0 1.1rem 1rem; }
.vi-tri { margin: 0.4rem 0; padding-left: 1.2rem; }
.vi-tri li { margin: 0.25rem 0; word-break: break-word; }
.mau-goi-y { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.o-mau { display: inline-block; width: 1.4rem; height: 1.4rem; border: 1px solid var(--chu-phu); border-radius: 4px; vertical-align: middle; }
.mau-mau { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 4px; border: 1px solid var(--vien); font-weight: 600; }

.anh-luoi { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem; }
figure { margin: 0; }
figure > a { display: block; border-radius: 8px; }
.o-mau-chu { flex: none; vertical-align: middle; }
figure img { display: block; width: 100%; border: 1px solid var(--vien); border-radius: 8px; background: #fff; }
figcaption { font-size: 0.92rem; color: var(--chu-phu); margin-top: 0.3rem; }
.anh-cao img { max-height: 32rem; object-fit: cover; object-position: top; }

.so-do { position: relative; }
.so-do svg.lop { position: absolute; inset: 0; width: 100%; height: 100%; }
.chu-giai { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.95rem; margin: 0.5rem 0; padding: 0; list-style: none; }
.cham { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 50%; vertical-align: -0.1em; margin-right: 0.3rem; border: 2px solid #fff; box-shadow: 0 0 0 1px #333; }

.bang-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--mat); font-size: 0.97rem; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--vien); }
th { background: var(--chinh-nhat); }
caption { text-align: left; font-weight: 600; padding: 0.4rem 0; }

.noi-dung-van-ban { max-width: 50rem; }
.noi-dung-van-ban li { margin: 0.3rem 0; }

/* Báo cáo: đầu báo cáo + mã QR, tóm tắt lãnh đạo, so sánh, tuyên bố */
.dau-bao-cao { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.dau-bao-cao > div { flex: 1 1 20rem; min-width: 0; }
.ma-qr { flex: none; border: 1px solid var(--vien); border-radius: 6px; margin-top: 1.2rem; }
.tom-tat { margin: 1.2rem 0; border-top: 4px solid var(--chinh); }
.chu-tot { color: var(--tot); } .chu-xau { color: var(--xau); }
.o-nhap { font: inherit; color: var(--chu); background: var(--bg); border: 2px solid #6b7686; border-radius: 8px; padding: 0.55rem 0.75rem; width: 100%; max-width: 28rem; min-height: 44px; }
.o-nhap[aria-invalid="true"] { border-color: var(--xau); }
.o-ngan { max-width: 7rem; }
.o-van-ban { font: inherit; width: 100%; color: var(--chu); background: var(--bg); border: 2px solid #6b7686; border-radius: 8px; padding: 0.75rem; }

@media print {
  header.dau nav, footer.chan, .bo-qua, form.o-quet, .khong-in { display: none !important; }
  body { background: #fff; color: #000; }
  details.loi { break-inside: avoid; }
  .tom-tat { box-shadow: none; }
  body.in-tom-tat #vung > :not(.dau-bao-cao):not(.tom-tat):not(.so-lieu) { display: none !important; }
}

/* Thư viện tiêu chí */
.duong-dan { font-size: 0.95rem; color: var(--chu-phu); margin-top: 1rem; }
.duong-dan a { display: inline-flex; align-items: center; min-height: 44px; }
.ma-tc { color: var(--chinh); }
.the-tc { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.so-tc { font-weight: 400; font-size: 0.8em; color: var(--chu-phu); }
.vi-du { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.8rem; }
.vi-du .the { min-width: 0; }
.vi-du-sai { border-top: 4px solid var(--xau); }
.vi-du-dung { border-top: 4px solid var(--tot); }
.vi-du pre { margin: 0; }
.truoc-sau { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem; margin: 2rem 0 1rem; }
.truoc-sau a { display: block; padding: 0.8rem 1rem; border: 1px solid var(--vien); border-radius: 10px; background: var(--mat); text-decoration: none; }
.truoc-sau a span { display: block; font-size: 0.85rem; color: var(--chu-phu); }
.truoc-sau a[rel="next"] { text-align: right; }
.ds-tra-cuu { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.ds-tra-cuu dt { font-weight: 600; }
.ds-tra-cuu dd { margin: 0; word-break: break-word; }
@media (max-width: 30rem) { .ds-tra-cuu { grid-template-columns: 1fr; } .ds-tra-cuu dd { margin-bottom: 0.4rem; } }

/* Tài khoản */
.ds-web { list-style: none; padding: 0; display: grid; gap: 0.8rem; }
.ds-web h3 { margin: 0 0 0.3rem; word-break: break-word; }
.ds-web h4 { display: inline; font-size: 1rem; margin: 0; }
.ds-web code { word-break: break-all; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.thong-bao-tk { font-weight: 600; color: var(--chinh); }
.thong-bao-tk:empty { display: none; }
