/* ============================================================================
   KC — TÀI KHOẢN · PHÂN QUYỀN (0.9.6): màn đăng nhập, chân thanh bên, dải «Chỉ xem»,
   màn #/tai-khoan (danh sách · hộp tài khoản · bảng quyền · mẫu quyền · nhật ký).
   Dùng lại hệ màu / thẻ / nút của app.css.
   ========================================================================== */

/* ---------- ô nhập có biểu tượng (đăng nhập, đổi mật khẩu) ---------- */
.tk-o { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.tk-o > span { font-size: 12.5px; font-weight: 600; color: var(--chu-2); }
.tk-nhap { position: relative; display: flex; align-items: center; }
.tk-nhap > .ic { position: absolute; left: 12px; color: var(--mo); pointer-events: none; }
.tk-nhap input { width: 100%; height: 42px; padding: 0 42px 0 38px; border: 1px solid var(--vien-2); border-radius: 10px; background: var(--mat); font-size: 14.5px;
  transition: border-color .12s, box-shadow .12s; }
.tk-nhap input:focus { outline: none; border-color: var(--chinh); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.tk-mat { position: absolute; right: 5px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--nhat); cursor: pointer; display: grid; place-items: center; }
.tk-mat:hover { background: #eef2f7; color: var(--chu); }
.tk-mat:focus-visible { outline: 3px solid rgba(37,99,235,.3); }
.hop .tk-nhap input { height: 38px; font-size: 13.5px; }
.tk-loi { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; margin-bottom: 14px; border: 1px solid #f5c2bf; border-radius: 10px; background: var(--do-nhat); color: #8f1d1d; font-size: 13px; line-height: 1.45; }
.tk-loi .ic { margin-top: 1px; }
.tk-loi.rung { animation: tk-rung .28s ease; }
@keyframes tk-rung { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tk-hai { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 12px; }
.tk-tich { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--chu); cursor: pointer; }
.tk-tich input { width: 16px; height: 16px; accent-color: var(--chinh); }

/* ---------- màn đăng nhập toàn trang ---------- */
body.dn-mo { overflow: hidden; }
/* KHÔNG hiệu ứng hiện dần: màn đăng nhập phải che kín app ngay từ khung hình đầu (hiệu ứng bị trình duyệt tạm dừng ở tab nền thì app phía sau lộ qua lớp mờ) */
.dn { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-columns: minmax(380px, 44%) minmax(0, 1fr); background: var(--nen); overflow: auto; }
.dn-trai { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 24px; padding: 40px 48px; color: #c8d4e6;
  background: radial-gradient(900px 520px at -8% -12%, rgba(59,130,246,.55) 0%, transparent 60%), radial-gradient(700px 480px at 115% 110%, rgba(30,64,175,.6) 0%, transparent 60%), linear-gradient(160deg, #0f2440 0%, #0a1a31 100%); }
.dn-trai::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.dn-trai > * { position: relative; }
.dn-hieu { display: flex; align-items: center; gap: 13px; color: #fff; }
.dn-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #3b82f6, #1e40af); color: #fff; font-weight: 800; font-size: 17px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 6px 18px rgba(0,0,0,.25); flex: none; }
.dn-logo.anh { width: auto; max-width: 130px; object-fit: contain; background: #fff; padding: 4px 8px; }
.dn-ten { display: flex; flex-direction: column; line-height: 1.25; }
.dn-ten b { font-size: 18px; letter-spacing: .07em; }
.dn-ten small { font-size: 12.5px; color: #9fb3d1; }
.dn-gioi-thieu { margin: auto 0; max-width: 470px; }
.dn-gioi-thieu h2 { font-size: 31px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: #fff; margin: 0 0 14px; }
.dn-gioi-thieu p { font-size: 14.5px; line-height: 1.6; color: #b4c4dd; margin: 0 0 22px; }
.dn-gioi-thieu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.dn-gioi-thieu li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: #d4e0f2; }
.dn-gioi-thieu li .ic { width: 17px; height: 17px; padding: 8px; box-sizing: content-box; border-radius: 10px; background: rgba(255,255,255,.08); color: #8ab8ff; }
.dn-chan { font-size: 11.5px; letter-spacing: .1em; color: #6f86a6; }
.dn-phai { display: grid; place-items: center; padding: 32px 20px; min-width: 0; }
.dn-the { width: min(410px, 100%); padding: 32px 30px 26px; background: var(--mat); border: 1px solid var(--vien); border-radius: 16px; box-shadow: 0 18px 50px rgba(15,27,45,.12), var(--bong); }
.dn-the h1 { font-size: 23px; margin-bottom: 6px; }
.dn-phu { margin: 0 0 18px; color: var(--nhat); font-size: 13.5px; line-height: 1.5; }
.dn-hieu.nho { display: none; margin-bottom: 22px; color: var(--chu); }
.dn-hieu.nho .dn-ten small { color: var(--nhat); }
.dn-hieu.nho .dn-logo.anh { box-shadow: 0 0 0 1px var(--vien); }
.dn-caps { display: flex; align-items: center; gap: 6px; margin: -6px 0 10px; color: var(--vang); font-size: 12.5px; font-weight: 500; }
.dn-nut { width: 100%; height: 44px; justify-content: center; margin-top: 4px; border-radius: 10px; font-size: 14.5px; font-weight: 600; }
.dn-nut-phu { width: 100%; height: 36px; justify-content: center; margin-top: 8px; color: var(--nhat); }
.dn-ghi { margin-top: 16px; text-align: center; color: var(--nhat); font-size: 12.5px; line-height: 1.5; }

/* ---------- chân thanh bên: người đang đăng nhập ---------- */
.tk-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: #e2e8f0; color: #334155; }
.tk-avatar.tim { background: var(--tim-nhat); color: var(--tim); }
.tk-avatar.lam { background: var(--chinh-nhat); color: var(--chinh); }
.tk-avatar.ngoc { background: var(--lam-nhat); color: var(--lam); }
.tk-avatar.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.tk-avatar.lon { width: 46px; height: 46px; font-size: 16px; }
.tk-toi { display: flex; align-items: center; gap: 2px; margin: 0 -4px 8px; padding: 6px 6px 6px 7px; border-radius: 10px; background: rgba(255,255,255,.07); }
.tk-toi-ten { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: none; color: #fff; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.tk-toi-ten:focus-visible, .tk-nut-nho:focus-visible, .tk-moi:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.tk-ten { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.tk-ten b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-ten small { font-size: 11px; color: var(--sb-chu); white-space: nowrap; }
.tk-nut-nho { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--sb-chu); cursor: pointer; }
.tk-nut-nho:hover { background: rgba(255,255,255,.13); color: #fff; }
.tk-nut-nho .ic { width: 15px; height: 15px; }
.tk-moi { display: flex; align-items: center; gap: 8px; width: calc(100% + 8px); margin: 0 -4px 8px; padding: 7px 9px; border: 1px dashed rgba(255,255,255,.3); border-radius: 9px; background: rgba(255,255,255,.05);
  color: #dbe6f7; font: inherit; font-size: 12px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; }
.tk-moi:hover { background: rgba(255,255,255,.11); color: #fff; border-color: rgba(255,255,255,.5); }
.tk-moi .ic { color: #8ab8ff; }

/* thanh bên (màn rộng): menu dài hơn chiều cao cửa sổ thì CUỘN trong thanh bên — chân thanh bên (người đang đăng nhập · đổi mật khẩu ·
   đăng xuất) và mục «Tài khoản» cuối menu luôn với tới được, kể cả ở màn 1366×768 */
@media (min-width: 861px) {
  .sb-nav { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; margin: 0 -6px; padding: 0 6px 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
  .sb-nav::-webkit-scrollbar { width: 6px; }
  .sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 99px; }
  .sb-nav > * { flex: none; }
  .sb-chan { flex: none; margin-top: 10px; }
}

/* ---------- dải «Chỉ xem» · trang «không có quyền» ---------- */
#dai-quyen { display: flex; align-items: center; gap: 10px; margin: 12px 18px 0 calc(var(--sb-rong) + 18px); padding: 8px 12px; max-width: 1404px;
  border: 1px solid #bfd3f7; border-radius: var(--bo); background: var(--chinh-nhat); color: #1e3a8a; font-size: 13px; line-height: 1.45; }
#dai-quyen .ic { color: var(--chinh); }
.tk-cam .trong { padding: 56px 16px; }
.tk-cam .bieu-lon { background: var(--vang-nhat); color: var(--vang); }
.tk-cam .trong > div { max-width: 560px; margin: 0 auto; line-height: 1.6; }

/* ---------- hộp ---------- */
.hop.tk-hop-nho { width: min(440px, 100%); }
.hop.tk-hop-vua { width: min(660px, 100%); }
.hop.tk-hop-rong { width: min(1100px, 100%); }
.tk-h3 { margin: 18px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--nhat); }
.tk-hs-dau { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tk-hs-dau > div { flex: 1; min-width: 0; }
.tk-hs-dau b { font-size: 15px; color: var(--chu); }
.tk-ds-quyen { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-q { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: var(--nhat); }
.tk-q b { font-weight: 500; color: var(--chu-2); }
.tk-q.m1 { background: var(--chinh-nhat); color: var(--chinh); }
.tk-q.m2 { background: var(--xanh-nhat); color: var(--xanh); }
.tk-q.m3 { background: var(--do-nhat); color: var(--do); }
.tk-q.m0 b { color: var(--mo); }
.tk-ds-phien { display: grid; gap: 6px; }
.tk-phien { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border: 1px solid var(--vien); border-radius: var(--bo-nho); }
.tk-phien > .ic { margin-top: 2px; color: var(--nhat); }
.tk-phien b { font-weight: 600; color: var(--chu); }
.tk-mk-tam { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--chinh); border-radius: 10px; background: var(--chinh-nhat); }
.tk-mk-tam code { flex: 1; min-width: 0; font-family: "JetBrains Mono", Consolas, "Cascadia Mono", monospace; font-size: 20px; font-weight: 700; letter-spacing: .08em; color: var(--chu); user-select: all; word-break: break-all; }

/* ---------- màn #/tai-khoan ---------- */
#tk-tab { margin-bottom: 12px; }
#tk-tab button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; }
#tk-tab button .ic { width: 14px; height: 14px; }
.tk-chon { width: auto; min-width: 130px; height: 32px; }
.tk-ngay { display: inline-flex; align-items: center; gap: 6px; color: var(--nhat); font-size: 12.5px; white-space: nowrap; }
.tk-ngay input { width: 138px; height: 32px; }
.tk-o-ten { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.tk-o-ten b { color: var(--chu); }
.tk-bang td, .tk-nk td { padding-top: 7px; padding-bottom: 7px; }
.tk-cap { font-weight: 600; }
.tk-cham { display: inline-flex; gap: 2px; vertical-align: middle; }
.tk-cham i { display: block; width: 9px; height: 15px; border-radius: 3px; background: #e2e8f0; }
.tk-cham i.m1 { background: #93c5fd; }
.tk-cham i.m2 { background: #22a55b; }
.tk-cham i.m3 { background: #c62828; }
.tk-chu-thich { margin: -4px 2px 14px; font-size: 12px; line-height: 1.8; color: var(--nhat); }
.tk-chu-thich .tk-cham { margin: 0 3px 0 8px; }
.tk-chu-thich .tk-cham:first-child { margin-left: 0; }
.tk-nk-luc { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tk-nk-dt { font-weight: 500; word-break: break-word; }
.tk-nk-ct { color: var(--chu-2); font-size: 12.5px; word-break: break-word; max-width: 520px; }
.tk-nk .chi-nho { display: none; font-weight: 400; }
.tk-nk-them { display: flex; justify-content: center; padding: 10px; border-top: 1px solid var(--vien); }

/* ---------- hộp tài khoản: thông tin + cấp | bảng quyền ---------- */
.tk-hai-cot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 26px; align-items: start; }
.tk-ds-cap { display: grid; gap: 6px; margin-top: 8px; }
.tk-o-cap { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--vien-2); border-radius: 10px; background: var(--mat); cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; }
.tk-o-cap:hover { border-color: #9fb0c6; }
.tk-o-cap input { position: absolute; opacity: 0; pointer-events: none; }
.tk-o-cap.on { border-color: var(--chinh); background: var(--chinh-nhat); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.tk-o-cap:focus-within { box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.tk-o-cap.tat { opacity: .48; cursor: not-allowed; }
.tk-o-cap b { display: block; color: var(--chu); }
.tk-o-cap small { display: block; margin-top: 1px; font-size: 12px; line-height: 1.4; color: var(--nhat); }
.tk-ghi { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 8px 10px; border-radius: var(--bo-nho); background: var(--mat-2); font-size: 12.5px; line-height: 1.5; color: var(--chu-2); }
.tk-ghi .ic { margin-top: 2px; color: var(--nhat); }
.tk-bq-dau { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tk-bq-dau h3 { flex: 1; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--nhat); }
.tk-bq { display: grid; gap: 3px; }
.tk-bq-nhom { margin-top: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mo); }
.tk-bq-nhom:first-child { margin-top: 0; }
.tk-bq-dong { display: grid; grid-template-columns: minmax(120px, 1fr) auto; align-items: center; gap: 10px; padding: 2px 0; }
.tk-bq-ten { font-weight: 500; color: var(--chu); }
.tk-bq-muc { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: #eef2f7; }
.tk-bq-muc button { border: 0; border-radius: 7px; padding: 4px 10px; background: transparent; color: var(--nhat); font: inherit; font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .1s, color .1s; }
.tk-bq-muc button:hover:not(:disabled):not(.on) { color: var(--chu); background: rgba(255,255,255,.7); }
.tk-bq-muc button:focus-visible { outline: 3px solid rgba(37,99,235,.3); }
.tk-bq-muc button.on { font-weight: 600; box-shadow: var(--bong); }
.tk-bq-muc button.m0.on { background: var(--mat); color: var(--chu-2); }
.tk-bq-muc button.m1.on { background: var(--chinh); color: #fff; }
.tk-bq-muc button.m2.on { background: var(--xanh); color: #fff; }
.tk-bq-muc button.m3.on { background: var(--do); color: #fff; }
.tk-bq-muc button:disabled { opacity: .32; cursor: not-allowed; }
.tk-bq-muc button:disabled.on { opacity: 1; }
.tk-bq-muc.nho button { padding: 3px 8px; font-size: 12px; }
.tk-bq-du { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border: 1px dashed var(--vien-2); border-radius: var(--bo); background: var(--mat-2); color: var(--chu-2); line-height: 1.5; }
.tk-bq-du .ic { width: 26px; height: 26px; color: var(--tim); }
.tk-bq-chu { margin-top: 12px; line-height: 1.6; }
.tk-mau td { vertical-align: middle; }
.tk-mau-nhom td { background: var(--mat-2); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nhat); padding-top: 6px; padding-bottom: 6px; }

@media (max-width: 1180px) {
  .an-nho { display: none; }
  .tk-nk .chi-nho { display: block; }
}
@media (max-width: 940px) {
  .tk-hai-cot { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 860px) {
  .dn { grid-template-columns: 1fr; }
  .dn-trai { display: none; }
  .dn-hieu.nho { display: flex; }
  .dn-phai { padding: 24px 16px; align-items: start; padding-top: max(24px, 9vh); }
  #dai-quyen { margin: 12px 14px 0; }
  /* thanh trên (màn hẹp): chân thanh bên chỉ còn ảnh đại diện — bấm mở «Hồ sơ của tôi» (có Đổi mật khẩu · Đăng xuất) */
  .sb .sb-chan.co-tk { display: flex; order: 3; margin: 0 0 0 auto; padding: 0; }
  .sb .sb-chan.co-tk > div:not(.tk-toi), .sb .sb-chan.co-tk .tk-moi, .sb .tk-toi .tk-ten, .sb .tk-toi .tk-nut-nho { display: none; }
  .sb .tk-toi { margin: 0; padding: 3px; background: transparent; }
  .an-vua { display: none; }
  .tk-chon { flex: 1 1 130px; }
}
@media (max-width: 560px) {
  .dn-the { padding: 26px 20px 22px; border-radius: 14px; }
  .dn-the h1 { font-size: 21px; }
  .tk-hai { grid-template-columns: 1fr; }
  .tk-bq-dong { grid-template-columns: 1fr; gap: 3px; padding: 4px 0; }
  .tk-bq-muc { display: flex; }
  .tk-bq-muc button { flex: 1; padding: 6px 4px; }
  .tk-mk-tam { flex-direction: column; align-items: stretch; text-align: center; }
  .tk-mk-tam code { font-size: 18px; }
  .che.tk-che { padding: 10px; }
  .tk-che .hop { max-height: calc(100vh - 20px); }
  .tk-che .hop-than { padding: 14px; }
  .tk-che .hop-chan { padding: 10px 14px; }
  .tk-che .hop-chan .nut { flex: 1 1 auto; justify-content: center; }
  .tk-o-ten { min-width: 150px; }
}
