/* CKU Booth — giao diện admin theo nhận diện website chamkyucptb.com:
   thanh bên/đầu trang navy chấm bi, vùng nội dung nền giấy sáng để đọc số liệu dễ,
   tiêu đề Shantell Sans, thân Mali, nút đất nung có bóng cứng, thẻ giấy bo lệch dán băng keo, nhấn vàng.
   Font lưu tại chỗ (public/fonts), không gọi CDN. */
@import url("fonts/fonts.css");
:root {
  --navy: #23395D; --navy-dam: #1a2b47; --navy2: #2f4a75; --xam-xanh: #7F98AB; --pastel: #C9D7DD; --pastel-nhat: #EEF4FA;
  --giay: #F7F3EC; --nen: #F7F3EC; --the: #ffffff; --chu: #1d2433; --mo: #5b6577; --vien: #e2d9c8;
  --dat: #C8553D;            /* đất nung — nút chính */
  --vang: #E8B04B;           /* nhấn, đang chọn */
  --xanh: #2f7d4f; --do: #b42318; --cam: #9a5b00; --hong: #F2B5A7;
  --tit: 'Shantell Sans', system-ui, sans-serif; --than: 'Mali', system-ui, sans-serif; --tay: 'Patrick Hand', cursive; --script: 'Dancing Script', cursive;
  --r: 22px 18px 24px 16px;  /* bo góc lệch như vẽ tay */
  --r-nho: 12px 10px 13px 9px;
  --bong: 3px 4px 0 var(--navy-dam);
  --cham-bi: radial-gradient(rgba(255,255,255,.09) 1.4px, transparent 1.6px) 0 0 / 22px 22px;
  --rong-ben: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--nen); color: var(--chu); font: 15px/1.5 var(--than); }
html { overflow-x: hidden; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--pastel-nhat); padding: 1px 6px; border-radius: 6px; color: var(--navy); }
.tai { padding: 40px; text-align: center; color: var(--mo); font-family: var(--tay); font-size: 20px; }

