/* Bo sung cho che do ung dung (PWA) cua trang admin. Tach rieng khoi index.html. */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
html { overscroll-behavior-y: none; }
/* Vung cuon trong khong "keo ra" cuon cha / khong kich hoat keo-de-tai-lai */
#main, #main > div, .msPanel { overscroll-behavior: contain; }
/* Khong chon nham chu khi cham nut/thanh dieu huong (van chon duoc noi dung va o nhap) */
button, .dock, .msRow, .hb, header.topbar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }

/* Tai tho / thanh o duoi / canh man hinh (viewport-fit=cover) */
#login { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); padding-left: calc(20px + env(safe-area-inset-left)); padding-right: calc(20px + env(safe-area-inset-right)); }
@media (min-width: 1001px) { header.topbar { padding-left: calc(24px + env(safe-area-inset-left)); padding-right: calc(24px + env(safe-area-inset-right)); } }

/* Bang "Cai ung dung" */
#pwaBar { position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 650; display: none; align-items: center; gap: 10px;
  max-width: 460px; margin: 0 auto; padding: 10px 10px 10px 14px; background: var(--u-surface, #FFFEFB); border-radius: 14px; box-shadow: 0 0 0 .5px var(--u-line, rgba(60,48,30,.12)), var(--u-sh-pop, 0 8px 24px rgba(31,27,22,.10));
  font-size: 15px; font-weight: 600; color: var(--u-ink, #1F1B16); opacity: 0; transition: opacity .2s ease; }
#pwaBar.show { display: flex; opacity: 1; }
#pwaBar .pwaTxt { flex: 1; min-width: 0; line-height: 1.3; }
#pwaBar button { font: inherit; font-size: 15px; font-weight: 600; border: 0; border-radius: 10px; min-height: 44px; padding: 0 16px; cursor: pointer; }
#pwaBar .pwaGo { background: var(--u-accent, #1F5E9C); color: #fff; }
#pwaBar .pwaNo { background: var(--fill, rgba(94,78,50,.08)); color: var(--u-ink-2, #463F35); padding: 0 12px; }
@media (min-width: 1001px) { #pwaBar { bottom: 16px; } }

/* Lo CB: so do tren menu (nay nhe khi doi so) + the "Bat so do & thong bao" */
@keyframes kbPop { 0% { transform: scale(.88); opacity: .6; } 100% { transform: scale(1); opacity: 1; } }
.nbadge.kbPop { animation: kbPop .24s cubic-bezier(.22,1,.36,1); }
@media (prefers-reduced-motion: reduce) { .nbadge.kbPop { animation: none; } }
#kbCard { position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 640; display: flex; align-items: center; gap: 10px; max-width: 460px; margin: 0 auto; padding: 10px 10px 10px 14px; background: var(--u-surface, #FFFEFB); border-radius: 14px; box-shadow: 0 0 0 .5px var(--u-line, rgba(60,48,30,.12)), var(--u-sh-pop, 0 8px 24px rgba(31,27,22,.10)); font-size: 15px; font-weight: 600; color: var(--u-ink, #1F1B16); }
body:has(#pwaBar.show) #kbCard { bottom: calc(176px + env(safe-area-inset-bottom)); }
#kbCard .kbTxt { flex: 1; min-width: 0; line-height: 1.3; }
#kbCard button { font: inherit; font-size: 15px; font-weight: 600; border: 0; border-radius: 10px; min-height: 44px; padding: 0 16px; cursor: pointer; }
#kbCard .kbGo { background: var(--u-accent, #1F5E9C); color: #fff; }
#kbCard .kbNo { background: var(--fill, rgba(94,78,50,.08)); color: var(--u-ink-2, #463F35); padding: 0 12px; }
@media (min-width: 1001px) { #kbCard { bottom: 16px; left: auto; right: 16px; margin: 0; } body:has(#pwaBar.show) #kbCard { bottom: 86px; } }
/* LO EQ (dien thoai): hai the nhac khong duoc che noi dung/nut o cuoi trang.
   Chi hien MOT the mot luc (cai ung dung truoc), va chua cho cho no: khung noi dung ngan lai bang the. */
@media (max-width: 1000px) {
  body:has(#pwaBar.show) #kbCard { display: none; }
  /* cac man la khung absolute inset:0 trong #main nen thu day cua tung man, khong phai padding cua #main */
  #main > [id$="View"] { bottom: var(--promptPad, 0px); }
}
