/*
 * maloiGree — giao diện tra cứu công khai.
 *
 * MOBILE-FIRST là ràng buộc cứng (CLAUDE.md Mục 3.1):
 *  - thiết kế từ 360px, desktop chỉ là mở rộng;
 *  - vùng chạm >= 44px, nút chính nằm trong tầm ngón cái;
 *  - KHÔNG có tương tác chỉ-hover;
 *  - font input >= 16px để iOS không tự phóng to trang khi gõ.
 */

:root {
    /* Màu lấy TRỰC TIẾP từ file logo (favicon.png): chữ G #0078FF, lá & dấu tick #00C8D9.
       Đỏ CHỈ dùng cho cảnh báo nguy hiểm — không dùng làm màu thương hiệu, để khi thợ thấy đỏ
       là biết "nguy hiểm" chứ không phải trang trí. */
    --gree-xanh: #0078FF;
    --gree-xanh-dam: #0060cc;
    --gree-ngoc: #00C8D9;
    --muc: #16181d;
    --muc-nhat: #5b6472;
    --nen: #f5f7fa;
    --the: #ffffff;
    --vien: #e2e5ea;
    --canh-bao: #b45309;
    --canh-bao-nen: #fff7ed;
    --nguy-hiem: #b91c1c;
    --nguy-hiem-nen: #fef2f2;
    --ok: #15803d;
    --ok-nen: #f0fdf4;
    --bo-goc: 12px;
    --cham-toi-thieu: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--muc);
    background: var(--nen);
}

img { max-width: 100%; height: auto; }

a { color: var(--gree-xanh); }

/* ---------- Thanh trên cùng ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--the);
    border-bottom: 1px solid var(--vien);
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
}

/* Nút quay lại: nằm sát mép trái như thanh điều hướng của app, vùng chạm đủ 44px. */
.quay-lai {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: var(--cham-toi-thieu);
    min-width: var(--cham-toi-thieu);
    margin-left: -6px;
    padding: 0 8px 0 4px;
    border-radius: 10px;
    color: var(--gree-xanh);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    flex: 0 0 auto;
}

.quay-lai:active { background: var(--nen); }

/* Trên màn hẹp chỉ để mũi tên, nhường chỗ cho tên trang. */
@media (max-width: 400px) {
    .quay-lai span { display: none; }
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--muc);
    font-weight: 700;
    min-width: 0;
}

.topbar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar__brand img { width: 34px; height: 34px; }

.topbar__brand span { font-size: 15px; font-weight: 500; }

.topbar__brand b { color: var(--gree-xanh); font-weight: 800; }

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

/* ---------- Ô tìm kiếm ---------- */
.tim-kiem { position: relative; margin-bottom: 14px; }

.tim-kiem__o {
    width: 100%;
    /* >=16px: iOS tự zoom trang nếu input nhỏ hơn, thợ mất khung nhìn đang đọc. */
    font-size: 17px;
    padding: 14px 16px;
    min-height: var(--cham-toi-thieu);
    border: 2px solid var(--vien);
    border-radius: var(--bo-goc);
    background: var(--the);
}

.tim-kiem__o:focus { outline: none; border-color: var(--gree-xanh); }

.tim-kiem__goi-y {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    background: var(--the);
    border: 1px solid var(--vien);
    border-radius: var(--bo-goc);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    overflow: hidden;
    z-index: 30;
}

.tim-kiem__goi-y a {
    display: block;
    padding: 12px 14px;
    min-height: var(--cham-toi-thieu);
    text-decoration: none;
    color: var(--muc);
    border-bottom: 1px solid var(--vien);
}

.tim-kiem__goi-y a:last-child { border-bottom: 0; }

.tim-kiem__goi-y b { color: var(--gree-xanh); }

.tim-kiem__goi-y small { color: var(--muc-nhat); display: block; }

/* ---------- Bộ lọc: cuộn ngang, chạm được ---------- */
.loc { margin-bottom: 16px; }

.loc__nhan { font-size: 13px; color: var(--muc-nhat); margin: 0 0 6px; }

.loc__hang {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.loc__hang::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--vien);
    background: var(--the);
    color: var(--muc);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.chip--chon { background: var(--gree-xanh); border-color: var(--gree-xanh); color: #fff; font-weight: 600; }

/* ---------- Thẻ mã lỗi ---------- */
.ds-the { display: grid; gap: 10px; }

.the {
    display: block;
    background: var(--the);
    border: 1px solid var(--vien);
    border-radius: var(--bo-goc);
    padding: 14px;
    text-decoration: none;
    color: inherit;
}

.the__dau { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }

.ma {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: .5px;
    color: var(--gree-xanh);
    /* Mã lỗi phải đọc chính xác: chữ hoa/thường có ý nghĩa (Pd, dJ). */
    font-variant-ligatures: none;
}

.nhan {
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--nen);
    color: var(--muc-nhat);
    border: 1px solid var(--vien);
}

