/* DESIGN MASTER AI — cùng tông màu và bố cục với web DESIGN MASTER (xanh navy, nút xanh dương):
   đầu trang · thanh tải file · 3 cột [Tệp & dự án | khung xem có tab chức năng | Chức năng (thông số sổ xuống)] · thanh trạng thái. */
:root {
  --nen: #080f1f;
  --dau: linear-gradient(100deg, #101c31, #0b1730);
  --thanh-tai: #0d192c;
  --cot-trai: #0c1729;
  --cot-phai: #0d1b30;
  --tam: #101d33;
  --tam-2: #13233c;
  --o: #0b1628;
  --nut: #172740;
  --nut-vien: #2b4060;
  --nut-hover: #233c60;
  --nut-hover-vien: #4473a7;
  --vien: #23324b;
  --vien-sang: #2b3d5a;
  --chu: #e8edf8;
  --chu-phu: #8e9db6;
  --chu-mo: #8094b4; /* ≥ 4,5:1 trên nền navy */
  --xanh: #1687ff;
  --xanh-nut: #1284fa;
  --xanh-sang: #21a0ff;
  --xanh-nhat: #80baff;
  --mo-panel: #0f2440;
  --mo-vien: #1f5fa3;
  --la: #39d5a7;
  --vang: #f5c542;
  --do: #ff7a8a;
  --c: #13c2e8;
  --m: #ec1f86;
  --y: #f5d31c;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* clip: trang gốc không bao giờ cuộn (kể cả cuộn bằng code), chỉ các cột bên trong cuộn */
html, body { margin: 0; height: 100%; overflow: clip; }
body {
  background: var(--nen);
  color: var(--chu);
  font: 400 13px/1.45 var(--font);
  display: grid;
  grid-template-rows: 72px 60px minmax(0, 1fr) 28px;
  grid-template-columns: minmax(0, 1fr); /* cột duy nhất không được nở theo nội dung (cửa sổ hẹp từng tràn cột Chức năng ra ngoài) */
  overflow: clip;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--xanh); outline-offset: 2px; }
svg { flex: none; }
button svg, label svg, .ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Nút chung giống DESIGN MASTER */
button {
  font: inherit; cursor: pointer; color: #dce6f7; background: var(--nut); border: 1px solid var(--nut-vien);
  border-radius: 7px; padding: 7px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: var(--nut-hover); border-color: var(--nut-hover-vien); }
button:disabled { opacity: .4; cursor: not-allowed; }
.nut-chinh { background: var(--xanh-nut); border-color: #2798ff; color: #fff; font-weight: 600; box-shadow: 0 3px 12px #0873e933; }
.nut-chinh:hover:not(:disabled) { background: #2996ff; border-color: #44a6ff; }
.nut-chinh.to { padding: 11px 18px; font-size: 15px; }
.nut-chinh svg { stroke-width: 2.1; }
.nut-o { width: 40px; height: 40px; padding: 0; border-radius: 9px; }
.nut-o svg { width: 19px; height: 19px; }
.nut-o.nho { width: 30px; height: 30px; border-radius: 7px; }
.nut-o.nho svg { width: 15px; height: 15px; }
.nut-o.bat { color: var(--xanh-sang); border-color: var(--mo-vien); background: #12305a; }
.nut-vuong { width: 26px; height: 26px; padding: 0; font-size: 19px; line-height: 1; }
.nut-vuong.nho { width: 24px; height: 24px; font-size: 13px; }
.chu-do { color: #e3a3ad; }
input, select, textarea {
  font: inherit; color: var(--chu); background: var(--o); border: 1px solid #2a3d58; border-radius: 6px;
  padding: 7px 9px; width: 100%; min-width: 0; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--xanh); }
textarea { resize: vertical; line-height: 1.5; user-select: text; }
input[type="range"] { padding: 0; accent-color: var(--xanh); height: 18px; border: 0; background: none; }
input[type="checkbox"] { width: auto; accent-color: var(--xanh); }

/* ── Đầu trang ── */
.dau-trang { display: flex; align-items: center; gap: 16px; padding: 0 0 0 22px; background: var(--dau); border-bottom: 1px solid var(--vien); -webkit-app-region: drag; }
/* macOS: chừa chỗ cho ba nút đèn của cửa sổ (index.js trafficLightPosition) */
html.he-mac .dau-trang { padding-left: 84px; }
.thuong-hieu { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; }
/* Biểu tượng DESIGN MASTER (bút xanh, assets/icon.svg) — 4 ô màu CMYK là biểu tượng của MASTER TOOL, không dùng ở app này */
.dau-dm { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 4px 10px #1263e655); }
.ten-app { font-size: 22px; font-weight: 700; letter-spacing: -.6px; white-space: nowrap; line-height: 1.1; }
.ten-app b { color: var(--xanh-sang); font-weight: 700; }
.thuong-hieu small { display: block; font-size: 11px; letter-spacing: .1px; color: var(--chu-phu); margin-top: 4px; white-space: nowrap; }
.thuong-hieu > div { min-width: 0; overflow: hidden; }
.cum-phai { display: flex; align-items: center; gap: 8px; -webkit-app-region: no-drag; flex: none; }
/* Khung hẹp (tab trình duyệt ở chế độ web — cửa sổ app tối thiểu 1180 px): bớt dần để tên app không đè lên ô GPU — dòng phụ dưới tên,
   rồi chữ của Lưu ảnh / Tải kết quả (còn biểu tượng, rê chuột xem tên), rồi tên app (còn biểu tượng) */
@media (max-width: 1360px) { .thuong-hieu small { display: none; } }
@media (max-width: 1240px) { .cum-phai .nut-xuat .chu-nut { display: none; } .cum-phai .nut-xuat { padding: 0 12px; } }
@media (max-width: 1060px) { .ten-app { display: none; } }
.chi-so { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 7px; background: #0e1c33; border: 1px solid var(--vien); font-size: 11px; font-variant-numeric: tabular-nums; }
.chi-so span { color: var(--chu-mo); font-weight: 600; letter-spacing: .05em; font-size: 11px; }
.chi-so b { font-weight: 500; }
/* Đèn của từng ô: tắt (xám) khi rảnh, chớp vàng khi việc đang chạy dùng tới mục đó — kiểu chớp chung ở @keyframes den-chop */
.chi-so .den { width: 7px; height: 7px; border-radius: 50%; background: var(--vien-sang); flex: none; }
.chi-so.dang-chay { border-color: #5c4a1d; }
.chi-so.dang-chay span { color: var(--vang); }
.vach-nho { display: block; width: 32px; height: 4px; border-radius: 2px; background: var(--vien-sang); overflow: hidden; }
.vach-nho i { display: block; height: 100%; width: 0; background: var(--xanh-sang); transition: width .5s; }
.cum-phai .nut-xuat { height: 40px; padding: 0 16px; color: #cfe5ff; background: #102a4c; border-color: #1f5fa3; font-weight: 600; }
.cum-phai .nut-xuat:hover:not(:disabled) { background: #14386a; border-color: #2d7fd6; }
.cum-phai .nut-xuat svg { color: var(--xanh-sang); }
/* Nút Lưu ảnh + menu định dạng (sổ xuống dưới nút, canh phải) */
.cum-luu { position: relative; display: flex; }
.cum-phai .nut-luu { background: var(--nut); border-color: var(--nut-vien); color: var(--chu); }
.nut-luu .mui-luu { font-style: normal; font-size: 11px; margin-left: 2px; color: var(--chu-phu); }
.menu-luu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 248px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: var(--tam-2); border: 1px solid var(--vien-sang); border-radius: 10px; box-shadow: 0 14px 34px #02060fcc; }
.menu-luu[hidden] { display: none; }
.menu-luu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; height: auto; padding: 7px 10px; border: 0;
  border-radius: 7px; background: transparent; text-align: left; }
.menu-luu button:hover, .menu-luu button:focus-visible { background: var(--nut-hover); }
.menu-luu b { font-size: 13px; font-weight: 600; color: var(--chu); }
.menu-luu small { font-size: 11.5px; color: var(--chu-phu); }
.cho-nut-cua-so { width: 140px; flex: none; align-self: stretch; }
/* Chế độ web (tab trình duyệt — web-dm.js gắn lớp che-do-web): không có nút cửa sổ Windows → bỏ chỗ chừa, chừa lề phải bình thường */
.che-do-web .cho-nut-cua-so { width: 16px; }

/* ── Thanh tải file ── */
.thanh-tai { display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--thanh-tai); border-bottom: 1px solid var(--vien); min-width: 0; }
.trang-thai-may { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; flex: none; }
.tab-trong { color: var(--chu-mo); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Dải tab chức năng ở hàng trên cùng: mỗi tab = một chức năng đang mở, tab đang chạy có % và vạch tiến độ */
.tab-cn { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tab-cn:empty { display: none; }
.tab-cn button {
  position: relative; overflow: hidden; flex: none; gap: 8px; height: 38px; padding: 0 8px 0 12px; border-radius: 8px;
  background: #0f1d33; border-color: #22324a; color: var(--chu-phu); font-weight: 500; max-width: 250px;
}
.tab-cn button:hover { border-color: #2e4a72; color: var(--chu); }
.tab-cn button[aria-selected="true"] { background: #12305a; border-color: #1f5fa3; color: #fff; }
.tab-cn .cham { width: 8px; height: 8px; border-radius: 50%; background: var(--la); flex: none; }
.tab-cn .cham.dang { background: var(--vang); animation: nhap 1s infinite; }
.tab-cn .cham.cho { background: var(--chu-mo); }
.tab-cn .cham.loi { background: var(--do, #ff6b81); }
.tab-cn .ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-cn .pt { font-size: 11px; color: var(--vang); font-variant-numeric: tabular-nums; flex: none; }
.tab-cn .pt:empty { display: none; }
.tab-cn .vach-tab { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--vang); transition: width .3s; }
.tab-cn .dong { width: 20px; height: 20px; border-radius: 4px; display: grid; place-content: center; color: var(--chu-mo); font-size: 15px; line-height: 1; flex: none; }
.tab-cn .dong:hover { background: #ffffff14; color: #fff; }
.dau-xanh { display: flex; align-items: center; gap: 7px; color: #7cddc0; white-space: nowrap; }
.dau-xanh em, .nut-gpt em, .chan-trang > em { width: 7px; height: 7px; border-radius: 50%; background: var(--la); box-shadow: 0 0 10px #39d5a744; display: inline-block; }
.nut-gpt { border-radius: 14px; padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--chu-phu); background: #0e1c33; }
.nut-gpt em { background: var(--chu-mo); box-shadow: none; }
.nut-gpt[data-trang-thai="san-sang"] { color: #7cddc0; border-color: #1f5a4c; }
.nut-gpt[data-trang-thai="san-sang"] em { background: var(--la); box-shadow: 0 0 10px #39d5a766; }
.nut-gpt[data-trang-thai="chua-dang-nhap"] { color: var(--vang); border-color: #5c4a1d; }
.nut-gpt[data-trang-thai="chua-dang-nhap"] em { background: var(--vang); }
/* Đèn chớp "đang xử lý" (như ChatGPT đang trả lời): chấm vàng nhấp nháy + vòng sóng lan ra — dùng chung cho ô GPU/VRAM/RAM,
   dòng "Đang xử lý cục bộ" và nút ChatGPT khi đang làm */
.chi-so.dang-chay .den, .dau-xanh.dang-chay em, .nut-gpt[data-trang-thai="dang-lam"] em { background: var(--vang); animation: den-chop 1.2s ease-out infinite; }
.dau-xanh.dang-chay, .nut-gpt[data-trang-thai="dang-lam"] { color: var(--vang); }
.nut-gpt[data-trang-thai="dang-lam"] { border-color: #5c4a1d; }
@keyframes den-chop {
  0% { opacity: 1; box-shadow: 0 0 0 0 #f5c542b3; }
  50% { opacity: .4; }
  70% { box-shadow: 0 0 0 6px #f5c54200; }
  100% { opacity: 1; box-shadow: 0 0 0 0 #f5c54200; }
}
@keyframes nhap { 50% { opacity: .3; } }
@keyframes quay { to { transform: rotate(360deg); } }
@keyframes truot { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }

/* ── Khung: Tệp | khung xem | thông số (bung ra khi chọn chức năng) | danh sách chức năng ── */
/* Độ rộng cột kéo được (thanh .tay-keo): người dùng đặt --rong-*-dat (lưu localStorage), gập cột vẫn đè được về 0 */
.khung {
  /* Cột bên tự co theo cửa sổ (cửa sổ hẹp ~1000 px từng đẩy cột Chức năng tràn ra ngoài, khuất nút gập) */
  --rong-tep: min(var(--rong-tep-dat, 240px), 21vw); --rong-ts: 0px; --rong-cn: min(var(--rong-cn-dat, 214px), 19vw); position: relative; min-width: 0;
  display: grid; grid-template-columns: var(--rong-tep) minmax(0, 1fr) var(--rong-ts) var(--rong-cn); min-height: 0; transition: grid-template-columns .18s ease;
}
.khung.co-ts { --rong-ts: min(var(--rong-ts-dat, 340px), 30vw); }
.khung.dang-keo { transition: none; cursor: col-resize; user-select: none; }
.khung.dang-keo > :not(.tay-keo) { pointer-events: none; }
/* Thanh kéo nằm trên đường ranh giữa hai cột: rê chuột hiện vạch xanh */
.tay-keo { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -4px; z-index: 20; cursor: col-resize; }
.tay-keo::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background .12s, box-shadow .12s; }
.tay-keo:hover::after, .khung.dang-keo .tay-keo.dang::after { width: 2px; left: 3.5px; background: var(--xanh-sang); box-shadow: 0 0 8px var(--xanh); }
.tay-keo.trai { left: var(--rong-tep); }
.tay-keo.phai { left: auto; right: calc(var(--rong-ts) + var(--rong-cn)); margin: 0 -4px 0 0; }
.khung.gap-trai > .tay-keo.trai, .khung.gap-phai > .tay-keo.phai { display: none; }
.khung.gap-trai { --rong-tep: 0px; }
.khung.gap-phai { --rong-ts: 0px; --rong-cn: 0px; }
.khung.gap-trai > .cot-tep, .khung.gap-phai > .cot-cn, .khung.gap-phai > .cot-ts, .khung:not(.co-ts) > .cot-ts { visibility: hidden; overflow: hidden; border: 0; }
/* Đang xử lý (app.js thuKhiChay) — chủ app 28/10: cột Tệp VẪN GIỮ ảnh gốc, chỉ ẩn các nút nhỏ (Tải file, Chọn / Xóa tất cả, xóa
   từng ảnh, chân cột); ẩn TOÀN BỘ bảng thông số của chức năng, danh sách các nhánh Chức năng chính vẫn hiện. Nút Dừng + tiến độ có sẵn
   trên khung chờ giữa màn hình (.nut-dung-cho). Ảnh kết quả về thì hiện lại hết. */
.khung.thu-khi-chay > .cot-tep :is(.tai-len, .dk-tep, .chan-tep, .ds-tep .xoa, .ds-tep .len, .ds-tep .xuong) { display: none; }
.khung.thu-khi-chay.co-ts { --rong-ts: 0px; }
.khung.thu-khi-chay > .cot-ts { visibility: hidden; overflow: hidden; border: 0; }
.khung.thu-khi-chay.co-ts > .tay-keo.phai { display: none; }

/* Cột Tệp & dự án */
.cot-tep { background: var(--cot-trai); border-right: 1px solid var(--vien); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dau-muc { padding: 16px 12px 10px 14px; display: flex; align-items: center; justify-content: space-between; }
.dau-muc { gap: 8px; }
.dau-muc h2 { font-size: 15px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Nút gập cột luôn thấy được: tiêu đề co lại (…) chứ không đẩy nút ra ngoài khi cột hẹp */
.dau-muc > .nut-vuong, .ray-cn > h2 > .nut-vuong, .dau-ts > .nut-vuong { flex-shrink: 0; }
.ray-cn > h2 { gap: 8px; }
.ray-cn > h2 > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dau-muc h2 span { color: #98afd1; background: #23344f; border-radius: 4px; padding: 1px 6px; font-size: 11px; margin-left: 6px; font-weight: 600; }
.tai-len { padding: 0 12px 10px; display: grid; gap: 6px; }
.tai-len button { width: 100%; justify-content: center; padding: 11px 10px; font-size: 13px; font-weight: 600; }
.tai-len small { color: var(--chu-mo); font-size: 11px; text-align: center; line-height: 1.4; }
.dk-tep { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 12px 10px; }
.dk-tep button { font-size: 11px; padding: 7px 6px; background: transparent; border-color: #22324a; }
.dk-tep svg { width: 13px; height: 13px; }
.ds-tep { list-style: none; margin: 0; padding: 0 8px; overflow: auto; flex: 1; }
.ds-tep li {
  display: grid; grid-template-columns: 18px 46px 1fr 20px; gap: 9px; align-items: center; padding: 8px 6px 8px 8px;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer; margin-bottom: 4px; position: relative;
}
.ds-tep li:hover { background: #10203a; }
.ds-tep li.dang-xem { background: #102544; border-color: #1f5fa3; }
.ds-tep li .anh-o { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; background: #fff; border: 1px solid #22324a; }
/* Số thứ tự ảnh (tep.js) ở góc trên ảnh nhỏ: ô yêu cầu thiết kế gọi "hình 1", "hình số 2" theo số này */
.ds-tep li .so-tep {
  position: absolute; left: 29px; top: 3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--xanh-nut); color: #fff; font: 700 11px/19px var(--font); text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--cot-trai); cursor: help;
}
.ds-tep li .ten { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-tep li .phu { color: var(--chu-phu); font-size: 11px; font-variant-numeric: tabular-nums; }
.ds-tep li .kho-tep { color: #8fb8ea; }
.ds-tep li .cum { white-space: nowrap; }
.ds-tep li .ppi-tep { color: #c9d7ee; font-weight: 600; }
.ds-tep li .tt { font-size: 11px; color: var(--chu-mo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-tep li .tt.tao { color: var(--xanh-nhat); }
.ds-tep li .tt.dang { color: var(--vang); }
.ds-tep li .tt.loi { color: var(--do); }
.ds-tep li .xoa { width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--chu-mo); }
.ds-tep li .xoa:hover { color: var(--do); background: none; }
.ds-tep li .xoa svg { width: 14px; height: 14px; }
/* Đổi thứ tự ảnh (tep.js doiCho / chuyenToi): nút ▲ ▼ quanh nút xóa, hiện khi rê chuột; kéo thả hiện vạch chỗ sẽ đặt */
.ds-tep li .nut-tep { display: grid; gap: 1px; justify-items: center; }
.ds-tep li .len, .ds-tep li .xuong { width: 20px; height: 18px; padding: 0; border: 0; background: none; color: var(--chu-mo); opacity: 0; transition: opacity .15s; }
.ds-tep li:hover .len, .ds-tep li:hover .xuong { opacity: 1; }
.ds-tep li .len:hover:not(:disabled), .ds-tep li .xuong:hover:not(:disabled) { color: var(--xanh-sang); background: none; }
.ds-tep li .len:disabled, .ds-tep li .xuong:disabled { visibility: hidden; }
.ds-tep li .len svg, .ds-tep li .xuong svg { width: 15px; height: 15px; stroke-width: 2.2; }
.ds-tep li.chen-tren { box-shadow: 0 -3px 0 -1px var(--xanh-sang); }
.ds-tep li.chen-duoi { box-shadow: 0 3px 0 -1px var(--xanh-sang); }
.ds-tep li .thanh-tep { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--vien); overflow: hidden; }
.ds-tep li .thanh-tep > i { display: block; height: 100%; background: var(--xanh-sang); transition: width .2s; }
.ds-tep .tach-nhom { font-size: 12.5px; font-weight: 700; color: #dbe6f5; padding: 12px 8px 6px; cursor: default; display: block; border: 0; }
.ds-tep .tach-nhom:hover { background: none; }
.tep-trong { margin: 4px 12px 12px; flex: 1; border: 1.5px dashed var(--vien-sang); border-radius: 12px; display: grid; place-content: center; justify-items: center; text-align: center; gap: 6px; color: var(--chu-phu); padding: 12px; }
.tep-trong svg { width: 28px; height: 28px; color: var(--chu-mo); fill: none; stroke: currentColor; stroke-width: 1.6; }
.tep-trong p { font-weight: 600; }
.tep-trong small { color: var(--chu-mo); font-size: 11px; }
.tep-trong { cursor: pointer; transition: background .15s, border-color .15s; }
.tep-trong:hover, .tep-trong:focus-visible { background: var(--mo-panel); border-color: var(--mo-vien); outline: none; }
.tep-trong:hover svg, .tep-trong:focus-visible svg { color: var(--xanh-sang); }
.chan-tep { padding: 12px; border-top: 1px solid var(--vien); display: grid; gap: 7px; }
.chan-tep button { justify-content: center; font-size: 12px; }
.chu-thich { font-size: 11px; color: var(--chu-mo); line-height: 1.55; margin-top: 4px; }
body.dang-keo-file .tep-trong, body.dang-keo-file .ds-tep { outline: 2px dashed var(--xanh); outline-offset: -4px; border-radius: 10px; }

/* ── Cột giữa: khung xem ── */
/* Gán hàng cố định: hàng tab trống bị ẩn cũng không làm khung xem trượt lên hàng khác */
/* Cột lưới minmax(0,1fr): cửa sổ hẹp thì khung xem co lại, không giãn theo thanh công cụ rồi chui xuống dưới bảng thông số */
.cot-xem { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(52px, auto) minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; background: var(--nen); }
.cot-xem > .thanh-xem { grid-row: 1; }
.cot-xem > .vung-xem { grid-row: 2; } .cot-xem > .dong-thong-so { grid-row: 3; } .cot-xem > .o-yeu-cau { grid-row: 4; }
/* Ô yêu cầu thiết kế dưới khung xem — như app DESIGN MASTER */
.o-yeu-cau { margin: 0 20px 14px; padding: 9px 11px 10px; background: #0b1729; border: 1px solid #213957; border-radius: 9px; }
.o-yeu-cau:focus-within { border-color: #3b82f6; }
.o-yeu-cau label { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; color: #7e9abc; }
.o-yeu-cau > div { display: flex; gap: 10px; align-items: flex-end; margin-top: 4px; }
/* Đầu ô: nhãn + nút gạt "Sửa tiếp kết quả đang xem" (ảnh nhỏ của kết quả sẽ sửa) — chủ app 30/10 */
.o-yeu-cau > .dau-yc { margin-top: 0; align-items: center; justify-content: space-between; min-height: 22px; }
.o-yeu-cau .sua-tiep { display: inline-flex; align-items: center; gap: 6px; max-width: 72%; padding: 2px 10px 2px 6px; border: 1px solid #2a4566; border-radius: 999px;
  background: #0f2036; font-size: 11.5px; font-weight: 600; letter-spacing: 0; color: #a9bdd8; cursor: pointer; user-select: none; }
.o-yeu-cau .sua-tiep[hidden] { display: none; }
.o-yeu-cau .sua-tiep:hover { border-color: #3b82f6; }
.o-yeu-cau .sua-tiep.bat { border-color: #22a06b; background: #0d2e24; color: #e6fff3; }
.o-yeu-cau .sua-tiep input { margin: 0; accent-color: #22a06b; }
.o-yeu-cau .sua-tiep img { width: 30px; height: 20px; object-fit: cover; border-radius: 3px; background: #fff; flex: none; }
.o-yeu-cau .sua-tiep img[hidden] { display: none; }
.o-yeu-cau .sua-tiep span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-yeu-cau.che-do-sua { border-color: #22a06b; }
.o-yeu-cau.che-do-sua:focus-within { border-color: #2fcb8a; }
.o-yeu-cau.che-do-sua #nut-thiet-ke { background: #168a5b; box-shadow: 0 6px 18px #16a06b4d; }
.o-yeu-cau.che-do-sua #nut-thiet-ke:hover:not(:disabled) { background: #1aa36c; }
.o-yeu-cau textarea { flex: 1; border: 0; background: transparent; padding: 3px 0; min-height: 40px; max-height: 120px; resize: none; font-size: 13px; line-height: 1.45; }
.o-yeu-cau textarea:focus { outline: none; }
.o-yeu-cau button { white-space: nowrap; padding: 9px 16px; }
/* Nút CorelDRAW / Illustrator (app.js UNG): huy hiệu màu hãng "Cdr" xanh lá, "Ai" cam — tải vào (cạnh Thiết kế) và lấy từ (cột Tệp) */
.nut-ung b { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 4px; border-radius: 5px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.nut-ung.cdr b { color: #b6f5c4; background: #12452a; border: 1px solid #2f9e57; }
.nut-ung.ai b { color: #ffd59a; background: #4a2a06; border: 1px solid #c77712; }
.nut-ung.cdr:hover:not(:disabled) { border-color: #2f9e57; }
.nut-ung.ai:hover:not(:disabled) { border-color: #c77712; }
.nut-ung.dang { cursor: progress; }
/* Ô yêu cầu: hai nút phụ Tải vào Corel / Illustrator nhỏ, xếp hai tầng; nút Thiết kế là nút chính — to, cao bằng cả cụm
   (chủ app 30/10: "thiết kế gọn lại hơn, nút thiết kế vẫn phải to vì nó là nút chính") */
.o-yeu-cau .gui-ung { display: grid; grid-template-rows: 26px 26px; grid-auto-flow: column; gap: 4px; }
.o-yeu-cau .gui-ung:not(:has(> button:not([hidden]))) { display: none; }
.o-yeu-cau .gui-ung .nut-ung { height: 26px; padding: 0 10px 0 5px; gap: 6px; justify-content: flex-start; font-size: 11.5px; border-radius: 6px; color: #c9d6ea; }
.o-yeu-cau .gui-ung .nut-ung b { min-width: 23px; height: 16px; padding: 0 3px; font-size: 9.5px; border-radius: 4px; }
/* Gửi sang MASTER (cầu nối MASTER TOOL, chủ app 30/10): cột thứ hai, cao bằng hai nút Corel / Illustrator, chữ hai dòng */
.o-yeu-cau .gui-ung #nut-gui-master { grid-row: span 2; height: auto; width: 104px; padding: 0 10px 0 6px; white-space: normal; line-height: 1.25; text-align: left; }
.nut-ung.master b { color: #a8e3ff; background: #0b2c48; border: 1px solid #1f8fd6; box-shadow: inset 0 -2px 0 #e6007e; }
.nut-ung.master:hover:not(:disabled) { border-color: #1f8fd6; }
.o-yeu-cau #nut-thiet-ke { height: 56px; padding: 0 28px; gap: 9px; font-size: 15.5px; border-radius: 9px; box-shadow: 0 6px 18px #0873e94d; }
.o-yeu-cau #nut-thiet-ke svg { width: 19px; height: 19px; }
.lay-tu-ung { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tai-len .lay-tu-ung button { padding: 7px 6px; font-size: 12px; font-weight: 600; gap: 6px; }
/* Một hàng: Lưới/Chi tiết · tiêu đề · công cụ xem. Cột xem quá hẹp (bảng thông số đang mở trên cửa sổ nhỏ) thì nhóm công cụ xuống dòng
   thay vì bị cắt; thanh dưới 760px thì nút Lưới/Chi tiết chỉ còn biểu tượng để tiêu đề còn chỗ */
.thanh-xem { display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: space-between; gap: 6px 10px; min-height: 52px; padding: 6px 16px;
  border-bottom: 1px solid var(--vien); background: #0a1426; overflow: hidden; container-type: inline-size; }
@container (max-width: 760px) { .doan-nut button > span { display: none; } .doan-nut button { padding: 6px 9px; } }
.thanh-xem button { white-space: nowrap; }
.doan-nut { display: flex; gap: 4px; flex: none; }
.doan-nut button { background: transparent; border-color: transparent; color: var(--chu-phu); padding: 6px 11px; }
.doan-nut button.bat { background: #12305a; border-color: var(--mo-vien); color: #cfe5ff; }
.doan-nut button:disabled { opacity: .35; }
.nhom-cong-cu { display: flex; align-items: center; gap: 8px; flex: none; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom button { background: transparent; border-color: transparent; color: var(--chu-phu); padding: 5px 8px; font-size: 12px; }
.zoom button:hover { color: var(--chu); }
/* Tiêu đề + phụ đề + hệ màu nằm TRONG thanh xem, giữa nút Lưới/Chi tiết và công cụ xem (chủ app 30/10: "2 ô này đưa về thành 1 hàng.
   tối ưu lại diện tích") — bỏ hẳn hàng tiêu đề riêng, khung xem cao thêm. Chỗ hẹp thì phụ đề co trước (cắt "…", rê chuột xem đủ —
   title gán trong app.js hienThi), rồi tới tên chức năng; nút hai bên giữ nguyên cỡ */
.tieu-de-xem { flex: 1 1 0; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-left: 14px; border-left: 1px solid var(--vien); }
.tieu-de-xem h1 { flex: 0 1 auto; min-width: 0; font-size: 17px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tieu-de-xem p { flex: 1 1 0; min-width: 0; color: var(--chu-phu); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tieu-de-xem .the-nho { align-self: center; }
.the-nho { flex: none; font-size: 11px; color: var(--chu-phu); border: 1px solid var(--vien-sang); border-radius: 12px; padding: 4px 10px; white-space: nowrap; }
.vung-xem { position: relative; min-height: 0; overflow: hidden; margin: 12px 20px 0; border: 1px solid var(--vien); border-radius: 10px; background: #0a1324; }
.dong-thong-so { display: flex; gap: 18px; flex-wrap: wrap; padding: 9px 22px 12px; font-size: 12px; color: var(--chu-phu); font-variant-numeric: tabular-nums; min-height: 34px; }
.dong-thong-so b { color: var(--chu); font-weight: 600; }
.dong-thong-so .mui { color: var(--xanh-nhat); }

/* Màn trống (chưa nạp ảnh): nền DESIGN MASTER + ô thả ảnh ở giữa + MỘT hàng "Kết quả gần đây" ở đáy */
.loi-chao { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 18px 20px 14px; --co-ten: clamp(18px, min(7.2cqi, 9cqb), 58px); }
.loi-chao > .noi-dung-chao { flex: 1; min-height: 0; align-content: safe center; }
/* Khung xem thấp (cửa sổ nhỏ): bỏ hàng gần đây và dòng chào, giữ tên + ô thả ảnh — không để chữ chồng lên nhau */
@container (max-height: 300px) { .loi-chao .gan-day, .loi-chao .dong-chao { display: none; } }
.vong-tha {
  width: clamp(52px, 10cqb, 70px); height: clamp(52px, 10cqb, 70px); margin-top: clamp(12px, 4.5cqb, 34px); padding: 0; border-radius: 18px;
  display: grid; place-content: center; background: #0f2a4dcc; border: 1px solid #1f5fa3; color: var(--xanh-sang); cursor: pointer;
  box-shadow: 0 0 0 6px #1687ff10, 0 10px 30px #0008;
}
.vong-tha:hover { background: #143a68; border-color: var(--xanh-sang); }
.vong-tha svg { width: clamp(22px, 4.6cqb, 32px); height: clamp(22px, 4.6cqb, 32px); stroke-width: 1.7; }
.goi-y-dan { margin: 6px 0 0; font-size: clamp(10px, 1.6cqi, 12.5px); color: #a9bbd6; }
.goi-y-dan kbd { font: 600 .92em var(--font); padding: 1px 6px; border-radius: 4px; border: 1px solid #36547d; border-bottom-width: 2px; background: #0f2442; color: #e3ecfa; }
@container (max-height: 300px) { .loi-chao .goi-y-dan { display: none; } }
.tha-anh { margin: 10px 0 0; font-size: clamp(14px, 2.2cqi, 19px); font-weight: 700; color: #f1f6ff; }
/* Một hàng duy nhất: các hàng sau cao 0 và bị cắt (cửa sổ hẹp thì bớt thẻ, không xuống dòng) */
.gan-day {
  position: relative; flex: none; width: 100%; max-width: 1000px; display: grid; grid-template-columns: repeat(auto-fit, 118px); grid-template-rows: auto auto;
  grid-auto-rows: 0; gap: 0 10px; justify-content: center; overflow: hidden;
}
/* align-self: start — thẻ ở hàng bị cắt giữ nguyên chiều cao và nằm hẳn dưới mép (nút mặc định căn giữa nội dung → tràn ngược lên hàng trên) */
.gan-day button { display: flex; flex-direction: column; justify-content: flex-start; align-self: start; gap: 4px; padding: 5px; width: 100%; font-size: 11px; align-items: stretch; text-align: left; background: #0d1b30d9; }
.gan-day img { width: 100%; height: clamp(48px, 11cqb, 76px); object-fit: contain; border-radius: 5px; background: conic-gradient(#d9dee6 25%, #fff 0 50%, #d9dee6 0 75%, #fff 0) 0 0/12px 12px; }
.gan-day small { color: var(--chu-mo); display: block; }
.gan-day .tieu-de { grid-column: 1/-1; justify-self: center; margin-bottom: 7px; font-size: 10.5px; font-weight: 600; letter-spacing: 1.5px; color: #8fa6c6; text-align: center; text-transform: uppercase; }

/* Thước mm ở mép trên / trái khung xem */
.thuoc { position: absolute; z-index: 6; display: block; pointer-events: none; }
.thuoc-tren { left: 20px; right: 0; top: 0; height: 20px; width: calc(100% - 20px); border-bottom: 1px solid var(--vien); }
.thuoc-trai { left: 0; top: 20px; bottom: 0; width: 20px; height: calc(100% - 20px); border-right: 1px solid var(--vien); }
.goc-thuoc { position: absolute; z-index: 6; left: 0; top: 0; width: 20px; height: 20px; display: grid; place-content: center; font-size: 9px; color: var(--chu-mo); background: #0a1426; border-right: 1px solid var(--vien); border-bottom: 1px solid var(--vien); }
/* Thao tác với ảnh đang xem (dòng dưới khung xem) */
.dong-thong-so { align-items: center; }
.dong-thong-so .thao-tac { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dong-thong-so .thao-tac button { padding: 5px 10px; font-size: 12px; }
.dong-thong-so .dung-tiep { color: var(--chu-mo); font-size: 12px; margin-left: 6px; }
.dong-thong-so .nut-tiep { background: transparent; border-color: #24476f; color: var(--xanh-nhat); }

/* Bàn xem so sánh (xem-anh.js) — chừa chỗ cho thước */
.vung-so-sanh { position: absolute; inset: 20px 0 0 20px; z-index: 2; overflow: hidden; cursor: grab; outline: none; }
.vung-so-sanh.dang-keo-anh { cursor: grabbing; }
.lop-anh { position: absolute; transform-origin: 0 0; }
.lop-anh img { display: block; width: 100%; height: 100%; object-fit: contain; }
.lop-anh.pixel .anh-truoc { image-rendering: pixelated; }
.anh-truoc, .lop-sau.nen-caro, .khung-the img { background: conic-gradient(#d9dee6 25%, #fff 0 50%, #d9dee6 0 75%, #fff 0) 0 0/16px 16px; }
.lop-sau { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.lop-sau.nen-trang { background: #fff; }
.svg-sau, .lop-phu { position: absolute; inset: 0; }
.svg-sau svg, .lop-phu svg { width: 100%; height: 100%; display: block; }
.thanh-keo { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; z-index: 4; cursor: ew-resize; }
.thanh-keo::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--xanh-sang); box-shadow: 0 0 0 1px #0006; }
.thanh-keo span { position: absolute; top: 50%; left: -17px; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%; background: var(--xanh-nut); border: 2px solid #fff; box-shadow: 0 2px 10px #0008; }
.thanh-keo span::before { content: "‹ ›"; position: absolute; inset: 0; display: grid; place-content: center; color: #fff; font-weight: 700; letter-spacing: 2px; font-size: 15px; }
.nhan-goc, .nhan-sau { position: absolute; top: 12px; z-index: 4; font: 600 10.5px var(--font); letter-spacing: .08em; padding: 4px 9px; border-radius: 5px; background: #0a1426dd; border: 1px solid var(--vien-sang); }
.nhan-goc { left: 14px; } .nhan-sau { right: 14px; color: var(--xanh-nhat); }
.vung-so-sanh.tat-so-sanh .thanh-keo, .vung-so-sanh.tat-so-sanh .nhan-goc { display: none; }

/* Lưới kết quả: thẻ giống DESIGN MASTER (ảnh trên nền ca-rô, tên · kích thước, nút tải) */
.luoi-xem { position: absolute; inset: 0; z-index: 3; overflow: auto; padding: 16px; display: flex; flex-direction: column; }
.tom-tat {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px;
  background: var(--tam); border: 1px solid var(--vien);
}
.tom-tat .anh-goc { width: 92px; height: 70px; border-radius: 6px; object-fit: contain; background: #fff; flex: none; }
.tom-tat .chu-tom-tat { flex: 1; min-width: 0; }
.tom-tat b { font-size: 15px; display: block; }
.tom-tat small { color: var(--chu-phu); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Nút không bao giờ bẻ chữ từng dòng: thiếu chỗ thì chữ tóm tắt bị cắt "…", nút giữ nguyên */
.tom-tat .nhom-nut { flex: none; display: flex; gap: 8px; }
.tom-tat .nhom-nut button { white-space: nowrap; }
/* Số cột và cỡ ảnh do app.js tính (xepVuaKhung) cho vừa khung xem; mặc định tạm trước khi tính */
.cac-the { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); justify-content: center; align-content: safe center; flex: 1; }
.the-kq { display: grid; grid-template-rows: auto auto auto auto; gap: 8px; padding: 10px; border-radius: 10px; background: var(--tam); border: 1px solid var(--vien); text-align: center; cursor: pointer; }
.the-kq:hover { border-color: #2d5f96; }
.the-kq.dang-chon { border-color: var(--xanh); box-shadow: 0 0 0 1px var(--xanh); }
/* Ca-rô chỉ nằm sau đúng phần ảnh (ảnh không trong suốt thì không bị hiểu nhầm là trong suốt) */
.khung-the { position: relative; border-radius: 7px; overflow: hidden; height: var(--cao-anh, 180px); display: flex; align-items: center; justify-content: center; background: #0b1729; padding: 6px; }
.khung-the.nen-trang { background: #fff; }
.khung-the img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.khung-the .o-svg { position: absolute; inset: 6px; }
.khung-the .o-svg svg { width: 100%; height: 100%; }
.the-kq .ten-the { font-size: 13px; color: var(--chu-phu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.the-kq .ten-the b { color: var(--chu); }
.the-kq .phu-the { font-size: 11px; color: var(--chu-phu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.the-kq .nut-the { display: flex; gap: 6px; justify-content: center; }
.the-kq .nut-the button { padding: 5px 10px; font-size: 12px; }
.the-kq.cho { cursor: default; }
.the-kq.cho .khung-the { background: #0d1a2e; border: 1px dashed var(--vien-sang); }

/* Lớp chờ: tiến độ nổi ngay trong khung xem + vệt quét */
.lop-cho {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8; width: min(460px, 82%);
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 16px; border-radius: 12px;
  background: #0d1b30ee; border: 1px solid var(--mo-vien); box-shadow: 0 12px 40px #000a;
}
.lop-cho .chu-cho { font-size: 13px; font-weight: 500; }
.lop-cho .nut-dung-cho { height: 30px; padding: 0 14px; font-size: 12.5px; font-weight: 600; color: var(--do); background: #2a1420; border-color: #6b2a3c; }
.lop-cho .nut-dung-cho:hover { background: #3a1a2a; border-color: #94405a; }
.vach { height: 4px; border-radius: 2px; background: var(--vien); overflow: hidden; grid-column: 1 / -1; }
.vach > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--xanh), var(--xanh-sang)); transition: width .3s; }
.vach.cho > div { width: 35% !important; animation: truot 1.3s ease-in-out infinite; }
.quay { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--vien-sang); border-top-color: var(--xanh-sang); animation: quay .8s linear infinite; }
.vung-xem.dang-xu-ly::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 7; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--xanh), var(--xanh-sang), transparent); box-shadow: 0 0 18px var(--xanh);
  animation: quet 2.2s ease-in-out infinite;
}
@keyframes quet { 0% { top: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: calc(100% - 3px); opacity: 0; } }

/* Nền DESIGN MASTER (kiểu MASTER TOOL, đổi tên): nền sao navy — dùng cho màn trống (.loi-chao) và màn chờ xử lý (.man-chao) */
.nen-dm {
  overflow: hidden; text-align: center; color: #eaf2ff; container-type: size;
  background: radial-gradient(ellipse 70% 55% at 50% 38%, #163a72 0%, #0c1f40 42%, #071228 72%, #050b19 100%);
}
/* Màn chờ xử lý: phủ khung xem, thẻ tiến độ nổi bên trên */
.man-chao { position: absolute; inset: 0; z-index: 6; display: none; align-items: center; justify-content: center; padding: 24px 24px 120px; }
/* Nền phủ ngay (không lộ màn trống bên dưới), chỉ chữ hiện dần */
.vung-xem.dang-xu-ly > .man-chao { display: flex; }
.vung-xem.dang-xu-ly > .man-chao > .noi-dung-chao { animation: hien-chao .45s ease-out; }
@keyframes hien-chao { from { opacity: 0; } to { opacity: 1; } }
/* Bầu trời sao (app.js bauTroiSao): ba lớp hạt xa (nhỏ li ti) / vừa / gần (to, có quầng sáng), trôi qua lại chậm —
   lớp gần trôi xa hơn và nhanh hơn chút → có chiều sâu. Từng hạt hiện ra, trôi, mờ mất rồi mọc chỗ khác. Máy bật "giảm chuyển động" thì đứng yên. */
.nen-dm .sao { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lop-sao { position: absolute; inset: -4%; will-change: transform; animation: troi-qua-lai var(--chu-ky) ease-in-out infinite alternate; }
.lop-sao.xa { --chu-ky: 30s; --dx: 1.4%; --dy: .6%; }
.lop-sao.vua { --chu-ky: 23s; --dx: -2.2%; --dy: 1%; animation-delay: -9s; }
.lop-sao.gan { --chu-ky: 17s; --dx: 3.2%; --dy: -1.4%; animation-delay: -5s; }
@keyframes troi-qua-lai { from { transform: translate(calc(var(--dx) * -1), calc(var(--dy) * -1)); } to { transform: translate(var(--dx), var(--dy)); } }
/* Vòng đời một hạt: hiện dần → trôi một quãng ngắn (--mx/--my) + lấp lánh giữa đời (--lap) → mờ mất; hết vòng app.js đổi chỗ hạt */
.lop-sao i {
  position: absolute; border-radius: 50%; background: #fff; opacity: 0; transform: translate(-50%, -50%);
  animation: doi-sao var(--tg, 10s) ease-in-out var(--tre, 0s) infinite;
}
@keyframes doi-sao {
  0% { opacity: 0; transform: translate(-50%, -50%); }
  20% { opacity: var(--sang, .8); }
  50% { opacity: calc(var(--sang, .8) * var(--lap, 1)); }
  80% { opacity: var(--sang, .8); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--mx, 0px)), calc(-50% + var(--my, 0px))); }
}
.lop-sao i.xanh { background: #cfe2ff; }
.lop-sao.vua i { box-shadow: 0 0 4px #ffffff66; }
.lop-sao.gan i { box-shadow: 0 0 7px 2px #ffffffb3, 0 0 18px 5px #5b9dff5e; }
@media (prefers-reduced-motion: reduce) { .lop-sao, .lop-sao i { animation: none; } .lop-sao i { opacity: var(--sang, .8); } }
.noi-dung-chao { position: relative; display: grid; justify-items: center; max-width: 100%; }
/* Cỡ chữ theo bề rộng KHUNG XEM (cqi), không theo cửa sổ: mở bảng thông số khung hẹp lại thì chữ co theo, không xuống dòng */
.ten-chao {
  display: flex; align-items: center; margin: 0; font-weight: 800; letter-spacing: .07em; line-height: 1; white-space: nowrap;
  font-size: var(--co-ten, clamp(18px, min(8.4cqi, 13cqb), 64px)); color: #f4f8ff; text-shadow: 0 0 28px #3b82f666, 0 2px 0 #0008;
}
.ten-chao .chu-a { width: .86em; height: .86em; margin: 0 .05em; color: #f4f8ff; filter: drop-shadow(0 0 10px #3b82f688); }
.vach-sang {
  width: min(560px, 86%); height: 2px; margin: 16px 0 14px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #2563eb 22%, #dbeafe 50%, #2563eb 78%, transparent);
  box-shadow: 0 0 14px #3b82f6, 0 0 32px #3b82f655; animation: vach-sang 3.2s ease-in-out infinite;
}
@keyframes vach-sang { 50% { opacity: .55; } }
.phu-chao { margin: 0; font-size: clamp(8px, 1.9cqi, 13px); font-weight: 600; letter-spacing: min(.34em, .55cqi); color: #c9d7ee; text-wrap: balance; }
.dong-chao { margin: clamp(10px, 3.5cqb, 22px) 0 0; font-size: clamp(10px, 1.9cqi, 14px); font-weight: 500; color: #d3def0; text-wrap: balance; }
/* Khoanh vùng (bóc tách layer) */
.lop-ve { position: absolute; inset: 0; z-index: 5; }
.lop-ve.dang-ve { cursor: crosshair; background: #ef444408; }
.khung-vung { position: absolute; border: 2px solid #ef4444; background: #ef44441a; pointer-events: none; }
.khung-vung span { position: absolute; left: -2px; top: -20px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px 3px 0 0; white-space: nowrap; }

/* ── Cột Chức năng: danh sách, thông số sổ xuống (accordion) ── */
.cot-cn { display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; border-left: 1px solid var(--vien); }
.ray-cn { position: relative; overflow-y: auto; background: var(--cot-phai); padding: 14px 8px 16px 10px; scrollbar-gutter: stable; min-height: 0; }
/* Bảng thông số của chức năng đang chọn (bung bên trái danh sách) */
.cot-ts { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; border-left: 1px solid var(--vien); background: var(--mo-panel); }
.dau-ts { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 13px 12px 11px 14px; border-bottom: 1px solid #1d3a61;
  background: linear-gradient(180deg, color-mix(in srgb, var(--mau, #1687ff) 14%, #0f2440), #0f2440); }
.dau-ts .ico-cn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-content: center; background: color-mix(in srgb, var(--mau) 22%, transparent); color: var(--mau); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mau) 45%, transparent); }
.dau-ts .ico-cn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dau-ts h2 { font-size: 16px; font-weight: 700; line-height: 1.25; }
.dau-ts .may { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 8px; color: var(--xanh-nhat); border: 1px solid #24476f; margin-left: 6px; vertical-align: 2px; }
.dau-ts .may.ai { color: #7cddc0; border-color: #1f5a4c; }
.than-ts { overflow-y: auto; min-height: 0; scrollbar-gutter: stable; }
.than-ts > .bang-cn { margin: 0; border: 0; border-radius: 0; background: none; padding: 12px 12px 16px 14px; animation: none; }
.cot-ts .chan-cn { border-top: 1px solid #1d3a61; }
.cot-ts #nut-xu-ly { background: var(--mau, var(--xanh-nut)); border-color: transparent; color: var(--chu-nut, #fff); }
.cot-ts #nut-xu-ly:hover:not(:disabled) { filter: brightness(1.08); }
.ray-cn > h2 { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; margin: 2px 0 12px; }
.ray-cn > h2 small { font-size: 11px; font-weight: 500; color: var(--chu-mo); margin-left: 6px; }
.tim { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #2a3d58; border-radius: 7px; background: var(--o); color: var(--chu-mo); margin-bottom: 12px; }
.tim:focus-within { border-color: var(--xanh); }
.tim input { border: 0; background: none; padding: 8px 0; }
.nhan-tat-ca { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .6px; color: var(--chu-mo); margin-bottom: 10px; }
.nhan-tat-ca span:last-child { color: var(--xanh-nhat); letter-spacing: 0; }
/* Thứ bậc chữ (một font Be Vietnam Pro): tên nhóm / tiêu đề mục 700 sáng · tên chức năng 600 · nhãn trường 500 · mô tả 400 mờ */
.nhom-cn { margin-bottom: 14px; }
.nhom-cn h3 { font-size: 12.5px; font-weight: 700; color: #dbe6f5; margin: 0 0 7px 2px; display: flex; align-items: center; gap: 8px; letter-spacing: .1px; }
.nhom-cn h3::after { content: ""; flex: 1; height: 1px; background: #24406a; }
.muc-cn { display: grid; gap: 5px; }
/* Mỗi chức năng một màu riêng: ô biểu tượng, vạch trái khi chọn, đầu bảng thông số, nút chạy */
.nut-cn { position: relative; width: 100%; justify-content: flex-start; gap: 9px; padding: 7px 8px 7px 9px; min-height: 44px; background: #12223a; border-color: #22385a; text-align: left; font-size: 13px; font-weight: 600; color: #d3def0; }
.nut-cn:hover { border-color: color-mix(in srgb, var(--mau) 55%, #2b4060); background: #162a47; }
.nut-cn .ico-cn { width: 30px; height: 30px; border-radius: 8px; display: grid; place-content: center; background: color-mix(in srgb, var(--mau) 18%, transparent); color: var(--mau); flex: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mau) 35%, transparent); }
.nut-cn .ico-cn svg { width: 17px; height: 17px; }
.nut-cn .ten-cn { flex: 1; min-width: 0; }
.nut-cn .ten-cn { line-height: 1.25; }
/* Máy / ChatGPT: chấm nhỏ góc phải (đỡ rối chữ), chú giải ở đầu cột */
.nut-cn .may { width: 7px; height: 7px; border-radius: 50%; background: #22c3ee; flex: none; font-size: 0; }
.nut-cn .may.ai { background: var(--la); }
.nut-cn .chev { display: none; }
.nut-cn.mo { background: color-mix(in srgb, var(--mau) 16%, #12223a); border-color: var(--mau); color: #fff; }
.nut-cn.mo::before { content: ""; position: absolute; left: -1px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mau); }
.nut-cn.co-tab:not(.mo) .ten-cn::after { content: " ●"; font-size: 9px; color: var(--mau); vertical-align: 2px; }
.chu-giai-cn { display: flex; gap: 12px; font-size: 11px; color: var(--chu-mo); margin: -4px 0 10px 2px; }
.chu-giai-cn i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c3ee; margin-right: 5px; }
.chu-giai-cn i.ai { background: var(--la); }
.bang-cn { margin: -5px 0 6px; padding: 12px 11px 13px; border: 1px solid var(--mo-vien); border-top: 0; border-radius: 0 0 9px 9px; background: var(--mo-panel); display: grid; gap: 12px; animation: so-xuong .16s ease-out; }
@keyframes so-xuong { from { opacity: 0; transform: translateY(-4px); } }
.bang-cn .mo-ta { color: var(--chu-phu); font-size: 12.5px; line-height: 1.55; font-weight: 400; }
.bang-cn .canh-bao { font-size: 12px; color: var(--vang); background: #f5c5420f; border: 1px solid #5c4a1d; border-radius: 7px; padding: 7px 9px; }
.nhom-tso { display: grid; gap: 10px; }
.nhom-tso > h4 { font-size: 13px; font-weight: 700; color: #e3ecf8; display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.nhom-tso > h4::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--mau, var(--xanh)); flex: none; }
.nhom-tso > h4::after { content: ""; flex: 1; height: 1px; background: #24406a; }
details.nhom-tso > summary { font-size: 13px; font-weight: 700; color: #e3ecf8; cursor: pointer; list-style: none; }
details.nhom-tso > summary::before { content: "▸ "; }
details.nhom-tso[open] > summary::before { content: "▾ "; }
.truong { display: grid; gap: 5px; }
.truong .nhan-truong { font-size: 12.5px; font-weight: 500; color: #b9c9de; display: flex; justify-content: space-between; gap: 8px; }
.truong .nhan-truong output { color: var(--chu); font-weight: 600; font-variant-numeric: tabular-nums; }
.truong .goi-y { font-size: 11px; color: var(--chu-mo); }
.truong .nhan-truong:has(.o-so-truot) { align-items: center; }
.o-so-truot { display: inline-flex; align-items: center; gap: 4px; }
.o-so-truot input { width: 74px; padding: 2px 6px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.o-so-truot input.sai { border-color: #f87171; color: #fca5a5; }
.o-so-truot small { color: var(--chu-phu); font-size: 11.5px; }
.luoi-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ds-the { display: grid; gap: 4px; }
.ds-the button { display: grid; grid-template-columns: 12px 1fr; column-gap: 9px; justify-content: stretch; text-align: left; padding: 7px 9px; background: #0d1d34; border-color: #1d3557; }
.ds-the button::before { content: ""; grid-row: span 2; align-self: center; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #5b7598; }
.ds-the button[aria-checked="true"] { background: #12305a; border-color: var(--mo-vien); }
.ds-the button[aria-checked="true"]::before { border-color: var(--xanh-sang); background: var(--xanh-sang); box-shadow: inset 0 0 0 2px #12305a; }
.ds-the b { font-weight: 600; font-size: 12.5px; }
.ds-the small { color: var(--chu-phu); font-size: 11.5px; font-weight: 400; line-height: 1.4; }
.chip-nhom { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--o); border: 1px solid #22385a; border-radius: 8px; }
.chip { flex: 1 0 auto; border: 0; background: none; padding: 5px 8px; border-radius: 5px; color: var(--chu-phu); font-weight: 500; font-size: 12px; }
.chip:hover:not(:disabled) { background: #ffffff0d; border: 0; color: var(--chu); }
.chip[aria-pressed="true"] { background: #1a4478; color: #fff; font-weight: 600; }
.o-mau { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.o-mau button { width: 28px; height: 28px; border-radius: 7px; border: 2px solid #2b4060; padding: 0; }
.o-mau button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--xanh); }
.o-mau input[type="color"] { width: 30px; height: 30px; padding: 0; border: 1px dashed #4473a7; background: none; border-radius: 7px; }
.cong-tac { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #c4d3e8; cursor: pointer; position: relative; }
/* ô ẩn phải nằm trong nút (position: relative ở trên) — nếu không nó kéo dài trang và trang bị cuộn mất đầu */
.cong-tac input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cong-tac span { width: 30px; height: 17px; border-radius: 9px; background: #2b4060; position: relative; transition: background .15s; flex: none; }
.cong-tac span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #9fb3cf; transition: transform .15s; }
.cong-tac input:checked + span { background: var(--xanh); }
.cong-tac input:checked + span::after { transform: translateX(13px); background: #fff; }
.chon-thu-muc { justify-content: flex-start; font-size: 12px; border-style: dashed; background: transparent; min-width: 0; }
.chon-thu-muc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.the-thong-tin { display: grid; gap: 5px; padding: 9px 10px; border-radius: 8px; background: #0b1a30; border: 1px solid #1d3557; font-size: 12px; }
.the-thong-tin .dong { display: flex; justify-content: space-between; gap: 8px; color: var(--chu-phu); font-variant-numeric: tabular-nums; }
.the-thong-tin .dong b { color: var(--chu); text-align: right; }
.the-thong-tin .vach { grid-column: auto; }
.tot { color: var(--la); } .canh-bao-chu { color: var(--vang); } .xau { color: var(--do); }
/* Ô ảnh theo vai trò (chức năng 2 ảnh) */
.o-vai-tro { display: grid; grid-template-columns: 48px 1fr; gap: 9px; align-items: center; padding: 7px; border-radius: 8px; border: 1.5px dashed #2d4d75; background: #0b1a30; }
.o-vai-tro.co-anh { border-style: solid; border-color: #1d3557; }
.o-vai-tro.dang-tha { border-color: var(--xanh); }
.o-vai-tro img, .o-vai-tro .cho-anh { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: #fff; }
.o-vai-tro .cho-anh { background: #13233c; display: grid; place-content: center; color: var(--chu-mo); font-size: 21px; }
.o-vai-tro b { font-size: 12px; display: block; }
.o-vai-tro small { font-size: 11px; color: var(--chu-phu); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-vai-tro .nut-o-vt { grid-column: 1 / -1; display: flex; gap: 6px; }
.o-vai-tro .nut-o-vt button { padding: 4px 9px; font-size: 12px; }
.ghi-chu-vt { font-size: 11px; color: var(--chu-mo); }
.nhom-sua { display: grid; gap: 7px; }

/* Chân cột chức năng: phạm vi + Xử lý ảnh */
.chan-cn { padding: 12px 14px 14px; border-top: 1px solid var(--vien); background: #0b1729; display: grid; gap: 9px; }
.hang-chon { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--chu-phu); }
.hai-nut { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.hai-nut .nut-chinh { white-space: nowrap; }
/* Chức năng chạy trên máy không có lệnh AI → nút chạy chiếm cả hàng */
.hai-nut:has(#nut-xem-lenh[hidden]) { grid-template-columns: 1fr; }
.hai-nut button { padding: 11px 10px; }
#nut-xu-ly { font-size: 15px; font-weight: 700; }
.nut-dung { border-color: #6b2f3c; color: #ffb3bd; background: #2a1520; }
.nut-xanh-la { border-color: #1f5a4c; color: #7cddc0; background: #0f2a2a; }
.tien-do-cn { display: grid; gap: 5px; font-size: 12px; color: var(--chu-phu); }

/* ── Thanh trạng thái ── */
.chan-trang { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-top: 1px solid var(--vien); background: #0a1426; font-size: 12px; color: var(--chu-phu); position: relative; }
.tien-do-chung { position: absolute; top: -1px; left: 0; right: 0; height: 2px; }
#tien-do-chay { height: 100%; width: 0; background: linear-gradient(90deg, var(--xanh), var(--xanh-sang)); transition: width .25s; }
#trang-thai { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-mau { display: flex; gap: 2px; }
.day-mau i { width: 9px; height: 9px; border-radius: 2px; }
.day-mau i:nth-child(1) { background: var(--c); } .day-mau i:nth-child(2) { background: var(--m); }
.day-mau i:nth-child(3) { background: var(--y); } .day-mau i:nth-child(4) { background: #000; box-shadow: inset 0 0 0 1px var(--vien-sang); }

/* Hộp thoại, thông báo */
.hop { border: 1px solid var(--vien-sang); border-radius: 14px; background: var(--tam); color: var(--chu); padding: 0; width: 470px; box-shadow: 0 30px 80px #000c; }
.hop.rong { width: 720px; }
.hop::backdrop { background: #03070fcc; }
.hop form { padding: 20px 22px; display: grid; gap: 14px; }
.hop h2 { font-size: 15px; }
.hop .o { display: grid; gap: 6px; font-size: 12px; color: var(--chu-phu); }
.hang-o { display: flex; gap: 6px; }
.hop-nut { display: flex; justify-content: flex-end; gap: 8px; }
/* Bộ duyệt thư mục của chế độ web (renderer/web-dm.js duyetThuMuc): nơi nhanh · đường dẫn · thư mục + lưới ảnh thu nhỏ · nút */
.hop-duyet { width: min(860px, calc(100vw - 32px)); }
.hop-duyet form { grid-template-rows: auto auto auto minmax(0, 1fr) auto; height: min(640px, calc(100vh - 48px)); }
.duyet-noi { display: flex; flex-wrap: wrap; gap: 6px; }
.duyet-chip { padding: 5px 11px; border-radius: 14px; font-size: 12px; }
.duyet-duong { display: flex; gap: 6px; }
.duyet-len { width: 36px; flex: none; justify-content: center; font-size: 15px; }
.duyet-o { flex: 1; min-width: 0; font-size: 12.5px; }
.duyet-ds { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); align-content: start; gap: 8px; min-height: 0; overflow: auto;
  padding: 8px; border: 1px solid var(--vien); border-radius: 10px; background: var(--o); }
.duyet-muc { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 6px; text-align: left; min-width: 0; height: auto;
  background: transparent; border: 1px solid transparent; border-radius: 8px; }
.duyet-muc:hover { background: var(--nut-hover); }
.duyet-muc span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duyet-muc small { font-size: 11px; color: var(--chu-mo); }
.duyet-muc.thu-muc { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; padding: 6px 8px; }
.duyet-muc.thu-muc svg { width: 17px; height: 17px; flex: none; color: var(--vang); }
.duyet-muc.anh img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px;
  background: repeating-conic-gradient(#1b2a42 0 25%, #14213a 0 50%) 0 0 / 14px 14px; }
.duyet-muc.anh.chon { border-color: var(--xanh-sang); background: #12305a; }
.duyet-trong { grid-column: 1 / -1; color: var(--chu-mo); font-size: 12.5px; padding: 18px 6px; text-align: center; }
.duyet-trong.loi { color: var(--do, #ff6b81); }
.duyet-chan { align-items: center; }
.duyet-dem { margin-right: auto; font-size: 12px; color: var(--chu-phu); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buoc-kn { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--chu-phu); font-size: 13px; }
.buoc-kn b { color: var(--chu); }
.trang-thai-kn { min-height: 18px; font-size: 12px; color: var(--la); font-weight: 500; }
.xem-lenh { font: 12px/1.55 var(--font); color: #c4d3e8; white-space: pre-wrap; background: var(--o); border: 1px solid var(--vien); border-radius: 8px; padding: 12px; max-height: 60vh; overflow: auto; user-select: text; margin: 0; }
.thong-bao {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  background: #13233c; border: 1px solid var(--mo-vien); border-radius: 10px; padding: 10px 16px; max-width: 640px;
  box-shadow: 0 10px 30px #000a; transition: .2s; white-space: pre-line;
}
.thong-bao.hien { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.thong-bao.loi { border-color: #8a3a4a; }
.thong-bao a { color: var(--xanh-nhat); cursor: pointer; margin-left: 12px; font-weight: 600; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1d3150; border-radius: 5px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #2b4a75; }
::-webkit-scrollbar-corner { background: transparent; }

/* Công cụ chạy riêng (Xếp CCCD, Xếp ảnh thẻ — chuyển từ MASTER TOOL 28/10): khung phủ cột Tệp + Xem + Thông số, chừa cột Chức năng */
.khung-cong-cu { position: absolute; top: 0; bottom: 0; left: 0; right: var(--rong-cn); z-index: 30; display: flex; flex-direction: column; background: var(--nen); border-right: 1px solid var(--vien); }
.khung-cong-cu[hidden] { display: none; }
.khung-cong-cu > header { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--vien); background: #0d1728; }
.khung-cong-cu > header .ico-cn { width: 28px; height: 28px; border-radius: 8px; display: grid; place-content: center; flex: none; color: var(--mau); background: color-mix(in srgb, var(--mau) 18%, transparent); }
.khung-cong-cu > header .ico-cn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.khung-cong-cu > header b { font-size: 15px; color: #fff; white-space: nowrap; }
.khung-cong-cu > header small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8ea2c0; font-size: 12.5px; }
.khung-cong-cu > iframe { flex: 1; width: 100%; border: 0; background: #141e30; }
