/* ============================================================
   XƯỞNG CRM — xuong.css (15/10/2026). Cùng tông màu với Klasse CRM (design tokens giống style.css gốc).
   ============================================================ */
:root {
  /* Chuyển động (animate-ui, 25/10/2026) — chép từ style.css của Klasse */
  --ease-soft: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-away: cubic-bezier(0.33, 0.17, 0.67, 0.5);
  --spring-toast: linear(0, 0.042, 0.143, 0.274, 0.415, 0.55, 0.671, 0.774, 0.858, 0.922, 0.97, 1.002, 1.023, 1.034, 1.039, 1.039, 1.036, 1.031, 1.026, 1.02, 1.015, 1.011, 1.007, 1.004, 1);
  --primary: #2563eb; --primary-h: #1d4ed8; --primary-soft: #eff6ff;
  --success: #10b981; --warning: #f59e0b; --danger: #ef4444; --info: #06b6d4;
  --bg: #f1f5f9; --surface: #fff; --border: #e2e8f0; --text: #0f172a; --muted: #64748b;
  --side: #1e293b; --side-w: 268px; --head-h: 56px; --r: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 20% 0%, #dbeafe 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #cffafe 0%, transparent 60%), var(--bg); }
.login-box { width: min(380px, 100%); background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(15, 23, 42, .12); }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-logo .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 22px; }
.login-sub { color: var(--muted); margin-bottom: 20px; }
.login .err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0; }

/* ---------- Khung ---------- */
.shell { display: flex; min-height: 100vh; }
/* Thanh bên kiểu thẻ nổi (25/10/2026 — chép kiểu từ sidebar Klasse, sửa 1 bên thì chép bên kia): khung bo góc cách mép 10px, ô tìm menu,
   biểu tượng nét (XS_SVG), nhóm có bong bóng màu, mục đang chọn có vạch đỏ mép trái, Sáng | Tối (.xs-light), thu gọn (body.side-col).
   --side-w = phần chừa cho thanh bên (gồm 2 lề 10px) → .main / hộp rộng tự lùi theo. */
.side { --sb-bg: #3b3f45; --sb-text: #e5e7eb; --sb-strong: #fff; --sb-muted: #a1a1aa; --sb-hover: rgba(255, 255, 255, .08); --sb-active-bg: rgba(255, 255, 255, .16);
  --sb-field: rgba(255, 255, 255, .14); --sb-line: rgba(255, 255, 255, .1); --sb-seg: rgba(255, 255, 255, .1); --sb-seg-on: rgba(255, 255, 255, .2);
  width: calc(var(--side-w) - 20px); background: var(--sb-bg); color: var(--sb-text); position: fixed; top: 10px; bottom: 10px; left: 10px; display: flex; flex-direction: column;
  z-index: 20; border-radius: 18px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); overflow: hidden; transition: width .3s var(--ease-soft), background-color .25s; }
.side.xs-light { --sb-bg: #fff; --sb-text: #1f2937; --sb-strong: #0f172a; --sb-muted: #94a3b8; --sb-hover: #f3f4f6; --sb-active-bg: #f3f4f6; --sb-field: #f3f4f6;
  --sb-line: #eceef1; --sb-seg: #f3f4f6; --sb-seg-on: #fff; background: var(--sb-bg) !important; box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.main { transition: margin-left .3s var(--ease-soft); }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px 18px; color: var(--sb-strong); font-weight: 700; font-size: 18px; white-space: nowrap; flex-shrink: 0; position: relative; }
.side-brand .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); display: grid; place-items: center; font-size: 20px; flex: none; box-shadow: 0 4px 10px rgba(37, 99, 235, .3); }
.side-brand .xs-name { flex: 1; min-width: 0; overflow: hidden; }
.xs-col { width: 28px; height: 28px; border-radius: 50%; border: 0; background: #2563eb; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none;
  box-shadow: 0 3px 8px rgba(37, 99, 235, .4); transition: transform .3s var(--ease-soft), background .15s; }