.nhan--nghiem-trong { background: var(--nguy-hiem-nen); color: var(--nguy-hiem); border-color: #fecaca; }

.nhan--dang-cap-nhat { background: var(--canh-bao-nen); color: var(--canh-bao); border-color: #fed7aa; }

.the__su-co { margin: 0; font-size: 15px; }

.the__tom-tat { margin: 6px 0 0; font-size: 14px; color: var(--muc-nhat); }

.the .nhan--dang-cap-nhat { display: inline-block; margin-top: 8px; }

/* Dấu hiệu "bấm vào còn hướng dẫn" — trông như nút, nằm góc phải dưới (tầm ngón cái). Cả thẻ là
   vùng chạm nên không cần tự đạt 44px; vẫn để đủ to để nhìn thấy ngoài nắng. */
.the__xem {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    margin: 10px 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--gree-xanh);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.the__xem span { font-size: 20px; line-height: 1; }

.the:active .the__xem { background: var(--gree-xanh-dam); }

/* ---------- Trang chi tiết ---------- */
.tieu-de-lon { font-size: 24px; margin: 4px 0 2px; }

.phu-de { color: var(--muc-nhat); margin: 0 0 16px; font-size: 15px; }

.khoi {
    background: var(--the);
    border: 1px solid var(--vien);
    border-radius: var(--bo-goc);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.khoi h2 { font-size: 17px; margin: 0 0 8px; }

.khoi p:last-child { margin-bottom: 0; }

/* Lưu ý an toàn luôn nổi bật nhất và đứng TRƯỚC các bước thao tác. */
.canh-bao {
    border-left: 5px solid var(--nguy-hiem);
    background: var(--nguy-hiem-nen);
    border-color: #fecaca;
}

.canh-bao h2 { color: var(--nguy-hiem); }

.luu-y {
    border-left: 5px solid var(--canh-bao);
    background: var(--canh-bao-nen);
    border-color: #fed7aa;
}

.meo { border-left: 5px solid var(--ok); background: var(--ok-nen); border-color: #bbf7d0; }

/* ---------- Bước ---------- */
.buoc { display: flex; gap: 12px; }

.buoc__so {
    flex: 0 0 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gree-xanh);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buoc__than { flex: 1 1 auto; min-width: 0; }

.buoc__tieu-de { font-size: 16px; margin: 4px 0 6px; }

.ket-qua {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--nen);
    border-radius: 8px;
    font-size: 14px;
}

.ket-qua b { color: var(--ok); }

figure { margin: 12px 0 0; }

/* Ảnh tiêu đề bài: khung 16:9 cố định — ảnh dọc không được chiếm cả màn hình 360px, đẩy nội dung
   xuống dưới màn hình đầu tiên. */
.anh-tieu-de {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    background: var(--nen);
    margin: 8px 0 10px;
}

/* ---------- Bài hướng dẫn nổi bật (đầu trang mã lỗi) ----------
   Viền trái xanh thương hiệu — KHÔNG dùng đỏ/cam: hai màu đó dành cho cảnh báo an toàn. */
.bai-noi-bat {
    background: var(--the);
    border: 1px solid #bfdbfe;
    border-left: 5px solid var(--gree-xanh);
    border-radius: var(--bo-goc);
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 120, 255, .08);
}

.bai-noi-bat__nhan {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gree-xanh);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.bai-noi-bat__tieu-de { font-size: 19px; line-height: 1.35; margin: 0 0 8px; }

.bai-noi-bat__tom-tat { margin: 0 0 10px; font-size: 15px; color: var(--muc-nhat); }

/* Nút chính, full-width, cao >= 44px — bấm bằng ngón cái ngoài nắng. */
.bai-noi-bat__nut {
    display: flex;
    width: 100%;
    border: 0;
    font-family: inherit;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--cham-toi-thieu);
    margin-top: 12px;
    border-radius: 10px;
    background: var(--gree-xanh);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.bai-noi-bat__nut:active { background: var(--gree-xanh-dam); }

.bai-noi-bat__phu { margin: 14px 0 8px; font-size: 14px; font-weight: 700; color: var(--muc-nhat); }

.bai-noi-bat__nhan + .bai-noi-bat__phu, .bai-noi-bat > .bai-noi-bat__phu:first-child { margin-top: 0; }


html { scroll-behavior: smooth; }

.tieu-de-phan { font-size: 18px; margin: 18px 0 10px; }

figcaption { font-size: 13px; color: var(--muc-nhat); margin-top: 6px; }

/* ---------- Bộ ảnh: dải vuốt ngang (spec 03 Mục 4.7) ----------
   Ảnh ~85% bề ngang để ló mép ảnh sau → thợ biết là vuốt được. Không JS. */
.bo-anh__goi-y { font-size: 13px; color: var(--muc-nhat); margin: -4px 0 8px; }

.bo-anh__dai {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding-bottom: 6px;
}

.bo-anh__muc { flex: 0 0 85%; scroll-snap-align: start; margin: 0; min-width: 0; }
.bo-anh__muc:only-child { flex-basis: 100%; }
.bo-anh__muc a { display: block; }
.bo-anh__muc img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    background: var(--vien);
}

@media (min-width: 700px) {
    .bo-anh__muc { flex-basis: calc(50% - 5px); }
}

/* Hộp "Hình ảnh cần kiểm tra" (trang mã lỗi, spec 03 Mục 4.8): <dialog> full màn hình trên mobile,
   lưới 2 cột (mô tả dưới ảnh cần bề ngang để đọc), 3 cột từ 700px. */
.hop-anh {
    width: 100%;
    max-width: 960px;
    height: 100%;
    max-height: 100%;
    margin: auto;
    padding: 0;
    border: 0;
    background: var(--the);
    color: var(--muc);
    overscroll-behavior: contain;
}

@media (min-width: 700px) {
    .hop-anh { width: calc(100% - 32px); height: calc(100% - 48px); border-radius: 12px; }
}

.hop-anh::backdrop { background: rgba(0, 0, 0, .6); }

.hop-anh[open] { display: flex; flex-direction: column; }

.hop-anh__dau {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 16px;
    border-bottom: 1px solid var(--vien);
}

.hop-anh__dau h2 { flex: 1; margin: 0; font-size: 17px; }

.hop-anh__dong {
    width: var(--cham-toi-thieu);
    height: var(--cham-toi-thieu);
    border: 0;
    background: none;
    color: var(--muc);
    font-size: 20px;
    cursor: pointer;
}

.hop-anh__than { flex: 1; overflow-y: auto; padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }

.hop-anh__luoi {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 8px;
}

@media (min-width: 700px) {
    .hop-anh__luoi { grid-template-columns: repeat(3, 1fr); }
}

.hop-anh .bo-anh__muc { margin: 0; min-width: 0; }
.hop-anh .bo-anh__muc a { display: block; }
.hop-anh .bo-anh__muc img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    background: var(--vien);
}

