/* Cùng hệ màu với app qtdn của HappyAI: xanh đậm nhận diện, 4 bước luồng hàng dùng 4 tông trầm.
   Nhập NCC = xanh dương · Xuất khách = gạch · Xuất thợ = mận · Nhập lại = xanh ngọc. Vàng đồng chỉ cho gói AI. */
:root {
  --bg: #f3f5f7; --surface: #ffffff; --sunk: #eaeef2; --ink: #14202e; --muted: #566373; --faint: #6b7785; --line: #dde3e9;
  --side: #10233a; --side-2: #1a3350; --side-ink: #d9e2ec; --side-muted: #8fa3b8; --side-line: #223b58;
  --brand: #0f7173; --brand-soft: #e0f1f0;
  --nk: #24527f; --xk: #a8482f; --xt: #75426f; --nl: #0f7173;
  --nk-soft: #e4ecf4; --xk-soft: #f6e9e4; --xt-soft: #f1e8f0; --nl-soft: #e0f1f0;
  --ai: #86600f; --ai-soft: #f7f0df; --bad: #b3362b; --bad-soft: #f8e6e4; --warn: #8a5a00; --warn-soft: #fbf0d9; --ok: #2f7a3e; --ok-soft: #e3f2e6;
  --on-accent: #ffffff; --shadow: 0 1px 2px rgb(16 35 58 / 0.06);
  --f: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e1620; --surface: #16212d; --sunk: #1d2a38; --ink: #e6ecf2; --muted: #9fb0c0; --faint: #8e9eae; --line: #2a3a4a;
  --side: #0a131d; --side-2: #152433; --side-line: #1e3042;
  --brand: #4cc0bb; --brand-soft: #123033;
  --nk: #7fb0e3; --xk: #ec9a7f; --xt: #d493cc; --nl: #4cc0bb;
  --nk-soft: #18293b; --xk-soft: #36211a; --xt-soft: #2f2030; --nl-soft: #123033;
  --ai: #e0b454; --ai-soft: #2f2712; --bad: #f0857a; --bad-soft: #3a1c19; --warn: #e6b35a; --warn-soft: #33270f; --ok: #7ccf8b; --ok-soft: #16301c;
  --on-accent: #0b1218; --shadow: none; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0e1620; --surface: #16212d; --sunk: #1d2a38; --ink: #e6ecf2; --muted: #9fb0c0; --faint: #8e9eae; --line: #2a3a4a;
  --side: #0a131d; --side-2: #152433; --side-line: #1e3042;
  --brand: #4cc0bb; --brand-soft: #123033;
  --nk: #7fb0e3; --xk: #ec9a7f; --xt: #d493cc; --nl: #4cc0bb;
  --nk-soft: #18293b; --xk-soft: #36211a; --xt-soft: #2f2030; --nl-soft: #123033;
  --ai: #e0b454; --ai-soft: #2f2712; --bad: #f0857a; --bad-soft: #3a1c19; --warn: #e6b35a; --warn-soft: #33270f; --ok: #7ccf8b; --ok-soft: #16301c;
  --on-accent: #0b1218; --shadow: none; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.55 var(--f); margin: 0; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 22px; } h2 { font-size: 16.5px; } h3 { font-size: 14.5px; }
p { margin: 0; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.mo { color: var(--muted); } .nho { font-size: 12.5px; } .dam { font-weight: 600; }
.do { color: var(--bad); } .vang { color: var(--warn); } .xanh { color: var(--ok); }

/* ---------- Khung ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; border-bottom: 1px solid var(--side-line); }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--side-2); display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 9px 7px; flex: none; }
.logo-mark i { border-radius: 1px; } .logo-mark i:nth-child(1) { background: #8dbbec; } .logo-mark i:nth-child(2) { background: #f0a78f; } .logo-mark i:nth-child(3) { background: #d9a0d2; } .logo-mark i:nth-child(4) { background: #5fd0c9; }
.logo b { display: block; color: #fff; font-size: 15px; }
.logo small { display: block; color: var(--side-muted); font-size: 11.5px; }
.nav { padding: 12px 10px; display: grid; gap: 2px; }
.nav-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); padding: 12px 10px 6px; }
.nav button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--side-ink); padding: 9px 10px; border-radius: 8px; text-align: left; font-weight: 500; }
.nav button:hover { background: var(--side-2); }
.nav button[aria-current="page"] { background: var(--side-2); color: #fff; }
.nav .dem { margin-left: auto; font-size: 11px; font-weight: 700; background: #b3362b; color: #fff; border-radius: 99px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 10px; }
.side-foot .ai { min-width: 0; flex: 1; } .side-foot b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .side-foot small { color: var(--side-muted); font-size: 11.5px; }
.side-foot button { border: 1px solid var(--side-line); background: var(--side-2); color: var(--side-ink); border-radius: 8px; padding: 7px; display: grid; place-items: center; }

.work { min-width: 0; padding: 26px 30px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head p { color: var(--muted); margin-top: 3px; }
.head .nut-hang { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar { display: none; }
.botnav { display: none; }

/* ---------- Thành phần ---------- */
.the { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.the-pad { padding: 16px 18px; }
.the-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.the-head h2 { font-size: 15px; }
.luoi { display: grid; gap: 14px; }
.luoi-2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.luoi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.luoi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mb { margin-bottom: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 13px; font-weight: 600; font-size: 13.5px; white-space: nowrap; min-height: 38px; }
.btn:hover { border-color: var(--faint); }
.btn.chinh { background: var(--brand); border-color: var(--brand); color: var(--on-accent); }
.btn.nguy { color: var(--bad); }
.btn.nho { padding: 5px 10px; min-height: 32px; font-size: 12.5px; }
.btn.to { min-height: 54px; font-size: 16px; border-radius: 12px; padding: 12px 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.btn.l-NK { color: var(--nk); background: var(--nk-soft); border-color: transparent; }
.btn.l-XK { color: var(--xk); background: var(--xk-soft); border-color: transparent; }
.btn.l-XT { color: var(--xt); background: var(--xt-soft); border-color: transparent; }
.btn.l-NL { color: var(--nl); background: var(--nl-soft); border-color: transparent; }

.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip.do { background: var(--bad-soft); color: var(--bad); } .chip.vang { background: var(--warn-soft); color: var(--warn); } .chip.xanh { background: var(--ok-soft); color: var(--ok); }
.chip.l-NK { background: var(--nk-soft); color: var(--nk); } .chip.l-XK { background: var(--xk-soft); color: var(--xk); } .chip.l-XT { background: var(--xt-soft); color: var(--xt); } .chip.l-NL { background: var(--nl-soft); color: var(--nl); }
.chip.ai { background: var(--ai-soft); color: var(--ai); }

.loc { display: flex; gap: 6px; flex-wrap: wrap; }
.loc button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.loc button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* Ô số */
.so-o { padding: 14px 16px; }
.so-o .nhan { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.so-o .gt { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.so-o .phu { font-size: 12.5px; color: var(--faint); margin-top: 2px; }

/* Luồng hàng */
.luong { display: grid; grid-template-columns: 1fr 34px 1fr 34px 1fr; align-items: center; padding: 16px 18px 18px; gap: 0; }
.luong .buoc { border-radius: 11px; padding: 12px 14px; border: 1px solid transparent; text-align: left; background: var(--sunk); width: 100%; }
.luong .buoc:hover { border-color: var(--line); }
.luong .buoc b { display: block; font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.luong .buoc span { font-size: 12.5px; font-weight: 600; }
.luong .buoc small { display: block; font-size: 12px; color: var(--muted); }
.luong .b-NK { background: var(--nk-soft); color: var(--nk); } .luong .b-XK { background: var(--xk-soft); color: var(--xk); }
.luong .b-XT { background: var(--xt-soft); color: var(--xt); } .luong .b-NL { background: var(--nl-soft); color: var(--nl); }
.luong .giua { display: grid; gap: 8px; }
.luong .mui { display: grid; place-items: center; color: var(--faint); }
.luong .mui svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.luong-chu { padding: 0 18px 14px; font-size: 12.5px; color: var(--muted); }

/* Danh sách cảnh báo */
.cb { list-style: none; margin: 0; padding: 0; }
.cb li { display: flex; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.cb li:last-child { border-bottom: 0; }
.cb .dau { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; margin-top: 1px; }
.cb .dau svg.i { width: 16px; height: 16px; }
.cb .do .dau { background: var(--bad-soft); color: var(--bad); } .cb .vang .dau { background: var(--warn-soft); color: var(--warn); }
.cb b { display: block; font-size: 13.5px; } .cb p { font-size: 12.5px; color: var(--muted); }
.cb button.lk { border: 0; background: none; padding: 0; color: var(--brand); font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.trong { padding: 26px 18px; text-align: center; color: var(--muted); }

/* Thanh đôi Việc / Công */
.ct-dong { padding: 13px 18px; border-bottom: 1px solid var(--line); cursor: pointer; display: block; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.ct-dong:last-child { border-bottom: 0; }
.ct-dong:hover { background: var(--sunk); }
.ct-ten { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 7px; }
.ct-ten b { font-size: 13.5px; }
.thanh { display: grid; grid-template-columns: 38px 1fr 64px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.thanh + .thanh { margin-top: 4px; }
.thanh .ray { height: 7px; border-radius: 99px; background: var(--sunk); overflow: hidden; position: relative; }
.thanh .ray i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--brand); }
.thanh .ray i.cong { background: var(--faint); } .thanh .ray i.cong.vuot { background: var(--bad); }
.thanh .so { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* Bảng */
.bang-cuon { overflow-x: auto; }
table.bang { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bang th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--sunk); white-space: nowrap; }
.bang td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bang tr:last-child td { border-bottom: 0; }
.bang .p { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bang tr.bam { cursor: pointer; } .bang tr.bam:hover td { background: var(--sunk); }
.bang tr.thap td { background: var(--warn-soft); }
.bang tfoot td { font-weight: 700; background: var(--sunk); }
.nhom-hang td { background: var(--bg) !important; font-weight: 700; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* Ô nhập */
.truong { display: grid; gap: 5px; }
.truong > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.o { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 11px; min-height: 40px; }
.o:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
textarea.o { min-height: 70px; resize: vertical; }
.luoi-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.luoi-form .rong { grid-column: 1 / -1; }
.goi-y { font-size: 12px; color: var(--faint); }
.tim { position: relative; } .tim svg.i { position: absolute; left: 10px; top: 11px; width: 16px; height: 16px; color: var(--faint); } .tim .o { padding-left: 33px; }

/* Lớp phủ (hộp thoại) */
#lop { position: fixed; inset: 0; background: rgb(10 19 29 / .5); z-index: 50; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.hop { background: var(--surface); border-radius: 14px; width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgb(0 0 0 / .25); }
.hop.rong { width: min(1040px, 100%); } .hop.hep { width: min(460px, 100%); }
.hop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.hop-head button { border: 0; background: var(--sunk); border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; }
.hop-than { padding: 16px 18px; overflow-y: auto; }
.hop-chan { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.loi-hop { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.loi-hop ul { margin: 4px 0 0; padding-left: 18px; }

/* Dòng phiếu */
.dong-phieu { display: grid; grid-template-columns: minmax(0, 2.4fr) 92px 120px minmax(0, 1.2fr) 34px; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.dong-phieu .phu { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.dong-phieu .xoa { border: 0; background: none; color: var(--faint); height: 40px; }
.dong-phieu .o { min-height: 38px; padding: 7px 9px; }
.dong-phieu.tu-dong .o-sl { background: var(--xt-soft); }
.dong-dau { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.chon-loai { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.chon-loai button { border: 2px solid transparent; border-radius: 11px; padding: 10px; text-align: left; font-weight: 600; font-size: 13px; background: var(--sunk); color: var(--muted); }
.chon-loai button small { display: block; font-weight: 400; font-size: 11.5px; }
.chon-loai button[aria-pressed="true"].l-NK { background: var(--nk-soft); color: var(--nk); border-color: var(--nk); }
.chon-loai button[aria-pressed="true"].l-XK { background: var(--xk-soft); color: var(--xk); border-color: var(--xk); }
.chon-loai button[aria-pressed="true"].l-XT { background: var(--xt-soft); color: var(--xt); border-color: var(--xt); }
.chon-loai button[aria-pressed="true"].l-NL { background: var(--nl-soft); color: var(--nl); border-color: var(--nl); }
.tong-phieu { display: flex; justify-content: space-between; padding: 12px 0 0; font-weight: 700; }

/* Chi tiết công trình */
.ba-do { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.do-o { padding: 14px 16px; }
.do-o .nhan { font-size: 12.5px; color: var(--muted); }
.do-o .gt { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.do-o .ray { height: 8px; border-radius: 99px; background: var(--sunk); margin: 8px 0 6px; overflow: hidden; }
.do-o .ray i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.do-o .ray i.vuot { background: var(--bad); }
.ket-luan { border-radius: 11px; padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; }
.ket-luan.do { background: var(--bad-soft); color: var(--bad); } .ket-luan.xanh { background: var(--ok-soft); color: var(--ok); } .ket-luan.vang { background: var(--warn-soft); color: var(--warn); }
.ket-luan b { display: block; } .ket-luan p { color: var(--ink); font-size: 13px; }

.dong-thoi { list-style: none; margin: 0; padding: 0; }
.ngay-nhom { padding: 8px 18px; background: var(--sunk); font-size: 12px; font-weight: 700; color: var(--muted); }
.dong-thoi li { display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.dong-thoi .gio { font-weight: 700; font-variant-numeric: tabular-nums; }
.dong-thoi .loai-vao { color: var(--ok); } .dong-thoi .loai-ra { color: var(--muted); } .dong-thoi .loai-tien_do { color: var(--brand); }
.anh-nho { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--sunk); border: 0; padding: 0; display: grid; place-items: center; color: var(--faint); font-size: 11px; }

/* Màn hình thợ */
.tho-wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 100px; }
.tho-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tinh-trang { border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; }
.tinh-trang.dang { background: var(--ok-soft); color: var(--ok); } .tinh-trang.nghi { background: var(--sunk); color: var(--muted); }
.tinh-trang b { display: block; color: var(--ink); }
.viec { padding: 16px; margin-bottom: 12px; }
.viec h2 { font-size: 16px; }
.viec .hang-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.viec .hang-nut .rong { grid-column: 1 / -1; }
.btn.vao { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ra { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chup { border: 2px dashed var(--line); border-radius: 12px; min-height: 180px; display: grid; place-items: center; text-align: center; color: var(--muted); cursor: pointer; overflow: hidden; position: relative; background: var(--sunk); }
.chup img { width: 100%; display: block; }
.chup input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gps { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 10px 12px; border-radius: 9px; background: var(--sunk); margin: 12px 0; }
.gps.tot { background: var(--ok-soft); color: var(--ok); } .gps.xau { background: var(--warn-soft); color: var(--warn); }

/* Đăng nhập */
.dn { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--side); }
.dn-hop { background: var(--surface); border-radius: 16px; width: min(440px, 100%); padding: 24px; }
.dn-hop .logo { padding: 0 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.dn-hop .logo b { color: var(--ink); } .dn-hop .logo small { color: var(--muted); }
.ds-nguoi { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.ds-nguoi button { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 14px; text-align: left; font-weight: 600; }
.ds-nguoi button:hover { border-color: var(--brand); }
.pin { font-size: 26px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.goi-y-mau { margin-top: 14px; font-size: 12.5px; background: var(--ai-soft); color: var(--ai); border-radius: 9px; padding: 9px 12px; }

/* Thông báo nổi */
#bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; pointer-events: none; }
#bao div { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 8px 24px rgb(0 0 0 / .2); max-width: 90vw; }
#bao div.loi { background: var(--bad); color: #fff; }

.ai-the { border-color: color-mix(in srgb, var(--ai) 35%, var(--line)); }
.ai-the .the-head { background: var(--ai-soft); color: var(--ai); border-radius: 12px 12px 0 0; }
.ai-the ul { margin: 0; padding: 12px 18px 14px 34px; font-size: 13px; display: grid; gap: 6px; }
pre.ban-tin { white-space: pre-wrap; font: 13px/1.6 var(--f); margin: 0; padding: 14px 18px; background: var(--sunk); border-radius: 0 0 12px 12px; max-height: 260px; overflow-y: auto; }

/* In phiếu */
.in-phieu { color: #000; background: #fff; padding: 8px; font-size: 13px; }
.in-phieu h2 { text-align: center; font-size: 18px; margin: 8px 0 2px; text-transform: uppercase; }
.in-phieu .ky { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 26px; font-weight: 600; }
.in-phieu .ky small { display: block; font-weight: 400; font-style: italic; margin-bottom: 60px; }
.in-phieu table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.in-phieu th, .in-phieu td { border: 1px solid #555; padding: 5px 7px; }
.in-phieu .p { text-align: right; }
@media print {
  body * { visibility: hidden; }
  .in-phieu, .in-phieu * { visibility: visible; }
  .in-phieu { position: absolute; left: 0; top: 0; width: 100%; }
  #lop { position: static; background: none; padding: 0; }
}

/* ---------- Điện thoại ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--side); color: #fff; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); position: sticky; top: 0; z-index: 20; }
  .topbar b { font-size: 15px; flex: 1; }
  .topbar button { border: 0; background: var(--side-2); color: #fff; border-radius: 8px; padding: 7px; display: grid; place-items: center; }
  .work { padding: 16px 16px 96px; }
  .botnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .botnav button { border: 0; background: none; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--faint); position: relative; }
  .botnav button[aria-current="page"] { color: var(--brand); }
  .botnav .dem { position: absolute; top: 4px; left: calc(50% + 6px); background: #b3362b; color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
  .luoi-2, .luoi-3 { grid-template-columns: 1fr; }
  .luoi-4 { grid-template-columns: 1fr 1fr; }
  .ba-do { grid-template-columns: 1fr; }
  .luong { grid-template-columns: 1fr; gap: 6px; }
  .luong .mui { transform: rotate(90deg); height: 22px; }
  .luong .giua { grid-template-columns: 1fr 1fr; }
  .luong .buoc b { font-size: 18px; }
  .chon-loai { grid-template-columns: 1fr 1fr; }
  .luoi-form { grid-template-columns: 1fr; }
  .dong-phieu { grid-template-columns: 1fr 84px 34px; }
  .dong-phieu .c-gia, .dong-phieu .c-sr { grid-column: 1 / 3; }
  .dong-phieu .c-gia:empty, .dong-phieu .c-sr:empty { display: none; }
  .dong-phieu .xoa { grid-row: 1; grid-column: 3; }
  .dong-hd { display: none; }
  #lop { padding: 0; place-items: end stretch; }
  .hop, .hop.rong, .hop.hep { width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .head h1 { font-size: 19px; }
  .so-o .gt { font-size: 20px; }
  .an-dt { display: none; }
}
