/* Chat Nhà Số trên điện thoại (2026-11-25, mockup mockups/chat-dien-thoai, js/chat_dt.js).
 * Chỉ áp dụng màn ≤ 820px khi đang mở trang Thảo luận ca (body.tc-dt do chat_dt.js bật): chat toàn màn kiểu Zalo,
 * danh sách và cuộc trò chuyện là 2 màn riêng. Máy tính / iPad ngang giữ nguyên giao diện cũ (page1.css).
 * body.tc-conv = đang ở trong 1 cuộc trò chuyện; body.tc-app = mở từ biểu tượng Chat Nhà Số (ẩn thanh dưới của app). */
/* ngoài chế độ điện thoại (máy tính, hoặc xoay ngang rộng ra) không hiện các phần riêng của điện thoại */
body:not(.tc-dt) .dt-top, body:not(.tc-dt) .dt-banner, body:not(.tc-dt) .dt-plus { display: none !important; }
@media (max-width: 820px) {
  body.tc-dt { overflow: hidden; overscroll-behavior: none; }
  body.tc-dt #p1DiscussView { position: fixed; left: 0; right: 0; top: var(--dt-top, 0px); height: var(--dt-h, 100dvh);
    z-index: 940; margin: 0; padding: 0 !important; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
  body.tc-dt.mnav-on:not(.tc-conv):not(.tc-app) #p1DiscussView { height: calc(var(--dt-h, 100dvh) - var(--mnav-h, 0px)); }
  body.tc-dt.tc-conv #p1DiscussView, body.tc-dt.tc-app #p1DiscussView { z-index: 1000; } /* trên thanh dưới (950) */
  body.tc-app.tc-dt .mnav, body.tc-dt.tc-conv .mnav { display: none !important; }
  body.tc-dt #p1DiscussView > .tl-top { display: none; }
  body.tc-dt #p1DiscussView > [data-tl-pane] { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
  body.tc-dt #p1DiscussView > [data-tl-pane="chat"] { overflow: hidden; display: flex; flex-direction: column; }
  body.tc-dt #p1DiscussView > [data-tl-pane="friends"] { padding: 4px 12px 24px; background: #f4f8f8; }
  body.tc-dt #p1DiscussView > [data-tl-pane][hidden] { display: none !important; }
  body.tc-dt #btnInstallApp, body.tc-dt .tc-dock, body.tc-dt .tc-heads { display: none !important; }

  /* thanh trên của danh sách: "Tin nhắn" + Danh bạ + Tạo mới */
  .dt-top { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; padding: calc(8px + env(safe-area-inset-top)) 6px 8px 16px;
    background: linear-gradient(90deg, #0b5b57, #0f766e); color: #fff; font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
  .dt-top h1 { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
  .dt-top h1 .dt-back { margin-left: -10px; }
  body.tc-dt.tc-conv .dt-top { display: none; }
  .dt-ib { position: relative; flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: inherit;
    display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; padding: 0; }
  .dt-ib:active { background: rgba(255,255,255,.16); }
  .dt-ib svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .dt-ib em { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444;
    color: #fff; font: 700 10.5px/18px system-ui, sans-serif; font-style: normal; text-align: center; border: 2px solid #0f766e; }
  .dt-ib em[hidden] { display: none; }

  /* khung chat: 2 màn (danh sách / cuộc trò chuyện) */
  body.tc-dt #p1DiscussView .tc-wrap { flex: 1; height: auto; min-height: 0; margin: 0 !important; border: 0; border-radius: 0; box-shadow: none;
    grid-template-columns: minmax(0, 1fr) !important; }
  body.tc-dt .tc-wrap.has-active .tc-side { display: none; }
  body.tc-dt .tc-wrap:not(.has-active) .tc-main { display: none; }
  body.tc-dt .tc-side { max-height: none; border: 0; background: #fff; }
  body.tc-dt .tc-main { min-height: 0; }
  body.tc-dt .tc-search { padding: 10px 12px 6px; }
  body.tc-dt .tc-search input { height: 42px; font-size: 16px; border-radius: 21px; background: #f1f5f5; border-color: transparent; padding: 0 16px; }
  body.tc-dt .tc-list { padding: 0 4px; }
  body.tc-dt .tc-newgroup { display: none; }
  body.tc-dt .tc-conv { padding: 10px 12px; gap: 12px; border-radius: 14px; }
  body.tc-dt .tc-conv .tl-ava { width: 50px; height: 50px; border-radius: 50%; font-size: 15px; }
  body.tc-dt .tc-conv .tl-ava.group svg { width: 24px; height: 24px; }
  body.tc-dt .tc-ctop strong { font-size: 15.5px; }
  body.tc-dt .tc-ctop small { font-size: 12px; }
  body.tc-dt .tc-snip { font-size: 14px; }
  body.tc-dt .tc-unread { min-width: 22px; height: 22px; font-size: 12px; }
  body.tc-dt .tc-start { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  body.tc-dt .tc-chip { height: 36px; font-size: 13px; }

  /* đầu cuộc trò chuyện: nút ‹, tên, các nút chỉ có biểu tượng */
  body.tc-dt .tc-head { padding: calc(6px + env(safe-area-inset-top)) 4px 6px 2px; gap: 6px; background: linear-gradient(90deg, #0b5b57, #0f766e);
    color: #fff; border-bottom: 0; }
  body.tc-dt .tc-back { display: grid; place-items: center; width: 40px; height: 44px; font-size: 34px; color: #fff; padding: 0 0 4px; }
  body.tc-dt .tc-head .tl-ava { width: 38px; height: 38px; border-radius: 50%; font-size: 12px; }
  body.tc-dt .tc-head .tl-who strong { color: #fff; font-size: 15.5px; }
  body.tc-dt .tc-head .tl-who small { color: #b9ece6; font-size: 12px; }
  body.tc-dt .tc-hbtn { font-size: 0 !important; width: 42px; height: 42px !important; padding: 0 !important; border: 0 !important;
    background: transparent !important; color: #fff !important; box-shadow: none !important; display: grid !important; place-items: center;
    flex: 0 0 auto; border-radius: 12px; }
  body.tc-dt .tc-hbtn svg, body.tc-dt .tc-hbtn .p1-ic { width: 22px !important; height: 22px !important; margin: 0 !important; }
  body.tc-dt .tc-hbtn .oi { width: 22px !important; height: 22px !important; margin: 0 !important; font-size: 22px; display: grid; place-items: center; }
  body.tc-dt .tc-hbtn.on { background: rgba(255,255,255,.18) !important; }
  body.tc-dt .dt-mute svg { stroke: #fff; }

  /* luồng tin + ô gõ */
  body.tc-dt .tc-stream { padding: 12px 10px; gap: 8px; background: #eef3f3; }
  body.tc-dt .tc-msg { max-width: 84%; }
  body.tc-dt .tc-bubble { font-size: 15px; }
  body.tc-dt .tc-photo { width: 240px; }
  body.tc-dt .tc-sticker { width: 112px; height: 112px; }
  body.tc-dt .tc-compose { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; align-items: flex-end; }
  body.tc-dt .tc-compose textarea { font-size: 16px; min-height: 42px; max-height: 40dvh; resize: none; border-radius: 21px; padding: 10px 14px; }
  body.tc-dt .tc-compose [data-image], body.tc-dt .tc-compose .tc-icon[data-attach] { display: none; }
  body.tc-dt .tc-icon { width: 42px; height: 42px; }
  body.tc-dt .tc-icon svg { width: 24px; height: 24px; }
  body.tc-dt .tc-sendbtn { width: 42px; height: 42px !important; padding: 0 !important; border-radius: 50% !important; justify-content: center; flex: 0 0 auto; }
  body.tc-dt .tc-sendbtn span { display: none; }
  body.tc-dt .tc-sendbtn svg { width: 20px; height: 20px; margin: 0; }
  .dt-plus { display: none; }
  body.tc-dt .dt-plus { display: grid; place-items: center; }
  body.tc-dt .dt-plus svg { stroke: #0f766e; stroke-width: 2.2; }
  /* bảng sticker thay chỗ bàn phím: rộng hết màn, sát ô gõ */
  body.tc-dt .tc-pick { left: 0; right: 0; width: auto; bottom: 100%; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0;
    box-shadow: 0 -10px 30px rgba(13,49,52,.16); }
  body.tc-dt .tc-pickgrid { height: 236px; }
  body.tc-dt .tc-pickgrid.em { grid-template-columns: repeat(8, 1fr); }
  body.tc-dt .tc-quote em, body.tc-dt .tc-replybar em { max-width: 62vw; }
  /* cột "Ảnh & ca": phủ hết màn */
  body.tc-dt .tc-info { width: 100vw; z-index: 1060; padding-top: env(safe-area-inset-top); }

  /* thanh nhắc trong danh sách: cài biểu tượng / bật báo tin / mở trong Zalo */
  .dt-banner { display: flex; align-items: center; gap: 10px; margin: 6px 12px 4px; padding: 10px 10px 10px 12px; border-radius: 14px;
    background: #ecfdf5; border: 1px solid #a7f3d0; font: 500 13px/1.35 'Be Vietnam Pro', system-ui, sans-serif; color: #134e4a; }
  .dt-banner.bell { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
  .dt-banner.warn { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
  .dt-banner img { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
  .dt-banner .dt-bi { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; background: #fb923c; color: #fff; }
  .dt-banner .dt-bi svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .dt-banner > div { flex: 1; min-width: 0; }
  .dt-banner b { display: block; font-size: 14px; font-weight: 700; }
  .dt-banner button.go { flex: 0 0 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: #0d9488; color: #fff;
    font: 700 13px 'Be Vietnam Pro', system-ui, sans-serif; cursor: pointer; }
  .dt-banner.bell button.go { background: #ea580c; }
  .dt-banner button.x { flex: 0 0 auto; width: 28px; height: 28px; border: 0; background: transparent; color: inherit; opacity: .55; font-size: 18px; cursor: pointer; padding: 0; }

  /* bảng trượt lên: + (tạo mới) và + ở ô gõ (ảnh / chụp / gửi ca) */
  .dt-sheet { position: fixed; inset: 0; z-index: 100045; background: rgba(15,23,42,0); transition: background .18s; font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
  .dt-sheet.open { background: rgba(15,23,42,.42); }
  .dt-sheet > div { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 22px 22px 0 0;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
  .dt-sheet.open > div { transform: none; }
  .dt-grip { width: 40px; height: 5px; border-radius: 9px; background: #cbd5e1; margin: 0 auto 8px; }
  .dt-sheet button.it { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; padding: 13px 8px; border-radius: 12px;
    font: 500 15.5px/1.3 'Be Vietnam Pro', system-ui, sans-serif; color: #0f172a; text-align: left; cursor: pointer; }
  .dt-sheet button.it:active { background: #f1f5f9; }
  .dt-sheet button.it > span:first-child { width: 40px; height: 40px; border-radius: 12px; background: #ccfbf1; color: #0f766e; display: grid; place-items: center; flex: 0 0 auto; }
  .dt-sheet button.it svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .dt-sheet button.it small { display: block; font-size: 12.5px; color: #64748b; }
  .dt-sheet button.it em { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: #d97706; border-radius: 6px; padding: 2px 6px; }
}

/* Hộp thoại chat (gửi ca, nhóm, cài đặt) + Xem ca: toàn màn trên điện thoại */
@media (max-width: 640px) {
  #p1ChatPick, #p1GroupDlg, #p1ChatSettings, #p1CaseViewer:not(.tl-split) { padding: 0; place-items: stretch; }
  #p1ChatPick > .p1-modal, #p1GroupDlg > .p1-modal, #p1ChatSettings > .p1-modal, #p1CaseViewer:not(.tl-split) > .p1-modal {
    width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; display: flex; flex-direction: column; overflow: hidden; }
  #p1ChatPick .p1-mhead, #p1GroupDlg .p1-mhead, #p1ChatSettings .p1-mhead, #p1CaseViewer .p1-mhead { padding-top: calc(14px + env(safe-area-inset-top)); flex: 0 0 auto; }
  #p1ChatPick .tl-dbody, #p1GroupDlg .tl-dbody, #p1ChatSettings .tl-dbody { flex: 1; min-height: 0; overflow: auto; }
  #p1CaseViewer:not(.tl-split) .tl-body { flex: 1; min-height: 0; overflow: auto; }
  #p1ChatPick .p1-mfoot, #p1GroupDlg .p1-mfoot, #p1ChatSettings .p1-mfoot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); flex: 0 0 auto; }
  #p1ChatPick .tl-pick, #p1GroupDlg .tl-pick { max-height: none; }
  #p1ChatPick .p1-mfoot .p1-primary, #p1GroupDlg .p1-mfoot .p1-primary { flex: 1; height: 46px; }
  #p1CaseViewer .tl-splitbtn { display: none !important; }
  #p1ChatSettings .tc-settings input[type=text], #p1ChatSettings input[type=checkbox] { transform: scale(1.15); }
}

/* Máy tính: dòng nhắc "có app chat cho điện thoại" giữa các tab và nút Báo tin (js/chat_dt.js pcHint) */
.dt-pchint { flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 2px; margin: 0 10px 0 auto; align-self: center;
  padding: 3px 4px 3px 4px; border-radius: 999px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #134e4a; font-size: 12.5px; line-height: 1.3; }
.dt-pchint + .tl-navtools { margin-left: 0 !important; }
.tl-tabs:has(.dt-pchint) > button, .tl-tabs:has(.dt-pchint) > .tl-navtools { flex-shrink: 0; white-space: nowrap; }
.dt-pchint { flex-shrink: 99; overflow: hidden; }
.dt-pchint .go { display: inline-flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; padding: 0 4px 0 0; cursor: pointer;
  color: inherit; font: inherit; text-align: left; }
.dt-pchint .go img { width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto; }
.dt-pchint .go > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-pchint .go b { font-weight: 700; }
.dt-pchint .go u { flex: 0 0 auto; text-decoration: none; font-weight: 700; color: #fff; background: #0d9488; border-radius: 999px; padding: 3px 10px; }
.dt-pchint .go:hover u { background: #0f766e; }
.dt-pchint .x { flex: 0 0 auto; width: 24px; height: 24px; border: 0; background: none; border-radius: 50%; color: inherit; opacity: .55;
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0; }
.dt-pchint .x:hover { opacity: 1; background: rgba(13, 148, 136, .12); }
body.tc-dt .dt-pchint { display: none !important; }
@media (max-width: 1180px) { .dt-pchint .go > span { display: none; } }
.dt-pcqr { position: fixed; inset: 0; z-index: 100050; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif; }
.dt-pcqr .box { position: relative; width: 340px; max-width: 100%; background: #fff; border-radius: 18px; padding: 22px 22px 18px; text-align: center;
  box-shadow: 0 24px 60px rgba(13, 49, 52, .28); color: #0f172a; }
.dt-pcqr h3 { margin: 0 0 6px; font-size: 17px; color: #0f766e; }
.dt-pcqr p { margin: 0 0 12px; font-size: 13px; color: #475569; line-height: 1.45; }
.dt-pcqr .qr { width: 200px; height: 200px; margin: 0 auto; display: grid; place-items: center; font-size: 12px; color: #64748b;
  border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.dt-pcqr .url { margin: 8px 0 10px; font: 700 14px ui-monospace, Consolas, monospace; color: #134e4a; }
.dt-pcqr ul { margin: 0 0 12px; padding: 10px 12px 10px 28px; text-align: left; font-size: 12.5px; color: #334155; background: #f0fdfa;
  border-radius: 12px; line-height: 1.55; }
.dt-pcqr a { font-size: 12.5px; color: #0f766e; font-weight: 700; }
.dt-pcqr .cl { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border: 0; background: none; font-size: 22px; color: #64748b;
  cursor: pointer; border-radius: 50%; }
.dt-pcqr .cl:hover { background: #f1f5f9; }

/* Cài đặt chat: phần thông báo điện thoại + Zalo (cả máy tính) */
.dt-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #dfe8e9); }
.dt-sec h4 { margin: 0 0 8px; font-size: 13px; color: #0f766e; }
.dt-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.dt-row > div { flex: 1; min-width: 0; }
.dt-row b { display: block; font-size: 13px; color: var(--ink, #142b38); }
.dt-row small { display: block; font-size: 11.5px; color: var(--muted, #607580); line-height: 1.45; }
.dt-row .p1-btn2, .dt-row .p1-primary { height: 34px; font-size: 12px; padding: 0 12px; flex: 0 0 auto; white-space: nowrap; }
.dt-zl { background: #0068ff !important; color: #fff !important; border-color: #0068ff !important; }
.dt-code { margin: 8px 0 4px; padding: 14px; text-align: center; background: #eff6ff; border: 1px dashed #93c5fd; border-radius: 14px; }
.dt-code strong { display: block; font: 800 30px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .18em; color: #1e3a8a; margin: 4px 0; }
.dt-code small { font-size: 11.5px; color: #475569; }
.dt-code .dt-btns { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.dt-mute.on svg { opacity: .55; }