.hop-anh .bo-anh__muc figcaption { font-size: 14px; line-height: 1.35; color: var(--muc); margin-top: 4px; }

/* Ô video trong lưới: vuông như ô ảnh (Shorts cũng cắt vuông — chỉ là ảnh xem trước), nút ▶ nhỏ hơn
   cho vừa ô ~170px ở màn 360px. Phát thật ở lớp phủ toàn màn hình bên dưới. */
.hop-anh__o-video { margin: 0; min-width: 0; }
.hop-anh__luoi .video { border-radius: 6px; }
.hop-anh__luoi .video .video__anh { aspect-ratio: 1 / 1; }
.hop-anh__luoi .video__nut span { width: 48px; height: 48px; font-size: 20px; }
.hop-anh__o-video figcaption { font-size: 14px; line-height: 1.35; color: var(--muc); margin-top: 4px; }

.video--doc .video__anh,
.video--doc iframe { aspect-ratio: 9 / 16; }

/* Lớp phủ phát video của hộp: nền đen toàn màn, khung lớn nhất vừa màn (chừa thanh nút Đóng ở đáy —
   tầm ngón cái). Shorts: cao tối đa, rộng = cao × 9/16; video ngang: rộng tối đa, 16:9. */
.phat-lon {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.phat-lon iframe {
    display: block;
    border: 0;
    width: min(100vw, calc((100dvh - 64px - env(safe-area-inset-bottom)) * 16 / 9));
    aspect-ratio: 16 / 9;
}

.phat-lon--doc iframe {
    width: min(100vw, calc((100dvh - 64px - env(safe-area-inset-bottom)) * 9 / 16));
    aspect-ratio: 9 / 16;
}

.phat-lon__dong {
    position: absolute;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    min-width: 140px;
    min-height: var(--cham-toi-thieu);
    border: 1.5px solid #fff;
    border-radius: 22px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* Trình xem toàn màn hình (PhotoSwipe): thanh nút xuống ĐÁY — tầm ngón cái. Tiền tố `.pswp` để
   thắng CSS của PhotoSwipe nạp sau. */
.pswp .pswp__top-bar {
    top: auto;
    bottom: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(0, 0, 0, .55);
}

.pswp .pswp__chu-thich {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom));
    padding: 10px 16px;
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
    pointer-events: none;
}

