/* App-shell iTN Store (25/09/2026) — thanh bên desktop, tab đáy iPhone, bảng "Thêm", splash, skeleton, chuyển trang.
   Nạp SAU mọi file CSS khác. Chỉ dùng token theme (themes.css) nên đổi theme là đổi theo; không màu cứng ngoài màu cam logo.
   Một số chỗ buộc dùng !important vì quy tắc cũ (styles.css / backend.css / nav.css) đã đặt display/background kèm !important. */

:root, html[data-itn-theme] {
  --sb-w: 248px;
  --sb-bg: var(--theme-header, #0b172b);
  --sb-line: var(--border-color, rgba(151,194,255,.2));
  --sb-text: color-mix(in srgb, var(--text-main, #f7fbff) 82%, var(--bg-card, #111c2f));
  --sb-muted: color-mix(in srgb, var(--text-muted, #9dacc2) 88%, var(--text-main, #f7fbff));
  --sb-hover: var(--theme-header-layer, rgba(255,255,255,.06));
  --sb-active-bg: var(--theme-accent-soft, rgba(71,150,255,.16));
  --sb-active-text: color-mix(in srgb, var(--theme-accent-strong, #1976d2) 60%, var(--text-main, #f7fbff));
  --sb-indicator: var(--theme-accent, #57a7ff);
  --itn-orange: #f28c28;
  --itn-r-sm: 6px; --itn-r-md: 8px; --itn-r-lg: 8px;
  --itn-shadow-1: 0 1px 2px rgba(16, 24, 40, .04);
  --itn-shadow-2: 0 2px 6px rgba(16, 24, 40, .08), 0 12px 28px rgba(16, 24, 40, .10);
  --itn-ease: cubic-bezier(.16, 1, .3, 1);
}
html[data-itn-theme="sapphire"], html[data-itn-theme="graphite"], html[data-itn-theme="gold-noir"] {
  --itn-shadow-1: 0 1px 2px rgba(0,0,0,.22);
  --itn-shadow-2: 0 2px 8px rgba(0,0,0,.35), 0 16px 36px rgba(0,0,0,.35);
}

/* ---------- Khung: nội dung bên phải thanh bên ---------- */
@media (min-width: 1024px) {
  body.itn-shell .main-viewport { margin: 0 0 0 var(--sb-w) !important; max-width: none !important; padding: 16px 28px 48px !important; }
  body.itn-shell .main-viewport > * { max-width: 1480px; margin-left: auto; margin-right: auto; }
  body.itn-shell #app-header { position: sticky; top: 0; z-index: 30; border-radius: var(--itn-r-lg) !important; border: 1px solid var(--sb-line) !important; box-shadow: var(--itn-shadow-1) !important; margin-bottom: 18px !important; }
  body.itn-shell #app-header .header-brand { display: none !important; }
  body.itn-shell #role-control-bar { display: none !important; }
}
@media (min-width: 1024px) and (max-width: 1279px) { :root, html[data-itn-theme] { --sb-w: 84px; } }

/* ---------- Thanh bên ---------- */
body.itn-shell #app-nav.app-nav { display: none; }
@media (min-width: 1024px) {
  html body.itn-shell #app-nav.app-nav {
    position: fixed !important; inset: 0 auto 0 0; z-index: 40; width: var(--sb-w); height: 100dvh; margin: 0 !important;
    display: flex !important; flex-direction: column; flex-wrap: nowrap !important; align-items: stretch; gap: 14px !important;
    padding: max(16px, env(safe-area-inset-top, 0px)) 12px 20px !important; overflow: hidden auto !important;
    background: var(--sb-bg) !important; border: 0 !important; border-right: 1px solid var(--sb-line) !important; border-radius: 0 !important; box-shadow: none !important;
    scrollbar-width: thin; view-transition-name: itn-sidebar;
  }
  body.itn-shell #app-nav .sb-brand { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px 10px; color: var(--text-main); text-decoration: none; font-weight: 750; font-size: 17px; letter-spacing: -.02em; border-bottom: 1px solid var(--sb-line); }
  body.itn-shell #app-nav .sb-brand .itn-mark { min-width: 40px; height: 40px; border-radius: 8px; font-size: 16px; box-shadow: none; }
  body.itn-shell #app-nav .sb-group { display: grid; gap: 2px; }
  body.itn-shell #app-nav .sb-group-t { margin: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--sb-muted); }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item {
    position: relative; display: flex !important; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px !important;
    border-radius: 8px !important; color: var(--sb-text) !important; font-size: 14px !important; font-weight: 600 !important; text-align: left;
    background: transparent !important; text-decoration: none !important; white-space: nowrap;
    transition: background-color .18s var(--itn-ease), color .18s var(--itn-ease);
  }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item .nav-ico { width: 20px; height: 20px; flex: 0 0 20px; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item:hover { background: var(--sb-hover) !important; color: var(--text-main) !important; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item.active,
  html body.itn-shell #app-nav .nav-tab-btn.sb-item[aria-current="page"] { background: var(--sb-active-bg) !important; color: var(--sb-active-text) !important; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item.active::after,
  html body.itn-shell #app-nav .nav-tab-btn.sb-item[aria-current="page"]::after { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; background: var(--sb-indicator); transform: none; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item .nav-badge { margin-left: auto; position: static; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item:focus-visible { outline: 2px solid var(--sb-indicator) !important; outline-offset: -2px; }
}
/* Rail thu gọn 1024–1279px: icon + nhãn nhỏ dưới icon, không mất chữ */
@media (min-width: 1024px) and (max-width: 1279px) {
  html body.itn-shell #app-nav.app-nav { padding-inline: 8px !important; }
  body.itn-shell #app-nav .sb-brand { justify-content: center; padding-inline: 0; }
  body.itn-shell #app-nav .sb-brand .sb-name, body.itn-shell #app-nav .sb-group-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item { flex-direction: column; justify-content: center; gap: 4px; min-height: 58px; padding: 6px 2px !important; font-size: 10.5px !important; text-align: center; white-space: normal; line-height: 1.15; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item .nav-label { max-width: 100%; overflow-wrap: anywhere; }
  html body.itn-shell #app-nav .nav-tab-btn.sb-item .nav-badge { position: absolute; top: 4px; right: 10px; margin: 0; }
  body.itn-shell #app-nav .sb-group + .sb-group { border-top: 1px solid var(--sb-line); padding-top: 6px; }
}

/* ---------- Tab đáy iPhone (<1024px) ---------- */
@media (max-width: 1023px) {
  html body.itn-shell #iphone-bottom-bar.iphone-bottom-bar {
    position: fixed !important; left: 0; right: 0; bottom: 0; z-index: 50; display: grid !important; grid-auto-flow: column; grid-auto-columns: 1fr;
    align-items: stretch; gap: 0; margin: 0 !important; width: auto !important; max-width: none !important; transform: none !important;
    min-height: 0 !important;   /* backend.css cũ ép 68px ở Kho / Bán hàng → hai trang cao khác nhau */
    padding: 0 max(8px, env(safe-area-inset-right, 0px)) var(--itn-tab-duoi) max(8px, env(safe-area-inset-left, 0px)) !important;
    background: color-mix(in srgb, var(--sb-bg) 92%, transparent) !important; -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    border: 0 !important; border-top: 1px solid var(--sb-line) !important; border-radius: 0 !important; box-shadow: 0 -6px 24px rgba(16,24,40,.08) !important;
    view-transition-name: itn-tabbar;
  }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item {
    position: relative; display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-width: 0; min-height: var(--itn-tab-cao) !important;
    padding: 5px 2px 2px !important; margin: 0 !important; border: 0 !important; border-radius: 12px !important; background: transparent !important; box-shadow: none !important;
    color: var(--sb-muted) !important; font-family: inherit !important; font-size: 11px !important; font-weight: 600 !important; line-height: 1.25 !important; text-decoration: none !important; -webkit-tap-highlight-color: transparent;
  }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item svg { width: 24px; height: 24px; flex: none; transition: transform .2s var(--itn-ease); }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item.active,
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item[aria-current="page"] { color: var(--sb-active-text) !important; }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item.active svg,
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item[aria-current="page"] svg { transform: translateY(-1px); }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item.active::before,
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item[aria-current="page"]::before { content: ""; position: absolute; top: 3px; left: 50%; width: 46px; height: 30px; margin-left: -23px; border-radius: 15px; background: var(--sb-active-bg); z-index: -1; }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item:focus-visible { outline: 2px solid var(--sb-indicator) !important; outline-offset: -2px; }
  html body.itn-shell #iphone-bottom-bar .iphone-nav-item .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  body.itn-shell { padding-bottom: 0 !important; min-height: 100dvh; }
  body.itn-shell .main-viewport { padding-bottom: calc(var(--itn-tab-h) + 16px) !important; }
  html.itn-ban-phim body.itn-shell .main-viewport { padding-bottom: 8px !important; }
}
@media (min-width: 1024px) { html body.itn-shell #iphone-bottom-bar.iphone-bottom-bar { display: none !important; } }

/* ---------- Bảng "Thêm" ---------- */
.itn-more[hidden] { display: none !important; }
.itn-more { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; justify-content: flex-end; }
.itn-more-back { position: absolute; inset: 0; background: rgba(8, 12, 20, .42); animation: itn-fade .2s var(--itn-ease) both; }
.itn-more-sheet { position: relative; max-height: 78dvh; overflow: auto; overscroll-behavior: contain; padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--bg-card, #fff); color: var(--text-main); border-radius: 22px 22px 0 0; box-shadow: var(--itn-shadow-2); animation: itn-sheet .26s var(--itn-ease) both; }
.itn-more-sheet::before { content: ""; display: block; width: 38px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: var(--border-color); }
.itn-more-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-size: 16px; }
.itn-more-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--bg-input, rgba(0,0,0,.05)); color: var(--text-main); cursor: pointer; }
.itn-more-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 6px; }
.itn-more-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: var(--itn-r-md); background: var(--bg-card-hover, transparent); color: var(--text-main); font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; text-align: left; cursor: pointer; }
.itn-more-item svg { width: 22px; height: 22px; flex: none; color: var(--sb-active-text); }
.itn-more-item.active { border-color: var(--sb-indicator); background: var(--sb-active-bg); }
.itn-more-item .nav-badge { margin-left: auto; }
.itn-more-item:focus-visible, .itn-more-x:focus-visible { outline: 2px solid var(--sb-indicator); outline-offset: 2px; }
html.itn-more-open, html.itn-more-open body,
html:has(body.tkg-mo), html:has(body.ns-sheet-mo), html:has(body.bl-mo), html:has(body.tb-mo), html:has(.itn-sx:not([hidden])), html:has(.itn-modal-overlay.open, .itn-modal-overlay.active), html:has(dialog[open]) { overflow: hidden; overscroll-behavior-y: none; }
@keyframes itn-fade { from { opacity: 0; } }
@keyframes itn-sheet { from { transform: translateY(24px); opacity: .6; } }

/* ---------- Thẻ số liệu: có lớp, phân cấp ---------- */
body.itn-shell .dash-exec-kpi-card, body.itn-shell .pilot-summary article, body.itn-shell .stats-grid > *,
body.itn-shell .chain-card, body.itn-shell .pilot-panel { border-radius: var(--itn-r-lg) !important; box-shadow: var(--itn-shadow-1) !important; }
body.itn-shell .dash-exec-kpi-card { transition: transform .2s var(--itn-ease), box-shadow .2s var(--itn-ease); }
@media (hover: hover) { body.itn-shell .dash-exec-kpi-card:hover { transform: translateY(-2px); box-shadow: var(--itn-shadow-2) !important; } }
body.itn-shell .kpi-icon-wrap svg { width: 20px; height: 20px; }

/* ---------- Skeleton ---------- */
.sk-card { display: grid; gap: 12px; padding: 20px; border-radius: var(--itn-r-lg); background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: var(--itn-shadow-1); }
.sk-title, .sk-line { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-input) 0%, color-mix(in srgb, var(--bg-input) 55%, var(--bg-card)) 40%, var(--bg-input) 80%); background-size: 240% 100%; animation: itn-shimmer 1.3s linear infinite; }
.sk-title { width: 34%; height: 18px; margin-bottom: 6px; }
.auth-loading:empty::after, .sk-card .sr-only, .itn-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes itn-shimmer { to { background-position: -240% 0; } }

/* ---------- Splash (chỉ lần mở đầu trong phiên) ---------- */
/* Splash (26/09/2026, đăng nhập phương án A): nền trắng khớp màn khởi động iPhone, logo chữ iTN cam phẳng bo 8px; dang-nhap.mjs cho logo thu vào chỗ logo màn đăng nhập. */
#itn-splash { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: #fff; transition: opacity .28s var(--itn-ease), visibility .28s; }
#itn-splash .itn-splash-mark { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 8px; background: #e8651f; color: #fff; font: 800 38px/1 Roboto, -apple-system, sans-serif; letter-spacing: -.03em; animation: itn-pop .5s var(--itn-ease) both; }
#itn-splash.is-out { opacity: 0; visibility: hidden; }
html.itn-no-splash #itn-splash { display: none; }
@keyframes itn-pop { from { transform: scale(.86); opacity: 0; } }

/* ---------- Chuyển trang giữa giao diện chính và kho/bán (cùng nguồn): mờ nhẹ, thanh bên/tab đứng yên ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: var(--itn-ease); }
::view-transition-group(itn-sidebar), ::view-transition-group(itn-tabbar) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .itn-more-back, .itn-more-sheet, #itn-splash .itn-splash-mark, .sk-title, .sk-line { animation: none !important; }
  #itn-splash, html body.itn-shell #app-nav .nav-tab-btn.sb-item, body.itn-shell .dash-exec-kpi-card { transition: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* Bộ lọc Kho: khối "Bộ lọc" (Chi nhánh / Tình trạng / Sở hữu) trước chỉ chiếm 1 ô lưới hẹp → 3 ô chọn xếp dọc. Cho trải đủ cột. */
body.itn-shell form[data-form="search"] > .pilot-loc { grid-column: span 3; }
@media (max-width: 1180px) { body.itn-shell form[data-form="search"] > .pilot-loc { grid-column: 1 / -1; } }

/* ---------- Tương phản chữ trạng thái ở giao diện chính (đo getComputedStyle 25/09): màu Apple gốc dùng làm CHỮ chỉ 1.8–4.4:1.
   Giữ sắc màu nhưng pha về màu chữ theme → ≥4.5:1 ở cả theme sáng lẫn tối. Nền nhạt giữ nguyên. ---------- */
:root, html[data-itn-theme] {
  --kpi-ok: color-mix(in srgb, #1f9d4a 52%, var(--text-main, #111827));
  --kpi-mid: color-mix(in srgb, var(--theme-accent-strong, #0071e3) 54%, var(--text-main, #111827));
  --kpi-low: color-mix(in srgb, #d97706 48%, var(--text-main, #111827));
  --txt-accent: color-mix(in srgb, var(--theme-accent-strong, #0071e3) 54%, var(--text-main, #111827));
  --txt-ok: color-mix(in srgb, var(--theme-success, #1f7a45) 54%, var(--text-main, #111827));
  --txt-warn: color-mix(in srgb, var(--theme-warning, #935f00) 52%, var(--text-main, #111827));
  --txt-bad: color-mix(in srgb, var(--theme-danger, #c0262d) 58%, var(--text-main, #111827));
}
html body .badge-ratio, html body .stock-qty-badge, html body .role-badge-tag, html body .vip-badge-tag,
html body .exec-link-btn, html body .branch-chevron, html body .branch-fin-link { color: var(--txt-accent) !important; }
html body .badge-ratio.success, html body .badge-achieved { color: var(--txt-ok) !important; }
html body .staff-rank.gold { color: var(--txt-warn) !important; }
html body .pay-method-badge.cash { color: var(--txt-bad) !important; }
html body .hd-nguon-cu { color: var(--text-muted) !important; }

/* ---------- Vùng bấm ≥44pt (Apple HIG / App Store 4.2) cho nút & ô chọn ở giao diện chính (đo 25/09: 16–38px) ---------- */
html body.itn-shell :is(.header-theme-btn, .user-profile-badge, .backend-account-btn, .dash-action-btn-primary, .dash-action-btn-secondary, .dash-refresh-btn,
  .dash-exec-dropdown, .inv-time-tab, .view-switcher-btn, .btn-print-inv-sm, .branch-fin-link, .action-btn-primary, .exec-link-btn, .search-input, [data-trang]) {
  min-height: 44px !important; box-sizing: border-box;
}
html body.itn-shell :is(.dash-action-btn-secondary, .branch-fin-link, .exec-link-btn, .btn-print-inv-sm) { display: inline-flex !important; align-items: center; justify-content: center; }
html body.itn-shell [data-trang] { min-width: 44px !important; }
html body.itn-shell .header-branch-pill { min-height: 44px; }
html body.itn-shell .header-branch-pill.tkn-an-cn, #app-header .header-branch-pill.tkn-an-cn { display: none !important; }
html body.itn-shell .header-branch-pill select {
  -webkit-appearance: none; appearance: none;
  min-height: 44px; height: 44px; min-width: 102px !important; width: auto !important; padding: 0 14px 0 2px !important; border: 0 !important;
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 1px center !important; background-size: 12px 12px !important;
}

/* Mượt iPhone (31/10/2026): bỏ độ trễ chạm 300ms + tắt mảng xám mặc định của WebKit; chặn menu nhấn-giữ hệ thống CHỈ trên nút / tab / tay nắm (vẫn chọn chữ bình thường trong tin nhắn, bảng, văn bản). */
:is(button, a[href], summary, [role="button"], [role="tab"], input, select, textarea, label) {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
:is(button, summary, [role="button"], [role="tab"], .iphone-nav-item, .nav-tab-btn, .header-brand, [data-itn-sx-nam]) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
@media (hover: none), (pointer: coarse) {
  :where(button, a[href], summary, [role="button"], [role="tab"]):active:not(:disabled):not([aria-disabled="true"]) {
    opacity: .74;
  }
}

/* Giảm chuyển động (hệ điều hành bật "Reduce Motion"): tắt mọi animation/transition còn sót (vd hiệu ứng xuất hiện dần ở Tổng quan). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Biến cũ chưa từng được định nghĩa (--card-bg, --accent, --accent-blue, --surface-2, --text-primary): trước luôn rơi về
   màu dự phòng của theme sáng (#fff, #0071e3) kể cả khi đang ở theme tối → nút trắng/nền trắng, "Quản lý vai trò" chữ trắng trên trắng. ---------- */
html[data-itn-theme] {
  --card-bg: var(--bg-card); --surface-2: var(--bg-card-hover); --text-primary: var(--text-main);
  --accent: var(--theme-accent-strong); --accent-blue: var(--txt-accent);
}
/* Chữ nhấn/đỏ/xanh ở giao diện chính: đặt theo token pha màu (đủ tương phản cả sáng lẫn tối). Tiền tố body.itn-shell để thắng body.theme-light … */
html body.itn-shell :is(.badge-ratio, .stock-qty-badge, .role-badge-tag, .vip-badge-tag, .exec-link-btn, .branch-chevron, .branch-fin-link, .inv-code-link, .text-blue) { color: var(--txt-accent) !important; }
html body.itn-shell :is(.badge-ratio.success, .badge-achieved, .text-green) { color: var(--txt-ok) !important; }
html body.itn-shell .staff-rank.gold { color: var(--txt-warn) !important; }
html body.itn-shell :is(.pay-method-badge.cash, .pilot-error, #xtk-bat-dau) { color: var(--txt-bad) !important; }
html body.itn-shell :is(.pilot-step legend, .pilot-item legend) { color: var(--txt-accent) !important; }
html body.itn-shell .view-switcher-btn:not(.active) { color: var(--text-muted) !important; }
/* Nút chính trên màu nhấn sáng (Graphite, Gold Noir): chữ trắng chỉ ~3.6:1 → chữ tối của theme */
html[data-itn-theme="graphite"] body.itn-shell :is(.action-btn-primary, .user-avatar-exec, .view-switcher-btn.active),
html[data-itn-theme="gold-noir"] body.itn-shell :is(.action-btn-primary, .user-avatar-exec, .view-switcher-btn.active) { color: var(--bg-app) !important; }
html body.itn-shell .header-branch-pill .branch-chevron { color: var(--txt-accent) !important; }
html body.itn-shell #xtk-bat-dau { background: transparent !important; border: 1px solid currentColor !important; }
/* Vùng bấm iPhone còn thiếu (đo 390px): nút "Huỷ" ở Sổ quỹ, link "Hỗ trợ" ở Tài khoản */
@media (max-width: 1023px) { html body.itn-shell .dash-action-btn-secondary, html body.itn-shell .login-legal a { min-width: 44px !important; justify-content: center; } }
html body.itn-shell .login-legal a { padding-inline: 6px; }
html body.itn-shell nav[aria-label="Thông tin"] a { min-width: 44px; justify-content: center; padding-inline: 6px; }

/* KPI thu tiền theo nhân viên (Tổng quan, anh Nghĩa 25/09/2026): 4 ô tổng + bảng xếp hạng đầy khung.
   Tên + chi nhánh hai dòng, số canh phải cùng độ rộng chữ số, thanh ngang = doanh số so với người cao nhất.
   Màn hẹp (iPhone): mỗi nhân viên một thẻ, 4 con số lưới 2×2 có nhãn. */
.kpi-thu-dem {
  font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border-color);
}
.kpi-thu-tong { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.kpi-thu-o {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px;
  border-radius: 12px; background: var(--bg-input); border: 1px solid var(--border-color);
}
.kpi-thu-o.chinh { background: var(--theme-accent-soft, var(--bg-input)); border-color: transparent; }
.kpi-thu-nhan { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.kpi-thu-so { font-size: 20px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-thu-o.chinh .kpi-thu-so { font-size: 24px; color: var(--theme-accent-strong, var(--text-main)); }
.kpi-thu-ti { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.kpi-thu-wrap { margin-top: 18px; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.kpi-thu-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kpi-thu-table thead th {
  padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--bg-input);
  text-align: right; border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.kpi-thu-table thead th:nth-child(2) { text-align: left; }
.kpi-thu-table tbody th, .kpi-thu-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.kpi-thu-table tbody tr:last-child th, .kpi-thu-table tbody tr:last-child td { border-bottom: 0; }
.kpi-thu-table tbody th { text-align: left; font-weight: 400; }
.kpi-thu-table .kpi-hang { width: 40px; padding-right: 0; text-align: center; color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-thu-table thead .kpi-hang { text-align: center; }
.kpi-nv { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kpi-av {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: var(--theme-accent-strong, var(--text-main)); background: var(--theme-accent-soft, var(--bg-input));
}
.kpi-av.cm { color: var(--text-main); background: var(--color-gold-bg, var(--bg-input)); }
.kpi-thu-table .kpi-ten { display: block; font-weight: 600; color: var(--text-main); white-space: nowrap; }
.kpi-thu-table .kpi-cn { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.kpi-thu-table td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-main); }
.kpi-thu-table td.kpi-chinh { font-weight: 700; min-width: 150px; }
.kpi-thanh { display: block; height: 4px; margin-top: 6px; margin-left: auto; width: 100%; max-width: 140px; border-radius: 4px; background: var(--border-color); overflow: hidden; }
.kpi-thanh i { display: block; height: 100%; margin-left: auto; border-radius: 4px; background: var(--theme-accent, #0071e3); }
.kpi-thu-table tbody tr:hover { background: var(--bg-card-hover, transparent); }
@media (max-width: 1000px) { .kpi-thu-tong { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) {
  .kpi-thu-o { padding: 12px; }
  .kpi-thu-so { font-size: 17px; }
  .kpi-thu-o.chinh .kpi-thu-so { font-size: 20px; }
  .kpi-thu-wrap { border: 0; border-radius: 0; }
  .kpi-thu-table, .kpi-thu-table tbody { display: block; }
  .kpi-thu-table thead { display: none; }
  .kpi-thu-table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px;
    margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card);
  }
  .kpi-thu-table tbody td.kpi-hang { display: none; }
  .kpi-thu-table tbody th { grid-column: 1 / -1; padding: 0; border: 0; }
  .kpi-thu-table tbody td { padding: 0; border: 0; text-align: left; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .kpi-thu-table tbody td::before { content: attr(data-nhan); font-size: 12px; font-weight: 400; color: var(--text-muted); }
  .kpi-thanh { margin-left: 0; max-width: none; }
  .kpi-thanh i { margin-left: 0; }
  .kpi-thu-table tbody tr:hover { background: var(--bg-card); }
}

/* Nhãn gói bảo hành theo giá (anh Nghĩa 25/09/2026): càng đắt càng "VIP".
   4 gói đầu: nền pha nhẹ màu gói trên nền thẻ + chữ pha đậm (tự đủ tương phản ở cả chủ đề sáng lẫn tối).
   3 gói cao: nền chuyển sắc cố định như đá quý — GOLD vàng, DIAMOND xanh băng, PREMIUM đen ánh vàng. */
html body .vip-badge-tag.goi-tag {
  --goi: #6c6c72;
  display: inline-flex; align-items: center; margin: 1px 0; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; border: 1px solid transparent;
  background: color-mix(in srgb, var(--goi) 14%, var(--bg-card, #fff));
  color: color-mix(in srgb, var(--goi) 48%, var(--text-main, #111)) !important;
}
html body .vip-badge-tag.goi-care { --goi: #2e9e5b; }
html body .vip-badge-tag.goi-plus { --goi: #0f9fb5; }
html body .vip-badge-tag.goi-basic { --goi: #0a72e0; }
html body .vip-badge-tag.goi-pro { --goi: #7a4ce0; border-color: color-mix(in srgb, #7a4ce0 35%, transparent); }
html body .vip-badge-tag.goi-gold {
  background: linear-gradient(135deg, #fff3cf 0%, #f6d36b 55%, #e5b53a 100%); border-color: #d9a52c; color: #5c3d00 !important;
}
html body .vip-badge-tag.goi-diamond {
  background: linear-gradient(135deg, #f2fbff 0%, #bfe6fb 50%, #9fc4f6 100%); border-color: #7fb0ea; color: #0b3a73 !important;
}
html body .vip-badge-tag.goi-premium {
  background: linear-gradient(135deg, #111114 0%, #2c2c30 60%, #45403a 100%); border-color: #c9a54b; color: #f3d27e !important;
  box-shadow: 0 1px 4px rgba(201, 165, 75, .35);
}

/* Hóa đơn kiểu KiotViet trên điện thoại (anh Nghĩa 25/09/2026): chỉ ≤700px; máy tính giữ bảng đầy đủ.
   "Lọc khác" mở lại thanh lọc đầy đủ (nguồn, cách trả, người bán). */
.kv-hd, .kv-fab { display: none; }
.kv-hd .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 700px) {
  .inv-wrapper > .inv-desk, .inv-wrapper:not(.kv-mo-loc) > .inv-desk-loc { display: none !important; }
  .inv-wrapper.kv-mo-loc > .inv-desk-loc { margin: 0 0 12px; }
  .kv-hd, .kv-hd[hidden] { display: block; position: relative; padding-bottom: 72px; }
  .kv-hd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0 8px; }
  .kv-hd-top h2 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.01em; color: var(--text-main); }
  .kv-hd-nut { display: flex; gap: 4px; }
  .kv-hd-nut button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-main); cursor: pointer; }
  .kv-hd-nut button:hover, .kv-hd-nut button[aria-expanded="true"] { background: var(--bg-input); }
  .kv-hd-tim { margin-bottom: 8px; }
  /* Chip Thời gian / Chi nhánh / Lọc khác xuống dòng khi hẹp — trước trượt ngang, "Lọc khác" bị cắt ở 390px (26/09/2026). */
  .kv-hd-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 2px; }
  .kv-hd-chips::-webkit-scrollbar { display: none; }
  .kv-chip { flex: none; position: relative; display: inline-flex; align-items: center; min-height: 44px; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; }
  .kv-chip select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; min-height: 42px; padding: 0 30px 0 14px; cursor: pointer; }
  .kv-chip:has(select)::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
  .kv-chip-loc { padding: 0 14px; cursor: pointer; }
  .kv-chip-loc.is-bat { border-color: var(--theme-accent-strong, #0071e3); color: var(--txt-accent, var(--text-main)); }
  .kv-hd-nap { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
  .kv-hd-nap :is(button, a) { min-height: 44px; }
  .kv-trung { color: var(--txt-warn, #935f00); font-weight: 600; }
  .kv-hd :is([data-chip-bo], [data-chip-het]) { min-height: 44px; }
  .kv-chip-loc[aria-expanded="true"] { background: var(--theme-accent-soft, var(--bg-input)); color: var(--txt-accent, var(--text-main)); }
  .kv-hd-tong { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 14px 2px 10px; font-size: 14px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
  .kv-hd-tong strong { font-size: 17px; color: var(--text-main); font-variant-numeric: tabular-nums; }
  /* Danh sách nằm trên bề mặt thẻ như Khách hàng / Tổng quan (26/09/2026), không đặt thẳng trên nền trang. */
  .kv-hd-ds { list-style: none; margin: 10px 0 0; padding: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
  .kv-hd-ds li + li { border-top: 1px solid var(--border-color); }
  .kv-hd-dong { display: grid; gap: 4px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: var(--text-main); text-align: left; font: inherit; cursor: pointer; min-height: 44px; }
  .kv-hd-dong:active, .kv-hd-dong:hover { background: var(--bg-card-hover, var(--bg-input)); }
  .kv-hd-dong:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: -2px; }
  .kv-hd-dong > span { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
  .kv-r1 { font-size: 16px; font-weight: 700; }
  .kv-khach { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kv-tien { flex: none; font-variant-numeric: tabular-nums; }
  .kv-r2 { font-size: 13px; color: var(--text-muted); }
  .kv-r2 > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .kv-tt { flex: none; font-weight: 600; }
  .kv-tt.is-ok { color: var(--txt-ok, #1d7a3a); }
  .kv-tt.is-warn { color: var(--txt-warn, #9a5b00); }
  .kv-tt.is-bad { color: var(--txt-bad, #c0262d); }
  .kv-r3 { font-size: 14px; }
  .kv-mh { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Hàng nhãn: ô màu máy + gói bảo hành cùng cỡ, thẳng hàng, bắt đầu từ trái (26/09/2026) */
  .kv-hd-dong > .kv-r3 { justify-content: flex-start; align-items: center; gap: 6px; flex-wrap: nowrap; }
  .kv-r3 > .kv-mh { flex: 0 1 auto; }
  .kv-r3 > .kv-nhan { flex: none; display: inline-flex; gap: 6px; }
  .kv-r3 > .kv-sl { margin-left: auto; }
  .kv-nhan > :is(.mau-chip, .goi-tag) { box-sizing: border-box; height: 24px; display: inline-flex !important; align-items: center; margin: 0 !important;
    padding: 0 10px !important; font-size: 12px !important; font-weight: 700; line-height: 1; letter-spacing: .02em; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
  .kv-sl { flex: none; color: var(--text-muted); }
  .kv-r4 { font-size: 13px; color: var(--text-muted); }
  /* Các khoản trả: tối đa 2 khoản lớn nhất + "+N khoản"; xuống dòng khi hẹp, không tràn. */
  .kv-hd-dong > .kv-r5 { justify-content: flex-start; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--text-muted); }
  .kv-kt { min-width: 0; overflow-wrap: anywhere; }
  .kv-kt b { color: var(--text-main); font-weight: 600; font-variant-numeric: tabular-nums; }
  .kv-kt-them { color: var(--theme-accent-strong); font-weight: 600; }
  .kv-hd-dong.is-huy .kv-tien { text-decoration: line-through; color: var(--text-muted); }
  .kv-hd-dong.is-huy .kv-tt { color: var(--txt-bad, #c0262d); }
  .kv-hd-trong { padding: 28px 4px; text-align: center; color: var(--text-muted); }
  body.itn-shell .kv-fab:not([hidden]) {
    position: fixed; right: 18px; bottom: calc(var(--itn-tab-h, 64px) + 14px); z-index: 40;
    width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
    background: var(--theme-accent-strong, #0071e3); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  }
  body.itn-shell .kv-fab[hidden] { display: none !important; }
  /* Nút tròn "+" nổi che dòng ghi chú / phân trang cuối màn Hóa đơn → chừa thêm đúng chiều cao nút + khoảng cách (27/09/2026). */
  body.itn-shell:has(> .kv-fab:not([hidden])) .main-viewport { padding-bottom: calc(96px + 56px + 16px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ═════════ PHẦN B — trải nghiệm cao cấp (anh Nghĩa 25/09/2026) ═════════ */
/* Logo chữ iTN: chuyển sắc cam nhẹ, nhất quán ở thanh bên và header (giữ chữ iTN — chưa dùng hình táo tới khi Apple duyệt). */
:root, html[data-itn-theme] { --itn-mark-bg: linear-gradient(145deg, #f7a24d 0%, #f28c28 48%, #e0701c 100%); }
html body .itn-mark { background: var(--itn-mark-bg) !important; color: #fff !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 2px 8px rgba(226, 112, 28, .28); }

/* Thông báo nổi dùng chung: giữa màn, trên thanh tab iPhone (không che nội dung/tab), không chặn bấm, lỗi màu đỏ theme. */
html body #itn-toast.itn-toast {
  left: 50%; right: auto; bottom: 24px; width: min(92vw, 420px); z-index: 9999;
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card, #fff) 94%, transparent); color: var(--text-main);
  border: 1px solid var(--border-color); box-shadow: var(--itn-shadow-2);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  transform: translate(-50%, 16px) scale(.98); opacity: 0; pointer-events: none;
  transition: transform .32s var(--itn-ease), opacity .24s var(--itn-ease);
}
html body #itn-toast.itn-toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: none; }
html body #itn-toast .itn-toast-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; color: var(--txt-ok); margin-top: 1px; }
html body #itn-toast.is-bad .itn-toast-ico { color: var(--txt-bad); }
html body #itn-toast.is-bad { border-color: color-mix(in srgb, var(--txt-bad) 45%, var(--border-color)); }
html body #itn-toast .itn-toast-body { min-width: 0; }
/* Dấu tick thành công (28/09/2026): thẻ nhỏ giữa màn, bo 8px, vòng xanh --txt-ok + tick vẽ ra; không chặn bấm; giảm chuyển động = hiện tĩnh. */
.itn-tick { position: fixed; left: 50%; top: 42%; z-index: 10000; display: grid; justify-items: center; gap: 10px; min-width: 136px; max-width: min(80vw, 240px);
  padding: 20px 18px 16px; border-radius: 8px; background: color-mix(in srgb, var(--bg-card, #fff) 96%, transparent); color: var(--text-main);
  border: 1px solid var(--border-color); box-shadow: var(--itn-shadow-2, 0 8px 24px rgba(0,0,0,.12));
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  transform: translate(-50%, -50%) scale(.92); opacity: 0; pointer-events: none; transition: transform .22s var(--itn-ease, ease-out), opacity .2s var(--itn-ease, ease-out); }
.itn-tick.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.itn-tick-svg { display: block; }
.itn-tick-vong { fill: var(--txt-ok, #1d7a3a); }
.itn-tick-dau { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 0; }
.itn-tick.show .itn-tick-dau { animation: itn-tick-ve .38s .08s var(--itn-ease, ease-out) both; }
@keyframes itn-tick-ve { from { stroke-dashoffset: 36; } to { stroke-dashoffset: 0; } }
.itn-tick-chu { margin: 0; font-size: 14px; font-weight: 650; line-height: 1.35; text-align: center; color: var(--text-main) !important; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .itn-tick, .itn-tick.show { transition: none; transform: translate(-50%, -50%); } .itn-tick.show .itn-tick-dau { animation: none; } }
html body #itn-toast #itn-toast-title { margin: 0; font-size: 14px; font-weight: 650; color: var(--text-main) !important; }
html body #itn-toast #itn-toast-desc { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
@media (max-width: 1023px) {
  html body.itn-shell #itn-toast.itn-toast { bottom: calc(var(--itn-tab-h, 64px) + 12px); }
  /* Màn Hóa đơn iPhone có nút tròn "+ Lập hóa đơn" (56px, cùng đáy) → toast nổi lên trên nút, không che. */
  html body.itn-shell:has(> .kv-fab:not([hidden])) #itn-toast.itn-toast { bottom: calc(84px + 56px + 12px + env(safe-area-inset-bottom, 0px)); }
}
html body #itn-toast .itn-toast-ico[hidden] { display: none; }

/* Trạng thái rỗng: icon nét iTN + câu chính + gợi ý + nút hành động (≥44px). Không hiệu ứng. */
.itn-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 18px; text-align: center; border: 1.5px dashed var(--border-color); border-radius: var(--itn-r-lg); background: color-mix(in srgb, var(--bg-input) 55%, transparent); color: var(--text-main); }
.itn-empty-ico { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 4px; border-radius: 16px; color: var(--itn-orange); background: color-mix(in srgb, var(--itn-orange) 12%, var(--bg-card)); }
.itn-empty.is-bad .itn-empty-ico { color: var(--txt-bad); background: color-mix(in srgb, var(--txt-bad) 10%, var(--bg-card)); }
.itn-empty-t { margin: 0; font-size: 15px; font-weight: 650; color: var(--text-main); }
.itn-empty-h { margin: 0; max-width: 42ch; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.itn-empty-btn { margin-top: 8px; min-height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border-color); background: var(--bg-card); color: var(--txt-accent); }
.itn-empty-btn.is-primary { border-color: transparent; background: var(--theme-accent-strong, #0071e3); color: #fff; }
html[data-itn-theme="graphite"] .itn-empty-btn.is-primary, html[data-itn-theme="gold-noir"] .itn-empty-btn.is-primary { color: var(--bg-app); }
.itn-empty-row > td { padding: 14px !important; border: 0 !important; background: transparent !important; }

/* Nút chính/phụ ở giao diện chính: trước chưa có kiểu gốc (hiện nút xám mặc định trình duyệt) → pill bo tròn đúng chuẩn. */
html body.itn-shell .dash-action-btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0 !important; border-radius: 999px !important; padding: 0 18px !important;
  background: var(--theme-accent-strong, #0071e3) !important; color: #fff !important; font-weight: 650; cursor: pointer; }
html[data-itn-theme="graphite"] body.itn-shell .dash-action-btn-primary, html[data-itn-theme="gold-noir"] body.itn-shell .dash-action-btn-primary { color: var(--bg-app) !important; }
html body.itn-shell .dash-action-btn-secondary.is-nguy { color: var(--txt-bad, #d70015) !important; }   /* nút phá huỷ (Ngừng hoạt động, Xóa tài khoản) giữ màu đỏ */
html body.itn-shell .dash-action-btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
html body.itn-shell .dash-action-btn-secondary { gap: 6px; border: 1px solid var(--border-color) !important; border-radius: 999px !important; padding: 0 16px !important; background: var(--bg-card) !important; color: var(--text-main) !important; font-weight: 600; cursor: pointer; text-decoration: none; }

@media (prefers-reduced-motion: no-preference) {

  html body .iphone-nav-item:active svg { transform: scale(.9); transition: transform .1s var(--itn-ease); }
}

/* Biểu đồ nhỏ cạnh số liệu chính: màu theo chiều tăng/giảm, token theme. */
.itn-spark { display: block; flex: none; color: var(--txt-accent); }
.itn-spark.is-len { color: var(--txt-ok); }
.itn-spark.is-xuong { color: var(--txt-warn); }
.kpi-spark-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; min-width: 0; }
.kpi-spark-row > .exec-kpi-val { min-width: 0; white-space: nowrap; }   /* không bẻ số tiền giữa chừng; hàng tự xuống dòng nhờ flex-wrap */
/* Sổ quỹ — khối tổng gọn (27/09/2026): một bề mặt bo 8px, ô chia bằng đường kẻ (không thẻ riêng từng số). Hàng chính Tổng thu · Tổng chi · Còn lại,
   hàng phụ nguồn thu + trạng thái. Số tabular, không ngắt dòng; màu trạng thái theo token (đủ tương phản ở mọi theme). */
.sq-tong { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.sq-tong-chinh, .sq-tong-phu { display: grid; }
.sq-tong-chinh { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sq-tong-phu { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--border-color); background: var(--bg-card-hover, transparent); }
.sq-to { display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; padding: 10px 14px; min-width: 0; box-shadow: -1px 0 0 var(--border-color); }
.sq-to-nhan { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sq-to-hang { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sq-to-hang .itn-spark { max-width: 72px; height: 22px; }
.sq-to-so { font-size: 17px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.3; }
.sq-tong-chinh .sq-to-so { font-size: 21px; }
.sq-to-phu { font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
.sq-to-so.sq-ok { color: var(--txt-ok) !important; }
.sq-to-so.sq-warn { color: var(--txt-warn) !important; }
.sq-to-so.sq-bad { color: var(--txt-bad, #c0262d) !important; }
@media (max-width: 760px) {
  .sq-to { padding: 8px 10px; }
  .sq-tong-chinh .sq-to-so { font-size: 16px; }
  .sq-to-so { font-size: 15px; }
  .sq-tong-phu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sq-tong-phu .sq-to { box-shadow: -1px 0 0 var(--border-color), 0 -1px 0 var(--border-color); }
}
/* Sổ quỹ (anh Nghĩa 27/09/2026): mỗi chi nhánh một sổ riêng (Cần Thơ / Cà Mau song song khi đủ rộng), cột như sổ tay cửa hàng:
   Thời gian · Nội dung · Người nộp / nhận · THU · CHI. Bấm dòng → hộp phiếu. Không cột thao tác (hết nút bo tròn to bị vỡ).
   Bảng co theo CHÍNH khung chi nhánh (container query): khung hẹp gộp người nộp vào dòng phụ; rất hẹp (điện thoại) thành danh sách. */
.sq-trang { max-width: 1600px; margin: 0 auto; }
.sq-dau-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sq-dau-nut > button { font-size: 13px; }
/* Chọn sổ: Sổ bán hàng / Sổ kỹ thuật (059, 02/10/2026) — cùng kiểu nút chọn khoảng ngày; điện thoại chia đôi bề ngang. */
.sq-so { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.sq-so .inv-time-tab { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .sq-so { display: grid; grid-template-columns: 1fr 1fr; } .sq-so .inv-time-tab { justify-content: center; } }
.sq-khung { container: sqkhung / inline-size; }
.sq-luoi { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@container sqkhung (min-width: 960px) { .sq-2cn { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sq-cn { container: sqcn / inline-size; min-width: 0; }
.sq-cn-td { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--text-main); }
.sq-cn-dem { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.sq-cn .sq-tong { margin-bottom: 10px; }
.sq-mat { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.sq-nhac { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border-color); border-left: 3px solid var(--txt-warn); border-radius: 8px; background: var(--bg-card); color: var(--text-main); font-size: 14px; line-height: 1.45; }
.sq-nhac > svg { flex: none; margin-top: 2px; color: var(--txt-warn); }
html body table.sq-bang { width: 100%; min-width: 0; table-layout: auto; border-collapse: collapse; }
html body table.sq-bang th, html body table.sq-bang td { vertical-align: top; padding: 8px 10px; }
html body table.sq-bang th { white-space: nowrap; font-size: 12px; text-align: left; }
table.sq-bang .sq-c-tg { width: 1%; white-space: nowrap; }
table.sq-bang .sq-c-nd { width: auto; }
table.sq-bang .sq-c-nn { width: 22%; min-width: 110px; }
html body table.sq-bang .sq-c-thu, html body table.sq-bang .sq-c-chi { width: 1%; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
html body table.sq-bang td.sq-c-thu { font-weight: 700; color: var(--text-main); }
html body table.sq-bang td.sq-c-chi, .sq-hop .sq-am { font-weight: 700; color: var(--txt-bad) !important; }   /* thắng luật ép màu chữ ô bảng của theme (themes.css) */
table.sq-bang tr.sq-dong { cursor: pointer; }
table.sq-bang tr.sq-dong:hover > td { background: var(--bg-card-hover, rgba(0, 0, 0, .03)); }
table.sq-bang tr.sq-can-duyet > td { background: rgba(255, 159, 10, .07); }
table.sq-bang tr.sq-nhay > td { background: var(--theme-accent-soft, rgba(10, 102, 194, .08)); }
table.sq-bang tr.sq-da-huy .sq-c-thu, table.sq-bang tr.sq-da-huy .sq-c-chi { color: var(--text-muted) !important; text-decoration: line-through; font-weight: 500; }
/* Dòng TỔNG ngay dưới tiêu đề cột (27/09/2026): tổng thu đúng cột Thu (xanh), tổng chi đúng cột Chi (đỏ), Tồn quỹ bên trái. */
html body table.sq-bang tr.sq-tong-hang > td { background: var(--bg-card-hover, rgba(0, 0, 0, .03)); border-bottom: 1px solid var(--border-color); vertical-align: bottom; padding-top: 8px; padding-bottom: 10px; }
.sq-tong-ten { display: block; font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--text-muted); }
.sq-tong-ton { font-size: 17px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sq-tong-trai .itn-spark { display: inline-block; vertical-align: middle; max-width: 72px; height: 20px; margin-left: 8px; }
/* Số dư theo mốc (062, 02/10/2026): dưới "Tồn cuối kỳ" là tồn đầu kỳ (chữ nhỏ); dòng mốc dưới tên chi nhánh; phiếu lập trước mốc ghi chú nhỏ. */
.sq-tong-dau { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sq-moc { display: flex; align-items: flex-start; gap: 6px; margin: -4px 0 8px; font-size: 13px; line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.sq-moc > svg { flex: none; margin-top: 2px; }
.sq-moc strong { color: var(--text-main); font-variant-numeric: tabular-nums; }
/* Dòng nhắc phiếu chờ ngày khác (anh Nghĩa 09/11/2026: chữ bị bóp thành cột dọc khi nhiều ngày): câu nhắc một dòng riêng, nút ngày xuống dòng dưới (giữ cỡ bấm 44px). */
.sq-cho-ngay { flex-wrap: wrap; align-items: center; row-gap: 6px; }
.sq-cho-ngay > span { flex: 1 1 calc(100% - 24px); min-width: 0; overflow-wrap: normal; }
.sq-cho-ngay .sq-cho-nut { flex: none; }
.sq-truoc-moc { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.sq-hop .sq-sodu-canh { margin: 4px 0 0; }
html body table.sq-bang tr.sq-tong-hang > td.sq-c-thu { color: var(--txt-ok) !important; font-size: 17px; font-weight: 700; }
html body table.sq-bang tr.sq-tong-hang > td.sq-c-chi { color: var(--txt-bad) !important; font-size: 17px; font-weight: 700; }
html body table.sq-bang tr.sq-tong-hang > td.sq-c-chi.sq-khong { color: var(--text-main) !important; }
.sq-gio { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
button.sq-nd { display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.4; text-align: left; color: var(--text-main); cursor: pointer; overflow-wrap: anywhere; border-radius: 4px; }
button.sq-nd:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
.sq-phu { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--text-muted); overflow-wrap: anywhere; }
.sq-mo { color: var(--text-muted); }
.sq-cho { display: block; margin-top: 2px; color: var(--txt-warn); font-weight: 600; font-size: 12px; }
.sq-co { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 12px; color: var(--txt-bad); }
.sq-nd-nn { display: none; }
.sq-nd-tg { display: none; }
/* Khung chi nhánh hẹp (hai sổ song song trên màn vừa): gộp Người nộp / nhận vào dòng phụ của Nội dung để Nội dung đủ rộng. */
@container sqcn (max-width: 699px) {
  table.sq-bang .sq-c-nn { display: none; }
  .sq-nd-nn { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); }
  .sq-nd-nn .sq-phu, .sq-nd-nn .sq-cho { display: inline; margin: 0; }
  .sq-nd-nn .sq-phu:not(:empty)::before, .sq-nd-nn .sq-cho::before { content: " · "; color: var(--text-muted); font-weight: 400; }
}
/* Rất hẹp (iPhone, anh Nghĩa 27/09/2026 "trên app chưa có cột thu chi"): VẪN là bảng 3 cột Nội dung · THU · CHI như máy tính —
   giờ · ngày và người nộp / trạng thái xuống dòng phụ trong Nội dung; dòng tổng nằm ngay trên cột Thu / Chi. Không kéo ngang. */
@container sqcn (max-width: 519px) {
  html body [data-list-module="cashbook"] table.sq-bang .sq-c-tg { display: none; }
  html body [data-list-module="cashbook"] table.sq-bang th, html body [data-list-module="cashbook"] table.sq-bang td { padding: 8px 6px; }
  html body [data-list-module="cashbook"] table.sq-bang th:first-child, html body [data-list-module="cashbook"] table.sq-bang td:first-child,
  html body [data-list-module="cashbook"] table.sq-bang tr > .sq-c-nd { padding-left: 12px; }
  html body [data-list-module="cashbook"] table.sq-bang tr > .sq-c-chi { padding-right: 12px; }
  html body [data-list-module="cashbook"] table.sq-bang td.sq-c-thu, html body [data-list-module="cashbook"] table.sq-bang td.sq-c-chi { font-size: 13px; }
  html body [data-list-module="cashbook"] table.sq-bang tr.sq-tong-hang > td.sq-c-thu, html body [data-list-module="cashbook"] table.sq-bang tr.sq-tong-hang > td.sq-c-chi,
  html body [data-list-module="cashbook"] .sq-tong-ton { font-size: 14px; }
  html body [data-list-module="cashbook"] .sq-tong-trai .itn-spark { display: none; }
  html body [data-list-module="cashbook"] button.sq-nd { font-size: 14px; }
  .sq-nd-tg { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
}
@media (max-width: 760px) { .sq-dau-nut > button { min-height: 44px; } }
/* Điện thoại (13/10/2026, đo 390px): nút Nội dung (button.sq-nd) chỉ cao một dòng chữ (~20px). ::after phủ cả ô Nội dung (ô ≥ 44px vì
   còn dòng người nộp / giờ bên dưới) — bấm chỗ nào trong ô cũng là bấm nút, bảng không đổi bố cục. Cả dòng vốn đã mở phiếu
   ([data-sq-hang]) nên không đổi hành vi; ::after chỉ để chính nút đủ vùng chạm 44px. */
@media (max-width: 760px) {
  table.sq-bang td.sq-c-nd { position: relative; }
  table.sq-bang button.sq-nd::after { content: ""; position: absolute; inset: 0; }
}
/* Hộp "Chi" (<dialog> gốc: Esc / Hủy đóng). Bo 8px, nút chính Apple Blue theo theme. */
dialog.sq-hop { position: fixed; inset: 0; margin: auto; height: fit-content; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-card); color: var(--text-main); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
dialog.sq-hop::backdrop { background: rgba(0, 0, 0, .35); }
.sq-hop-f { display: grid; gap: 10px; padding: 18px 18px 16px; margin: 0; }
.sq-hop-td { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-main); }
.sq-hop-mo { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.sq-o { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-main); }
.sq-nhap { width: 100%; min-height: 44px; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input, var(--bg-card));
  color: var(--text-main); font: inherit; font-weight: 400; font-size: 16px; }
textarea.sq-nhap { resize: vertical; min-height: 64px; }
.sq-nhap:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 1px; border-color: var(--theme-accent-strong, #0071e3); }
.sq-nhap[aria-invalid="true"] { border-color: var(--txt-bad); }
.sq-tien-o { position: relative; display: block; }
.sq-tien-o .sq-nhap { padding-right: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.sq-tien-o > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 400; }
.sq-loi { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; font-size: 13px; color: var(--txt-bad); }
.sq-hop-tt { display: grid; gap: 8px; margin: 0; }
.sq-hop-tt > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; }
.sq-hop-tt dt { color: var(--text-muted); font-size: 13px; }
.sq-hop-tt dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sq-hop-nut { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
html body .sq-hop-nut > button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; }
/* Hộp phiếu / "Yêu cầu phê duyệt" (27/09/2026): máy tính hộp giữa 480px; điện thoại tấm trượt từ dưới lên, hai nút chia đôi.
   Từ chối / Huỷ = viền đỏ (không nền); Đồng ý = Apple Blue (nút chính theme). */
dialog.sq-hop.sq-phieu { width: min(480px, calc(100vw - 32px)); }
.sq-phieu-dau { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sq-phieu-dau .sq-hop-mo { margin-top: 2px; }
.sq-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -10px 0 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-muted); cursor: pointer; }
.sq-ic:hover { background: var(--bg-card-hover, rgba(0, 0, 0, .05)); color: var(--text-main); }
.sq-ic:focus-visible, .sq-nut-tu:focus-visible, .sq-ls-nut:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
/* Hàng thông tin như mẫu duyệt: nhãn trái, giá trị căn phải, đường kẻ mảnh phân hàng; số tiền đậm, tabular. */
.sq-phieu .sq-hop-tt { gap: 0; }
.sq-phieu .sq-hop-tt > div { grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--border-color); }
.sq-phieu .sq-hop-tt dt { font-size: 14px; color: var(--text-main); font-weight: 400; }
.sq-phieu .sq-hop-tt dd { text-align: right; font-weight: 500; }
.sq-hop-tt dd.sq-phieu-tien { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sq-phieu .sq-hop-nut > button { flex: 1 1 0; }
.sq-keo { display: none; }
.sq-o-phu { font-weight: 400; color: var(--text-muted); }
.sq-nut-tu { min-height: 44px; padding: 0 16px; border: 1px solid var(--txt-bad); border-radius: 8px; background: transparent; color: var(--txt-bad); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.sq-nut-tu:hover:not(:disabled) { background: rgba(215, 0, 21, .06); }
.sq-nut-tu:disabled { opacity: .55; cursor: default; }
.sq-ls-nut { display: inline-flex; align-items: center; gap: 6px; justify-self: start; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; border-radius: 8px; }
.sq-ls-nut:hover { color: var(--text-main); }
.sq-ls-ds { font-size: 12px; line-height: 1.6; color: var(--text-main); padding: 8px 10px; border-radius: 8px; background: var(--bg-card-hover, rgba(0, 0, 0, .03)); }
@media (max-width: 760px) {
  dialog.sq-hop, dialog.sq-hop.sq-phieu { inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 88dvh; border-radius: 8px 8px 0 0; border-bottom: 0; }
  dialog.sq-hop .sq-hop-f { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .sq-keo { display: block; justify-self: center; width: 36px; height: 5px; margin: -8px 0 2px; border-radius: 3px; background: var(--border-color); }
  .sq-hop-nut > button { flex: 1 1 0; }
}
@media (prefers-reduced-motion: no-preference) { dialog.sq-hop[open] { animation: sq-hop-vao .16s ease-out; } }
@keyframes sq-hop-vao { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Thẻ số liệu co theo khung (không đẩy trang tràn ngang khi số lớn + biểu đồ nhỏ) */
html body .dash-exec-kpis > *, html body .dash-exec-kpi-card .kpi-body { min-width: 0; }
.kpi-spark-row .itn-spark { margin-bottom: 4px; }

/* Lời chào theo giờ + gợi ý giao diện tối buổi tối (không ép, bấm Để sau là thôi trong ngày). */
.dash-greet { margin: 0 0 2px; font-size: 22px; font-weight: 750; letter-spacing: -.02em; color: var(--text-main); }
.itn-goi-y-toi { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 0; padding: 10px 14px; border-radius: var(--itn-r-md); border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); font-size: 14px; }
.itn-goi-y-toi svg { color: var(--txt-accent); flex: none; }
.itn-goi-y-toi span { flex: 1 1 180px; }
.itn-goi-y-toi button { min-height: 44px; padding: 0 16px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--border-color); background: transparent; color: var(--text-main); }
.itn-goi-y-toi button[data-goi-y-toi="chuyen"] { background: var(--theme-accent-strong, #0071e3); color: #fff; border-color: transparent; }

/* Đổi chi nhánh: số liệu mờ dần vào nhẹ thay vì nhảy số (tắt khi giảm chuyển động). */
@keyframes itn-fade-in { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) { .scene-enter-fade { animation: itn-fade-in .22s var(--itn-ease) both; } }

/* Tài khoản › Phản hồi trên máy này (rung / âm báo — mặc định tắt): công tắc cỡ cố định — xem styles.css ".tk-switch" (26/09/2026). */

/* Thẻ bảo hành dạng thẻ số (màn Bảo hành › Tra cứu): nền theo gói — gói càng đắt càng sang (cùng thang màu nhãn gói). */
.bh-the-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 12px; }
.bh-the { --the-a: #3a4150; --the-b: #1f2430; --the-ink: #fff; --the-mut: rgba(255,255,255,.9);
  position: relative; overflow: hidden; display: grid; gap: 6px; padding: 16px 18px 14px; border-radius: 18px; color: var(--the-ink);
  background: linear-gradient(135deg, var(--the-a), var(--the-b)); box-shadow: 0 10px 28px rgba(0,0,0,.18); aspect-ratio: auto; }

.bh-the.goi-care { --the-a: #177a41; --the-b: #14603a; }
.bh-the.goi-plus { --the-a: #0a7282; --the-b: #0b6477; }
.bh-the.goi-basic { --the-a: #2268c2; --the-b: #0b4f9c; }
.bh-the.goi-pro { --the-a: #7244dc; --the-b: #4d2aa8; }
.bh-the.goi-gold { --the-a: #f6d36b; --the-b: #c4921f; --the-ink: #2e1e00; --the-mut: rgba(46,30,0,.9); }
.bh-the.goi-diamond { --the-a: #e3f5ff; --the-b: #8fb8f2; --the-ink: #0b2f5e; --the-mut: rgba(11,47,94,.9); }
.bh-the.goi-premium { --the-a: #2c2c30; --the-b: #0e0e10; --the-ink: #f3d27e; --the-mut: rgba(243,210,126,.72); box-shadow: 0 10px 28px rgba(0,0,0,.28), inset 0 0 0 1px rgba(201,165,75,.55); }
.bh-the p { margin: 0; }
.bh-the-dau { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bh-the-mark { display: grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 7px; background: var(--itn-mark-bg); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -.02em; }
.bh-the-ten { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--the-mut); }
.bh-the-goi { margin-left: auto; font-size: 15px; font-weight: 800; letter-spacing: .06em; }
.bh-the-khach { font-size: 16px; font-weight: 700; }
.bh-the-may { font-size: 14px; color: var(--the-mut); }
.bh-the-imei { font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: .03em; color: var(--the-mut); }
.bh-the-imei b { color: var(--the-ink); }
.bh-the-han { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.bh-the-han span { display: block; font-size: 11px; color: var(--the-mut); }
.bh-the-han strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.bh-the-thanh { height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--the-ink) 22%, transparent); overflow: hidden; margin-top: 6px; }
.bh-the-thanh i { display: block; height: 100%; border-radius: 5px; background: var(--the-ink); }
.bh-the-con { font-size: 12px; color: var(--the-mut); }
.bh-the-ql { margin-top: 4px; font-size: 13px; }
.bh-the-ql summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.bh-the-ql ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bh-the-ql li { display: flex; justify-content: space-between; gap: 10px; color: var(--the-mut); }
.bh-the-ql li b { flex: none; color: var(--the-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.bh-the-trung { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: color-mix(in srgb, var(--the-ink) 14%, transparent); color: var(--the-ink); }

/* ---------- Thanh header điện thoại (26/09/2026, anh Nghĩa: "thanh ngang lỗi") ----------
   (1) Ô chọn chi nhánh đã có mũi tên của hệ điều hành → bỏ ký tự ▾ thừa (hiện thành chấm xanh nhỏ lạ).
   (2) ≤600px dòng phụ dưới "iTN Store" bị ẩn nhưng logo vẫn chiếm 2 hàng lưới (themes.css) → chữ dính lên trên; về 1 hàng.
   (3) Nút chi nhánh cao 52px = cả thanh (ô chọn 40px + đệm 5px trên dưới) → sát mép; bỏ đệm dọc, còn 44px. */
html body.itn-shell .header-branch-pill .branch-chevron { display: none !important; }
@media (max-width: 600px) {
  html body[data-itn-theme] .header-brand { grid-template-rows: auto; }
  html body[data-itn-theme] .header-brand :is(.itn-mark, .header-logo-img) { grid-row: auto; }
  html body.itn-shell .header-branch-pill { padding: 0 6px !important; min-height: 44px; max-width: 164px !important; flex: 0 0 auto; box-sizing: border-box; }
  html body.itn-shell .header-branch-pill .branch-label-dim { display: none !important; }
  html body.itn-shell .header-branch-pill select { min-width: 102px !important; max-width: 150px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
}
@media (max-width: 420px) {
  html body[data-itn-theme].itn-shell #app-header, body.itn-shell #app-header { padding: 7px 8px !important; }
  html body.itn-shell #app-header .header-left { min-width: 0; gap: 4px !important; flex: 1 1 auto; }
  html body.itn-shell #app-header .header-right { gap: 2px !important; }
  html body.itn-shell .header-branch-pill { min-width: 0; flex: 0 0 auto; padding: 0 4px !important; max-width: 156px !important; }
  html body.itn-shell .header-branch-pill select { min-width: 102px !important; max-width: 146px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
}

/* Dải "Đã có bản cập nhật" (app-shell.js banMoi): cố định trên cùng giữa màn, Apple Blue, nút ≥ 44px; trên điện thoại tràn đủ bề ngang (16px lề). */
.itn-ban-moi { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 14px; border-radius: 8px; background: var(--theme-accent-strong, #0071e3); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.itn-ban-moi button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: #fff; color: var(--theme-accent-strong, #0071e3); font: inherit; font-weight: 700; cursor: pointer; }
.itn-ban-moi button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 760px) { .itn-ban-moi { left: 16px; right: 16px; transform: none; justify-content: space-between; } }

/* Đổi bảo hành / nâng đời hóa đơn hệ thống cũ (037, KPI đợt 2) — form trong hộp hóa đơn: nhóm theo nghiệp vụ, ô 44px bo 8px, lỗi ngay dưới ô. */
.doi-cu .doi-cu-tt { margin: 0 0 6px; font-size: 14px; color: var(--text-main); }
.doi-cu .doi-cu-het { color: var(--txt-bad, #c0262d); font-weight: 600; }
.doi-cu .doi-cu-ghi { margin: 8px 0 12px; font-size: 13px; color: var(--text-muted); }
.doi-cu .doi-cu-canh { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--txt-warn, #b25e00); background: var(--bg-card-hover, rgba(0,0,0,.03)); border-radius: 8px; font-size: 14px; color: var(--text-main); }
.doi-cu .doi-cu-nhom { border: 0; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.doi-cu .doi-cu-nhom legend { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); margin-bottom: 6px; }
.doi-cu .doi-cu-f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-main); }
.doi-cu .doi-cu-f input, .doi-cu .doi-cu-f select { min-height: 44px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-input, var(--bg-card)); color: var(--text-main); font: inherit; font-size: 15px; font-weight: 400; }
.doi-cu .doi-cu-f input:focus-visible, .doi-cu .doi-cu-f select:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 1px; }
/* Bảo hành sau khi đổi (070, 03/10/2026): 2 lựa chọn radio dạng hàng ≥ 44px chiếm cả hàng; khối chỉnh 2 cột (1 cột điện thoại theo .doi-cu-nhom). */
.doi-cu .doi-cu-bh .doi-cu-chon { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.doi-cu .doi-cu-bh .doi-cu-chon input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--theme-accent-strong, #0071e3); }
.doi-cu .doi-cu-bh .doi-cu-chon span { display: grid; gap: 2px; }
.doi-cu .doi-cu-bh .doi-cu-chon small { color: var(--text-muted); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.doi-cu .doi-cu-bh-o { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.doi-cu .doi-cu-bh-o[hidden] { display: none; }
@media (max-width: 640px) { .doi-cu .doi-cu-bh-o { grid-template-columns: minmax(0, 1fr); } }
.doi-cu .doi-cu-f input[aria-invalid="true"] { border-color: var(--txt-bad, #c0262d); }
.doi-cu .doi-cu-loi { min-height: 0; font-size: 12px; font-weight: 600; color: var(--txt-bad, #c0262d); }
.doi-cu .doi-cu-loi:empty { display: none; }
@media (max-width: 760px) { .doi-cu .doi-cu-nhom { grid-template-columns: 1fr; } }
.bh-the-doi { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; border-left: 3px solid var(--the-ink); background: color-mix(in srgb, var(--the-ink) 10%, transparent); color: var(--the-ink); margin: 4px 0 0; }

/* Gửi cảnh báo khẩn (29/09/2026; 05/10/2026 thành NÚT ICON): khiên Lucide 44×44 bo 8px cạnh chuông, cùng khung với chuông (.tb-nut) nhưng
   icon + viền đỏ nhẹ (--theme-danger) để nhận ra; không chữ to. Chỉ tắt (mờ) trong lúc đang gửi — bấm bao nhiêu lần gửi bấy nhiêu. */
.cb-ic-nut { position: relative; display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--theme-danger, #c0262d) 45%, var(--border-color)); border-radius: 8px;
  background: color-mix(in srgb, var(--theme-danger, #c0262d) 7%, var(--bg-card)); color: var(--theme-danger, #c0262d); cursor: pointer; }
.cb-ic-nut:hover:not(:disabled) { background: color-mix(in srgb, var(--theme-danger, #c0262d) 14%, var(--bg-card)); }
.cb-ic-nut:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
.cb-ic-nut:disabled { cursor: default; color: var(--text-muted); border-color: var(--border-color); background: var(--bg-card); }
.cb-ic-nut[aria-busy="true"] { cursor: progress; }
.cb-ic-nut .cb-ic { flex: none; }
.cb-khan { max-width: 560px; margin: 0 auto; padding-block: 8px; display: grid; gap: 12px; }
.cb-khan .cb-tieu-de { margin: 0; font-size: 20px; }
.cb-khan .cb-dong { display: flex; align-items: center; gap: 12px; }
.cb-khan .cb-mo-ta { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.cb-khan .cb-trang-thai { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--text-main); }
/* Chuyển trang mượt (28/09/2026): Tổng quan / Hóa đơn ↔ Kho / Bán hàng là hai trang — trình duyệt hỗ trợ (Safari 18.2+, Chrome 126+)
   giữ màn cũ rồi chuyển mờ nhanh sang màn mới thay vì nháy trắng. Người dùng tắt chuyển động → không hiệu ứng. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ══ SẮP XẾP MENU (anh Nghĩa 01/10/2026: "các nút menu mỗi người tự sắp xếp vị trí") ═══════════════════════════════════════
   Lối vào: nút cuối thanh bên (máy tính / tablet), dòng cuối bảng "Thêm" (điện thoại), mục Menu ở Tài khoản. Hộp "Sắp xếp menu": máy tính giữa màn
   480px; điện thoại tấm trượt đáy toàn bề ngang. Mỗi dòng: tay nắm kéo + số thứ tự + icon + tên + 2 nút Lên / Xuống 44×44. Bo ≤ 8px, chỉ token theme. */
body.itn-shell #app-nav .sb-cuoi { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--sb-line); }
body.itn-shell #app-nav .sb-sap { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--sb-muted); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; text-align: left; cursor: pointer; }
body.itn-shell #app-nav .sb-sap:hover { background: var(--sb-hover); color: var(--text-main); }
body.itn-shell #app-nav .sb-sap:focus-visible { outline: 2px solid var(--sb-indicator); outline-offset: -2px; }
body.itn-shell #app-nav .sb-sap svg { flex: none; }
@media (min-width: 1024px) and (max-width: 1279px) {
  body.itn-shell #app-nav .sb-sap { flex-direction: column; justify-content: center; gap: 4px; min-height: 56px; padding: 6px 2px; font-size: 10.5px; text-align: center; white-space: normal; line-height: 1.15; }
}
.itn-more-sap { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 22px; padding: 0 14px;
  border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card, transparent); color: var(--text-main); font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.itn-more-sap svg { color: var(--sb-active-text); }
.itn-more-sap:focus-visible { outline: 2px solid var(--sb-indicator); outline-offset: 2px; }

.itn-sx { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.itn-sx-nen { position: absolute; inset: 0; background: rgba(8, 12, 20, .42); }
.itn-sx-bang { position: relative; display: flex; flex-direction: column; width: min(480px, 100%); max-height: min(86dvh, 760px); overflow: hidden;
  background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--itn-shadow-2); }
.itn-sx-dau { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 4px 20px; }
.itn-sx-dau h2 { margin: 0; font-size: 18px; }
.itn-sx-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--text-main); cursor: pointer; }
.itn-sx-x:hover { background: var(--bg-card-hover, var(--bg-input)); }
.itn-sx-gt { margin: 0; padding: 0 20px 12px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.itn-sx-ds { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border-color); }
/* Dòng: tay nắm 44px (bấm là kéo ngay) · số · icon · tên · Lên · Xuống. Nhấn giữ ~0,3 giây chỗ khác trên dòng cũng kéo được → không chọn chữ / không menu iOS. */
.itn-sx-muc { position: relative; display: grid; grid-template-columns: 44px 20px 20px minmax(0, 1fr) 44px 44px; align-items: center; gap: 8px; min-height: 56px; padding: 6px 12px 6px 4px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  border-bottom: 1px solid var(--border-color); background: var(--bg-card); }
.itn-sx-muc > svg { color: var(--sb-active-text); }
.itn-sx-keo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--text-muted); cursor: grab; touch-action: none; }
.itn-sx-keo:hover { background: var(--bg-card-hover, var(--bg-input)); color: var(--text-main); }
.itn-sx-so { font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: center; font-variant-numeric: tabular-nums; }
.itn-sx-ten { min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.itn-sx-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--theme-accent-soft); color: var(--txt-accent, var(--text-main)); font-size: 11px; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.itn-sx-nut { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--itn-nut-vien, var(--border-color)); border-radius: 8px;
  background: var(--bg-card); color: var(--text-main); cursor: pointer; }
.itn-sx-nut:hover:not(:disabled) { background: var(--bg-card-hover, var(--bg-input)); }
.itn-sx-nut:disabled { opacity: .35; cursor: default; }
.itn-sx-nut:focus-visible, .itn-sx-x:focus-visible, .itn-sx-chan button:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
/* Đang kéo: dòng được kéo nhấc nhẹ (viền nhấn + bóng mảnh, không bóng nặng) và đi theo ngón tay; các dòng khác trượt ra chừa chỗ thả.
   Giảm chuyển động (.is-tinh): các dòng nhảy thẳng chỗ mới, không trượt. */
.itn-sx-ds.is-keo { cursor: grabbing; }
.itn-sx-ds.is-keo .itn-sx-muc { transition: transform .16s ease; }
.itn-sx-ds.is-keo.is-tinh .itn-sx-muc, .itn-sx-ds.is-keo .itn-sx-muc.is-nang { transition: none; }
.itn-sx-muc.is-nang { z-index: 2; background: var(--bg-card); box-shadow: 0 0 0 2px var(--theme-accent-strong), 0 4px 12px rgba(15, 23, 42, .12); }
.itn-sx-muc.is-nang .itn-sx-keo { color: var(--txt-accent, var(--theme-accent-strong)); }
@media (prefers-reduced-motion: reduce) { .itn-sx-ds.is-keo .itn-sx-muc { transition: none; } }
/* Nhấn giữ mục menu bằng ngón tay mở "Sắp xếp menu": không bật xem trước liên kết / menu iOS trên mục menu. */
#app-nav [data-shell-key], #iphone-bottom-bar [data-shell-key], #itn-more [data-shell-key] { -webkit-touch-callout: none; }
.itn-sx-loi { display: flex; align-items: flex-start; gap: 8px; margin: 10px 20px 0; color: var(--txt-bad); font-size: 13px; font-weight: 600; }
.itn-sx-loi[hidden] { display: none; }
.itn-sx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.itn-sx-chan { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border-color); }
.itn-sx-chan .itn-sx-gian { flex: 1 1 auto; }
.itn-sx-chan button { --itn-nut-bo: 8px; }
html body #itn-sx .itn-sx-chan button { border-radius: 8px !important; min-height: 44px; }   /* bo ≤ 8px cho phần mới (nút chung của app là viên thuốc) */
html.itn-sx-mo, html.itn-sx-mo body { overflow: hidden; }
@media (max-width: 760px) {
  .itn-sx { place-items: end stretch; padding: 0; }
  .itn-sx-bang { width: 100%; max-height: 92dvh; border-radius: 8px 8px 0 0; border-bottom: 0; }
  .itn-sx-chan .itn-sx-gian { display: none; }
  .itn-sx-chan [data-sx="mac-dinh"] { flex: 1 1 100%; }
  .itn-sx-chan [data-sx="huy"], .itn-sx-chan [data-sx="luu"] { flex: 1 1 0; }
}
@media (prefers-reduced-motion: no-preference) { .itn-sx-bang { animation: itn-sheet .2s var(--itn-ease) both; } }

/* ══ TRUY CẬP NHANH (anh Nghĩa 04/10/2026: "truy cập nhanh ở tất cả các màn hình tổng quan, có thể thêm bất kì mục nào") ═════════════════════════════
   Khối trên Tổng quan: tiêu đề + nút Chỉnh sửa / Thêm mục; lưới ô (icon + tên) tự xếp theo bề ngang (máy tính ≥150px/ô, điện thoại 2 cột). Ô ≥ 52px,
   bo 8px, viền mảnh chỉ để tách ô, chỉ token theme — không card lồng card (khối nằm thẳng trong Tổng quan). Hộp chọn dùng lại khung .itn-sx (giữa màn /
   tấm trượt đáy): phần "Đang hiện" có Lên / Xuống / Bỏ 44×44, phần "Thêm mục" có nút Thêm. */
.itn-nhanh { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 16px 14px; }
.itn-nhanh-dau { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.itn-nhanh-td { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 700; }
.itn-nhanh-td-ico { flex: none; color: var(--txt-accent, var(--theme-accent-strong)); }
.itn-nhanh-sua { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-right: -8px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--txt-accent, var(--theme-accent-strong)); font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap; }
.itn-nhanh-sua:hover { background: var(--theme-accent-soft); }
.itn-nhanh-sua:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.itn-nhanh-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
html body .itn-nhanh .itn-nhanh-o { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border: 1px solid var(--border-color); border-radius: 8px !important;
  background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.25; text-align: left; text-decoration: none; cursor: pointer;
  transition: border-color .15s var(--itn-ease), background-color .15s var(--itn-ease); }
html body .itn-nhanh .itn-nhanh-o:hover { border-color: var(--theme-accent-strong, #0071e3); background: var(--bg-card-hover, var(--bg-input)); }
html body .itn-nhanh .itn-nhanh-o:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
.itn-nhanh-ico { flex: none; color: var(--txt-accent, var(--theme-accent-strong)); }
.itn-nhanh-ten { min-width: 0; overflow-wrap: anywhere; }
.itn-nhanh-cha { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 500; line-height: 1.2; color: var(--text-muted); }
.itn-nhanh-trong { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-muted); }
@media (max-width: 760px) {
  .itn-nhanh { padding: 8px 12px 12px; }
  .itn-nhanh-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body .itn-nhanh .itn-nhanh-o { padding: 0 10px; }
}
@media (max-width: 340px) { .itn-nhanh-luoi { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { html body .itn-nhanh .itn-nhanh-o { transition: none; } }
/* Hộp chọn */
.itn-cn-than { padding-bottom: 8px; }
.itn-cn-nhom { margin: 0; padding: 12px 20px 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); }
.itn-cn-ds { margin: 0; padding: 0; list-style: none; }
.itn-cn-muc { display: grid; grid-template-columns: 20px minmax(0, 1fr) 44px 44px 44px; align-items: center; gap: 8px; min-height: 56px; padding: 6px 12px 6px 20px;
  border-top: 1px solid var(--border-color); background: var(--bg-card); }
.itn-cn-muc:last-child { border-bottom: 1px solid var(--border-color); }
.itn-cn-muc.is-them { grid-template-columns: 20px minmax(0, 1fr) auto; }
.itn-cn-muc > svg { color: var(--sb-active-text); }
.itn-cn-bo { color: var(--txt-bad); }
.itn-cn-them { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 8px; border: 1px solid var(--itn-nut-vien, var(--border-color)); border-radius: 8px;
  background: var(--bg-card); color: var(--text-main); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.itn-cn-them:hover:not(:disabled) { border-color: var(--theme-accent-strong); }
.itn-cn-them:disabled { opacity: .35; cursor: default; }
.itn-cn-them:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
.itn-cn-trong { margin: 0; padding: 6px 20px 10px; font-size: 13px; line-height: 1.45; color: var(--text-muted); }
.itn-cn-cha { padding: 10px 20px 2px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.itn-cn-muc.is-con { padding-left: 36px; }
.itn-cn-chat { color: var(--text-muted); font-weight: 500; }
/* Hộp sắp xếp thứ tự dùng chung (.itn-tt): số · icon · tên · Lên · Xuống. */
.itn-tt-muc { display: grid; grid-template-columns: 20px 20px minmax(0, 1fr) 44px 44px; align-items: center; gap: 8px; min-height: 56px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--border-color); background: var(--bg-card); }
.itn-tt-muc > svg { color: var(--sb-active-text); }
/* Khối Tổng quan sắp xếp được (tq-khoi) + thanh công cụ nhỏ "Sắp xếp" ở biến thể không có hàng điều khiển. */
.tq-khoi:empty { display: none; }
.tq-congcu { display: flex; justify-content: flex-end; margin: -8px 0 -8px; }
.tq-sap { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.tq-sap:hover { background: var(--theme-accent-soft); color: var(--text-main); }
.tq-sap:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
@media (max-width: 760px) { .itn-sx-chan [data-tt="mac-dinh"] { flex: 1 1 100%; } .itn-sx-chan [data-tt="huy"], .itn-sx-chan [data-tt="luu"] { flex: 1 1 0; } }
@media (max-width: 760px) { .itn-sx-chan [data-cn="bo-het"] { flex: 1 1 100%; } .itn-sx-chan [data-cn="huy"], .itn-sx-chan [data-cn="luu"] { flex: 1 1 0; } }

/* ---------- Dải mục con (03/10/2026, "Hàng hoá / Kho" gộp 5 mục) ----------
   Nằm ngay trên #module-content, cuộn ngang khi chật (không kéo cả trang). Ô bấm ≥ 44px, bo 8px; mục đang mở nền Apple Blue chữ trắng
   như dải tab trong demo anh đã duyệt. Nút vẫn có trong trang khi dải ẩn (backend-ui mở view bằng nút này). */
.itn-mucon { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 0 14px; padding: 2px 0 4px; }
.itn-mucon::-webkit-scrollbar { display: none; }
.itn-mucon[hidden] { display: none !important; }
html body .itn-mucon .itn-mucon-item {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px !important;
  border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .15s var(--itn-ease), color .15s var(--itn-ease);
}
html body .itn-mucon .itn-mucon-item .nav-ico { width: 18px; height: 18px; flex: 0 0 18px; }
html body .itn-mucon .itn-mucon-item:hover { border-color: var(--theme-accent-strong, #0071e3); }
html body .itn-mucon .itn-mucon-item.active, html body .itn-mucon .itn-mucon-item[aria-current="page"] {
  background: var(--theme-accent-strong, #0071e3); border-color: var(--theme-accent-strong, #0071e3); color: #fff;
}
html[data-itn-theme="graphite"] body .itn-mucon .itn-mucon-item:is(.active, [aria-current="page"]),
html[data-itn-theme="gold-noir"] body .itn-mucon .itn-mucon-item:is(.active, [aria-current="page"]) {
  color: var(--bg-app, #101216) !important;
}
html body .itn-mucon .itn-mucon-item:focus-visible { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
.backend-mode .itn-mucon { padding-inline: 16px; }
@media (max-width: 760px) {
  .backend-mode .itn-mucon { padding-inline: 8px; margin-bottom: 8px; }
  html body .itn-mucon .itn-mucon-item { padding: 0 12px; }
}
@media (max-width: 420px) { html body .itn-mucon .itn-mucon-item .nav-ico { display: none; } }   /* điện thoại hẹp: bỏ icon cho đủ chỗ chữ */
@media (prefers-reduced-motion: reduce) { html body .itn-mucon .itn-mucon-item { transition: none; } }

/* ===== SỔ QUỸ — đường kẻ + cột Chuyển khoản (anh Nghĩa duyệt 06/10/2026, demo de-xuat-v2) =====
   Cả hai sổ: kẻ dọc giữa các cột + kẻ ngang mảnh giữa các dòng, màu viền theo theme (sáng / tối tự đổi qua --border-color).
   Sổ kỹ thuật: Thu chia "Tiền mặt" | "Chuyển khoản (không vào quỹ)" — số chuyển khoản màu chữ phụ (không phải tiền trong két). */
html body table.sq-bang tbody > tr > td { border-bottom: 1px solid var(--border-color) !important; }
html body table.sq-bang tr > th + th, html body table.sq-bang tr > td + td { border-left: 1px solid var(--border-color) !important; }
html body table.sq-bang thead tr:first-child > th, html body table.sq-bang thead tr.sq-con > th { border-bottom: 1px solid var(--border-color) !important; }
html body table.sq-bang th.sq-c-thu-nhom { text-align: center; }
html body table.sq-bang tr.sq-con > th.sq-c-thu { border-left: 1px solid var(--border-color) !important; }
html body table.sq-co-ck th[rowspan] { vertical-align: bottom; }
html body table.sq-bang .sq-c-ck { width: 1%; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
html body table.sq-bang th.sq-c-ck { white-space: normal; line-height: 1.25; min-width: 84px; }
.sq-ck-ghi-th { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); }
html body table.sq-bang td.sq-c-ck { font-weight: 600; color: var(--text-muted) !important; }
html body table.sq-bang tr.sq-tong-hang > td.sq-c-ck { color: var(--text-muted) !important; font-size: 17px; font-weight: 600; }
html body table.sq-bang tr.sq-ck-trung > td.sq-c-ck { text-decoration: line-through; font-weight: 500; }
table.sq-bang tr.sq-dong-ck { cursor: default; }
table.sq-bang tr.sq-dong-ck:hover > td { background: transparent; }
.sq-nd-ck { display: block; font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--text-main); overflow-wrap: anywhere; }
/* Hộp "+ Thu" sổ kỹ thuật: chọn hình thức (hai ô to ≥ 44px, như nút chọn sổ). */
.sq-ht { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.sq-ht-td { grid-column: 1 / -1; padding: 0; margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--text-main); }
.sq-ht-o { position: relative; display: block; }
.sq-ht-o input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sq-ht-o span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 10px; box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-card); color: var(--text-main); font-size: 15px; font-weight: 600; text-align: center; }
.sq-ht-o input:checked + span { border-color: var(--theme-accent-strong, #0071e3); background: var(--theme-accent-soft, rgba(0, 113, 227, .1)); color: var(--theme-accent-strong, #0071e3); }
.sq-ht-o input:focus-visible + span { outline: 2px solid var(--theme-accent-strong, #0071e3); outline-offset: 2px; }
.sq-o-ghi { margin-top: -4px; font-size: 12px; }
@container sqcn (max-width: 519px) {
  html body [data-list-module="cashbook"] table.sq-bang td.sq-c-ck { font-size: 13px; }
  html body [data-list-module="cashbook"] table.sq-bang tr.sq-tong-hang > td.sq-c-ck { font-size: 14px; }
  html body [data-list-module="cashbook"] table.sq-co-ck th, html body [data-list-module="cashbook"] table.sq-co-ck td { padding-left: 5px; padding-right: 5px; }
  html body [data-list-module="cashbook"] table.sq-co-ck th.sq-c-ck { min-width: 0; }
  html body [data-list-module="cashbook"] table.sq-co-ck th, html body [data-list-module="cashbook"] table.sq-co-ck .sq-tong-ten, html body [data-list-module="cashbook"] table.sq-co-ck .sq-tong-dau { white-space: normal; }
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-tong-hang > td.sq-c-thu, html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-tong-hang > td.sq-c-ck,
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-tong-hang > td.sq-c-chi, html body [data-list-module="cashbook"] table.sq-co-ck .sq-tong-ton { font-size: 13px; }
  html body [data-list-module="cashbook"] table.sq-co-ck td.sq-c-thu, html body [data-list-module="cashbook"] table.sq-co-ck td.sq-c-ck, html body [data-list-module="cashbook"] table.sq-co-ck td.sq-c-chi { font-size: 12px; }
  /* iPhone (anh Nghĩa duyệt): mỗi số ghi rõ loại tiền — "Thu tiền mặt" / "Thu chuyển khoản" / "Chi". */
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-thu:not(:empty)::before,
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-ck:not(:empty)::before,
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-chi:not(:empty)::before { display: block; font-size: 10px; font-weight: 600; line-height: 1.3; color: var(--text-muted); white-space: normal; text-decoration: none; }
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-thu:not(:empty)::before { content: "Thu tiền mặt"; }
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-ck:not(:empty)::before { content: "Thu chuyển khoản"; }
  html body [data-list-module="cashbook"] table.sq-co-ck tr.sq-dong > td.sq-c-chi:not(:empty)::before { content: "Chi"; }
}

/* Lối quay lại chung cho mobile; các vùng bấm dài xuống dòng, không mất chữ. */
.itn-mobile-backbar { display:none; }
@media(max-width:760px){
 .itn-mobile-backbar { display:none!important; }
 body.itn-shell .main-viewport > main { padding-top:4px!important; }
 [data-itn-back] { min-height:44px; min-width:44px; padding:8px 14px; border:1px solid var(--border-color);border-radius:8px;background:var(--bg-card);color:var(--text-main);font:inherit;cursor:pointer; }
 .ns-sheet-h .ns-icon,.theme-picker-dialog [data-theme-close] { flex-shrink:0; }
 .ns-sheet-f button,.ns-ct-f button,.pilot-toolbar button,.ns-row button,.ts .ts-btn,.ns-tabs button,.lkw-seg button { white-space:normal!important;overflow-wrap:anywhere;height:auto;min-height:44px;line-height:1.35;padding-top:8px;padding-bottom:8px; }
}

/* Tấm "Thêm" dạng DANH SÁCH (anh Nghĩa 13/10/2026 "giao diện vậy nhìn xấu quá" — bản xem trước khung app, nhóm 2; thay lưới 2 cột
   thẻ lồng thẻ bo 18px của 08/10). Nền tấm = nền trang; dòng Tài khoản trên cùng; mỗi nhóm = tiêu đề chữ nhỏ in hoa + MỘT khối liền
   bo 8px; mỗi mục một hàng 52px: ô icon · tên · số chờ · ›; đường kẻ mảnh giữa hàng (thụt tới chữ). Tấm nằm TRÊN thanh đầu (z 100)
   nhưng dưới các ngăn (10040+) và thông báo nổi (10200). */
.itn-more { z-index: 1000; }
.itn-more .itn-more-sheet { background: var(--bg-app, var(--bg-main, #f2f2f7)); border-radius: 8px 8px 0 0; padding: 6px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.itn-more .itn-more-head { position: sticky; top: -6px; z-index: 1; margin: 0 -16px; padding: 2px 16px 8px; background: var(--bg-app, var(--bg-main, #f2f2f7)); }
.itn-more .itn-more-head strong { font-size: 17px; font-weight: 700; }
.itn-more .itn-more-x { border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); }
.itn-more .itn-more-x:hover, .itn-more .itn-more-x:active { background: var(--bg-card-hover, rgba(0, 0, 0, .05)); color: var(--text-main); }
.itn-more .itn-more-list { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.itn-more-group { min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.itn-more-group h2 { margin: 0 0 6px; padding: 0 4px; font-size: 12px; font-weight: 600; line-height: 1.4; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.itn-more-grid { display: block; overflow: hidden; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card, #fff); }
.itn-more .itn-more-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; min-height: 52px; margin: 0; padding: 8px 14px;
  border: 0; border-radius: 0; outline: none; background: transparent; color: var(--text-main); font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.3; text-align: left; text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s ease; }
.itn-more .itn-more-grid .itn-more-item + .itn-more-item::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--border-color); }
.itn-more .itn-more-grid .itn-more-item svg { box-sizing: content-box; width: 20px; height: 20px; padding: 7px; border-radius: 8px; background: color-mix(in srgb, var(--sb-active-text, var(--theme-accent-strong)) 10%, var(--bg-card, #fff)); color: var(--sb-active-text); }
.itn-more .itn-more-item .tab-label { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.itn-more .itn-more-item .nav-badge { position: static; margin: 0; }
.itn-more .itn-more-item::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); color: var(--text-muted); opacity: .55; }
.itn-more .itn-more-item:active { background: var(--bg-card-hover, rgba(0, 0, 0, .04)); }
.itn-more .itn-more-item:focus-visible { outline: 2px solid var(--sb-indicator); outline-offset: -2px; }
.itn-more .itn-more-grid .itn-more-item.active { background: var(--sb-active-bg); color: var(--sb-active-text); font-weight: 600; }
/* Dòng Tài khoản: khối riêng, chữ viết tắt trong vòng tròn (ảnh đại diện — được bo tròn theo DESIGN.md). */
.itn-more .itn-more-tk { min-height: 64px; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card, #fff); }
.itn-more-tk-av { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--sb-active-bg); color: var(--sb-active-text); font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.itn-more-tk-chu { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.itn-more-tk-chu strong { overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.itn-more-tk-chu span { overflow: hidden; font-size: 13px; font-weight: 400; color: var(--text-muted); text-overflow: ellipsis; white-space: nowrap; }
@media(min-width:1024px) {
 html body.itn-shell #app-nav .sb-folder { display:block; }
 html body.itn-shell #app-nav .sb-folder-toggle { display:flex;align-items:center;gap:10px;width:100%;min-height:48px;padding:10px 12px;border:0;border-radius:8px;background:transparent;color:var(--sb-text);font:inherit;font-size:14px;font-weight:600;line-height:1.45;text-align:left;cursor:pointer; }
 html body.itn-shell #app-nav .sb-folder-toggle>span:first-of-type { min-width:0;overflow-wrap:anywhere; }
 html body.itn-shell #app-nav .sb-chevron { margin-left:auto;flex-shrink:0; }
 html body.itn-shell #app-nav .sb-current>.sb-folder-toggle,html body.itn-shell #app-nav .sb-open>.sb-folder-toggle { background:var(--sb-active-bg);color:var(--sb-active-text); }
 html body.itn-shell #app-nav .sb-group-items { display:none;margin:6px 0 10px 21px;padding-left:8px;border-left:1px solid var(--sb-line); }
 html body.itn-shell #app-nav .sb-open>.sb-group-items { display:block; }
 html body.itn-shell #app-nav .sb-folder-toggle:focus-visible { outline:2px solid var(--sb-indicator);outline-offset:-2px; }
}
@media(min-width:1024px) and (max-width:1279px) {
 html body.itn-shell #app-nav .sb-folder-toggle { flex-direction:column;gap:4px;font-size:10.5px;padding:6px 2px;text-align:center; }
 html body.itn-shell #app-nav .sb-chevron { display:none; }
 html body.itn-shell #app-nav .sb-group-items { margin-left:0;padding-left:0;border:0; }
}

/* Flyout: rê chuột không đẩy vị trí các nhóm khác; dính sát rail để qua mục con không mất hover. */
@media(min-width:1024px) {
 html body.itn-shell #app-nav .sb-folder .sb-group-items { position:fixed;z-index:45;width:260px;max-width:calc(100vw - var(--sb-w) - 12px);max-height:calc(100dvh - 16px);overflow:auto;margin:0;padding:10px;border:1px solid var(--sb-line);border-radius:8px;background:var(--sb-bg);box-shadow:var(--itn-shadow-2); }
 html body.itn-shell #app-nav .sb-folder.sb-nguy { margin-top:20px;padding-top:14px;border-top:1px solid rgba(215,0,21,.35); }
 html body.itn-shell #app-nav .sb-folder.sb-nguy .sb-folder-toggle { color:var(--text-danger,#c72837); }
 html body.itn-shell #app-nav .sb-folder .sb-group-items .nav-tab-btn.sb-item { flex-direction:row;font-size:14px!important;min-height:44px;gap:10px;padding:10px!important;text-align:left; }
}
html body.itn-shell :is(.branch-fin-link, .exec-link-btn, .dash-action-btn-secondary, .dash-action-btn-primary, .action-btn-primary) { white-space: nowrap; }
html body.itn-shell :is(.kpi-value-lg, .kpi-val, .money-val, .pilot-summary article strong) { font-variant-numeric: tabular-nums; white-space: nowrap; }

.itn-more-danger h2, .itn-more .itn-more-danger .itn-more-item { color: var(--text-danger, #c72837); }
.itn-more-danger .itn-more-grid { border-color: var(--text-danger, #c72837); }

/* Hàng chờ giá (10/10/2026): nút cảnh báo vàng ở thanh bên + dải mục con Kho.
   !important vì nav.css/themes.css dùng #app-nav + body[data-itn-theme] (độ ưu tiên cao hơn) cho mọi nút menu. */
[data-shell-key="chogia"] { background:#fff4cc !important; color:#7a4f00 !important; border:1px solid #f2c94c !important; }
[data-shell-key="chogia"]:hover { background:#ffe9a3 !important; }
[data-shell-key="chogia"].active, [data-shell-key="chogia"][aria-current="page"] { background:#f2b705 !important; color:#3d2800 !important; border-color:#d99a00 !important; }
[data-shell-key="chogia"] svg { color:inherit !important; stroke:currentColor; }

/* ══ Khung app điện thoại (13/10/2026 — khảo sát trải nghiệm mobile, đo trên iPhone 18 Pro Max ảo, app 1.3 build 24) ═══════════
   1. Thanh đầu dính thật. ≤768px styles.css đặt overflow-x:hidden cho html, body và .main-viewport → .main-viewport thành một khung
      cuộn riêng (không bao giờ cuộn) nên mọi position:sticky trong trang mất tác dụng (cuộn 700px thì thanh đầu ở −692px), và khoá
      cuộn ở body (body.ns-sheet-mo, bl-mo, tb-mo…) không chặn được trang vì overflow của body không còn truyền ra viewport.
      overflow-x:clip (iOS 16+) vẫn cắt tràn ngang nhưng KHÔNG tạo khung cuộn; html để visible để overflow của body truyền ra viewport.
      Dòng `overflow-x:hidden` đứng trước là dự phòng cho trình duyệt chưa có clip (hành vi y như cũ).
   2. Thanh đầu dừng NGAY DƯỚI tai thỏ: khung cuộn giờ là viewport (body chỉ đẩy nội dung xuống một lần) nên top = safe-area-inset-top
      đúng một lần — khác lỗi 26/09 ("132px thay vì 70px"), khi đó khung cuộn là .main-viewport đã bị body đẩy xuống.
   3. --itn-tab-h: chiều cao tab đáy dùng chung cho thanh Lưu dính đáy trong trang (không chui dưới tab đáy). Bàn phím mở
      (html.itn-ban-phim, app-shell.js) → ẩn tab đáy như app iOS gốc và --itn-tab-h = 0.
   4. Thông báo nổi đặt TRÊN các ngăn (ngăn 10040–10100): "Đã lưu" không còn bị ngăn che. */
@media (max-width: 768px) {
  html { overflow-x: visible; }
  body, .main-viewport { overflow-x: hidden; overflow-x: clip; }
  body.itn-shell #app-header { top: env(safe-area-inset-top, 0px); }
  /* Bớt khoảng trống trên (anh Nghĩa 13/10/2026) + đồng bộ chiều cao 58px giữa main/backend, che kín khe góc bo khi cuộn qua thanh đầu. */
  html body[data-itn-theme].itn-shell #app-header,
  body.itn-shell #app-header {
    min-height: 58px !important;
    height: auto !important;
    padding: 7px 10px !important;
    border-radius: 8px !important;
    margin-bottom: 8px !important;
    background: var(--bg-card, var(--theme-header, #fff)) !important;
    box-shadow: 0 -12px 0 12px var(--bg-app, var(--bg-main, #f2f2f7)), var(--itn-shadow-1) !important;
  }
  /* 5. Khoá cuộn khi mở tấm Thêm / Cài đặt / Sắp xếp: CHỈ khoá ở html (= khung nhìn). Quy tắc cũ đặt overflow:hidden cho cả body →
        body thành khung cuộn riêng, thanh đầu dính theo body nên trôi lệch khi tấm mở (ảnh anh Nghĩa 13/10/2026 17:45). body giữ
        overflow-x:clip (không tạo khung cuộn). Khoá kiểu body.xxx-mo { overflow:hidden } thì không sao: html visible nên giá trị
        của body được chuyển lên khung nhìn. */
  html.itn-more-open body, html.itn-cd-mo body, html.itn-sx-mo body { overflow: visible; overflow-x: hidden; overflow-x: clip; }
}
@media (max-width: 425px) {
  /* Điện thoại nhỏ (390px) màn Tổng quan có đồng thời logo 44px + chọn chi nhánh + 5 nút 44px = 264px nút → phân bổ sát khít 372px lòng trong để không đè chữ "Toàn chuỗi" và giữ nguyên 100% vùng chạm ≥ 44×44px. */
  html body[data-itn-theme].itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select),
  body.itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select) {
    margin-inline: -4px !important;
    padding: 7px 4px !important;
    gap: 3px !important;
  }
  html body.itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select) .header-left { gap: 3px !important; flex: 1 1 auto; min-width: 0; }
  html body.itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select) .header-right { gap: 1px !important; flex: 0 0 auto; }
  html body.itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select) .header-branch-pill {
    padding: 0 3px !important;
    max-width: 98px !important;
    flex: 0 1 98px !important;
  }
  html body.itn-shell #app-header:has(.header-branch-pill:not(.tkn-an-cn) select) .header-branch-pill select {
    min-width: 90px !important;
    max-width: 90px !important;
    padding: 0 11px 0 1px !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em !important;
    background-size: 10px 10px !important;
    background-position: right 0 center !important;
  }
}
@media (max-width: 1023px), (pointer: coarse) {
  /* Mượt iPhone (31/10/2026): mọi ô nhập / chọn trên điện thoại & màn cảm ứng cỡ chữ tối thiểu 16px — chặn WebKit tự phóng to trang khi chạm vào ô, nhờ đó bỏ được khoá phóng to trợ năng ở thẻ viewport. Giữ nguyên .tkg-o (17px). */
  html body :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="hidden"]):not(.tkg-o):not(#sr-tiep):not(#sr-chot):not([name="salePrice"]),
    select,
    textarea
  ) {
    font-size: 16px !important;
  }
  html body button[data-sap] {
    min-height: 44px !important;
  }
  /* WebKit bỏ qua min-height trên <select> khi height là auto → đặt đồng thời height + min-height 44px để đạt chuẩn vùng chạm mà vẫn giữ mũi tên hệ thống. */
  html body select:not([multiple]):not([size]) {
    min-height: 44px !important;
    height: 44px !important;
  }
  html body #app-header .header-brand {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  /* Ô tick rời (Nhân sự, Kiểm kho): vùng chạm 44×44 thực tế trên chính phần tử nhưng hộp vẽ bên trong giữ đúng 20×20 sắc nét. */
  html body :is(input.ns-card-cb, input.stocktake-group-check) {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex: none;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: -10px -8px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    vertical-align: middle;
  }
  html body input.stocktake-group-check { margin: -10px 0 -10px -8px !important; }
  html body :is(input.ns-card-cb, input.stocktake-group-check)::before {
    content: "";
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border: 1.5px solid var(--itn-nut-vien, var(--border-color, #94a3b8));
    border-radius: 5px;
    background: var(--bg-card, #fff);
  }
  html body :is(input.ns-card-cb, input.stocktake-group-check):is(:checked, :indeterminate)::before {
    background: var(--theme-accent-strong, #0071e3);
    border-color: var(--theme-accent-strong, #0071e3);
  }
  html body :is(input.ns-card-cb, input.stocktake-group-check):checked::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 5px;
    border-left: 2.2px solid #fff;
    border-bottom: 2.2px solid #fff;
    transform: translateY(-1px) rotate(-45deg);
  }
  html body :is(input.ns-card-cb, input.stocktake-group-check):indeterminate::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 2.2px;
    background: #fff;
    border-radius: 1px;
  }
}
@media (max-width: 1023px) {
  /* Tab đáy gọn như tab bar iOS gốc (anh Nghĩa 13/10/2026 ảnh 18:00 "thanh bar nó cao quá, dư phía dưới"): ô 50px (trước 52 + đệm
     6 trên / 6 dưới), icon + chữ dồn lên trên; phần chừa thanh Home bớt 6px (vẫn trên vạch Home). Trước ~98pt, nay ~78pt. */
  :root { --itn-tab-cao: 50px; --itn-tab-duoi: max(4px, calc(env(safe-area-inset-bottom, 0px) - 6px)); --itn-tab-h: calc(var(--itn-tab-cao) + var(--itn-tab-duoi)); }
  html.itn-ban-phim { --itn-tab-h: 0px; }
  html.itn-ban-phim body.itn-shell #iphone-bottom-bar.iphone-bottom-bar { display: none !important; }
  .main-viewport .ts-thanh, .main-viewport .ns-sticky { bottom: var(--itn-tab-h); }
}
html body #itn-toast.itn-toast { z-index: 10200; }
/* Tấm mời bật thông báo (push-bridge.mjs hienMoiBatThongBao, app 1.4+): thay hộp hỏi iOS bật ngay lúc mở app. Không chặn màn,
   nằm trên tab đáy; hai nút ≥ 44px; màu theo token theme. */
.itn-push-moi { position: fixed; left: 12px; right: 12px; bottom: calc(var(--itn-tab-h, 0px) + 12px); z-index: 60; max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 14px; background: var(--bg-card, #fff); color: var(--text-main);
  border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--itn-shadow-2); }
.itn-push-moi > svg { width: 24px; height: 24px; margin-top: 2px; color: var(--theme-accent-strong); }
.itn-push-moi-chu { display: grid; gap: 2px; min-width: 0; }
.itn-push-moi-chu span { color: var(--text-muted); font-size: 14px; line-height: 1.4; }
.itn-push-moi-nut { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
/* Chọn theo id: nút chung của theme (body[data-itn-theme] button…) có độ ưu tiên cao hơn lớp thường. */
#itn-push-moi .itn-push-moi-nut button { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border-color); background: transparent;
  color: var(--text-main); font: inherit; font-weight: 600; cursor: pointer; box-shadow: none; }
#itn-push-moi .itn-push-moi-nut button.is-chinh { background: var(--theme-accent-strong); border-color: var(--theme-accent-strong); color: var(--bg-card, #fff); }
#itn-push-moi .itn-push-moi-nut button:focus-visible { outline: 2px solid var(--theme-accent-strong); outline-offset: 2px; }
html.itn-ban-phim .itn-push-moi { display: none; }
/* Bàn phím iPhone đang mở/đóng: tắt transition trên các khung co giãn theo bàn phím để tránh trôi 2 nhịp cùng WebKit. */
html.itn-ban-phim :is(.main-viewport, #module-content, #iphone-bottom-bar, .hc-khung, .bt-ht, .tl-dialog, .itn-more-sheet, .ns-sheet) {
  transition: none !important;
}

/* ══ Vuốt lùi kéo-trượt kiểu iOS (mobile-back.js, anh Nghĩa 13/10/2026: bỏ vòng tròn ‹ — "giống như cũ nhưng mở rộng vùng ra giữa
   màn hình", video mẫu TikTok) ══════════════════════════════════════════════════════════════════════════════════════════════════
   Đặt ngón ở 24px … 55% bề ngang rồi kéo sang phải: thanh đầu + khối nội dung trượt theo ngón (JS đặt transform trực tiếp), tab đáy đứng
   yên, màn trước lộ dần bên dưới. Ở đây chỉ có 3 lớp phụ, đều không bắt bấm, màu theo token theme:
   - .itn-vuot-nen  lớp cố định dưới phần trượt: bản sao tĩnh màn trước (cùng trang, có thị sai) hoặc nền trơn màu nền trang.
   - .itn-vuot-toi  lớp tối trong .itn-vuot-nen, mờ dần theo quãng kéo.
   - .itn-vuot-ke   nền đặc trượt cùng phần trượt: che khe giữa thanh đầu / nội dung / lề + bóng mảnh ở mép trái.
   Thứ tự lớp: nền 37 < kẻ 38 < khối nội dung 39 (JS) < nút + nổi 40 < tab đáy 50 < thanh đầu 100. */
.itn-vuot-nen { position: fixed; inset: 0; z-index: 37; overflow: hidden; background: var(--bg-app, var(--bg-main)); pointer-events: none;
  -webkit-user-select: none; user-select: none; }
.itn-vuot-nen-lop { position: absolute; top: 0; left: 0; width: 100%; will-change: transform; }
.itn-vuot-toi { position: fixed; inset: 0; background: rgba(0, 0, 0, .14); pointer-events: none; will-change: opacity; }
.itn-vuot-ke { position: fixed; inset: 0; z-index: 38; background: var(--bg-app, var(--bg-main)); box-shadow: -2px 0 16px rgba(0, 0, 0, .16);
  pointer-events: none; will-change: transform; }
/* Bản sao màn trước là ảnh tĩnh: hiệu ứng hiện dần / chuyển màu bên trong chạy xong ngay, không diễn lại lúc bắt đầu kéo. */
.itn-vuot-nen-lop *, .itn-vuot-nen-lop *::before, .itn-vuot-nen-lop *::after { animation-duration: .01ms !important; animation-delay: 0s !important;
  animation-iteration-count: 1 !important; transition: none !important; caret-color: transparent; }
/* Giảm chuyển động: không thị sai, không trượt hoạt hình (JS đặt thẳng vị trí cuối). */
@media (prefers-reduced-motion: reduce) { .itn-vuot-nen-lop, .itn-vuot-toi, .itn-vuot-ke { transition: none !important; } .itn-vuot-nen-lop { transform: none !important; } }
