@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url(/fonts/be-vietnam-pro-vietnamese-400-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url(/fonts/be-vietnam-pro-vietnamese-500-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url(/fonts/be-vietnam-pro-vietnamese-600-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url(/fonts/be-vietnam-pro-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url(/fonts/be-vietnam-pro-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }

:root {
  --nen: #e7eeeb;
  --mat: #fbfcfb;
  --muc: #12302f;
  --nhat: #4d6664;
  --vien: #c9d6d1;
  --la: #0b6b62;
  --la-dam: #084f49;
  --la-nhat: #d5ebe5;
  --ho-phach: #b97a00;
  --ho-phach-nhat: #fbeecb;
  --do: #b3301f;
  --do-nhat: #fae0da;
  --xam: #8b9c99;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--nen);
  color: var(--muc);
  font: 400 15px/1.55 "Be Vietnam Pro", system-ui, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 700; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--la); }
:focus-visible { outline: 2px solid var(--la); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

.an-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Khung trang */
.khung { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100dvh; }
.rail { background: var(--la-dam); color: #eaf5f2; display: flex; flex-direction: column; padding: 18px 10px; gap: 4px; }
.rail .ten { font-weight: 700; font-size: 16px; padding: 4px 12px 16px; }
.rail a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 6px; color: inherit; text-decoration: none; font-weight: 500;
}
.rail a:hover { background: rgb(255 255 255 / .09); }
.rail a[aria-current="page"] { background: var(--mat); color: var(--la-dam); }
.rail .day { margin-top: auto; }
.rail .thoat { background: none; border: 0; padding: 9px 12px; text-align: left; cursor: pointer; opacity: .8; }
.dem { background: var(--ho-phach); color: #fff; border-radius: 10px; font-size: 12px; font-weight: 600; padding: 0 7px; }
.trang { overflow: auto; min-width: 0; }
.noi-dung { max-width: 960px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.dau-trang { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mo-ta { color: var(--nhat); max-width: 68ch; }

/* Thành phần */
.mang { background: var(--mat); border: 1px solid var(--vien); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.nut {
  border: 1px solid transparent; border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.nut.chinh { background: var(--la); color: #fff; }
.nut.chinh:hover { background: var(--la-dam); }
.nut.phu { background: var(--mat); border-color: var(--vien); }
.nut.phu:hover { border-color: var(--la); }
.nut.nguy { background: var(--mat); border-color: var(--do); color: var(--do); }
.nut:disabled { opacity: .5; cursor: default; }
.nut.nho { padding: 4px 10px; font-size: 13px; }
.hang-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.day-phai { justify-content: flex-end; }
label.o { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 14px; min-width: 0; }
label.o small { font-weight: 400; color: var(--nhat); }
input[type=text], input[type=password], input[type=tel], input[type=search], input[type=number], input[type=url],
input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--vien); border-radius: 6px; padding: 8px 10px; font-weight: 400;
}
textarea { resize: vertical; min-height: 84px; }
.luoi-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bat-tat { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.bat-tat input { width: 18px; height: 18px; accent-color: var(--la); }
.loi-chu { color: var(--do); font-size: 14px; }
.nhac { padding: 10px 12px; border-radius: 6px; background: var(--ho-phach-nhat); color: #5e3f00; }
.nhac.xau { background: var(--do-nhat); color: #7c1d10; }
.nhac.tot { background: var(--la-nhat); color: var(--la-dam); }
.nhan { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 4px; background: var(--la-nhat); color: var(--la-dam); font-size: 13px; }
.nhan button { all: unset; cursor: pointer; padding: 0 2px; font-weight: 700; }
.nhan.vang { background: var(--ho-phach-nhat); color: #5e3f00; }
.nhan.do { background: var(--do-nhat); color: #7c1d10; }
.nhan.xam { background: #e3e8e6; color: var(--nhat); }
.trong { color: var(--nhat); padding: 28px 12px; text-align: center; }
.dong { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--vien); }
.dong:first-child { border-top: 0; }
.dong > div:first-child { min-width: 0; }
.phu-chu { color: var(--nhat); font-size: 13px; }
.cat-chu { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hộp thư */
.hop-thu { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; }
.ds-hoi-thoai { background: var(--mat); border-right: 1px solid var(--vien); display: flex; flex-direction: column; min-height: 0; }
.ds-hoi-thoai .tim { padding: 12px; border-bottom: 1px solid var(--vien); }
.ds-cuon { overflow: auto; flex: 1; }
.muc-ht { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--vien); padding: 10px 12px 0; cursor: pointer; }
.muc-ht:hover { background: #f0f5f3; }
.muc-ht[aria-current="true"] { background: var(--la-nhat); }
.muc-ht .tren { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.muc-ht b { font-weight: 600; }
.muc-ht .xem-truoc { color: var(--nhat); font-size: 14px; display: flex; gap: 8px; justify-content: space-between; margin-bottom: 8px; }

/* Thanh khung gửi: cạn dần theo thời gian còn được nhắn khách */
.thanh-khung { height: 4px; background: #dfe7e4; margin: 0 -12px; display: block; }
.thanh-khung i { display: block; height: 100%; }
.thanh-khung.mien_phi i { background: var(--la); }
.thanh-khung.co_phi i { background: var(--ho-phach); }
.thanh-khung.het i, .thanh-khung.chua_ro i { background: transparent; }

.khung-chat { display: flex; flex-direction: column; min-height: 0; height: 100%; min-width: 0; }
.dau-chat { background: var(--mat); padding: 10px 16px 0; border-bottom: 1px solid var(--vien); display: flex; flex-direction: column; gap: 6px; }
.dau-chat .hang { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.dau-chat .thanh-khung { margin: 0 -16px; height: 6px; }
.quay-lai { display: none; }
.dong-tin { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.tin { max-width: min(72%, 560px); padding: 7px 11px; border-radius: 8px; background: var(--mat); border: 1px solid var(--vien); white-space: pre-wrap; overflow-wrap: anywhere; align-self: flex-start; }
.tin.ra { align-self: flex-end; background: var(--la); border-color: var(--la); color: #fff; }
.tin.ra.tu-dong { background: var(--la-nhat); color: var(--la-dam); border-color: var(--la-nhat); }
.tin img { display: block; max-width: 100%; max-height: 280px; border-radius: 4px; }
.tin .gio { display: block; font-size: 11px; opacity: .75; margin-top: 2px; }
.soan { background: var(--mat); border-top: 1px solid var(--vien); padding: 10px 12px; display: flex; gap: 8px; align-items: flex-end; }
.soan textarea { min-height: 42px; height: 42px; flex: 1; }
.chi-tiet-khach { display: grid; grid-template-columns: 170px 170px minmax(0, 1fr); gap: 10px; padding: 6px 0; }
.chi-tiet-khach textarea { min-height: 40px; height: 40px; }
.dau-chat details { padding-bottom: 6px; }
.dau-chat summary { cursor: pointer; }
.dong form { flex-wrap: nowrap; }
.dong form input { width: 150px; }

/* Bảng số khách */
.so-lieu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--mat); border: 1px solid var(--vien); border-radius: 8px; }
.so-lieu div { padding: 12px 16px; border-left: 1px solid var(--vien); }
.so-lieu div:first-child { border-left: 0; }
.so-lieu b { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.so-lieu span { color: var(--nhat); font-size: 13px; }
.thanh-tien-do { height: 6px; background: var(--vien); border-radius: 3px; overflow: hidden; }
.thanh-tien-do i { display: block; height: 100%; background: var(--la); }

/* Trình soạn bài */
.khoi { border: 1px solid var(--vien); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.anh-xem { max-width: 240px; max-height: 150px; border-radius: 4px; display: block; }

/* Kết nối: đây là các bước tuần tự nên mới đánh số */
.buoc { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.buoc > span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--la-nhat); color: var(--la-dam); }
.buoc.xong > span { background: var(--la); color: #fff; }
.buoc > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chep { display: flex; gap: 8px; align-items: center; }
.chep code { flex: 1; background: var(--nen); padding: 6px 8px; border-radius: 4px; overflow-wrap: anywhere; font-size: 13px; }

/* Đăng nhập */
.man-vao { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.man-vao form { width: min(380px, 100%); background: var(--mat); border: 1px solid var(--vien); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }

dialog { border: 1px solid var(--vien); border-radius: 8px; padding: 18px; max-width: min(420px, calc(100vw - 32px)); color: var(--muc); }
dialog::backdrop { background: rgb(18 48 47 / .45); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
#bao { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 20; display: flex; flex-direction: column; gap: 6px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
#bao div { background: var(--muc); color: #fff; padding: 9px 14px; border-radius: 6px; }
#bao div.xau { background: var(--do); }
.co-gia-lap { background: var(--ho-phach); color: #fff; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 4px; margin: 0 2px 8px; }

@media (max-width: 760px) {
  .khung { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .trang { order: 1; }
  .rail { order: 2; flex-direction: row; padding: 4px; gap: 0; justify-content: space-around; }
  .rail .ten, .rail .day, .co-gia-lap, .chu-them { display: none; }
  .rail a { flex: 1; justify-content: center; padding: 8px 2px; font-size: 12px; text-align: center; gap: 3px; }
  .noi-dung { padding: 16px; }
  .hop-thu { grid-template-columns: minmax(0, 1fr); }
  .hop-thu.dang-chat .ds-hoi-thoai, .hop-thu:not(.dang-chat) .khung-chat { display: none; }
  .quay-lai { display: inline-block; }
  .luoi-2, .chi-tiet-khach { grid-template-columns: minmax(0, 1fr); }
  .so-lieu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .so-lieu div:nth-child(3) { border-left: 0; }
  .so-lieu div:nth-child(n+3) { border-top: 1px solid var(--vien); }
  .tin { max-width: 86%; }
  .dong { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: hien .12s ease-out; }
  @keyframes hien { from { opacity: 0; transform: translateY(4px); } }
}
.hang-doc { display: flex; flex-direction: column; gap: 8px; }