.xs-col:hover { background: #1d4ed8; }
body.side-col .xs-col { transform: rotate(180deg); }
.xs-search { margin: 6px 16px 4px; height: 40px; border-radius: 11px; background: var(--sb-field); display: flex; align-items: center; gap: 10px; padding: 0 12px; flex-shrink: 0; cursor: text; }
.xs-search svg { flex: none; color: var(--sb-text); }
.xs-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--sb-strong); font: inherit; font-size: 13.5px; height: auto; padding: 0; box-shadow: none; }
.xs-search input::placeholder { color: var(--sb-muted); }
.xs-search:focus-within { box-shadow: 0 0 0 2px rgba(37, 99, 235, .5); }
.nav { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav .xs-sec { font-size: 12px; color: var(--sb-muted); padding: 10px 2px 4px; white-space: nowrap; }
.nav .xs-div { height: 1px; background: var(--sb-line); margin: 8px 4px; flex: none; }
.nav .xs-empty { font-size: 12.5px; color: var(--sb-muted); padding: 10px 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 10px; border-radius: 11px; color: var(--sb-text); text-decoration: none; font-weight: 500;
  font-size: 14.5px; cursor: pointer; white-space: nowrap; flex: none; transition: background .15s, color .15s; }
.nav a:hover { background: var(--sb-hover); color: var(--sb-strong); }
.nav a.on { background: var(--sb-active-bg); color: var(--sb-strong); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; left: -16px; top: 7px; bottom: 7px; width: 5px; border-radius: 0 6px 6px 0; background: #ef4444; }
.nav .ic { width: 22px; height: 22px; display: grid; place-items: center; font-size: 16px; flex: none; }
.nav .ic svg { width: 20px; height: 20px; }
.nav .ic.grp { width: 26px; height: 26px; border-radius: 50%; margin: 0 -2px; background: color-mix(in srgb, var(--gc) 18%, transparent); color: var(--gc); }
.nav .ic.grp svg { width: 15px; height: 15px; }
.nav .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav .xs-pg { color: var(--sb-muted); font-size: 12.5px; font-weight: 400; }
.nav a.sub { height: 36px; margin-left: 22px; padding-left: 10px; font-size: 13.5px; }
.nav a.sub::after { content: ''; position: absolute; left: -9px; top: -4px; bottom: -4px; width: 1px; background: var(--sb-line); }
.nav a.sub.on::before { left: -38px; }
.nav a.sub .ic svg { width: 17px; height: 17px; }
.nav .chev { margin-left: auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: none; color: inherit; opacity: .8; transition: transform .2s var(--ease-soft), background .15s; flex: none; }
.nav .chev:hover { background: var(--sb-hover); opacity: 1; }
.nav .chev.open { transform: rotate(90deg); }
.nav .cnt + .chev { margin-left: 6px; }
.nav .cnt { margin-left: auto; background: #dc2626; color: #fff; border-radius: 6px; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 4px 6px; min-width: 22px; text-align: center; }
.xs-mode { margin: 6px 16px 0; padding: 4px; border-radius: 12px; background: var(--sb-seg); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex-shrink: 0; }
.xs-mode button { height: 34px; border: 0; border-radius: 9px; background: none; color: var(--sb-text); font: inherit; font-size: 14px; display: flex; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; transition: background .2s var(--ease-soft); }
.xs-mode button.on { background: var(--sb-seg-on); color: var(--sb-strong); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.side-foot { padding: 12px 16px 14px; flex-shrink: 0; }
.side .sf-me { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 6px; margin: 0 -6px; cursor: pointer; }
.side .sf-me:hover { background: var(--sb-hover); }
.side .sf-av { width: 40px; height: 40px; border-radius: 12px; }
.side .sf-who b { color: var(--sb-strong); font-size: 14px; }
.side .sf-who span { color: var(--sb-muted); font-size: 11.5px; }
.side .sf-ic { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--sb-text); display: grid; place-items: center; cursor: pointer; flex: none; }
.side .sf-ic:hover { background: var(--sb-hover); color: var(--sb-strong); }
.side .sf-ic.out:hover { background: rgba(239, 68, 68, .15); color: #ef4444; }
/* Thu gọn: chỉ còn biểu tượng, rê chuột hiện tên (#xs-tip) */
body.side-col { --side-w: 96px; }
body.side-col .side-brand { flex-direction: column; padding: 16px 0 8px; gap: 10px; }
body.side-col .side-brand .xs-name, body.side-col .nav .lb, body.side-col .nav .cnt, body.side-col .nav .chev, body.side-col .xs-search input, body.side-col .side .sf-who,
body.side-col .side .sf-ic, body.side-col .xs-mode .tx, body.side-col .nav a.sub { display: none; }
body.side-col .xs-search { width: 44px; margin: 6px auto 4px; padding: 0; justify-content: center; cursor: pointer; }
body.side-col .nav .xs-sec { text-align: center; font-size: 11px; padding-left: 0; padding-right: 0; }
body.side-col .nav a { justify-content: center; padding: 0; }
body.side-col .nav a.has-cnt .ic::after { content: ''; position: absolute; top: 7px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--sb-bg); }
body.side-col .nav a.in-grp { background: var(--sb-active-bg); }
body.side-col .nav a.in-grp::before { content: ''; position: absolute; left: -16px; top: 7px; bottom: 7px; width: 5px; border-radius: 0 6px 6px 0; background: #ef4444; }
body.side-col .xs-mode { grid-template-columns: 1fr; }
body.side-col .xs-mode button:not(.on) { display: none; }
body.side-col .xs-mode button.on { background: none; box-shadow: none; }
body.side-col .side-foot { padding: 12px 0 14px; display: flex; justify-content: center; }
body.side-col .side .sf-me { margin: 0; }
#xs-tip { position: fixed; z-index: 9000; background: #1f2937; color: #fff; font-size: 12.5px; font-weight: 500; padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap;
  transform: translateY(-50%); box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.sf-me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sf-av { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.sf-me { border-radius: 10px; padding: 4px; margin: -4px; transition: background .15s; }
.sf-me:hover { background: rgba(255, 255, 255, .06); }
/* Hồ sơ của tôi (16/10/2026) */
.pf-av { width: 88px; height: 88px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 34px; box-shadow: 0 0 0 4px var(--primary-soft); }
.pf-av-sm { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.sf-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sf-who b { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-who span { color: #94a3b8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sf-btn { height: 32px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .06); color: #cbd5e1; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sf-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.sf-btn.out:hover { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.main { margin-left: var(--side-w); flex: 1; min-width: 0; }
.top { height: var(--head-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 10; }
.top h1 { font-size: 17px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { padding: 20px 22px 90px; }
.bottom-nav { display: none; }

/* ---------- Thành phần ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-h); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input, .select, textarea.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; outline: none; }
textarea.input { height: auto; min-height: 70px; padding: 9px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: #334155; }
.field .req { color: var(--danger); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.card-b { padding: 14px 16px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; flex: 0 1 220px; }
.toolbar .grow { flex: 1 1 240px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px; cursor: pointer; }
.kpi .v { font-size: 26px; font-weight: 800; margin-top: 4px; }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi.warn .v { color: var(--warning); } .kpi.bad .v { color: var(--danger); } .kpi.good .v { color: var(--success); } .kpi.blue .v { color: var(--primary); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid2 > *, .kpis > * { min-width: 0; }
.kpis.kpis4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.use-ctl { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.use-ctl .select, .use-ctl .input { height: 28px; font-size: 12px; padding: 0 6px; border-radius: 6px; width: 100%; min-width: 0; }
.hist-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.hist-filter .select, .hist-filter .input { width: auto; height: 32px; font-size: 13px; padding: 0 8px; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #f8fafc; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #f8fafc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.tbl .m-sel { width: 36px; padding-right: 0; }
.tbl .m-sel input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.tbl tr.sel td { background: #eff6ff; }
.sel-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px; background: #eff6ff; border: 1px solid #bfdbfe; font-size: 13.5px; }
.sel-bar .btn:last-child { margin-left: auto; }
.muted { color: var(--muted); } .small { font-size: 12px; } .b { font-weight: 700; } .nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.gray { background: #f1f5f9; color: #475569; } .badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.green { background: #d1fae5; color: #047857; } .badge.red { background: #fee2e2; color: #b91c1c; }
.badge.amber { background: #fef3c7; color: #b45309; }
.bar { height: 8px; border-radius: 6px; background: #e2e8f0; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.bar.done > i { background: var(--success); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px; }

/* ---------- Sản phẩm (từ Klasse CRM) ---------- */
.kp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 8px; cursor: pointer; box-shadow: var(--shadow); min-width: 0; }
.kp-card:hover { border-color: var(--primary); }
.kp-img { aspect-ratio: 1; border-radius: 8px; background: #f8fafc; display: grid; place-items: center; overflow: hidden; margin-bottom: 6px; font-size: 28px; color: #cbd5e1; }
.kp-img img { width: 100%; height: 100%; object-fit: contain; }
.kp-name { font-weight: 600; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kp-row { display: flex; align-items: flex-start; gap: 6px; }
.kp-row .kp-name { flex: 1; min-width: 0; }
.kp-stock { flex: none; padding: 2px 7px; border-radius: 6px; background: #f1f5f9; font-size: 12px; color: #475569; white-space: nowrap; }
.kp-stock b { font-size: 13px; color: var(--text); }
.kp-stock.has { background: #ecfdf5; } .kp-stock.has b { color: #047857; }
.kp-stock.neg { background: #fef2f2; } .kp-stock.neg b { color: var(--danger); }
.kp-big { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.kp-big img { width: 100%; border-radius: 8px; border: 1px solid var(--border); background: #fff; display: block; }

/* ---------- Ô chọn sản phẩm Klasse (form lệnh) ---------- */
.pp { position: relative; }
.pp-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18); max-height: 360px; overflow: auto; padding: 4px; }
.pp-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.pp-row:hover, .pp-row.on { background: var(--primary-soft); }
.pp-row img, .pp-sel img, .pp-noimg { width: 46px; height: 46px; border-radius: 6px; object-fit: contain; background: #f8fafc; border: 1px solid var(--border); flex: none; display: grid; place-items: center; font-size: 18px; }
.pp-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-stock { font-size: 12px; color: #047857; background: #d1fae5; border-radius: 6px; padding: 3px 8px; white-space: nowrap; flex: none; }
.pp-stock.zero { color: #b91c1c; background: #fee2e2; }
.pp-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.pp-more { padding: 8px 10px; text-align: center; color: var(--muted); font-size: 12px; }
.pp-sel { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px; border: 1px solid #bfdbfe; background: var(--primary-soft); border-radius: 10px; }
.pp-sel img, .pp-sel .pp-noimg { width: 56px; height: 56px; }

/* ---------- Danh sách chọn nổi trên hộp thoại (chọn SP / khách — Gửi thành phẩm) ---------- */
.pick-bg { position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pick-box { width: min(560px, 100%); max-height: 86vh; background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.pick-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 14px 0; }
.pick-list { flex: 1; overflow: auto; padding: 0 8px 8px; min-height: 160px; }
.ship-line .ship-pick { flex: 1 1 200px; min-width: 0; justify-content: flex-start; height: auto; min-height: 40px; padding: 4px 8px; gap: 8px; text-align: left; font-weight: 500; }
.ship-line .ship-pick img, .ship-line .ship-pick .pp-noimg { width: 32px; height: 32px; }
/* Phiếu order từ công ty (Klasse → xưởng, 16/10/2026) */
.req-box { margin-bottom: 16px; }
.req-box .card-h .select { width: auto; max-width: 60%; height: 32px; padding: 4px 8px; font-size: 13px; }
.rq-filters { display: flex; gap: 8px; align-items: center; }
.rq-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-box.has-new { border-color: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.req-box .tbl td.rq-ov { display: none; }
.req-box .tbl .rq-d-ov { display: inline; margin-left: 4px; }
.req-th img, .req-th .pp-noimg { width: 36px; height: 36px; border-radius: 6px; object-fit: contain; background: #f8fafc; border: 1px solid var(--border); display: grid; place-items: center; font-size: 15px; }
.ship-line .ship-pick .sp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-line .input[data-ship-qty] { width: 80px; }
.ship-line { flex-wrap: wrap; }
.ship-line .ship-err { flex: 1 1 100%; color: var(--danger); font-size: 12.5px; font-weight: 600; margin: -2px 0 0; }
.ship-line .ship-err:empty { display: none; }
.ship-line.err .input[data-ship-qty] { border-color: var(--danger); box-shadow: 0 0 0 3px #fee2e2; color: var(--danger); font-weight: 700; }

/* ---------- Hộp thoại ---------- */
.modal-bg { position: fixed; inset: 0; height: 100%; height: 100dvh; background: rgba(15, 23, 42, .5); z-index: 100; display: flex; justify-content: flex-end; animation: ux-ov-in .4s var(--ease-soft); }
.modal { width: min(640px, 100%); height: 100%; max-height: 100dvh; background: var(--surface); display: flex; flex-direction: column; animation: slide .4s var(--ease-soft); }
/* Khung trượt mở / đóng mượt (animate-ui, 25/10/2026): trượt vào từ mép phải + mờ → rõ 0,4s; đóng (closeModal thêm .out) 0,2s;
   nền mờ dần từ trong suốt */
@keyframes slide { from { transform: translateX(100%); opacity: 0; } }
@keyframes ux-ov-in { from { background-color: transparent; } }
.modal-bg.out { background-color: transparent; pointer-events: none; transition: background-color .2s var(--ease-away); }
.modal-bg.out .modal { transform: translateX(100%); opacity: 0; transition: transform .2s var(--ease-away), opacity .2s var(--ease-away); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-h b { flex: 1; font-size: 16px; }
.modal-x { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { flex: 1; overflow: auto; padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.line { display: flex; gap: 8px; align-items: center; }
.line .select { flex: 1; min-width: 0; }
.line .input { width: 110px; flex: none; }
.line.bom-line .input[data-bom-qty] { width: 100px; }
.line.bom-line .bom-note { width: auto; flex: 1 1 150px; min-width: 0; }
.line .x { border: 0; background: none; color: var(--danger); font-size: 20px; cursor: pointer; width: 28px; flex: none; }
.line .hint { font-size: 12px; color: var(--muted); width: 90px; flex: none; text-align: right; }
.sec-t { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.stage { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.stage-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stage-top b { flex: 1; }
.stage-act { display: flex; gap: 6px; margin-top: 8px; }
.stage-act .input { width: 140px; height: 32px; }
.stage-log { font-size: 12px; color: var(--muted); margin-top: 6px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.info-grid .k { font-size: 12px; color: var(--muted); }
.warn-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 8px 0; }

/* Toast (animate-ui, 25/10/2026): vào = trồi từ dưới + 0,96 → 1 + nhoè → rõ theo lò xo (nảy ~4%); ra = mờ + thu nhỏ tại chỗ 0,2s */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) scale(.96); filter: blur(4px); background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease-away), transform .2s var(--ease-away), filter .2s var(--ease-away); z-index: 10050; max-width: 90vw; }
/* 28/10/2026: trước z-index 200 → nằm DƯỚI màn quét (9970): bấm "Xuất kho" chưa quét mã / máy chủ báo lỗi thì thông báo bị che, tưởng nút không chạy */
.toast.show { opacity: 1; transform: translateX(-50%); filter: none; animation: ux-toast-t .45s var(--spring-toast); transition: opacity .3s var(--ease-soft), filter .3s var(--ease-soft); }
@keyframes ux-toast-t { from { transform: translateX(-50%) translateY(100%) scale(.96); } }
.toast.error { background: var(--danger); } .toast.success { background: #047857; }
@media (max-width: 768px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }   /* trên hàng nút chân màn quét / thanh menu dưới, không che nút */
.demo-tag { white-space: nowrap; flex: none; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 1024px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 768px) {
  .side { display: none; }
  .main { margin-left: 0; }
  .top { padding: 0 14px; }
  .page { padding: 14px 12px 84px; }
  .bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 58px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .06);
    z-index: 30;
    align-items: center;
    padding: 0 4px;
  }
  .bottom-nav-side {
    display: contents;
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    border-radius: 10px;
    width: 100%;
    min-width: 0;
    transition: all .15s ease;
  }
  .bottom-nav a:active { transform: scale(0.92); }
  .bottom-nav a.on { color: var(--primary); font-weight: 700; background: rgba(99, 102, 241, .07); }
  .bottom-nav a .ic { font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .bottom-nav a .lb { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; line-height: 1.2; }
  .bottom-nav .cnt { position: absolute; top: 2px; right: 14%; background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; padding: 0 5px; line-height: 14px; font-weight: 700; }
  
  .bottom-nav-center,
  .bottom-nav-cradle,
  .bottom-nav-fab {
    display: none !important;
  }
  .toolbar .input, .toolbar .select { flex: 1 1 140px; }
  .kp-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tbl .m-hide { display: none !important; }
  /* Bảng → thẻ trên điện thoại (labelTables gắn data-label = tiêu đề cột): ô đầu là tiêu đề thẻ, các ô sau "nhãn ……… giá trị" */
  .tbl:not(.no-cards) thead { display: none; }
  .tbl:not(.no-cards), .tbl:not(.no-cards) tbody { display: block; }
  .tbl:not(.no-cards) tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .tbl:not(.no-cards) tr:last-child { border-bottom: 0; }
  .tbl:not(.no-cards) td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0; text-align: right; min-width: 0 !important; }
  .tbl:not(.no-cards) td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .tbl:not(.no-cards) td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .tbl:not(.no-cards) td:first-child::before { display: none; }
  /* ô tích (chỉ tài khoản admin) nằm góc phải thẻ, ô kế tiếp làm tiêu đề thẻ */
  .tbl:not(.no-cards) tr { position: relative; }
  .tbl:not(.no-cards) td.m-sel { position: absolute; right: 14px; top: 10px; padding: 0; width: auto; }
  .tbl:not(.no-cards) td.m-sel + td { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; padding-right: 32px; }
  .tbl:not(.no-cards) td.m-sel + td::before { display: none; }
  .tbl:not(.no-cards) td[data-label=""]::before { display: none; }
  .tbl:not(.no-cards) td[data-label=""] { justify-content: flex-end; }
  .tbl:not(.no-cards) td > .bar { flex: 1; max-width: 160px; }
  .tbl:not(.no-cards) td.num { white-space: normal; }
  .kpis { gap: 8px; } .kpi { padding: 12px; } .kpi .v { font-size: 22px; }
  .kpis.kpis4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hist-filter .select { flex: 1 1 100%; }
  .hist-filter .input { flex: 1 1 0; min-width: 0; }
  .card-h { flex-wrap: wrap; }
  /* Bảng trong hộp thoại: các ô phụ chia 2 cột cho gọn (bảng vật tư của lệnh, lịch sử kho của vật tư / sản phẩm…) */
  .modal .tbl:not(.ptx-tbl):not(.no-cards) tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; }
  .modal .tbl:not(.ptx-tbl):not(.no-cards) td:first-child, .modal .tbl:not(.ptx-tbl):not(.no-cards) td[data-label=""] { grid-column: 1 / -1; }
  .modal .tbl:not(.no-cards) td { font-size: 13px; }
  .modal .tbl:not(.no-cards) td.m-hide { display: none !important; }
  .modal .tbl:not(.no-cards) td.nowrap, .modal .tbl:not(.no-cards) td.num { white-space: normal; }
  .modal .tbl:not(.no-cards) td { flex-wrap: wrap; row-gap: 2px; }
  .modal .tbl:not(.no-cards) td .tdv { min-width: 0; margin-left: auto; text-align: right; }

  /* Bảng lịch sử thay đổi tồn thành phẩm trong hộp thoại (.ptx-tbl) dạng thẻ sạch sẽ trên điện thoại (22/10/2026) */
  .modal .tbl-wrap:has(.ptx-tbl) { border: none !important; background: transparent !important; overflow: visible !important; }
  .modal .tbl.ptx-tbl { display: block !important; border: 0 !important; width: 100% !important; background: transparent !important; }
  .modal .tbl.ptx-tbl thead { display: none !important; }
  .modal .tbl.ptx-tbl tbody { display: flex !important; flex-direction: column !important; gap: 10px !important; width: 100% !important; }
  .modal .tbl.ptx-tbl tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px 10px !important;
    padding: 12px 14px !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    position: relative !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05) !important;
  }
  .modal .tbl.ptx-tbl tr.sel {
    border-color: var(--primary) !important;
    background: rgba(37, 99, 235, .04) !important;
  }
  .modal .tbl.ptx-tbl td::before { display: none !important; }
  .modal .tbl.ptx-tbl td.m-sel {
    position: absolute !important;
    top: 11px !important;
    right: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 2 !important;
    width: auto !important;
    height: auto !important;
    border: 0 !important;
  }
  .modal .tbl.ptx-tbl td.m-sel input { width: 18px; height: 18px; cursor: pointer; }
  .modal .tbl.ptx-tbl td.ptx-time {
    grid-column: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .modal .tbl.ptx-tbl td.ptx-kind {
    grid-column: 2 / 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .modal .tbl.ptx-tbl tr:has(td.m-sel) td.ptx-kind {
    padding-right: 28px !important;
  }
  .modal .tbl.ptx-tbl td.ptx-qty {
    grid-column: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg) !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    border: 0 !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
  }
  .modal .tbl.ptx-tbl td.ptx-qty::before {
    content: 'Thay đổi' !important;
    display: inline-block !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    color: var(--muted) !important;
  }
  .modal .tbl.ptx-tbl td.ptx-after {
    grid-column: 2 / 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg) !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    border: 0 !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
  }
  .modal .tbl.ptx-tbl td.ptx-after::before {
    content: 'Tồn sau' !important;
    display: inline-block !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    color: var(--muted) !important;
  }
  .modal .tbl.ptx-tbl td.ptx-note {
    grid-column: 1 / -1 !important;
    display: block !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: var(--muted) !important;
    padding: 6px 0 0 !important;
    border: 0 !important;
    border-top: 1px dashed var(--border) !important;
    word-break: break-word !important;
    text-align: left !important;
  }
  .modal .tbl.ptx-tbl td.ptx-note:empty { display: none !important; }
  .modal .tbl.ptx-tbl td.ptx-note .tdv { margin-left: 0 !important; text-align: left !important; display: block !important; }
  .modal .tbl.ptx-tbl td.ptx-note a { color: var(--primary); font-weight: 600; text-decoration: none; }
  .modal .tbl.ptx-tbl .ptx-by { color: var(--muted); font-size: 11.5px; }
  /* Thanh công cụ: ô tìm cả hàng, các ô chọn / nút lọc chia đều 2 ô/hàng (50%), nút hành động full hàng hoặc 50% */
  .toolbar { gap: 8px; }
  .toolbar > label.uxs, .toolbar > .grow { flex: 1 1 100% !important; width: 100%; }
  .toolbar > * { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar > .dr-wrap { flex: 1 1 calc(50% - 4px); min-width: 0; display: inline-flex; }
  .toolbar > .dr-wrap .dr-btn { width: 100% !important; height: 38px !important; font-size: 13px !important; padding: 0 8px !important; justify-content: center; }
  .toolbar > .dr-wrap:has(.dr-x) { flex-basis: 100%; } /* đã chọn ngày + nút ✕ → cả hàng, chữ ngày không bị cắt */
  .toolbar > .uxd-btn, .toolbar > select {
    flex: 1 1 calc(50% - 4px) !important;
    width: 100% !important;
    height: 38px !important;
    font-size: 13px !important;
    padding: 0 8px 0 10px !important;
    min-width: 0 !important;
  }
  .toolbar > .btn {
    flex: 1 1 calc(50% - 4px);
    height: 38px;
    font-size: 13px;
    padding: 0 8px;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .toolbar > label.nowrap {
    flex: 1 1 calc(50% - 4px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    min-height: 38px;
  }
  .toolbar > span:empty, .toolbar > span[style*="flex:1"] { display: none; }
  .toolbar > .fab-bar {
    flex: 1 1 100% !important;
    display: flex !important;
    gap: 8px !important;
    width: 100%;
  }
  .toolbar > .fab-bar .btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    justify-content: center !important;
    height: 38px !important;
    font-size: 13px !important;
    padding: 0 8px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Chân hộp thoại: nút xếp lưới đều, bỏ khoảng đệm */
  .modal-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; padding: 10px 12px; }
  .modal-f > span { display: none; }
  .modal-f:has(> .btn:nth-of-type(4):last-of-type) { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* 4 nút → 2 × 2 thay vì 3 + 1 */
  .modal-f .btn { width: 100%; padding: 0 6px; }
  .modal-f:has(> .sr-dlall) { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* hộp Mã tem: Về phiếu · In tất cả, dưới là Tải tất cả cả hàng */
  .modal-f > .sr-dlall { grid-column: 1 / -1; order: 3; }
  .modal-b { padding: 14px 14px; }
  /* Ghi nhận tiến độ: ô nhập cả hàng, 2 nút chia đều */
  .stage-act { flex-wrap: wrap; }
  .stage-act .input { flex: 1 1 100%; width: auto; }
  .stage-act .btn { flex: 1 1 0; }
  .kpi .l { font-size: 12px; line-height: 1.3; }
  .info-grid { gap: 8px 12px; }
  .line { flex-wrap: wrap; } .line .select { flex: 1 1 100%; }
  .line.bom-line { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  /* Tổng quan (16/10/2026): ô số liệu lên đầu, phiếu order công ty ở giữa, lệnh đang SX + vật tư sắp hết bên dưới */
  .dash { display: flex; flex-direction: column; }
  .dash > .kpis { order: 1; }
  .dash > .req-box { order: 2; }
  .dash > .grid2 { order: 3; }
  /* Khung phiếu order trên điện thoại (16/10/2026): tiêu đề 1 hàng, 2 ô lọc chia đều; thẻ phiếu 2 dòng thay vì "nhãn … giá trị" */
  .req-box .card-h { flex-wrap: wrap; gap: 10px; }
  .req-box .card-h > span[style*="flex:1"] { display: none; }
  .req-box .rq-title { flex: 1 1 100%; }
  .req-box .rq-filters { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 8px; } /* ô trạng thái rộng hơn: 'Mọi trạng thái (12)' bị cắt ở 360px */
  .req-box .rq-filters label.uxs { grid-column: 1 / -1; }
  .req-box .rq-filters .dr-wrap:has(.dr-x) { grid-column: 1 / -1; } /* đã chọn ngày: '01/10 → 24/10/2026' + nút ✕ không vừa nửa hàng → chiếm cả hàng */
  .req-box .rq-filters > *, .req-box .rq-filters .dr-btn, .req-box .rq-filters .uxd-btn { width: 100% !important; max-width: none !important; min-width: 0; }
  .req-box .rq-filters .dr-btn { justify-content: center; }
  .req-box .rq-filters .uxd-btn { font-size: 13px !important; padding: 0 6px 0 10px !important; gap: 4px; }
  .req-box .rq-filters .dr-btn { font-size: 13px; padding: 0 8px; }
  .req-box .sel-bar { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; margin: 0 12px 8px; font-size: 13px; white-space: nowrap; }
  .req-box .sel-bar .btn { padding: 0 8px; height: 30px; font-size: 12.5px; }
  .req-box .tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "code st" "to qty"; align-items: center; gap: 4px 10px; padding: 12px 14px; }
  .req-box .tbl tr:has(td.m-sel) { padding-right: 46px; }
  .req-box .tbl td { display: block; padding: 0; text-align: left; font-size: 13.5px; }
  .req-box .tbl td::before { display: none; }
  .req-box .tbl td.m-hide { display: none !important; }
  .req-box .tbl td.rq-code { grid-area: code; font-size: 15px; font-weight: 700; padding: 0; white-space: nowrap; }
  .req-box .tbl td.rq-st { grid-area: st; justify-self: end; }
  .req-box .tbl td.rq-st .badge { font-size: 11.5px; padding: 2px 7px; white-space: nowrap; }
  .req-box .tbl td.rq-st .rq-d-ov { display: none !important; }
  .req-box .tbl td.rq-to { grid-area: to; color: var(--muted); overflow: hidden; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }  /* 2 dòng — 1 dòng cắt mất tên khách dài (19/10/2026) */
  .req-box .tbl td.rq-qty { grid-area: qty; justify-self: end; font-weight: 700; white-space: nowrap; }
  .req-box .tbl td.rq-qty::after { content: ' SP'; font-weight: 500; color: var(--muted); font-size: 12px; }
  .req-box .tbl td.rq-ov { grid-column: 1 / -1; grid-row: 3; display: block; padding: 0; margin-top: 3px; }
  .req-box .tbl td.rq-ov .badge { display: inline-block; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; white-space: normal; line-height: 1.35; max-width: 100%; }
  .req-box .tbl td.m-sel { top: 50%; transform: translateY(-50%); }
  .req-box .tbl tr.sel { background: #eff6ff; }
  .req-box .tbl tr.sel td { background: transparent; }   /* tô cả thẻ đang chọn, không tô từng ô */
  /* Tổng quan — Lệnh đang SX: dòng 1 mã + hạn, dòng 2 sản phẩm · SL, dòng 3 thanh tiến độ; Vật tư sắp hết: tên / mã bên trái, tồn đỏ + tối thiểu bên phải */
  .dash .tbl.dsh-run tr, .dash .tbl.dsh-low tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 14px; }
  .dash .tbl.dsh-run td, .dash .tbl.dsh-low td { display: block; padding: 0; text-align: left; font-size: 13.5px; }
  .dash .tbl.dsh-run td::before, .dash .tbl.dsh-low td::before { display: none; }
  .dash .tbl.dsh-run tr { grid-template-areas: "code due" "prod prod" "prog prog"; }
  .dash .tbl.dsh-run td:nth-child(1) { grid-area: code; font-size: 15px; padding: 0; }
  .dash .tbl.dsh-run td:nth-child(2) { grid-area: prod; }
  .dash .tbl.dsh-run td:nth-child(2) .small { display: inline; margin-left: 6px; }
  .dash .tbl.dsh-run td:nth-child(3) { grid-area: prog; display: flex; align-items: center; gap: 10px; min-width: 0 !important; }
  .dash .tbl.dsh-run td:nth-child(3) .bar { flex: 1; max-width: none; }
  .dash .tbl.dsh-run td:nth-child(3) .tdv { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; text-align: left; }
  .dash .tbl.dsh-run td:nth-child(3) .small { flex: none; }
  .dash .tbl.dsh-run td .tdv, .dash .tbl.dsh-low td .tdv { margin-left: 0; text-align: inherit; }
  .dash .tbl.dsh-run td.dsh-due { grid-area: due; justify-self: end; }
  .dash .tbl.dsh-low tr { grid-template-areas: "name stock" "name min"; }
  .dash .tbl.dsh-low td:nth-child(1) { grid-area: name; font-size: 14px; padding: 0; }
  .dash .tbl.dsh-low td:nth-child(2) { grid-area: stock; justify-self: end; font-size: 15px; }
  .dash .tbl.dsh-low td:nth-child(3) { grid-area: min; justify-self: end; color: var(--muted); font-size: 12px; }
  .dash .tbl.dsh-low td:nth-child(3)::before { display: inline; content: 'Tối thiểu '; font-weight: 400; font-size: 12px; }
  /* Dòng hàng phiếu order (16/10/2026): tên cả hàng, các số (SL order · Tồn · SL gửi) xếp ngang thành ô nhỏ nhãn TRÊN số,
     ghi chú cả hàng (trống thì ẩn) — trước nhãn / số kéo dãn 2 đầu thẻ, khó đọc */
  .modal .tbl.req-items tr { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
  .modal .tbl.req-items td:first-child { flex: 1 1 100%; padding-bottom: 2px; }
  .modal .tbl.req-items td:not(:first-child) { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: flex-start;
    gap: 2px; padding: 6px 8px; text-align: left; background: var(--bg); border-radius: 8px; font-size: 14px; }
  .modal .tbl.req-items td:not(:first-child)::before { font-size: 11px; }
  .modal .tbl.req-items td .tdv { margin-left: 0; text-align: left; }
  .modal .tbl.req-items td.req-note { flex-basis: 100%; background: none; padding: 0; font-size: 13px; flex-direction: row; gap: 6px; }
  .modal .tbl.req-items .req-q { width: 100% !important; text-align: left !important; }
}


/* ================= GIAO DIỆN THEO MÙA (chép từ Klasse CRM style.css, 16/10/2026) =================
   Đổi tên khung cho khớp Xưởng: .topbar → .top, .sidebar → .side, .sb-logo → .side-brand, .sb-logo-mark → .side-brand .mark,
   .sb-nav → .nav, .sb-footer → .side-foot, .topbar-right → .top-right. Bỏ quy tắc đổi position của thanh bên (ở Xưởng là fixed). */
.top-right { display: flex; align-items: center; gap: 4px; flex: none; }
.top-right .theme-toggle-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.top-right .theme-toggle-btn:hover { background: #f1f5f9; }
body[class*="theme-"] .top { overflow: visible; }
/* ===== ÁO HALLOWEEN (body.theme-halloween, 12/10/2026) — chỉ đổi màu nhấn + trang trí ở rìa ===== */
body.theme-halloween {
  --primary: #ea580c; --primary-h: #c2410c; --primary-soft: #fff7ed; --accent: #9333ea;
  --sb-bg: #22152f; --sb-text: #e9d5ff; --sb-muted: #7c6a92;
  --sb-active-bg: rgba(234, 88, 12, .22); --sb-active-text: #fdba74; --sb-hover: rgba(253, 186, 116, .08);
}
body.theme-halloween .top { position: sticky; box-shadow: inset 0 -2px 0 #f97316; }   /* KHÔNG overflow:hidden — sẽ cắt ô thông báo xổ xuống */
body.theme-halloween .side-brand .mark { background: linear-gradient(135deg, #f97316, #9333ea); }
body.theme-halloween .side { background: linear-gradient(180deg, #2a1838 0%, #22152f 55%, #1b1026 100%); }
.theme-toggle-btn { font-size: 17px; line-height: 1; }
.theme-toggle-btn.theme-off { filter: grayscale(1); opacity: .55; }
.theme-deco { pointer-events: none; }
.hw-bats { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.hw-bat { position: absolute; left: -40px; width: 26px; color: #4c1d95; opacity: .5; animation: hw-fly 26s linear infinite; }
.hw-bat svg { display: block; width: 100%; height: auto; }
.hw-wing { transform-origin: 0 0; animation: hw-flap .32s ease-in-out infinite alternate; }
.hw-wing-r { animation-delay: .16s; }
/* Đường lượn lấy từ --y1..--y3 do JS chọn ngẫu nhiên mỗi vòng (_hwBatRandom) */
@keyframes hw-fly { 0% { transform: translate(0, 0); } 25% { transform: translate(28vw, var(--y1, 9px)); } 50% { transform: translate(56vw, var(--y2, -2px)); } 75% { transform: translate(84vw, var(--y3, 8px)); } 100% { transform: translate(calc(100vw + 80px), 0); } }
@keyframes hw-flap { from { transform: scaleY(1); } to { transform: scaleY(.45); } }
body.theme-halloween .top h1, body.theme-halloween .top-right { position: relative; z-index: 1; }
.hw-pumpkin { display: inline-flex; width: 22px; margin-left: auto; filter: drop-shadow(0 0 6px rgba(249, 115, 22, .55)); }
.hw-pumpkin svg, .hw-pumpkin-foot svg { width: 100%; height: auto; display: block; }
.hw-web { position: absolute; top: 0; right: 0; width: 70px; color: rgba(233, 213, 255, .16); z-index: 0; }
.hw-pumpkin-foot { position: absolute; right: 14px; bottom: 72px; width: 34px; opacity: .85; z-index: 0; filter: drop-shadow(0 0 10px rgba(249, 115, 22, .5)); }
body.theme-halloween .side-brand, body.theme-halloween .nav, body.theme-halloween .side-foot { position: relative; z-index: 1; }
@media (max-width: 768px) { .hw-bat:nth-child(n+4), .hw-pumpkin-foot { display: none; } }
@media (prefers-reduced-motion: reduce) { .hw-bats { display: none; } }
@media print { .theme-deco, .theme-toggle-btn { display: none !important; } }

/* ===== GIÁNG SINH (body.theme-christmas, 13/10/2026) — đỏ / xanh lá, dây đèn, tuyết, cây thông ===== */
body.theme-christmas {
  --primary: #c62828; --primary-h: #a51d1d; --primary-soft: #fef2f2; --accent: #15803d;
  --sb-bg: #0f2a1d; --sb-text: #dcfce7; --sb-muted: #6b8f7b;
  --sb-active-bg: rgba(220, 38, 38, .25); --sb-active-text: #fecaca; --sb-hover: rgba(255, 255, 255, .07);
}
body.theme-christmas .side { background: linear-gradient(180deg, #14382a 0%, #0f2a1d 60%, #0b2016 100%); }
body.theme-christmas .side-brand .mark { background: linear-gradient(135deg, #dc2626, #15803d); }
body.theme-christmas .top { position: sticky; box-shadow: inset 0 -2px 0 #15803d; }
body.theme-christmas .top h1, body.theme-christmas .top-right { position: relative; z-index: 1; }
body.theme-christmas .side-brand, body.theme-christmas .nav, body.theme-christmas .side-foot { position: relative; z-index: 1; }
/* Dây đèn nháy dọc mép dưới thanh trên */
.xm-lights { position: absolute; left: 0; right: 0; bottom: -5px; height: 12px; display: flex; justify-content: space-between; padding: 0 10px; overflow: hidden; z-index: 0; }
.xm-lights::before { content: ""; position: absolute; left: 0; right: 0; top: 1px; height: 6px; border-bottom: 1.5px solid #14532d; border-radius: 0 0 50% 50%; }
.xm-lights i { position: relative; top: 4px; width: 6px; height: 8px; border-radius: 50% 50% 45% 45%; background: var(--c); box-shadow: 0 0 6px var(--c); animation: xm-blink 1.75s ease-in-out infinite; }
@keyframes xm-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; box-shadow: none; } }
/* Tuyết rơi trong thanh menu */
.xm-snow { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.xm-snow i { position: absolute; top: -10px; width: var(--s); height: var(--s); border-radius: 50%; background: rgba(255, 255, 255, .75); animation: xm-fall linear infinite; }
@keyframes xm-fall { from { transform: translate(0, -10px); } 50% { transform: translate(12px, 50vh); } to { transform: translate(-6px, 102vh); } }
.xm-star { display: inline-flex; width: 20px; margin-left: auto; filter: drop-shadow(0 0 6px rgba(250, 204, 21, .8)); animation: xm-twinkle 2.4s ease-in-out infinite; }
.xm-star svg, .xm-tree svg { width: 100%; height: auto; display: block; }
@keyframes xm-twinkle { 50% { transform: scale(.85) rotate(12deg); opacity: .8; } }
.xm-tree { position: absolute; right: 12px; bottom: 70px; width: 40px; z-index: 0; filter: drop-shadow(0 0 10px rgba(250, 204, 21, .35)); }
@media (max-width: 768px) { .xm-tree { display: none; } .xm-lights i:nth-child(2n) { display: none; } }
@media (prefers-reduced-motion: reduce) { .xm-snow { display: none; } .xm-lights i, .xm-star { animation: none; } }

/* Giao diện theo mùa: KHÔNG đổi position của sidebar trên điện thoại — ở đó sidebar là position:fixed trượt ra / vào;
   đặt relative làm sidebar chen vào bố cục, đẩy cả trang sang phải (lỗi 13/10/2026). Trên máy tính cần relative để
   trang trí (tuyết, mạng nhện, cây thông) bám vào sidebar. */

/* ===== TẾT CỔ TRUYỀN (body.theme-tet, 14/10/2026) — đỏ son / vàng kim, đèn lồng, hoa mai, cờ đỏ sao vàng ===== */
body.theme-tet {
  --primary: #c8102e; --primary-h: #a00d25; --primary-soft: #fff1f2; --accent: #e0a800;
  --sb-bg: #5c0a14; --sb-text: #ffe8b0; --sb-muted: #b98a6a;
  --sb-active-bg: rgba(255, 205, 0, .18); --sb-active-text: #ffd84d; --sb-hover: rgba(255, 205, 0, .08);
}
body.theme-tet .side { background: linear-gradient(180deg, #7a0f1c 0%, #5c0a14 60%, #45070f 100%); }
body.theme-tet .side-brand .mark { background: linear-gradient(135deg, #da251d, #e0a800); }
body.theme-tet .top { position: sticky; box-shadow: inset 0 -2px 0 #e0a800; }
body.theme-tet .top h1, body.theme-tet .top-right { position: relative; z-index: 1; }
body.theme-tet .side-brand, body.theme-tet .nav, body.theme-tet .side-foot { position: relative; z-index: 1; }
.theme-toggle-btn .vn-flag { width: 22px; height: auto; display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
/* Đèn lồng treo, đung đưa — đặt giữa thanh trên (không che nút ở 2 bên) */
.tet-lanterns { position: absolute; top: 0; left: 32%; right: 32%; height: 100%; display: flex; justify-content: space-around; overflow: visible; z-index: 0; }
.tet-lantern { width: 26px; transform-origin: 50% 0; animation: tet-swing 3.2s ease-in-out infinite alternate; margin-top: -3px; filter: drop-shadow(0 2px 4px rgba(200, 16, 46, .35)); }
.tet-l2 { width: 30px; animation-delay: -1.1s; }
.tet-l3 { animation-delay: -2.2s; }
.tet-lantern svg { width: 100%; height: auto; display: block; }
@keyframes tet-swing { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
/* Lá cờ phấp phới cạnh logo */
.tet-flag { display: inline-flex; margin-left: auto; width: 24px; animation: tet-wave 2.6s ease-in-out infinite; transform-origin: 0 50%; }
.tet-flag svg { width: 100%; height: auto; display: block; border-radius: 2px; }
@keyframes tet-wave { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(-4deg) scaleX(.94); } }
/* Hoa mai rơi trong thanh menu */
.tet-petals { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.tet-petals i { position: absolute; top: -20px; width: var(--s); opacity: .85; animation: tet-fall linear infinite; }
.tet-petals i svg { width: 100%; height: auto; display: block; }
@keyframes tet-fall { from { transform: translate(0, -20px) rotate(0); } 50% { transform: translate(16px, 50vh) rotate(180deg); } to { transform: translate(-8px, 102vh) rotate(360deg); } }
.tet-greet { position: absolute; right: 12px; bottom: 74px; z-index: 0; text-align: right; font-weight: 800; font-size: 13px; line-height: 1.25;
  color: #ffd84d; text-shadow: 0 1px 0 #7a0f1c, 0 0 10px rgba(255, 205, 0, .45); letter-spacing: .3px; }
/* Điện thoại: thanh trên hẹp, đèn lồng đè lên nút 🎃 / 🎄 / cờ → ẩn; giữ hoa mai + cờ trong menu */
@media (max-width: 768px) { .tet-lanterns { display: none; } .tet-greet { display: none; } }
@media (prefers-reduced-motion: reduce) { .tet-petals { display: none; } .tet-lantern, .tet-flag { animation: none; } }

/* Nút Tết = đèn lồng (14/10/2026) */
.tet-btn-lantern { display: block; width: 15px; animation: tet-swing 3s ease-in-out infinite alternate; transform-origin: 50% 0; }
.tet-btn-lantern svg { width: 100%; height: auto; display: block; }
.theme-toggle-btn.theme-off .tet-btn-lantern { animation: none; }
/* Halloween: nhện thả tơ trong thanh menu (14/10/2026) */
.hw-spiders { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.hw-spiders i { position: absolute; top: 0; width: var(--sz); transform: translateY(-40px); animation: hw-dangle ease-in-out infinite; }
.hw-spiders i::before { content: ""; position: absolute; left: 50%; bottom: 70%; width: 1px; height: 100vh; background: rgba(233, 213, 255, .32); }
.hw-spiders i svg { position: relative; display: block; width: 100%; height: auto; filter: drop-shadow(0 0 3px rgba(249, 115, 22, .35));
  animation: hw-sway 2.6s ease-in-out infinite alternate; transform-origin: 50% -40%; }
.hw-spiders i svg path { stroke: #c4b5fd; }
.hw-spiders i svg ellipse, .hw-spiders i svg circle:first-of-type { fill: #3b2352; }
@keyframes hw-dangle {
  0% { transform: translateY(-40px); }
  35% { transform: translateY(var(--d)); }
  45% { transform: translateY(calc(var(--d) - 18px)); }
  55% { transform: translateY(var(--d)); }
  100% { transform: translateY(-40px); }
}
@keyframes hw-sway { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
@media (prefers-reduced-motion: reduce) { .hw-spiders { display: none; } }

/* Đoàn chạy ngang thanh trên (15/10/2026): Giáng sinh = ông già Noel + tuần lộc, Tết = múa lân + trẻ con chạy theo.
   Nằm dưới nút / tiêu đề (z-index 0), chạy 1 lượt rồi nghỉ, lặp lại. */
.season-run { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.season-runner { position: absolute; left: -140px; bottom: 2px; width: 118px; animation: season-ride 34s linear infinite; animation-delay: 3s; }
.season-runner svg { display: block; width: 100%; height: auto; animation: season-bob .34s ease-in-out infinite alternate; }
.tet-lion { width: 112px; animation-duration: 40s; }
@keyframes season-ride { 0% { left: -140px; } 55% { left: 100%; } 100% { left: 100%; } }
@keyframes season-bob { from { transform: translateY(0); } to { transform: translateY(-2.5px); } }
.season-runner .run-a, .season-runner .run-b { transform-box: fill-box; transform-origin: 50% 0; animation: run-leg .34s ease-in-out infinite alternate; }
.season-runner .run-b { animation-direction: alternate-reverse; }
@keyframes run-leg { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
.tet-lion .lan-head { transform-box: fill-box; transform-origin: 20% 90%; animation: lan-nod .5s ease-in-out infinite alternate; }
@keyframes lan-nod { from { transform: rotate(-7deg); } to { transform: rotate(6deg) translateY(-1px); } }
@media (max-width: 768px) { .season-runner { width: 86px; } .tet-lion { width: 82px; } }
@media (prefers-reduced-motion: reduce) { .season-run { display: none; } }

/* Sửa số đã sản xuất (16/10/2026) */
/* Vật tư theo định mức: thẻ thay cho bảng (16/10/2026 — trên điện thoại bảng tách thành nhãn "/ 1 SP", "Cả lệnh"… khó hiểu) */
.bom-list { display: flex; flex-direction: column; gap: 8px; }
.bom-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.bom-name { display: flex; flex-direction: column; margin-bottom: 8px; }
.bom-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bom-stats > div { background: #f8fafc; border-radius: 8px; padding: 6px 8px; min-width: 0; }
.bom-stats span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bom-stats b { font-size: 14px; white-space: nowrap; }
.bom-stats small { font-weight: 400; color: var(--muted); margin-left: 1px; }
.bom-stats .bad { background: #fef2f2; } .bom-stats .bad b { color: var(--danger); }
@media (max-width: 480px) { .bom-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Lịch sử thao tác lệnh sản xuất (16/10/2026) */
.ohist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ohist-row { display: flex; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13.5px; }
.ohist-row:last-child { border-bottom: 0; }
.ohist-ic { flex: none; width: 22px; text-align: center; }
.ohist-main { min-width: 0; flex: 1; }

/* Giảm số đã sản xuất: báo lỗi + lý do bắt buộc (16/10/2026) */
.st-warn { margin-top: 8px; padding: 10px 12px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 8px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.st-warn[hidden] { display: none; }
.st-reason { display: flex; gap: 6px; flex-wrap: wrap; }
.st-reason .input { flex: 1 1 180px; min-width: 0; }

/* Pháo hoa Tết (17/10/2026) — lớp vẽ trong suốt, không chặn chuột / chạm, dưới khung trượt / hộp thoại */
.tet-fireworks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
@media print { .tet-fireworks { display: none !important; } }

/* ===== chép từ Klasse style.css (17/10/2026) — sửa ở Klasse thì chép lại ===== */
/* ===== POPUP CẢM ƠN CA TỐI / ĐÊM (18h – 6h, 15/10/2026) ===== */
.nt-overlay { position: fixed; inset: 0; z-index: 9500; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: nt-fade .3s ease; }
.nt-overlay.nt-out { opacity: 0; transition: opacity .25s; }
.nt-card { width: 100%; max-width: 420px; background: var(--surface, #fff); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  animation: nt-pop .4s cubic-bezier(.2, .9, .3, 1.2); }
.nt-sky { position: relative; height: 130px; background: linear-gradient(180deg, #0b1437 0%, #1e2a6b 60%, #3b3f8f 100%); overflow: hidden; }
.nt-sky i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; animation: nt-twinkle 2.4s ease-in-out infinite; }
/* Trăng khuyết = bóng đổ của 1 vòng tròn trong suốt (không cần lớp che cùng màu nền) */
.nt-moon { position: absolute; right: 46px; top: 20px; width: 50px; height: 50px; border-radius: 50%; background: transparent;
  box-shadow: 14px 8px 0 0 #fde68a; filter: drop-shadow(0 0 12px rgba(253, 230, 138, .55)); animation: nt-float 4s ease-in-out infinite alternate; }
.nt-time { position: absolute; left: 22px; bottom: 16px; color: #e0e7ff; font-size: 30px; font-weight: 700; letter-spacing: 1px; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.nt-body { padding: 18px 22px 22px; }
.nt-body h3 { margin: 0 0 8px; font-size: 19px; color: var(--text, #0f172a); }
.nt-msg { margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; color: #334155; }
.nt-msg b { color: var(--primary); }
.nt-msg:has(+ .nt-wish) { margin-bottom: 6px; }
.nt-wish { margin: 0 0 14px; font-size: 14.5px; font-weight: 600; color: #4338ca; }
.nt-tips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.nt-tips span { background: #eef2ff; color: #4338ca; border-radius: 99px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; }
.nt-btn { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; }
@keyframes nt-fade { from { opacity: 0; } }
@keyframes nt-pop { from { transform: translateY(18px) scale(.94); opacity: 0; } }
@keyframes nt-twinkle { 50% { opacity: .25; transform: scale(.6); } }
@keyframes nt-float { to { transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .nt-overlay, .nt-card, .nt-sky i, .nt-moon { animation: none; } }

/* Popup cảm ơn ca tối: ô "Không hiển thị lại hôm nay" (17/10/2026) */
.nt-hide { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.nt-hide input { width: 15px; height: 15px; cursor: pointer; }

/* Popup chào buổi sáng (7h30 – 8h, 17/10/2026): dùng chung .nt-*, nền bình minh + mặt trời + mây */
.nt-sky.nt-morning { background: linear-gradient(180deg, #7dd3fc 0%, #fcd34d 70%, #fdba74 100%); }
.nt-sun { position: absolute; right: 46px; top: 26px; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle, #fff7ae 0%, #fde047 55%, #f59e0b 100%);
  box-shadow: 0 0 30px 10px rgba(253, 224, 71, .55); animation: nt-sunrise 1.4s ease-out both; }
@keyframes nt-sunrise { from { transform: translateY(40px); opacity: .3; } to { transform: none; opacity: 1; } }
.nt-cloud { position: absolute; height: 18px; border-radius: 20px; background: rgba(255, 255, 255, .85); animation: nt-cloud 18s linear infinite; }
.nt-cloud::before { content: ''; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: inherit; top: -12px; left: 12px; }
.nt-cloud.c1 { width: 70px; left: 8%; top: 32px; }
.nt-cloud.c2 { width: 54px; left: 48%; top: 64px; animation-duration: 24s; opacity: .8; }
@keyframes nt-cloud { from { transform: translateX(-30px); } to { transform: translateX(60px); } }
.nt-morning .nt-time { color: #fff; text-shadow: 0 2px 10px rgba(180, 83, 9, .45); }
.nt-wish.nt-wish-am { color: #b45309; }
.nt-tips.nt-tips-am span { background: #fef3c7; color: #92400e; }
@media (prefers-reduced-motion: reduce) { .nt-sun, .nt-cloud { animation: none; } }

/* Sản phẩm: bảng danh sách giống Kho hàng Klasse (19/10/2026, thay lưới thẻ .kp-grid) */
.kp-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kp-th { flex: none; width: 36px; height: 36px; border-radius: 6px; object-fit: contain; background: #f8fafc; border: 1px solid var(--border); cursor: zoom-in; }
.kp-noimg { display: grid; place-items: center; font-size: 16px; color: #cbd5e1; cursor: default; }
.kp-brand { background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.kp-st { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.kp-st.ok { color: var(--success, #10b981); font-weight: 600; }
.kp-st.neg { color: var(--danger); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ===== Lệnh sản xuất nhiều sản phẩm (19/10/2026) — form to 2 cột: thành phẩm | định mức vật tư của dòng đang chọn ===== */
.modal.wide { width: min(1360px, 100%); }
.of2 { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 14px; align-items: start; }
.of2-l, .of2-r { min-width: 0; }
.of2-r { border-left: 1px solid var(--border); padding-left: 14px; position: sticky; top: 0; }
.of2-tw { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; overflow-y: hidden; margin-bottom: 8px; }
.of2-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.of2-tbl th { background: var(--bg); text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.of2-tbl td { padding: 4px 5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.of2-tbl tbody tr:last-child td { border-bottom: 0; }
.of2-tbl tfoot td { background: var(--bg); padding: 6px; border-top: 1px solid var(--border); border-bottom: 0; }
.of2-tbl .num { text-align: right; }
.of2-tbl .input, .of2-tbl .select { height: 34px; padding: 4px 6px; font-size: 13px; }
#of2-rows tr { cursor: pointer; }
#of2-rows tr.on td { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
#of2-rows tr.on td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.of2-p { display: flex; align-items: center; gap: 6px; min-width: 130px; }
.of2-p img, .of2-p .pp-noimg { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex: none; }
.of2-p .input { flex: 1; min-width: 0; }
.of2-code { width: 76px; }
.of2-qty { width: 58px; text-align: right; }
.of2-qty.bad, .of2-tbl td.bad { color: var(--danger); border-color: var(--danger); font-weight: 700; }

/* Bảng định mức bên phải */
.of2-btbl .select { min-width: 180px; width: 100%; }
.of2-btbl th:nth-child(1), .of2-btbl td:nth-child(1) { width: 22px; text-align: center; }
.of2-btbl th:nth-child(2), .of2-btbl td:nth-child(2) { min-width: 180px; }
.of2-btbl th:nth-child(3), .of2-btbl td:nth-child(3) { width: 62px; }
.of2-btbl th:nth-child(4), .of2-btbl td:nth-child(4) { width: 80px; white-space: nowrap; }
.of2-btbl th:nth-child(5), .of2-btbl td:nth-child(5) { width: 60px; white-space: nowrap; }
.of2-btbl th:nth-child(6), .of2-btbl td:nth-child(6) { min-width: 75px; }
.of2-btbl th:nth-child(7), .of2-btbl td:nth-child(7) { width: 24px; text-align: center; }
.of2-btbl .of2-qty { width: 100%; }
.of2-btbl td:nth-child(6) .input { width: 100%; min-width: 65px; }

/* Bảng thành phẩm bên trái */
#of2-rows td:nth-child(1) { width: 22px; text-align: center; }
#of2-rows td:nth-child(2) { min-width: 130px; }
#of2-rows td:nth-child(3) { width: 76px; }
#of2-rows td:nth-child(4) { width: 58px; }
#of2-rows td:nth-child(5) { width: 50px; white-space: nowrap; text-align: right; }
#of2-rows td:nth-child(6) { width: 24px; text-align: center; }

.of2-bname { text-transform: none; letter-spacing: 0; color: var(--primary); }
.of2-tbl .x { border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; padding: 0 4px; }
.of2-tbl .x:hover { color: var(--danger); }
/* chi tiết lệnh nhiều SP */
.ln-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.ln-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); min-width: 0; }
.ln-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ln-hd img, .ln-hd .pp-noimg { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.ln-bom { margin-top: 8px; font-size: 12.5px; }
.ln-bom td.bad { color: var(--danger); font-weight: 700; }
@media (max-width: 900px) {
  .of2 { grid-template-columns: 1fr; }
  .of2-r { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; position: static; }
  .ln-list { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .of2-tw { border: 0; overflow: visible; }
  .of2-tbl thead { display: none; }
  .of2-tbl tr { display: grid; grid-template-columns: 22px minmax(0, 1fr) 84px 28px; gap: 4px 6px; padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; align-items: center; }
  .of2-tbl td { border: 0; padding: 0; }
  #of2-rows td:nth-child(1) { grid-row: 1 / 3; }
  #of2-rows td:nth-child(2) { grid-column: 2 / 4; }
  #of2-rows td:nth-child(3) { grid-column: 2; grid-row: 2; }
  #of2-rows td:nth-child(4) { grid-column: 3; grid-row: 2; }
  #of2-rows td:nth-child(5) { display: none; }
  #of2-rows td:nth-child(6) { grid-column: 4; grid-row: 1; }
  .of2-code { width: 100%; }
  .of2-qty { width: 100%; }
  .of2-tbl tfoot tr { border: 0; padding: 4px 6px; display: flex; gap: 8px; }
  .of2-btbl tbody tr { grid-template-columns: 22px minmax(0, 1fr) 72px 28px; }
  .of2-btbl td:nth-child(1) { grid-row: 1 / 4; }
  .of2-btbl td:nth-child(2) { grid-column: 2 / 4; }
  .of2-btbl td:nth-child(3) { grid-column: 3; grid-row: 2; }
  .of2-btbl td:nth-child(4) { grid-column: 2; grid-row: 2; font-size: 12px; color: var(--muted); }
  .of2-btbl td:nth-child(5) { display: none; }
  .of2-btbl td:nth-child(6) { grid-column: 2 / 4; grid-row: 3; }
  .of2-btbl td:nth-child(7) { grid-column: 4; grid-row: 1; }
  .of2-btbl .select { min-width: 0; width: 100%; }
}
.of2-btbl td:nth-child(6) .input { min-width: 110px; }
.ln-bom td:first-child { min-width: 120px; }
@media (max-width: 768px) {
  .of2-tbl tfoot td:empty { display: none; }
  .of2-tbl tfoot td { background: transparent; border: 0; padding: 0; }
  #of2-rows tr.on { border-color: var(--primary); }
}
/* ô chọn sản phẩm dạng sổ xuống trong form lệnh (19/10/2026) */
.of2-dd { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 200px; height: 38px; padding: 3px 10px 3px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; color: var(--text); text-align: left; }
.of2-dd:hover { border-color: var(--primary); }
.of2-dd img, .of2-dd .pp-noimg { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.of2-dd-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.of2-dd-t.muted { font-weight: 400; }
.of2-dd-c { color: var(--muted); font-size: 12px; }
.of-dd { position: fixed; z-index: 2000; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, .22); padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 380px; }
.of-dd > .input { height: 36px; }
.of-dd-list { overflow-y: auto; min-height: 0; flex: 1; }
.of-dd-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.of-dd-row:hover { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.of-dd-row.on { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.of-dd-row img, .of-dd-row .pp-noimg { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); }
.of-dd-row img { cursor: zoom-in; transition: transform .12s; }
.of-dd-row img:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--primary); }
.of-dd-no-match { margin: 8px; padding: 10px 12px; border: 1px dashed #fdba74; background: #fff7ed; border-radius: 10px; }   /* không khớp SP (24/10/2026, thay "Dùng tên khác") */
.of-zoom { position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; cursor: zoom-out; }
.of-zoom img { max-width: 92vw; max-height: 82vh; border-radius: 12px; background: #fff; object-fit: contain; }
.of-zoom-cap { color: #fff; font-size: 14px; }
@media (max-width: 768px) {
  .of2-dd { min-width: 0; }
  .of-dd { left: 8px !important; right: 8px; width: auto !important; }
  .of2-tbl tr.of2-empty-tr, .of2-tbl tr:has(td[colspan]) {
    display: block !important;
    border: 1px dashed var(--border) !important;
    border-radius: 8px !important;
    padding: 14px 10px !important;
    margin-bottom: 6px;
    text-align: center;
  }
  .of2-tbl tr.of2-empty-tr td, .of2-tbl tr:has(td[colspan]) td {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    white-space: normal !important;
  }
}
/* lệnh nhiều SP (19/10/2026): phiếu FULL màn hình; bảng vật tư trong khung SP không tràn (cuộn ngang trong khung nếu quá hẹp) */
.modal { min-width: 0; }
.modal.wide { width: 100%; }
.ln-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.ln-bom-w { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; }
.ln-bom-w .ln-bom { margin: 0; width: 100%; min-width: 420px; font-size: 12px; border-collapse: collapse; }
.ln-bom-w .ln-bom th { white-space: nowrap; padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--border); }
.ln-bom-w .ln-bom td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.ln-bom-w .ln-bom tr:last-child td { border-bottom: 0; }
.ln-bom-w .ln-bom td.num { white-space: nowrap; text-align: right; }
.ln-bom-w .ln-bom td:first-child { min-width: 120px; }
.ln-card .stage-act { flex-wrap: wrap; }
@media (max-width: 768px) {
  .ln-bom-w .ln-bom,
  .modal .ln-bom-w .ln-bom { display: table !important; width: 100% !important; min-width: 420px !important; }
  .ln-bom-w .ln-bom thead,
  .modal .ln-bom-w .ln-bom thead { display: table-header-group !important; }
  .ln-bom-w .ln-bom tbody,
  .modal .ln-bom-w .ln-bom tbody { display: table-row-group !important; }
  .ln-bom-w .ln-bom tr,
  .modal .ln-bom-w .ln-bom tr { display: table-row !important; padding: 0 !important; }
  .ln-bom-w .ln-bom td, .ln-bom-w .ln-bom th,
  .modal .ln-bom-w .ln-bom td, .modal .ln-bom-w .ln-bom th { display: table-cell !important; padding: 6px 8px !important; }
  .ln-bom-w .ln-bom td::before,
  .modal .ln-bom-w .ln-bom td::before { display: none !important; }
  .ln-card { padding: 10px; }
}
/* phiếu to (lệnh nhiều SP): phủ phần nội dung, CHỪA thanh menu trái (19/10/2026 — người dùng: "full đến cột bên trái thôi"); điện thoại không có menu trái → hết màn */
.modal.wide { width: calc(100% - var(--side-w)); }
@media (max-width: 768px) { .modal.wide { width: 100%; } }
/* mã tem 15 số (19/10/2026) */
.sr-grp { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.sr-hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.sr-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.sr-btns .btn { width: 100%; justify-content: center; }
.sr-codes { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; }
.sr-code { font: 600 12.5px ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; letter-spacing: .3px; }

/* Nút tạo phiếu GHIM góc dưới phải — CHỈ điện thoại (19/10/2026; máy tính giữ nút trong thanh công cụ như cũ):
   1 nút: .ship-fab (Gửi lên công ty, Lệnh sản xuất); nhiều nút: khung .fab-bar (Kho vật tư, Nhập kho, Xuất kho, Vật tư hư hỏng) —
   máy tính .fab-bar là display: contents (các nút nằm thẳng trong thanh công cụ) */
.fab-bar { display: contents; }
.pq-fab { display: none !important; }
@media (max-width: 768px) {
  .pq-fab { display: none !important; }
  .ship-fab { position: static; height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; box-shadow: none; width: auto; }
  .fab-bar { display: flex; flex-wrap: wrap; gap: 6px; }
  .fab-bar .btn { height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; box-shadow: none; }
  .page { padding-bottom: 84px !important; }
}

/* Hộp quét mã QR / mã vạch sản phẩm (tenin/xuong.js, 22/10/2026) */
.scan-box { width: min(560px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column; overflow: hidden; }
.scan-body { overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.scan-cam-wrap { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: #000; min-height: 160px; max-height: 200px; height: 180px; display: flex; align-items: center; justify-content: center; }
.scan-cam-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 12% 14%; border: 2px solid #22c55e; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .4); pointer-events: none; }
.scan-frame::after { content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #22c55e; box-shadow: 0 0 8px #22c55e; animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 15%; } to { top: 85%; } }
.scan-input-wrap { display: flex; gap: 6px; align-items: center; }
.scan-input-wrap .input { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; height: 36px; }
.scan-input-wrap .btn { height: 36px; padding: 0 14px; font-size: 13px; flex: none; }
.scan-msg { padding: 6px 10px; border-radius: 7px; font-size: 12.5px; line-height: 1.4; }
.scan-msg.ok { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.scan-msg.err { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.scan-cam-err { position: absolute; inset: 0; background: rgba(15, 23, 42, .9); color: #fff; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: 13px; z-index: 5; }
.scan-cam-ctrls { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 5; }
.scan-cam-ctrls .btn, .btn-cam-toggle { padding: 5px 12px; font-size: 12px; font-weight: 700; background: rgba(15, 23, 42, .85); color: #fff; border: 1px solid rgba(255, 255, 255, .4); border-radius: 8px; backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.scan-cam-ctrls .btn:hover, .btn-cam-toggle:hover { background: rgba(15, 23, 42, 1); border-color: #38bdf8; }
.scan-cam-wrap.cam-off { min-height: 84px !important; height: auto !important; max-height: 110px !important; background: #f0fdf4 !important; border: 1.5px dashed #16a34a !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.scan-cam-wrap.cam-off video, .scan-cam-wrap.cam-off .scan-frame { display: none !important; }
.scan-cam-wrap.cam-off .scan-cam-ctrls { display: none !important; }
.scan-pda-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 14px; text-align: center; width: 100%; }
.scan-pda-badge { font-size: 13px; font-weight: 700; color: #15803d; display: inline-flex; align-items: center; gap: 5px; }
.scan-pda-sub { font-size: 11.5px; color: #64748b; line-height: 1.3; }
.scan-pda-placeholder .btn { margin-top: 4px; height: 28px; padding: 0 10px; font-size: 11.5px; }

/* ==================== CHẾ ĐỘ MÁY QUÉT PDA SIÊU GỌN ==================== */
.pda-mode {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  background: #f8fafc !important;
  overflow: hidden !important;
}
.pda-mode .scan-cam-wrap,
.pda-mode .xl-scan-cam-wrap,
.pda-mode .scan-input-wrap,
.pda-mode .xl-scan-input-wrap,
.pda-mode .lsx-checklist-sec,
.pda-mode .lsx-scan-summary,
.pda-mode .xl-scan-tbl-wrap,
.pda-mode .os-list,
.pda-mode .os-cust,
.pda-mode #rss-scan-table,
.pda-mode #ret-scan-table,
.pda-mode #ret-man,
.pda-mode .ret-man-btn,
.pda-mode #rss-scan-feedback,
.pda-mode #ret-scan-feedback,
.pda-mode #lsx-scan-feedback,
.pda-mode .scan-msg,
.pda-mode .desktop-only-scan {
  display: none !important;
}
.pda-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding: 8px 12px;
  overflow-y: auto;
}
.pda-hero {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.pda-hero-nums {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}
.pda-count {
  font-size: 34px;
  font-weight: 800;
  color: #15803d;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pda-total {
  font-size: 20px;
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}
.pda-unit {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  margin-left: 2px;
}
.pda-bar {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 2px 0;
}
.pda-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.pda-status {
  font-size: 11.5px;
  font-weight: 600;
  color: #15803d;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pda-feedback {
  background: #ffffff;
  border: 2px solid #22c55e;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
  flex-shrink: 0;
}
.pda-feedback.err {
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
  background: #fef2f2;
}
.pda-feedback.warn {
  border-color: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
  background: #fffbeb;
}
.pda-feedback.idle {
  border: 1.5px dashed #cbd5e1;
  box-shadow: none;
  background: #f8fafc;
  color: #64748b;
  justify-content: center;
}
.pda-fb-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.pda-fb-body {
  flex: 1;
  min-width: 0;
}
.pda-fb-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.pda-feedback.err .pda-fb-title {
  color: #b91c1c;
}
.pda-feedback.warn .pda-fb-title {
  color: #b45309;
}
.pda-fb-sub {
  font-size: 12px;
  color: #475569;
  font-weight: 500;
  margin-top: 1px;
}
.pda-feedback.err .pda-fb-sub {
  color: #dc2626;
}
.pda-feedback.warn .pda-fb-sub {
  color: #d97706;
}
.pda-prod-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}
.pda-prod-card {
  background: #ffffff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pda-prod-card.done {
  background: #f0fdf4;
  border-color: #86efac;
}
.pda-pname {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.pda-prod-card.done .pda-pname {
  color: #166534;
}
.pda-pqty {
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  white-space: nowrap;
}
.pda-prod-card.done .pda-pqty {
  color: #15803d;
}
.pda-mode .lsx-scan-foot,
.pda-mode .modal-f,
.pda-mode .xl-scan-foot,
.lsx-scan-foot {
  margin-top: auto !important;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)) !important;
  background: #ffffff !important;
  border-top: 1px solid var(--border, #e2e8f0) !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  grid-template-columns: none !important;
  gap: 8px !important;
}
.pda-mode .lsx-view-tem-btn {
  display: none !important;
}
.pda-mode .btn-pda-confirm,
.lsx-scan-foot .btn-pda-confirm {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  height: 44px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding: 0 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.pda-mode .btn-pda-close,
.lsx-scan-foot .btn-pda-close {
  flex: 0 0 65px !important;
  width: 65px !important;
  min-width: 65px !important;
  max-width: 65px !important;
  height: 44px !important;
  font-size: 13px !important;
  padding: 0 !important;
  justify-content: center !important;
  text-align: center !important;
  border-radius: 10px !important;
}

/* Hộp quét QR nhập kho lệnh sản xuất (tenin/xuong.js, 23/10/2026) */
.lsx-scan-box { width: min(560px, 100%); }
.lsx-scan-h { padding: 10px 14px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lsx-scan-title { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lsx-scan-summary { background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; }
.lsx-scan-prog-bar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.lsx-scan-prog-fill { height: 100%; transition: width .3s ease; }
.lsx-scan-prod-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.lsx-scan-pill { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #fff; border: 1px solid var(--border); line-height: 1.3; }
.lsx-scan-pill.done { background: #dcfce7; border-color: #86efac; color: #15803d; font-weight: 600; }
.scan-alert-switch { background: #fff7ed; border: 1.5px solid #fdba74; border-radius: 9px; padding: 10px 12px; }

/* Danh sách tem quét dạng bảng có bộ lọc */
.lsx-checklist-sec { display: flex; flex-direction: column; min-width: 0; }
.lsx-checklist-hd { margin-bottom: 6px; }
.lsx-tabs-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; width: 100%; }
.lsx-filter-pills { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lsx-ftab { font-size: 11.5px; font-weight: 500; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all .15s ease; user-select: none; }
.lsx-ftab:hover { border-color: var(--primary); color: var(--text); }
.lsx-ftab.active { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; font-weight: 700; }
.lsx-ftab.done.active { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.lsx-ftab.remain.active { background: #fefce8; border-color: #fde047; color: #a16207; }
.lsx-ftab.pending.active { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.lsx-ftab .cnt { font-weight: 700; font-size: 11px; }

.lsx-serials-table-wrap { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.lsx-serials-table-wrap table { margin: 0; width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lsx-serials-table-wrap th { position: sticky; top: 0; background: #f8fafc; z-index: 2; padding: 7px 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.lsx-serials-table-wrap td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lsx-serials-table-wrap tr:last-child td { border-bottom: 0; }
.lsx-row-done { background: #f0fdf4 !important; }
.lsx-row-done td { color: #166534; }
.lsx-row-pending { background: #fefce8 !important; }
.lsx-row-pending td { color: #854d0e; }
.lsx-scan-pill.active { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; font-weight: 700; box-shadow: 0 0 0 1.5px #3b82f6; }

.lsx-scan-foot {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important;
}
.lsx-scan-foot .btn { height: 44px !important; font-size: 13.5px !important; justify-content: center !important; }

/* Footer lệnh sản xuất: PC đủ nút riêng rẽ ngang hàng, Mobile nút Quét QR full hàng nổi bật */
.order-foot-wrap, .order-foot-primary, .order-foot-actions {
  display: contents;
}

@media (max-width: 768px) {
  .lsx-scan-box { width: 100% !important; max-height: 100dvh !important; height: 100dvh !important; border-radius: 0 !important; }
  .scan-cam-wrap { min-height: 140px; max-height: 150px; height: 145px; border-radius: 10px; }
  .scan-cam-wrap video { max-height: 150px; }
  .scan-frame { inset: 8% 12%; border-radius: 8px; }
  .lsx-serials-table-wrap { max-height: 190px; }
  .lsx-tabs-row { gap: 4px; }
  .lsx-ftab { font-size: 11px; padding: 2px 6px; }

  .modal-f:has(.order-foot-wrap) {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important;
  }
  .order-foot-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .order-foot-primary {
    display: block !important;
    width: 100% !important;
    order: 1;
  }
  .order-foot-primary .btn {
    width: 100% !important;
    height: 42px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    justify-content: center !important;
    border-radius: 9px !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
  }
  .order-foot-actions {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    order: 2;
  }
  .order-foot-actions .btn {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    height: 36px !important;
    font-size: 12.5px !important;
    padding: 0 10px !important;
    justify-content: center !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
  }
}


/* Lời chúc 20/10 — Ngày Phụ nữ Việt Nam (20/10/2026, chỉ hôm nay): nền hồng, hoa rơi, chữ 20/10 to */
.nt-sky.nt-wd { background: linear-gradient(180deg, #fce7f3 0%, #f9a8d4 60%, #ec4899 100%); overflow: hidden; }
.nt-fl { position: absolute; top: -24px; font-size: 20px; animation: nt-fl-fall 5.5s linear infinite; }
@keyframes nt-fl-fall { from { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: 1; } to { transform: translateY(150px) rotate(220deg); opacity: .2; } }
/* logo Klasse (khung trắng) + chữ 20/10 cạnh nhau, giữa nền hồng — đường dẫn tương đối assets/ (Xưởng có bản sao tenin/assets) */
.nt-wd-row { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 16px; z-index: 1; animation: nt-wd-pop .9s cubic-bezier(.2, 1.4, .4, 1) both; }
/* logo nhỏ ở góc trên bên trái (người dùng: "logo ở góc thôi"), chữ 20/10 giữa */
.nt-wd-logo { position: absolute; left: 12px; top: 12px; z-index: 2; display: flex; align-items: center; background: #fff; border-radius: 10px; padding: 5px 8px; box-shadow: 0 4px 12px rgba(190, 24, 93, .25); }
.nt-wd-logo img { height: 22px; width: auto; display: block; }
.nt-wd-big { font: 900 44px/1 Inter, system-ui, sans-serif; color: #fff; letter-spacing: 1px; text-shadow: 0 3px 14px rgba(190, 24, 93, .55); }
@keyframes nt-wd-pop { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
.nt-wd .nt-time { color: #fff; text-shadow: 0 2px 10px rgba(190, 24, 93, .5); }
.nt-wish.nt-wish-wd { color: #be185d; }
.nt-tips.nt-tips-wd span { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.nt-btn.nt-btn-wd { background: #ec4899; border-color: #ec4899; }
.nt-btn.nt-btn-wd:hover { background: #db2777; border-color: #db2777; }
@media (prefers-reduced-motion: reduce) { .nt-fl, .nt-wd-row { animation: none; } .nt-fl { display: none; } }
.btn.sr-view { margin-top: 5px; height: 26px; padding: 0 9px; font-size: 12px; }
/* Chọn SP lệnh sản xuất trên điện thoại (20/10/2026): màn chọn toàn màn hình, bàn phím bật không làm mất danh sách */
.of-dd.of-dd-mob { inset: 0 !important; left: 0 !important; right: 0 !important; width: auto !important; max-height: none; height: 100dvh; border-radius: 0; z-index: 2100; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.of-dd-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 4px; }
.of-dd-hd b { font-size: 15px; }
.of-dd-mob > .input { height: 42px; font-size: 16px; }   /* 16px: iPhone không tự phóng to khi bấm ô */
.sent-next-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sent-next-btns .btn { justify-content: center; height: 44px; }
.sent-next-btns:not(:has(.btn + .btn)) { grid-template-columns: 1fr; }

/* Lịch sử phiếu order / phiếu gửi (21/10/2026) — chung Klasse + Xưởng */
.xh-list { display: flex; flex-direction: column; }
.xh-it { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.xh-it:last-child { border-bottom: 0; }
.xh-ic { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.xh-b { flex: 1; min-width: 0; }
.xh-s { font-weight: 600; font-size: 13.5px; }
.xh-m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.xh-b ul { margin: 6px 0 0 16px; font-size: 12.5px; color: var(--text); }
.xh-b li { margin: 2px 0; overflow-wrap: anywhere; }
.xh-app { font-weight: 700; } .xh-app.x { color: #b45309; } .xh-app.k { color: #2563eb; }
.xh-empty { padding: 24px; text-align: center; color: var(--muted); }

/* 24/10/2026: phiếu đã gửi quá 48 giờ chưa nhận · chọn SP cho tem mới khi nhập phiếu hoàn · nhập điều chỉnh / kiểm kê */
.badge.req-overdue { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; font-weight: 700; white-space: nowrap; }
.ret-ask { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ret-ask .btn { font-weight: 600; }
.adj-plist { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.adj-prow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.adj-prow:last-child { border-bottom: 0; }
.adj-prow:hover { background: #f8fafc; }

/* Lưới thông tin chi tiết: chữ dài (tên, mã, giờ) xuống dòng thay vì tràn (24/10/2026) */
.info-grid > div { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
/* Bảng BOM vật tư cuộn ngang: bóng mờ mép phải báo còn cột bên phải (tự mất khi cuộn tới cuối) */
.ln-bom-w {
  position: relative;
  background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)), linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .15), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .15), rgba(0, 0, 0, 0)) 100% 0;
  background-repeat: no-repeat; background-color: #fff;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* ===== Điện thoại — tối ưu giao diện (24/10/2026) ===== */
@media (max-width: 768px) {
  .dash-return-banner { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  .dash-return-banner .btn { width: 100%; height: 38px; justify-content: center; }
  .btn.sm.sr-view { height: 32px; padding: 0 10px; font-size: 12.5px; margin-top: 4px; }
  .use-ctl .select, .use-ctl .input { height: 34px; font-size: 13px; }
  .modal-f > .req-lack-btn { grid-column: 1 / -1; height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .scan-cam-wrap { height: 130px; min-height: 120px; max-height: 135px; }
  .scan-cam-wrap video { max-height: 135px; }
  .lsx-serials-table-wrap { max-height: 210px; }
}
@media (max-width: 400px) {
  .info-grid > .ig-wide { grid-column: 1 / -1; }   /* mục "người · giờ" dài → cả hàng */
}

/* ===== Form Lệnh sản xuất trên điện thoại — thiết kế lại (24/10/2026, người dùng: "khó hiểu và xấu") =====
   Mỗi thành phẩm / mỗi vật tư = 1 thẻ: hàng trên là ô chọn + nút ×, hàng dưới các ô số CÓ NHÃN (Mã SP · Số lượng SX · Tồn xưởng /
   Định mức / 1 SP · Cần cả dòng · Sẵn có); ghi chú vật tư cả hàng; dòng Tổng gọn 1 hàng (trước bị bọc thành khung nét đứt to). */
.of2-ml, .of2-ml-i { display: none; }
@media (max-width: 768px) {
  .of2-ml { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; text-align: left; white-space: nowrap; }
  .of2-ml-i { display: inline; }
  .of2-mv { display: flex; align-items: center; height: 38px; font-weight: 700; font-size: 14px; }
  #modal .of2-tbl tbody tr { display: grid !important; gap: 8px 8px !important; padding: 10px 10px 12px !important; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); align-items: end; }
  #modal .of2-tbl td { display: block; padding: 0 !important; border: 0 !important; min-width: 0 !important; width: auto !important; text-align: left; }
  #modal .of2-tbl .input, #modal .of2-tbl .select { height: 38px; font-size: 14px; width: 100% !important; min-width: 0 !important; }
  #modal .of2-tbl .of2-qty { text-align: right; font-weight: 700; }
  #modal .of2-tbl .x { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg); font-size: 20px; }
  /* thẻ thành phẩm */
  #modal #of2-rows tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) 36px; grid-template-areas: "name name name x" "code qty stock ."; }
  #modal #of2-rows tr.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
  #modal #of2-rows tr.on td:first-child { box-shadow: none; }
  #modal #of2-rows td { background: transparent !important; }
  #modal #of2-rows td:nth-child(1) { display: none; }
  #modal #of2-rows td:nth-child(2) { grid-area: name !important; }
  #modal #of2-rows td:nth-child(3) { grid-area: code !important; }
  #modal #of2-rows td:nth-child(4) { grid-area: qty !important; }
  #modal #of2-rows td:nth-child(5) { grid-area: stock !important; display: block !important; }
  #modal #of2-rows td:nth-child(6) { grid-area: x !important; align-self: start; }
  #modal .of2-dd { height: 44px; }
  /* dòng Tổng */
  #modal .of2-tbl tfoot tr.of2-foot { display: flex !important; justify-content: space-between; align-items: center; border: 0 !important; border-radius: 0 !important;
    padding: 2px 4px 10px !important; margin: 0; background: transparent; text-align: left; }
  #modal .of2-tbl tfoot tr.of2-foot td { display: block !important; width: auto !important; font-size: 13px !important; text-align: left !important; }
  #modal .of2-tbl tfoot tr.of2-foot td:empty { display: none !important; }
  #modal .of2-tbl tfoot tr.of2-foot #of2-sum { font-size: 16px !important; color: var(--text); }
  /* thẻ vật tư */
  /* 24/10/2026: bỏ ô "Sẵn có" (tên vật tư trong ô chọn đã kèm Tồn) → Định mức + Cần cả dòng chia đôi hàng */
  #modal .of2-btbl tbody tr:not(.of2-empty-tr) { grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr) 40px; grid-template-areas: "mat mat mat x" "per per need need" "note note note note"; }
  #modal .of2-btbl td:nth-child(1) { display: none; }
  #modal .of2-btbl td:nth-child(2) { grid-area: mat !important; }
  #modal .of2-btbl td:nth-child(3) { grid-area: per !important; }
  #modal .of2-btbl td:nth-child(4) { grid-area: need !important; color: inherit; font-size: inherit; }
  #modal .of2-btbl td:nth-child(5) { display: none !important; }
  #modal .of2-btbl td:nth-child(4).need-bad .of2-mv { color: var(--danger); }
  #modal .of2-btbl td:nth-child(6) { grid-area: note !important; }
  #modal .of2-btbl td:nth-child(6) .input { height: 34px; font-size: 13px; }
  #modal .of2-btbl td:nth-child(7) { grid-area: x !important; align-self: start; }
}

@media (max-width: 768px) {
  /* dòng trống "Chưa có vật tư…" (td colspan): KHÔNG xếp thẻ lưới — trước bị ép vào 1 ô hẹp → chữ dọc từng từ */
  #modal .of2-tbl tbody tr.of2-empty-tr { display: block !important; padding: 14px 12px !important; border: 1px dashed var(--border); }
  #modal .of2-tbl tbody tr.of2-empty-tr td { display: block !important; width: 100% !important; text-align: center !important; white-space: normal !important; }
}
@media (max-width: 768px) {
  /* 24/10/2026 (lần 3, người dùng: "hiển thị xấu"): thẻ vật tư gọn, cân đối — 2 ô cùng cỡ, số căn phải, "Cần cả dòng" là ô nền xám chỉ xem;
     bảng + thẻ không vượt bề ngang hộp (trước thẻ tràn mép phải trên máy màn rộng) */
  #modal .of2, #modal .of2-l, #modal .of2-r, #modal .of2-tw, #modal #of2-bom { max-width: 100%; min-width: 0; overflow-x: hidden; }
  #modal .of2-tbl, #modal .of2-tbl tbody, #modal .of2-tbl tfoot { display: block; width: 100%; }
  #modal .of2-btbl tbody tr:not(.of2-empty-tr) { gap: 6px 10px !important; padding: 10px !important; border-radius: 12px; background: var(--surface); }
  #modal .of2-btbl td:nth-child(3), #modal .of2-btbl td:nth-child(4) { align-self: stretch; }
  #modal .of2-btbl .of2-ml { font-size: 11.5px; margin-bottom: 4px; }
  #modal .of2-btbl td:nth-child(3) .of2-qty { height: 40px; border-radius: 10px; font-size: 15px; }
  #modal .of2-btbl td:nth-child(4) .of2-mv { height: 40px; justify-content: flex-end; padding: 0 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 15px; color: var(--text); }
  #modal .of2-btbl td:nth-child(4).need-bad .of2-mv { color: var(--danger); background: #fef2f2; border-color: #fecaca; }
  #modal .of2-btbl td:nth-child(6) .input { height: 36px; border-radius: 10px; background: var(--bg); border-color: transparent; }
  #modal .of2-btbl td:nth-child(6) .input:focus { background: var(--surface); border-color: var(--primary); }
  #modal .of2-btbl td:nth-child(7) .x { width: 40px; height: 40px; }
  #modal .of2-btbl td:nth-child(2) .uxd-btn, #modal .of2-btbl td:nth-child(2) .select { height: 40px !important; border-radius: 10px !important; }
}

/* Tồn ảo (24/10/2026): 5 chỉ số tồn ở hộp tồn SP, danh sách phiếu đang giữ, tab Thẻ kho / Lịch sử giữ chỗ, nhãn Thiếu tồn ở phiếu chờ */
.ps-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.kpi.ps-hold { cursor: pointer; border-color: #fdba74; background: #fff7ed; }
.kpi.ps-hold .v { color: #c2410c; }
.ps-hold-box { margin-top: 10px; border: 1px solid #fed7aa; background: #fffaf5; border-radius: 10px; padding: 10px; }
.ps-hold-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid #ffedd5; cursor: pointer; flex-wrap: wrap; }
.ps-hold-row:first-of-type { border-top: 0; }
.ps-hold-row .small { flex: 1; min-width: 120px; }
/* Bộ lọc 3 mục của hộp tồn SP — gạch chân đơn giản (26/10/2026, thay nút viên thuốc tô xanh) */
.ps-tabs { display: flex; gap: 0; margin: 16px 0 10px; border-bottom: 1px solid var(--border); }
.ps-tabs button { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-radius: 0; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); white-space: nowrap; }
.ps-tabs button:hover { color: var(--text); }
.ps-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.badge.req-lack { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; font-weight: 700; white-space: nowrap; }
@media (max-width: 768px) {
  .ps-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .ps-tabs button { flex: 1 1 0; padding: 8px 4px; font-size: 12.5px; white-space: normal; }
}

/* Nhập thủ công hàng hoàn mất tem (24/10/2026) */
.ret-man-btn { width: 100%; justify-content: center; margin: 8px 0 4px; border-style: dashed; font-weight: 600; }
.ret-man { border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.ret-man-hd { font-size: 12.5px; color: #92400e; margin-bottom: 8px; }
.ret-man-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 110px minmax(0, 1.4fr); gap: 8px; align-items: end; padding: 8px 0; border-top: 1px solid #fef3c7; }
.ret-man-row:first-of-type { border-top: 0; }
.ret-man-n { display: flex; flex-direction: column; min-width: 0; }
.ret-man-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ret-man-q, .ret-man-r { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ret-man-q .input { text-align: right; font-weight: 700; }
@media (max-width: 768px) {
  .ret-man-row { grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "n n" "q r"; }
  .ret-man-n { grid-area: n; } .ret-man-q { grid-area: q; } .ret-man-r { grid-area: r; }
}

/* Vật tư đang cấp cho lệnh SX (24/10/2026) */
.mat-alloc { color: #c2410c; font-weight: 700; }
.kpi.mat-alloc-k { cursor: pointer; border-color: #fdba74; background: #fff7ed; }
.kpi.mat-alloc-k .v { color: #c2410c; }
.mat-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
@media (max-width: 1100px) { .mat-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 768px) { .mat-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Báo hỏng thành phẩm có tem (24/10/2026) */
.btn.danger-soft { background: #fef2f2; border-color: #fecaca; color: #b91c1c; font-weight: 600; }
.scrap-card { border: 1px solid #fecaca; background: #fff; border-radius: 10px; padding: 12px; margin-top: 8px; }
.scrap-hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.scrap-code { font: 700 14px ui-monospace, Menlo, monospace; }
.scrap-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#scrap-cam { margin-bottom: 8px; }
.badge.tem-scrap { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* Chấm trạng thái kết nối realtime (24/10/2026) */
.rt-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; margin-right: 8px; cursor: pointer; background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.rt-dot.ok { background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.rt-dot.off { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.rt-dot.wait { animation: rt-pulse 1.2s ease-in-out infinite; }
@keyframes rt-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rt-dot.wait { animation: none; } }
/* iPhone: chân hộp / màn quét (24/10/2026) */
@media (max-width: 768px) {
  .modal-f { padding-bottom: 12px !important; }
  .scan-body { padding-bottom: 14px !important; }
  .lsx-scan-foot { padding-bottom: 12px !important; }
}

/* ===== Điện thoại: chữ trong nút không tràn / không bị cắt "…" (24/10/2026, rà toàn bộ nút ở 375px) =====
   Chân hộp trước chia cột tối thiểu 96px → "📷 Quét QR nhập kho", "📷 Quét QR nhập" tràn ra ngoài nút; nút dài trên thanh công cụ
   ("⚖️ Nhập điều chỉnh / Kiểm kê", "⚠️ Báo hỏng thành phẩm có tem") bị cắt "…". Giờ: cột ≥ 120px, chữ dài xuống tối đa 2 dòng. */
@media (max-width: 768px) {
  .modal-f { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important; }
  .lsx-scan-foot, .pda-mode .modal-f, .pda-mode .lsx-scan-foot {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    grid-template-columns: none !important;
  }
  .modal-f .btn, .toolbar .btn, .fab-bar .btn, .scan-input-wrap .btn {
    white-space: normal !important; text-overflow: clip !important; overflow: visible !important;
    height: auto !important; min-height: 38px; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; overflow-wrap: anywhere; text-align: center; justify-content: center;
  }
}
@media (max-width: 768px) {
  .toolbar > .btn.btn-row-m { flex: 1 1 100% !important; width: 100%; }   /* nút chữ dài: cả 1 hàng riêng */
  .fab-bar > .btn.btn-row-m { grid-column: 1 / -1; }
}

/* Điện thoại: bảng danh sách tem trong màn quét (gửi hàng / nhận hàng hoàn / quét nhập kho) rộng hơn màn hình
   → cột cuối bị cắt, phải kéo ngang (24/10/2026). Thu lề ô, cho chữ / nhãn xuống dòng để bảng vừa khung. */
@media (max-width: 768px) {
  .lsx-serials-table-wrap { overflow-x: hidden; }
  .lsx-serials-table-wrap table { table-layout: auto; }
  .lsx-serials-table-wrap th, .lsx-serials-table-wrap td { padding: 6px 5px; }
  .lsx-serials-table-wrap th { white-space: normal; }
  .lsx-serials-table-wrap th:first-child, .lsx-serials-table-wrap td:first-child { width: 22px !important; padding-left: 4px; padding-right: 2px; }
  .lsx-serials-table-wrap th:last-child[style*="width:40px"], .lsx-serials-table-wrap td:last-child { padding-left: 2px; padding-right: 4px; }
  .lsx-serials-table-wrap td { overflow-wrap: anywhere; }
  .lsx-serials-table-wrap td.nowrap { white-space: normal; word-break: break-all; }
  .lsx-serials-table-wrap .badge { white-space: normal; text-align: center; line-height: 1.2; }
}

/* Điện thoại — rà theo hướng dẫn mobile-design (25/10/2026): ô gõ chữ ≥ 16px (chữ < 16px thì iPhone tự phóng to trang khi bấm ô),
   nút ≥ 40px / nút nhỏ ≥ 34px, nút giao diện mùa 40×40, nhãn thanh dưới 11px */
@media (max-width: 768px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=button]):not([type=submit]),
  textarea { font-size: 16px !important; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .top-right .theme-toggle-btn { width: 40px; height: 40px; }
  .bottom-nav a .lb { font-size: 10px; letter-spacing: -0.2px; max-width: 82px; }
}

/* Chân chi tiết phiếu order đang chờ (điện thoại, 25/10/2026 — người dùng): Lịch sử | Từ chối chung 1 hàng (2 nút bằng nhau),
   dưới là Tạo lệnh sản xuất SP thiếu, rồi 📷 Quét QR cả hàng — to bằng nút Tạo lệnh */
@media (max-width: 768px) {
  .modal-f:has(> #req-send) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .modal-f:has(> #req-send) > .btn { order: 1; }
  .modal-f:has(> #req-send) > .req-lack-btn { order: 3; grid-column: 1 / -1; height: 44px; }
  .modal-f:has(> #req-send) > #req-send { order: 4; grid-column: 1 / -1; height: 44px; font-weight: 700; }
}

/* Dòng hàng phiếu order đang chờ (điện thoại, 25/10/2026 — người dùng): "Tồn" lên cùng hàng tên SP (góc phải),
   SL order | SL gửi chung 1 hàng dưới. Thứ tự ô gốc: tên · SL order · Tồn sẵn có · SL gửi · ghi chú (dòng là lưới 2 cột) */
@media (max-width: 768px) {
  .modal .tbl.req-items.req-pend tr { position: relative; }
  .modal .tbl.req-items.req-pend td:nth-child(1) { grid-column: 1 / -1; padding-right: 76px; }
  .modal .tbl.req-items.req-pend td:nth-child(3) { position: absolute; top: 12px; right: 0; flex-direction: row; align-items: center;
    gap: 4px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
  .modal .tbl.req-items.req-pend td:nth-child(3)::before { content: 'Tồn'; font-size: 12px; font-weight: 500; }
  .modal .tbl.req-items.req-pend td:nth-child(n+5) { grid-column: 1 / -1; }
}

/* Giảm chuyển động (25/10/2026): bỏ quãng trượt / nhoè, giữ mờ dần */
@media (prefers-reduced-motion: reduce) {
  @keyframes slide { from { opacity: 0; } }
  .modal-bg.out .modal { transform: none; }
  .toast, .toast.show { filter: none; animation: none; transform: translateX(-50%); }
}

/* ==================== TỔNG QUAN TRÊN MÁY QUÉT iData (26/10/2026) ==================== */
.ret-box { margin-bottom: 14px; }
.ret-box.card { padding: 0; overflow: hidden; }
.ret-box .card-h { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ret-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ret-row:last-child { border-bottom: 0; }
.ret-main { flex: 1; min-width: 0; cursor: pointer; }
.ret-main .small { margin-top: 2px; line-height: 1.35; }
.ret-row .btn { flex: none; white-space: nowrap; }
.ret-box .empty { padding: 14px; }

/* PDA Custom Styling */
.pda-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.pda-kpi-card {
  padding: 10px 12px !important;
  border-radius: 12px !important;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.1s ease;
  min-height: 84px;
}
.pda-kpi-card:active { transform: scale(0.97); }
.pda-kpi-card.blue { border-left: 4px solid var(--primary); }
.pda-kpi-card.warn { border-left: 4px solid #f59e0b; }
.pda-kpi-card.danger { border-left: 4px solid #ef4444; }
.pda-kpi-card.good { border-left: 4px solid #10b981; }

.pda-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.pda-kpi-ic { font-size: 18px; line-height: 1; }
.pda-kpi-val { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1; }
.pda-kpi-title { font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.25; }
.pda-kpi-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.2; }

.pda-sec { margin-bottom: 16px; }
.pda-sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
}
.pda-wh-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}
.pda-wh-item:active { background: #f8fafc; }
.pda-wh-item.order-item { border-left: 4px solid var(--primary); }
.pda-wh-item.ret-item { border-left: 4px solid #f59e0b; }
.pda-wh-item.lsx-item { border-left: 4px solid #10b981; }
.pda-wh-item-main { flex: 1; min-width: 0; }
.pda-wh-item-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.pda-wh-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
  font-size: 13.5px;
  color: var(--primary);
}
.pda-wh-cust {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.pda-wh-prods {
  font-size: 11.5px;
  color: #475569;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pda-wh-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.btn-pda-scan-act {
  height: 34px !important;
  padding: 0 12px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  flex: none !important;
  white-space: nowrap !important;
  border-radius: 8px !important;
}
.btn-pda-top-scan {
  width: 100% !important;
  height: 46px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* ===== POPUP MÃ QR CỦA 1 TEM (hộp tồn SP → Danh sách mã QR, 26/10/2026) ===== */
.ps-qr-code { font-size: 13.5px; letter-spacing: .3px; color: var(--primary); text-decoration: none; cursor: pointer; }
.ps-qr-code:hover { text-decoration: underline; }
.psqr-pop { position: fixed; inset: 0; z-index: 9950; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.psqr-card { position: relative; background: #fff; color: #0f172a; border-radius: 16px; padding: 20px 18px 16px; width: min(360px, 100%); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.psqr-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f1f5f9; cursor: pointer; font-size: 15px; }
.psqr-name { font-weight: 700; font-size: 15px; padding: 0 30px; }
.psqr-img { margin: 12px auto 8px; width: min(260px, 72vw); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #fff; }
.psqr-img img { width: 100%; height: 100%; image-rendering: pixelated; }
.psqr-code { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.psqr-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* Grid hiển thị mã QR thành phẩm phiếu order gửi (28/10/2026) */
.req-qr-card { transition: border-color .15s, box-shadow .15s; }
.req-qr-card:hover { border-color: #cbd5e1 !important; box-shadow: 0 4px 10px rgba(0, 0, 0, .07) !important; }
.req-qr-img-wrap { transition: transform .15s, background-color .15s, border-color .15s; }
.req-qr-img-wrap:hover { transform: scale(1.04); background: #eff6ff !important; border-color: #bfdbfe !important; }


/* Chân hộp tồn thành phẩm (30/10/2026): máy tính — mọi nút 1 hàng, không xuống dòng */
@media (min-width: 769px) {
  .modal-f:has(> .ps-foot-sp) { flex-wrap: nowrap; gap: 6px; }
  .modal-f:has(> .ps-foot-sp) > .btn { padding: 0 10px; white-space: nowrap; flex-shrink: 0; }
}
