:root {
  --nen: #eef0f1; --mat: #fff; --mat-2: #f3f5f7; --chu: #081c36; --mo: #7589a3; --vien: #e1e4ea;
  --chinh: #0068ff; --chinh-dam: #005ae0; --chinh-chu: #fff; --ray: #0068ff; --ray-chon: #0053cc;
  --minh: #e5efff; --khach: #fff; --chon: #e5efff; --re: #f3f5f7;
  --loi: #d93025; --cho: #e8590c; --xanh: #22c55e; --xam: #aab4c3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --nen: #0e1116; --mat: #171b22; --mat-2: #1d232c; --chu: #e6ebf2; --mo: #8b9bb0; --vien: #262d37;
    --chinh: #3d8bff; --chinh-dam: #2f7af0; --chinh-chu: #06101f; --ray: #0b3a80; --ray-chon: #0a2f68;
    --minh: #183258; --khach: #222a35; --chon: #1b2d48; --re: #1f2630;
    --loi: #ff7b72; --cho: #ffa94d; --xanh: #34d399; --xam: #5d6b7e;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--nen); color: var(--chu); font: 14px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { background: var(--mat); border: 1px solid var(--vien); border-radius: 6px; padding: 7px 10px; }
:focus-visible { outline: 2px solid var(--chinh); outline-offset: 1px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nho { font-size: 12px; }
.mo-chu { color: var(--mo); }
.loi { color: var(--loi); margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.trong { color: var(--mo); padding: 16px; margin: 0; text-align: center; }
.an-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nut-chinh { padding: 7px 16px; border: 0; border-radius: 6px; background: var(--chinh); color: var(--chinh-chu); cursor: pointer; font-weight: 600; }
.nut-chinh:hover { background: var(--chinh-dam); }
.nut-phu { padding: 6px 12px; border: 1px solid var(--vien); border-radius: 6px; background: var(--mat); cursor: pointer; }
.nut-phu:hover { background: var(--mat-2); }
.nut-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: none; color: var(--mo); cursor: pointer; position: relative; }
.nut-icon:hover { background: var(--mat-2); color: var(--chu); }
.nut-icon[aria-pressed="true"] { color: var(--chinh); background: var(--chon); }
.nut-icon.nho { width: 24px; height: 24px; }
button:disabled { opacity: .5; cursor: default; }

/* Dang nhap */
.man-dn { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.hop-dn { width: min(360px, 100%); background: var(--mat); border: 1px solid var(--vien); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.hop-dn h1 { margin: 0; font-size: 20px; color: var(--chinh); }
.hop-dn p { margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--mo); font-size: 13px; }
label input { color: var(--chu); font-size: 14px; }

/* Bo cuc 4 cot */
.khung { height: 100%; display: grid; grid-template-columns: 64px 340px minmax(0, 1fr) 320px; }
.khung.an-tt { grid-template-columns: 64px 340px minmax(0, 1fr) 0; }
.khung.an-tt .cot-tt { display: none; }

/* Cot nick */
.ray { background: var(--ray); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; min-height: 0; }
.ray-nick { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; align-items: center; width: 100%; padding: 2px 0; }
.ray-mot { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.ray-mot .avt { box-shadow: 0 0 0 2px transparent; }
.ray-mot[aria-current="true"] .avt { box-shadow: 0 0 0 3px #fff; }
.ray-mot:hover .avt { box-shadow: 0 0 0 3px rgb(255 255 255 / .55); }
.cham { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ray); background: var(--xam); }
.cham.dang-nghe { background: var(--xanh); }
.cham.loi { background: var(--loi); }
.ray-nut { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: #fff; cursor: pointer; }
.ray-nut:hover { background: var(--ray-chon); }
.ray-duoi { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ray-duoi .ray-nut { width: 60px; height: auto; min-height: 44px; padding: 5px 0 4px; gap: 2px; grid-template-rows: 22px auto; }
.ray-chu { font-size: 9.5px; line-height: 1.1; opacity: .9; white-space: nowrap; }
.ray-ten { color: #fff; font-size: 10px; max-width: 60px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }

/* Avatar */
.avt { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 600; background: var(--xam); user-select: none; }
.avt img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Cot danh sach */
.cot-ds { background: var(--mat); border-right: 1px solid var(--vien); display: flex; flex-direction: column; min-height: 0; }
.dau-ds { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--vien); }
.nick-hien { display: flex; flex-direction: column; }
.nick-hien strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-tim { display: flex; align-items: center; gap: 6px; background: var(--re); border-radius: 8px; padding: 0 10px; color: var(--mo); }
.o-tim svg { width: 18px; height: 18px; }
.o-tim input { border: 0; background: none; flex: 1; min-width: 0; padding: 8px 0; }
.o-tim input:focus-visible { outline: none; }
.loc { display: flex; gap: 16px; }
.loc-nut { border: 0; background: none; padding: 6px 0 8px; color: var(--mo); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.loc-nut[aria-pressed="true"] { color: var(--chinh); border-bottom-color: var(--chinh); }
#soCho:not(:empty) { background: var(--loi); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; }
.hop-qr { padding: 16px; text-align: center; border-bottom: 1px solid var(--vien); }
.hop-qr p { margin: 0 0 10px; }
.hop-qr img { display: block; margin: 0 auto 12px; background: #fff; padding: 6px; border-radius: 8px; }
.ds-ht { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.ht { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.ht:hover { background: var(--mat-2); }
.ht[aria-current="true"] { background: var(--chon); }
.ht-giua { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ht-dong { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ht-ten { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht.dang-cho .ht-ten { font-weight: 700; }
.ht-gio { color: var(--mo); font-size: 12px; white-space: nowrap; }
.ht-tin { color: var(--mo); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht.dang-cho .ht-tin { color: var(--chu); }
.the-cho { flex: none; background: var(--loi); color: #fff; font-size: 11px; font-weight: 600; border-radius: 9px; padding: 0 6px; white-space: nowrap; }

/* Cot chat */
.cot-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--nen); }
.dau-chat { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--mat); border-bottom: 1px solid var(--vien); min-height: 64px; }
.ten-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ten-chat strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.khung-tin { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.chao { margin: auto; text-align: center; color: var(--mo); max-width: 360px; }
.chao h2 { color: var(--chu); font-weight: 600; }
.moc-ngay { align-self: center; margin: 12px 0 6px; background: rgb(0 0 0 / .32); color: #fff; font-size: 12px; padding: 2px 12px; border-radius: 12px; }
@media (prefers-color-scheme: dark) { .moc-ngay { background: rgb(255 255 255 / .12); } }
.dong-tin { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.dong-tin.minh { flex-direction: row-reverse; }
.cho-avt { width: 32px; flex: none; }
.cot-bong { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: min(70%, 600px); min-width: 0; }
.dong-tin.minh .cot-bong { align-items: flex-end; }
.tin { padding: 8px 12px; border-radius: 10px; background: var(--khach); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgb(0 0 0 / .06); max-width: 100%; }
.minh .tin { background: var(--minh); }
.tin.thu-hoi { opacity: .65; font-style: italic; }
.tin small { display: block; margin-top: 3px; color: var(--mo); font-size: 11px; }
.tin a { color: var(--chinh); }
.tin img { display: block; max-width: 100%; max-height: 300px; border-radius: 6px; margin: 2px 0; cursor: zoom-in; background: var(--mat-2); }
.trich { border-left: 3px solid var(--chinh); padding: 2px 8px; margin-bottom: 4px; font-size: 12px; color: var(--mo); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.cam-xuc { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -6px; }
.cam-xuc span { background: var(--mat); border: 1px solid var(--vien); border-radius: 10px; padding: 0 6px; font-size: 12px; }
.hanh-dong { display: flex; gap: 2px; flex-wrap: wrap; opacity: 0; transition: opacity .12s; }
.dong-tin:hover .hanh-dong, .dong-tin:focus-within .hanh-dong { opacity: 1; }
@media (hover: none) { .hanh-dong { opacity: 1; } }
.hanh-dong button { border: 1px solid var(--vien); background: var(--mat); border-radius: 12px; padding: 0 7px; font-size: 12px; line-height: 22px; cursor: pointer; }
.hanh-dong button:hover { background: var(--chon); }

/* Soan tin */
.soan { background: var(--mat); border-top: 1px solid var(--vien); position: relative; }
.hop-mau { position: absolute; left: 10px; right: 10px; bottom: 100%; margin-bottom: 6px; max-height: 320px; display: flex; flex-direction: column;
  background: var(--mat); border: 1px solid var(--vien); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .14); z-index: 5; }
.dau-mau { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--vien); }
.dau-mau input { flex: 1; min-width: 0; }
.ds-mau { list-style: none; margin: 0; padding: 4px; overflow-y: auto; }
.mot-mau { display: flex; flex-direction: column; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.mot-mau span { color: var(--mo); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; }
.mot-mau[aria-selected="true"], .mot-mau:hover { background: var(--chon); }
.ds-mau .rong-muc { padding: 10px; }
.hop-ql-mau { width: min(560px, calc(100% - 32px)); }
.hop-ql-mau > p { margin: 6px 0 12px; }
.form-mau label { display: flex; flex-direction: column; gap: 4px; }
.form-mau textarea { resize: vertical; }
.ds-ql-mau { list-style: none; margin: 16px 0; padding: 0; max-height: 40vh; overflow-y: auto; border-top: 1px solid var(--vien); }
.ds-ql-mau li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--vien); }
.ql-mau-chu { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ql-mau-chu span { white-space: pre-line; overflow-wrap: anywhere; color: var(--mo); font-size: 13px; }
.nick-hien .cong-tac { display: inline-flex; flex-direction: row; align-self: flex-start; align-items: center; gap: 6px; margin-top: 4px; color: var(--mo); cursor: pointer; }
.cong-tac input { margin: 0; }
.nhan-nhom { font-size: 10px; font-weight: 600; padding: 0 5px; border-radius: 4px; background: var(--re); color: var(--mo); margin-right: 5px; vertical-align: 1px; }
.thanh-cong-cu { display: flex; align-items: center; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--vien); }
.thanh-cong-cu .loi { margin-left: 8px; }
.dang-tra-loi { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 16px; border-left: 3px solid var(--chinh); background: var(--mat-2); font-size: 12px; }
.dang-tra-loi > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dong-nhap { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 10px 16px; }
.dong-nhap textarea { flex: 1; border: 0; resize: none; max-height: 160px; padding: 8px 0; background: none; }
.dong-nhap textarea:focus-visible { outline: none; }
.nut-gui { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--chinh); cursor: pointer; }
.nut-gui:hover { background: var(--chon); }

/* Cot thong tin */
.cot-tt { background: var(--mat); border-left: 1px solid var(--vien); display: flex; flex-direction: column; min-height: 0; }
.dau-tt { margin: 0; padding: 0 16px; min-height: 64px; display: flex; align-items: center; justify-content: center; font-size: 16px; border-bottom: 1px solid var(--vien); }
.noi-dung-tt { overflow-y: auto; flex: 1; }
.tt-dau { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; border-bottom: 6px solid var(--nen); text-align: center; }
.tt-dau strong { font-size: 16px; overflow-wrap: anywhere; }
details { border-bottom: 6px solid var(--nen); }
summary { padding: 12px 16px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "▾"; color: var(--mo); }
details:not([open]) summary::after { content: "▸"; }
.luoi-anh { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 16px 12px; }
.luoi-anh a { aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--mat-2); }
.luoi-anh img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ds-tep { list-style: none; margin: 0; padding: 0 8px 12px; }
.ds-tep a { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.ds-tep a:hover { background: var(--mat-2); }
.bieu-tep { flex: none; width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; background: #7c5cff; }
.bieu-tep.link { background: var(--chinh); }
.tep-chu { min-width: 0; display: flex; flex-direction: column; }
.tep-chu span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rong-muc { padding: 0 16px 12px; color: var(--mo); margin: 0; font-size: 13px; }

/* Quan ly nhan vien */
.vung-nv { grid-column: 3 / 5; overflow: auto; padding: 0 20px 20px; background: var(--mat); }
.dau-nv { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; }
.dau-nv h2 { margin: 0; font-size: 16px; }
.dong-them { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.dong-them input { flex: 1 1 200px; min-width: 0; }
.bang-cuon { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--vien); vertical-align: top; }
th { color: var(--mo); font-weight: 600; font-size: 12px; }
.chon-nick { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.chon-nick label { flex-direction: row; align-items: center; gap: 6px; color: var(--chu); font-size: 14px; }
.thao-tac { display: flex; flex-wrap: wrap; gap: 6px; }
.thao-tac input { width: 150px; }
.nhan { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--chon); margin-left: 6px; }
.nhan.khoa { color: var(--loi); }
.khung.dang-nv .cot-chat, .khung.dang-nv .cot-tt { display: none; }

dialog { border: 1px solid var(--vien); border-radius: 12px; background: var(--mat); color: var(--chu); width: min(380px, calc(100% - 32px)); padding: 20px; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-size: 16px; }
dialog::backdrop { background: rgb(0 0 0 / .4); }
.dong-nut { display: flex; justify-content: flex-end; gap: 8px; }

/* Man hinh hep */
@media (max-width: 1180px) {
  .khung, .khung.an-tt { grid-template-columns: 64px 300px minmax(0, 1fr); }
  .cot-tt { position: fixed; right: 0; top: 0; bottom: 0; width: min(320px, 90vw); z-index: 5; box-shadow: -4px 0 16px rgb(0 0 0 / .15); }
  .vung-nv { grid-column: 3 / 4; }
}
@media (max-width: 760px) {
  .khung, .khung.an-tt { grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto; }
  .ray { grid-row: 1 / 3; }
  .cot-ds { max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--vien); }
  .cot-chat { grid-column: 2; min-height: 55vh; }
  .vung-nv { grid-column: 2; }
  .ray-nut { width: 40px; height: 40px; }
}
.hop-xac-nhan p { margin: 0 0 16px; white-space: pre-line; }
/* Gui hang loat */
.hl-luu-y { margin: 0 0 12px; max-width: 900px; }
.hl-luoi { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hl-tao, .hl-dot { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hl-tao h3, .hl-dot h3 { margin: 0; font-size: 15px; }
.hl-tao label { display: flex; flex-direction: column; gap: 4px; }
.hl-tao select { background: var(--mat); border: 1px solid var(--vien); border-radius: 6px; padding: 6px 8px; font: inherit; color: inherit; }
.hl-tao textarea { resize: vertical; }
.hl-hang { display: flex; gap: 12px; flex-wrap: wrap; }
.hl-hang > label { flex: 1 1 160px; min-width: 0; }
.hl-tao fieldset { border: 1px solid var(--vien); border-radius: 8px; padding: 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hl-tao legend { padding: 0 4px; font-weight: 600; }
.hl-tao .hl-chon-het { flex-direction: row; align-items: center; gap: 6px; }
.hl-ds-khach { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; border-top: 1px solid var(--vien); }
.hl-ds-khach label { flex-direction: row; align-items: center; gap: 8px; padding: 5px 2px; cursor: pointer; }
.hl-ds-khach .hl-ten { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-ds-khach .rong-muc { padding: 10px 0; }
.hl-phanh { flex-direction: row !important; flex-wrap: wrap; }
.hl-phanh label { flex: 1 1 110px; font-size: 13px; }
.hl-phanh input { width: 100%; }
.hl-ds-dot { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hl-mot { border: 1px solid var(--vien); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.hl-dong { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.hl-dong strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-thanh { height: 6px; border-radius: 3px; background: var(--re); overflow: hidden; }
.hl-thanh span { display: block; height: 100%; background: var(--chinh); }
.nhan.tt-dang-chay { background: var(--chinh); color: var(--chinh-chu); }
.nhan.tt-tam-dung { background: var(--cho); color: #fff; }
.hl-chi-tiet ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
.hl-nguoi { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--vien); }
.hl-nguoi.loi { color: var(--loi); }
.hl-nguoi.da-gui .nho { color: var(--xanh); }
@media (max-width: 1180px) { .hl-luoi { grid-template-columns: minmax(0, 1fr); } }
