/* khung.css — vỏ ứng dụng: thanh điều hướng dọc (máy tính) / đáy (điện thoại), vùng màn, màn cổng (đăng nhập, lời mời…). */

body { display: flex; flex-direction: column; }
#cs-goc { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Mở đầu ---------- */
.mo-dau { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--mo); font-size: 13.5px; padding: 24px; }
.mo-dau-logo { border-radius: 15px; box-shadow: var(--bong); }

/* ---------- Vỏ ---------- */
.vo { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--ray) minmax(0, 1fr); }
.vo-than { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.man-khung { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; }
.man { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 26px 32px 48px; overscroll-behavior: contain; }
.man:not(.man-day) > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.man-day { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- Thanh dọc (máy tính, máy tính bảng) ---------- */
.ray { background: #161513; color: #b9b2a5; display: flex; flex-direction: column; min-height: 0; padding: calc(12px + env(safe-area-inset-top, 0px)) 0 10px; }
.ray-logo { display: flex; justify-content: center; margin-bottom: 10px; flex: none; }
.ray-logo img { border-radius: 11px; }
.ray-logo:focus-visible { outline-offset: 4px; border-radius: 12px; }
.ray-muc-khoi { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px 8px; scrollbar-width: none; }
.ray-muc-khoi::-webkit-scrollbar { display: none; }
.ray-muc { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 8px; border-radius: 11px; color: #b9b2a5; text-decoration: none; font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; position: relative; flex: none; transition: background-color .12s, color .12s; }
.ray-muc:hover { background: rgba(255, 255, 255, .07); color: #f3eee4; }
.ray-muc.chon { background: rgba(184, 147, 90, .18); color: #ecd3a6; }
.ray-muc.chon::before { content: ""; position: absolute; left: -8px; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; background: var(--vang); }
.ray-muc:focus-visible, .ray-toi:focus-visible, .ray-trang-thai:focus-visible { outline: 2px solid #d9b77e; outline-offset: 1px; border-radius: 11px; }
.ray-muc-hinh, .day-muc-hinh { position: relative; display: inline-flex; }
.ray-so { position: absolute; top: -7px; left: 12px; box-shadow: 0 0 0 2px #161513; }
.ray-chan { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px 0; margin-top: 6px; border-top: 1px solid rgba(255, 255, 255, .09); flex: none; }
.ray-trang-thai { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #cdebd9; background: rgba(54, 161, 102, .22); white-space: nowrap; transition: opacity .12s; }
.ray-trang-thai:hover { background: rgba(54, 161, 102, .32); }
.ray-trang-thai.tam-nghi { color: #d6cfc2; background: rgba(255, 255, 255, .1); }
.ray-trang-thai.tam-nghi:hover { background: rgba(255, 255, 255, .16); }
.ray-trang-thai.dang-doi { opacity: .5; pointer-events: none; }
.ray-tt-cham { width: 7px; height: 7px; border-radius: 50%; background: #4bc282; }
.tam-nghi .ray-tt-cham { background: #9a9386; }
.ray-toi { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 11px; width: 100%; color: #ebe5d9; }
.ray-toi:hover, .ray-toi.chon { background: rgba(255, 255, 255, .07); }
.ray-toi-ten { font-size: 11px; font-weight: 600; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.ray-toi-vai { font-size: 10px; color: #c9a871; font-weight: 600; line-height: 1.1; }
.ray .anh-dd-goc { box-shadow: 0 0 0 2px #161513; }

/* menu tài khoản + ngăn "Thêm" */
.toi-khoi { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; min-width: 240px; }
.toi-chu { min-width: 0; }
.toi-ten { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toi-dn { font-size: 12.5px; color: var(--mo); }
.toi-vai { grid-column: 1 / -1; margin-top: 10px; }
.menu-toi { width: 300px; }
.them-trang-thai { margin: 16px 0 6px; padding: 12px 14px; border: 1px solid var(--vien); border-radius: 12px; background: #fdfbf7; }
.them-trang-thai .cong-tac { display: flex; }
.them-ds { margin: 10px -20px 0; border-top: 1px solid var(--vien); }
.them-ds .ds-dong { padding: 12px 20px; min-height: 56px; }
.them-hinh { width: 38px; height: 38px; border-radius: 10px; background: var(--nen-2); color: var(--muc-2); display: flex; align-items: center; justify-content: center; flex: none; }
.them-dang-xuat { color: var(--do); border-bottom: 0; }
.them-dang-xuat .them-hinh { background: var(--do-nen); color: var(--do); }

/* ---------- Thanh đáy (điện thoại) ---------- */
.day { display: none; }
@media (max-width: 760px) {
  .vo { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ray { display: none; }
  .vo-than { padding-top: env(safe-area-inset-top, 0px); }
  .day { display: flex; background: #161513; padding: 0 4px var(--day-an-toan); height: calc(var(--day) + var(--day-an-toan)); flex: none; }
  .day-muc { flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #b0a99c; font-size: 11px; font-weight: 600; text-decoration: none; position: relative; text-align: center; }
  .day-muc-hinh { padding: 3px 16px; border-radius: 999px; transition: background-color .12s; }
  .day-muc .ray-so { left: 28px; top: -4px; }
  .day-muc.chon { color: #ecd3a6; }
  .day-muc.chon .day-muc-hinh { background: rgba(184, 147, 90, .22); }
  .day-muc:focus-visible { outline: 2px solid #d9b77e; outline-offset: -3px; border-radius: 10px; }
  .day-muc-nhan { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .vo-an-day .day { display: none; }
  .man { padding: 16px 14px 28px; }
  .man-day { padding: 0; }
  .thanh-bao { padding-left: 14px; padding-right: 4px; }
  /* chỗ bấm trên dải báo đủ 44px (chữ vẫn nhỏ như cũ) */
  .thanh-bao-nut { min-height: 44px; display: inline-flex; align-items: center; padding: 4px 8px; }
  .thanh-bao-dong { width: 44px; height: 44px; }
  /* đang mở khung chat trên điện thoại: nhường chỗ cho tin nhắn. Dải "bản thử" và dải kênh lỗi tạm ẩn (khung chat đã tự báo nếu chính kênh đó lỗi);
     dải đỏ mất kết nối thì vẫn hiện. Về danh sách là hiện lại. */
  .vo-an-day .thanh-bao-thu, .vo-an-day .thanh-bao-cam { display: none; }
}

/* ---------- Màn cổng: đăng nhập, cài đặt lần đầu, lời mời, đổi mật khẩu ---------- */
.cong { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); overflow: hidden; background: var(--nen); }
.cong-ben { background: #161513; color: #efe9dd; padding: 40px 52px 34px; display: flex; flex-direction: column; position: relative; overflow: hidden; min-height: 0; }
.cong-ben::before { content: ""; position: absolute; inset: 0; pointer-events: none; background:
    radial-gradient(circle at 104% 108%, rgba(184, 147, 90, .13) 0 150px, transparent 151px),
    radial-gradient(circle at 104% 108%, transparent 0 239px, rgba(184, 147, 90, .5) 240px 241px, transparent 242px 349px, rgba(184, 147, 90, .34) 350px 351px, transparent 352px 479px, rgba(184, 147, 90, .22) 480px 481px, transparent 482px 629px, rgba(184, 147, 90, .13) 630px 631px, transparent 632px); }
.cong-hieu { display: flex; align-items: center; gap: 12px; position: relative; }
.cong-hieu img { border-radius: 11px; flex: none; }
.cong-hieu-ten { font-weight: 700; font-size: 16px; letter-spacing: -.005em; }
.cong-hieu-phu { font-size: 10.5px; letter-spacing: .16em; color: #c9a871; font-weight: 700; margin-top: 1px; }
.cong-loi-chao { margin: auto 0; position: relative; max-width: 470px; padding: 30px 0; }
.cong-khau-hieu { font-size: clamp(28px, 3.1vw, 42px); line-height: 1.14; font-weight: 700; letter-spacing: -.028em; }
.cong-khau-hieu em { font-style: normal; color: #d9b77e; }
.cong-doan { margin-top: 16px; color: #b9b2a5; font-size: 16px; line-height: 1.55; max-width: 400px; }
.cong-ds-kenh { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cong-kenh { display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); font-size: 13px; font-weight: 600; }
.cong-chan-ben { position: relative; font-size: 12.5px; color: #8f887b; }
.cong-ban-thu { color: #e8cfa3; letter-spacing: .06em; font-weight: 700; }
.cong-chinh { overflow-y: auto; display: flex; padding: 40px 24px; min-height: 0; }
.cong-the { margin: auto; width: 100%; max-width: 400px; }
.cong-tieu-de { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.cong-mo-ta { color: var(--mo); margin-top: 6px; display: flex; flex-direction: column; gap: 12px; }
.cong-the > .bieu-mau, .cong-the > .cot, .cong-the > .cong-cho, .cong-the > .loi-moi-the { margin-top: 22px; }
.cong-loi { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--do-nen); color: #8a1c15; font-size: 13.5px; font-weight: 600; border: 1px solid #f0c2bd; line-height: 1.45; }
.cong-loi > svg { margin-top: 2px; }
.cong-loi.rung { animation: cs-rung .3s; }
@keyframes cs-rung { 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.cong-chan { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.cong-nho { font-size: 13px; color: var(--mo); text-align: center; }
.cong-lien-ket { color: var(--vang-chu); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; padding: 6px; }
.cong-khac:empty { display: none; }
.loi-moi-the { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--vien); border-radius: 14px; background: #fff; }
.loi-moi-cau { font-weight: 600; }
.loi-moi-nhom { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 900px) {
  .cong { display: flex; flex-direction: column; overflow-y: auto; }
  .cong-ben { flex: none; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 14px; overflow: visible; min-height: auto; }
  .cong-ben::before, .cong-khau-hieu, .cong-doan, .cong-chan-ben { display: none; }
  .cong-hieu img { width: 36px; height: 36px; }
  .cong-loi-chao { margin: 0; padding: 0; }
  .cong-ds-kenh { margin: 0; gap: 5px; flex-wrap: nowrap; }
  .cong-kenh { padding: 0; border: 0; background: none; }
  .cong-kenh > span:last-child { display: none; }
  .cong-chinh { overflow: visible; padding: 28px 20px 44px; flex: 1 0 auto; }
  .cong-the { margin: 0 auto; }
  .cong-tieu-de { font-size: 23px; }
}
