:root {
  --xanh: #0F6E56;
  --xanh-nhat: #E6F2EE;
  --vang: #BA7517;
  --vang-nhat: #FBF1E3;
  --nen: #F7F6F2;
  --giay: #FFFFFF;
  --chu: #1F2421;
  --chu-phu: #5C645F;
  --vien: #DAD8D0;
  --do: #B3261E;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--nen); color: var(--chu); font: 16px/1.5 "Segoe UI", Arial, sans-serif; }
button { font: inherit; cursor: pointer; }

.dau-trang { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 20px; background: var(--xanh); color: #fff; }
.ten-app { font-family: "Times New Roman", serif; font-size: 22px; font-weight: bold; }
.phan-app { display: flex; gap: 6px; flex-wrap: wrap; }
.phan-app button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: 6px 12px; }
.phan-app button.dang-chon { background: #fff; color: var(--xanh); font-weight: 600; }

.khung { max-width: 1200px; margin: 0 auto; padding: 16px; }
.loi-vao-khung { background: var(--giay); border: 1px solid var(--vien); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.loi-vao { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.loi-vao button { border: 1px solid var(--xanh); background: var(--giay); color: var(--xanh); border-radius: 20px; padding: 7px 16px; }
.loi-vao button.dang-chon { background: var(--xanh); color: #fff; }
#o-loi-vao { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
#o-loi-vao label { display: flex; flex-direction: column; font-size: 14px; color: var(--chu-phu); gap: 4px; }
#o-loi-vao select, #o-tim { font: inherit; padding: 7px 10px; border: 1px solid var(--vien); border-radius: 6px; min-width: 180px; background: #fff; }
#o-tim { width: 100%; }
.chip-hang { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--vang); background: var(--vang-nhat); color: #6B430A; border-radius: 16px; padding: 4px 12px; }
.de-tai-nhom { display: grid; gap: 10px; width: 100%; }
.ten-nhom { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--xanh); }
.chip.mo { opacity: .55; }
.chip.dang-chon { background: var(--vang); color: #fff; }

.hai-cot { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.bo-loc { background: var(--giay); border: 1px solid var(--vien); border-radius: 10px; padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.bo-loc summary { font-weight: 600; cursor: pointer; }
.bo-loc fieldset { border: 0; border-top: 1px solid var(--vien); margin: 10px 0 0; padding: 8px 0 0; }
.bo-loc legend { font-weight: 600; color: var(--xanh); font-size: 14px; padding: 0; }
.bo-loc label { display: block; font-size: 14px; padding: 2px 0; }
.bo-loc fieldset[data-nhom-loc=de_tai], .bo-loc fieldset[data-nhom-loc=the_loai] { max-height: 320px; overflow: auto; }
.bo-loc .cha { font-weight: 600; }
.bo-loc .con { padding-left: 22px; }
.bo-loc label.mo { color: #A3A7A4; }
.bo-loc .so { color: var(--chu-phu); }
.nut-phu { margin-top: 8px; border: 1px solid var(--vien); background: #fff; border-radius: 6px; padding: 4px 10px; font-size: 14px; }

.dem { margin: 0 0 8px; color: var(--chu-phu); }
#ket-qua { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dong-the { width: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--giay); border: 1px solid var(--vien); border-radius: 8px; padding: 10px 14px; }
.dong-the:hover { border-color: var(--xanh); }
.dong-the .ten { font-family: "Times New Roman", serif; font-size: 18px; font-weight: bold; flex: 1 1 100%; }
.dong-the .tac-gia { color: var(--chu-phu); margin-right: 6px; }
.nhan { font-size: 13px; background: var(--xanh-nhat); color: var(--xanh); border-radius: 4px; padding: 1px 8px; }
.dau { font-size: 13px; border-radius: 4px; padding: 1px 8px; margin-left: auto; }
.dau.chua { background: #EEF6EA; color: #2E6B1F; }
.dau.trung { background: #FCE8E6; color: var(--do); }
.dau.trung + .dau { margin-left: 0; }
.dau.da { background: var(--vang-nhat); color: #8A5410; }
.trong { padding: 20px; text-align: center; color: var(--chu-phu); }

#man-the { position: fixed; inset: 0; background: rgba(20,25,22,.45); overflow: auto; padding: 24px 12px; z-index: 10; }
#man-the[hidden], #thong-bao[hidden] { display: none; }
.the { position: relative; max-width: 820px; margin: 0 auto; background: var(--giay); border-radius: 12px; padding: 24px 28px; }
.nut-dong { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 22px; color: var(--chu-phu); }
.ma-the { margin: 0; font-size: 13px; color: var(--chu-phu); }
.the h2 { font-family: "Times New Roman", serif; font-size: 26px; margin: 4px 0 2px; color: var(--xanh); }
.tac-gia-lon { margin: 0 0 12px; font-style: italic; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.nut-chinh { background: var(--xanh); color: #fff; border: 0; border-radius: 6px; padding: 8px 18px; }
.nut-khoa { background: #EDECE7; color: #7A7E7B; border: 1px dashed #B9B8B1; border-radius: 6px; padding: 8px 18px; }
.the section { border-top: 1px solid var(--vien); margin-top: 14px; padding-top: 10px; }
.the h3 { margin: 0 0 6px; font-size: 16px; color: var(--vang); text-transform: uppercase; letter-spacing: .03em; }
.van-ban { font-family: "Times New Roman", serif; font-size: 18px; line-height: 1.6; white-space: pre-wrap; text-indent: 0; }
.van-ban.tho { padding-left: 1.27cm; }
.ghi-chu-noi-bo { background: var(--vang-nhat); border-left: 4px solid var(--vang); padding: 8px 12px; border-radius: 6px; font-size: 14px; white-space: pre-wrap; }
.loi-dan { font-style: italic; color: var(--chu-phu); }
.phu { color: var(--chu-phu); font-size: 14px; margin: 0 0 6px; }
.canh-bao { color: var(--do); font-size: 14px; }
.the dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; }
.the dt { color: var(--chu-phu); }
.the dd { margin: 0; }
.bang-lop { border-collapse: collapse; width: 100%; font-size: 14px; margin: 6px 0; }
.bang-lop th, .bang-lop td { border: 1px solid var(--vien); padding: 5px 8px; text-align: left; vertical-align: top; }
.lien-ket { border: 0; background: none; color: var(--xanh); text-decoration: underline; padding: 0; }

.nut-vang { background: var(--vang) !important; border-color: var(--vang) !important; font-weight: 600; }
.hop, #form-the { background: var(--giay); border: 1px solid var(--vien); border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; }
.hop h2, #form-the h2 { margin: 0; color: var(--xanh); font-family: "Times New Roman", serif; }
.hop h3 { margin: 16px 0 2px; color: var(--vang); font-size: 16px; }
.hang-tieu-de { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.nut-file { display: inline-block; cursor: pointer; margin-top: 0; }
.hang-nut .nut-phu { margin-top: 0; }
.ds-bs { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.dong-bs { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border: 1px solid var(--vien); border-radius: 8px; padding: 8px 12px; }
.nut-xoa { color: var(--do); }
#form-the fieldset { border: 1px solid var(--vien); border-radius: 8px; margin: 14px 0; padding: 10px 14px 14px; }
#form-the legend { font-weight: 700; color: var(--xanh); padding: 0 6px; }
#form-the label { display: block; margin: 8px 0; font-size: 14px; color: var(--chu-phu); }
#form-the input:not([type=checkbox]):not([type=radio]):not([type=file]), #form-the select, #form-the textarea { display: block; width: 100%; margin-top: 3px; font: inherit; color: var(--chu); padding: 7px 10px; border: 1px solid var(--vien); border-radius: 6px; background: #fff; }
#form-the textarea[name=van_ban] { font-family: "Times New Roman", serif; font-size: 18px; line-height: 1.6; }
#form-the .o-tron { display: inline-flex; align-items: center; gap: 4px; margin: 3px 12px 3px 0; color: var(--chu); }
.hang-o { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.luoi-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.nhan-o { margin: 12px 0 4px; font-size: 14px; font-weight: 600; color: var(--chu); }
.o-de-tai { max-height: 260px; overflow: auto; border: 1px solid var(--vien); border-radius: 6px; padding: 6px 10px; display: grid; gap: 6px; }
.dong-lap { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 6px; }
.dong-lap > * { margin-top: 0 !important; }
.dong-lop select { flex: 0 0 auto; width: auto !important; }
.dong-lop select[data-f=bai] { max-width: 320px; }
.dong-lap input, .dong-lap textarea { flex: 1 1 0; }
.dong-ghi-chu select { width: auto !important; }
.nut-bo { border: 1px solid var(--vien); background: #fff; border-radius: 6px; padding: 6px 10px; color: var(--chu-phu); }
.o-bao-trung { background: #FCE8E6; color: var(--do); border-left: 4px solid var(--do); border-radius: 6px; padding: 8px 12px; font-size: 14px; margin: 6px 0; }
.o-bao-trung[hidden] { display: none; }
.xem-anh { display: flex; flex-wrap: wrap; gap: 10px; }
.xem-anh img { display: block; max-width: 160px; max-height: 220px; border: 1px solid var(--vien); }
.thanh-luu { position: sticky; bottom: 0; background: var(--giay); padding: 10px 0; border-top: 1px solid var(--vien); }

.ds-khung { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.dong-khung { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 8px 10px; }
.dong-khung.dang-chon { border-color: var(--xanh); background: var(--xanh-nhat); }
.thong-tin-khung { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 15px; }
.thong-tin-khung dt { color: var(--chu-phu); }
.thong-tin-khung dd { margin: 0; }
.cuon-ngang { overflow-x: auto; }
.bang-khung { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0; }
.bang-khung th, .bang-khung td { border: 1px solid var(--vien); padding: 5px 7px; text-align: left; vertical-align: top; }
.bang-khung th { background: var(--xanh-nhat); color: var(--xanh); }
.bang-khung tfoot td { background: var(--nen); }
.o-nho { font: inherit; padding: 3px 6px; border: 1px solid var(--vien); border-radius: 4px; }
.o-ten { font: inherit; width: 100%; padding: 4px 8px; border: 1px solid var(--vien); border-radius: 6px; }
.ket-qua-kiem-tra { border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-size: 14px; }
.ket-qua-kiem-tra ul { margin: 6px 0 0; padding-left: 18px; }
.ket-qua-kiem-tra.dat { background: #EEF6EA; color: #2E6B1F; }
.ket-qua-kiem-tra.co-loi { background: #FCE8E6; color: var(--do); }
#man-ra-de .hai-cot { grid-template-columns: 300px 1fr; }

#thong-bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--chu); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .hai-cot { grid-template-columns: 1fr; }
  .bo-loc { position: static; max-height: none; }
  .bo-loc summary { padding: 4px 0; }
  .bo-loc details:not([open]) summary::after { content: " (bấm để mở)"; font-weight: 400; color: var(--chu-phu); font-size: 14px; }
  .the { padding: 20px 16px; }
  #o-loi-vao label, #o-loi-vao select { width: 100%; }
  .luoi-2 { grid-template-columns: 1fr; }
  #man-ra-de .hai-cot { grid-template-columns: 1fr; }
  .dong-lap { flex-wrap: wrap; }
  .dong-lop select[data-f=bai] { max-width: none; flex: 1 1 100%; width: 100% !important; }
}
.hang-loc { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ds-yccd { list-style: none; padding: 0; display: grid; gap: 8px; }
.ds-yccd li { background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 8px 10px; }

/* ---------- Ra đề: soạn đề ba cột ---------- */
.khung-rong { max-width: 1760px; }
.tab-con { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 2px solid var(--vien); }
.tab-con button { background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 8px 16px; color: var(--chu-phu); font-weight: 600; }
.tab-con button.dang-chon { color: var(--xanh); border-bottom-color: var(--xanh); }

.tab-cot { display: none; }
.soan-de { display: grid; gap: 12px; align-items: start; grid-template-columns: 300px minmax(640px, 760px) minmax(440px, 1fr); }
.cot-trai, .cot-phai { position: sticky; top: 8px; max-height: calc(100vh - 150px); overflow: auto; }
.cot-giua { min-width: 0; }

.cot-trai .trai-dau { display: flex; justify-content: space-between; align-items: center; }
.cot-trai h3, .cot-phai h3 { margin: 0; font-size: 17px; color: var(--xanh); }
.cot-trai h4 { margin: 14px 0 6px; font-size: 15px; color: var(--xanh); }
.cot-trai label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--chu-phu); margin: 8px 0; }
.cot-trai select, .cot-trai input:not([type=checkbox]), .cot-trai textarea { font: inherit; font-size: 15px; color: var(--chu); padding: 6px 8px; border: 1px solid var(--vien); border-radius: 6px; background: #fff; width: 100%; }
.cot-trai label.o-chon { flex-direction: row; align-items: center; gap: 6px; }
.cot-trai .hang-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.cot-trai .thong-tin-khung { font-size: 14px; margin: 8px 0; }
.cot-trai .nho { font-size: 13px; color: var(--chu-phu); }
.cot-trai .o-tom-tat { background: var(--xanh-nhat); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }
.cot-trai .o-tom-tat b { display: block; }
.cot-trai .dong-luu { display: flex; gap: 6px; align-items: center; justify-content: space-between; border: 1px solid var(--vien); border-radius: 6px; padding: 5px 8px; margin: 5px 0; font-size: 13px; background: #fff; }
.cot-trai .dong-luu span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nut-xanh { background: var(--xanh); color: #fff; border: 1px solid var(--xanh); border-radius: 6px; padding: 6px 12px; }
.nut-xanh:disabled { background: #9FB8B0; border-color: #9FB8B0; cursor: not-allowed; }
.hang-nut { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

/* Trang giấy */
.giay-de { background: #fff; border: 1px solid var(--vien); border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 28px 34px; font-family: "Times New Roman", serif; font-size: 18px; line-height: 1.55; }
.giay-de h3 { text-align: center; margin: 6px 0 14px; font-size: 20px; text-transform: uppercase; }
.giay-de .de-dau { text-align: center; font-size: 16px; color: var(--chu-phu); }
.giay-de h4 { margin: 22px 0 8px; font-size: 18px; display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; justify-content: space-between; }
.giay-de h4 .nut-bo { font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; font-weight: 400; }
.ngu-lieu { border-left: 4px solid var(--vang); background: var(--vang-nhat); padding: 10px 16px; margin: 10px 0 16px; }
.ngu-lieu .vb { white-space: pre-wrap; margin: 8px 0; }
.ngu-lieu .loi-dan { font-style: italic; }
.ngu-lieu .nguon { font-size: 15px; text-align: right; color: var(--chu-phu); }
.ngu-lieu .chu-thich { font-size: 14px; border-top: 1px solid var(--vien); margin-top: 8px; padding-top: 6px; }
.ngu-lieu.trong { border-left-color: var(--vien); background: var(--nen); color: var(--chu-phu); font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; }
.cau { border: 1px solid var(--vien); border-left: 4px solid var(--vien); border-radius: 6px; padding: 8px 12px; margin: 10px 0; background: #fff; font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; }
.cau.sang { border-left-color: var(--xanh); background: #F3FAF7; box-shadow: 0 0 0 1px var(--xanh); }
.cau.da-duyet { border-left-color: #2E6B1F; }
.cau-dau { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-family: "Times New Roman", serif; font-size: 17px; }
.cau-dau .o-diem { width: 62px; font: inherit; font-size: 15px; padding: 2px 6px; border: 1px solid var(--vien); border-radius: 4px; }
.cau-dau select { font: inherit; font-size: 14px; padding: 2px 6px; border: 1px solid var(--vien); border-radius: 4px; }
.cau-dau .nut-duyet { margin-left: auto; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; display: inline-flex; gap: 4px; align-items: center; color: var(--chu-phu); }
.cau textarea { width: 100%; margin-top: 8px; font: inherit; font-family: "Times New Roman", serif; font-size: 17px; line-height: 1.5; padding: 6px 8px; border: 1px solid var(--vien); border-radius: 6px; resize: vertical; }
.cau-yccd { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-y { background: var(--xanh-nhat); color: var(--xanh); border-radius: 12px; padding: 1px 9px; font-size: 13px; font-weight: 600; cursor: help; }
.chip-y.la { background: var(--vang-nhat); color: var(--vang); }
.hop-gan { border: 1px dashed var(--vien); border-radius: 6px; padding: 6px 10px; margin-top: 6px; max-height: 220px; overflow: auto; background: var(--nen); }
.hop-gan .dong-y { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; margin: 5px 0; }
.hop-gan .dong-y input { margin-top: 4px; }
.the-muc { display: inline-block; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.muc-nb { background: #E3EEF8; color: #1D4E7D; }
.muc-th { background: var(--vang-nhat); color: var(--vang); }
.muc-vd { background: #F9E6D6; color: #9A4A0F; }
.muc-vdc { background: #F6DDDB; color: var(--do); }

/* Cột phải */
.cot-phai .tab-phai { display: flex; gap: 2px; border-bottom: 2px solid var(--vien); margin: 8px 0 10px; flex-wrap: wrap; }
.cot-phai .tab-phai button { background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 6px 10px; color: var(--chu-phu); font-size: 14px; font-weight: 600; }
.cot-phai .tab-phai button.dang-chon { color: var(--xanh); border-bottom-color: var(--xanh); }
.cot-phai table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.cot-phai th, .cot-phai td { border: 1px solid var(--vien); padding: 4px 6px; text-align: left; vertical-align: top; }
.cot-phai th { background: var(--xanh-nhat); color: var(--xanh); }
.cot-phai td.so { text-align: center; }
.cot-phai td:first-child { white-space: nowrap; }
.cot-phai tr.sang td { background: #FFF6DD; }
.cot-phai tr.sang td:first-child { box-shadow: inset 4px 0 0 var(--vang); }
.cot-phai tfoot td { background: var(--nen); font-weight: 600; }
.cot-phai textarea { width: 100%; font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--vien); border-radius: 4px; resize: vertical; }
.cot-phai .chua { color: var(--chu-phu); font-style: italic; }
.cot-phai .nhom-kt { margin: 10px 0 4px; font-weight: 700; font-size: 14px; }
.cot-phai ul.kt { margin: 4px 0; padding: 0; list-style: none; }
.cot-phai ul.kt li { padding: 6px 8px 6px 10px; border-left: 4px solid; border-radius: 4px; margin: 5px 0; font-size: 14px; }
.cot-phai ul.kt li.loi { background: #FCE8E6; border-color: var(--do); color: var(--do); }
.cot-phai ul.kt li.nhac { background: var(--vang-nhat); border-color: var(--vang); }
.cot-phai ul.kt li button { background: none; border: 0; padding: 0; text-decoration: underline; color: inherit; cursor: pointer; font-size: 13px; margin-left: 6px; }
.cot-phai .dat { background: #EEF6EA; color: #2E6B1F; border-radius: 8px; padding: 10px 12px; font-size: 14px; }

/* Thanh trạng thái */
.thanh-trang-thai { position: sticky; bottom: 0; z-index: 5; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 8px 14px; font-size: 14px; box-shadow: 0 -2px 8px rgba(0,0,0,.05); }
.thanh-trang-thai .tt { display: inline-flex; gap: 5px; align-items: baseline; }
.thanh-trang-thai .tt b { font-size: 17px; }
.thanh-trang-thai .tot b { color: #2E6B1F; }
.thanh-trang-thai .loi b { color: var(--do); }
.thanh-trang-thai .canh b { color: var(--vang); }
.thanh-trang-thai small { color: var(--chu-phu); }
.thanh-trang-thai .nut-viec { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.thanh-trang-thai .gian { margin-left: auto; }

@media (max-width: 1600px) {
  .soan-de { grid-template-columns: 260px minmax(600px, 1.1fr) minmax(420px, 1fr); }
}
@media (max-width: 1366px) {
  .soan-de { grid-template-columns: 260px minmax(560px, 1fr) minmax(380px, 440px); }
}
@media (min-width: 1101px) and (max-width: 1366px) {
  .soan-de.thu-gon { grid-template-columns: 44px minmax(580px, 1fr) minmax(400px, 440px); }
}
@media (min-width: 761px) {
  .soan-de.thu-gon .cot-trai .trai-ruot { display: none; }
  .soan-de.thu-gon .cot-trai h3 { display: none; }
  .soan-de.thu-gon .cot-trai { padding: 8px 6px; text-align: center; }
  .soan-de.thu-gon .cot-trai .trai-dau { justify-content: center; }
}
@media (max-width: 1100px) {
  .soan-de { grid-template-columns: 260px minmax(0, 1fr); }
  .soan-de.thu-gon { grid-template-columns: 44px minmax(0, 1fr); }
  .cot-phai { grid-column: 1 / -1; position: static; max-height: none; }
  .cot-trai { max-height: none; }
}
@media (max-width: 760px) {
  .tab-cot { display: flex; gap: 4px; margin-bottom: 10px; position: sticky; top: 0; z-index: 6; background: var(--nen); padding: 4px 0; }
  .tab-cot button { flex: 1; background: #fff; border: 1px solid var(--vien); border-radius: 18px; padding: 6px 4px; font-size: 14px; color: var(--chu-phu); }
  .tab-cot button.dang-chon { background: var(--xanh); color: #fff; border-color: var(--xanh); }
  .soan-de { grid-template-columns: 1fr; }
  .soan-de > section { display: none; position: static; max-height: none; }
  .soan-de[data-hien=trai] .cot-trai, .soan-de[data-hien=de] .cot-giua, .soan-de[data-hien=phai] .cot-phai { display: block; }
  #sd-thu { display: none; }
  .giay-de { padding: 16px 14px; font-size: 17px; }
  .thanh-trang-thai { gap: 6px 12px; padding: 6px 10px; font-size: 13px; }
  .thanh-trang-thai .gian { margin-left: 0; }
  .tab-con button { padding: 8px 10px; font-size: 14px; }
}

/* ---------- Nhận diện thương hiệu (chỉ bản demo) ---------- */
.the-thu { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 1px 8px; border-radius: 10px; background: #E9E9E6; color: #6B6F6C; font: 400 12px/1.5 "Segoe UI", Arial, sans-serif; letter-spacing: .2px; }
.chan-trang { margin: 28px auto 0; max-width: 1200px; padding: 22px 16px 28px; border-top: 1px solid rgba(0,0,0,.1); text-align: center; }
.con-dau { display: block; max-width: 260px; margin: 0 auto; padding: 4px; border: 1px solid #c59b5f; border-radius: 8px; opacity: .65; transition: opacity .2s; }
.con-dau:hover { opacity: .95; }
.con-dau .vien-trong { border: 1.5px solid #b71c1c; padding: 7px 8px 8px; color: #b71c1c; line-height: 1.35; }
.con-dau .d1 { font: 600 10px/1.4 "Segoe UI", Arial, sans-serif; letter-spacing: .6px; }
.con-dau .d2 { font: 700 19px/1.3 "Times New Roman", serif; letter-spacing: 1px; margin: 1px 0 2px; }
.con-dau .d3, .con-dau .d4 { font: 400 11.5px/1.45 "Segoe UI", Arial, sans-serif; }
.con-dau .d4 { font-weight: 700; }
.con-dau a { color: inherit; text-decoration: none; }
.con-dau a:hover { text-decoration: underline; }
.chu-thich-demo { margin: 10px 0 0; font-size: 11px; color: #A3A6A3; }

/* ---------- Ma trận và bản đặc tả tự sinh ---------- */
.bang-van-ban th, .bang-van-ban td { font-size: 13px; }
.bang-van-ban td.so { text-align: center; white-space: nowrap; }
.bang-van-ban td:first-child { white-space: nowrap; }
.bang-van-ban .goi-y { color: var(--chu-phu); font-size: 11.5px; font-style: italic; }
.bang-van-ban .ma-y { color: var(--chu-phu); font-size: 11px; background: var(--nen); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.bang-van-ban .chua-gan { color: var(--do); font-style: italic; }
.bang-van-ban .the-muc { font-size: 11.5px; }
.ghi-chu-bang { font-size: 12.5px; color: var(--chu-phu); margin: 6px 0 0; }
.cot-phai .hang-nut { margin-top: 0; }
.cot-phai .cuon-ngang { overflow-x: auto; }
.cot-phai td.so, .cot-phai th { text-align: center; }

.phu-lop { position: fixed; inset: 0; z-index: 30; background: rgba(20,24,22,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow: auto; }
.phu-lop[hidden] { display: none; }
.phu-lop-ruot { position: relative; background: #fff; border-radius: 10px; padding: 36px 20px 20px; max-width: 1400px; width: 100%; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.phu-lop-ruot .nut-dong { position: absolute; top: 8px; right: 10px; }
.phu-lop .bang-van-ban { border-collapse: collapse; width: 100%; }
.phu-lop .bang-van-ban th, .phu-lop .bang-van-ban td { font-size: 14.5px; padding: 6px 9px; border: 1px solid var(--vien); text-align: left; vertical-align: top; }
.phu-lop .bang-van-ban th { background: var(--xanh-nhat); color: var(--xanh); text-align: center; }
.phu-lop .bang-van-ban td.so { text-align: center; }
.phu-lop .bang-van-ban tfoot td { background: var(--nen); font-weight: 600; }
.cau .o-dv { width: 100%; margin-top: 6px; font: inherit; font-size: 14px; padding: 4px 8px; border: 1px solid var(--vien); border-radius: 6px; color: var(--chu-phu); background: #fff; }
.cau .o-dv:focus { color: var(--chu); }

.cot-phai .bang-van-ban { min-width: 500px; }
.bang-van-ban td.mo-ta { min-width: 210px; }
.bang-van-ban td:nth-child(3) { min-width: 110px; }
.bang-van-ban th { white-space: nowrap; }

/* ---------- Đầu trang đề, in và xuất ---------- */
.hang-hanh-dong { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 10px; font-size: 14px; }
.hang-hanh-dong .o-chon { display: inline-flex; gap: 5px; align-items: center; color: var(--chu-phu); }
.bang-dau-de { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 16px; line-height: 1.45; }
.bang-dau-de td { border: none; vertical-align: top; text-align: center; padding: 0 4px; }
.bang-dau-de td.trai { width: 42%; }
.giay-de h3.chua-ten { color: var(--chu-phu); font-weight: 400; font-style: italic; text-transform: none; font-size: 17px; }
.giay-de .thuong-hieu { margin-top: 26px; text-align: center; font-family: "Segoe UI", Arial, sans-serif; font-size: 11px; color: var(--chu-phu); opacity: .45; }
.vung-in { display: none; }

@media print {
  @page { size: A4; margin: 2cm; }
  body.dang-in-de { background: #fff; margin: 0; }
  body.dang-in-de > *:not(#sd-vung-in) { display: none !important; }
  body.dang-in-de #sd-vung-in { display: block; font: 13pt/1.35 "Times New Roman", serif; color: #000; }
  #sd-vung-in p { margin: 0 0 5pt; text-align: justify; }
  #sd-vung-in .bang-dau-de { font-size: 13pt; line-height: 1.35; margin-bottom: 8pt; }
  #sd-vung-in .de-dau { text-align: center; font-size: 13pt; color: #000; }
  #sd-vung-in .vb-tieude { text-align: center; font-weight: bold; font-size: 14pt; margin: 10pt 0; }
  #sd-vung-in .vb-phan { font-weight: bold; margin: 12pt 0 5pt; text-align: left; }
  #sd-vung-in .vb-nguon { text-align: right; font-style: italic; }
  #sd-vung-in .vb-chuthich { font-size: 12pt; }
  #sd-vung-in .vb-het { text-align: center; font-weight: bold; margin-top: 12pt; }
  #sd-vung-in .vb-doan, #sd-vung-in .vb-cau { text-indent: 1.27cm; }
  #sd-vung-in .vb-kho { margin-left: 1.27cm; text-align: left; }
  #sd-vung-in .vb-demo { font-size: 8.5pt; font-style: italic; color: #9A9A9A; text-align: right; margin-top: 18pt; text-indent: 0; }
  #sd-vung-in table { border-collapse: collapse; page-break-inside: auto; }
  #sd-vung-in tr { page-break-inside: avoid; }
}

/* ---------- Kiểm tra độ khớp ---------- */
.tom-tat-kt { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; margin: 0 0 8px; }
.tom-tat-kt .so-loi b { color: var(--do); }
.tom-tat-kt .so-nhac b { color: var(--vang); }
.tom-tat-kt .so-dat b { color: #2E6B1F; }
.cot-phai ul.kt li.dat { background: #F1F7EE; border-color: #7FAF6B; color: #2E5A22; font-size: 13px; padding: 4px 8px 4px 10px; }
.cot-phai ul.kt li.xn { background: var(--nen); border-color: var(--vien); color: var(--chu-phu); font-size: 13px; }
.cot-phai .dau-kt { display: inline-block; width: 14px; font-weight: 700; }
.cau-loi { margin-top: 4px; font-size: 13px; line-height: 1.4; }
.cau-loi:empty { display: none; }
.cau-loi .loi { color: var(--do); }
.cau-loi .nhac { color: #8A5A12; }

/* ---------- Ngân hàng câu hỏi mẫu ---------- */
.nut-nh { border-color: var(--vang); color: var(--vang); }
.hop-nh { border: 1px dashed var(--vang); border-radius: 6px; padding: 6px 10px; margin-top: 6px; max-height: 420px; overflow: auto; background: var(--vang-nhat); }
.nh-cau { background: #fff; border: 1px solid var(--vien); border-radius: 6px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.nh-cau.da-dung { opacity: .65; }
.nh-dau { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.nh-nd { font-family: "Times New Roman", serif; font-size: 16px; line-height: 1.45; margin-bottom: 4px; }
.nh-cau details { margin: 4px 0 6px; }
.nh-cau summary { cursor: pointer; color: var(--xanh); font-size: 13px; }
.nh-da { font-size: 13.5px; line-height: 1.45; padding: 4px 0 0 8px; border-left: 3px solid var(--vien); margin-top: 4px; }

/* ---------- Bản demo: hộp mời bản Pro, chặn bôi đen ở màn Ra đề, chặn in ---------- */
.hop-pro { position: relative; background: #fff; border-radius: 12px; max-width: 560px; width: 100%; margin-top: 12vh; padding: 30px 26px 24px; box-shadow: 0 10px 34px rgba(0,0,0,.3); border-top: 6px solid #BA7517; }
.hop-pro h3 { margin: 0 0 10px; color: #0F6E56; font-size: 20px; line-height: 1.35; }
.hop-pro p { margin: 0 0 18px; color: #3d4441; line-height: 1.55; }
.hang-nut-pro { display: flex; gap: 10px; flex-wrap: wrap; }
.hang-nut-pro a { flex: 1 1 210px; text-align: center; padding: 11px 14px; border-radius: 8px; color: #fff; font-weight: 600; text-decoration: none; }
.hang-nut-pro .nut-fb { background: #1877F2; }
.hang-nut-pro .nut-zalo { background: #0068FF; }
.hang-nut-pro a:hover { filter: brightness(1.08); }
body.ban-demo #man-ra-de { -webkit-user-select: none; user-select: none; }
body.ban-demo #man-ra-de input, body.ban-demo #man-ra-de textarea, body.ban-demo #man-ra-de select { -webkit-user-select: text; user-select: text; }
@media print {
  body.ban-demo > * { display: none !important; }
  body.ban-demo::before { content: "Tính năng in đề chỉ có ở bản Pro. Liên hệ Zalo 0328961617 hoặc Fanpage Kết Nối Tri Thức EdTech & AI."; display: block; padding: 40px; font: 16pt "Times New Roman", serif; text-align: center; }
}
