/* PAN Messenger web app - uu tien dien thoai; man hinh rong: 2 cot (danh sach | cuoc tro chuyen) */
:root { --tim: #6d28d9; --tim-dam: #4c1d95; --tim-nhat: #f3eefe; --chu: #111827; --mo: #6b7280; --vien: #e5e7eb; --nen: #ffffff; --nen2: #f3f4f6;
  --xanh: #22c55e; --vang: #f59e0b; --do: #ef4444; --an-tren: env(safe-area-inset-top, 0px); --an-duoi: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--nen); color: var(--chu); font: 15px/1.4 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--tim); }
.an { display: none !important; }
.text-muted { color: var(--mo); }
#app { height: 100%; display: flex; }
.dang-tai { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--mo); }
.dang-tai img { width: 72px; height: 72px; }

/* ---- dang nhap ---- */
.dn { margin: auto; width: 100%; max-width: 380px; padding: calc(24px + var(--an-tren)) 22px 24px; }
.dn-logo { text-align: center; margin-bottom: 8px; } .dn-logo img { width: 84px; height: 84px; }
.dn h1 { text-align: center; font-size: 22px; margin: 4px 0 2px; color: var(--tim-dam); }
.dn .phu { text-align: center; color: var(--mo); font-size: 13px; margin-bottom: 18px; }
.dn label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.o { width: 100%; height: 46px; border: 1px solid var(--vien); border-radius: 12px; padding: 0 14px; background: #fff; outline: 0; font-size: 16px; }
.o:focus { border-color: var(--tim); box-shadow: 0 0 0 3px var(--tim-nhat); }
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; border-radius: 12px; background: var(--tim); color: #fff; font-weight: 600; padding: 0 18px; }
.nut:disabled { opacity: .6; }
.nut.rong { width: 100%; margin-top: 18px; }
.nut.phu { background: var(--nen2); color: var(--chu); }
.loi { color: var(--do); font-size: 13.5px; min-height: 20px; margin-top: 10px; text-align: center; }
.goi-y { color: var(--mo); font-size: 12.5px; text-align: center; margin-top: 14px; }

/* ---- khung 2 cot ---- */
.cot-ds { width: 100%; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.cot-chat { display: none; flex: 1; min-width: 0; height: 100%; flex-direction: column; background: #fbfaff; }
.dang-chat .cot-ds { display: none; } .dang-chat .cot-chat { display: flex; }
@media (min-width: 900px) {
  .cot-ds { width: 360px; flex: none; border-right: 1px solid var(--vien); display: flex !important; }
  .cot-chat { display: flex; }
  .nut-lui { display: none !important; }
}
.trong-chat { margin: auto; color: var(--mo); text-align: center; padding: 20px; } .trong-chat img { width: 96px; opacity: .8; }

/* ---- dau trang ---- */
.dau { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--an-tren)) 12px 10px; border-bottom: 1px solid var(--vien); background: var(--nen); min-height: 60px; }
.dau h2 { margin: 0; font-size: 20px; flex: 1; }
.dau .ten { flex: 1; min-width: 0; } .dau .ten b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.dau .ten small { display: block; color: var(--mo); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nut-tron { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--tim); flex: none; }
.nut-tron:active { background: var(--tim-nhat); }
.nut-tron svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tim { padding: 8px 12px; } .tim input { width: 100%; height: 40px; border: 0; border-radius: 20px; background: var(--nen2); padding: 0 16px; outline: 0; font-size: 15px; }
.ket-noi { background: #fef3c7; color: #92400e; font-size: 13px; text-align: center; padding: 4px; }

/* ---- danh sach ---- */
.ds { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--an-duoi); }
.tieu-muc { font-size: 12px; font-weight: 700; color: var(--mo); text-transform: uppercase; letter-spacing: .4px; padding: 12px 16px 4px; }
.dong { display: flex; align-items: center; gap: 12px; padding: 9px 14px; cursor: pointer; }
.dong:active, .dong.chon { background: var(--tim-nhat); }
.dong .giua { flex: 1; min-width: 0; }
.dong .giua b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dong .giua small { display: block; color: var(--mo); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dong.chua-doc .giua b, .dong.chua-doc .giua small { color: var(--chu); font-weight: 700; }
.dong .phai { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--mo); font-size: 12px; }
.dem { min-width: 20px; height: 20px; border-radius: 10px; background: var(--do); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; padding: 0 6px; }
.trong { color: var(--mo); text-align: center; padding: 30px 16px; font-size: 14px; }

.anh { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; background: #c4b5fd center/cover no-repeat; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.anh.nho { width: 32px; height: 32px; font-size: 13px; } .anh.vua { width: 40px; height: 40px; font-size: 15px; } .anh.lon { width: 84px; height: 84px; font-size: 30px; }
.anh img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cham { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; background: #9ca3af; }
.cham.online { background: var(--xanh); } .cham.away { background: var(--vang); } .cham.dnd { background: var(--do); }
.anh.nho .cham { width: 10px; height: 10px; }

/* ---- cuoc tro chuyen ---- */
.tin-vung { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 10px 6px; }
.them-cu { text-align: center; color: var(--mo); font-size: 13px; padding: 6px; }
.ngay { text-align: center; color: var(--mo); font-size: 12px; margin: 12px 0 6px; }
.he-thong { text-align: center; color: var(--mo); font-size: 12.5px; font-style: italic; margin: 6px 12px; }
.tin { display: flex; gap: 6px; align-items: flex-end; margin: 2px 0; }
.tin.toi { justify-content: flex-end; }
.tin .anh { visibility: hidden; } .tin.cuoi .anh { visibility: visible; }
.kh { max-width: 78%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.tin.toi .kh { align-items: flex-end; }
.nguoi-gui { font-size: 12px; color: var(--mo); margin: 4px 10px 0; }
.bong { padding: 8px 12px; border-radius: 18px; background: #fff; border: 1px solid #ece8f7; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; max-width: 100%; -webkit-user-select: text; user-select: text; }
.tin.toi .bong { background: var(--tim); border-color: var(--tim); color: #fff; }
.tin.toi .bong a { color: #fff; }
.bong blockquote { margin: 0 0 4px; padding: 2px 0 2px 8px; border-left: 3px solid rgba(0,0,0,.2); opacity: .85; font-size: 13.5px; }
.tin.toi .bong blockquote { border-left-color: rgba(255,255,255,.6); }
.bong.buzz { background: #fde7ef; border-color: #fbcfe0; color: #be185d; font-weight: 700; }
.bong .da-sua { font-size: 11px; opacity: .7; margin-left: 4px; }
.gio { font-size: 11px; color: var(--mo); margin: 0 6px; }
.da-xem { text-align: right; font-size: 11.5px; color: var(--mo); margin: 2px 6px 0; }
.tu-huy { font-size: 11px; opacity: .8; }
.cam-xuc { display: flex; gap: 3px; flex-wrap: wrap; }
.cam-xuc span { background: #fff; border: 1px solid var(--vien); border-radius: 12px; padding: 0 6px; font-size: 13px; }
.cam-xuc span.cua-toi { border-color: var(--tim); background: var(--tim-nhat); }
.tep-anh { display: block; border-radius: 14px; overflow: hidden; background: var(--nen2); max-width: 240px; }
.tep-anh img { display: block; max-width: 100%; max-height: 300px; object-fit: cover; }
.tep { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--vien); border-radius: 14px; padding: 9px 12px; max-width: 260px; color: var(--chu); text-decoration: none; }
.tep svg { width: 26px; height: 26px; stroke: var(--tim); fill: none; stroke-width: 1.8; flex: none; }
.tep b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tep small { color: var(--mo); font-size: 12px; }
.the-goi { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.the-goi .nut { height: 36px; border-radius: 10px; }
.tin.toi .the-goi .nut { background: #fff; color: var(--tim); }
.dang-go { flex: none; height: 20px; padding: 0 14px; color: var(--mo); font-size: 12.5px; }

.soan { flex: none; display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px calc(8px + var(--an-duoi)); border-top: 1px solid var(--vien); background: var(--nen); }
.soan textarea { flex: 1; resize: none; border: 0; border-radius: 20px; background: var(--nen2); padding: 10px 14px; max-height: 120px; min-height: 40px; outline: 0; font-size: 16px; line-height: 1.3; }
.tra-loi-thanh { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--tim-nhat); font-size: 13px; }
.tra-loi-thanh span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tai-len { flex: none; font-size: 12.5px; color: var(--tim); padding: 2px 14px; }
.bang-bt { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-top: 1px solid var(--vien); max-height: 200px; overflow-y: auto; }
.bang-bt button { width: 42px; height: 42px; font-size: 24px; border-radius: 8px; }
.bang-bt button:active { background: var(--nen2); }

/* ---- bang chon / hop thoai ---- */
.man { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.tam { background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 10px 0 calc(10px + var(--an-duoi)); max-height: 85vh; overflow-y: auto; }
@media (min-width: 900px) { .man { align-items: center; } .tam { border-radius: 18px; } }
.tam .cx { display: flex; justify-content: space-around; padding: 8px 12px 12px; border-bottom: 1px solid var(--vien); }
.tam .cx button { font-size: 30px; width: 48px; height: 48px; border-radius: 50%; }
.tam .cx button:active { background: var(--nen2); }
.tam .muc { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 20px; font-size: 16px; }
.tam .muc:active { background: var(--nen2); } .tam .muc.nguy { color: var(--do); }
.tam h3 { margin: 6px 20px 10px; font-size: 17px; }
.tam .noi { padding: 0 20px 10px; }
.chon-nguoi { max-height: 45vh; overflow-y: auto; border: 1px solid var(--vien); border-radius: 12px; margin-top: 8px; }
.chon-nguoi label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.xem-anh { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; }
.xem-anh img { max-width: 100%; max-height: 100%; }
.xem-anh .dong-x { position: absolute; top: calc(10px + var(--an-tren)); right: 10px; color: #fff; }
.xem-anh .tai { position: absolute; top: calc(10px + var(--an-tren)); right: 60px; color: #fff; }

.goi-den { position: fixed; inset: 0; z-index: 70; background: linear-gradient(170deg, #4c1d95, #111827); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.goi-den small { opacity: .8; }
.goi-den .hang-nut { display: flex; gap: 60px; margin-top: 40px; }
.goi-den .hang-nut button { width: 70px; height: 70px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.goi-den .hang-nut svg { width: 32px; height: 32px; stroke: #fff; fill: none; stroke-width: 2; }
.goi-den .tu-choi { background: var(--do); } .goi-den .nghe { background: var(--xanh); animation: nhay 1.2s infinite; }
@keyframes nhay { 50% { box-shadow: 0 0 0 14px rgba(34, 197, 94, .25); } }
.banh-goi { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #dcfce7; color: #166534; font-size: 14px; }
.banh-goi span { flex: 1; }

.toi-dau { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px 12px; }
.toi-dau b { font-size: 19px; }
.cai { padding: 0 0 20px; }
.cai .muc { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--nen2); }
.cai .muc span { flex: 1; }
.cai select, .cai input[type=text] { border: 1px solid var(--vien); border-radius: 10px; padding: 8px 10px; background: #fff; }
.cong-tac { position: relative; width: 50px; height: 30px; flex: none; }
.cong-tac input { opacity: 0; width: 0; height: 0; }
.cong-tac i { position: absolute; inset: 0; background: #d1d5db; border-radius: 15px; transition: .2s; }
.cong-tac i::before { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.cong-tac input:checked + i { background: var(--tim); } .cong-tac input:checked + i::before { transform: translateX(20px); }
.ghi-chu { color: var(--mo); font-size: 13px; padding: 10px 18px; }
/* trang Quan tri */
.qt-the { flex: none; display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--vien); overflow-x: auto; }
.qt-the a { padding: 8px 12px; color: var(--mo); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.qt-the a.chon { color: var(--tim); border-bottom-color: var(--tim); }
.qt-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 14px; }
.qt-o { background: var(--tim-nhat); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.qt-o b { font-size: 22px; color: var(--tim-dam); } .qt-o span { font-size: 13px; font-weight: 600; } .qt-o small { font-size: 12px; color: var(--mo); }
.qt-loc { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 0; }
.chip { border: 1px solid var(--vien); border-radius: 16px; padding: 5px 12px; font-size: 13px; background: #fff; }
.chip.chon { background: var(--tim); border-color: var(--tim); color: #fff; }
/* (14/10) danh sach tro chuyen: phan loai, ghim, tat bao, da an */
.loc-loai { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
.loc-loai .chip { white-space: nowrap; flex: none; cursor: pointer; font-size: 12px; padding: 3px 10px; }
.loc-loai .chip.chon { color: #fff; }
.nhan-loai { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dem.xam { background: #9ca3af; }
.dong.bi-an { opacity: .6; }
#ds .dong[data-k] { -webkit-touch-callout: none; user-select: none; }
.qt-tk .giua small, .qt-nhom .giua small { white-space: normal; }
.thong-bao-noi { white-space: pre-line; position: fixed; left: 50%; top: calc(12px + var(--an-tren)); transform: translateX(-50%); z-index: 80; background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
