/* ===================== Ô SOẠN TIN (.cp-) ===================== */
.cp { position: relative; padding: 8px 8px 10px; background: var(--bg-elev); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.cp.is-drop::after { content: ""; position: absolute; inset: 4px; border: 2px dashed var(--accent); border-radius: var(--r-lg); background: var(--accent-soft); opacity: .6; pointer-events: none; }
.cp-row { display: flex; align-items: flex-end; gap: 2px; }
.cp-row[hidden], .cp-btn[hidden] { display: none; }
.cp-btn { flex: none; width: 38px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast); }
.cp-btn:hover { background: var(--hover); color: var(--accent); }
.cp-send { background: var(--accent); color: var(--accent-text); }
.cp-send:hover { background: var(--accent-2); color: var(--accent-text); transform: scale(1.06); }
.cp-field { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; padding: 3px 4px 3px 14px; border-radius: 22px; background: var(--surface-2); border: 1.5px solid var(--border); transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast); }
.cp-field:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.cp-input { font-size: 15.5px; }
.cp-btn { color: var(--accent); }
.cp-btn.cp-send { color: var(--accent-text); box-shadow: 0 2px 8px hsl(var(--accent-h) 60% 30% / .3); }
.cp-btn.cp-rec__cancel { color: var(--danger); }
.cp-field .cp-btn { width: 34px; height: 34px; }
.cp-input { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; line-height: 1.4; padding: 8px 0; max-height: 160px; }
.cp-input::placeholder { color: var(--text-3); }
.cp-notice { padding: 12px; text-align: center; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-md); font-size: var(--fs-sm); }
.cp-notice[hidden] { display: none; }

.cp-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-md); background: var(--accent-soft); border-left: 3px solid var(--accent); }
.cp-bar[hidden], .cp-tray[hidden], .cp-chips[hidden], .cp-suggest[hidden], .cp-rec[hidden] { display: none; }
.cp-bar__ic { color: var(--accent); display: inline-flex; }
.cp-bar__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--fs-sm); line-height: 1.3; }
.cp-bar__txt b { color: var(--accent); }
.cp-bar__txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.cp-bar__x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.cp-bar__x:hover { background: var(--hover); }

.cp-tray { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; }
.cp-tray__item { position: relative; flex: none; display: flex; align-items: center; gap: 8px; max-width: 220px; height: 64px; padding: 0 28px 0 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); }
.cp-tray__item.is-image { padding: 0; width: 64px; overflow: hidden; }
.cp-tray__item img { width: 100%; height: 100%; object-fit: cover; }
.cp-tray__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.cp-tray__item small { color: var(--text-3); }
.cp-tray__item.is-image { width: 72px; height: 72px; border-radius: 14px; }
.cp-tray__ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); background: var(--surface-3); }
.cp-tray__play { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; display: grid; place-items: center; padding-left: 2px; color: #fff; background: rgba(0, 0, 0, .55); pointer-events: none; }
.cp-tray__item.is-busy img { opacity: .55; }
.cp-tray__prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .25); }
.cp-tray__prog i { display: block; height: 100%; width: 4%; background: var(--accent); transition: width .2s linear; }
.cp-send.is-waiting { opacity: .6; pointer-events: none; animation: cp-pulse .9s infinite; }
.cp-tray__x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; }
.cp-chips { display: flex; gap: 6px; }
.cp-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--warning); color: #3b2a00; }
.cp-suggest { position: absolute; left: 12px; right: 12px; bottom: 100%; margin-bottom: 4px; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-3); z-index: 20; padding: 4px; }
.cp-suggest__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--r-sm); text-align: left; }
.cp-suggest__item:hover, .cp-suggest__item.is-active { background: var(--accent-soft); }
.cp-suggest__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

.cp-vp[hidden] { display: none; }
.cp-vp { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 22px 12px 14px; border-top: 1px solid var(--border); }
.cp-vp__hint { margin: 0; font-size: 16px; color: var(--text); text-align: center; }
.cp-vp__close { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }
.cp-vp__close:hover { background: var(--hover); }
.cp-vp__mic { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 6px 18px hsl(var(--accent-h) 60% 30% / .35); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform var(--dur-fast); }
.cp-vp__mic:active { transform: scale(.94); }
.cp-vp__mic.is-live { background: var(--danger); animation: cp-vp-ring 1.2s infinite; }
@keyframes cp-vp-ring { 0% { box-shadow: 0 0 0 0 hsl(0 80% 55% / .45); } 100% { box-shadow: 0 0 0 22px hsl(0 80% 55% / 0); } }
.cp-vp__segs { display: flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-2); }
.cp-vp__segs.is-locked { opacity: .5; pointer-events: none; }
.cp-vp__seg { padding: 9px 20px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); white-space: nowrap; }
.cp-vp__seg.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1, 0 1px 4px rgba(0,0,0,.15)); }
.cp-rec { display: flex; align-items: center; gap: 10px; padding: 4px; }
.cp-rec__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: cp-pulse 1s infinite; }
@keyframes cp-pulse { 50% { opacity: .25; } }
.cp-rec__time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 40px; }
.cp-rec__meter { flex: 1; height: 36px; display: flex; align-items: center; gap: 3px; }
.cp-rec__meter i { flex: 1; height: 12%; min-height: 4px; border-radius: 3px; background: var(--accent); transition: height .08s; }
.cp-rec__cancel { color: var(--danger); }

