/* Trang Hoa Hồng Nội Bộ: phiếu phân bổ hoa hồng nội bộ (commissions.js) */
@media screen {

  /* danh sách */
  #appView .hh-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
  #appView .hh-month { display:inline-flex; align-items:center; gap:6px; }
  #appView .hh-month strong { min-width:120px; text-align:center; font-size:15px; }
  #appView .hh-bar input[type="search"] { flex:1 1 240px; min-width:0; max-width:380px; min-height:38px; }
  #appView .hh-bar select { min-height:38px; max-width:260px; }
  #appView .hh-new { display:flex; gap:8px; margin-left:auto; flex-wrap:wrap; }
  #appView .hh-views { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  /* nhãn biểu mẫu trong danh sách */
  #appView .hh-tag { display:inline-block; padding:2px 8px; border-radius:999px; font-size:11.5px; font-weight:700; white-space:nowrap; background:#f4eadb; color:var(--bronze-deep); }
  #appView .hh-tag-product { background:#e4f0ea; color:#1f5e43; }
  #appView .hh-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
  #appView .hh-stat { display:flex; flex-direction:column; gap:4px; padding:14px 16px; border:1px solid #e3d6c4; border-radius:12px; background:#fff; }
  #appView .hh-stat span { color:#3f3a33; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
  #appView .hh-stat b { font-size:20px; color:#0a0a0a; font-variant-numeric:tabular-nums; }
  #appView .hh-stat small { font-size:13px; color:#5b524a; }
  #appView .hh-list th, #appView .hh-list td { text-align:center; vertical-align:middle; }
  #appView .hh-list .l { text-align:left; } #appView .hh-list .r { text-align:right; font-variant-numeric:tabular-nums; }
  #appView .hh-list tbody tr[data-open] { cursor:pointer; }
  #appView .hh-list tbody tr[data-open]:hover td { background:#fbf6ef; }
  #appView .hh-list tbody tr[data-open]:focus-visible { outline:2px solid var(--bronze); outline-offset:-2px; }
  #appView .hh-list .hub-sub { display:block; }
  #appView .hh-go { color:#8a8078; font-size:18px; width:28px; }
  #appView .hh-people tr.is-fund td { background:#faf7f1; }
  #appView .hh-people tr.is-empty strong { color:#a2560b; }
  #appView .hh-people tfoot td { font-weight:800; background:#f3ebd9; }

  /* phiếu */
  #appView .hh-paper { padding:22px; }
  #appView .hh-fs { margin:0; padding:0; border:0; min-width:0; }
  #appView .hh-head { text-align:center; margin-bottom:18px; }
  #appView .hh-head h2 { margin:0; font-size:19px; font-weight:800; letter-spacing:.02em; text-transform:uppercase; color:var(--bronze-deep); }
  #appView .hh-head-sub { margin:4px 0 0; color:#5b524a; font-size:13px; }
  /* nhắc phiếu YTTS còn theo bảng hoa hồng cũ (danh sách tháng + màn phiếu) */
  #appView .hh-recalc { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin:0 0 14px; padding:10px 14px; border:1px solid #ecd9b8; border-radius:10px; background:#fdf6ea; color:#6b4a1c; font-size:13px; font-weight:600; }
  #appView .hh-recalc.is-on { background:#eef6ee; border-color:#c9e2c9; color:#285c2b; }
  #appView .hh-lbl .hh-sub { display:block; margin-top:2px; color:#8a8078; font-size:11px; font-weight:600; text-transform:none; letter-spacing:0; }
  #appView .hh-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px 14px; margin-bottom:12px; }
  #appView .hh-f { display:flex; flex-direction:column; gap:5px; min-width:0; }
  #appView .hh-f.w2 { grid-column:span 2; }
  /* Dòng 1: 6 ô trên một hàng; Tên khách hàng rộng nhất để không mất chữ */
  #appView .hh-grid.hh-row1 { grid-template-columns:minmax(190px,1.05fr) minmax(120px,.8fr) minmax(220px,1.6fr) minmax(170px,1.1fr) minmax(145px,.95fr) minmax(145px,.95fr); gap:12px 10px; }
  #appView .hh-row1 .hh-f > label { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; letter-spacing:.01em; }
  #appView .hh-row1 select { text-overflow:ellipsis; }
  #appView .hh-plan-row { flex-wrap:nowrap; justify-content:space-between; }
  #appView .hh-cnt { white-space:nowrap; }
  /* Mẫu NMN / Exosomes: Ngày lập, Tên sản phẩm, Số hóa đơn, Tên khách hàng, Nguồn tạo ra khách, Direct Sales */
  #appView .hh-grid.hh-row1.hh-row1-p { grid-template-columns:minmax(165px,.95fr) minmax(130px,.8fr) minmax(140px,.9fr) minmax(220px,1.6fr) minmax(170px,1.1fr) minmax(160px,1fr); }
  @media (max-width:1280px) {
    #appView .hh-grid.hh-row1, #appView .hh-grid.hh-row1.hh-row1-p { grid-template-columns:repeat(3,minmax(0,1fr)); }
    #appView .hh-plan-row { flex-wrap:wrap; justify-content:flex-start; }
  }
  @media (max-width:1100px) { #appView .hh-svcs { grid-template-columns:repeat(2,minmax(0,1fr)); } }
  #appView .hh-f > label, #appView .hh-lbl { color:#3f3a33; font-size:11.5px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
  #appView .hh-req { margin-left:3px; color:var(--crit); }
  /* ô Tên khách hàng: tìm khách trên CRM, chọn thì tự điền Direct Sales + nguồn */
  #appView .hh-ac { position:relative; }
  #appView .hh-ac-pop { position:absolute; z-index:30; top:calc(100% + 4px); left:0; min-width:min(460px,calc(100vw - 48px)); max-width:calc(100vw - 48px); max-height:min(320px,45vh); overflow-y:auto; overscroll-behavior:contain; padding:6px; border:1px solid #e3d6c4; border-radius:12px; background:#fff; box-shadow:0 12px 40px #20202724; }
  #appView .hh-ac-pop[hidden] { display:none; }
  #appView .hh-ac-pop button { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; min-height:40px; padding:7px 10px; border:0; border-radius:8px; background:none; text-align:left; font:inherit; color:#111; cursor:pointer; }
  #appView .hh-ac-pop button:hover, #appView .hh-ac-pop button.is-active { background:#fbf6ef; }
  #appView .hh-ac-pop button b { display:block; font-size:13.5px; }
  #appView .hh-ac-pop button small { display:block; color:#5b524a; font-size:11.5px; }
  #appView .hh-ac-pop button em { flex:0 0 auto; font-style:normal; font-size:11.5px; font-weight:700; color:var(--bronze-deep); text-align:right; max-width:42%; }
  #appView .hh-ac-pop button em small { color:#8a8078; }
  #appView .hh-ac-pop .hh-ac-empty { padding:8px 10px; color:#8a8078; font-size:12.5px; }
  #appView .hh-ac-info { display:block; min-height:14px; margin-top:3px; color:#5b524a; font-size:11.5px; font-weight:600; line-height:1.3; }
  #appView .hh-ac-info.is-warn { color:#a2560b; }
  #appView .hh-ac-info b { color:var(--bronze-deep); }
  #appView .hh-f input, #appView .hh-f select, #appView .hh-f textarea { width:100%; min-height:40px; box-sizing:border-box; }
  #appView .hh-f.is-missing input, #appView .hh-f.is-missing select, #appView .hh-sec.is-missing .hh-svc, #appView .hh-plan.is-missing .hh-plan-row { border-color:var(--crit); box-shadow:0 0 0 3px var(--crit-wash); }
  #appView .hh-f.is-missing > label, #appView .hh-f.is-missing .hh-lbl, #appView .hh-sec.is-missing h3 { color:var(--crit); }
  #appView .hh-plan { margin-bottom:12px; }
  #appView .hh-plan-row { display:flex; flex-wrap:wrap; gap:8px 18px; padding:10px 12px; border:1px solid #e3d6c4; border-radius:10px; background:#fdfaf6; }
  #appView .hh-cnt { display:inline-flex; align-items:center; gap:7px; font-weight:700; font-size:13.5px; }
  #appView .hh-cnt input, #appView .hh-turn input { width:56px; min-height:34px; padding:4px 6px; text-align:center; }
  #appView .hh-cnt em { font-style:normal; color:#5b524a; font-weight:600; }
  #appView .hh-vnd { position:relative; display:flex; align-items:center; }
  #appView .hh-vnd input { padding-right:30px; text-align:right; font-variant-numeric:tabular-nums; font-weight:700; }
  #appView .hh-vnd span { position:absolute; right:11px; color:#5b524a; font-size:13px; pointer-events:none; }
  /* Tổng giá trị phiếu ĐKDV và Giá trị phân bổ lần này: mỗi ô một hàng, nhãn bên trái */
  /* Tổng giá trị phiếu · Tổng tiền dịch vụ lần này · Giá tính phân bổ lần này: 3 cụm trên một dòng, nhãn ở trên ô */
  #appView .hh-money { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px 16px; align-items:end; margin-bottom:12px; }
  #appView .hh-money .hh-f.hh-inline { display:flex; flex-direction:column; align-items:stretch; gap:6px; }
  #appView .hh-money .hh-f.hh-inline > label, #appView .hh-money .hh-f.hh-inline > .hh-lbl { margin:0; }
  #appView .hh-money .hh-vnd input, #appView .hh-money .hh-gross, #appView .hh-money .hh-alloc { min-height:44px; box-sizing:border-box; }
  @media (max-width:700px) { #appView .hh-money { grid-template-columns:1fr; } }
  /* Phiếu YTTS: "Loại liệu trình đăng ký" (trái) + "Tổng giá trị của Phiếu ĐKDV" (phải) một hàng; tổng tiền dịch vụ + giá tính phân bổ là hàng tổng cuối khu Dịch vụ */
  #appView .hh-planline { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px 16px; margin-bottom:12px; }
  #appView .hh-planline > .hh-plan { flex:1 1 auto; min-width:0; margin:0; }
  /* Nhãn "Tổng giá trị của Phiếu ĐKDV" nằm ngay trước ô tiền cùng dòng (Chủ dự án 05/11); màn hẹp cả cụm xuống dòng dưới hàng liệu trình */
  #appView .hh-planline > .hh-money-top { display:block; flex:0 0 auto; margin:0 0 0 auto; }
  #appView .hh-money-top .hh-f.hh-inline { flex-direction:row; align-items:center; gap:10px; }
  #appView .hh-money-top .hh-f.hh-inline > label { white-space:nowrap; }
  #appView .hh-money-top .hh-vnd { width:200px; }
  /* khít để 5 loại liệu trình vẫn một dòng ở màn 1280px */
  #appView .hh-planline .hh-plan-row { gap:10px 14px; }
  #appView .hh-planline .hh-cnt { gap:6px; }
  #appView .hh-planline .hh-cnt input { width:48px; }
  @media (max-width:1400px) { #appView .hh-planline .hh-cnt { font-size:13px; } }
  #appView .hh-money.hh-money-svc { margin:16px 0 0; }
  #appView .hh-money.hh-money-svc > :first-child:not(:only-child) { grid-column:2; }
  #appView .hh-money.hh-money-svc > :only-child { grid-column:3; }
  @media (max-width:900px) {
    #appView .hh-planline { flex-direction:column; align-items:stretch; }
    #appView .hh-planline > .hh-money-top { flex-basis:auto; margin-left:0; }
    #appView .hh-money-top .hh-f.hh-inline { flex-direction:column; align-items:stretch; gap:6px; }
    #appView .hh-money-top .hh-vnd { width:auto; }
    #appView .hh-money.hh-money-svc > * { grid-column:auto !important; }
  }
  #appView .hh-f.hh-inline { display:grid; grid-template-columns:260px minmax(0,380px); align-items:center; gap:12px; }
  #appView .hh-alloc { display:flex; align-items:center; justify-content:flex-end; gap:4px; min-height:40px; padding:6px 12px; border:1px solid #e0c56a; border-radius:8px; background:#fff6c7; color:#b3261e; font-size:17px; font-weight:800; font-variant-numeric:tabular-nums; }
  #appView .hh-alloc small { color:#5b524a; font-size:13px; font-weight:600; }
  #appView .hh-gross { display:flex; align-items:center; justify-content:flex-end; gap:4px; min-height:40px; padding:6px 12px; border:1px solid #e3d6c4; border-radius:8px; background:#faf8f4; color:#111; font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; }
  #appView .hh-gross small { color:#5b524a; font-size:13px; font-weight:600; }
  #appView .hh-prior { margin:-2px 0 12px; padding:9px 12px; border-radius:10px; background:var(--info-wash); color:#173c66; font-size:13px; }
  #appView .hh-prior.is-bad { background:var(--crit-wash); color:var(--crit); }
  #appView .hh-sec { margin-top:18px; }
  #appView .hh-sec h3 { margin:0 0 10px; padding-left:10px; border-left:4px solid var(--bronze); font-size:14px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; color:#1f1f1f; }
  #appView .hh-srcname { color:var(--bronze-deep); text-transform:none; letter-spacing:0; }
  /* 6 dịch vụ: 3 cột × 2 hàng; mỗi ô: tên + lần thứ ở trên, số tiền ở dưới */
  #appView .hh-svcs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px 14px; }
  #appView .hh-svc { display:grid; grid-template-columns:minmax(0,1fr); align-items:center; gap:8px; padding:10px 12px 12px 14px; border:1px solid #e3d6c4; border-radius:10px; background:#fff; }
  #appView .hh-svc-l { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; min-height:34px; font-weight:700; font-size:13.5px; }
  #appView .hh-svc-l > span { white-space:nowrap; line-height:1.2; }
  /* Nhãn "lần thứ" / ô số lần: bỏ lề dưới mặc định của <label> để chữ và ô cùng trục giữa */
  #appView .hh-turn, #appView .hh-cnt { margin:0; line-height:1.2; font-size:13.5px; }
  #appView .hh-turn input, #appView .hh-cnt input { margin:0; }
  #appView .hh-svc-l [data-note] { min-width:0; }
  #appView .hh-turn { display:inline-flex; align-items:center; gap:6px; color:#5b524a; font-weight:600; }
  #appView .hh-tick input { width:18px; height:18px; min-height:0; margin:0; accent-color:#a9783a; }
  #appView .hh-price { display:block; min-height:0; margin-top:-2px; color:#8a6a3c; font-size:11.5px; font-weight:600; }
  #appView .hh-price:empty { display:none; }
  #appView .hh-svc-l [data-note] { flex:1 1 100px; min-height:34px; }
  #appView .hh-svc .hh-vnd input { min-height:38px; }
  #appView .hh-pick { margin:0; }
  #appView table.hh-alloc-t { width:100%; min-width:900px; border-collapse:collapse; table-layout:fixed; }
  #appView .hh-alloc-t .c-stt { width:52px; } #appView .hh-alloc-t .c-rate { width:84px; } #appView .hh-alloc-t .c-amt { width:150px; } #appView .hh-alloc-t .c-acct { width:148px; } #appView .hh-alloc-t .c-name { width:22%; } #appView .hh-alloc-t .c-note { width:16%; }
  #appView .hh-alloc-t td.acct { white-space:nowrap; font-weight:700; color:#5b4a33; font-size:12.5px; }
  #appView .hh-alloc-t th { white-space:normal; padding:9px 8px; border:1px solid #c9b89e; border-bottom:2px solid #8a6a3c; background:#fff; color:#111; font-size:11.5px; font-weight:800; text-transform:uppercase; text-align:center; }
  #appView .hh-alloc-t td { padding:6px 8px; border:1px solid #d9cbb6; vertical-align:middle; background:#fff; font-size:13.5px; }
  #appView .hh-alloc-t td small { display:block; color:#5b524a; font-size:11.5px; }
  #appView .hh-alloc-t td.c { text-align:center; } #appView .hh-alloc-t td.r { text-align:right; font-weight:800; }
  #appView .hh-alloc-t td.m { text-align:right; white-space:nowrap; font-weight:800; color:#b3261e; font-variant-numeric:tabular-nums; }
  #appView .hh-alloc-t td input { width:100%; min-height:34px; box-sizing:border-box; margin:0; font-size:13px; }
  #appView .hh-alloc-t tr.is-fund td { background:#faf7f1; }
  #appView .hh-alloc-t tr.is-none td { color:#9a9088; }   /* đối tượng không được phân bổ ở nguồn khách này */
  #appView .hh-alloc-t tr.is-none strong { font-weight:600; }
  #appView .hh-alloc-t tfoot td { padding:10px 8px; background:#f3ebd9; font-weight:800; }
  #appView .hh-muted { color:#8a8078; font-style:italic; }
  #appView .hh-full { margin-top:12px; }
  #appView .hh-full summary { cursor:pointer; color:var(--bronze-deep); font-weight:700; font-size:13.5px; padding:6px 0; }
  #appView .hh-notef { margin-top:18px; }
  #appView .hh-notef textarea { min-height:60px; resize:vertical; }
  #appView .hh-fs:disabled input, #appView .hh-fs:disabled select, #appView .hh-fs:disabled textarea { background:#faf8f4; color:#111; opacity:1; -webkit-text-fill-color:#111; }
  #appView button.hh-del { color:var(--crit); }
  #appView button.hh-del:hover { background:var(--crit-wash); }
  /* bảng ngân sách đầy đủ trên màn hình */
  #appView table.hh-matrix { width:100%; min-width:1180px; border-collapse:collapse; table-layout:fixed; font-size:12px; }
  #appView table.hh-matrix.hh-matrix-wide { min-width:1560px; }   /* bảng YTTS 12 nguồn khách */
  #appView .hh-matrix td.c { white-space:nowrap; }
  #appView .hh-matrix th, #appView .hh-matrix td { padding:4px 5px; border:1px solid #cdbfa8; vertical-align:middle; white-space:normal; overflow-wrap:anywhere; height:auto; letter-spacing:0; }
  #appView .hh-matrix th { background:#fff; font-size:10.5px; font-weight:800; text-transform:uppercase; text-align:center; line-height:1.3; }
  #appView .hh-matrix th small { display:block; font-weight:600; text-transform:none; }
  #appView .hh-matrix .c-stt { width:40px; } #appView .hh-matrix .c-role { width:210px; } #appView .hh-matrix .c-name { width:130px; } #appView .hh-matrix .c-note { width:120px; }
  #appView .hh-matrix td.c { text-align:center; font-variant-numeric:tabular-nums; }
  #appView .hh-matrix tr.hh-m-rate > td, #appView .hh-matrix tr.hh-m-amt > td { height:22px; box-sizing:border-box; }
  #appView .hh-matrix td small { display:block; color:#5b524a; }
  #appView .hh-matrix .is-sel { background:#fff6c7; }
  #appView .hh-matrix .hh-m-amt td.is-sel { color:#b3261e; font-weight:800; }
  #appView .hh-matrix .hh-m-budget td, #appView .hh-matrix .hh-m-sum td { background:#f3ebd9; font-weight:700; }
  #appView .hh-matrix .hh-m-budget td.is-sel, #appView .hh-matrix .hh-m-sum td.is-sel { background:#f5e49a; }
  #appView .hh-matrix .c-ref { width:120px; }
  #appView .hh-matrix td.hh-m-ref { vertical-align:middle; text-align:center; font-weight:700; font-size:11px; line-height:1.35; background:#fdfaf6; }
  #appView .hh-matrix-p { min-width:1120px; }

  /* bảng chi tiết tháng (mỗi phiếu một dòng, mỗi đối tượng / người một cột) */
  /* Tổng hợp hoa hồng tháng (theo mẫu ảnh 22/10): tiêu đề, thời gian, bộ phận lập, bảng */
  #appView .hh-sum-paper h3 { margin:4px 0 2px; text-align:center; font-size:17px; font-weight:800; text-transform:uppercase; color:#111; }
  #appView .hh-sum-paper .hh-sum-time { margin:0; text-align:center; font-weight:700; font-size:13.5px; }
  #appView .hh-sum-paper .hh-sum-by { margin:10px 0 6px; font-style:italic; font-weight:700; font-size:13px; }
  #appView table.hh-sum { border-collapse:collapse; table-layout:fixed; font-size:12.5px; }
  #appView .hh-sum th, #appView .hh-sum td { padding:8px 7px; border:1px solid #c9c2b6; vertical-align:middle; text-align:center; height:auto; letter-spacing:0; }
  #appView .hh-sum th { background:#fff; color:#111; font-size:12px; font-weight:800; line-height:1.3; text-transform:none; white-space:normal; }
  #appView .hh-sum th.hh-d-name { font-weight:800; }
  #appView .hh-sum td { font-weight:700; }
  #appView .hh-sum td.r { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
  #appView .hh-sum td.nw { white-space:nowrap; }
  #appView .hh-sum td.hh-d-note { font-weight:500; font-size:12px; }
  #appView .hh-sum tfoot td { background:#fbf8f2; font-weight:800; }
  #appView .hh-views button + button { margin-left:6px; }
  #appView .hub-heading .hh-head-new { gap:10px; }
  #appView .hh-alloc-t input.hh-auto { font-weight:700; background:#fdfaf6; }
  /* chức danh cần người: tích "Có" mới có ô tên; chưa có tên = không phân bổ (tỷ lệ gạch, tiền "—") */
  #appView .hh-alloc-t .hh-has { display:inline-flex; align-items:center; gap:7px; color:#8a8078; font-style:italic; cursor:pointer; min-height:34px; }
  #appView .hh-alloc-t .hh-has-on { display:flex; align-items:center; gap:7px; }
  #appView .hh-alloc-t .hh-has input[type=checkbox], #appView .hh-alloc-t .hh-has-on input[type=checkbox] { width:18px; height:18px; min-height:0; flex:none; margin:0; accent-color:#a9783a; cursor:pointer; }
  #appView .hh-alloc-t tr.is-unpaid td { color:#9a9088; }
  #appView .hh-alloc-t tr.is-unpaid td:nth-child(4) { text-decoration:line-through; }
  #appView .hh-alloc-t tr.is-unpaid td.m { color:#9a9088; font-weight:600; }
  #appView table.hh-detail { width:100%; min-width:1100px; border-collapse:collapse; font-size:12.5px; }
  #appView .hh-detail th, #appView .hh-detail td { padding:6px 7px; border:1px solid #d9cbb6; vertical-align:middle; white-space:normal; height:auto; letter-spacing:0; }
  #appView .hh-detail th { background:#fff; color:#111; font-size:10.5px; font-weight:800; text-transform:uppercase; text-align:center; line-height:1.3; border-color:#c9b89e; }
  #appView .hh-detail th.hh-d-name { text-transform:none; font-weight:700; color:var(--bronze-deep); background:#fdfaf6; }
  #appView .hh-detail .c-stt { width:40px; } #appView .hh-detail .c-cust { min-width:150px; } #appView .hh-detail .c-src { min-width:110px; } #appView .hh-detail .c-item { min-width:120px; } #appView .hh-detail .c-sum { min-width:105px; } #appView .hh-detail .c-note { min-width:110px; }
  #appView .hh-detail td.c { text-align:center; } #appView .hh-detail td.r { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
  #appView .hh-detail td.m { text-align:right; font-weight:800; color:#b3261e; font-variant-numeric:tabular-nums; white-space:nowrap; }
  #appView .hh-detail td small { display:block; color:#5b524a; font-size:11px; }
  #appView .hh-detail td.hh-d-note { font-size:11.5px; color:#5b524a; }
  #appView .hh-detail tfoot td { background:#f3ebd9; font-weight:800; }

  @media (max-width:900px) {
    #appView .hh-grid, #appView .hh-grid.hh-row1, #appView .hh-grid.hh-row1.hh-row1-p { grid-template-columns:1fr 1fr; }
    #appView .hh-svcs { grid-template-columns:repeat(2,minmax(0,1fr)); }
    #appView .hh-stats { grid-template-columns:1fr 1fr 1fr; gap:8px; }
    #appView .hh-stat b { font-size:16px; }
  }
  @media (max-width:560px) {
    #appView .hh-paper { padding:14px; }
    #appView .hh-grid, #appView .hh-grid.hh-row1, #appView .hh-grid.hh-row1.hh-row1-p { grid-template-columns:1fr; }
    #appView .hh-f.w2 { grid-column:auto; }
    #appView .hh-svcs { grid-template-columns:1fr; }
    #appView .hh-f.hh-inline { grid-template-columns:1fr; gap:5px; }
    #appView .hh-stats { grid-template-columns:1fr; gap:6px; }
    #appView .hh-stat { flex-direction:row; align-items:center; justify-content:space-between; padding:10px 14px; }
    #appView .hh-new { margin-left:0; width:100%; }
    #appView .hh-new button { flex:1 1 auto; }
  }
}

/* Nút In phiếu ▾ / Xuất PDF ▾: menu chọn Phiếu rút gọn / Phiếu đầy đủ */
#appView .hh-menu { position:relative; display:inline-flex; }
#appView .hh-menu > button span { font-size:10px; margin-left:2px; }
#appView .hh-menu-pop { position:absolute; z-index:40; top:calc(100% + 4px); right:0; min-width:170px; padding:5px; border:1px solid #e3d6c4; border-radius:10px; background:#fff; box-shadow:0 12px 32px #20202724; }
#appView .hh-menu-pop[hidden] { display:none; }
#appView .hh-menu-pop button { display:block; width:100%; min-height:36px; padding:7px 10px; border:0; border-radius:7px; background:none; text-align:left; font:inherit; font-weight:600; color:#111; cursor:pointer; }
#appView .hh-menu-pop button:hover, #appView .hh-menu-pop button:focus-visible { background:#fbf6ef; outline:none; }

/* Xem trước bản in (màn hình): thanh trên cùng dính đầu, trang giấy trắng trên nền xám */
#printRoot .hh-pv-bar { position:sticky; top:0; z-index:2; display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:10px 16px; background:#fff; border-bottom:1px solid #d8cdbd; font-family:'Plus Jakarta Sans',system-ui,sans-serif; font-size:13px; color:#111; }
#printRoot .hh-pv-bar > b { font-size:14px; margin-right:6px; }
#printRoot .hh-pv-bar button { min-height:34px; padding:6px 12px; border:1px solid #cdbfa8; border-radius:8px; background:#fff; font:inherit; font-weight:600; color:#111; cursor:pointer; }
#printRoot .hh-pv-tabs { display:inline-flex; gap:0; }
#printRoot .hh-pv-tabs button { border-radius:0; }
#printRoot .hh-pv-tabs button:first-child { border-radius:8px 0 0 8px; } #printRoot .hh-pv-tabs button:last-child { border-radius:0 8px 8px 0; border-left:0; }
#printRoot .hh-pv-tabs button[aria-pressed="true"] { background:#a9783a; border-color:#a9783a; color:#fff; }
#printRoot .hh-pv-sp { flex:1 1 auto; }
#printRoot .hh-pv-close { border-color:transparent !important; }
@media print { #printRoot .hh-pv-bar { display:none !important; } }

/* Bản in phiếu phân bổ hoa hồng — A4 ngang như file Excel */
@page hhp { size: A4 landscape; margin: 0; }   /* lề nằm trong #printRoot (app.css --pm, 14/11/2026) */
@media print {
  /* đệm 1px hai bên để đường kẻ phải của bảng không bị cắt khi in / chụp PDF */
  /* Gọn để cả phiếu (đầu phiếu + bảng + ghi chú + 9 ô ký) nằm trong 1 trang A4 ngang; commissions.js còn đo và co thêm nếu vẫn dài. */
  #printRoot .hh-print { page:hhp; box-sizing:border-box; padding:0 1px; color:#000; font-family:'Plus Jakarta Sans','Inter',Arial,sans-serif; font-size:8pt; line-height:1.3; }
  #printRoot .hh-print * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  #printRoot .hh-p-head { text-align:center; padding-bottom:3px; margin-bottom:4px; border-bottom:2px double #a9783a; }
  /* Ảnh header: đặt theo chiều cao, bề rộng tự theo tỷ lệ ảnh (html2canvas không hiểu object-fit nên không dùng width:100%). */
  #printRoot .hh-p-head img { display:block; height:10mm; width:auto; max-width:100%; margin:0 auto 1px; }
  #printRoot .hh-p-head h1 { margin:0; font-size:11.5pt; font-weight:800; text-transform:uppercase; color:#1f1f1f; }
  #printRoot .hh-p-sub { display:flex; justify-content:center; gap:28px; margin:1px 0 0; font-size:9pt; }
  #printRoot .hh-p-sub em { font-style:normal; font-weight:700; color:#b3261e; }
  #printRoot .hh-p-sub b { font-weight:700; }
  #printRoot .hh-p-info > div { display:flex; flex-wrap:wrap; gap:2px 18px; padding:1.5px 0; }
  #printRoot .hh-p-i em { font-style:normal; font-weight:700; color:#b3261e; }
  #printRoot .hh-p-i b { font-weight:700; }
  #printRoot .hh-p-alloc { padding:1px 8px; border:1px solid #555; background:#fff59d; }
  #printRoot .hh-p-svc-h { margin-top:3px; font-weight:800; }
  #printRoot table.hh-p-svc { width:100%; border-collapse:collapse; table-layout:fixed; margin:2px 0 5px; }
  #printRoot .hh-p-svc td { padding:1.5px 5px; border:1px solid #555; font-weight:700; }
  #printRoot .hh-p-svc td.m { text-align:right; color:#b3261e; }
  #printRoot table.hh-matrix { width:100%; border-collapse:collapse; table-layout:fixed; font-size:6.5pt; }
  #printRoot .hh-matrix th, #printRoot .hh-matrix td { padding:0.5px 3px; border:1px solid #555; vertical-align:middle; line-height:1.15; white-space:normal; overflow-wrap:anywhere; height:auto; letter-spacing:0; }
  #printRoot .hh-matrix th { background:#fff; font-size:6.2pt; font-weight:800; text-transform:uppercase; text-align:center; }
  #printRoot .hh-matrix th small { display:block; font-weight:600; text-transform:none; }
  #printRoot .hh-matrix .c-stt { width:5mm; } #printRoot .hh-matrix .c-role { width:44mm; } #printRoot .hh-matrix .c-name { width:28mm; } #printRoot .hh-matrix .c-note { width:20mm; }
  #printRoot .hh-matrix td.c { text-align:center; }
  /* mỗi đối tượng luôn đủ 2 ô (tỷ lệ / số tiền) kể cả khi ô số tiền trống */
  #printRoot .hh-matrix tr.hh-m-rate > td, #printRoot .hh-matrix tr.hh-m-amt > td { height:3mm; box-sizing:border-box; }
  #printRoot .hh-matrix td small { display:block; font-size:6pt; }
  #printRoot .hh-matrix .is-sel { background:#fff59d; }
  #printRoot .hh-matrix .hh-m-amt td.is-sel { color:#b3261e; font-weight:800; }
  #printRoot .hh-matrix .hh-m-budget td, #printRoot .hh-matrix .hh-m-sum td { font-weight:700; }
  #printRoot .hh-matrix .c-ref { width:26mm; }
  #printRoot .hh-matrix td.hh-m-ref { text-align:center; font-weight:700; font-size:6.5pt; line-height:1.3; }
  /* bảng chi tiết tháng */
  #printRoot table.hh-detail { width:100%; border-collapse:collapse; font-size:7pt; margin-top:3px; }
  #printRoot .hh-detail th, #printRoot .hh-detail td { padding:1.5px 3px; border:1px solid #555; vertical-align:middle; line-height:1.2; white-space:normal; overflow-wrap:anywhere; height:auto; letter-spacing:0; }
  #printRoot .hh-detail th { font-size:6.4pt; font-weight:800; text-transform:uppercase; text-align:center; }
  #printRoot .hh-detail th.hh-d-name { text-transform:none; font-weight:700; }
  #printRoot .hh-detail td.c { text-align:center; } #printRoot .hh-detail td.r, #printRoot .hh-detail td.m { text-align:right; white-space:nowrap; }
  #printRoot .hh-detail td.m { font-weight:800; color:#b3261e; }
  #printRoot .hh-detail td small { display:block; font-size:6.2pt; color:#444; }
  #printRoot .hh-detail tfoot td { font-weight:800; }
  #printRoot .hh-detail tr { break-inside:avoid; }
  #printRoot .hh-print-detail .hh-p-sub { gap:18px; flex-wrap:wrap; }
  #printRoot .hh-p-sigs.n7 { grid-template-columns:repeat(7,minmax(0,1fr)); margin-top:10mm; }
  /* Bản in / PDF tổng hợp hoa hồng tháng — không dùng tabular-nums (html2canvas vẽ lệch độ rộng → tràn ô) */
  #printRoot .hh-print-sum .hh-p-head h1 { font-size:12.5pt; }
  #printRoot .hh-print-sum .hh-sum-time { margin:1px 0 0; font-weight:700; font-size:9pt; }
  #printRoot .hh-print-sum .hh-sum-by { margin:3px 0 3px; font-style:italic; font-weight:700; font-size:8.5pt; }
  #printRoot table.hh-sum { border-collapse:collapse; table-layout:fixed; font-size:7pt; }
  #printRoot .hh-sum td.t { font-size:var(--sum-text, 7pt); }
  #printRoot .hh-sum th, #printRoot .hh-sum td { padding:2px 3px; border:1px solid #555; vertical-align:middle; text-align:center; line-height:1.25; white-space:normal; overflow-wrap:normal; word-break:normal; height:auto; letter-spacing:0; }
  #printRoot .hh-sum th { font-size:var(--sum-head, 6.6pt); font-weight:800; text-transform:none; }
  #printRoot .hh-sum td { font-weight:700; height:7mm; }
  #printRoot .hh-sum td.r { text-align:right; white-space:nowrap; }
  #printRoot .hh-sum td.nw { white-space:nowrap; }
  #printRoot .hh-sum td.hh-d-note { font-weight:500; }
  #printRoot .hh-sum tr { break-inside:avoid; }
  #printRoot .hh-p-sigs.n6 { grid-template-columns:repeat(6,minmax(0,1fr)); margin-top:6mm; }
  /* Bộ in "Tổng hợp + toàn bộ phiếu": mỗi khối bắt đầu trang mới */
  #printRoot .hh-print + .hh-print { break-before:page; page-break-before:always; }
  #printRoot .hh-print-sum .hh-p-sig .t { font-style:italic; text-transform:none; font-size:8pt; }
  #printRoot .hh-matrix tr { break-inside:avoid; }
  #printRoot .hh-p-note { margin:4px 0 0; }
  #printRoot .hh-p-end { break-inside:avoid; page-break-inside:avoid; }
  #printRoot .hh-p-notes { margin-top:2px; font-size:6.2pt; line-height:1.22; }
  /* 5 ghi chú xếp 2 cột cho thấp lại */
  #printRoot .hh-p-notes ol { margin:1px 0 0; padding-left:14px; columns:2; column-gap:7mm; }
  #printRoot .hh-p-notes li { break-inside:avoid; padding-right:2mm; }
  #printRoot .hh-p-sigs { display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:4px; margin-top:4px; text-align:center; break-inside:avoid; }
  #printRoot .hh-p-sig .t { font-weight:800; font-size:7pt; text-transform:uppercase; }
  #printRoot .hh-p-sig .s { min-height:8mm; }
  #printRoot .hh-p-sig .n { font-weight:700; font-size:8pt; color:#8a5f2a; }
  #printRoot .hh-p-foot { margin-top:2px; text-align:right; font-size:6pt; color:#666; }

  /* ===== Bảng in dễ đọc (22/10/2026, theo Chủ dự án): nét kẻ mảnh, ô có khoảng đệm để chữ có dấu / số không dính nét kẻ,
     chữ đen thuần — chỉ giữ màu ở các ô vốn có màu (số tiền đỏ, ô vàng cột đang chọn, nhãn đỏ, tên người ký). ===== */
  #printRoot .hh-print, #printRoot .hh-p-head h1, #printRoot .hh-p-foot,
  #printRoot .hh-matrix th, #printRoot .hh-matrix td, #printRoot .hh-matrix td small, #printRoot .hh-matrix th small,
  #printRoot .hh-p-svc td, #printRoot .hh-sum th, #printRoot .hh-sum td, #printRoot .hh-detail td small, #printRoot .hh-p-notes { color:#000; }
  #printRoot .hh-matrix th, #printRoot .hh-matrix td, #printRoot .hh-p-svc td, #printRoot .hh-sum th, #printRoot .hh-sum td, #printRoot .hh-detail th, #printRoot .hh-detail td {
    border:0.3px solid #000; }
  #printRoot .hh-matrix th, #printRoot .hh-matrix td { padding:1px 4px; line-height:1.28; }
  #printRoot .hh-matrix td { font-weight:600; }
  #printRoot .hh-matrix tr.hh-m-rate > td, #printRoot .hh-matrix tr.hh-m-amt > td { height:3.3mm; }
  #printRoot .hh-p-svc td { padding:2px 5px; line-height:1.3; }
  #printRoot .hh-sum th, #printRoot .hh-sum td { padding:2.5px 4px; line-height:1.3; }
  #printRoot .hh-p-alloc { border:0.3px solid #000; }
  #printRoot .hh-matrix .hh-m-amt td.is-sel, #printRoot .hh-p-svc td.m, #printRoot .hh-detail td.m { color:#b3261e; }
}

/* Bản in rút gọn — A4 dọc, trắng đen (Chủ dự án in trắng đen): thông tin phiếu, bảng phân bổ theo tỷ lệ nguồn khách, chân ký (lề khớp pdf-export PAGES.portrait) */
@page hhmini { size: A4 portrait; margin: 0; }   /* lề nằm trong #printRoot (app.css --pm, 14/11/2026) */
@media print {
  #printRoot .hh-mini { page:hhmini; display:flex; flex-direction:column; min-height:270mm; box-sizing:border-box; padding:0 1px; color:#000; font-family:'Plus Jakarta Sans','Inter',Arial,sans-serif; font-size:9.5pt; line-height:1.4; }
  #printRoot .hh-mini * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  #printRoot .hh-mi-head { text-align:center; padding-bottom:5px; margin-bottom:8px; border-bottom:2px double #000; }
  #printRoot .hh-mi-head img { display:block; width:100%; height:auto; margin:0 0 4px; filter:grayscale(1); }
  #printRoot .hh-mi-head h1 { margin:0; font-size:14pt; font-weight:800; text-transform:uppercase; color:#000; }
  #printRoot .hh-mi-head p { margin:2px 0 0; font-size:9.5pt; font-weight:600; }
  #printRoot .hh-mi-info { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px 16px; }
  #printRoot .hh-mi-kv { min-width:0; }
  #printRoot .hh-mi-kv span { display:block; font-size:7.5pt; font-weight:700; color:#000; text-transform:uppercase; letter-spacing:.02em; }
  #printRoot .hh-mi-kv b { display:block; font-weight:700; overflow-wrap:anywhere; }
  #printRoot .hh-mi-alloc { display:flex; justify-content:space-between; align-items:baseline; margin:6px 0 6px; padding:4px 10px; border:0.3px solid #000; }
  #printRoot .hh-mi-alloc span { font-weight:700; }
  #printRoot .hh-mi-alloc b { font-size:12pt; font-weight:800; color:#000; }
  #printRoot table.hh-mi-t { width:100%; border-collapse:collapse; table-layout:fixed; font-size:9pt; }
  #printRoot .hh-mi-t th, #printRoot .hh-mi-t td { padding:2px 6px; border:0.3px solid #000; vertical-align:middle; line-height:1.3; color:#000; overflow-wrap:anywhere; }
  #printRoot .hh-mi-t th { background:none; font-size:8pt; font-weight:800; text-transform:uppercase; text-align:center; }
  #printRoot .hh-mi-t td.c { text-align:center; } #printRoot .hh-mi-t td.r { text-align:right; }
  #printRoot .hh-mi-t td.n { font-weight:700; }
  #printRoot .hh-mi-t td.m { text-align:right; white-space:nowrap; font-weight:800; color:#000; font-size:var(--amt-pt, 9pt); padding-left:3px; padding-right:4px; }
  #printRoot .hh-mi-t td.acct { white-space:nowrap; font-weight:700; font-size:8pt; padding-left:4px; padding-right:4px; }
  #printRoot .hh-mi-t tfoot td.c { white-space:nowrap; }
  #printRoot .hh-mi-t tfoot td { font-weight:800; background:none; }
  #printRoot .hh-mi-t tr { break-inside:avoid; }
  #printRoot .hh-mi-note { margin:4px 0 0; font-size:8.5pt; }
  /* ghi chú của bảng chính sách (P.notes): chữ nhỏ, sát dưới bảng */
  #printRoot .hh-mi-notes { margin-top:4px; font-size:6.5pt; line-height:1.3; }
  #printRoot .hh-mi-notes ol { margin:1px 0 0; padding-left:12px; }
  #printRoot .hh-mi-notes li { break-inside:avoid; }
  #printRoot .hh-mi-sigs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px 12px; margin-top:4mm; text-align:center; break-inside:avoid; page-break-inside:avoid; }
  #printRoot .hh-mi-sig .t { font-weight:800; font-size:8.5pt; text-transform:uppercase; }
  #printRoot .hh-mi-sig .s { min-height:11.5mm; }
    #printRoot .hh-mi-foot { margin-top:auto; padding-top:4px; text-align:right; font-size:7pt; color:#333; }   /* chân trang: đáy trang A4, bên phải */
}

/* ===== Giao diện mới (11/2026, máy tính ≥ 901px): Hoa Hồng Nội Bộ, phiếu phân bổ, và dùng chung cho Đại lý & CTV ===== */
@media screen and (min-width: 901px) {
  /* đầu màn một dòng: tiêu đề · số đếm · nút */
  #appView #workWorkspace .hub-heading.hh-head1 { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
  #appView #workWorkspace .hub-heading.hh-head1 > div:first-child { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; }
  #appView #workWorkspace .hub-heading.hh-head1 > .hub-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-left:auto; }
  #appView .hh-count { display:inline-grid; place-items:center; min-width:26px; height:24px; padding:0 8px; box-sizing:border-box; border-radius:12px; background:#F1ECE4; color:#6F655A; font-size:12px; font-weight:700; }
  #appView .hub-heading.hh-head1 .hub-actions > button, #appView .hub-heading.hh-head1 .hh-menu > button { display:inline-flex; align-items:center; gap:8px; height:40px; min-height:40px; padding:0 16px; border:1px solid #E4DACA; border-radius:10px; background:#fff; color:#25211C; font-size:14px; font-weight:600; }
  #appView .hub-heading.hh-head1 .hub-actions > button.primary { border-color:#9A6A2E; background:#9A6A2E; color:#fff; font-weight:700; }
  #appView .hub-heading.hh-head1 .hub-actions > button.primary:hover { background:#7E5523; border-color:#7E5523; }
  /* màn phiếu: ← Danh sách, tiêu đề, dòng phụ xếp dọc */
  #appView #workWorkspace .hub-heading.hh-detail { align-items:flex-end; }
  #appView #workWorkspace .hub-heading.hh-detail > div:first-child { flex-direction:column; align-items:flex-start; flex-wrap:nowrap; gap:6px; }
  #appView .hh-back { display:inline-flex; align-items:center; gap:6px; height:auto; min-height:0; padding:0; border:0; background:none; color:#8A5F27; font-size:14px; font-weight:600; box-shadow:none; }
  #appView .hh-back:hover { background:none; color:#6E4A1C; }
  #appView .hh-head-sub { display:flex; align-items:center; gap:8px; color:#6F655A; font-size:13px; }
  #appView .hh-moreWrap { display:inline-flex; }
  #appView .hh-orig { display:none !important; }
  #appView .hh-menu-pop { border-color:#EFE9DD; border-radius:12px; box-shadow:0 8px 24px #392e221f; }

  /* tab (gạch dưới) */
  #appView .hh-tabs { margin-bottom:16px; }
  #appView .hh-tabs .tab { height:44px; padding:0 2px; margin-right:26px; font-size:14px; }

  /* hàng công cụ */
  #appView .hh-bar { gap:10px; margin-bottom:14px; }
  #appView .hh-month { gap:0; height:40px; border:1px solid #E4DACA; border-radius:10px; overflow:hidden; background:#fff; }
  #appView .hh-month button.sm { width:36px; min-width:36px; height:40px; min-height:40px; padding:0; border:0; border-radius:0; background:#fff; color:#25211C; font-size:16px; }
  #appView .hh-month strong { min-width:0; padding:0 10px; font-size:14px; font-weight:700; white-space:nowrap; }
  #appView .hh-search { display:flex; align-items:center; gap:8px; flex:1 1 280px; max-width:420px; height:40px; margin:0; padding:0 14px; box-sizing:border-box; border:1px solid #E4DACA; border-radius:20px; background:#fff; color:#6F655A; }
  #appView .hh-search input[type="search"] { flex:1 1 auto; min-width:0; height:36px; min-height:0; max-width:none; padding:0; border:0; border-radius:0; outline:0; background:transparent; box-shadow:none; color:#25211C; font-size:14px; }
  #appView .hh-bar select { appearance:none; -webkit-appearance:none; height:36px; min-height:36px; max-width:240px; padding:0 30px 0 14px; border:1px solid #E4DACA; border-radius:18px; background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236F655A' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color:#25211C; font-size:13px; font-weight:600; }
  #appView .hh-bar > .hh-new { margin-left:auto; }

  /* thanh nhắc phiếu tính theo bảng cũ */
  #appView .hh-recalc { gap:14px; margin:0 0 14px; padding:10px 16px; border:1px solid #F1D9B5; border-radius:12px; background:#FFF8EE; color:#8A4B0C; font-size:14px; font-weight:600; }
  #appView .hh-recalc b { font-weight:700; }
  #appView .hh-recalc button { height:34px; min-height:34px; padding:0 14px; border-radius:10px; font-size:13px; }
  #appView .hh-recalc.is-on { border-color:#C9E2CC; background:#E6F2E8; color:#1F5E2E; }

  /* dải tóm tắt: số cùng màu chữ chính */
  #appView .hub-stats.hh-stats { display:flex; margin-bottom:14px; }
  #appView .hub-stats.hh-stats .hub-stat strong, #appView .hub-stats.hh-stats .hub-stat:nth-child(n) strong { color:#25211C; }
  #appView .hh-viewbar { display:flex; justify-content:flex-end; gap:10px; margin:0 0 12px; }
  #appView .hh-viewbar button { height:36px; min-height:36px; padding:0 14px; border-radius:10px; font-size:13px; font-weight:600; }

  /* bảng trong một khung viền */
  #appView .hh-box { overflow:hidden; border:1px solid #E4DACA; border-radius:16px; background:#fff; }
  #appView .hh-box > .tbl-wrap { border:0; border-radius:0; }
  #appView .hh-box .hh-sum-paper { padding:16px; }
  #appView .hh-box table.hub-table { width:100%; border-collapse:collapse; font-size:14px; }
  #appView .hh-box .hub-table th { padding:12px 12px; background:#FAF7F2; color:#6F655A; font-size:13px; font-weight:600; text-align:left; border-bottom:1px solid #EFE9DD; }
  #appView .hh-box .hub-table td { padding:12px 12px; border:0; border-top:1px solid #EFE9DD; text-align:left; vertical-align:middle; }
  #appView .hh-box .hub-table tbody tr:first-child td { border-top:0; }
  #appView .hh-box .hub-table th:first-child, #appView .hh-box .hub-table td:first-child { padding-left:16px; }
  #appView .hh-box .hub-table th:last-child, #appView .hh-box .hub-table td:last-child { padding-right:16px; }
  #appView .hh-box .hub-table th.r, #appView .hh-box .hub-table td.r { text-align:right; }
  #appView .hh-box .hub-table td.nw { white-space:nowrap; }
  #appView .hh-box .hub-table td.r { white-space:nowrap; font-variant-numeric:tabular-nums; }
  #appView .hh-box .hub-table td .hub-sub { display:block; color:#6F655A; font-size:12px; font-weight:400; }
  #appView .hh-box .hub-table td strong { font-weight:700; }
  #appView .hh-box .hub-table tbody tr:hover td { background:#FAF1E1; }
  #appView .hh-box .hub-table tfoot td { background:#FAF7F2; border-top:1px solid #E4DACA; font-weight:700; }
  #appView .hh-box .hub-table td.hh-act, #appView .hh-box .hub-table th.hh-act-h { width:76px; text-align:right; white-space:nowrap; }
  #appView .hh-box .hub-table td.hh-act button { height:32px; min-height:32px; padding:0 12px; border-radius:10px; font-size:13px; font-weight:600; }
  #appView .hh-tag { height:24px; display:inline-flex; align-items:center; padding:0 10px; border-radius:12px; font-size:12px; font-weight:600; }
  #appView .hh-tag, #appView .hh-tag-ytts { background:#F4EADB; color:#6E4A1C; }
  #appView .hh-tag-product { background:#E6F2E8; color:#1F5E2E; }
  #appView .hh-people tr.is-fund td { background:#FAF7F2; }
  #appView .hh-people tr.is-empty strong { color:#8A4B0C; }

  /* ---- phiếu phân bổ ---- */
  #appView #hhForm.hh-paper { display:flex; flex-direction:column; gap:16px; padding:0; border:0; background:none; }
  #appView #hhForm.hh-paper .hh-fs { display:flex; flex-direction:column; gap:16px; }
  #appView #hhForm.hh-paper .hh-head { display:none; }
  #appView .hh-blk { margin:0; padding:20px 24px; border:1px solid #E4DACA; border-radius:16px; background:#fff; }
  #appView .hh-blk > h2 { margin:0 0 16px; font-size:16px; font-weight:700; color:#25211C; }
  #appView .hh-blk .hh-srcname { color:#8A5F27; font-size:14px; font-weight:600; }
  #appView #hhForm .hh-sec { margin-top:0; }
  #appView .hh-f > label, #appView .hh-lbl { color:#6F655A; font-size:13px; font-weight:600; text-transform:none; letter-spacing:0; }
  #appView .hh-f input, #appView .hh-f select, #appView .hh-f textarea, #appView #hhForm .hh-alloc-t input { border:1px solid #E4DACA; border-radius:10px; font-size:14px; }
  #appView .hh-f input, #appView .hh-f select { height:40px; }
  /* "Thông tin phiếu": 6 ô một hàng, không xuống dòng (Chủ dự án 05/11) — YTTS: Ngày · Số phiếu ĐKDV · Tên khách · Nguồn · Tele · Direct;
     sản phẩm: Ngày · Sản phẩm · Số chứng từ · Tên khách · Nguồn · Direct. Nhãn dài tự cắt "…" (luật .hh-row1 label ở trên). */
  #appView .hh-grid.hh-row1 { grid-template-columns:minmax(0,1.12fr) minmax(0,1.05fr) minmax(0,1.3fr) minmax(0,1.1fr) minmax(0,.9fr) minmax(0,.9fr); gap:12px; margin-bottom:16px; }
  #appView .hh-grid.hh-row1.hh-row1-p { grid-template-columns:minmax(0,.95fr) minmax(0,1.1fr) minmax(0,1fr) minmax(0,1.4fr) minmax(0,1.1fr) minmax(0,1fr); }
  @media (max-width:1180px) { #appView .hh-row1 .hh-f :is(input, select) { padding-left:10px; padding-right:10px; font-size:13px; } }
  #appView .hh-plan { margin-bottom:16px; }
  #appView .hh-plan-row { flex-wrap:wrap; justify-content:flex-start; gap:10px 24px; padding:0; border:0; background:none; }
  #appView .hh-cnt { gap:8px; font-weight:500; font-size:14px; }
  #appView .hh-cnt input, #appView .hh-turn input { width:56px; height:36px; min-height:36px; border-radius:10px; }
  #appView .hh-turn.hh-tick input { width:18px; height:18px; min-height:0; padding:0; border-radius:4px; }   /* ô "có dùng" là ô tích nhỏ, không phải ô số */
  #appView .hh-cnt em { color:#6F655A; font-size:13px; font-weight:400; }
  #appView .hh-money { grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px 20px; margin-bottom:0; }
  #appView .hh-money .hh-vnd input, #appView .hh-money .hh-gross, #appView .hh-money .hh-alloc { min-height:40px; height:40px; border-radius:10px; }
  #appView .hh-alloc { border:1px solid #F1D9B5; background:#FFF8EE; color:#8A5F27; font-size:22px; font-weight:800; }
  #appView .hh-alloc small { color:#8A5F27; }
  #appView .hh-gross { border:1px solid #E4DACA; background:#FAF7F2; font-size:14px; }
  #appView .hh-svcs { gap:16px; }
  #appView .hh-svc { gap:10px; padding:14px 16px; border:1px solid #EFE9DD; border-radius:12px; background:#FAF7F2; }
  #appView .hh-svc-l { font-size:14px; font-weight:700; }
  #appView .hh-turn { color:#6F655A; font-size:13px; font-weight:400; }
  #appView .hh-svc .hh-vnd input { height:40px; min-height:40px; background:#fff; }
  #appView .hh-price { color:#8A5F27; font-size:12px; }
  /* 6 dịch vụ một hàng (Chủ dự án 05/11); hàng tổng tiền bên dưới giữ nguyên. Thẻ khít hơn, dòng tên + "lần thứ" tự xuống dòng khi hẹp. */
  @media (min-width:1101px) {
    /* 3 hàng chung cho 6 thẻ (subgrid, 15/11/2026): tên + lần thứ · ô tiền · dòng "Theo phiếu ĐKDV". Ô tiền mọi thẻ thẳng một hàng
       ngay dưới tên, thẻ chưa dùng không còn tụt ô tiền xuống đáy (trước đây align-content:space-between). */
    #appView .hh-svcs { grid-template-columns:repeat(6,minmax(0,1fr)); grid-template-rows:auto auto auto; gap:0 12px; }
    #appView .hh-svc { grid-row:span 3; grid-template-rows:subgrid; row-gap:8px; align-content:start; padding:12px; }
    #appView .hh-svc > .hh-svc-l { align-self:start; }
    #appView .hh-svc-l { flex-wrap:wrap; gap:6px 8px; }
    #appView .hh-svc .hh-turn:not(.hh-tick) input { width:48px; }
    #appView .hh-svc-l [data-note] { flex:1 1 100%; }
  }
  #appView .hh-prior { border-radius:12px; font-size:13px; }
  /* bảng phân bổ */
  #appView .hh-sec .tbl-wrap { border:1px solid #EFE9DD; border-radius:12px; }
  #appView table.hh-alloc-t { min-width:1000px; }
  #appView .hh-alloc-t th { padding:10px 12px; border:0; border-bottom:1px solid #EFE9DD; background:#FAF7F2; color:#6F655A; font-size:13px; font-weight:600; text-transform:none; text-align:left; }
  #appView .hh-alloc-t td { padding:8px 12px; border:0; border-top:1px solid #EFE9DD; background:#fff; font-size:14px; }
  #appView .hh-alloc-t tbody tr:first-child td { border-top:0; }
  #appView .hh-alloc-t td.c { text-align:left; } #appView .hh-alloc-t th:nth-child(4), #appView .hh-alloc-t th:nth-child(5) { text-align:right; }
  #appView .hh-alloc-t td:nth-child(4) { text-align:right; }
  #appView .hh-alloc-t td.m { color:#9B2F23; }
  #appView .hh-alloc-t td.acct { color:#6F655A; font-weight:400; font-size:13px; }
  #appView .hh-alloc-t td small { color:#6F655A; font-size:12px; }
  #appView .hh-alloc-t td input { height:34px; min-height:34px; }
  #appView .hh-alloc-t tr.is-fund td { background:#fff; }
  #appView .hh-alloc-t tfoot td { padding:12px; background:#FAF7F2; border-top:1px solid #E4DACA; font-weight:700; }
  #appView .hh-alloc-t tfoot td.m { color:#9B2F23; }
  #appView .hh-alloc-t tfoot td.c { text-align:right; }
  #appView .hh-full { margin-top:14px; }
  #appView .hh-full summary { color:#8A5F27; font-size:14px; font-weight:600; }
  #appView .hh-notef { margin-top:16px; }
  #appView .hh-notef textarea { min-height:72px; padding:12px; }
  /* nhật ký */
  #appView .srp-history { padding:20px 24px; }
  #appView .srp-history > h2 { margin:0 0 12px; font-size:16px; font-weight:700; }
}
@media screen and (min-width: 901px) {
  #appView .hh-tabs { display:flex; align-items:flex-end; gap:0; margin-bottom:16px; border-bottom:1px solid #EFE9DD; }
  #appView .hh-tabs .tab { display:inline-flex; align-items:center; gap:8px; background:none; border:0; border-radius:0; color:#6F655A; font-weight:600; box-shadow:none; border-bottom:2px solid transparent !important; }
  #appView .hh-tabs .tab[aria-selected="true"] { color:#25211C; border-bottom-color:#9A6A2E !important; }
  #appView .hh-tabs .tab:hover { background:none; color:#25211C; }
}
/* màn hẹp: giữ bố cục dùng được (thanh tìm, khung bảng cuộn ngang) */
@media screen and (max-width: 900px) {
  #appView .hh-search { display:flex; align-items:center; gap:8px; flex:1 1 100%; height:40px; margin:0; padding:0 12px; box-sizing:border-box; border:1px solid #E4DACA; border-radius:20px; background:#fff; color:#6F655A; }
  #appView .hh-search input[type="search"] { flex:1 1 auto; min-width:0; height:36px; min-height:0; border:0; outline:0; background:transparent; box-shadow:none; }
  #appView .hh-box { max-width:100%; overflow-x:auto; border:1px solid #E4DACA; border-radius:16px; }
  #appView .hh-count { display:inline-grid; place-items:center; min-width:26px; height:24px; padding:0 8px; border-radius:12px; background:#F1ECE4; color:#6F655A; font-size:12px; font-weight:700; }
  #appView .hh-tabs { display:flex; gap:18px; overflow-x:auto; margin-bottom:12px; border-bottom:1px solid #EFE9DD; }
  #appView .hh-tabs .tab { white-space:nowrap; border-bottom:2px solid transparent !important; }
  #appView .hh-tabs .tab[aria-selected="true"] { border-bottom-color:#9A6A2E !important; }
  #appView .hh-orig { display:none !important; }
  #appView .hh-back { display:inline-flex; align-items:center; gap:6px; padding:0; border:0; background:none; color:#8A5F27; font-weight:600; }
  #appView .hh-blk { margin:0 0 12px; padding:14px; border:1px solid #E4DACA; border-radius:16px; background:#fff; }
}
@media screen { #appView .hh-box { position:relative; } }

/* ==========================================================================
   Điện thoại (≤ 900px): Hoa hồng nội bộ, Hoa hồng Đại lý & CTV, Đại lý & CTV (lớp hh-* dùng chung với partners.js).
   Đầu màn: tiêu đề · số · 1 nút đặc + ⋯; ô tìm cả hàng, tháng gọn + chip lọc cuộn ngang; dải tóm tắt lưới 2 cột; mỗi dòng một thẻ.
   Máy tính không đổi: .hh-chips = display:contents, nút .hh-m-only chỉ hiện ở điện thoại. Bản in không đổi.
   ========================================================================== */
.hh-chips { display:contents; }
@media screen and (min-width: 901px) { #appView .hh-m-only { display:none !important; } }
@media screen and (max-width: 900px) {
  /* Đầu màn danh sách */
  #appView #workWorkspace .hub-heading.hh-head1:not(.hh-detail) { flex-wrap:nowrap; align-items:center; gap:8px; }
  #appView #workWorkspace .hub-heading.hh-head1:not(.hh-detail) > div:first-child { flex:1 1 auto; min-width:0; flex-wrap:wrap; gap:4px 8px; }
  #appView .hub-heading.hh-head1 > .hub-actions.hh-head-new { flex:0 0 auto; flex-wrap:nowrap; gap:8px; margin-left:auto; }
  #appView .hub-heading.hh-head1 .hub-actions > button { display:inline-flex; align-items:center; gap:6px; height:40px; min-height:40px; padding:0 14px; border-radius:10px; font-size:14px; white-space:nowrap; }
  #appView .hub-heading.hh-head1 .hub-actions > button.primary { border-color:#9A6A2E; background:#9A6A2E; color:#fff; font-weight:700; }
  #appView .hh-head-new:has(> #hhNewM) > [data-new], #appView .hh-head-new:has(> [data-pt-more]) > button:not(.primary):not(.ui-more):not(#pcSumCancel) { display:none; }
  #appView .hub-heading .hh-count { flex:0 0 auto; }
  #appView .hh-m-hide { display:none; }

  /* Màn phiếu: ← · tiêu đề · Lưu phiếu · ⋯ (Xem trước, In phiếu, Xuất PDF, Chuyển chính sách, Xóa); dòng phụ ở dưới */
  #appView #workWorkspace .hub-heading.hh-detail { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:start; gap:4px 8px; }
  #appView #workWorkspace .hub-heading.hh-detail > div:first-child { display:contents; }
  #appView .hub-heading.hh-detail .hh-back { grid-column:1; grid-row:1; justify-content:center; width:40px; height:40px; margin-left:-8px; border-radius:10px; color:#25211C; font-size:0; gap:0; }
  #appView .hub-heading.hh-detail .hh-back svg { width:22px; height:22px; }
  #appView .hub-heading.hh-detail h1 { grid-column:2; grid-row:1; align-self:center; margin:0; font-size:17px; line-height:1.3; }
  #appView .hub-heading.hh-detail .hh-head-sub { grid-column:2 / -1; grid-row:2; flex-wrap:wrap; }
  #appView .hub-heading.hh-detail > .hub-actions { grid-column:3; grid-row:1; flex-wrap:nowrap; gap:8px; margin:0; }
  #appView .hub-heading.hh-detail > .hub-actions > #hhPreview, #appView .hub-heading.hh-detail > .hub-actions > .hh-menu { display:none; }

  /* Hàng công cụ: ô tìm cả hàng · ‹ Tháng › + chip lọc cuộn ngang */
  #appView .hh-bar { gap:8px; margin:0 0 12px; }
  #appView .hh-bar > .hh-search { order:-1; flex:1 1 100%; height:44px; }
  #appView .hh-bar > .hh-search input[type="search"] { max-width:none; height:42px; font-size:16px; }
  #appView .hh-bar > .hh-month { flex:0 0 auto; height:36px; gap:0; border:1px solid #E4DACA; border-radius:10px; overflow:hidden; background:#fff; }
  #appView .hh-bar > .hh-month button.sm { width:32px; min-width:32px; height:34px; min-height:34px; padding:0; border:0; border-radius:0; background:#fff; color:#25211C; font-size:16px; }
  #appView .hh-bar > .hh-month strong { min-width:0; padding:0 4px; font-size:13px; font-weight:700; white-space:nowrap; }
  #appView .hh-bar > .hh-chips { display:flex; flex:1 1 0; min-width:0; gap:8px; overflow-x:auto; scrollbar-width:none; }
  #appView .hh-bar > .hh-chips::-webkit-scrollbar { display:none; }
  #appView .hh-bar .hh-chips select { flex:0 0 auto; appearance:none; -webkit-appearance:none; width:auto; max-width:none; height:36px; min-height:36px; padding:0 30px 0 14px; border:1px solid #E4DACA; border-radius:18px; background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236F655A' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color:#25211C; font-size:16px; font-weight:600; }
  #appView .hh-recalc { padding:10px 12px; }
  #appView .hh-recalc button { min-height:40px; }

  /* Dải tóm tắt: lưới 2 cột (nhãn trên, số dưới); số lẻ thì ô cuối cả hàng */
  #appView .hub-stats.hh-stats { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; margin-bottom:12px; padding:4px; }
  #appView .hub-stats.hh-stats .hub-stat { flex-direction:column; align-items:flex-start; gap:2px; min-width:0; padding:8px 12px; border-left:0; }
  #appView .hub-stats.hh-stats .hub-stat:nth-child(even) { border-left:1px solid #EFE9DD; }
  #appView .hub-stats.hh-stats .hub-stat:nth-child(n+3) { border-top:1px solid #EFE9DD; }
  #appView .hub-stats.hh-stats .hub-stat:last-child:nth-child(odd) { grid-column:1 / -1; }
  #appView .hub-stats.hh-stats .hub-stat span { font-size:12px; }
  #appView .hub-stats.hh-stats .hub-stat strong { font-size:15px; white-space:nowrap; }

  /* Bảng danh sách → thẻ (khung .hh-box bỏ viền, mỗi dòng một thẻ) */
  #appView .hh-box:has(> .tbl-wrap > :is(table.hh-slips, table.hh-people, table.pc-list, table.pt-list)) { overflow:visible; border:0; border-radius:0; background:none; }
  #appView .hh-box > .tbl-wrap:has(> :is(table.hh-slips, table.hh-people, table.pc-list, table.pt-list)) { overflow:visible; border:0; }
  #appView table.hub-table:is(.hh-slips, .hh-people, .pc-list, .pt-list) { display:block; width:100%; min-width:0; }
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > thead { display:none; }
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody { display:flex; flex-direction:column; gap:10px; }
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; padding:14px; border:1px solid #E4DACA; border-radius:16px; background:#fff; }
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr > td, #appView .hh-list:is(.hh-slips, .hh-people, .pc-list, .pt-list) tbody tr[data-open]:hover td { display:block; min-width:0; width:auto; padding:0; border:0; background:none; text-align:left; font-size:13px; white-space:normal; }
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr[data-open]:hover { background:#FAF7F2; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td strong { font-size:15px; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td .hub-sub { color:#6F655A; font-size:12px; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td.hh-act { align-self:end; text-align:right; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td.hh-act button { height:36px; min-height:36px; padding:0 16px; border-radius:10px; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td.r { text-align:left; }
  #appView :is(.hh-slips, .pc-list, .pt-list) td[class]::before { display:block; color:#6F655A; font-size:12px; font-weight:500; }
  /* Hoa hồng nội bộ: số phiếu · ngày / khách / nguồn · biểu mẫu / giá trị phân bổ · hoa hồng / Direct Sales · Mở */
  #appView .hh-slips > tbody > tr { grid-template-areas:"no date" "cust cust" "src form" "alloc total" "dir act"; }
  #appView .hh-slips > tbody > tr > td:first-child { grid-area:date; color:#6F655A; font-size:12px; text-align:right; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(8) { grid-area:form; justify-self:end; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(7) { grid-area:no; overflow-wrap:anywhere; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(6) { grid-area:cust; font-size:14px; font-weight:600; color:#25211C; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(5) { grid-area:src; color:#6F655A; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(4) { grid-area:dir; align-self:center; margin-right:-12px; padding:10px 12px 0 0; border-top:1px solid #EFE9DD; color:#6F655A; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(4) .hub-sub { display:inline; margin-left:4px; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(3) { grid-area:alloc; margin-top:6px; font-weight:600; color:#25211C; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(3)::before { content:"Giá trị phân bổ"; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(2) { grid-area:total; margin-top:6px; text-align:right; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(2)::before { content:"Hoa hồng"; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(2) b { font-size:16px; font-weight:800; }
  #appView .hh-slips > tbody > tr > td:nth-last-child(2) .hub-sub { display:inline; margin-left:4px; }
  #appView .hh-slips > tbody > tr > td.hh-act { grid-area:act; padding-top:10px; border-top:1px solid #EFE9DD; }
  /* Tổng Hợp Hoa Hồng: tiêu đề gọn, chỉ bảng cuộn ngang trong khung */
  body.sales-shell #appView .hh-viewbar { justify-content:flex-start; gap:8px; }
  body.sales-shell #appView .hh-viewbar button { height:40px; min-height:40px; border-color:var(--m-line); border-radius:12px; }
  body.sales-shell #appView .hh-box:has(> .hh-sum-paper) { overflow:visible; border-color:var(--m-line); border-radius:14px; }
  body.sales-shell #appView .hh-box .hh-sum-paper { padding:14px 12px; }
  body.sales-shell #appView .hh-sum-paper h3 { margin:0 0 4px; font-size:15px; line-height:1.35; text-align:left; text-transform:none; }
  body.sales-shell #appView .hh-sum-paper .hh-sum-time { font-size:13px; text-align:left; }
  body.sales-shell #appView .hh-sum-paper .hh-sum-by { margin:4px 0 10px; color:var(--m-sub); font-size:12px; font-weight:600; }
  body.sales-shell #appView .hh-sum-paper > .tbl-wrap { overflow-x:auto; border:1px solid var(--m-line-soft); border-radius:12px; }
  body.sales-shell #appView table.hh-sum { font-size:13px; }
  /* Tổng hợp theo người */
  #appView .hh-people > tbody > tr > td:nth-child(1) { grid-column:1; font-size:14px; }
  #appView .hh-people > tbody > tr > td:nth-child(4) { grid-column:2; grid-row:1; text-align:right; font-size:15px; }
  #appView .hh-people > tbody > tr > td:nth-child(2) { grid-column:1; color:#6F655A; }
  #appView .hh-people > tbody > tr > td:nth-child(3) { grid-column:2; grid-row:2; color:#6F655A; text-align:right; }
  #appView .hh-people > tbody > tr > td:nth-child(3)::after { content:" phiếu"; }
  #appView .hh-people > tbody > tr.is-fund { background:#FAF7F2; }
  #appView table.hh-people > tfoot { display:block; margin-top:10px; }
  #appView table.hh-people > tfoot > tr { display:flex; justify-content:space-between; gap:12px; padding:12px 14px; border-radius:12px; background:#FAF7F2; }
  #appView table.hh-people > tfoot td { display:block; padding:0; border:0; background:none; font-weight:800; }
  /* Màn phiếu phân bổ: ô nhập 16px (chống zoom iOS), khối 1 cột */
  #appView .hh-paper .hh-f input:not([type="checkbox"]), #appView .hh-paper .hh-f select, #appView .hh-paper textarea { font-size:16px; }
  #appView .hh-f > label, #appView .hh-lbl { color:#6F655A; font-size:13px; font-weight:600; text-transform:none; letter-spacing:0; }
  #appView .hh-paper .hh-f input:not([type="checkbox"]), #appView .hh-paper .hh-f select { min-height:44px; }
}

/* ===== MOBILE 11/2026 (≤ 760px) — docs/MOBILE-UI-SPEC.md ===== */
/* Hoa hồng nội bộ + lớp hh-* dùng chung với partners.js (Hoa hồng Đại lý & CTV, Đại lý & CTV). */
#appView .hh-m-bar { display:none; }
@media screen and (max-width: 760px) {
  /* Tab trong trang: dải cuộn ngang 44px, chữ 14/600, gạch chân đồng, không thanh cuộn, dính dưới thanh đầu */
  body.sales-shell #appView .hh-tabs { position:sticky; top:52px; z-index:15; display:flex; gap:22px; margin:0 0 12px; padding:0; overflow-x:auto; overflow-y:hidden; border-bottom:1px solid var(--m-line-soft); background:#fff; box-shadow:-12px 0 0 #fff, 12px 0 0 #fff; scrollbar-width:none; }
  body.sales-shell #appView .hh-tabs::-webkit-scrollbar { display:none; }
  body.sales-shell #appView .hh-tabs .tab { flex:0 0 auto; height:44px; min-height:44px; margin:0; padding:0; border:0; border-bottom:2px solid transparent !important; border-radius:0; background:none; box-shadow:none; color:var(--m-sub); font-size:14px; font-weight:600; white-space:nowrap; }
  body.sales-shell #appView .hh-tabs .tab[aria-selected="true"] { color:var(--m-ink); border-bottom-color:var(--m-accent) !important; }

  /* Đầu màn danh sách: tiêu đề tối đa 2 dòng, số đếm ngay sau tiêu đề */
  body.sales-shell #appView #workWorkspace .hub-heading.hh-head1:not(.hh-detail) > div:first-child { flex-wrap:nowrap; align-items:center; }
  body.sales-shell #appView #workWorkspace .hub-heading.hh-head1:not(.hh-detail) h1 { min-width:0; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
  body.sales-shell #appView .hub-heading.hh-head1 .hub-actions > button { border-radius:12px; }
  /* Hàng công cụ: ô tìm 46px bo 12 · chip 36px bo 18 */
  body.sales-shell #appView .hh-bar > .hh-search { height:46px; border-color:var(--m-line); border-radius:12px; }
  body.sales-shell #appView .hh-bar > .hh-search input[type="search"] { height:44px; min-height:0; border:0 !important; box-shadow:none !important; text-overflow:ellipsis; }
  body.sales-shell #appView .hh-bar > .hh-month { border-color:var(--m-line); border-radius:18px; }
  body.sales-shell #appView .hh-bar .hh-chips select { height:36px; min-height:36px; border-color:var(--m-line); border-radius:18px; font-size:14px; }
  body.sales-shell #appView .hh-recalc { border-radius:14px; }
  body.sales-shell #appView .hh-recalc button { border-radius:12px; }

  /* KPI: lưới 2 cột, ô nền nhạt bo 12, không viền; ô lẻ cuối kéo hết hàng */
  body.sales-shell #appView .hub-stats.hh-stats { gap:8px; padding:0; border:0; background:none; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat { padding:12px; border:0 !important; border-radius:12px; background:var(--m-wash); }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat strong { font-size:18px; font-weight:800; }

  /* Thẻ danh sách (phiếu nội bộ / phiếu đại lý / đại lý): viền đồng nhạt, bo 14, không đổi nền khi chạm */
  body.sales-shell #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr { border-color:var(--m-line); border-radius:14px; background:#fff; }
  body.sales-shell #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr[data-open]:hover,
  body.sales-shell #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr:is(.is-fund, .is-old, .is-legacy, :hover) { background:#fff; }
  body.sales-shell #appView .hh-list:is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr > td,
  body.sales-shell #appView .hh-list:is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr:hover > td { background:none !important; box-shadow:none !important; }

  /* Phiếu nội bộ: số phiếu · ngày / khách · biểu mẫu / nguồn / giá trị phân bổ | hoa hồng / Direct Sales (cả hàng; cả thẻ bấm được → bỏ nút Mở) */
  body.sales-shell #appView .hh-slips > tbody > tr { grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-areas:"no date" "cust form" "src src" "alloc total" "dir dir"; gap:4px 12px; }
  body.sales-shell #appView .hh-slips > tbody > tr:not(:has(> td:nth-child(9))) { grid-template-areas:"no date" "cust cust" "src src" "alloc total" "dir dir"; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:first-child { align-self:center; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:first-child:nth-last-child(8) { grid-area:date; justify-self:stretch; text-align:right; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(8) { align-self:center; justify-self:end; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(7) strong { font-size:15px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(7) .hub-sub { display:inline; margin-left:6px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(6) { align-self:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(5) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(3) { align-self:end; margin-top:8px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(2) { align-self:end; margin-top:8px; justify-self:stretch; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(4) { align-self:stretch; margin:10px 0 0; padding:10px 0 0; border-top:1px solid var(--m-line-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td.hh-act { display:none; }

  /* Tổng hợp theo người */
  body.sales-shell #appView .hh-people > tbody > tr { gap:4px 12px; }
  body.sales-shell #appView .hh-people > tbody > tr > td:nth-child(4) { font-weight:800; }
  body.sales-shell #appView table.hh-people > tfoot > tr { background:var(--m-wash); }

  /* ---------- Form lập phiếu: khối phẳng (tiêu đề + khoảng trắng), một lớp thẻ bên trong ---------- */
  body.sales-shell #appView #hhForm.hh-paper { padding:0; border:0; border-radius:0; background:none; box-shadow:none; }
  body.sales-shell #appView #hhForm.hh-paper > .hh-fs { display:flex; flex-direction:column; gap:0; }
  body.sales-shell #appView #hhForm.hh-paper .hh-head { display:none; }
  body.sales-shell #appView #hhForm .hh-blk { margin:0; padding:20px 0; border:0; border-top:1px solid var(--m-line-soft); border-radius:0; background:none; box-shadow:none; }
  body.sales-shell #appView #hhForm .hh-blk:first-of-type { padding-top:4px; border-top:0; }
  body.sales-shell #appView #hhForm .hh-blk > h2 { margin:0 0 12px; font-size:15px; font-weight:700; line-height:1.3; }
  body.sales-shell #appView #hhForm .hh-grid { gap:12px; }
  body.sales-shell #appView #hhForm .hh-f :is(input:not([type="checkbox"]), select) { height:46px; min-height:46px; border-color:var(--m-line); border-radius:12px; }
  body.sales-shell #appView #hhForm .hh-f > label, body.sales-shell #appView #hhForm .hh-lbl { margin-bottom:6px; color:var(--m-sub); font-size:13px; font-weight:600; }
  body.sales-shell #appView #hhForm .hh-vnd input { padding-right:32px; }
  body.sales-shell #appView #hhForm .hh-vnd span { right:12px; color:var(--m-sub); font-size:14px; }
  /* Loại liệu trình: lưới thẳng cột [tên | ô số có "lần" trong ô] */
  body.sales-shell #appView #hhForm .hh-planline { gap:16px; margin:16px 0 0; }
  body.sales-shell #appView #hhForm .hh-plan { margin:0; }
  body.sales-shell #appView #hhForm .hh-plan > .hh-lbl { display:block; }
  body.sales-shell #appView #hhForm .hh-plan-row { display:flex; flex-direction:column; flex-wrap:nowrap; gap:0; padding:0 14px; border:1px solid var(--m-line); border-radius:14px; background:#fff; }
  body.sales-shell #appView #hhForm .hh-plan.is-missing .hh-plan-row { border-color:var(--m-bad); box-shadow:0 0 0 3px var(--m-bad-wash); }
  body.sales-shell #appView #hhForm .hh-cnt { position:relative; display:grid; grid-template-columns:minmax(0,1fr) 96px; align-items:center; gap:12px; min-height:58px; border-top:1px solid var(--m-line-soft); color:var(--m-ink); font-size:15px; font-weight:600; white-space:normal; }
  body.sales-shell #appView #hhForm .hh-cnt:first-child { border-top:0; }
  body.sales-shell #appView #hhForm .hh-cnt > input { grid-column:2; grid-row:1; width:100%; height:44px; min-height:44px; padding:0 40px 0 12px; text-align:right; font-weight:700; font-variant-numeric:tabular-nums; }
  body.sales-shell #appView #hhForm .hh-cnt > em { grid-column:2; grid-row:1; justify-self:end; margin-right:12px; color:var(--m-sub); font-size:14px; font-style:normal; font-weight:500; pointer-events:none; }
  body.sales-shell #appView #hhForm .hh-money-top .hh-f.hh-inline { display:flex; flex-direction:column; align-items:stretch; gap:0; }
  /* Dịch vụ lần này: mỗi dịch vụ một thẻ — tên | "lần thứ" + ô số (cùng cột 96px) · ô tiền cả hàng */
  body.sales-shell #appView #hhForm .hh-svcs { display:flex; flex-direction:column; gap:10px; }
  body.sales-shell #appView #hhForm .hh-svc { display:grid; grid-template-columns:minmax(0,1fr); gap:10px; padding:12px; border:1px solid var(--m-line); border-radius:14px; background:#fff; }
  body.sales-shell #appView #hhForm .hh-sec.is-missing .hh-svc { border-color:var(--m-bad); }
  body.sales-shell #appView #hhForm .hh-svc-l { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px 12px; min-height:44px; }
  body.sales-shell #appView #hhForm .hh-svc-l > span { font-size:15px; font-weight:700; white-space:normal; }
  body.sales-shell #appView #hhForm .hh-turn { display:grid; grid-template-columns:auto 96px; align-items:center; gap:8px; color:var(--m-sub); font-size:13px; font-weight:500; white-space:nowrap; }
  body.sales-shell #appView #hhForm .hh-turn:not(.hh-tick) > input { width:100%; height:44px; min-height:44px; padding:0 12px; text-align:right; font-weight:700; }
  body.sales-shell #appView #hhForm .hh-turn.hh-tick { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-height:44px; padding:0 4px; color:var(--m-ink); font-size:14px; }
  body.sales-shell #appView #hhForm .hh-turn.hh-tick input { width:22px; height:22px; }
  body.sales-shell #appView #hhForm .hh-svc-l > [data-note] { grid-column:1 / -1; height:46px; min-height:46px; }
  body.sales-shell #appView #hhForm .hh-svc .hh-vnd input { height:46px; min-height:46px; background:#fff; font-size:16px; }
  body.sales-shell #appView #hhForm .hh-price { margin-top:-4px; font-size:12px; }
  /* Tổng tiền dịch vụ / Giá tính phân bổ: ô chỉ đọc nền nhạt, số căn phải (bỏ nền vàng) */
  body.sales-shell #appView #hhForm .hh-money { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; margin:16px 0 0; }
  body.sales-shell #appView #hhForm .hh-money .hh-f.hh-inline { display:flex; flex-direction:column; align-items:stretch; gap:0; }
  body.sales-shell #appView #hhForm .hh-money > * { grid-column:auto !important; }
  body.sales-shell #appView #hhForm :is(.hh-alloc, .hh-gross) { height:auto; min-height:48px; padding:8px 14px; border:0; border-radius:12px; background:var(--m-wash); color:var(--m-ink); font-size:16px; font-weight:700; }
  body.sales-shell #appView #hhForm .hh-alloc { color:var(--m-accent-deep); font-size:20px; font-weight:800; }
  body.sales-shell #appView #hhForm :is(.hh-alloc, .hh-gross) small { color:var(--m-sub); font-size:13px; }
  body.sales-shell #appView #hhForm .hh-lbl small, body.sales-shell #appView #hhForm .hh-lbl .hh-vat { font-size:12px; font-weight:500; }
  /* Bảng phân bổ → thẻ: đối tượng | số tiền · sổ TK | tỷ lệ · tên · ghi chú */
  body.sales-shell #appView #hhAllocTable .tbl-wrap { overflow:visible; border:0; border-radius:0; }
  body.sales-shell #appView table.hh-alloc-t { display:block; width:100%; min-width:0; table-layout:auto; }
  body.sales-shell #appView .hh-alloc-t colgroup, body.sales-shell #appView .hh-alloc-t thead { display:none; }
  body.sales-shell #appView .hh-alloc-t tbody { display:flex; flex-direction:column; gap:8px; }
  body.sales-shell #appView .hh-alloc-t tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; padding:12px; border:1px solid var(--m-line); border-radius:14px; background:#fff; }
  body.sales-shell #appView .hh-alloc-t tbody td { display:block; min-width:0; padding:0; border:0 !important; background:none !important; font-size:13px; text-align:left; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(1) { display:none; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(2) { grid-column:1; grid-row:1; font-size:14px; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(2) strong { font-weight:700; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(5) { grid-column:2; grid-row:1; font-size:16px; text-align:right; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(6) { grid-column:1; grid-row:2; color:var(--m-sub); font-weight:500; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(4) { grid-column:2; grid-row:2; color:var(--m-sub); text-align:right; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(3) { grid-column:1 / -1; grid-row:3; margin-top:6px; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(7) { grid-column:1 / -1; grid-row:4; }
  body.sales-shell #appView .hh-alloc-t tbody td:is(:nth-child(3), :nth-child(7)):empty { display:none; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(7):has(input)::before { content:"Ghi chú"; display:block; margin:2px 0 4px; color:var(--m-sub); font-size:12px; font-weight:600; }
  body.sales-shell #appView .hh-alloc-t td :is(input, select) { width:100%; height:46px; min-height:46px; font-size:16px; }
  body.sales-shell #appView .hh-alloc-t tbody tr.is-none { padding:10px 12px; border-style:dashed; }
  body.sales-shell #appView .hh-alloc-t tbody tr.is-none td:nth-child(6) { grid-column:2; grid-row:1; text-align:right; }
  body.sales-shell #appView .hh-alloc-t tbody tr.is-none td:nth-child(2) { color:var(--m-faint); }
  body.sales-shell #appView .hh-alloc-t tfoot { display:block; margin-top:8px; }
  body.sales-shell #appView .hh-alloc-t tfoot tr { display:flex; align-items:baseline; gap:10px; padding:12px 14px; border-radius:12px; background:var(--m-wash); }
  body.sales-shell #appView .hh-alloc-t tfoot td { display:block; padding:0; border:0 !important; background:none !important; font-size:14px; }
  body.sales-shell #appView .hh-alloc-t tfoot td:first-child { flex:1 1 auto; text-align:left; }
  body.sales-shell #appView .hh-alloc-t tfoot td.c { color:var(--m-sub); font-weight:600; }
  body.sales-shell #appView .hh-alloc-t tfoot td.m { font-size:17px; font-weight:800; }
  body.sales-shell #appView .hh-alloc-t tfoot td:empty { display:none; }
  body.sales-shell #appView #hhForm .hh-full { margin-top:12px; }
  body.sales-shell #appView #hhForm .hh-full > summary { min-height:44px; display:flex; align-items:center; }
  body.sales-shell #appView #hhForm .hh-notef { margin-top:8px; }
  body.sales-shell #appView #hhForm .hh-notef textarea { min-height:88px; border-color:var(--m-line); }
  /* Dải đáy Lưu phiếu (mobile.js gom thành dải dính đáy); nút Lưu trên đầu màn ẩn để khỏi trùng */
  body.sales-shell #appView .hh-m-bar { display:flex; margin-top:16px; }
  body.sales-shell #appView .hh-m-bar > button { flex:1 1 auto; justify-content:center; height:46px; min-height:46px; border:1px solid var(--m-accent); border-radius:12px; background:var(--m-accent); color:#fff; font-size:15px; font-weight:700; }
  body.sales-shell #appView .hh-m-bar > button:disabled { opacity:.55; }
  body.sales-shell #appView .hub-heading.hh-detail:has(~ * .hh-m-bar, ~ .hh-m-bar) > .hub-actions > #hhSave,
  body.sales-shell #appView #workWorkspace:has(.hh-m-bar) .hub-heading.hh-detail > .hub-actions > #hhSave { display:none; }
  body.sales-shell #appView #workWorkspace .hub-heading.hh-detail h1 { font-size:18px; font-weight:800; }
  body.sales-shell #appView .hub-heading.hh-detail .hh-back { border-radius:20px; }
}

/* ===== MOBILE 11/2026 — ĐỢT 2: mật độ & căn chữ (docs/MOBILE-UI-SPEC.md, mục "Đợt 2") ===== */
@media screen and (max-width: 760px) {
  /* Dải số chung (hoa hồng nội bộ, đại lý, bảng đối chiếu): một hộp nền nhạt, 3 cột, kẻ ngăn; 5 ô → hàng 2 hai ô */
  body.sales-shell #appView .hub-stats.hh-stats { display:grid; grid-template-columns:auto minmax(0,1fr) minmax(0,1fr); gap:0; margin:0 0 12px; padding:0; border:0; border-radius:12px; background:var(--m-wash); overflow:hidden; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat { display:flex; flex-direction:column; align-items:flex-start; gap:2px; min-width:0; padding:8px 12px; border:0 !important; border-radius:0; background:none; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat:last-child:nth-child(odd) { grid-column:auto; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(3n+2), body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(3n+3), body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(3n+2):last-child, body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(3n+3):last-child { border-left:1px solid #EADFCF !important; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(n+4), body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(n+4):last-child { border-top:1px solid #EADFCF !important; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat:nth-child(4):nth-last-child(2) { grid-column:1 / 3; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat span { color:var(--m-sub); font-size:12px; font-weight:600; line-height:1.35; white-space:nowrap; }
  body.sales-shell #appView .hub-stats.hh-stats .hub-stat strong { font-size:17px; font-weight:800; line-height:1.25; letter-spacing:-.3px; white-space:normal; }
  /* 3 ô có số tiền dài (hoa hồng nội bộ): đệm ngang 10 cho số 9 chữ số vừa một dòng */
  body.sales-shell #appView #hhListBody > .hub-stats.hh-stats .hub-stat { padding:8px 10px; }
  /* Khối "n phiếu … bảng cũ · Tính lại": chữ trái, nút phải, một hàng */
  body.sales-shell #appView .hh-recalc { display:flex; flex-wrap:nowrap; align-items:center; gap:8px; margin:0 0 12px; padding:8px 12px; }
  body.sales-shell #appView .hh-recalc > span { flex:1 1 0; min-width:0; font-size:13px; line-height:1.35; }
  body.sales-shell #appView .hh-recalc button { flex:0 0 auto; height:32px; min-height:32px; padding:0 10px; font-size:12px; white-space:nowrap; }
  body.sales-shell #appView .hh-bar { margin-bottom:12px; }

  /* Thẻ phiếu nội bộ (≤ 110px): số phiếu | ngày · khách | biểu mẫu · nguồn · Direct | hoa hồng · phân bổ | % */
  body.sales-shell #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody { gap:8px; }
  body.sales-shell #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) > tbody > tr { padding:12px; }
  body.sales-shell #appView .hh-slips > tbody > tr, body.sales-shell #appView .hh-slips > tbody > tr:not(:has(> td:nth-child(9))) { grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; grid-template-areas:"no no date" "cust cust form" "src dir total" "alloc alloc total"; gap:4px 8px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td, body.sales-shell #appView .hh-list.hh-slips > tbody > tr:hover > td { margin:0 !important; padding:0 !important; border:0 !important; font-size:13px; line-height:1.35; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:first-child { align-self:center; text-align:right; font-size:12px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(7) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(7) strong { font-size:15px; font-weight:700; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(7) .hub-sub { font-size:12px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(6) { color:var(--m-ink); font-size:14px; font-weight:600; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(5) { color:var(--m-sub); }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(4) { align-self:auto; color:var(--m-sub); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(4)::before { content:"· "; display:inline; font-size:13px; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(4) .hub-sub { display:none; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(3) { align-self:auto; color:var(--m-sub); font-weight:500; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(3)::before { content:"Phân bổ "; display:inline; color:var(--m-sub); font-size:13px; font-weight:400; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(2) { align-self:center; text-align:right; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(2)::before { content:none; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(2) b { font-size:15px; line-height:1.25; }
  body.sales-shell #appView .hh-slips > tbody > tr > td:nth-last-child(2) .hub-sub { display:block; margin:0; font-size:12px; }
  body.sales-shell #appView .hh-slips .hh-tag { font-size:12px; white-space:nowrap; }
  /* Tổng hợp theo người */
  body.sales-shell #appView .hh-people > tbody > tr { gap:2px 12px; }
  body.sales-shell #appView .hh-people > tbody > tr > td { font-size:13px; line-height:1.35; }
  body.sales-shell #appView .hh-people > tbody > tr > td:nth-child(1), body.sales-shell #appView .hh-people > tbody > tr > td:nth-child(4) { font-size:14px; }

  /* Đầu màn phiếu: tiêu đề 18/800 một dòng */
  body.sales-shell #appView #workWorkspace .hub-heading.hh-detail h1 { font-size:18px; line-height:1.25; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.sales-shell #appView #workWorkspace .hub-heading:not(.hh-detail) h1 { font-size:20px; line-height:1.25; }
  /* Form phiếu: tiêu đề nhóm trên 16 dưới 8, nhãn 12/600, khoảng giữa ô 10 */
  body.sales-shell #appView #hhForm .hh-blk { padding:16px 0; }
  body.sales-shell #appView #hhForm .hh-blk:first-of-type { padding-top:0; }
  body.sales-shell #appView #hhForm .hh-blk > h2 { margin:0 0 8px; }
  body.sales-shell #appView #hhForm .hh-grid { gap:10px; }
  body.sales-shell #appView #hhForm .hh-f > label, body.sales-shell #appView #hhForm .hh-lbl { margin-bottom:2px; font-size:12px; line-height:1.35; }
  body.sales-shell #appView #hhForm .hh-ac-info:empty { display:none; }
  body.sales-shell #appView #hhForm .hh-planline { gap:10px; margin-top:10px; }
  body.sales-shell #appView #hhForm .hh-cnt { min-height:52px; font-size:14px; }
  body.sales-shell #appView #hhForm .hh-svcs { gap:8px; }
  body.sales-shell #appView #hhForm .hh-svc { gap:8px; }
  body.sales-shell #appView #hhForm .hh-svc-l > span { font-size:15px; }
  body.sales-shell #appView #hhForm .hh-money { gap:10px; margin-top:12px; }
  body.sales-shell #appView #hhForm :is(.hh-alloc, .hh-gross) { min-height:44px; padding:6px 12px; font-size:15px; }
  body.sales-shell #appView #hhForm .hh-alloc { font-size:17px; }
  body.sales-shell #appView .hh-alloc-t tbody tr { gap:2px 12px; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(5) { font-size:15px; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(3) { margin-top:4px; }
  body.sales-shell #appView .hh-alloc-t tbody td:nth-child(7):has(input)::before { margin:2px 0 2px; }
  body.sales-shell #appView .hh-alloc-t tfoot td.m { font-size:15px; }
  /* Tổng Hợp Hoa Hồng */
  body.sales-shell #appView .hh-box .hh-sum-paper { padding:12px; }
}

/* Thanh tỷ trọng ngay trong ô tiền hoa hồng (đồng bộ với báo cáo doanh thu — BC3 15/11/2026):
   số là chính, thanh mảnh dưới = tỷ lệ so với dòng lớn nhất của bảng. Mobile (bảng biến thành thẻ) ẩn thanh cho gọn. */
@media screen {
  #appView .hh-meter { display: block; width: 100%; min-width: 72px; height: 4px; margin-top: 3px; border-radius: 99px; background: #F3EEE6; overflow: hidden; }
  #appView .hh-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #c4955a, #a9783a); }
  #appView tr:hover .hh-meter i { background: linear-gradient(90deg, #a9783a, #8a5f2a); }
}
@media screen and (max-width: 760px) {
  #appView :is(.hh-slips, .hh-people, .pc-list, .pt-list) .hh-meter { display: none; }
}
