/* ============================================================================
   KC — giao diện. Một hệ màu, một cỡ chữ, một kiểu thẻ cho mọi màn.
   ========================================================================== */
:root {
  --nen: #f4f6fa; --mat: #ffffff; --mat-2: #f8fafc; --vien: #e3e8ef; --vien-2: #cfd6e0;
  --chu: #0f1b2d; --chu-2: #334155; --nhat: #64748b; --mo: #94a3b8;
  --sb: #0f2440; --sb-2: #17345a; --sb-chu: #c8d4e6;
  --chinh: #2563eb; --chinh-dam: #1d4ed8; --chinh-nhat: #eaf1fe;
  --xanh: #15803d; --xanh-nhat: #e8f6ed; --vang: #b45309; --vang-nhat: #fdf4e3; --do: #c62828; --do-nhat: #fdeceb;
  --tim: #6d28d9; --tim-nhat: #f1ebfd; --lam: #0e7490; --lam-nhat: #e3f4f7;
  --bo: 12px; --bo-nho: 8px;
  --bong: 0 1px 2px rgba(15, 27, 45, .05), 0 1px 3px rgba(15, 27, 45, .06);
  --bong-cao: 0 12px 32px rgba(15, 27, 45, .18);
  --sb-rong: 212px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--nen); color: var(--chu); font: 13px/1.42 Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--chinh); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 19px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
.nho { font-size: 12.5px; color: var(--nhat); }
.so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.giua { text-align: center; }
.ma { font-family: "JetBrains Mono", Consolas, "Cascadia Mono", monospace; font-size: 12.5px; font-weight: 600; white-space: nowrap; letter-spacing: -.01em; }
.mo-ta { font-size: 12px; color: var(--nhat); }
.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.lon { width: 20px; height: 20px; }
[hidden] { display: none !important; }