/* Emoji / nhãn dán */
.cp-emoji { width: 340px; max-width: 92vw; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.cp-emoji__search { height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 0; outline: 0; background: var(--surface-2); color: var(--text); }
.cp-emoji__tabs, .cp-sticker__tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.cp-emoji__tab, .cp-sticker__tab { flex: none; width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-3); font-size: 20px; }
.cp-emoji__tab:hover, .cp-sticker__tab:hover { background: var(--hover); }
.cp-emoji__tab.is-active, .cp-sticker__tab.is-active { background: var(--accent-soft); color: var(--accent); }
.cp-emoji__body { height: 240px; overflow-y: auto; }
.cp-emoji__grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.cp-emoji__btn { aspect-ratio: 1; border-radius: var(--r-sm); font-size: 22px; display: grid; place-items: center; transition: transform var(--dur-fast); }
.cp-emoji__btn:hover { background: var(--hover); transform: scale(1.2); }
.cp-emoji__empty { padding: 40px 10px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.cp-sticker { width: 372px; max-width: 92vw; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cp-sticker__body { height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.cp-sticker__name { font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); padding: 2px 4px 6px; }
.cp-sticker__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 2px 8px; }
.cp-sticker__btn { border-radius: var(--r-md); display: grid; place-items: center; padding: 6px 2px; transition: transform var(--dur-fast), background var(--dur-fast); }
.cp-sticker__btn:hover { background: var(--hover); transform: scale(1.12); }
@media (max-width: 760px) { .cp { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); } .cp-btn { width: 38px; height: 38px; } }

.cp-sticker__search { height: 36px; border-radius: var(--r-pill); border: 0; background: var(--surface-2); padding: 0 14px; font-size: var(--fs-md); color: var(--text); outline: none; width: 100%; box-sizing: border-box; }
.cp-sticker__tabs { order: -0; padding-bottom: 2px; }
.cp-sticker__tab { width: 42px !important; height: 42px !important; border-radius: 12px !important; }
.cp-sticker__tab .stk { pointer-events: none; }
.cp-sticker__btn .stk-svg { animation: none; }

/* ---------- Khay ảnh chờ gửi kiểu Messenger/Zalo ---------- */
.cp-tray { gap: 10px; padding: 8px 4px 6px; scroll-snap-type: x proximity; }
.cp-tray__item.is-image { width: 88px; height: 88px; border-radius: 16px; scroll-snap-align: start; box-shadow: 0 2px 8px rgba(30, 30, 60, .15); animation: cp-tray-in .22s var(--ease); }
@keyframes cp-tray-in { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.cp-tray__item.is-busy img { opacity: 1; filter: brightness(.7); }
.cp-tray__ring { position: absolute; inset: 0; display: grid; place-items: center; --p: 20deg; }
.cp-tray__ring::before { content: ''; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(#fff var(--p), rgba(255, 255, 255, .28) 0); -webkit-mask: radial-gradient(circle, transparent 11px, #000 12px); mask: radial-gradient(circle, transparent 11px, #000 12px); transition: background .2s linear; }
.cp-tray__x { top: 5px; right: 5px; width: 22px; height: 22px; }
.cp-tray__add { flex: none; width: 88px; height: 88px; border-radius: 16px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border: 2px dashed var(--accent); }
.cp-send { position: relative; }
.cp-send[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 9px; display: grid; place-items: center; background: #fff; color: var(--accent); font-size: 11px; font-weight: 800; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }

/* Khung gộp Emoji + Nhãn dán (bấm biểu tượng mặt cười) */
.cp-ep { width: 372px; max-width: 92vw; display: flex; flex-direction: column; box-sizing: border-box; }
.cp-ep__segs { display: flex; gap: 4px; padding: 8px 8px 0; }
.cp-ep__seg { flex: 1; height: 36px; border-radius: var(--r-pill); display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); color: var(--text-3); background: transparent; }
.cp-ep__seg:hover { background: var(--hover); }
.cp-ep__seg.is-on { background: var(--accent-soft); color: var(--accent); }
.cp-ep .cp-emoji, .cp-ep .cp-sticker { width: 100%; max-width: none; box-sizing: border-box; }
.cp-ep .cp-sticker__body { height: 240px; }
.cp-ep [hidden] { display: none !important; }
.kit-popover--sheet .cp-ep { width: 100%; max-width: none; }
.kit-popover--sheet .cp-ep .cp-sticker__body { height: min(46vh, 340px); }
