/* CỔNG KDI */
@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap");
:root { --nhan: #174A9C; --su-kien: #1D4ED8; --chu: #14213D; --chu-phu: #4B5873; --vien: #DCE3EF; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--chu); background: #F6F8FC; }
#nen { position: fixed; inset: 0; z-index: 0; pointer-events: none; transition: background .4s; }
#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #F5A623; outline-offset: 3px; }

.kdi-gia-lap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px clamp(16px, 3vw, 48px); background: #FEF3C7; color: #78350F; font-size: 13px; border-bottom: 1px solid #FCD34D; }
.kdi-gia-lap select { font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid #D97706; background: #fff; color: #78350F; max-width: 100%; }

.khung-trang { width: 100%; max-width: 1920px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 48px); display: flex; flex-direction: column; gap: 14px; flex: 1; position: relative; }
.kinh { background: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.95); backdrop-filter: blur(12px); }

/* Đầu trang */
.dau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 12px 0 0; }
.khoi-logo { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 18px; border-radius: 18px; background: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.95); backdrop-filter: blur(12px); box-shadow: 0 6px 18px rgba(20,33,61,.06); }
.khoi-logo img { height: 40px; width: auto; display: block; }
.vach-doc { width: 1px; height: 32px; background: #CBD3E3; }
.chuyen-trang { display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px; background: rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.chuyen-trang a { min-height: 44px; padding: 0 22px; border-radius: 999px; display: flex; align-items: center; text-decoration: none; font-size: 15px; font-weight: 700; color: var(--chu); }
.chuyen-trang a[aria-current="page"] { background: #14213D; color: #fff; }
.dau-phai { display: flex; align-items: center; gap: 10px; }
.nut-kinh { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(20,33,61,.12); background: rgba(255,255,255,.85); backdrop-filter: blur(12px); color: var(--chu); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 999px; background: var(--nhan); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 3px solid #fff; }

/* Tiêu đề */
.tieu-de { display: flex; align-items: center; gap: 24px; padding: 6px 0 4px; }
.tieu-de-trai { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tranh-khung { flex: 0 0 auto; width: clamp(260px, 22vw, 400px); padding: 12px; border-radius: 22px; background: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 18px 40px rgba(20,33,61,.14); backdrop-filter: blur(10px); }
.tranh-khung img { display: block; width: 100%; height: auto; }
body.nen-toi .chao { color: #DCE4F5; }
body.nen-toi .tieu-de h1 { color: #E0EAFF; text-shadow: 0 2px 12px rgba(10,16,38,.45); }
.su-kien { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.95); }
.sk-thang { font-family: "JetBrains Mono", monospace; font-size: 12px; letter-spacing: .1em; color: var(--su-kien); }
.su-kien strong { font-size: 14px; }
.sk-ngay { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--su-kien); color: #fff; }
.chao { margin: 0; font-size: 15px; font-weight: 600; color: var(--chu-phu); }
.tieu-de h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); font-weight: 800; line-height: 1.08; letter-spacing: -.03em; color: var(--nhan); }
.hang-tim { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: 100%; }
.o-tim { flex: 1 1 320px; max-width: 520px; display: flex; align-items: center; background: #fff; border: 1px solid var(--vien); border-radius: 16px; padding: 0 18px; min-height: 54px; box-shadow: 0 10px 28px rgba(20,33,61,.08); }
.o-tim input { flex: 1; border: 0; outline: none; font: inherit; font-size: 16px; color: var(--chu); background: transparent; min-width: 0; }
.o-tim input::placeholder { color: #6B7895; }
.seg { display: inline-flex; gap: 4px; padding: 5px; background: rgba(255,255,255,.88); border: 1px solid var(--vien); border-radius: 16px; }
.seg button { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 700; color: var(--chu); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--nhan); color: #fff; }

/* Ghim */
.vung-ds { display: flex; flex-direction: column; gap: 14px; }
.ghim { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 20px; background: rgba(255,255,255,.82); border: 1px solid rgba(255,255,255,.95); backdrop-filter: blur(14px); overflow-x: auto; }
.ghim-nhan { flex-shrink: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; padding-right: 14px; border-right: 1px solid var(--vien); white-space: nowrap; }
.ghim-the { flex-shrink: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 16px 4px 6px; border-radius: 14px; background: #fff; border: 1px solid #E4E9F2; text-decoration: none; color: var(--chu); font-size: 15px; font-weight: 600; white-space: nowrap; }
.ghim-the.khoa { opacity: .6; }
.ghim-trong { font-size: 14px; color: #5B6884; white-space: nowrap; }

/* Nhóm + thẻ */
.luoi-nhom { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.nhom { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 20px; background: rgba(255,255,255,.88); border: 1px solid rgba(255,255,255,.95); backdrop-filter: blur(10px); }
.nhom h2 { margin: 0; }
.nhom h2 button { width: 100%; min-height: 48px; padding: 0 10px; border: 0; border-radius: 14px; background: transparent; cursor: pointer; font: inherit; display: flex; align-items: center; gap: 10px; text-align: left; color: var(--chu); }
.nhom-vach { flex-shrink: 0; width: 6px; height: 22px; border-radius: 999px; }
.nhom-ten { flex: 1; font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.nhom-dem { font-family: "JetBrains Mono", monospace; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px solid var(--vien); color: #33415F; }
.nhom-mui { font-size: 14px; color: var(--chu-phu); }
.nhom-ds { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; padding: 0 4px 4px 0; scrollbar-width: thin; }
.the { position: relative; overflow: hidden; background: #fff; border: 1px solid #E4E9F2; border-radius: 18px; transition: transform .2s, box-shadow .2s; }
.the:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20,33,61,.1); }
.the-link { display: flex; align-items: center; gap: 14px; padding: 8px 58px 8px 10px; min-height: 56px; text-decoration: none; color: var(--chu); }
.the-link.khoa { cursor: default; }
.the-link.khoa .the-ten { color: #5B6884; }
.ic { flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.the-chu { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.the-ten { font-size: 16px; font-weight: 700; line-height: 1.3; }
.the-phu { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #475569; white-space: nowrap; overflow: hidden; }
.the-nguoi { overflow: hidden; text-overflow: ellipsis; }
.chip { padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.sao { position: absolute; top: 50%; right: 8px; margin-top: -22px; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sao:hover { background: #F1F4FA; }
.vach { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform: scaleX(0); transform-origin: left; transition: transform .3s; }
.the:hover .vach { transform: scaleX(1); }
body.the-nho .the-link { min-height: 48px; padding: 6px 54px 6px 8px; }
body.the-nho .ic { width: 32px; height: 32px; border-radius: 10px; }
body.the-nho .the-ten { font-size: 15px; }
.trong { text-align: center; color: var(--chu-phu); padding: 24px; }

/* Bảng tuỳ chỉnh */
.bang-tc { position: absolute; right: clamp(16px, 3vw, 48px); top: 76px; z-index: 5; width: 360px; max-width: calc(100% - 32px); padding: 18px; border-radius: 20px; background: #fff; border: 1px solid #E1E7F1; box-shadow: 0 24px 48px rgba(20,33,61,.18); display: flex; flex-direction: column; gap: 14px; }
.tc-dau { display: flex; align-items: center; justify-content: space-between; }
.nut-dong { width: 44px; height: 44px; border: 0; background: transparent; font-size: 24px; cursor: pointer; color: var(--chu-phu); }
.tc-tieu-de { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: #5B6884; text-transform: uppercase; margin-bottom: 6px; }
.tc-nut { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-nut button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 2px solid #E1E7F1; background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: var(--chu); cursor: pointer; }
.tc-nut button[aria-pressed="true"] { border-color: var(--nhan); background: var(--nhan); color: #fff; }
.bang-tc select { width: 100%; min-height: 40px; font: inherit; font-size: 14px; border: 1px solid var(--vien); border-radius: 10px; padding: 0 8px; }
.tc-ghi-chu { margin: 0; font-size: 12px; color: #5B6884; }

.chan { margin: auto 0 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 16px; font-size: 13px; color: var(--chu-phu); border-radius: 14px; background: rgba(255,255,255,.75); backdrop-filter: blur(8px); }
.mono { font-family: "JetBrains Mono", monospace; }
.khong-quyen { max-width: 640px; margin: 80px auto; padding: 0 20px; text-align: center; }
.dang-tai { padding: 80px 20px; text-align: center; color: var(--chu-phu); }

@media (max-width: 900px) { .tranh-khung { display: none; } }
@media (max-width: 640px) {
  .khoi-logo img { height: 30px; }
  .chuyen-trang { order: 3; width: 100%; justify-content: center; }
  .chuyen-trang a { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .the, .vach, #nen { transition: none; } }


/* Chấm trạng thái: chỉ dùng ở dạng ô */
.cham { display: none; }

/* ===== DẠNG Ô: icon to, chữ nhỏ bên dưới (mặc định) ===== */
body.dang-o .nhom-ds { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); max-height: 360px; }
body.dang-o .the-link { flex-direction: column; justify-content: flex-start; gap: 8px; padding: 16px 8px 12px; min-height: 128px; text-align: center; }
body.dang-o .ic { width: 60px; height: 60px; border-radius: 18px; }
body.dang-o .the-chu { align-items: center; }
body.dang-o .the-ten { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.dang-o .the-phu { display: none; }
body.dang-o .cham { display: block; position: absolute; top: 10px; left: 10px; width: 8px; height: 8px; border-radius: 999px; }
body.dang-o .sao { top: 4px; right: 4px; margin-top: 0; width: 36px; height: 36px; opacity: 0; transition: opacity .15s; }
body.dang-o .the:hover .sao, body.dang-o .sao:focus-visible, body.dang-o .sao[aria-pressed="true"] { opacity: 1; }
@media (hover: none) { body.dang-o .sao { opacity: 1; } }
body.dang-o .the-link.khoa .ic { opacity: .55; }

/* Màn hình rộng: nhóm rộng hơn để mỗi hàng chứa 3–4 ô */
@media (min-width: 1600px) { body.dang-o .luoi-nhom { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }
/* Máy tính bảng */
@media (max-width: 1024px) { .luoi-nhom { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
/* Điện thoại */
@media (max-width: 640px) {
  .luoi-nhom { grid-template-columns: 1fr; }
  body.dang-o .nhom-ds { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: none; }
  body.dang-o .the-link { min-height: 112px; padding: 14px 4px 10px; }
  body.dang-o .ic { width: 52px; height: 52px; }
  .hang-tim { gap: 8px; }
}

/* Nút thu/mở tất cả – nhỏ, kín đáo */
.hang-cong-cu { display: flex; justify-content: flex-end; margin: -6px 4px -8px; }
.nut-thu-mo { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--chu-phu); cursor: pointer; }
.nut-thu-mo:hover { background: rgba(255,255,255,.7); color: var(--chu); }
body.nen-toi .nut-thu-mo { color: #DCE4F5; }
body.nen-toi .nut-thu-mo:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Menu tài khoản */
.kdi-tk { position: relative; }
.kdi-tk-nut { width: 44px; height: 44px; border-radius: 999px; border: 3px solid #fff; background: #174A9C; color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(20,33,61,.15); }
.kdi-tk-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 240px; max-width: 320px; padding: 14px; border-radius: 16px; background: #fff; border: 1px solid #E1E7F1; box-shadow: 0 18px 40px rgba(20,33,61,.18); display: flex; flex-direction: column; gap: 4px; color: #14213D; text-align: left; }
.kdi-tk-menu[hidden] { display: none; }
.kdi-tk-ten { font-size: 15px; font-weight: 700; }
.kdi-tk-email { font-size: 13px; color: #4B5873; overflow-wrap: anywhere; }
.kdi-tk-nhom { font-size: 12px; color: #4B5873; margin-top: 2px; }
.kdi-tk-dang-xuat { margin-top: 10px; padding-top: 10px; border-top: 1px solid #E1E7F1; min-height: 36px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: #B91C1C; text-decoration: none; }
.kdi-tk-dang-xuat:hover { text-decoration: underline; }

/* ===== Hiệu ứng nền (chuyển từ mock) ===== */
#hieu-ung { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
@keyframes kdiFall { 0% { transform: translate3d(0,-80px,0) rotate(0deg) } 25% { transform: translate3d(40px,380px,0) rotate(90deg) } 50% { transform: translate3d(-10px,800px,0) rotate(180deg) } 75% { transform: translate3d(36px,1220px,0) rotate(270deg) } 100% { transform: translate3d(-20px,1680px,0) rotate(360deg) } }
@keyframes kdiRise { 0% { transform: translate3d(0,1680px,0) rotate(0deg) } 50% { transform: translate3d(-30px,800px,0) rotate(20deg) } 100% { transform: translate3d(20px,-90px,0) rotate(0deg) } }
@keyframes kdiTwinkle { 0%,100% { opacity: .15; transform: scale(.6) rotate(0deg) } 50% { opacity: 1; transform: scale(1.1) rotate(45deg) } }
@keyframes kdiShoot { 0% { transform: translateX(-160px); opacity: 0 } 4% { opacity: 1 } 14% { transform: translateX(560px); opacity: 0 } 100% { transform: translateX(560px); opacity: 0 } }
@keyframes kdiGlint { 0%,100% { transform: scale(.25) rotate(0deg); opacity: .15 } 50% { transform: scale(1) rotate(90deg); opacity: 1 } }
@keyframes kdiFly { 0% { transform: translateX(-280px) } 100% { transform: translateX(calc(100vw + 40px)) } }
@keyframes kdiFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-14px) } }
.p-fall { position: absolute; top: 0; animation-name: kdiFall; animation-timing-function: linear; animation-iteration-count: infinite; }
.p-rise { position: absolute; top: 0; animation-name: kdiRise; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.p-twinkle { position: absolute; animation-name: kdiTwinkle; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.shoot { position: absolute; left: 0; top: 0; width: 150px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(245,185,90,0), rgba(245,185,90,.95) 70%, #FFFFFF); box-shadow: 0 0 10px rgba(245,185,90,.9); opacity: 0; animation: kdiShoot 7s ease-in infinite; }
.glint { animation: kdiGlint 2.6s ease-in-out infinite; filter: drop-shadow(0 0 4px rgba(255,255,255,.95)); }
.hang-bay { position: absolute; left: 0; top: 150px; width: 100%; height: 90px; }
.flyer { position: absolute; left: 0; top: 0; animation: kdiFly 24s linear infinite; }
.floaty { animation: kdiFloat 7s ease-in-out infinite; }
@media (max-width: 640px) { .hang-bay { top: 110px; transform: scale(.7); transform-origin: left top; } }
@media (prefers-reduced-motion: reduce) { .p-fall, .p-rise, .p-twinkle, .shoot, .glint, .flyer, .floaty { animation: none; } .p-fall, .p-rise { display: none; } }
