/* ESARNTECH CONNECT — แอปบนหน้าจอ (PWA) */
.pwa-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; font-size: 14.5px; line-height: 1.5; position: relative; z-index: 70; }
.pwa-bar > div:first-child { flex: 1 1 240px; }
.pwa-inapp { background: #FFF4E5; border-bottom: 1px solid #F2C98A; color: #5A3A06; }
.pwa-bar-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pwa-promo { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 14px; border: 1px solid #CFE6D7; background: #F1FAF4; border-radius: 12px; }
.pwa-promo > div:nth-child(2) { flex: 1 1 180px; }
.pwa-promo img { border-radius: 10px; }
.pwa-x { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: #5b6b61; min-width: 36px; min-height: 36px; }
.pwa-update { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 90; display: flex; gap: 12px; align-items: center; background: #0b3d2a; color: #fff; padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 24px); }
.pwa-update .btn { background: #fff; color: #0b6040; border-color: #fff; }

/* แถบเมนูล่าง: เฉพาะเมื่อเปิดเป็นแอปบนจอแคบ */
.app-tabbar { display: none; }
@media (max-width: 760px) {
  html.is-standalone .app-tabbar, .app-tabbar.force { display: flex; }
  html.is-standalone body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  html.is-standalone .pwa-update { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) and (max-width: 760px) {
  .app-tabbar { display: flex; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
.app-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: #fff; border-top: 1px solid #DCE9E0; padding: 4px 4px env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(13, 70, 40, .06); }
.app-tabbar > a, .app-tabbar > button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 4px 2px; color: #5b6b61; text-decoration: none; font: inherit; font-size: 11.5px; background: transparent; border: 0; border-radius: 10px; position: relative; cursor: pointer; }
.app-tabbar > .on { color: #0b6040; font-weight: 700; background: #EAF5EE; }
.app-tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); background: #D92D20; color: #fff; font-size: 10.5px; line-height: 1; padding: 3px 5px; border-radius: 999px; }
@media print { .app-tabbar, .pwa-bar, .pwa-promo, .pwa-update { display: none !important; } }
/* iPhone ในโหมดแอป: เว้นขอบบน (รอยบาก) */
html.is-standalone.is-ios .topbar { padding-top: env(safe-area-inset-top); }
[data-pwa-install][hidden], [data-pwa-installed][hidden], .ins-tag[hidden] { display: none !important; }