/* ---------- Video: chỉ nạp iframe khi bấm play ---------- */
.video { position: relative; border-radius: 10px; overflow: hidden; background: #000; }

.video__anh { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }

.video__nut {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    /* Vùng chạm phủ toàn khung — ngoài nắng khó bấm trúng nút nhỏ. */
    min-height: var(--cham-toi-thieu);
}

.video__nut span {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(0, 120, 255, .92);
    color: #fff;
    font-size: 26px;
    display: flex; align-items: center; justify-content: center;
}

.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }

/* ---------- Bảng trị số: cuộn ngang trong khung riêng ---------- */
.bang-cuon { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }

th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--vien); white-space: nowrap; }

th { color: var(--muc-nhat); font-weight: 600; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }

.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; min-height: var(--cham-toi-thieu); }

.checklist input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }

.bat-buoc { color: var(--nguy-hiem); font-size: 12px; }

/* ---------- Nút ---------- */
.nut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--cham-toi-thieu);
    padding: 12px 18px;
    border-radius: var(--bo-goc);
    border: 1px solid var(--vien);
    background: var(--the);
    color: var(--muc);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.nut--chinh { background: var(--gree-xanh); border-color: var(--gree-xanh); color: #fff; }

.nut--rong { width: 100%; }

/* Hàng phản hồi đặt cuối trang, trong tầm ngón cái. */
.phan-hoi { display: flex; gap: 10px; margin-top: 8px; }

.phan-hoi form { flex: 1 1 0; }

.alert { padding: 12px 14px; border-radius: var(--bo-goc); margin-bottom: 14px; font-size: 15px; }

.alert--ok { background: var(--ok-nen); color: var(--ok); border: 1px solid #bbf7d0; }

.alert--loi { background: var(--nguy-hiem-nen); color: var(--nguy-hiem); border: 1px solid #fecaca; }

/* ---------- Trạng thái đang cập nhật ---------- */
.dang-cap-nhat {
    text-align: center;
    padding: 28px 16px;
    background: var(--canh-bao-nen);
    border: 1px dashed #fdba74;
    border-radius: var(--bo-goc);
    color: var(--canh-bao);
}

.dang-cap-nhat strong { display: block; font-size: 18px; margin-bottom: 6px; }

/* ---------- Chọn dòng máy ---------- */
.chon-dong-may { display: grid; gap: 10px; }

.chon-dong-may a { text-align: left; }

.rong { text-align: center; color: var(--muc-nhat); padding: 32px 12px; }

.footer {
    /* Nền tối: đây mới là chỗ dùng đúng logo chữ TRẮNG (logo.png). */
    background: #101827;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
    text-align: center;
    color: #9aa4b2;
    font-size: 13px;
}

.footer__logo { width: 104px; height: auto; opacity: .95; margin-bottom: 10px; }

.footer p { margin: 4px 0; }

.footer__note { font-size: 12px; }

.phan-trang { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.phan-trang a, .phan-trang span {
    min-width: var(--cham-toi-thieu);
    min-height: var(--cham-toi-thieu);
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--vien);
    border-radius: 8px;
    background: var(--the);
    text-decoration: none;
    color: var(--muc);
}

.phan-trang .active { background: var(--gree-xanh); color: #fff; border-color: var(--gree-xanh); }

@media (min-width: 720px) {
    .container { padding: 24px 16px 56px; }
    .tieu-de-lon { font-size: 28px; }
    .ds-the { grid-template-columns: 1fr 1fr; }
}

/* ---------- Quét serial bằng camera ---------- */
.nut--quet {
    margin-bottom: 14px;
    border-color: var(--gree-xanh);
    color: var(--gree-xanh);
    background: #fff;
}

.quet-modal {
    display: none;                 /* JS đổi thành flex khi mở */
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .85);
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.quet-panel {
    width: 100%;
    max-width: 440px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--the);
    border-radius: 14px;
    padding: 16px;
    /* iPhone không phím Home: chừa chỗ cho dải home indicator, nếu không nút cuối bị che. */
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.quet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.quet-header h2 { font-size: 17px; margin: 0; }

.quet-dong {
    width: var(--cham-toi-thieu);
    height: var(--cham-toi-thieu);
    border: 0;
    border-radius: 10px;
    background: var(--nen);
    color: var(--muc);
    font-size: 22px;
    cursor: pointer;
}

/*
 * ⚠ KHUNG NÀY PHẢI CÓ KÍCH THƯỚC THẬT TRƯỚC KHI GỌI start().
 *   html5-qrcode đo bề rộng container để tính vùng quét — nếu lúc đó container đang `display:none`
 *   hoặc rộng 0 thì trình duyệt vẫn HỎI QUYỀN camera, cấp quyền xong KHÔNG hiện gì.
 *   Đã dính đúng lỗi này 2026-08-14 do rule `#quetView:empty { display:none }`.
 *   Muốn ẩn thì dùng class `.quet-view--an` do JS bật/tắt, KHÔNG dùng :empty.
 */
#quetView {
    width: 100%;
    min-height: 240px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}

#quetView.quet-view--an { display: none; }

/* Thư viện chèn <video> vào trong — ép lấp đầy khung, không để tràn ra ngoài bo góc. */
#quetView video {
    width: 100% !important;
    height: auto !important;
    display: block;
}

.quet-goi-y {
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--muc-nhat);
    text-align: center;
}

.quet-goi-y:empty { display: none; }

.quet-ok {
    margin: 10px 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--ok-nen);
    color: var(--ok);
    text-align: center;
    font-size: 16px;
}