/* ---------- thanh bên ---------- */
.sb { position: fixed; inset: 0 auto 0 0; width: var(--sb-rong); background: var(--sb); color: var(--sb-chu); display: flex; flex-direction: column; padding: 14px 10px; z-index: 30; }
.sb-hieu { display: flex; align-items: center; gap: 11px; color: #fff; padding: 0 6px 14px; }
.sb-hieu:hover { text-decoration: none; }
.sb-logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #3b82f6, #1e40af); color: #fff; font-weight: 800; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
/* logo công ty (Cài đặt chung) thay ô "KC": nền trắng để logo màu tối vẫn thấy trên thanh bên xanh đậm */
.sb-logo.anh { width: auto; max-width: 64px; object-fit: contain; background: #fff; padding: 2px 4px; border-radius: 8px; }
.sb-ten { display: flex; flex-direction: column; line-height: 1.2; }
.sb-ten b { font-size: 14px; letter-spacing: .04em; }
.sb-ten small { font-size: 11.5px; color: var(--sb-chu); white-space: nowrap; }
.sb-tai { width: 100%; justify-content: center; height: 34px; margin-bottom: 12px; }
/* 0.9.6: menu dài hơn chiều cao màn (22 mục ≈ 830px, màn 1366×768 chỉ còn ~560px) → menu CUỘN ĐƯỢC giữa nút tải và chân thanh bên —
   trước đây các mục cuối («Thông số báo giá», «Mật khẩu xoá»…) bị cắt, không bấm được */
.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; padding-bottom: 6px; }
.sb-nav > * { flex: none; }
.sb-nav .nhom { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6f86a6; padding: 12px 10px 6px; }
.sb-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--sb-chu); font-weight: 500; }
.sb-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sb-nav a.on { background: var(--sb-2); color: #fff; box-shadow: inset 2px 0 0 #60a5fa; }
.sb-nav a .dem { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.1); padding: 0 7px; border-radius: 99px; }
.sb-chan { margin-top: auto; font-size: 11.5px; color: #6f86a6; padding: 0 8px; line-height: 1.6; }
.sb-chan .cham { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: #22c55e; }
.sb-chan .cham.tat { background: #f59e0b; }
main { margin-left: var(--sb-rong); padding: 14px 18px 24px; max-width: calc(1440px + var(--sb-rong)); min-height: 100vh; }

/* ---------- nút ---------- */
.nut { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--bo-nho); border: 1px solid var(--vien-2);
  background: var(--mat); color: var(--chu-2); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.nut:hover { border-color: #9fb0c6; color: var(--chu); text-decoration: none; background: var(--mat-2); }
.nut:focus-visible { outline: 3px solid rgba(37,99,235,.3); outline-offset: 1px; }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.nut.chinh:hover { background: var(--chinh-dam); border-color: var(--chinh-dam); color: #fff; }
.nut.nguy { color: var(--do); }
.nut.nguy:hover { border-color: #f1a7a3; background: var(--do-nhat); color: var(--do); }
.nut.nguy.dac { background: var(--do); color: #fff; border-color: var(--do); }
.nut.trong { border-color: transparent; background: transparent; }
.nut.trong:hover { background: #eef2f7; }
.nut.nho { height: 26px; padding: 0 8px; font-size: 12.5px; gap: 5px; }
.nut.vuong { width: 26px; padding: 0; justify-content: center; }
.nut:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.nhom-nut { display: inline-flex; }
.nhom-nut .nut { border-radius: 0; margin-left: -1px; }
.nhom-nut .nut:first-child { border-radius: var(--bo-nho) 0 0 var(--bo-nho); margin-left: 0; }
.nhom-nut .nut:last-child { border-radius: 0 var(--bo-nho) var(--bo-nho) 0; }
.hang-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- ô nhập ---------- */
input, textarea, select { font: inherit; color: inherit; }
.o-nhap, .luoi input, .luoi textarea, .luoi select { width: 100%; height: 30px; padding: 4px 9px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); transition: border-color .12s, box-shadow .12s; }
.luoi textarea { height: auto; min-height: 30px; resize: vertical; line-height: 1.4; }
.o-nhap:focus, .luoi input:focus, .luoi textarea:focus, .bang td input:focus, .o-tim input:focus, .kien input:focus, .kien select:focus { outline: none; border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.luoi { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px 10px; }
.luoi .o { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.luoi label { font-size: 11.5px; color: var(--nhat); font-weight: 500; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.o-tim { position: relative; }
.o-tim .ic { position: absolute; left: 10px; top: 8px; color: var(--mo); }

/* ---------- 0.9.11 ô chọn có danh sách (Payment term …) — web/app.js LC: ô gõ tự do · nút ▾ dính bên phải · nút «Khai báo» ---------- */
.o-lc { display: flex; align-items: stretch; min-width: 0; }
.o-lc > input, .luoi .o-lc > textarea { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.o-lc-mo { flex: 0 0 26px; min-height: 30px; padding: 0; border: 1px solid var(--vien-2); border-left: 0; border-radius: 0 var(--bo-nho) var(--bo-nho) 0;
  background: var(--mat-2); color: var(--nhat); cursor: pointer; display: grid; place-items: center; transition: background .12s, color .12s; }
.o-lc-mo:hover { background: var(--chinh-nhat); color: var(--chinh); }
.o-lc > [aria-expanded="true"] + .o-lc-mo { background: var(--chinh-nhat); color: var(--chinh); border-color: var(--chinh); }
.o-lc-mo .ic { width: 15px; height: 15px; }
.o-lc-kb { align-self: flex-start; height: 30px; margin-left: 6px; padding: 0 9px; gap: 5px; font-size: 12px; }
.o-lc-kb .ic { width: 14px; height: 14px; }
.o-lc > :disabled ~ button { display: none; }
.o-lc > :disabled { border-radius: var(--bo-nho); }
.lc-menu { position: fixed; z-index: 80; background: var(--mat); border: 1px solid var(--vien-2); border-radius: 10px; box-shadow: var(--bong-cao); padding: 4px;
  overflow: auto; display: flex; flex-direction: column; gap: 1px; animation: hien .1s ease; }
.lc-muc { display: block; width: 100%; flex: none; text-align: left; border: 0; background: transparent; padding: 7px 30px 7px 10px; border-radius: 7px;
  font: inherit; color: var(--chu); cursor: pointer; position: relative; line-height: 1.38; white-space: normal; overflow-wrap: anywhere; }
.lc-muc.hl { background: var(--chinh-nhat); }
.lc-muc.on { font-weight: 600; color: var(--chinh-dam); }
.lc-muc.on::after { content: "✓"; position: absolute; right: 11px; top: 7px; color: var(--chinh); font-weight: 700; }
.lc-trong { padding: 10px; color: var(--nhat); font-size: 12.5px; }
.lc-ghi { padding: 4px 10px 2px; font-size: 11px; color: var(--mo); flex: none; }
.lc-kb { display: flex; align-items: center; gap: 6px; flex: none; border: 0; border-top: 1px solid var(--vien); margin-top: 3px; padding: 8px 10px 6px; background: transparent;
  color: var(--chinh); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left; border-radius: 0 0 7px 7px; }
.lc-kb:hover { background: var(--chinh-nhat); }
.hop.lc-hop { width: min(760px, 100%); }
.lc-kb-ghi { font-size: 12.5px; color: var(--nhat); margin-bottom: 10px; line-height: 1.5; }
.lc-hop .canh-bao { font-size: 12.5px; line-height: 1.5; }
.lc-hop .canh-bao .lc-goi-o { margin-top: 4px; }
.lc-dang-go { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border: 1px dashed var(--chinh); border-radius: var(--bo-nho); margin-bottom: 8px;
  background: var(--chinh-nhat); font-size: 12.5px; }
.lc-dang-go span { color: var(--nhat); white-space: nowrap; }
.lc-dang-go b { flex: 1; min-width: 0; font-weight: 600; color: var(--chu); }
.lc-ds { list-style: none; margin: 0; padding: 0 2px 0 0; display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow: auto; }
.lc-ds li { display: flex; align-items: flex-start; gap: 6px; }
.lc-stt { flex: 0 0 22px; text-align: right; color: var(--mo); font-size: 12px; padding-top: 7px; }
.lc-ds textarea { flex: 1; min-width: 0; resize: none; min-height: 30px; padding: 5px 9px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); line-height: 1.4;
  overflow: hidden; background: var(--mat); }
.lc-ds textarea:focus, .lc-them input:focus { outline: none; border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.lc-dem { flex: 0 0 auto; font-size: 11.5px; font-weight: 500; color: var(--xanh); background: var(--xanh-nhat); border-radius: 999px; padding: 2px 8px; margin-top: 5px; white-space: nowrap; }
.lc-dem.chua { color: var(--mo); background: var(--mat-2); font-weight: 400; }
.lc-nut { display: flex; gap: 1px; flex: 0 0 auto; }
.lc-nut .nut { width: 28px; height: 28px; padding: 0; justify-content: center; }
.lc-them { display: flex; gap: 6px; margin-top: 10px; padding-left: 28px; }
.lc-them input { flex: 1; min-width: 0; height: 30px; padding: 4px 9px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); }
.lc-goi { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--vien); }
.lc-goi-dau { font-size: 11px; font-weight: 700; color: var(--nhat); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.lc-goi-o { display: flex; align-items: flex-start; gap: 6px; width: 100%; text-align: left; border: 1px dashed var(--vien-2); background: var(--mat); border-radius: var(--bo-nho);
  padding: 6px 9px; margin-bottom: 4px; font: inherit; font-size: 12.5px; color: var(--chu-2); cursor: pointer; }
.lc-goi-o:hover { border-color: var(--chinh); color: var(--chinh-dam); background: var(--chinh-nhat); }
.lc-goi-o .ic { margin-top: 2px; color: var(--chinh); }
.lc-goi-o span { flex: 1; min-width: 0; }
.lc-goi-o small { color: var(--nhat); white-space: nowrap; }
.o-tim input { height: 32px; width: 280px; max-width: 100%; padding: 7px 12px 7px 34px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); }

/* ---------- đầu trang ---------- */
.dau-trang { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dau-trang .tieu-de { flex: 1; min-width: 260px; }
.vet { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--nhat); margin-bottom: 3px; }
.vet a { color: var(--nhat); }
.vet a:hover { color: var(--chinh); }
.vet .ic { width: 13px; height: 13px; }
.phu-de { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; color: var(--nhat); font-size: 13px; }
.phu-de span { display: inline-flex; align-items: center; gap: 5px; }
.phu-de .ic { width: 14px; height: 14px; }

/* ---------- thẻ ---------- */
.the { background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); margin-bottom: 12px; }
.the-dau { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--vien); flex-wrap: wrap; min-height: 42px; }
.the-dau .viec { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.the-than { padding: 10px 12px; }
.the-than.khit { padding: 0; }
details.the > summary { list-style: none; cursor: pointer; }
details.the > summary::-webkit-details-marker { display: none; }
details.the > summary .mui { transition: transform .15s; color: var(--nhat); }
details.the[open] > summary .mui { transform: rotate(90deg); }
details.the:not([open]) > summary { border-bottom: 0; }
.nhom-o { grid-column: span 12; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--nhat); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }
.nhom-o::after { content: ""; flex: 1; height: 1px; background: var(--vien); }
.nhom-o:first-child { margin-top: 0; }

/* ô chỉ số */
.chi-so { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.o-so { background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); padding: 10px 14px; box-shadow: var(--bong); display: flex; gap: 12px; align-items: center; }
.o-so .bieu { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.o-so .bieu.lam { background: var(--chinh-nhat); color: var(--chinh); }
.o-so .bieu.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.o-so .bieu.tim { background: var(--tim-nhat); color: var(--tim); }
.o-so .bieu.vang { background: var(--vang-nhat); color: var(--vang); }
.o-so .nhan-so { font-size: 12.5px; color: var(--nhat); font-weight: 500; }
.o-so .gia-tri { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.o-so .phu { font-size: 12px; color: var(--nhat); margin-top: 2px; }

/* thanh công cụ trên bảng */
.cong-cu { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 12px; border-bottom: 1px solid var(--vien); }
/* flex-wrap + max-width: nhiều nút (vd. lọc năm từ 4 năm trở lên) thì xuống dòng trong thẻ, không lòi ra ngoài trên điện thoại */
.phan-doan { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: #eef2f7; border-radius: 9px; padding: 3px; gap: 2px; }
.phan-doan button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--nhat); padding: 3px 10px; border-radius: 7px; cursor: pointer; }
.phan-doan button.on { background: var(--mat); color: var(--chu); box-shadow: var(--bong); }
.phan-doan button .dem { color: var(--mo); margin-left: 4px; font-weight: 500; }

/* ---------- bảng ---------- */
.cuon { overflow-x: auto; }
table.bang { width: 100%; border-collapse: separate; border-spacing: 0; }
.bang th, .bang td { padding: 5px 10px; border-bottom: 1px solid var(--vien); vertical-align: middle; }
.bang th { background: var(--mat-2); font-size: 10.5px; font-weight: 600; color: var(--nhat); text-align: left; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.bang th.so { text-align: right; }
.bang tbody tr { transition: background .1s; }
.bang tbody tr:hover { background: #f8fbff; }
.bang tbody tr:last-child td { border-bottom: 0; }
.bang tr.mo td { color: var(--mo); }
.bang tr.mo .ma { color: var(--mo); }
.bang tfoot td { font-weight: 700; background: var(--mat-2); border-top: 1px solid var(--vien-2); border-bottom: 0; }
.bang td input { height: 27px; padding: 3px 8px; border: 1px solid var(--vien-2); border-radius: 7px; width: 100%; min-width: 60px; background: var(--mat); }
.bang td input.so { min-width: 84px; }
.bang input[type=checkbox], .kien input[type=checkbox] { width: 16px; height: 16px; min-width: 0; padding: 0; vertical-align: middle; accent-color: var(--chinh); cursor: pointer; }
input.loi { border-color: var(--do) !important; background: var(--do-nhat) !important; }
.bang tr.bam { cursor: pointer; }
.bang .viec-dong { display: flex; gap: 6px; justify-content: flex-end; }
.trong { padding: 30px 16px; text-align: center; color: var(--nhat); }
.trong .bieu-lon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--chinh-nhat); color: var(--chinh); display: grid; place-items: center; }
.trong h3 { color: var(--chu); margin-bottom: 4px; }

/* nhãn, tiến độ */
.nhan { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: var(--chu-2); white-space: nowrap; line-height: 1.5; }
.nhan.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.nhan.vang { background: var(--vang-nhat); color: var(--vang); }
.nhan.do { background: var(--do-nhat); color: var(--do); }
.nhan.lam { background: var(--chinh-nhat); color: var(--chinh); }
.nhan.tim { background: var(--tim-nhat); color: var(--tim); }
.nhan.ngoc { background: var(--lam-nhat); color: var(--lam); }
.nhan .ic { width: 12px; height: 12px; }
.loai { display: inline-grid; place-items: center; min-width: 34px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.loai.PI { background: var(--xanh-nhat); color: var(--xanh); }
.loai.CI { background: var(--chinh-nhat); color: var(--chinh); }
.loai.PL { background: var(--tim-nhat); color: var(--tim); }
.tien-do { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.tien-do .vach { flex: 1; height: 6px; border-radius: 99px; background: #e6ebf2; overflow: hidden; }
.tien-do .vach i { display: block; height: 100%; background: var(--chinh); border-radius: 99px; }
.tien-do .vach i.du { background: var(--xanh); }
.tien-do .vach i.vuot { background: var(--do); }
.tien-do span { font-size: 12px; color: var(--nhat); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* hộp cảnh báo */
.canh-bao { display: flex; gap: 10px; border: 1px solid #f3d9a4; background: var(--vang-nhat); color: #7c4a03; border-radius: var(--bo); padding: 8px 12px; margin-bottom: 12px; }
.canh-bao ul { margin: 4px 0 0; padding-left: 18px; }
.canh-bao.do { border-color: #f5c2bf; background: var(--do-nhat); color: #8f1d1d; }

/* ---------- quy trình đơn hàng ---------- */
.quy-trinh { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); margin-bottom: 12px; overflow: hidden; }
.buoc { padding: 9px 14px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--vien); position: relative; min-width: 0; }
.buoc:last-child { border-right: 0; }
.buoc .dau-buoc { display: flex; align-items: center; gap: 10px; }
.buoc .so-buoc { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #eef2f7; color: var(--nhat); flex: none; }
.buoc.xong .so-buoc { background: var(--xanh); color: #fff; }
.buoc.dang .so-buoc { background: var(--chinh); color: #fff; }
.buoc .ten-buoc { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--nhat); }
.buoc .gt { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buoc .hang-nut { margin-top: 4px; }

/* thông tin dạng nhãn : giá trị */
.tt { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 20px; }
.tt div span { display: block; font-size: 12px; color: var(--nhat); margin-bottom: 1px; }
.tt div b { font-weight: 500; word-break: break-word; }

/* thanh lưu cuối màn */
.thanh-luu { position: sticky; bottom: 8px; z-index: 10; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 7px 14px; margin-top: 4px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: 0 8px 28px rgba(15,27,45,.12); }
.thanh-luu .tong { display: flex; flex-direction: column; line-height: 1.25; }
.thanh-luu .tong span { font-size: 11.5px; color: var(--nhat); }
.thanh-luu .tong b { font-size: 15px; font-variant-numeric: tabular-nums; }
.thanh-luu .hang-nut { margin-left: auto; }
.chua-luu { display: inline-flex; align-items: center; gap: 6px; color: var(--vang); font-weight: 600; font-size: 13px; }
.chua-luu::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* NAME bắt buộc ở đơn hàng; NAME của kiện chỉ hiển thị */
.bang td input[data-k=ten]:placeholder-shown { background: var(--vang-nhat); border-color: #f0c36d; }
.o-chi-doc { height: 27px; display: flex; align-items: center; padding: 0 9px; border: 1px dashed var(--vien-2); border-radius: 7px; background: var(--mat-2); font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* cột "Hàng trong CI" của PL: ô tìm + lọc */
.pl-loc { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--vien); }
.pl-loc .o-tim { flex: 1 1 140px; }
.pl-loc .o-tim input { width: 100%; height: 28px; }
.pl-loc .o-tim .ic { top: 6px; }
.pl-loc .phan-doan button { padding: 2px 8px; font-size: 12px; }

/* lần đặt trong năm: 04 / 2026 */
.bang td.lan-dat { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bang td.lan-dat b { font-size: 14px; }
.bang td.lan-dat span { color: var(--nhat); font-size: 12px; }
h1 .h1-phu { font-weight: 500; color: var(--chu-2); }

/* cài đặt chung: logo · khổ nhãn */
.cd-logo { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: center; }
.khung-logo { width: 240px; height: 110px; display: grid; place-items: center; text-align: center; padding: 8px; border: 1px dashed var(--vien-2); border-radius: var(--bo-nho);
  background: repeating-conic-gradient(#f1f4f8 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.khung-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hop .khung-logo { height: 140px; margin-top: 4px; }
.kho-nhan { display: flex; gap: 8px; flex-wrap: wrap; }
.kho-nhan label { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); cursor: pointer; background: var(--mat); font-size: 13px; color: var(--chu); }
.kho-nhan label.on { border-color: var(--chinh); background: var(--chinh-nhat); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.kho-nhan input { position: absolute; opacity: 0; pointer-events: none; }
.kho-nhan span { display: flex; flex-direction: column; line-height: 1.25; }
.kho-nhan small { color: var(--chinh); font-weight: 600; font-size: 11px; }
/* hình minh hoạ tờ giấy: dọc 2 nhãn (nét đứt giữa) · ngang */
.hinh-kho { display: block; width: 22px; height: 30px; border: 1.5px solid var(--chu-2); border-radius: 2px; background: #fff; position: relative; }
.hinh-kho.hai::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; border-top: 1.5px dashed var(--chu-2); }
.hinh-kho.ngang { width: 28px; height: 20px; }
.hinh-kho.ngang.lon { width: 34px; height: 24px; }

/* ô tích trong hộp thoại */
.luoi label.o-chon { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--chu); cursor: pointer; }
.luoi .o-chon input { width: 16px; height: 16px; accent-color: var(--chinh); }

/* chọn sheet của tệp Quotation */
.ds-sheet { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
.sheet { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 170px; padding: 6px 12px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); font: inherit; text-align: left; cursor: pointer; }
.sheet:hover { border-color: #9fb0c6; }
.sheet.on { border-color: var(--chinh); background: var(--chinh-nhat); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.sheet.sai { background: var(--mat-2); }
.sheet.sai b { color: var(--nhat); }

/* ---------- PACKING LIST ---------- */
.pl-luoi { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 12px; align-items: start; }
.pl-hang { position: sticky; top: 10px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.pl-hang .the-than { overflow-y: auto; padding: 6px 0; }
.mat-hang { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 12px; border-bottom: 1px solid var(--vien); align-items: center; }
.mat-hang:last-child { border-bottom: 0; }
.mat-hang .tien-do { grid-column: 1 / -1; min-width: 0; }
.mat-hang.du { background: #fbfefc; }
.mat-hang.du .ma { color: var(--xanh); }
.ds-kien { display: flex; flex-direction: column; gap: 10px; }
.kien { background: var(--mat); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); transition: border-color .12s, box-shadow .12s; }
.kien.on { border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.12), var(--bong); }
.kien-dau { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--vien); background: var(--mat-2); border-radius: var(--bo) var(--bo) 0 0; flex-wrap: wrap; }
.kien-dau .so-kien { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.kien-dau .so-kien .ic { color: var(--tim); }
.kien-dau .viec { margin-left: auto; display: flex; gap: 4px; }
.kien-qc { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 8px; padding: 7px 10px; align-items: end; border-bottom: 1px dashed var(--vien); }
.kien-qc .r2 { grid-column: span 2; } .kien-qc .r4 { grid-column: span 4; }
.pl-cong-cu { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--vien); background: var(--mat-2); }
.kien-qc label { display: block; font-size: 11px; color: var(--nhat); font-weight: 500; margin-bottom: 1px; white-space: nowrap; }
.kien input, .kien select { width: 100%; height: 27px; padding: 3px 8px; border: 1px solid var(--vien-2); border-radius: 7px; background: var(--mat); }
.kien-qc input:placeholder-shown { background: var(--vang-nhat); border-color: #f0c36d; }
.kien-qc input::placeholder { color: #c08a2c; font-size: 11.5px; }
.kien-qc .cbm { font-size: 12px; color: var(--nhat); white-space: nowrap; padding-bottom: 7px; }
.kien-qc .cbm b { color: var(--chu); font-variant-numeric: tabular-nums; }
.kien-qc .kien-canh { grid-column: 1 / -1; display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--do); background: var(--do-nhat); border-radius: 7px; padding: 5px 8px; line-height: 1.4; }
.kien-qc .kien-canh[hidden] { display: none; }
.kien-qc .kien-canh .ic { flex: none; margin-top: 1px; }
.kien-hang { padding: 4px 10px 8px; }
.kien-hang table { width: 100%; border-collapse: collapse; }
.kien-hang td { padding: 2px 3px; vertical-align: middle; }
.kien-hang td.sl { width: 130px; }
.kien-hang td.xoa { width: 36px; text-align: right; }
.kien-hang .goi-y { font-size: 11.5px; color: var(--nhat); white-space: nowrap; }
.kien-trong { padding: 10px 0 4px; color: var(--mo); font-size: 13px; }

/* ---------- hộp thoại ---------- */
.che { position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 60; display: grid; place-items: center; padding: 20px; animation: hien .15s ease; }
.hop { background: var(--mat); border-radius: 14px; box-shadow: var(--bong-cao); width: min(480px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: noi .18s ease; }
.hop.rong { width: min(1100px, 100%); height: calc(100vh - 40px); }
.hop-dau { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--vien); }
.hop-dau h2 { flex: 1; font-size: 16px; }
.hop-than { padding: 18px 20px; overflow: auto; color: var(--chu-2); line-height: 1.55; }
.hop-than.khit { padding: 0; flex: 1; display: flex; white-space: normal; background: #525659; }
.hop-than iframe { border: 0; width: 100%; flex: 1; }
.hop-chan { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--vien); flex-wrap: wrap; }
.dang-tai-pdf { margin: auto; color: #e5e7eb; display: flex; align-items: center; gap: 10px; }
.xoay { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: xoay .7s linear infinite; }
@keyframes xoay { to { transform: rotate(360deg); } }
@keyframes noi { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* thông báo nổi */
#thong-bao { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(460px, calc(100vw - 44px)); }
.tb { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; background: var(--chu); color: #fff; box-shadow: var(--bong-cao); white-space: pre-line; animation: hien .2s ease; font-weight: 500; }
.tb.loi { background: var(--do); }
.tb.ok { background: #14532d; }
.tb .ic { margin-top: 2px; }
@keyframes hien { from { opacity: 0; transform: translateY(6px); } }
.dang-tai { padding: 80px; display: flex; justify-content: center; color: var(--nhat); gap: 10px; align-items: center; }

@media (max-width: 1100px) {
  .luoi .c2 { grid-column: span 3; } .luoi .c3, .luoi .c4, .luoi .c5 { grid-column: span 6; } .luoi .c6, .luoi .c7, .luoi .c8 { grid-column: span 12; }
  .pl-luoi { grid-template-columns: 1fr; }
  .pl-hang { position: static; max-height: 420px; }
  .chi-so { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  /* thanh trên: flex-wrap là lưới an toàn — không vừa một hàng thì xuống hàng chứ không tràn ngang cả trang */
  .sb { position: sticky; top: 0; inset: auto; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; gap: 10px; }
  .sb-hieu { padding: 0; }
  /* menu thanh trên chỉ để biểu tượng (chữ hiện khi rê chuột — title): 4 mục kèm chữ + logo công ty cần ~800px,
     hẹp hơn thì tràn ngang (561–640px) hoặc chữ gãy hai dòng */
  .sb-ten small, .sb-nav .nhom, .sb-chan, .sb-nav a .dem, .sb-nav a span { display: none; }
  .sb-nav { flex-direction: row; margin-left: auto; flex: 0 1 auto; overflow: visible; padding-bottom: 0; }
  .sb-tai { width: auto; margin: 0; order: 3; height: 34px; }
  main { margin-left: 0; padding: 16px 14px 30px; }
  .quy-trinh { grid-template-columns: 1fr 1fr; }
  .buoc:nth-child(2) { border-right: 0; }
  .buoc:nth-child(-n+2) { border-bottom: 1px solid var(--vien); }
  .luoi .c2, .luoi .c3, .luoi .c4, .luoi .c5, .luoi .c6, .luoi .c7, .luoi .c8 { grid-column: span 12; }
  .thanh-luu { gap: 14px; bottom: 8px; }
  .thanh-luu .hang-nut { margin-left: 0; }
  .o-tim input { width: 100%; }
}
@media (max-width: 560px) {
  .sb-ten { display: none; }
  .cd-logo { grid-template-columns: 1fr; }
  .chi-so { grid-template-columns: 1fr; }
  .quy-trinh { grid-template-columns: 1fr; }
  .buoc { border-right: 0; border-bottom: 1px solid var(--vien); }
  .kien-qc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kien-qc .r2, .kien-qc .r4 { grid-column: span 2; }
}
@media (max-width: 440px) {
  /* điện thoại hẹp: nút Tải Quotation chỉ còn biểu tượng (chữ vẫn đọc được qua title / trình đọc màn hình) — logo rộng
     tới 64px + 4 biểu tượng menu + nút đủ chữ cần ~395px, tràn ngang ở 360–390px */
  .sb-tai { font-size: 0; gap: 0; width: 34px; padding: 0; justify-content: center; }
}