/* ---------- Khung trang: đầu trang (điện thoại) / thanh bên (máy tính) ---------- */
.dau { position: sticky; top: 0; z-index: 20; background: var(--navy) var(--cham-bi); color: #fff; border-bottom: 3px solid var(--navy-dam); }
.dau-tren { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--tit); font-weight: 800; font-size: 18px; letter-spacing: .2px; line-height: 1.1; }
.logo img { width: 40px; height: 40px; object-fit: contain; }
.logo small { display: block; font-family: var(--script); font-weight: 700; font-size: 16px; color: var(--pastel); letter-spacing: 0; }
.dau-tren .gian { flex: 1; }
.nut-mo { background: transparent; border: 2px solid rgba(255,255,255,.45); color: #fff; border-radius: var(--r-nho); padding: 5px 12px; cursor: pointer; font-family: var(--tit); font-weight: 600; font-size: 13px; }
.nut-mo:hover { border-color: var(--vang); color: var(--vang); }
.thanh-tab { display: flex; gap: 4px; overflow-x: auto; padding: 0 10px 8px; scrollbar-width: none; }
.thanh-tab::-webkit-scrollbar { display: none; }
.thanh-tab a { color: rgba(255,255,255,.85); text-decoration: none; padding: 7px 12px; white-space: nowrap; font-size: 14px; font-family: var(--tit); font-weight: 600; border-radius: var(--r-nho); border: 2px solid transparent; }
.thanh-tab a:hover { background: rgba(255,255,255,.08); }
.thanh-tab a.chon { background: var(--vang); color: var(--navy-dam); border-color: var(--navy-dam); box-shadow: 2px 3px 0 var(--navy-dam); font-weight: 800; }
main { max-width: 1200px; margin: 0 auto; padding: 18px 16px 40px; }

@media (min-width: 960px) {
  .dau { position: fixed; top: 0; bottom: 0; left: 0; width: var(--rong-ben); border-bottom: 0; border-right: 3px solid var(--navy-dam); display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 64px; }
  .dau-tren { flex-direction: column; align-items: stretch; padding: 22px 16px 12px; gap: 14px; }
  .dau-tren .gian { display: none; }
  .logo { flex-direction: column; text-align: center; font-size: 20px; }
  .logo img { width: 92px; height: 92px; }
  .dau-tren .nut-mo { position: absolute; bottom: 18px; left: 16px; right: 16px; }
  .thanh-tab { flex-direction: column; overflow: visible; padding: 8px 14px 24px; gap: 6px; flex: 1; }
  .thanh-tab a { font-size: 15px; padding: 9px 14px; }
  main { margin-left: var(--rong-ben); padding: 26px 32px 60px; }
}
@media (min-width: 1500px) { main { margin-left: calc(var(--rong-ben) + (100vw - var(--rong-ben) - 1200px) / 2); } }

/* ---------- Tiêu đề + dòng giải thích ---------- */
h1 { font-family: var(--tit); font-weight: 800; font-size: 26px; line-height: 1.2; margin: 4px 0 4px; color: var(--navy); }
h1::after { content: ""; display: block; width: 64px; height: 6px; margin-top: 6px; background: var(--vang); border-radius: 999px; transform: rotate(-2deg); }
h2 { font-family: var(--tit); font-weight: 800; font-size: 18px; margin: 24px 0 10px; color: var(--navy); }
.mo-ta-trang { margin: 6px 0 16px; padding: 8px 14px 8px 12px; background: var(--pastel-nhat); border-left: 5px solid var(--vang); border-radius: 4px 12px 12px 4px; color: var(--navy); font-size: 14.5px; }
.mo-ta-trang b { font-family: var(--tay); font-weight: 400; font-size: 18px; margin-right: 4px; }
.huong-dan { background: #FFF6DA; border: 2px dashed var(--vang); border-radius: var(--r); padding: 12px 16px; color: var(--navy-dam); font-size: 14.5px; margin: 0 0 16px; }
.huong-dan .tieu { font-family: var(--tit); font-weight: 800; font-size: 15.5px; margin-bottom: 4px; }
.huong-dan ol, .huong-dan ul { margin: 6px 0 0; padding-left: 22px; }
.huong-dan li { margin: 3px 0; }

/* ---------- Thẻ giấy + lưới ---------- */
.the { position: relative; background: var(--the); border: 2px solid var(--navy-dam); border-radius: var(--r); padding: 16px 14px 14px; box-shadow: 4px 5px 0 rgba(26,43,71,.18); }
.the::before { content: ""; position: absolute; top: -9px; left: 50%; width: 58px; height: 17px; background: rgba(201,215,221,.88); transform: translateX(-50%) rotate(-3deg); border-radius: 2px; pointer-events: none; }
.the:nth-child(even)::before { transform: translateX(-50%) rotate(4deg); background: rgba(242,181,167,.82); }
.the.nhan-nho::before { display: none; }
.luoi-so { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-top: 8px; }
.luoi-so .the { text-align: center; }
.so-lon { font-family: var(--tit); font-size: 32px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.nhan-nho { color: var(--mo); font-size: 13.5px; }
.canh-bao { background: #FFF6DA; border: 2px solid var(--vang); color: #6b4300; padding: 10px 14px; border-radius: var(--r-nho); margin-bottom: 14px; }
.loi-hop { background: #fdecea; border: 2px solid #e8a093; color: #8a1f12; padding: 10px 14px; border-radius: var(--r-nho); margin: 8px 0; }
.hang { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hang.giua { justify-content: space-between; }
.cot { display: flex; flex-direction: column; gap: 10px; }
.ds-the { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 18px; padding-top: 6px; }
.cot > .the + .the { margin-top: 6px; }

/* ---------- Nút ---------- */
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 2px solid var(--navy-dam); background: var(--dat); color: #fff; padding: 8px 16px; border-radius: var(--r-nho); cursor: pointer; min-height: 40px; text-decoration: none; font-family: var(--tit); font-weight: 800; font-size: 14.5px; box-shadow: var(--bong); transition: transform .08s, box-shadow .08s; }
.nut:hover { filter: brightness(1.05); }
.nut:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--navy-dam); }
.nut:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.nut.phu { background: #fff; color: var(--navy); box-shadow: 3px 4px 0 var(--vang); }
.nut.do { background: #fff; color: var(--do); border-color: var(--do); border-style: dashed; box-shadow: none; }
.nut.nho { padding: 4px 12px; min-height: 34px; font-size: 13.5px; box-shadow: 2px 3px 0 var(--navy-dam); }
.nut.phu.nho { box-shadow: 2px 3px 0 var(--vang); }
.nut.do.nho { box-shadow: none; }
.nut-chu { background: none; border: 0; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- Huy hiệu ---------- */
.huy { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--pastel-nhat); color: var(--navy); white-space: nowrap; border: 1px solid rgba(35,57,93,.15); }
.huy.xanh { background: #e3f4ea; color: var(--xanh); border-color: #b9dfc8; }
.huy.do { background: #fbe9e7; color: var(--do); border-color: #f0bdb4; }
.huy.vang { background: #FFF1CC; color: var(--cam); border-color: #f0d38a; }
.huy.xam { background: #eef0f3; color: #59606d; }
.cham { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #b9c1cc; margin-right: 6px; border: 1px solid rgba(0,0,0,.2); }
.cham.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }

/* ---------- Thanh tiến độ ---------- */
.tien-do { height: 12px; background: var(--pastel-nhat); border-radius: 99px; overflow: hidden; border: 2px solid var(--navy-dam); }
.tien-do > i { display: block; height: 100%; background: var(--vang); }
.tien-do.day > i { background: var(--dat); }

/* ---------- Biểu mẫu ---------- */
label.o { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--navy); font-weight: 600; }
label.o > input, label.o > select, label.o > textarea, .loc-bar select, .loc-bar input { border: 2px solid #cfd8e3; background: #fff; border-radius: 10px; padding: 8px 10px; color: var(--chu); font-size: 15px; font-weight: 400; min-height: 42px; width: 100%; min-width: 0; font-family: var(--than); }
label.o > input:focus, label.o > select:focus, label.o > textarea:focus, .loc-bar select:focus { outline: none; border-color: var(--vang); box-shadow: 0 0 0 3px rgba(232,176,75,.25); }
label.o > textarea { min-height: 70px; resize: vertical; }
.hai-cot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loc-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.cong-tac { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--vien); font-size: 14.5px; }
.cong-tac input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--dat); flex: none; }
.thanh-truot { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 8px; font-size: 14.5px; }
.thanh-truot input { width: 100%; accent-color: var(--dat); }

/* ---------- Bảng ---------- */
.bang-boc { overflow-x: auto; background: #fff; border: 2px solid var(--navy-dam); border-radius: var(--r-nho); box-shadow: 4px 5px 0 rgba(26,43,71,.14); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid #efe8db; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: var(--navy); color: #fff; font-family: var(--tit); font-weight: 600; font-size: 13px; }
tbody tr:nth-child(even) td { background: #fbf9f4; }
tbody tr:hover td { background: #FFF6DA; }
td img.nho { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: #eee; display: block; border: 1px solid var(--vien); }

/* ---------- Lưới ảnh ---------- */
.luoi-anh { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.o-anh { position: relative; aspect-ratio: 1; background: #e9e3d7; border-radius: var(--r-nho); overflow: hidden; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--vien); }
.o-anh img { width: 100%; height: 100%; object-fit: cover; display: block; }
.o-anh .nhan { position: absolute; left: 4px; bottom: 4px; }
.o-anh .tich { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid var(--navy-dam); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--navy-dam); font-weight: 800; }
.o-anh.chon { border-color: var(--vang); box-shadow: 0 0 0 2px var(--navy-dam); }
.o-anh.chon .tich { background: var(--vang); }
.o-anh .bieu-tuong { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--navy); }
.thanh-chon { position: sticky; bottom: 0; background: var(--navy) var(--cham-bi); color: #fff; padding: 10px 16px; border-radius: 22px 18px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; border: 2px solid var(--navy-dam); border-bottom: 0; }
.thanh-chon b { font-family: var(--tit); }

/* ---------- Kho khung / dáng chụp ---------- */
.the-khung { position: relative; background: #fff; border: 2px solid var(--navy-dam); border-radius: var(--r); display: flex; flex-direction: column; box-shadow: 4px 5px 0 rgba(26,43,71,.16); }
.the-khung::before { content: ""; position: absolute; top: -9px; left: 50%; width: 52px; height: 16px; background: rgba(201,215,221,.88); transform: translateX(-50%) rotate(-3deg); border-radius: 2px; z-index: 1; }
.the-khung:nth-child(even)::before { transform: translateX(-50%) rotate(4deg); background: rgba(242,181,167,.82); }
.the-khung .xem { background: repeating-conic-gradient(#e9eef3 0 25%, #fff 0 50%) 0 0/16px 16px; height: 180px; display: flex; align-items: center; justify-content: center; padding: 10px; border-radius: 20px 16px 0 0; overflow: hidden; }
.the-khung .xem img { max-height: 100%; max-width: 100%; object-fit: contain; }
.the-khung .than { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; border-top: 2px dashed var(--vien); }
.the-khung .than b { font-family: var(--tit); color: var(--navy); }
.luoi-khung { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; padding-top: 6px; }
.vung-tha { border: 3px dashed var(--xam-xanh); border-radius: var(--r); padding: 24px 16px; text-align: center; color: var(--navy); background: var(--pastel-nhat); cursor: pointer; transition: background .15s; }
.vung-tha b { font-family: var(--tit); font-size: 17px; }
.vung-tha:hover { background: #e3edf7; }
.vung-tha.tren { border-color: var(--vang); background: #FFF6DA; }
.chon-khung { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 4px; }
.chon-khung > div { border: 2px solid var(--vien); border-radius: var(--r-nho); padding: 4px; cursor: pointer; text-align: center; font-size: 11.5px; background: repeating-conic-gradient(#f1f1f1 0 25%, #fff 0 50%) 0 0/12px 12px; }
.chon-khung > div img { height: 72px; object-fit: contain; display: block; margin: 0 auto 2px; }
.chon-khung > div.chon { border-color: var(--navy-dam); background-color: #FFF6DA; box-shadow: 0 0 0 3px var(--vang); }

/* ---------- Hộp thoại ---------- */
.man { position: fixed; inset: 0; background: rgba(20,28,45,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.hop { background: var(--giay); width: 100%; max-width: 660px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 16px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); border: 3px solid var(--navy-dam); border-bottom: 0; }
@media (min-width: 700px) { .man { align-items: center; } .hop { border-radius: var(--r); border-bottom: 3px solid var(--navy-dam); box-shadow: 6px 8px 0 rgba(0,0,0,.25); padding: 22px; } }
.hop h3 { margin: 0 0 14px; color: var(--navy); font-family: var(--tit); font-weight: 800; font-size: 20px; }
.hop h2 { font-size: 16px; }
.hop .cuoi { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.xem-lon { position: fixed; inset: 0; background: rgba(15,24,40,.95); z-index: 60; display: flex; flex-direction: column; }
.xem-lon .vung { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; }
.xem-lon img, .xem-lon video { max-width: 100%; max-height: 100%; object-fit: contain; }
.xem-lon .dieu-khien { display: flex; gap: 10px; justify-content: center; padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.khoa-hien { font-family: ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 2px dashed var(--navy); padding: 10px; border-radius: 10px; word-break: break-all; font-size: 14px; color: var(--chu); font-weight: 400; }

/* ---------- Xem trước màn hình bắt đầu ---------- */
.xem-truoc { aspect-ratio: 16/10; border-radius: var(--r); overflow: hidden; position: relative; background: var(--navy) var(--cham-bi); border: 3px solid var(--navy-dam); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; text-align: center; padding: 16px; }
.xem-truoc.co-nen { background-size: cover; background-position: center; background-repeat: no-repeat; }
.xem-truoc img.lg { max-height: 26%; max-width: 50%; object-fit: contain; }
.xem-truoc .nut-bd { padding: 10px 24px; border-radius: var(--r-nho); font-family: var(--tit); font-weight: 800; color: #fff; border: 2px solid var(--navy-dam); box-shadow: 3px 4px 0 var(--navy-dam); }
.xem-truoc .loi-chao { font-family: var(--tit); font-size: 18px; font-weight: 800; }
.xem-truoc.co-nen .loi-chao { text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* ---------- Máy ---------- */
.the-may .dong { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 4px 0; border-bottom: 1px dotted #ece4d6; }
.the-may .dong span:first-child { color: var(--mo); }
.the-may .dong > :last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.the b, .the-may b { font-family: var(--tit); color: var(--navy); }

/* ---------- Đăng nhập ---------- */
.dang-nhap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px 16px; background: var(--navy) var(--cham-bi); }
.dang-nhap .logo-dn { width: 140px; height: 140px; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(0,0,0,.18)); }
.dang-nhap .the { width: 100%; max-width: 380px; padding: 26px 20px 22px; box-shadow: 6px 8px 0 rgba(0,0,0,.3); border-width: 3px; }
.dang-nhap .the::before { width: 80px; height: 22px; top: -12px; background: rgba(232,176,75,.88); }
.dang-nhap h1 { text-align: center; }
.dang-nhap h1::after { margin: 6px auto 0; }
.dang-nhap .nut { width: 100%; min-height: 50px; font-size: 17px; }
.dang-nhap .chan-dn { font-family: var(--tay); color: var(--pastel); font-size: 18px; text-align: center; }

.thong-bao { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--navy-dam); color: #fff; padding: 11px 18px; border-radius: var(--r-nho); z-index: 80; font-size: 14.5px; max-width: 90vw; border: 2px solid var(--vang); box-shadow: 3px 4px 0 rgba(0,0,0,.3); }
.an { display: none !important; }

@media (max-width: 520px) {
  main { padding: 14px 12px 40px; }
  h1 { font-size: 23px; }
  .hai-cot { grid-template-columns: 1fr; }
  .luoi-anh { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .luoi-khung { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .the-khung .xem { height: 150px; }
  .so-lon { font-size: 26px; }
  .luoi-so { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