.quet-loi {
    margin: 10px 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--canh-bao-nen);
    color: var(--canh-bao);
    font-size: 15px;
    line-height: 1.5;
}

.quet-sua { font-size: 13px; color: var(--muc-nhat); text-align: center; margin: 8px 0 0; }

.quet-ds { display: grid; gap: 8px; margin-top: 10px; }

.quet-tay { margin-top: 14px; border-top: 1px solid var(--vien); padding-top: 14px; }

.quet-tay label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--muc-nhat); }

.quet-tay input {
    width: 100%;
    /* >=16px: iOS tự phóng to trang khi focus nếu nhỏ hơn — mất khung nhìn đang thao tác. */
    font-size: 17px;
    padding: 12px 14px;
    min-height: var(--cham-toi-thieu);
    border: 2px solid var(--vien);
    border-radius: 10px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.quet-tay input:focus { outline: none; border-color: var(--gree-xanh); }

.quet-rieng-tu {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--muc-nhat);
    text-align: center;
}

/* ---------- Lọc nhanh theo ký tự đầu + bảng đối chiếu đèn LED ---------- */
.chip--ky-tu {
    min-width: 44px;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
}

.chip--ma { font-weight: 700; letter-spacing: .5px; }

.loc__hang--cuon { flex-wrap: wrap; overflow-x: visible; }

.doi-chieu {
    background: var(--the);
    border: 1px solid var(--vien);
    border-radius: var(--bo-goc);
    padding: 0 14px;
    margin-bottom: 16px;
}

.doi-chieu > summary {
    /* Vùng chạm đủ lớn: đây là thứ thợ bấm khi đang bối rối không đọc được đèn. */
    min-height: var(--cham-toi-thieu);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    color: var(--gree-xanh);
    font-weight: 600;
    padding: 10px 0;
}

.doi-chieu__mo-ta { font-size: 14px; color: var(--muc-nhat); margin: 0 0 12px; }

.doi-chieu__tieu-de { font-size: 14px; margin: 14px 0 8px; color: var(--muc-nhat); }

.doi-chieu__bang {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 8px;
    padding-bottom: 14px;
}

.doi-chieu__o {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border: 1px solid var(--vien);
    border-radius: 8px;
    background: #0d1117;               /* nền tối cho giống mặt đèn thật */
}

.doi-chieu__o b { color: #fff; font-size: 15px; }

/* Đoạn sáng / tắt của đèn 7 đoạn */
.den-led__on { fill: #00d2ff; }
.den-led__off { fill: #22303c; }

.doi-chieu__nham { display: grid; gap: 10px; }

.nham {
    border: 1px solid var(--vien);
    border-radius: 10px;
    padding: 10px 12px;
}

.nham__cap { display: flex; align-items: center; gap: 14px; }

.nham__cap > span {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0d1117;
    border-radius: 8px;
    padding: 6px 10px;
}

.nham__cap b { color: #fff; font-size: 16px; }

.nham__vs { background: none !important; color: var(--muc-nhat); font-size: 18px; padding: 0 !important; }

.nham__ghi-chu { margin: 8px 0 0; font-size: 13px; color: var(--muc-nhat); }

/* Nút "chụp/chọn ảnh tem" — bọc input file ẩn, phải chiếm nguyên hàng để dễ bấm */
.quet-anh { display: block; margin-top: 10px; }
.quet-anh .nut { cursor: pointer; }
