/* Cam Thủy Kết Nối – tệp CSS duy nhất (khung chung + chat + biểu mẫu quản trị).
   Nền sáng ấm, màu nhấn xanh lá. Không dùng phông tải về, không dùng khung giao diện. */
:root{
  --nen:#faf6ef; --nen-cot:#fffdf9; --nen-the:#fff; --nen-di:#f1ebe0; --vien:#e6dfd2;
  --chu:#2b2a27; --chu-mo:#6f6a60; --xanh:#1f8a4c; --xanh-dam:#17703d; --xanh-nhat:#e3f3e8;
  --do:#c0392b; --do-nhat:#fbe9e6; --vang-nhat:#fdf3d7; --bong:0 6px 24px rgba(60,45,20,.14);
  --bo:12px;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--nen);color:var(--chu);font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
a{color:var(--xanh-dam)}
h1,h2,h3{margin:0 0 .5em;line-height:1.25}
h1{font-size:22px} h2{font-size:18px} h3{font-size:16px}
button,input,select,textarea{font:inherit;color:inherit}
[hidden]{display:none!important}
.an-doc{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.bt{width:22px;height:22px;flex:none;display:block}

/* ---- Thành phần chung (A dùng cho đăng nhập, quản trị) ---- */
.nut{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:8px 18px;border:1px solid transparent;border-radius:10px;background:var(--xanh);color:#fff;font-weight:600;text-decoration:none;cursor:pointer}
.nut:hover{background:var(--xanh-dam)}
.nut:disabled{opacity:.55;cursor:default}
.nut-phu{background:transparent;color:var(--chu);border-color:var(--vien)}
.nut-phu:hover{background:var(--nen-di)}
.nut-do{background:var(--do)}
.nut-do:hover{background:#a03024}
.nut-nho{min-height:32px;padding:4px 12px;font-size:14px}
.nut-bt{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--chu-mo);cursor:pointer;text-decoration:none;flex:none}
.nut-bt:hover{background:var(--nen-di);color:var(--chu)}
:focus-visible{outline:2px solid var(--xanh);outline-offset:2px}
.truong{display:block;margin:0 0 14px}
.truong>span,.truong>label{display:block;margin:0 0 4px;font-weight:600;font-size:14px}
.truong input,.truong select,.truong textarea,.o-nhap{display:block;width:100%;min-height:42px;padding:8px 12px;border:1px solid var(--vien);border-radius:10px;background:#fff}
.truong input:focus,.truong select:focus,.truong textarea:focus,.o-nhap:focus{outline:0;border-color:var(--xanh);box-shadow:0 0 0 3px var(--xanh-nhat)}
.truong .goi-y{font-weight:400;color:var(--chu-mo);font-size:13px;margin-top:4px}
.truong .loi,.errorlist{color:var(--do);font-size:13px;margin:4px 0 0;padding:0;list-style:none}
.the{background:var(--nen-the);border:1px solid var(--vien);border-radius:var(--bo);padding:20px}
.thong-bao{margin:0 0 14px;padding:10px 14px;border-radius:10px;background:var(--xanh-nhat);border:1px solid #c5e5cf}
.thong-bao.loi{background:var(--do-nhat);border-color:#f0c4bd}
.thong-bao.nhac{background:var(--vang-nhat);border-color:#f0dfa6}
.bang-cuon{overflow-x:auto}
.bang{width:100%;border-collapse:collapse;background:var(--nen-the)}
.bang th,.bang td{padding:9px 12px;border-bottom:1px solid var(--vien);text-align:left;vertical-align:top}
.bang th{font-size:13px;color:var(--chu-mo);font-weight:600;white-space:nowrap;background:var(--nen-cot)}
.nhan{display:inline-block;padding:1px 9px;border-radius:99px;background:var(--xanh-nhat);color:var(--xanh-dam);font-size:13px;font-weight:600}
.nhan.xam{background:var(--nen-di);color:var(--chu-mo)}
.nhan.do{background:var(--do-nhat);color:var(--do)}
.mo{color:var(--chu-mo)}

/* Trang ở giữa (đăng nhập, đặt mật khẩu): <body class="trang-giua"> */
.trang-giua{min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:20px}
.trang-giua .the{width:100%;max-width:380px;box-shadow:var(--bong)}
.logo{display:flex;align-items:center;gap:10px;font-weight:700;font-size:18px;margin:0 0 18px}
.logo img{width:40px;height:40px;border-radius:10px}

/* Trang thường (quản trị): thanh trên + phần thân */
.thanh-tren{display:flex;align-items:center;gap:10px;padding:8px 16px;background:var(--nen-cot);border-bottom:1px solid var(--vien);position:sticky;top:0;z-index:5}
.thanh-tren .ten{font-weight:700;margin-right:auto;display:flex;align-items:center;gap:8px;color:inherit;text-decoration:none}
.thanh-tren .ten img{width:28px;height:28px;border-radius:7px}
.than-trang{max-width:1100px;margin:0 auto;padding:20px 16px}
.hang{display:flex;flex-wrap:wrap;gap:10px;align-items:center}

/* ---- Ảnh đại diện 2 chữ cái ---- */
.dd{width:44px;height:44px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;color:#fff;background:#8a7f6d;overflow:hidden;text-transform:uppercase}
.dd img{width:100%;height:100%;object-fit:cover;display:block}
.dd.nho{width:32px;height:32px;font-size:12px}
.dd.vuong{border-radius:12px}
.mau-0{background:#1f8a4c}.mau-1{background:#c2703d}.mau-2{background:#3d7fc2}.mau-3{background:#8a5fb0}.mau-4{background:#b08a1f}.mau-5{background:#c2506b}.mau-6{background:#2f9a94}.mau-7{background:#7a8a3d}

/* ---- Thanh mục lớn: <body class="… co-muc"> + {% thanh_muc "ma" %}. Máy tính: cột hẹp bên trái; điện thoại: thanh đáy ---- */
.thanh-muc{position:fixed;left:0;top:0;bottom:0;width:88px;z-index:20;display:flex;flex-direction:column;align-items:stretch;gap:2px;padding:10px 6px;background:var(--nen-di);border-right:1px solid var(--vien);overflow-y:auto}
.thanh-muc .dau-muc{display:flex;justify-content:center;margin:0 0 10px}
.thanh-muc .dau-muc img{width:36px;height:36px;border-radius:9px}
.nut-muc{position:relative;display:flex;flex-direction:column;align-items:center;gap:3px;padding:8px 2px 6px;border-radius:12px;color:var(--chu-mo);text-decoration:none;font-size:11px;font-weight:600;line-height:1.15;text-align:center}
/* 20/11 (phiên F): chữ mục không bị cắt ở màn rộng / chữ to — xuống dòng trong cột, không tràn */
.nut-muc span{display:block;width:100%;overflow-wrap:anywhere;hyphens:auto}
.nut-muc:hover{background:rgba(0,0,0,.05);color:var(--chu)}
.nut-muc.chon{background:var(--nen-the);color:var(--xanh-dam);box-shadow:0 1px 3px rgba(60,45,20,.12)}
.nut-muc .bt{width:24px;height:24px}
.nut-muc .cham{position:absolute;top:3px;left:50%;margin-left:6px;min-width:17px;height:17px;padding:0 4px;font-size:10px;font-style:normal}
.co-muc{padding-left:88px}

/* ---- Trang của một mục không có cột bên (Tổng quan, trang giữ chỗ, Thiết lập) ---- */
.dau-muc-trang{display:flex;align-items:center;gap:4px;padding:10px 12px 10px 20px;background:var(--nen-cot);border-bottom:1px solid var(--vien);position:sticky;top:0;z-index:5}
.dau-muc-trang h1{flex:1;margin:0;font-size:19px}
.than-muc{max-width:980px;margin:0 auto;padding:20px 16px 32px}
.luoi-the{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;align-items:start}
.the h2{display:flex;align-items:center;gap:8px}
.the .ds-the{margin:0 -8px}
.dong-nhom{display:flex;align-items:center;gap:8px;padding:8px;border-radius:10px;color:inherit;text-decoration:none}
a.dong-nhom:hover{background:var(--nen-di)}
.dong-nhom .giua{flex:1;min-width:0}
.dong-nhom small{display:block;color:var(--chu-mo);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.giu-cho{max-width:460px;margin:8vh auto 0;text-align:center}
.giu-cho .bt{width:48px;height:48px;margin:0 auto 12px;color:var(--chu-mo)}
.nut-lon{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1px solid var(--vien);border-radius:var(--bo);background:var(--nen-the);color:inherit;text-decoration:none}
.nut-lon:hover{border-color:var(--xanh)}
.nut-lon .giua{flex:1;min-width:0}
.nut-lon b{display:block}
.nut-lon small{color:var(--chu-mo)}
.nut-lon .bt{color:var(--chu-mo)}

/* ---- Mục Nhóm kiểu Discord: cột hẹp danh mục bậc 1 + danh sách kênh và danh mục con ---- */
.ds-hoi-thoai.dm{display:flex;padding:0;overflow:hidden}
.dm-cot{flex:none;width:64px;overflow-y:auto;overscroll-behavior:contain;padding:8px 0 16px;display:flex;flex-direction:column;align-items:center;gap:10px;background:var(--nen-di);border-right:1px solid var(--vien);scrollbar-width:none}
.dm-cot::-webkit-scrollbar{display:none}
.dm-nut{position:relative;flex:none;border:0;background:transparent;padding:0;cursor:pointer;border-radius:50%}
.dm-nut .dd{width:46px;height:46px}
.dm-nut.chon .dd{border-radius:15px;box-shadow:0 0 0 2px var(--nen-di),0 0 0 4px var(--xanh)}
.dm-nut .cham{position:absolute;right:-5px;bottom:-3px;min-width:19px;height:19px;padding:0 4px;font-size:11px;font-style:normal;border:2px solid var(--nen-di)}
.dm-ds{flex:1;min-width:0;overflow-y:auto;overscroll-behavior:contain;padding:2px 6px 20px}
.dm-ten{display:flex;align-items:center;gap:4px;min-height:40px;margin:0;padding:4px 2px 4px 8px;font-size:13px;font-weight:700;text-transform:uppercase;letter-spacing:.03em;color:var(--chu)}
.dm-ten span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dm-ten .nut-bt,.dmc-dau .nut-bt{width:30px;height:30px}
.dm-ten .nut-bt .bt,.dmc-dau .nut-bt .bt{width:18px;height:18px}
.dm-sua{opacity:.45}
.dm-sua:hover,.dm-sua:focus{opacity:1}
.hoi-thoai.kenh-dong{gap:6px;padding:8px;min-height:38px}
.kenh-dong .thang{flex:none;width:16px;text-align:center;font-weight:700;color:var(--chu-mo)}
.kenh-dong .ten{flex:1;min-width:0;font-weight:500}
.kenh-dong.chua-doc .ten{font-weight:700}
.dmc{margin-top:8px}
.dmc .dmc{margin-left:4px} /* bậc 3 nằm trong .dmc-kenh của bậc 2 (21/11) */
.dmc-dau{display:flex;align-items:center;gap:4px;padding-right:4px}
.dmc-nut{flex:1;min-width:0;display:flex;align-items:center;gap:4px;min-height:32px;border:0;border-radius:8px;background:transparent;padding:4px;font-size:13px;font-weight:700;color:var(--chu-mo);cursor:pointer;text-align:left}
.dmc-nut:hover{color:var(--chu)}
.dmc-nut span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dmc-nut .bt{width:14px;height:14px;transform:rotate(90deg)}
.dmc.gap .dmc-nut .bt{transform:none}
/* Gập (Giám đốc 22/11: "không tự động đóng lại khi chọn tắt dropdown"): ẩn HẾT kênh và danh mục con, cháu, kể cả kênh đang mở / chưa đọc.
   Tin chưa đọc vẫn báo bằng chấm số ở tiêu đề danh mục (c.tong_chua_doc). Bản 21/11 kiểu Discord (vẫn hiện kênh đang mở / chưa đọc) đã bỏ. */
.dmc.gap>.dmc-kenh{display:none}
/* Giám đốc 23/11: vào nhóm, danh mục có tin chưa đọc chỉ hiện kênh chưa đọc / đang mở (lớp chi-tin do chat.js đặt); bấm tiêu đề để thả hết */
.dmc.chi-tin>.dmc-kenh>.hoi-thoai:not(.chua-doc):not(.dang-mo){display:none}
.dmc-kenh{padding-left:10px}
.nhom-trong{margin:0;padding:2px 8px 6px;font-size:13px;color:var(--chu-mo)}

/* ---- Tag và thông báo (1b) ---- */
.nhac-role,.nhac-tat_ca{background:var(--xanh-nhat);border-radius:5px;padding:0 3px}
.tin.to-sang .bong{box-shadow:0 0 0 3px #f3d36b;transition:box-shadow .6s}
.goi-y-ten .nhom-gy{display:block;padding:4px 8px 2px;font-size:12px;font-weight:700;color:var(--chu-mo);text-transform:uppercase}
.goi-y-ten .dd.role{border-radius:8px;background:var(--xanh-nhat);color:var(--xanh-dam)}
.thong-bao-dong{display:flex;align-items:center;gap:10px;padding:9px 8px;border-radius:10px;color:inherit;text-decoration:none}
.thong-bao-dong:hover{background:var(--nen-di)}
.thong-bao-dong .giua{flex:1;min-width:0}
.thong-bao-dong .tieu-de{display:block;font-size:14px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.thong-bao-dong.chua-xem .tieu-de{font-weight:600}
.thong-bao-dong .phai{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:6px;font-size:12px;color:var(--chu-mo)}
.loai-tb{display:block;font-size:12px;font-weight:700;color:var(--xanh-dam)}
.loai-tin_rieng{color:#3d7fc2}
.cham-nho{display:block;width:9px;height:9px;border-radius:50%;background:var(--xanh)}
.ket-noi-mat{position:fixed;left:50%;top:8px;transform:translateX(-50%);z-index:30;padding:3px 12px;border-radius:99px;background:var(--vang-nhat);border:1px solid #f0dfa6;font-size:12px;font-weight:600}

/* ---- Dán ảnh (Ctrl+V), kéo thả ảnh / tệp ---- */
.xem-truoc{display:flex;gap:4px;flex:none}
.xem-truoc img{width:40px;height:40px;object-fit:cover;border-radius:6px;border:1px solid var(--vien);background:#fff}
.cot-phai{position:relative}
.tha-tep{position:absolute;inset:8px;z-index:9;display:flex;align-items:center;justify-content:center;border:3px dashed var(--xanh);border-radius:16px;background:rgba(227,243,232,.92);font-weight:700;color:var(--xanh-dam);pointer-events:none}

/* ---- Tin của tài khoản máy (Cổng Claude) ---- */
.dd.dd-may{background:#4b4f58;color:#fff;border-radius:8px;font-size:11px}
.nhan-may{display:inline-block;padding:0 6px;border-radius:6px;background:#e7e8ec;color:#4b4f58;font-size:11px;font-weight:700;vertical-align:1px}

/* ---- Sửa / xoá / ghim, tìm, kho (W10) ---- */
.tin .bong.xoa{font-style:italic;color:var(--chu-mo);background:transparent}
.nhan-xoa{font-size:12px;color:var(--do);margin:0 4px 2px}
.nhan-ghim{color:var(--xanh-dam);font-weight:600}
.lich-su{font-size:12px;color:var(--chu-mo);margin:4px 4px 0}
.lich-su p{margin:2px 0}
.tin{position:relative}
.nut-tin{position:absolute;top:14px;right:-4px;width:28px;height:28px;border:0;border-radius:50%;background:var(--nen-the);box-shadow:0 1px 3px rgba(0,0,0,.18);color:var(--chu-mo);cursor:pointer;opacity:0;font-weight:700;line-height:1}
.tin.cua-toi .nut-tin{right:auto;left:-4px}
.tin:hover .nut-tin,.nut-tin:focus{opacity:1}
@media (hover:none){.nut-tin{opacity:.7}}
.menu-tin{position:absolute;z-index:9;min-width:140px;padding:4px;background:#fff;border:1px solid var(--vien);border-radius:var(--bo);box-shadow:var(--bong)}
.menu-tin button{display:block;width:100%;padding:7px 10px;border:0;border-radius:8px;background:transparent;text-align:left;cursor:pointer}
.menu-tin button:hover{background:var(--xanh-nhat)}
.menu-tin button.do{color:var(--do)}
.dang-sua{display:flex;align-items:center;gap:8px;margin:0 0 6px;padding:4px 4px 4px 12px;border-radius:10px;background:var(--vang-nhat);font-size:14px}
.dang-sua span{flex:1}
.dai-ghim{flex:none;border-bottom:1px solid var(--vien);background:var(--nen-cot)}
.dai-ghim-nut{display:block;width:100%;padding:6px 14px;border:0;background:transparent;text-align:left;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.ds-ghim{max-height:220px;overflow-y:auto;padding:0 8px 8px}
.ds-ghim a{display:block;padding:6px 8px;border-radius:8px;color:inherit;text-decoration:none;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ds-ghim a:hover{background:var(--xanh-nhat)}
dialog.hop-rong{max-width:620px}
.loc-tim{align-items:flex-end}
.loc-tim .truong{flex:1;min-width:120px;margin:0 0 8px}
.ket-qua-tim{margin:12px -8px 0}
.kq-tim{display:flex;gap:10px;padding:8px;border-radius:10px;color:inherit;text-decoration:none}
.kq-tim:hover{background:var(--nen-di)}
.kq-tim .giua{flex:1;min-width:0}
.kq-tim small{display:block;color:var(--chu-mo)}
.kq-tim mark{background:#fbe7a1;border-radius:3px}
.kho-noi-dung{margin:10px 0}
.luoi-anh{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:6px}
.luoi-anh a{display:block;aspect-ratio:1;border-radius:8px;overflow:hidden;background:var(--nen-di)}
.luoi-anh img{width:100%;height:100%;object-fit:cover}
.dong-kho{display:flex;gap:10px;align-items:center;padding:8px;border-bottom:1px solid var(--vien)}
.dong-kho .giua{flex:1;min-width:0}
.dong-kho b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dong-kho small{color:var(--chu-mo)}

/* ---- Thiết lập › Thông báo và chuông ---- */
.qt-o-chon{display:inline-flex;gap:6px;align-items:center;margin:0 12px 6px 0}
.dong-chuong{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid var(--vien)}
.dong-chuong .ten-chuong{flex:1 1 160px;font-weight:600}
.dong-chuong select{min-height:36px;border:1px solid var(--vien);border-radius:8px;padding:0 8px;background:#fff}
.dong-chuong input[type=range]{width:120px}

/* ---- Trang Hoạt động, Thiết lập ---- */
.chi-dt{display:none}
.lien-ket-dau{gap:8px;margin:0 0 14px}
.muc-tl{margin:0 0 22px}
.muc-tl>h2{margin:0 0 10px}
.dong-tl{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--vien);border-radius:var(--bo);background:var(--nen-the);margin:0 0 8px}
.dong-tl .giua{flex:1;min-width:0}
.dong-tl b{display:block}
.dong-tl small{color:var(--chu-mo)}
.dong-tl form{margin:0}

/* ---- Màn hình chat: <body class="trang-chat"> ---- */
.trang-chat{height:100vh;height:100dvh;display:flex;flex-direction:column;overflow:hidden}
.khung-chat{flex:1;min-height:0;display:grid;grid-template-columns:340px minmax(0,1fr)}
/* Dải báo trên đầu mọi trang (khối dai_bao của khung.html), ví dụ "Đang đăng nhập dưới tên X – Thôi" */
.dai-bao{flex:none;display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center;justify-content:center;padding:6px 12px;background:var(--vang-nhat);border-bottom:1px solid #f0dfa6;font-size:14px;font-weight:600}
.dai-bao form{margin:0}
.cot-trai{position:relative;display:flex;flex-direction:column;min-height:0;background:var(--nen-cot);border-right:1px solid var(--vien)}
.dau-cot{display:flex;align-items:center;gap:2px;padding:10px 8px 6px 14px}
.dau-cot .ten-noi{flex:1;min-width:0;font-weight:700;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:8px}
.dau-cot .ten-noi img{width:28px;height:28px;border-radius:7px;flex:none}
.o-tim{position:relative;margin:4px 12px 8px}
.o-tim .bt{position:absolute;left:12px;top:50%;margin-top:-10px;width:20px;height:20px;color:var(--chu-mo);pointer-events:none}
.o-tim input{width:100%;height:40px;padding:0 12px 0 40px;border:1px solid transparent;border-radius:20px;background:var(--nen-di)}
.o-tim input:focus{outline:0;background:#fff;border-color:var(--xanh)}
.bo-loc{display:flex;gap:6px;padding:0 12px 8px;overflow-x:auto;scrollbar-width:none}
.bo-loc::-webkit-scrollbar{display:none}
.loc{flex:none;height:32px;padding:0 14px;border:1px solid var(--vien);border-radius:16px;background:transparent;color:var(--chu-mo);font-size:14px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center}
.loc.chon{background:var(--xanh-nhat);border-color:var(--xanh-nhat);color:var(--xanh-dam)}
.loc.them{width:32px;padding:0;justify-content:center}
.loc.them .bt{width:16px;height:16px}
.ds-hoi-thoai{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding:0 6px 84px}
.hoi-thoai{display:flex;align-items:center;gap:12px;padding:9px 8px;border-radius:var(--bo);color:inherit;text-decoration:none}
.hoi-thoai:hover{background:var(--nen-di)}
.hoi-thoai.dang-mo{background:var(--xanh-nhat)}
.hoi-thoai .giua{flex:1;min-width:0}
.hoi-thoai .ten,.hoi-thoai .dong{display:block}
.hoi-thoai .ten{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hoi-thoai .dong{color:var(--chu-mo);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hoi-thoai .phai{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:5px;font-size:12px;color:var(--chu-mo);min-height:36px}
.cham{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--xanh);color:#fff;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.hoi-thoai.chua-doc .ten{font-weight:700}
.hoi-thoai.chua-doc .dong{color:var(--chu)}
.dd.tep-toi{background:var(--xanh-nhat);color:var(--xanh-dam)}
.ds-trong{padding:24px 12px;text-align:center;color:var(--chu-mo)}
.nut-tao{position:absolute;right:16px;bottom:76px;width:54px;height:54px;border:0;border-radius:50%;background:var(--xanh);color:#fff;box-shadow:var(--bong);cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:2}
.nut-tao:hover{background:var(--xanh-dam)}
.nut-tao .bt{width:26px;height:26px}
.chan-cot{display:flex;align-items:center;gap:10px;padding:8px 12px;border-top:1px solid var(--vien);background:var(--nen-cot);min-height:60px}
.chan-cot .giua{flex:1;min-width:0}
.chan-cot .ten{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dung-luong{font-size:12px;color:var(--chu-mo)}
.dung-luong .thanh{height:5px;border-radius:3px;background:var(--nen-di);overflow:hidden;margin:3px 0 2px}
.dung-luong .thanh i{display:block;height:100%;background:var(--xanh);border-radius:3px;min-width:2px}
.dung-luong.day .thanh i{background:var(--do)}

.cot-phai{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--nen)}
.chua-chon{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--chu-mo);padding:24px;text-align:center}
.chua-chon img{width:72px;height:72px;border-radius:18px;opacity:.9}
.dau-chat{display:flex;align-items:center;gap:10px;padding:8px 14px;background:var(--nen-cot);border-bottom:1px solid var(--vien);min-height:58px}
.dau-chat .giua{flex:1;min-width:0}
.dau-chat .ten{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dau-chat .phu{font-size:13px;color:var(--chu-mo);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.them-phieu{position:relative;flex:none}
.them-phieu>summary{list-style:none;position:relative}
.them-phieu>summary::-webkit-details-marker{display:none}
.them-phieu[open]>summary{background:var(--nen-di);color:var(--chu)}
.them-phieu .cham{position:absolute;top:7px;right:7px;width:9px;height:9px;border-radius:50%;background:var(--do)}
.them-phieu-ds{position:absolute;right:0;top:calc(100% + 6px);z-index:40;display:flex;flex-direction:column;gap:6px;min-width:180px;padding:8px;background:var(--nen-the);border:1px solid var(--vien);border-radius:12px;box-shadow:var(--bong)}
.them-phieu-ds .nut{justify-content:flex-start;width:100%;box-sizing:border-box}
.them-phieu.len .them-phieu-ds{top:auto;bottom:calc(100% + 6px);right:auto;left:0}
.nut-lui{display:none}
.ds-tin{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:14px 16px 6px}
.tai-cu{display:block;margin:0 auto 12px}
.ngay-tin{text-align:center;font-size:12px;color:var(--chu-mo);margin:10px 0}
.tin{display:flex;gap:8px;margin:0 0 10px;max-width:760px}
.tin .than{min-width:0;max-width:78%}
.tin .ai{font-size:12px;color:var(--chu-mo);margin:0 0 2px 4px}
.tin .bong{display:inline-block;max-width:100%;padding:8px 12px;border-radius:4px 16px 16px 16px;background:var(--nen-the);border:1px solid var(--vien);white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.tin .gio{font-size:11px;color:var(--chu-mo);margin:2px 4px 0}
.tin.cua-toi{flex-direction:row-reverse;margin-left:auto}
.tin.cua-toi .dd,.tin.cua-toi .ai{display:none}
.tin.cua-toi .than{text-align:right}
.tin.cua-toi .bong{text-align:left;background:var(--xanh-nhat);border-color:#cfe8d7;border-radius:16px 4px 16px 16px}
.tin.dang-gui{opacity:.6}
.nhac-ten{color:var(--xanh-dam);font-weight:700}
.tep-kem{display:flex;align-items:center;gap:8px;margin:6px 0 0;padding:8px 10px;border:1px solid var(--vien);border-radius:10px;background:#fff;color:inherit;text-decoration:none;max-width:280px;text-align:left}
.tep-kem:hover{border-color:var(--xanh)}
.tep-kem .bt{color:var(--xanh-dam)}
.tep-kem b{display:block;font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tep-kem small{color:var(--chu-mo)}
.tep-kem>span{min-width:0}
.bong a{color:var(--xanh-dam);word-break:break-all}
.cong-cu{display:flex;align-items:center;flex:none}
.anh-kem{display:block;margin:6px 0 0}
.anh-kem img{display:block;max-width:240px;max-height:220px;border-radius:10px;border:1px solid var(--vien);background:var(--nen-di)}
.tin-trong{text-align:center;color:var(--chu-mo);padding:40px 12px}
.khung-go{position:relative;border-top:1px solid var(--vien);background:var(--nen-cot);padding:8px 10px;padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
.o-go{display:flex;align-items:flex-end;gap:6px}
.o-go textarea{flex:1;min-width:0;min-height:42px;max-height:132px;resize:none;padding:10px 14px;border:1px solid var(--vien);border-radius:21px;background:#fff;line-height:1.4}
.o-go textarea:focus{outline:0;border-color:var(--xanh)}
.o-go textarea::placeholder{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.o-go .nut-gui{background:var(--xanh);color:#fff}
.o-go .nut-gui:hover{background:var(--xanh-dam);color:#fff}
.tep-chon{display:flex;align-items:center;gap:8px;margin:0 0 8px;padding:6px 6px 6px 12px;border-radius:10px;background:var(--nen-di);font-size:14px}
.tep-chon span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tep-chon .nut-bt{width:30px;height:30px}
.loi-gui{margin:0 0 8px;color:var(--do);font-size:14px}
.chi-doc{padding:12px;text-align:center;color:var(--chu-mo);border-top:1px solid var(--vien);background:var(--nen-cot)}
.goi-y-ten{position:absolute;left:10px;right:10px;bottom:100%;max-height:220px;overflow-y:auto;background:#fff;border:1px solid var(--vien);border-radius:var(--bo);box-shadow:var(--bong);padding:4px;z-index:6}
.goi-y-ten button{display:flex;align-items:center;gap:8px;width:100%;padding:6px 8px;border:0;border-radius:8px;background:transparent;text-align:left;cursor:pointer}
.goi-y-ten button.chon,.goi-y-ten button:hover{background:var(--xanh-nhat)}

/* ---- Chế độ giám sát (chỉ đọc) ---- */
.dai-giam-sat{padding:8px 14px;background:var(--vang-nhat);border-bottom:1px solid #f0dfa6;font-size:14px;font-weight:600;text-align:center}
.tim-gs{display:flex;gap:6px;margin:4px 12px 8px}
.tim-gs .o-tim{flex:1;margin:0}
.ghi-chu-gs{margin:0 12px 8px;font-size:13px;color:var(--chu-mo)}
.ds-hoi-thoai.gs{padding-bottom:12px}

/* ---- Hộp thoại (tạo cuộc trò chuyện) ---- */
dialog.hop{border:0;border-radius:16px;padding:0;width:calc(100% - 32px);max-width:420px;max-height:calc(100% - 32px);box-shadow:var(--bong);color:var(--chu);background:var(--nen-the)}
dialog.hop::backdrop{background:rgba(40,30,15,.4)}
.hop .dau-hop{display:flex;align-items:center;padding:12px 8px 8px 18px}
.hop .dau-hop h2{flex:1;margin:0}
.hop .than-hop{padding:4px 18px 18px;overflow-y:auto}
.the-chuyen{display:flex;gap:6px;margin:0 0 12px}
.ds-nguoi{max-height:300px;overflow-y:auto;margin:0 -8px}
.ds-nguoi button{display:flex;align-items:center;gap:10px;width:100%;padding:7px 8px;border:0;border-radius:10px;background:transparent;text-align:left;cursor:pointer}
.ds-nguoi button:hover{background:var(--nen-di)}

/* ---- Hộp mời cài app + hộp nhắc nhỏ ---- */
.hop-cai{position:fixed;right:16px;bottom:16px;z-index:50;width:320px;max-width:calc(100% - 32px);padding:14px 16px;background:var(--nen-the);border:1px solid var(--vien);border-radius:16px;box-shadow:var(--bong)}
.hop-cai .dong-dau{display:flex;align-items:center;gap:10px;margin:0 0 4px;font-weight:700}
.hop-cai .dong-dau img{width:36px;height:36px;border-radius:9px}
.hop-cai p{margin:0 0 12px;color:var(--chu-mo);font-size:14px}
.hop-cai .hang{justify-content:flex-end}

/* ---- Điện thoại ---- */
@media (max-width:640px){
  /* Thanh đáy đúng 4 nút: Hoạt động · Tin nhắn · Nhóm · Thiết lập */
  .thanh-muc{top:auto;right:0;width:auto;height:calc(58px + env(safe-area-inset-bottom,0px));flex-direction:row;justify-content:space-around;gap:0;padding:4px 2px;padding-bottom:calc(4px + env(safe-area-inset-bottom,0px));border-right:0;border-top:1px solid var(--vien);background:var(--nen-cot);overflow:hidden}
  .thanh-muc .dau-muc,.nut-muc:not(.dt){display:none}
  .nut-muc{flex:1 1 0;min-width:0;padding:5px 1px 3px;font-size:11px;gap:2px}
  .nut-muc[data-muc="hoat_dong"]{order:-1}
  .nut-muc span{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .nut-muc.chon{box-shadow:none;background:var(--xanh-nhat)}
  .co-muc{padding-left:0;padding-bottom:calc(58px + env(safe-area-inset-bottom,0px))}
  .co-muc.dang-chat{padding-bottom:0}
  .co-muc.dang-chat .thanh-muc{display:none}
  .co-muc .hop-cai{bottom:calc(70px + env(safe-area-inset-bottom,0px))}
  .dau-muc-trang{padding-left:14px}
  .chi-dt{display:flex}
  .khung-chat{grid-template-columns:minmax(0,1fr)}
  .khung-chat.co-kenh .cot-trai{display:none}
  .khung-chat:not(.co-kenh) .cot-phai{display:none}
  .cot-trai{border-right:0}
  .nut-lui{display:inline-flex;margin-left:-8px}
  .dau-chat{padding:6px 10px}
  .ds-tin{padding:12px 10px 4px}
  .tin .than{max-width:84%}
  .o-go{flex-wrap:wrap}
  .cong-cu{flex-basis:100%;order:-1;margin:-4px 0 2px -4px}
  .hop-cai{left:12px;right:12px;bottom:12px;width:auto;max-width:none}
  .than-trang{padding:14px 10px}
  .than-muc{padding:14px 12px 28px}
  .the{padding:16px}
}
@media (prefers-reduced-motion:no-preference){
  .hop-cai{animation:hien .25s ease-out}
  @keyframes hien{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}
}
/* Tin việc (Nhắc việc, phiên E): thẻ việc dưới tin, nút "Đã xong" */
.the-viec{display:block;margin:6px 0 0;padding:8px 12px;border:1px solid var(--vien);border-left:4px solid #e0a800;border-radius:10px;background:var(--nen-the);text-align:left;max-width:420px;font-size:14px}
.tin.cua-toi .the-viec{margin-left:auto}
.the-phieu-dien{display:block;max-width:560px;margin:6px 0 0;padding:8px 12px;border:1px solid var(--vien);border-left:4px solid var(--xanh);border-radius:10px;background:var(--nen-the);text-align:left}
.pd-nhan{display:inline-block;padding:0 6px;border-radius:6px;background:var(--xanh-nhat);color:var(--xanh-dam);font-size:12px;font-weight:600}
.pd-xong{font-size:14px}
.pd-dong{display:flex;flex-wrap:wrap;gap:6px 10px;margin:6px 0;padding-top:6px;border-top:1px dashed var(--vien)}
.pd-viet{flex-basis:100%;font-size:13px;color:var(--chu-mo)}
.pd-o{display:flex;flex-direction:column;gap:2px;font-size:12px;color:var(--chu-mo);min-width:120px;flex:1}
.pd-o select,.pd-o input{min-height:34px;padding:4px 8px;border:1px solid var(--vien);border-radius:8px;background:var(--nen-the);color:var(--chu);font:inherit;font-size:14px}
.pd-loi{margin:4px 0;color:var(--do);font-size:13px}
.the-viec .tv-dau{margin:0 0 2px}
.the-viec .tv-nhan{display:inline-block;padding:0 6px;border-radius:6px;background:#fff7e0;color:#7a5a00;font-size:12px;font-weight:600}
.the-viec .tv-tt{display:inline-block;padding:0 8px;border-radius:999px;font-size:12px;border:1px solid var(--vien);background:var(--nen-di)}
.the-viec .tv-dong{color:var(--chu-mo);font-size:13px;overflow-wrap:anywhere}
.the-viec .nut{margin-top:6px}
.the-viec.tv-cho_duyet{border-left-color:#1a73e8}
.the-viec.tv-da_duyet{border-left-color:var(--xanh)}
.the-viec.tv-da_duyet .tv-tt{background:#e6f4ea;border-color:#9fd4ae;color:#1e6b34}
.the-viec.tv-tra_lai{border-left-color:var(--do)}
.the-viec.tv-tra_lai .tv-tt{background:#fdecea;border-color:#f2a7a0;color:#a1261b}
.the-viec.tv-khong_lam{border-left-color:#999;opacity:.85}
/* Trang mục rộng (Quản trị, Hoạt động — phiên H 20/11, Giám đốc: "TÔI ĐANG LÀM VỚI BẠN LÀ PC"): dùng hết bề ngang máy tính */
.than-muc.than-muc-rong{max-width:none;padding-left:24px;padding-right:24px}
@media (max-width:640px){.than-muc.than-muc-rong{padding:14px 12px 28px}}

/* iPhone / iPad (Safari): ô nhập dưới 16px làm trình duyệt TỰ PHÓNG TO trang khi chạm vào và không thu lại
   → sau khi gửi tin trang bị lệch, tràn viền (Giám đốc 20/11, ảnh iPhone). Ép 16px cho mọi ô nhập trên thiết bị iOS. */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .o-go textarea { font-size: 16px; }
}

/* ---- Màu nhãn role (Giám đốc 21/11: nhãn "@Tên role" kiểu Discord, 10 màu cơ bản; mã màu ở quyen.models.MAU_ROLE) ---- */
.role-mau-xanh_la{--rm:#1f8a4c}.role-mau-xanh_duong{--rm:#2563c9}.role-mau-xanh_ngoc{--rm:#0e8a8a}.role-mau-tim{--rm:#7c4dcc}
.role-mau-hong{--rm:#c2417e}.role-mau-do{--rm:#c93a32}.role-mau-cam{--rm:#c8641a}.role-mau-vang{--rm:#9a7a05}
.role-mau-nau{--rm:#8a5a35}.role-mau-xam{--rm:#646b74}
.the-role{display:inline-block;padding:1px 8px;border-radius:6px;font-size:13px;font-weight:700;line-height:1.5;white-space:nowrap;
  color:var(--rm,#1f8a4c);background:color-mix(in srgb,var(--rm,#1f8a4c) 14%,#fff)}
a.khong-gach,a.khong-gach:hover{text-decoration:none}
a.khong-gach:hover .the-role{background:color-mix(in srgb,var(--rm,#1f8a4c) 24%,#fff)}
.nhac-ten.nhac-role[class*="role-mau-"]{color:var(--rm);background:color-mix(in srgb,var(--rm) 14%,#fff)}
.chon-mau-role{border:0;margin:4px 0 12px;padding:0;display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.chon-mau-role legend{font-size:14px;font-weight:600;margin-bottom:6px;padding:0}
.chon-mau-role .o-mau{position:relative;cursor:pointer}
.chon-mau-role .o-mau input{position:absolute;opacity:0;width:1px;height:1px}
.chon-mau-role .cham{display:block;width:28px;height:28px;border-radius:50%;background:var(--rm);border:3px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.15)}
.chon-mau-role .o-mau input:checked+.cham{box-shadow:0 0 0 3px var(--rm)}
.chon-mau-role .o-mau input:focus-visible+.cham{outline:2px solid #2b2a27;outline-offset:3px}
.an-chu{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
