[hidden] { display: none !important; }
:root {
  --nen: #f6f6f4; --the: #fff; --chu: #1f2328; --mo: #6a6f76; --vien: #d9dbde;
  --chinh: #1d5fb8; --chinh-dam: #154a91; --vang: #fff7dc; --vien-vang: #e8cf7a;
  --do: #c4302b; --cam: #b7701a; --xanh: #24804a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--nen); color: var(--chu); }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 5; }
h1 { margin: 0; font-size: 19px; }
.phu { color: var(--mo); font-size: 13px; }
.ben-phai { display: flex; align-items: center; gap: 12px; }
.the { padding: 3px 10px; border-radius: 12px; background: #eef2f8; color: var(--chinh-dam); font-size: 12px; white-space: nowrap; }
.the.thu { background: #fdf0dc; color: #8a5300; }
main { padding: 16px 20px 60px; max-width: 1500px; margin: 0 auto; }
section { background: var(--the); border: 1px solid var(--vien); border-radius: 8px; padding: 14px 18px 18px; margin-bottom: 16px; }
h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
h3 { margin: 16px 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.so { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--chinh); color: #fff; font-size: 13px; }
.mo { color: var(--mo); font-weight: normal; font-size: 12.5px; }
.hang { display: flex; gap: 20px; flex-wrap: wrap; }
.cot { flex: 1 1 420px; min-width: 0; }
.xem-anh img { max-width: 100%; max-height: 360px; border: 1px solid var(--vien); border-radius: 6px; }
.khoi-nhap { display: block; margin-top: 10px; }
textarea { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--vien); border-radius: 6px; }
.nut-hang { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
button, .nut, .nut-tep { font: inherit; border: 1px solid var(--vien); background: #fff; border-radius: 6px; padding: 6px 14px; cursor: pointer; }
button.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; }
button.chinh:hover { background: var(--chinh-dam); }
button:disabled { opacity: .5; cursor: default; }
button.nho { padding: 2px 8px; font-size: 12.5px; }
.nut-tep input { display: none; }
.nut-tep { display: inline-block; background: #eef2f8; }
.trang-thai { margin-top: 10px; min-height: 20px; }
.trang-thai.loi { color: var(--do); }
.trang-thai.ok { color: var(--xanh); }
.hop-vang { background: var(--vang); border: 1px solid var(--vien-vang); border-radius: 8px; padding: 4px 14px 12px; }
.hop-vang h3:first-child { margin-top: 10px; }
.xac-nhan { display: inline-flex; gap: 6px; margin-top: 10px; font-weight: 600; }
.luoi-form { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; align-items: center; }
.luoi-form input, .luoi-form select { font: inherit; padding: 3px 6px; border: 1px solid var(--vien); border-radius: 4px; width: 100%; }
.cuon { max-height: 520px; overflow: auto; border: 1px solid var(--vien); border-radius: 6px; }
table.bang { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.bang th { position: sticky; top: 0; background: #f0f1f3; text-align: left; font-weight: 600; padding: 4px 4px; border-bottom: 1px solid var(--vien); white-space: nowrap; z-index: 1; }
.bang td { padding: 1px 2px; border-bottom: 1px solid #eceef0; vertical-align: middle; }
.bang td.so-tt { color: var(--mo); text-align: right; padding-right: 6px; cursor: pointer; }
.bang input, .bang select, .bang textarea { font: inherit; width: 100%; border: 1px solid transparent; background: transparent; padding: 2px 4px; border-radius: 3px; }
.bang input:hover, .bang select:hover, .bang textarea:hover { border-color: var(--vien); }
.bang input:focus, .bang select:focus, .bang textarea:focus { border-color: var(--chinh); background: #fff; outline: none; }
.bang input[type=number] { text-align: right; min-width: 62px; }
.bang input[type=text] { min-width: 90px; }
.bang input[type=checkbox] { width: auto; }
.bang input[type=color] { width: 38px; padding: 0; height: 22px; }
.bang tr.chon td { background: #fde8e6; }
.bang tr.loi-dong td { background: #fff3f2; }
.bang td.so-lieu { text-align: right; padding: 3px 6px; }
.nut-hang input[type=number] { width: 80px; font: inherit; padding: 3px 6px; border: 1px solid var(--vien); border-radius: 4px; }
.canh-bao { margin: 0; padding-left: 18px; max-height: 220px; overflow: auto; }
.canh-bao li { margin: 2px 0; cursor: pointer; }
.canh-bao li.loi { color: var(--do); }
.canh-bao li.canh_bao { color: var(--cam); }
.canh-bao li.ok { color: var(--xanh); list-style: none; margin-left: -18px; cursor: default; }
.xem-3d { border: 1px solid var(--vien); border-radius: 6px; background: #fff; }
.xem-3d svg { display: block; width: 100%; height: 460px; }
.nut-goc { margin-left: auto; display: inline-flex; gap: 4px; }
select#loc-khoi { font: inherit; font-weight: normal; padding: 2px 4px; }
#so-do-tam { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-top: 12px; }
.tam-van { border: 1px solid var(--vien); border-radius: 6px; padding: 6px 8px 8px; background: #fafafa; }
.tam-van .tieu-de { font-size: 12.5px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.tam-van svg { width: 100%; height: auto; display: block; }
.nhan-ct { font: 34px "Segoe UI", sans-serif; fill: #222; pointer-events: none; }

/* hồ sơ quy chuẩn */
#b0 details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
#b0 details > summary::-webkit-details-marker { display: none; }
#b0 details > summary::after { content: '▸ mở'; margin-left: auto; color: var(--mo); font-size: 12.5px; }
#b0 details[open] > summary::after { content: '▾ thu gọn'; }
.tieu-de-ho-so { display: inline-flex; align-items: center; gap: 8px; }
.ds-quy-tac { margin: 0; padding-left: 0; list-style: none; max-height: 320px; overflow: auto; }
.ds-quy-tac li { margin: 3px 0; font-size: 13px; }
.ds-quy-tac label { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.ds-quy-tac input { margin-top: 3px; }
.xem-prompt { white-space: pre-wrap; background: #f6f7f9; border: 1px solid var(--vien); border-radius: 6px; padding: 8px 10px; font-size: 12px; max-height: 260px; overflow: auto; }
.mo-nhat { opacity: .55; }
#o-nguoi-dung input { font: inherit; padding: 2px 6px; border: 1px solid var(--vien); border-radius: 4px; }

/* khung chat sửa phiếu */
.dau-chat { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--vien); }
.tin-nhan { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: #fafbfc; }
.tn { max-width: 92%; padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.tn ul { margin: 6px 0 4px; padding-left: 18px; font-size: 12.5px; }
.tn button { margin-top: 4px; }
.tn.nguoi-dung { align-self: flex-end; background: var(--chinh); color: #fff; }
.tn.tro-ly { align-self: flex-start; background: #fff; border: 1px solid var(--vien); }
.tn.tro-ly.cho { color: var(--mo); font-style: italic; }
.tn.loi { align-self: flex-start; background: #fff3f2; border: 1px solid #f1c4c0; color: var(--do); }
.tn.he-thong { align-self: center; color: var(--mo); font-size: 12.5px; text-align: center; max-width: 100%; }
.go-chat { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--vien); align-items: flex-end; }
.go-chat textarea { flex: 1; resize: none; }

/* mô hình AI + token */
.chon-mo-hinh select { font: inherit; padding: 2px 4px; border: 1px solid var(--vien); border-radius: 4px; max-width: 210px; }
.the-token { border-radius: 12px; padding: 3px 12px; background: #e9f6ee; color: var(--xanh); border: 1px solid #bfe3cc; font-size: 12.5px; white-space: nowrap; }
.the-token.het { background: #fff1f0; color: var(--do); border-color: #f1c4c0; }
.lk-quan-tri { white-space: nowrap; font-size: 12.5px; color: var(--chinh); text-decoration: none; border: 1px solid var(--vien); border-radius: 12px; padding: 3px 10px; }
.nen-modal { position: fixed; inset: 0; background: rgba(20,24,30,.35); z-index: 30; display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; overflow: auto; }
.nen-modal[hidden] { display: none; }
.modal { background: #fff; border-radius: 10px; width: min(860px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.than-modal { padding: 4px 16px 16px; }
.o-so-du { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.o-so-du > div { flex: 1 1 140px; border: 1px solid var(--vien); border-radius: 8px; padding: 8px 12px; background: #fafbfc; }
.o-so-du b { display: block; font-size: 20px; }
.o-so-du span { color: var(--mo); font-size: 12.5px; }
.ds-goi { display: flex; gap: 10px; flex-wrap: wrap; }
.goi { border: 1px solid var(--vien); border-radius: 8px; padding: 8px 12px; min-width: 170px; display: flex; flex-direction: column; gap: 4px; }
.cuon.thap { max-height: 260px; }

/* giới thiệu, phiên bản */
.the-pb { border: 1px solid var(--vien); background: #f4f5f7; color: var(--mo); border-radius: 10px; padding: 0 8px; font-size: 12px; margin-left: 6px; cursor: pointer; }
.bao-cu { background: #fff4e5; border-bottom: 1px solid #f0c98a; color: #8a5300; padding: 8px 20px; font-size: 13px; }
.chan-trang { text-align: center; color: var(--mo); font-size: 12.5px; padding: 6px 20px 70px; }
.chan-trang a { color: var(--chinh); }
.ten-gt { margin-top: 12px; font-size: 18px; }
.pb-muc { margin: 8px 0; }
.pb-muc ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; }
header h1 { font-size: 18px; line-height: 1.3; }

/* màn hình hẹp (điện thoại, hộp thoại SketchUp nhỏ) */
header { flex-wrap: wrap; }
header > div:first-child { flex: 1 1 360px; min-width: 0; }
.ben-phai { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  header { position: static; padding: 10px 12px; gap: 8px; }
  header h1 { font-size: 16px; }
  .ben-phai { justify-content: flex-start; gap: 8px; }
  .chon-mo-hinh select { max-width: 170px; }
  main { padding: 10px 8px 70px; }
  section { padding: 10px 10px 14px; }
  .xem-3d svg { height: 320px; }
  #so-do-tam { grid-template-columns: 1fr; }
  .nen-modal { padding: 10px 6px; }
}

.bang select { min-width: 84px; }

/* học chung */
.hop-hoc-chung { margin-top: 14px; border-top: 1px dashed var(--vien); padding-top: 4px; }
.dong-tick { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13px; }
.dong-tick input { margin-top: 3px; }

/* thư viện mẫu */
.nut-thu-vien { border-radius: 12px; padding: 3px 12px; background: #fff7e6; border: 1px solid #f0c98a; color: #8a5300; font-size: 12.5px; white-space: nowrap; }
.modal.rong { width: min(1180px, 100%); }
.tab-tv { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tab-tv .dang-chon { background: var(--chinh); color: #fff; border-color: var(--chinh); }
.luoi-mau { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.the-mau { border: 1px solid var(--vien); border-radius: 10px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; background: #fff; }
.the-mau:hover { border-color: var(--chinh); box-shadow: 0 2px 10px rgba(29,95,184,.12); }
.anh-mau { background: #fafbfc; border: 1px solid #eceef0; border-radius: 8px; height: 150px; overflow: hidden; }
.anh-mau img, .anh-mau svg { display: block; width: 100%; height: 100%; object-fit: contain; padding: 6px; box-sizing: border-box; }
.anh-mau.lon { height: 300px; margin-bottom: 6px; }
.sao { color: #e8a317; letter-spacing: 1px; }
.hang-gia { display: flex; justify-content: space-between; align-items: baseline; }
.hang-gia.lon b { font-size: 22px; color: #154a91; }
.nhan-tt { font-size: 12px; color: #8a5300; }
.nhan-tt.ok { color: var(--xanh); }
.chi-tiet-mau { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.chi-tiet-mau > .cot { flex: 1 1 380px; }
.chon-sao span { font-size: 28px; color: #d0d4da; cursor: pointer; }
.chon-sao span.bat { color: #e8a317; }
.dg { border-top: 1px solid #eceef0; padding: 6px 0; }
.anh-nho { width: 80px; height: 52px; object-fit: contain; background: #fafbfc; border: 1px solid #eceef0; border-radius: 4px; }

/* thư viện riêng của người bán, danh mục nhiều cấp (0.7.0) */
.ten-nguoi-ban, .nho-link { color: var(--chinh); text-decoration: none; font-size: 13px; cursor: pointer; }
.ten-nguoi-ban:hover, .nho-link:hover { text-decoration: underline; }
.the-nguoi-ban { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 6px 0; padding: 8px 10px; background: #f6f8fb; border-radius: 8px; }
.dau-cua-hang { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 8px 0 14px; }
.dau-cua-hang h2 { margin: 0; font-size: 20px; }
.so-lieu-nb { display: flex; gap: 6px; flex-wrap: wrap; }
.so-lieu-nb span { background: #eef3fa; border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.cua-hang { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.cay-dm { border: 1px solid var(--vien); border-radius: 8px; padding: 6px; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.cay-dm .muc { display: flex; align-items: center; gap: 4px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.cay-dm .muc:hover { background: #f3f5f8; }
.cay-dm .muc.dang-chon { background: #e3edfb; font-weight: 600; }
.cay-dm .ten-dm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cay-dm .dem { margin-left: auto; color: var(--mo); font-size: 12px; font-weight: 400; }
.cay-dm .sua-dm { display: inline-flex; gap: 2px; }
.cay-dm button { align-self: flex-start; margin-top: 6px; }
.cay-dm .sua-dm button { margin: 0; }
button.xiu { padding: 0 5px; font-size: 12px; line-height: 18px; min-width: 0; }
.cay-dm .nho-chu { font-size: 12px; margin-top: 4px; }
.nut-hang.hep { margin-top: 0; margin-bottom: 8px; justify-content: space-between; }
.chon-dm-the { margin-top: 6px; width: 100%; font: inherit; font-size: 13px; }
@media (max-width: 700px) { .cua-hang { grid-template-columns: 1fr; } }

/* đăng nhập, tài khoản, mua token bằng mã QR (0.8.0) */
.lk-tai-khoan { text-decoration: none; color: var(--chu); border: 1px solid var(--vien); border-radius: 999px; padding: 4px 12px; background: #fff; white-space: nowrap; }
.lk-tai-khoan:hover { border-color: var(--chinh); color: var(--chinh); }
main.hep { max-width: 1000px; }
.trang-dn { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 40px 14px; box-sizing: border-box;
  background: linear-gradient(160deg, #eef3fa 0%, #f6f6f4 60%); }
.hop-dn { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; padding: 26px 26px 18px;
  box-shadow: 0 10px 30px rgba(20, 40, 80, .08); }
.dau-dn { text-align: center; margin-bottom: 18px; }
.dau-dn h1 { font-size: 18px; line-height: 1.35; }
.logo-dn { font-size: 34px; }
.tab-dn { display: flex; gap: 4px; background: #f1f3f6; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tab-dn button { flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 8px; font-size: 13.5px; }
.tab-dn button.dang-chon { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.nhan-dn { display: block; margin: 8px 0 4px; font-size: 13px; color: var(--mo); }
.hop-dn input { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--vien); border-radius: 8px; }
.hop-dn input:focus { outline: 2px solid #b9cdf0; border-color: var(--chinh); }
button.rong { width: 100%; padding: 10px; margin-top: 10px; font-size: 15px; border-radius: 8px; }
button.lien-ket { border: 0; background: none; color: var(--chinh); padding: 8px 0; }
button.lien-ket:disabled { color: var(--mo); }
.o-otp { letter-spacing: 8px; text-align: center; font-size: 22px !important; }
.o-otp.nho { letter-spacing: 3px; font-size: 15px !important; width: 110px; padding: 4px 6px; }
.o-google { display: flex; justify-content: center; min-height: 44px; }
.dong-dt { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid #eceef0; }
.dong-dt button { margin-left: auto; }
.dong-dt .g { color: #4285f4; }
.o-them-sdt { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.o-them-sdt input { font: inherit; padding: 4px 8px; border: 1px solid var(--vien); border-radius: 6px; }
.nhan-ok { color: var(--xanh); font-size: 12px; }
.goi-token { display: flex; flex-wrap: wrap; gap: 10px; }
.goi-token .goi { flex: 1 1 180px; border: 1px solid var(--vien); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.goi-token .goi .gia { font-size: 18px; font-weight: 700; color: var(--chinh-dam); }
.goi-token .goi button { margin-top: auto; }
.hop-qr { border: 1px solid #c9dcf5; background: #f5f9ff; border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.nap-qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.o-qr { text-align: center; }
.o-qr img, .o-qr svg { width: 240px; height: 240px; display: block; background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 6px; box-sizing: border-box; }
.o-qr.nho svg { width: 180px; height: 180px; }
.o-qr.xong img { opacity: .25; }
.tt-ck { flex: 1 1 260px; }
.tt-ck h3 { margin-top: 0; }
.bang.gon td { padding: 4px 6px; }
.ma-nd { font-family: Consolas, monospace; font-size: 15px; background: #fff6d6; padding: 1px 6px; border-radius: 4px; }
.tt-nap { margin-top: 8px; font-weight: 600; color: #8a6100; }
.tt-nap.ok { color: var(--xanh); }
.tt-nap.loi { color: var(--do); }
.hep-qr { flex: 0 0 220px; }
@media (max-width: 700px) { .o-qr img { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; margin: 0 auto; } .nap-qr { justify-content: center; } }
.luoi-form .dong-tick { margin: 0; }
.luoi-form .dong-tick input, .luoi-form input[type=checkbox] { width: auto; }
.luoi-form textarea { font: inherit; padding: 3px 6px; border: 1px solid var(--vien); border-radius: 4px; width: 100%; box-sizing: border-box; }
.anh-qr svg { width: 240px; height: 240px; display: block; background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 6px; box-sizing: border-box; }
.o-qr.xong .anh-qr { opacity: .25; }
@media (max-width: 700px) { .anh-qr svg { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; margin: 0 auto; } }

/* trang theo dõi AI (0.8.3) */
.the-tt { display: inline-block; white-space: nowrap; font-size: 12.5px; padding: 1px 8px; border-radius: 999px; background: #eef0f2; color: var(--chu); }
.the-tt.ok { background: #e3f4e8; color: #1e6b3a; }
.the-tt.loi { background: #fbe6e4; color: #a12a1f; }
.the-tt.chay { background: #fff3d6; color: #7a5200; }
.the-tt.cho { background: #eceef5; color: #3c4a6b; }
.so-loi { color: var(--do); }
.ghi-td { max-width: 380px; font-size: 12.5px; }
.bieu-do { max-width: 900px; }
.bieu-do svg { width: 100%; height: auto; display: block; }
.bieu-do .cot { fill: #1d5fb8; }
.bieu-do .luoi { stroke: #e6e8eb; stroke-width: 1; }
.bieu-do .goc { stroke: #c9ccd1; stroke-width: 1; }
.bieu-do .truc { fill: #6a6f76; font-size: 11px; }
.bieu-do .nhan-cot { fill: #1f2328; font-size: 11.5px; font-weight: 600; }
.bieu-do .cham { fill: transparent; cursor: default; }
.bieu-do .cham.dang-chi { fill: rgba(29, 95, 184, .06); }
.tip-bd { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--vien); border-radius: 8px; padding: 6px 10px;
  font-size: 12.5px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); pointer-events: none; }
.hop-phieu-cu { margin-top: 10px; padding: 8px 12px; background: var(--vang); border: 1px solid var(--vien-vang); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ===== trang chính 0.8.5: như nhắn tin — trái là hình dựng, phải là trao đổi với AI; phần khác ở "Nâng cao" ===== */
header { padding: 8px 20px; }
.ten-ht { display: flex; align-items: center; gap: 6px; }
header > div.ten-ht { flex: 0 1 auto; }
body:not(.nang-cao) .nc { display: none !important; }
.nut-nang-cao { border-radius: 12px; padding: 3px 12px; font-size: 12.5px; background: #f4f5f7; color: var(--mo); }
.nut-nang-cao.dang-chon { background: #e3edfb; color: var(--chinh-dam); border-color: #b9cdee; }
.ban-lam { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; padding: 12px; height: max(560px, calc(100vh - 92px)); }
.cot-chinh { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
/* trái: chưa có hình / đang đọc / hình dựng */
.hinh-trong, .dang-doc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  border: 2px dashed #c9d2de; border-radius: 12px; background: #f8fafc; color: var(--mo); padding: 20px; }
.hinh-trong b, .dang-doc b { font-size: 18px; color: var(--chu); }
.hinh-trong .so-lon { font-size: 40px; letter-spacing: 6px; }
body.keo .hinh-trong, body.keo .khung-chat { border-color: var(--chinh); background: #eef4fc; }
.dang-doc { border-style: solid; }
.xoay { width: 42px; height: 42px; border: 4px solid #d6e2f3; border-top-color: var(--chinh); border-radius: 50%; animation: xoay 1s linear infinite; }
@keyframes xoay { to { transform: rotate(360deg); } }
.khung-hinh { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.thanh-hinh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nhom-nut { display: inline-flex; flex-wrap: wrap; }
.nhom-nut button { border-radius: 0; margin-left: -1px; padding: 4px 12px; font-size: 13px; }
.nhom-nut button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.nhom-nut button:last-child { border-radius: 0 6px 6px 0; }
.nhom-nut .dang-chon { background: var(--chinh); color: #fff; border-color: var(--chinh); }
.khung-hinh .xem-3d { flex: 1; min-height: 300px; position: relative; }
.khung-hinh .xem-3d svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.xem-3d .dim text { fill: #1f2328; stroke: none; font-family: "Segoe UI", sans-serif; }
.xem-3d .dim .ten-chieu { font-weight: 600; }
.xem-3d g[data-k]:hover > polygon, .xem-3d g[data-k]:hover > rect { filter: brightness(1.1); }
.xem-anh-goc { flex: 1; min-height: 300px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--vien); border-radius: 6px; background: #fff; overflow: hidden; }
.xem-anh-goc img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dong-hinh { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: baseline; font-size: 13.5px; }
#tom-tat { cursor: default; }
.hanh-dong { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
button.lon { font-size: 15.5px; font-weight: 600; padding: 9px 20px; border-radius: 8px; }
#kq-dung { margin: 0; font-size: 13px; }
/* phải: trao đổi với AI */
.khung-chat { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--vien); border-radius: 10px; background: #fff; }
.khung-chat .dau-chat { align-items: center; justify-content: flex-start; padding: 8px 12px; gap: 8px; }
.khung-chat .tin-nhan { flex: 1; min-height: 120px; padding: 10px 12px; }
.tn.chao { max-width: 100%; }
.tn.chao ol { margin: 6px 0; padding-left: 20px; }
.tn .muc-tn { margin-top: 6px; font-weight: 600; font-size: 12.5px; }
.tn.nguoi-dung .tep-gui img { display: block; max-width: 220px; max-height: 160px; border-radius: 6px; margin-bottom: 6px; cursor: zoom-in; background: #fff; }
.tn.nguoi-dung .tep-gui { margin-bottom: 4px; }
.hop-phieu-cu { margin: 0 10px 6px; padding: 8px 10px; font-size: 13px; background: var(--vang); border: 1px solid var(--vien-vang); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#trang-thai { margin: 0 12px; font-size: 13px; min-height: 0; }
#trang-thai:empty { display: none; }
.go-chat { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px 10px; }
.hang-go { display: flex; gap: 8px; align-items: flex-end; }
.hang-go textarea { flex: 1; resize: none; font-size: 14px; }
.hang-go #gui-chat { padding: 9px 16px; font-weight: 600; }
.nut-kem { font-size: 22px; line-height: 1; padding: 8px 9px; border: 1px solid var(--vien); border-radius: 8px; cursor: pointer; background: #f4f6f9; user-select: none; }
.nut-kem:hover { background: #e9eef6; }
.nut-kem.nhac { animation: nhac .25s 4; border-color: var(--do); }
@keyframes nhac { 50% { transform: translateX(4px); } }
.dinh-kem { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--vien); border-radius: 8px; background: #f8fafc; font-size: 12.5px; }
.dinh-kem img { height: 54px; max-width: 90px; object-fit: cover; border-radius: 4px; }
.dinh-kem span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-phieu { display: flex; gap: 14px; justify-content: flex-end; padding: 0 12px 8px; }
button.nho-link { border: none; background: none; padding: 0; }
button.nho-link:disabled { opacity: .4; cursor: default; text-decoration: none; }
/* các phần bên dưới */
.sua-tay { margin-top: 12px; border-top: 1px solid var(--vien); padding-top: 8px; }
.sua-tay > summary { cursor: pointer; font-weight: 600; font-size: 14.5px; padding: 4px 0; }
.hang-tuy-chon { margin: 0 0 6px; }
.tuy-chon-van > summary { cursor: pointer; color: var(--chinh); font-size: 13px; }
.tuy-chon-van[open] { flex-basis: 100%; }
#tt-van:empty { display: none; }
.bo-qua { font-size: 12.5px; color: var(--mo); }
.bo-qua ul { margin: 4px 0; max-height: 160px; overflow: auto; }
.ghi-van { font-size: 12px; color: var(--cam); }
@media (max-width: 900px) {
  .ban-lam { grid-template-columns: 1fr; height: auto; }
  body:not(.co-phieu) .khung-chat { order: -1; }
  .hinh-trong { min-height: 200px; }
  .khung-hinh .xem-3d, .xem-anh-goc { min-height: min(60vh, 80vw); }
  .khung-chat { height: 70vh; }
}
.hinh-rong { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--mo); font-size: 15px; text-align: center; padding: 20px; }
/* lịch sử công việc (0.8.5) */
.nut-lich-su { border-radius: 12px; padding: 3px 12px; font-size: 12.5px; background: #eef2f8; color: var(--chinh-dam); border: 1px solid #c9d6ea; white-space: nowrap; }
.ds-ls { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.the-ls { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--vien); border-radius: 10px; padding: 8px; cursor: pointer; background: #fff; }
.the-ls:hover { border-color: var(--chinh); box-shadow: 0 2px 10px rgba(29,95,184,.12); }
.the-ls.dang-mo { border-color: #9fd3b2; background: #f3faf5; }
.anh-ls { flex: 0 0 96px; height: 72px; display: flex; align-items: center; justify-content: center; background: #f6f7f9; border-radius: 6px; overflow: hidden; font-size: 26px; }
.anh-ls img { width: 100%; height: 100%; object-fit: cover; }
.chu-ls { min-width: 0; flex: 1; }
.chu-ls > span { color: var(--mo); font-size: 13px; }
.gc-ls { font-size: 12.5px; color: #3d434a; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#lk-lich-su { margin-top: 10px; pointer-events: auto; font-size: 14px; }
/* xoay 3D bằng chuột (0.8.5) */
.xem-3d.xoay-duoc { touch-action: none; cursor: grab; user-select: none; }
.xem-3d.xoay-duoc:active { cursor: grabbing; }
.xem-3d.xoay-duoc svg { cursor: inherit; }
/* chọn vật liệu dựng, vật tư luôn sẵn (0.8.6) */
.chon-vl { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--vien); border-radius: 14px; padding: 2px 10px 2px 6px; cursor: pointer; background: #fff; user-select: none; }
.chip input { margin: 0; }
.chip:has(input:checked) { background: #e3edfb; border-color: #9cb9e6; color: var(--chinh-dam); }
/* "Dựng bằng": quy cách từng loại vật liệu */
.vl-ct { margin: 2px 0 6px; font-size: 13px; }
.vl-ct summary { cursor: pointer; color: var(--chinh-dam, #1d5fb8); list-style-position: inside; }
.vl-ct summary .mo { font-size: 12px; }
.vl-o { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 2px 4px; }
.vl-hang { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.vl-hang b { min-width: 34px; }
.vl-hang select, .vl-hang input { font: inherit; padding: 3px 6px; border: 1px solid var(--vien, #d0d5dc); border-radius: 6px; background: #fff; }
.vl-hang input { flex: 1; min-width: 180px; }
.vl-mac-dinh { font-size: 12px; }
.vat-tu-nhanh { font-size: 13px; background: #f3f8f4; border: 1px solid #cfe6d6; border-radius: 8px; padding: 5px 10px; line-height: 1.6; }
.vat-tu-nhanh b { color: var(--xanh); }
#nut-hien-dan-canh.dang-chon { background: #b36ea9; color: #fff; border-color: #b36ea9; }
.tieu-de-vt { margin-top: 14px; }
/* lấy từ SketchUp (0.8.7) */
button.nut-kem { line-height: 1; }
.lua-chon { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lua-chon button.da-chon { outline: 2px solid var(--xanh); }
/* ô nhập: chữ một dòng riêng rộng hết khung, nút 📎 📥 Gửi ở dưới (0.8.8) */
.hang-go { flex-wrap: wrap; align-items: center; gap: 6px; }
.hang-go textarea { flex: 1 1 100%; order: -1; min-height: 64px; }
.hang-go .nut-kem { font-size: 17px; padding: 5px 9px; }
.hang-go #gui-chat { margin-left: auto; padding: 7px 22px; }
/* quản trị: báo lỗi & góp ý */
.ds-gy { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.ds-gy .the-gy { border: 1px solid var(--vien); border-radius: 8px; padding: 8px 12px; background: #fff; }
.ds-gy .dau-gy { font-size: 13px; color: #555; }
.ds-gy .nd-gy { white-space: pre-wrap; margin: 6px 0; }
.ds-gy .tt-gy { border-radius: 10px; padding: 1px 8px; font-size: 12px; background: #eef1f5; }
.ds-gy .tt-gy.da_duyet { background: #e3edfb; color: #1d5fb8; }
.ds-gy .tt-gy.da_sua { background: #e3f5e8; color: #16803d; }
.anh-gy { display: flex; gap: 8px; flex-wrap: wrap; }
.anh-gy img { height: 120px; max-width: 220px; object-fit: cover; border: 1px solid var(--vien); border-radius: 6px; cursor: zoom-in; }
.vl-ct .vl-hang label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; margin: 0; font-weight: normal; }
.vl-ct .vl-hang select { width: auto; flex: none; min-width: 0; }
.vl-ct .vl-hang input { width: auto; }
.hang-token { margin: 4px 0 12px; }
.hang-token input { width: 150px; font: inherit; padding: 4px 8px; border: 1px solid var(--vien, #d0d5dc); border-radius: 6px; }
/* ⬇ trang tải bộ cài plugin (/tai-ve) */
.hop-tai { max-width: 520px; }
.nut-tai { display: flex; flex-direction: column; align-items: center; gap: 3px; margin: 14px 0 6px; padding: 14px 16px; border-radius: 10px;
  background: var(--chinh); color: #fff; font-size: 18px; font-weight: 600; text-decoration: none; text-align: center; }
.nut-tai:hover { filter: brightness(1.08); }
.nut-tai small { font-size: 12.5px; font-weight: 400; opacity: .9; }
.nut-tai.an, .tai-chua-co.an { display: none; }
.buoc-tai { padding-left: 20px; margin: 14px 0 8px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.buoc-tai .buoc-canh-bao { background: #eef4fc; border-left: 3px solid #1d5fb8; padding: 6px 10px; border-radius: 6px; }
.lk-tai { text-align: center; margin: 10px 0 0; font-size: 13px; color: var(--mo); }
.lk-tai a { color: var(--chinh); }
.lk-tai-dn { display: block; text-align: center; margin-top: 6px; font-size: 13.5px; color: var(--chinh); }

/* Khung khoá sửa (web/khoa_sua.js — cùng quy tắc với AI VIDEO STUDIO GTA): chỗ đã có dữ liệu chỉ để xem, bấm "✎ Sửa" mới sửa. */
.khoa-sua-o { border: 0; padding: 0; margin: 0; min-width: 0; }
.khoa-sua-thanh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 10px;
  padding: 5px 8px 5px 11px; border: 1px dashed var(--vien); border-radius: 8px; background: #f3f4f6; }
.khoa-sua-thanh .ghi { font-size: 13px; color: var(--mo); }
.khoa-sua:not(.dang-khoa) > .khoa-sua-thanh { border-style: solid; border-color: #9dbbe3; background: #eef4fc; }
.khoa-sua:not(.dang-khoa) > .khoa-sua-thanh .ghi { color: var(--chu); }
.khoa-sua.khong-thanh > .khoa-sua-thanh { display: none; }
/* Đang khoá: ô vẫn đọc rõ (không mờ), chỉ đổi nền; các nút trong vùng (Lưu, Xoá…) ẩn. */
.khoa-sua.dang-khoa .khoa-sua-o :is(input, select, textarea) { opacity: 1; color: var(--chu); -webkit-text-fill-color: var(--chu); cursor: not-allowed; }
.khoa-sua.dang-khoa .khoa-sua-o :is(.luoi-form, .hang-token, .nut-hang) :is(input, select, textarea) { background: #f3f4f6; }
.khoa-sua.dang-khoa .khoa-sua-o :is(input[type=checkbox], input[type=radio]) { opacity: .75; }
/* Chữ gợi ý trong ô trống vẫn mờ (không trông như giá trị đã lưu). */
.khoa-sua.dang-khoa .khoa-sua-o :is(input, textarea)::placeholder { color: #a3a7ad; -webkit-text-fill-color: #a3a7ad; }
.khoa-sua.dang-khoa .khoa-sua-o .bang :is(input, select, textarea):hover { border-color: transparent; }
.khoa-sua.dang-khoa .khoa-sua-o button { display: none; }
/* Đang sửa bảng: ô sửa được có viền để dễ thấy. */
.khoa-sua:not(.dang-khoa) .khoa-sua-o .bang :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { border-color: var(--vien); background: #fff; }
