/* ===== Kalin — [DOT 84] Thanh 4 nút đỏ trên cùng: BẢN ĐIỆN THOẠI =====
   Đợt 81 (topbar.js/css) chỉ bật thanh ở màn >= 821px nên điện thoại không thấy.
   File này CHỈ bật phần còn thiếu cho màn <= 820px, dùng lại nguyên topbar.js của Đợt 81
   (cùng #kb-bar, #kb-page, class html.kb-on do topbar.js tự gắn sau khi đăng nhập).
   Không sửa topbar.js/css, không đụng app.js, không đụng máy chủ. Máy tính (>=821px) giữ nguyên như Đợt 81. */
@media (max-width: 820.98px) {
  html.kb-on { --kb-h: calc(44px + env(safe-area-inset-top, 0px)); }
  html.kb-on body { padding-top: var(--kb-h); box-sizing: border-box; }
  html.kb-on .shell { height: calc(100vh - var(--kb-h)); height: calc(100dvh - var(--kb-h)); }
  html.kb-on #b-ti { display: none; } /* vali đỏ trong hàng nút nhỏ đã chuyển lên thanh trên (nút TIỆN ÍCH) */
  html.kb-on #nt-root { top: calc(var(--kb-h) + 8px); } /* thông báo nổi nằm dưới thanh, không đè lên */

  html.kb-on #kb-bar {
    display: flex; align-items: center; gap: 5px; position: fixed; z-index: 60; top: 0; left: 0; right: 0; width: 100%;
    height: var(--kb-h); box-sizing: border-box; padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
    background: #4f46e5; color: #fff; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  html.kb-on #kb-bar::-webkit-scrollbar { display: none; }
  #kb-bar .kb-b {
    flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 8px; border: 0; border-radius: 9px; cursor: pointer;
    font: 800 11px/1 "Be Vietnam Pro", system-ui, sans-serif; letter-spacing: 0; color: #fff; background: #dc2626;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; touch-action: manipulation;
    box-shadow: 0 1px 0 rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.18);
  }
  #kb-bar .kb-b:active { background: #b91c1c; transform: translateY(1px); }
  #kb-bar .kb-b.on { background: #b91c1c; box-shadow: 0 0 0 2px #fff, 0 1px 0 rgba(0,0,0,.25); }
  #kb-bar .kb-ic { font-size: 12px; line-height: 1; }
  @media (max-width: 380px) {
    html.kb-on #kb-bar { gap: 4px; padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
    #kb-bar .kb-b { padding: 0 5px; font-size: 10px; gap: 3px; }
    #kb-bar .kb-ic { font-size: 11px; }
  }
  @media (max-width: 345px) { #kb-bar .kb-ic { display: none; } }

  /* trang cổng (LĨNH VỰC, NGÔN NGỮ) — phủ dưới thanh, cuộn bên trong */
  html.kb-on #kb-page.open {
    display: block; position: fixed; z-index: 55; left: 0; right: 0; bottom: 0; top: var(--kb-h);
    background: var(--bg, #eef1f8); color: var(--ink, #1f2547); overflow: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #kb-page .kb-wrap { max-width: 980px; margin: 0 auto; padding: 18px 14px 40px; }
  #kb-page h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.3px; }
  #kb-page .kb-sub { margin: 0 0 16px; color: var(--ink2, #5a6385); line-height: 1.5; font-size: 13.5px; }
  #kb-page .kb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #kb-page .kb-tile {
    text-align: left; border: 1px solid var(--line, #dfe3f0); background: var(--panel, #fff); color: inherit; border-radius: 14px;
    padding: 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; font: inherit; min-width: 0;
  }
  #kb-page .kb-tile .kb-ti { font-size: 22px; width: 38px; height: 38px; border-radius: 11px; background: var(--panel2, #f1f3fa); display: grid; place-items: center; flex: none; }
  #kb-page .kb-tile b { display: block; font-size: 13px; }
  #kb-page .kb-tile small { color: var(--ink3, #8089a8); font-size: 11px; display: block; }
  #kb-page .kb-tile.soon { opacity: .8; }
  #kb-page .kb-note { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--panel, #fff); border: 1px dashed var(--line, #dfe3f0); color: var(--ink2, #5a6385); font-size: 12.5px; line-height: 1.55; }
  @media (max-width: 340px) { #kb-page .kb-grid { grid-template-columns: 1fr; } }
}
