:root {
  --nen: #f4f6f8;
  --the: #ffffff;
  --chu: #1f2937;
  --chu-nhe: #6b7280;
  --vien: #d9dee5;
  --xanh: #0f9d58;
  --xanh-nhat: #e6f5ec;
  --do: #b42318;
  --do-nhat: #fde8e6;
  --xanh-la: #067647;
  --xanh-la-nhat: #e6f6ee;
  --vang-nhat: #fff7e0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #111418;
    --the: #1a1f26;
    --chu: #e5e7eb;
    --chu-nhe: #9ca3af;
    --vien: #2d3440;
    --xanh: #4ade80;
    --xanh-nhat: #1b3327;
    --do: #f97066;
    --do-nhat: #3a1f1d;
    --xanh-la: #4ade80;
    --xanh-la-nhat: #1b3327;
    --vang-nhat: #3a3218;
  }
}
:root[data-theme="dark"] {
  --nen: #111418;
  --the: #1a1f26;
  --chu: #e5e7eb;
  --chu-nhe: #9ca3af;
  --vien: #2d3440;
  --xanh: #4ade80;
  --xanh-nhat: #1b3327;
  --do: #f97066;
  --do-nhat: #3a1f1d;
  --xanh-la: #4ade80;
  --xanh-la-nhat: #1b3327;
  --vang-nhat: #3a3218;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--nen);
  color: var(--chu);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--xanh); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 22px 0 8px; }

.khung { display: flex; min-height: 100vh; }
.menu {
  width: 240px; flex-shrink: 0; background: var(--the);
  border-right: 1px solid var(--vien); padding: 14px 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.thuong-hieu { font-weight: 700; font-size: 16px; padding: 4px 8px 14px; color: var(--xanh); }
.thuong-hieu span { display: block; font-size: 12px; color: var(--chu-nhe); font-weight: 400; }
.menu nav a {
  display: block; padding: 6px 10px; border-radius: 6px; color: var(--chu); margin-bottom: 1px;
}
.menu nav a:hover { background: var(--xanh-nhat); text-decoration: none; }
.menu .nhom {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--chu-nhe);
  padding: 12px 10px 4px;
}
.noi-dung { flex: 1; padding: 22px 26px; min-width: 0; }

