/* ═══ Tin nhắn nội bộ — kiểu iMessage (Apple) ═══ */
:is(#workspace#workspace, dialog.ch-dialog) .ch-root { --ch-blue: #0a84ff; --ch-gray: #e9e9eb; --ch-line: #e5e5ea; --ch-sub: #8e8e93; --ch-ink: #1d1d1f; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Be Vietnam Pro", "Segoe UI", Roboto, sans-serif; letter-spacing: -.01em; color: var(--ch-ink); }
:is(#workspace#workspace, dialog.ch-dialog) .ch-root * { box-sizing: border-box; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-root button { font: inherit; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 640px; overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 8px 30px rgba(0, 0, 0, .06); }
:is(#workspace#workspace, dialog.ch-dialog) .ch-boot { grid-column: 1 / -1; display: grid; place-items: center; color: var(--ch-sub); font-size: 14px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: var(--ch-blue) !important; cursor: pointer; flex: 0 0 auto; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-icon:hover { background: rgba(10, 132, 255, .1) !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Cột trái: danh sách ── */
:is(#workspace#workspace, dialog.ch-dialog) .ch-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--ch-line); background: #f9f9fb; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-side-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 18px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-side-head h2 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-portal { color: var(--ch-blue); font-size: 13px; font-weight: 500; text-decoration: none; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-search { display: block; padding: 4px 12px 8px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-search input { width: 100%; height: 34px !important; min-height: 0 !important; padding: 0 12px 0 32px !important; border: 0 !important; border-radius: 10px !important; background: #e9e9ee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") 10px center / 15px no-repeat !important; color: var(--ch-ink) !important; font-size: 14px !important; box-shadow: none !important; outline: none; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; overscroll-behavior: contain; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-list-cap { padding: 12px 10px 4px; color: var(--ch-sub); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-list-empty { padding: 40px 16px; color: var(--ch-sub); font-size: 13.5px; line-height: 1.5; text-align: center; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0 !important; height: auto !important; padding: 9px 10px 9px 4px !important; border: 0 !important; border-radius: 12px !important; background: transparent !important; color: inherit !important; text-align: left; cursor: pointer; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row:hover { background: rgba(0, 0, 0, .04) !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row.on { background: var(--ch-blue) !important; color: #fff !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row.on .ch-row-sub, :is(#workspace#workspace, dialog.ch-dialog) .ch-row.on time, :is(#workspace#workspace, dialog.ch-dialog) .ch-row.on em { color: rgba(255, 255, 255, .82) !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--ch-blue); }
:is(#workspace#workspace, dialog.ch-dialog) .ch-dot.off { background: transparent; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-top { display: flex; align-items: baseline; gap: 8px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-top b { flex: 1; min-width: 0; overflow: hidden; font-size: 14.5px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-top time { color: var(--ch-sub); font-size: 12px; white-space: nowrap; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-sub { display: -webkit-box; overflow: hidden; color: var(--ch-sub); font-size: 13px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row-sub em { font-style: normal; color: #3a3a3c; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-row.unread .ch-row-sub { color: #3a3a3c; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ch-blue); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }

/* ── Ảnh đại diện ── */
:is(#workspace#workspace, dialog.ch-dialog) .ch-av { --h: 210; display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; overflow: hidden; border-radius: 50%; background: linear-gradient(180deg, hsl(var(--h) 22% 72%), hsl(var(--h) 18% 56%)); color: #fff; font-size: 16px; font-weight: 600; letter-spacing: 0; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av img { width: 100%; height: 100%; object-fit: cover; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av.sm { flex-basis: 32px; width: 32px; height: 32px; font-size: 12.5px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av.xs { flex-basis: 28px; width: 28px; height: 28px; font-size: 11px; align-self: flex-end; margin-bottom: 18px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av.lg { flex-basis: 72px; width: 72px; height: 72px; font-size: 26px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av-group svg { width: 58%; height: 58%; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-av-gap { flex: 0 0 28px; width: 28px; }

/* ── Cột phải: cuộc trò chuyện ── */
:is(#workspace#workspace, dialog.ch-dialog) .ch-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-main.drop::after { content: "Thả ảnh để gửi"; position: absolute; inset: 8px; display: grid; place-items: center; border: 2px dashed var(--ch-blue); border-radius: 16px; background: rgba(10, 132, 255, .06); color: var(--ch-blue); font-weight: 600; pointer-events: none; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-blank { display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; color: var(--ch-sub); text-align: center; font-size: 14px; line-height: 1.5; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-blank span svg { width: 44px; height: 44px; fill: none; stroke: #c7c7cc; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--ch-line); background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
:is(#workspace#workspace, dialog.ch-dialog) .ch-back { display: none; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-head-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; height: auto !important; min-height: 0 !important; padding: 2px 6px !important; border: 0 !important; border-radius: 10px !important; background: transparent !important; color: inherit !important; text-align: left; cursor: pointer; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-head-who span { display: grid; min-width: 0; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-head-who b { overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-head-who small { color: var(--ch-sub); font-size: 12px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-scroll { flex: 1; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px 6px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msgs { display: flex; flex-direction: column; gap: 2px; min-height: 100%; justify-content: flex-end; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-loading { padding: 30px; color: var(--ch-sub); text-align: center; font-size: 13px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-older { align-self: center; margin: 4px 0 10px; height: 28px !important; min-height: 0 !important; padding: 0 12px !important; border: 0 !important; border-radius: 14px !important; background: #f2f2f7 !important; color: var(--ch-blue) !important; font-size: 12.5px !important; cursor: pointer; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-empty-thread { display: grid; justify-items: center; gap: 6px; margin: auto 0; padding: 30px 0; color: var(--ch-sub); font-size: 13px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-empty-thread b { color: var(--ch-ink); font-size: 17px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-sep { align-self: center; margin: 12px 0 6px; color: var(--ch-sub); font-size: 11.5px; font-weight: 500; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-sys { align-self: center; max-width: 80%; margin: 6px 0; color: var(--ch-sub); font-size: 12px; text-align: center; }

:is(#workspace#workspace, dialog.ch-dialog) .ch-msg { position: relative; display: flex; align-items: flex-end; gap: 6px; max-width: 100%; margin-top: 6px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.cont + .ch-msg, :is(#workspace#workspace, dialog.ch-dialog) .ch-msg.cont + .ch-status + .ch-msg { margin-top: 0; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.mine { flex-direction: row-reverse; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-col { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: min(72%, 520px); min-width: 0; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.mine .ch-col { align-items: flex-end; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-name { padding: 0 12px; color: var(--ch-sub); font-size: 11.5px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-bubble { position: relative; max-width: 100%; padding: 7px 12px 8px; border-radius: 18px; background: var(--ch-gray); color: var(--ch-ink); font-size: 15px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.mine .ch-bubble { background: var(--ch-blue); color: #fff; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg:not(.cont) .ch-bubble { border-bottom-left-radius: 6px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.mine:not(.cont) .ch-bubble { border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg:not(.mine) .ch-bubble a { color: #0060df; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-quote { display: grid; gap: 1px; width: 100%; height: auto !important; min-height: 0 !important; margin: 1px 0 5px; padding: 5px 9px !important; border: 0 !important; border-left: 3px solid rgba(0, 0, 0, .25) !important; border-radius: 8px !important; background: rgba(0, 0, 0, .06) !important; color: inherit !important; font-size: 13px !important; line-height: 1.3; text-align: left; white-space: normal; cursor: pointer; box-shadow: none !important; overflow: hidden; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-quote b { font-size: 12px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.mine .ch-quote { border-left-color: rgba(255, 255, 255, .7) !important; background: rgba(255, 255, 255, .18) !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-recalled { background: transparent !important; color: var(--ch-sub) !important; box-shadow: inset 0 0 0 1px var(--ch-line); font-style: italic; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-was { opacity: .55; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-was-tag { padding: 0 8px; color: #d70015; font-size: 11px; font-weight: 600; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-time { display: none; padding: 0 8px; color: var(--ch-sub); font-size: 11px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg:hover .ch-time, :is(#workspace#workspace, dialog.ch-dialog) .ch-msg.flash .ch-time { display: block; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-status { align-self: flex-end; margin: 2px 6px 4px 0; color: var(--ch-sub); font-size: 11px; font-weight: 500; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-more { align-self: center; display: grid; place-items: center; width: 28px; height: 28px; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: var(--ch-sub) !important; opacity: 0; cursor: pointer; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-more svg { width: 18px; height: 18px; fill: currentColor; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg:hover .ch-more { opacity: 1; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-more:hover { background: #f2f2f7 !important; }
@media (hover: none) { .ch-more { display: none; } }
:is(#workspace#workspace, dialog.ch-dialog) .ch-msg.flash .ch-bubble, :is(#workspace#workspace, dialog.ch-dialog) .ch-msg.flash .ch-imgs { animation: ch-flash 1.6s ease; }
@keyframes ch-flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(255, 204, 0, .9); } 100% { box-shadow: 0 0 0 3px rgba(255, 204, 0, 0); } }

/* Ảnh trong tin */
:is(#workspace#workspace, dialog.ch-dialog) .ch-imgs { display: grid; gap: 3px; max-width: 320px; overflow: hidden; border-radius: 18px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-imgs.n2, :is(#workspace#workspace, dialog.ch-dialog) .ch-imgs.n4 { grid-template-columns: 1fr 1fr; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-imgs.n3 { grid-template-columns: 1fr 1fr; } .ch-imgs.n3 .ch-img:first-child { grid-column: 1 / -1; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-img { display: block; overflow: hidden; background: #f2f2f7; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-img img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-imgs:not(.n1) .ch-img img { height: 150px; max-height: none; aspect-ratio: auto !important; }

/* Ô soạn tin */
:is(#workspace#workspace, dialog.ch-dialog) .ch-compose { padding: 8px 12px 10px; border-top: 1px solid var(--ch-line); background: #fff; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-compose-row { display: flex; align-items: flex-end; gap: 8px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-attach { width: 34px; height: 34px; background: #f2f2f7 !important; color: #636366 !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-input { position: relative; flex: 1; display: flex; align-items: flex-end; min-height: 36px; border: 1px solid #d1d1d6; border-radius: 19px; background: #fff; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-input:focus-within { border-color: #aeaeb2; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-input textarea { flex: 1; min-height: 34px !important; max-height: 160px; padding: 7px 4px 7px 14px !important; border: 0 !important; background: transparent !important; color: var(--ch-ink) !important; font: inherit; font-size: 15px !important; line-height: 1.35 !important; resize: none; outline: none; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-send { display: grid; place-items: center; width: 28px; height: 28px; min-height: 0 !important; margin: 3px; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: var(--ch-blue) !important; color: #fff !important; cursor: pointer; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-send:disabled { background: #d1d1d6 !important; cursor: default; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 6px 6px 12px; border-left: 3px solid var(--ch-blue); border-radius: 10px; background: #f2f2f7; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply span { display: grid; flex: 1; min-width: 0; color: #3a3a3c; font-size: 13px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply span b { color: var(--ch-blue); font-size: 12px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply .ch-icon { color: var(--ch-sub) !important; width: 26px; height: 26px; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-pending { display: flex; gap: 8px; margin: 0 0 8px; overflow-x: auto; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-thumb { position: relative; flex: 0 0 auto; width: 64px; height: 64px; overflow: hidden; border-radius: 12px; background: #f2f2f7; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-thumb img { width: 100%; height: 100%; object-fit: cover; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-thumb button { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 20px; height: 20px; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: rgba(0, 0, 0, .55) !important; color: #fff !important; cursor: pointer; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-thumb button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-locked { padding: 14px; border-top: 1px solid var(--ch-line); color: var(--ch-sub); font-size: 13px; text-align: center; }

/* Menu thao tác tin */
.ch-pop { position: fixed; z-index: 1000; display: grid; min-width: 200px; padding: 5px; border-radius: 14px; background: rgba(255, 255, 255, .96); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 14px 36px rgba(0, 0, 0, .18); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); font-family: -apple-system, BlinkMacSystemFont, "Be Vietnam Pro", sans-serif; }
.ch-pop button { height: 36px !important; min-height: 0 !important; padding: 0 12px !important; border: 0 !important; border-radius: 9px !important; background: transparent !important; color: #1d1d1f !important; font-size: 14px !important; text-align: left; cursor: pointer; box-shadow: none !important; }
.ch-pop button:hover { background: #f2f2f7 !important; }
.ch-pop button.danger { color: #d70015 !important; }

/* Huy hiệu ở menu trái */
html.has-chat-unread :is(.nav-row, .quick-menu-item, .subnav-row)[data-page="chat"]::after { counter-reset: chu var(--ch-unread); content: counter(chu); margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff; font: 700 11px/18px -apple-system, sans-serif; text-align: center; }

/* ── Hộp thoại ── */
dialog.ch-dialog { width: min(440px, calc(100vw - 24px)); padding: 0 !important; border: 0 !important; border-radius: 18px !important; }
dialog.ch-dialog .ch-dlg { display: grid; gap: 10px; padding: 16px 18px 14px; font-family: -apple-system, BlinkMacSystemFont, "Be Vietnam Pro", sans-serif; }
dialog.ch-dialog .ch-dlg header { display: flex; align-items: center; }
dialog.ch-dialog .ch-dlg header h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; }
dialog.ch-dialog .ch-dlg .ch-icon { color: var(--ch-sub, #8e8e93) !important; }
dialog.ch-dialog .ch-dlg-search { width: 100%; height: 36px !important; min-height: 0 !important; padding: 0 12px !important; border: 0 !important; border-radius: 10px !important; background: #f2f2f7 !important; font-size: 14px !important; box-shadow: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-picks { display: grid; max-height: 300px; overflow-y: auto; margin: 0 -6px; }
dialog.ch-dialog .ch-pick { display: flex !important; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
dialog.ch-dialog .ch-pick[hidden] { display: none !important; }
dialog.ch-dialog .ch-pick:hover { background: #f5f5f7; }
dialog.ch-dialog .ch-pick input { position: absolute; opacity: 0; pointer-events: none; }
dialog.ch-dialog .ch-pick span { display: grid; flex: 1; min-width: 0; }
dialog.ch-dialog .ch-pick b { font-size: 14px; font-weight: 600; } .ch-pick small { color: #8e8e93; font-size: 12px; }
dialog.ch-dialog .ch-pick i { width: 22px; height: 22px; border: 1.5px solid #c7c7cc; border-radius: 50%; }
dialog.ch-dialog .ch-pick input:checked ~ i { border-color: #0a84ff; background: #0a84ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 15px no-repeat; }
dialog.ch-dialog .ch-gname { display: grid !important; gap: 4px; font-size: 12.5px; color: #636366; }
dialog.ch-dialog .ch-gname[hidden] { display: none !important; }
dialog.ch-dialog .ch-gname input { height: 38px !important; min-height: 0 !important; border-radius: 10px !important; font-size: 14px !important; }
dialog.ch-dialog .ch-muted { margin: 0; color: #8e8e93; font-size: 12.5px; line-height: 1.45; }
dialog.ch-dialog .ch-dlg menu { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 4px 0 0; padding: 0; }
dialog.ch-dialog .ch-dlg menu span { flex: 1; }
dialog.ch-dialog .ch-dlg menu button { height: 34px !important; min-height: 0 !important; padding: 0 16px !important; border-radius: 980px !important; font-size: 13.5px !important; }
dialog.ch-dialog .ch-dlg menu .primary { border-color: #0a84ff !important; background: #0a84ff !important; color: #fff !important; }
dialog.ch-dialog .ch-dlg menu .primary:disabled { opacity: .45; }
dialog.ch-dialog .ch-profile { display: grid; justify-items: center; gap: 4px; padding: 4px 0 8px; text-align: center; }
dialog.ch-dialog .ch-profile b { font-size: 18px; } .ch-profile small { color: #8e8e93; font-size: 13px; }
dialog.ch-dialog .ch-gtitle { width: 100%; max-width: 300px; height: 38px !important; min-height: 0 !important; border-radius: 10px !important; font-size: 17px !important; font-weight: 600 !important; text-align: center; }
dialog.ch-dialog .ch-switch { display: flex !important; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #f5f5f7; cursor: pointer; }
dialog.ch-dialog .ch-switch span { display: grid; flex: 1; } .ch-switch b { font-size: 14px; font-weight: 600; } .ch-switch small { color: #8e8e93; font-size: 12px; }
dialog.ch-dialog .ch-switch input { width: 42px; height: 26px; min-height: 0 !important; margin: 0; appearance: none; -webkit-appearance: none; border-radius: 13px; background: #e5e5ea; position: relative; cursor: pointer; transition: background .2s; }
dialog.ch-dialog .ch-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
dialog.ch-dialog .ch-switch input:checked { background: #34c759; } .ch-switch input:checked::after { transform: translateX(16px); }
dialog.ch-dialog .ch-sec { margin-top: 2px; color: #8e8e93; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
dialog.ch-dialog .ch-members { display: grid; max-height: 260px; overflow-y: auto; }
dialog.ch-dialog .ch-member { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
dialog.ch-dialog .ch-member span { display: grid; flex: 1; min-width: 0; } .ch-member b { font-size: 14px; font-weight: 600; } .ch-member small { color: #8e8e93; font-size: 12px; }
dialog.ch-dialog .ch-link { height: 28px !important; min-height: 0 !important; padding: 0 8px !important; border: 0 !important; background: transparent !important; color: #0a84ff !important; font-size: 12.5px !important; cursor: pointer; box-shadow: none !important; }
dialog.ch-dialog .ch-link.danger, dialog.ch-dialog .ch-leave { color: #d70015 !important; }
dialog.ch-dialog .ch-leave { border: 0 !important; background: transparent !important; padding: 0 4px !important; }
dialog.ch-dialog .ch-add summary { color: #0a84ff; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; }
dialog.ch-dialog .ch-add[open] { display: grid; gap: 8px; }
dialog.ch-dialog .ch-addbtn { justify-self: end; height: 32px !important; min-height: 0 !important; padding: 0 14px !important; border-radius: 980px !important; font-size: 13px !important; }
dialog.ch-view-dialog { width: auto; max-width: calc(100vw - 24px); background: #000 !important; }
dialog.ch-dialog .ch-viewer { display: grid; }
dialog.ch-dialog .ch-viewer img { display: block; max-width: calc(100vw - 24px); max-height: calc(100vh - 110px); object-fit: contain; margin: 0 auto; }
dialog.ch-dialog .ch-viewer-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 10px 12px; background: #1c1c1e; }
dialog.ch-dialog .ch-viewer-bar a { margin-right: auto; color: #64d2ff; font-size: 13.5px; }
dialog.ch-dialog .ch-viewer-bar button { height: 32px !important; min-height: 0 !important; padding: 0 14px !important; border: 0 !important; border-radius: 980px !important; background: #3a3a3c !important; color: #fff !important; font-size: 13px !important; }
dialog.ch-dialog .ch-viewer-bar .primary { background: #0a84ff !important; }

/* ── Điện thoại: danh sách ↔ cuộc trò chuyện (như iPhone) ── */
@media (max-width: 760px) {
  :is(#workspace#workspace, dialog.ch-dialog) .ch-app { grid-template-columns: 1fr; border-radius: 0; box-shadow: none; margin: 0 -12px; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-side { border-right: 0; background: #fff; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-app.show-thread .ch-side { display: none; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-app:not(.show-thread) .ch-main { display: none; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-back { display: inline-grid; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-side-head h2 { font-size: 26px; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-col { max-width: 80%; }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-compose { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  :is(#workspace#workspace, dialog.ch-dialog) .ch-input textarea { font-size: 16px !important; } /* iPhone không tự phóng to khi gõ */
  :is(#workspace#workspace, dialog.ch-dialog) .ch-search input { font-size: 16px !important; }
}

/* ── chat.79ecom.site: chỉ có chat, toàn màn hình ── */
html.chat-host .rail, html.chat-host .sidebar, html.chat-host .topbar, html.chat-host #ordersView, html.chat-host .mobile-menu-scrim, html.chat-host .floating, html.chat-host .to-top { display: none !important; }
html.chat-host .app-shell { display: block !important; grid-template-columns: none !important; }
html.chat-host main { margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; }
html.chat-host #workspace { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
html.chat-host .ch-app { border-radius: 0; box-shadow: none; margin: 0; }
html.chat-host body { background: #fff; overflow: hidden; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-reply[hidden], :is(#workspace#workspace, dialog.ch-dialog) .ch-pending[hidden] { display: none !important; }
/* Trang Tin nhắn: ẩn nút nổi (che chữ "Đã xem") */
body:has(#chatRoot) #quickCreate, body:has(#chatRoot) .to-top { display: none !important; }
:is(#workspace#workspace, dialog.ch-dialog) .ch-quote span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* Điện thoại: đang mở 1 cuộc trò chuyện thì ẩn thanh menu dưới (như iMessage) */
@media (max-width: 760px) { body.ch-in-thread:has(#chatRoot) .tabbar { display: none !important; } :is(#workspace#workspace, dialog.ch-dialog) .ch-side-head h2 { font-size: 22px; } }