.the {
  background: var(--the); border: 1px solid var(--vien); border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.luoi-so { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.so-lieu .nhan { color: var(--chu-nhe); font-size: 12px; }
.so-lieu .gia-tri { font-size: 20px; font-weight: 600; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--the); }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--vien); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--chu-nhe); font-weight: 600; background: var(--nen); position: sticky; top: 0; }
td.so, th.so { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.tong td { font-weight: 700; border-top: 2px solid var(--vien); }
tr.huy td { color: var(--chu-nhe); text-decoration: line-through; }
.bang-cuon { overflow-x: auto; border: 1px solid var(--vien); border-radius: 10px; }
.bang-cuon table { border: 0; }

form.luoi { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
form.luoi label { display: flex; flex-direction: column; font-size: 12px; color: var(--chu-nhe); gap: 3px; }
input, select, textarea {
  font: inherit; color: var(--chu); background: var(--the);
  border: 1px solid var(--vien); border-radius: 6px; padding: 6px 8px; min-width: 0;
}
input.so { text-align: right; width: 140px; }
input[type="text"], input[type="date"], input[type="password"], input[type="search"] { min-width: 160px; }
select { min-width: 140px; }
textarea { width: 100%; min-height: 60px; }
.nut {
  display: inline-block; border: 1px solid var(--xanh); background: var(--xanh); color: #fff;
  border-radius: 6px; padding: 7px 14px; cursor: pointer; font: inherit; text-decoration: none;
}
.nut:hover { text-decoration: none; opacity: .92; }
.nut.phu { background: transparent; color: var(--xanh); }
.nut.do { background: var(--do); border-color: var(--do); }
.nut.nho { padding: 3px 8px; font-size: 12px; }
.hanh-dong { display: flex; gap: 6px; flex-wrap: wrap; }

.thong-bao { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid var(--vien); background: var(--xanh-nhat); }
.thong-bao.loi { background: var(--do-nhat); color: var(--do); border-color: var(--do); }
.thong-bao.thanh_cong { background: var(--xanh-la-nhat); color: var(--xanh-la); border-color: var(--xanh-la); }
.thong-bao.canh_bao { background: var(--vang-nhat); }

.nhan-trang-thai { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.dat { background: var(--xanh-la-nhat); color: var(--xanh-la); }
.sai { background: var(--do-nhat); color: var(--do); }
.chu-nhe { color: var(--chu-nhe); }
.khoa { background: var(--vang-nhat); }

/* Form lập chứng từ */
.dong-but-toan td { padding: 4px 4px; }
.dong-but-toan { min-width: 760px; }
.dong-but-toan input, .dong-but-toan select { width: 100%; }
.dong-but-toan td:nth-child(1) input { width: 90px; }
.dong-but-toan td:nth-child(2) select { width: 210px; }
.dong-but-toan td.so input { text-align: right; width: 140px; }
.tong-ket { display: flex; gap: 24px; font-weight: 600; margin-top: 8px; }
.tong-ket .lech { color: var(--do); }

/* Khung giao diện kiểu phần mềm kế toán: thanh trên, cột phân hệ, dãy chức năng */
.ung-dung { min-height: 100vh; display: flex; flex-direction: column; }
.thanh-tren {
  height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px; background: var(--the); border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 5;
}
.thanh-tren .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--chu); white-space: nowrap; }
.thanh-tren .logo:hover { text-decoration: none; }
.thanh-tren .logo small { font-weight: 400; color: var(--chu-nhe); }
.logo-o {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--xanh); color: #fff; font-size: 12px; font-weight: 700;
}
.tren-phai { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.tren-phai .ten-nguoi { color: var(--chu-nhe); }
.than { flex: 1; display: flex; min-height: 0; }
.cot-trai {
  width: 176px; flex-shrink: 0; background: var(--the); border-right: 1px solid var(--vien);
  position: sticky; top: 52px; height: calc(100vh - 52px); padding: 6px 0; z-index: 6;
}
.muc-wrap { position: relative; }
.flyout {
  display: none; position: absolute; left: 100%; top: 0; min-width: 240px; padding: 8px 0;
  background: var(--the); border: 1px solid var(--vien); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); z-index: 30;
}
.muc-wrap:hover .flyout { display: block; }
.flyout .fly-tieu { font-weight: 700; padding: 6px 14px 4px; color: var(--chu); }
.flyout .fly-nhom {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--chu-nhe);
  padding: 10px 14px 3px;
}
.flyout a { display: block; padding: 6px 14px; color: var(--chu); font-size: 13px; }
.flyout a:hover { background: var(--xanh-nhat); color: var(--xanh); text-decoration: none; }
.phan-he { display: flex; flex-direction: column; }
.muc-phan-he {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--chu); font-size: 13px;
  border-left: 3px solid transparent;
}
.muc-phan-he:hover { background: var(--xanh-nhat); text-decoration: none; }
.muc-phan-he.on { background: var(--xanh-nhat); border-left-color: var(--xanh); color: var(--xanh); font-weight: 600; }
.ky-hieu {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  background: var(--nen); color: var(--chu-nhe); font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.muc-phan-he.on .ky-hieu { background: var(--xanh); color: #fff; }
.ky-hieu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Nút "Thêm" có danh sách chọn (kiểu nút tách trên thanh công cụ) */
.tach { position: relative; display: inline-block; }
.tach > summary { list-style: none; }
.tach > summary::-webkit-details-marker { display: none; }
.tach > summary.nut::after { content: " ▾"; font-size: 11px; }
.tach-menu {
  position: absolute; right: 0; top: calc(100% + 4px); min-width: 230px; z-index: 20;
  background: var(--the); border: 1px solid var(--vien); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 6px 0;
}
.tach-menu a { display: block; padding: 8px 14px; color: var(--chu); }
.tach-menu a:hover { background: var(--xanh-nhat); color: var(--xanh); text-decoration: none; }
.thanh-cong-cu { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.thanh-cong-cu h1 { margin: 0; }
.khung-noi-dung { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thanh-tab {
  display: flex; gap: 2px; overflow-x: auto; background: var(--the); border-bottom: 1px solid var(--vien);
  padding: 0 10px; position: sticky; top: 52px; z-index: 4; white-space: nowrap;
}
.thanh-tab .tab {
  padding: 11px 12px; color: var(--chu-nhe); font-size: 13px; border-bottom: 2px solid transparent; flex-shrink: 0;
}
.thanh-tab .tab:hover { color: var(--chu); text-decoration: none; }
.thanh-tab .tab.on { color: var(--xanh); border-bottom-color: var(--xanh); font-weight: 600; }

@media (max-width: 760px) {
  .thanh-tren { height: auto; min-height: 48px; padding: 8px 12px; flex-wrap: wrap; }
  .thanh-tren .logo small { display: none; }
  .than { flex-direction: column; }
  .cot-trai {
    width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--vien);
    overflow-x: auto; overflow-y: hidden; padding: 0;
  }
  .flyout { display: none !important; }
  .phan-he { flex-direction: row; }
  .muc-phan-he { flex-direction: column; gap: 3px; padding: 8px 12px; border-left: 0; border-bottom: 3px solid transparent; font-size: 12px; white-space: nowrap; }
  .muc-phan-he.on { border-bottom-color: var(--xanh); }
  .ky-hieu { width: 30px; height: 24px; }
  .thanh-tab { position: static; }
}

/* Menu nhóm (thu gọn được) */
.menu details.nhom-menu { margin-bottom: 4px; }
.menu details.nhom-menu summary {
  cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--chu-nhe); padding: 10px 10px 4px; list-style: none; font-weight: 600;
}
.menu details.nhom-menu summary::-webkit-details-marker { display: none; }
.menu details.nhom-menu summary::after { content: " ▾"; }
.menu details.nhom-menu[open] summary::after { content: " ▴"; }
.menu .thuong-hieu a { color: var(--xanh); }
.dau-trang { justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.dau-trang h1 { margin: 0; }

/* Form phiếu nhiều dòng (dùng được trên điện thoại) */
.luoi-o { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.luoi-o label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--chu-nhe); }
.luoi-o label.rong { grid-column: 1 / -1; }
.luoi-o input, .luoi-o select { width: 100%; }
.phieu-tc .luoi-o label.rong { grid-column: 1 / -1; }
#cac-dong { display: flex; flex-direction: column; gap: 10px; }
.dong-phieu {
  display: grid; gap: 8px 10px; align-items: end; padding: 10px;
  border: 1px solid var(--vien); border-radius: 10px; background: var(--the);
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.3fr) auto;
}
.dong-phieu label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--chu-nhe); min-width: 0; }
.dong-phieu select, .dong-phieu input { width: 100%; min-width: 0; }
.dong-phieu .so { text-align: right; }
.dong-phieu .thanh-tien { display: flex; flex-direction: column; font-size: 12px; color: var(--chu-nhe); min-width: 0; }
.dong-phieu .thanh-tien .tt { color: var(--chu); font-weight: 600; font-size: 14px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nhan-nho { font-size: 12px; }
.tong-phieu {
  margin-top: 14px; margin-left: auto; max-width: 360px; background: var(--the);
  border: 1px solid var(--vien); border-radius: 10px; padding: 10px 14px;
}
.tong-phieu div { display: flex; justify-content: space-between; padding: 3px 0; }
.tong-phieu .lon { font-size: 16px; border-top: 1px solid var(--vien); margin-top: 4px; padding-top: 6px; }
.nhac-no textarea { width: 100%; margin: 8px 0 0; }

/* Trên điện thoại: mỗi dòng hàng thành một khối, nút to hơn */
@media (max-width: 760px) {
  .dong-phieu { grid-template-columns: 1fr 1fr; }
  .dong-phieu .o-hang { grid-column: 1 / -1; }
  .dong-phieu .xoa-dong { grid-column: 1 / -1; justify-self: start; }
  .dong-phieu .thanh-tien { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
  .dong-phieu .thanh-tien .tt { text-align: right; }
  .luoi-o { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .nut { min-height: 44px; display: inline-flex; align-items: center; }
  .luoi-so { grid-template-columns: 1fr 1fr; }
  .tong-phieu { max-width: none; }
}

/* Đăng nhập */
.dang-nhap-khung { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dang-nhap-the { width: 360px; max-width: 100%; }
.dang-nhap-the form { display: flex; flex-direction: column; gap: 10px; }
.dang-nhap-the input { width: 100%; }

@media (max-width: 760px) {
  .khung { flex-direction: column; }
  .menu { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--vien); }
  .menu nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .menu nav a { padding: 5px 8px; font-size: 13px; }
  .menu .nhom { width: 100%; }
  .noi-dung { padding: 14px; }
  input[type="text"], input[type="date"], input[type="password"], select { min-width: 0; width: 100%; }
  form.luoi label { width: 100%; }
}

/* Ô gõ để tìm (khách, NCC, nhân viên, hàng hóa) */
.o-tim-wrap { display: block; position: relative; min-width: 0; }
.o-tim-wrap .o-tim { width: 100%; min-width: 200px; }
.dong-phieu .o-tim-wrap .o-tim, .dong-but-toan .o-tim-wrap .o-tim { min-width: 0; }
.o-tim.chua-chon { border-color: var(--do); background: var(--do-nhat); }
.goi-y { position: fixed; z-index: 1000; background: var(--the); color: var(--chu); border: 1px solid var(--vien);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); overflow-y: auto; max-height: 320px; }
.goi-y-muc { padding: 9px 12px; cursor: pointer; font-size: 14px; line-height: 1.35; border-bottom: 1px solid var(--vien); }
.goi-y-muc:last-child { border-bottom: 0; }
.goi-y-muc small { display: block; color: var(--chu-nhe); font-size: 12px; }
.goi-y-muc:hover, .goi-y-muc.dang-chon { background: var(--xanh-nhat); }
.goi-y-trong { padding: 10px 12px; color: var(--chu-nhe); font-size: 13px; }

/* Chia trang danh sách dài */
.phan-trang { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.so-am { color: var(--do); font-weight: 600; }

/* ===== Bảng màu đậm (chị Hồng yêu cầu 15/10/2026: "đổ thêm màu cho đỡ mờ nhạt") ===== */
:root {
  --nen: #e9eef3;
  --chu: #111827;
  --chu-nhe: #4b5563;
  --vien: #c9d3dd;
  --xanh: #0a8a4a;
  --xanh-dam: #076b39;
  --xanh-nhat: #dcf3e5;
  --menu-nen: #17324d;
  --menu-chu: #d6e2ee;
  --menu-on: #0a8a4a;
  --dau-bang: #cfeedd;
  --dau-bang-chu: #064e2b;
  --dong-chan: #f5f9f7;
  --tong-nen: #fff1c7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --xanh-dam: #22c55e; --menu-nen: #0f1d2b; --menu-chu: #cbd5e1; --menu-on: #16a34a;
    --dau-bang: #183a2a; --dau-bang-chu: #bbf7d0; --dong-chan: #1e242c; --tong-nen: #3a3218;
  }
}
:root[data-theme="dark"] {
  --xanh-dam: #22c55e; --menu-nen: #0f1d2b; --menu-chu: #cbd5e1; --menu-on: #16a34a;
  --dau-bang: #183a2a; --dau-bang-chu: #bbf7d0; --dong-chan: #1e242c; --tong-nen: #3a3218;
}
h1 { color: var(--xanh-dam); font-weight: 700; }
h2 { color: var(--chu); font-weight: 700; border-left: 4px solid var(--xanh); padding-left: 8px; }

/* Thanh trên: nền xanh đậm, chữ trắng */
.thanh-tren { background: linear-gradient(90deg, var(--xanh-dam), var(--xanh)); border-bottom: 0; color: #fff; }
.thanh-tren .logo, .thanh-tren .logo small, .tren-phai .ten-nguoi, .tren-phai a { color: #fff; }
.thanh-tren .logo small { opacity: .85; }
.logo-o { background: #fff; color: var(--xanh-dam); }
.tren-phai .thoat { border: 1px solid rgba(255,255,255,.7); border-radius: 6px; padding: 4px 10px; }

/* Cột phân hệ bên trái: nền sẫm */
.cot-trai { background: var(--menu-nen); border-right: 0; }
.muc-phan-he { color: var(--menu-chu); }
.muc-phan-he:hover { background: rgba(255,255,255,.08); color: #fff; }
.muc-phan-he.on { background: rgba(255,255,255,.12); border-left-color: #4ade80; color: #fff; }
.ky-hieu { background: rgba(255,255,255,.12); color: var(--menu-chu); }
.muc-phan-he.on .ky-hieu { background: var(--menu-on); color: #fff; }
.flyout .fly-tieu { color: var(--xanh-dam); }

/* Dãy tab chức năng */
.thanh-tab { background: #f7fbf9; border-bottom: 2px solid var(--xanh-nhat); }
.thanh-tab .tab { color: #374151; }
.thanh-tab .tab.on { background: var(--the); color: var(--xanh-dam); border-bottom-color: var(--xanh); }

/* Thẻ, bảng */
.the { border-top: 3px solid var(--xanh); box-shadow: 0 1px 3px rgba(15, 40, 30, .08); }
.bang-cuon { box-shadow: 0 1px 3px rgba(15, 40, 30, .08); }
th { background: var(--dau-bang); color: var(--dau-bang-chu); font-size: 12.5px; font-weight: 700; border-bottom: 2px solid var(--xanh); }
tbody tr:nth-child(even) td { background: var(--dong-chan); }
tbody tr:hover td { background: var(--xanh-nhat); }
tr.tong td { background: var(--tong-nen) !important; color: var(--chu); }
td.so { font-weight: 500; }

/* Nút, ô nhập */
.nut { background: var(--xanh); border-color: var(--xanh); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.nut:hover { background: var(--xanh-dam); opacity: 1; }
.nut.phu { background: var(--the); color: var(--xanh-dam); border-color: var(--xanh); box-shadow: none; }
.nut.phu:hover { background: var(--xanh-nhat); }
.nut.excel { background: #1d6f42; border-color: #1d6f42; color: #fff; }
.nut.excel:hover { background: #155332; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--xanh); outline-offset: 0; border-color: var(--xanh); }
.luoi-o label, form.luoi label, .dong-phieu label { color: #374151; font-weight: 600; }

/* Ô số liệu tổng quan: mỗi ô một màu viền */
.luoi-so .the:nth-child(4n+1) { border-top-color: #0a8a4a; }
.luoi-so .the:nth-child(4n+2) { border-top-color: #2563eb; }
.luoi-so .the:nth-child(4n+3) { border-top-color: #d97706; }
.luoi-so .the:nth-child(4n+4) { border-top-color: #dc2626; }
.so-lieu .gia-tri { color: var(--xanh-dam); font-size: 22px; }
.tong-phieu { border: 2px solid var(--xanh); }
.tong-phieu .lon strong { color: var(--xanh-dam); }

/* Thanh xuất / nhập Excel trên mỗi trang */
.thanh-excel { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
@media (max-width: 760px) {
  .cot-trai { background: var(--menu-nen); }
  .muc-phan-he.on { border-bottom-color: #4ade80; }
}
a.the.so-lieu { display: block; color: var(--chu); text-decoration: none; }
a.the.so-lieu:hover { box-shadow: 0 4px 14px rgba(10, 138, 74, .18); transform: translateY(-1px); }
.so-lieu .chu-nhe { font-size: 12px; margin-top: 2px; }
/* Bảng nhiều cột: giữ độ rộng tối thiểu, cuộn ngang thay vì dồn chữ */
.bang-cuon th { white-space: nowrap; }
.bang-cuon td:first-child { white-space: nowrap; }
table.bang-rong { min-width: 1100px; }
table.bang-rong td.ten-dai { min-width: 240px; }
table.bang-rong td.nowrap { white-space: nowrap; }

/* Menu phân hệ kiểu bấm mở (chị Hồng: rê chuột không nhạy) */
.flyout { display: block; visibility: hidden; opacity: 0; transform: translateX(-4px);
  transition: visibility 0s linear .35s, opacity .12s ease .25s, transform .12s ease .25s;
  min-width: 300px; max-height: calc(100vh - 70px); overflow-y: auto; padding: 6px 0 10px;
  border: 1px solid var(--vien); border-left: 4px solid var(--xanh); border-radius: 0 10px 10px 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22); }
.muc-wrap:hover .flyout, .muc-wrap.mo .flyout { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.muc-wrap.mo .muc-phan-he { background: rgba(255,255,255,.16); color: #fff; }
.flyout .fly-tieu { display: flex; justify-content: space-between; align-items: center; font-size: 16px; padding: 8px 14px 6px 18px; }
.flyout .dong-fly { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--chu-nhe); cursor: pointer; padding: 0 4px; }
.flyout .fly-nhom { padding: 12px 18px 4px; font-weight: 700; color: var(--xanh-dam); }
.flyout a { padding: 10px 18px; font-size: 14.5px; border-left: 3px solid transparent; }
.flyout a:hover { background: var(--xanh-nhat); border-left-color: var(--xanh); }
.muc-phan-he { padding: 12px 14px; font-size: 14px; cursor: pointer; }
@media (max-width: 760px) { .flyout { display: none !important; } }
.phan-he.co-mo .muc-wrap:not(.mo):hover .flyout { visibility: hidden; opacity: 0; }
/* Bán khác đơn giá cố định */
tbody tr.dong-lech td, tbody tr.dong-lech:nth-child(even) td { background: #fff3c4; }
.mau-lech { background: #fff3c4; padding: 0 4px; border-radius: 3px; }
input.gia.lech-gia { background: #fff3c4; border-color: #d97706; font-weight: 700; }
.goi-y-gia { font-size: 12px; color: #b45309; }
/* Nhãn nhập / xuất kho trên tiêu đề phiếu */
.nhan-kho { display: inline-block; font-size: 13px; vertical-align: middle; padding: 3px 10px; border-radius: 999px; color: #fff; margin-left: 6px; }
.nhan-kho.xuat { background: #dc2626; }
.nhan-kho.nhap { background: #2563eb; }
.nhan-kho.kiem { background: #d97706; }
.thong-tin-hang { font-size: 12px; color: var(--xanh-dam); font-weight: 600; min-height: 1em; }
.thong-tin-hang .am { color: var(--do); }
/* Trang phân quyền */
.luoi-quyen { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.luoi-quyen .the { margin: 0; }
.dong-quyen { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-top: 1px solid var(--vien); cursor: pointer; }
.dong-quyen input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.o-chon span { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.o-chon input { width: 20px; height: 20px; min-height: 0; }
.nhan-kho.dat { background: #7c3aed; }
@media (max-width: 760px) {
  .luoi-so { gap: 8px; }
  .so-lieu .gia-tri { font-size: 18px; overflow-wrap: anywhere; }
  .luoi-so .the { padding: 12px; min-width: 0; }
}
/* Ô tích: không áp kích thước ô nhập chữ */
input[type="checkbox"], input[type="radio"] { min-height: 0 !important; width: 20px; height: 20px; padding: 0; flex-shrink: 0; accent-color: var(--xanh); }
.o-phan-he h2 label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* Tên hàng không bị bóp quá hẹp trong bảng (cuộn ngang trên điện thoại) */
td.ten-dai { min-width: 200px; }
@media (max-width: 760px) { td.ten-dai { min-width: 180px; } }
/* Nút Xem / In ở đầu mỗi dòng danh sách phiếu */
td.nut-dong { white-space: nowrap; }
td.nut-dong .nut { margin-right: 2px; }
@media (max-width: 760px) { td.nut-dong .nut { min-height: 34px; padding: 4px 10px; } }
.nhan-kho { white-space: nowrap; }
td.nowrap { white-space: nowrap; }
/* Bộ lọc kỳ trên điện thoại: Từ ngày / Đến ngày cạnh nhau cho gọn */
@media (max-width: 760px) {
  form.loc-ky { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  form.loc-ky label { width: auto; }
  form.loc-ky label:first-of-type, form.loc-ky .nut { grid-column: 1 / -1; }
  form.loc-ky input[type="date"] { font-size: 15px; padding: 6px 4px; }
  form.loc-ky .nut { justify-content: center; }
}
