:root {
  /* Cùng bảng màu với app khu phố */
  --chinh: #1a5fd0; --chinh-dam: #0f3f99; --chinh-nhat: #e8f0fe;
  --nen: #f2f4f8; --the: #fff; --chu: #172033; --phu: #6b7588; --vien: #e4e8ef; --vien-nhat: #eef1f5;
  --do: #e5383b; --do-nhat: #fdecec; --luc: #1e8e4e; --luc-nhat: #e3f5ea;
  --vang: #a86a00; --vang-nhat: #fff4d9; --cam: #e0670b; --cam-nhat: #ffeadb; --xam-nhat: #eef1f5;
  --bo: 14px; --bong: 0 1px 2px rgba(16, 32, 64, .05), 0 2px 10px rgba(16, 32, 64, .05);
  --menu: 236px; --tren: 56px; --cao-tab: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.5;
  color: var(--chu); background: var(--nen); -webkit-tap-highlight-color: transparent;
}
a { color: var(--chinh); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.bt { width: 18px; height: 18px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Khung ===== */
.thanh-tren {
  position: fixed; inset: 0 0 auto 0; height: var(--tren); z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; color: #fff; background: var(--chinh); box-shadow: var(--bong);
}
.thanh-tren .ten-app { font-weight: 700; font-size: 16px; line-height: 1.2; }
.thanh-tren .ten-don-vi { font-size: 12px; opacity: .85; }
.thanh-tren .gian { flex: 1; }
.thanh-tren button { color: #fff; background: transparent; border: 0; border-radius: 8px; padding: 8px; cursor: pointer; position: relative; display: flex; align-items: center; gap: 8px; font: inherit; }
.thanh-tren button:hover { background: rgba(255, 255, 255, .14); }
.thanh-tren .nut-menu { display: none; }
.nguoi-dung { text-align: right; line-height: 1.2; }
.nguoi-dung small { display: block; font-size: 12px; opacity: .85; }
.menu-trai {
  position: fixed; top: var(--tren); bottom: 0; left: 0; width: var(--menu); overflow-y: auto; background: #fff;
  border-right: 1px solid var(--vien); padding: 10px 8px 24px; z-index: 20;
}
.menu-trai { padding: 12px 0 24px; }
.menu-trai .tieu-de-nhom {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 14px 10px 16px; border: 0; background: none; font: inherit;
  font-size: 12px; font-weight: 600; line-height: 1.3; text-transform: uppercase; color: var(--phu); cursor: pointer; text-align: left;
}
.menu-trai .tieu-de-nhom:hover { background: var(--nen); color: var(--chu); }
.menu-trai .tieu-de-nhom .chu-nhom { flex: 1; }
.menu-trai .tieu-de-nhom .mui { display: inline-flex; color: #9aa3b2; transition: transform .2s; }
.menu-trai .tieu-de-nhom .mui .bt { width: 16px; height: 16px; }
.menu-trai .nhom-menu.mo > .tieu-de-nhom { color: var(--chu); }
.menu-trai .nhom-menu.mo > .tieu-de-nhom .mui { transform: rotate(90deg); }
.menu-trai .ds-muc { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.menu-trai .ds-muc > div { overflow: hidden; }
.menu-trai .nhom-menu.mo > .ds-muc { grid-template-rows: 1fr; }
.menu-trai .nhom-menu.mo > .ds-muc > div { padding-bottom: 6px; }
.menu-trai .muc-menu {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 51px; color: var(--chu); border-left: 3px solid transparent; font-size: 14px;
}
.menu-trai .muc-menu:hover { background: var(--nen); text-decoration: none; }
.menu-trai .muc-menu.chon { background: var(--chinh-nhat); color: var(--chinh-dam); border-left-color: var(--chinh); font-weight: 600; }

/* Ô biểu tượng 3D (giống app khu phố) */
.o-bt { --c1: #6aa8ff; --c2: #1a5fd0; --bong-mau: rgba(26, 95, 208, .42);
  position: relative; isolation: isolate; display: inline-grid; place-items: center; flex: none; width: 50px; height: 50px; border-radius: 16px;
  color: #fff; background: linear-gradient(155deg, var(--c1) 0%, var(--c2) 100%);
  box-shadow: 0 7px 14px -5px var(--bong-mau), 0 2px 4px -1px var(--bong-mau), inset 0 1.5px 0 rgba(255, 255, 255, .55), inset 0 -3px 5px rgba(0, 0, 0, .16);
  transition: transform .12s ease, box-shadow .12s ease; }
.o-bt::after { content: ""; position: absolute; z-index: -1; right: 6px; bottom: 5px; width: 40%; height: 40%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 70%); pointer-events: none; }
.o-bt.nho::after { display: none; }
.o-bt::before { content: ""; position: absolute; z-index: -1; left: 3px; right: 3px; top: 2px; height: 48%;
  border-radius: 13px 13px 50% 50% / 13px 13px 10px 10px; background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0)); pointer-events: none; }
.o-bt .bt { width: 52%; height: 52%; stroke-width: 2.1; filter: drop-shadow(0 1.5px 1.2px rgba(0, 0, 0, .28)); }
.o-bt.vua { width: 46px; height: 46px; border-radius: 14px; }
.o-bt.nho { width: 26px; height: 26px; border-radius: 8px; box-shadow: 0 3px 6px -3px var(--bong-mau), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 3px rgba(0, 0, 0, .15); }
.o-bt.nho::before { border-radius: 7px 7px 50% 50% / 7px 7px 5px 5px; left: 2px; right: 2px; top: 1px; }
.o-bt.nho .bt { width: 60%; height: 60%; }
.o-bt.m-xanh { --c1: #6aa8ff; --c2: #1a5fd0; --bong-mau: rgba(26, 95, 208, .42); }
.o-bt.m-luc { --c1: #5fdb98; --c2: #128245; --bong-mau: rgba(18, 130, 69, .38); }
.o-bt.m-cam { --c1: #ffbe6b; --c2: #ea620b; --bong-mau: rgba(234, 98, 11, .4); }
.o-bt.m-hong { --c1: #ff8db0; --c2: #d12a5f; --bong-mau: rgba(209, 42, 95, .38); }
.o-bt.m-tim { --c1: #b39bff; --c2: #5a35cb; --bong-mau: rgba(90, 53, 203, .4); }
.o-bt.m-ngoc { --c1: #5fe0e4; --c2: #0a8590; --bong-mau: rgba(10, 133, 144, .38); }
.o-bt.m-vang { --c1: #ffd86a; --c2: #dc9500; --bong-mau: rgba(220, 149, 0, .4); }
.o-bt.m-xam { --c1: #a9b5c8; --c2: #4b586e; --bong-mau: rgba(75, 88, 110, .38); }
.o-bt.m-do { --c1: #ff8a80; --c2: #d32f2f; --bong-mau: rgba(211, 47, 47, .38); }
.o-bt.m-cham { --c1: #7f9bff; --c2: #2b43b5; --bong-mau: rgba(43, 67, 181, .4); }

/* Chấm đỏ số tin mới (ô 3D, tab dưới) */
.cham { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--do); color: #fff;
  font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }

/* ===== Trang chủ kiểu app ===== */
.trang-chu-app { max-width: 980px; }
.dau-chu { position: relative; padding: 18px 20px 30px; color: #fff; border-radius: 24px; overflow: hidden;
  background: radial-gradient(130% 120% at 0% 0%, #4b91ff 0%, var(--chinh) 50%, var(--chinh-dam) 100%); }
.dau-chu::after { content: ""; position: absolute; right: -60px; top: -40px; width: 220px; height: 220px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .06); }
.dau-chu .hang { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.dau-chu .ten-phuong { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; opacity: .9; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dau-chu .nut-tron { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .14); flex: none; }
.dau-chu .nut-tron .bt { width: 22px; height: 22px; }
.dau-chu .nut-tron .cham { top: 2px; right: 2px; box-shadow: 0 0 0 2px var(--chinh); }
.dau-chu .chao-ten { margin-top: 18px; }
.dau-chu .chao { flex: 1; min-width: 0; }
.dau-chu .chao small { font-size: 14px; opacity: .85; }
.dau-chu .chao b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.dau-chu .vai-tro { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 12px; font-weight: 600; }
a.anh-dai-dien:hover, .dau-chu a:hover, .o-chuc-nang:hover, .nhanh a:hover, .thanh-duoi a:hover { text-decoration: none; }
.anh-dai-dien { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; font-weight: 700; font-size: 16px; flex: none; }
.anh-dai-dien.to { width: 64px; height: 64px; font-size: 22px; background: linear-gradient(145deg, #4b91ff, var(--chinh)); }
.nhanh { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 6px; margin: -18px 12px 0; }
.nhanh a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--chu); text-align: center; position: relative; min-width: 0; }
.nhanh a + a::before { content: ""; position: absolute; left: 0; top: 10%; bottom: 10%; width: 1px; background: var(--vien); }
.nhanh .o-bt { margin-bottom: 4px; }
.nhanh b { font-size: 20px; line-height: 1.1; }
.nhanh a > span:last-child { font-size: 12px; color: var(--phu); font-weight: 500; }
.tieu-de-muc { margin: 18px 2px 8px; }
.tieu-de-muc h3 { margin: 0; font-size: 16px; font-weight: 700; }
.luoi-chuc-nang { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 6px; padding: 18px 8px; margin-bottom: 0; }
.o-chuc-nang { display: flex; flex-direction: column; align-items: center; gap: 9px; color: var(--chu); text-align: center; position: relative; min-width: 0; }
.o-chuc-nang b { font-size: 12.5px; font-weight: 550; line-height: 1.25; }
.o-chuc-nang .o-bt { width: 52px; height: 52px; border-radius: 17px; }
.o-chuc-nang:hover .o-bt { transform: translateY(-2px); }
.o-chuc-nang:active .o-bt, .nhanh a:active .o-bt { transform: translateY(1px) scale(.94); }
.the-ho-so { display: flex; align-items: center; gap: 14px; }
.the-ho-so b { display: block; font-size: 18px; }

/* Thanh tab dưới – chỉ hiện trên điện thoại */
.thanh-duoi { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; align-items: stretch; height: calc(var(--cao-tab) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -1px 0 var(--vien), 0 -6px 20px rgba(16, 32, 64, .04); }
.thanh-duoi a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8a93a3; font-size: 11px; font-weight: 500; }
.thanh-duoi .o-tab { position: relative; display: grid; place-items: center; width: 52px; height: 28px; border-radius: 14px; transition: background .2s; }
.thanh-duoi .bt { width: 23px; height: 23px; }
.thanh-duoi .cham { top: -5px; right: 2px; }
.thanh-duoi a.chon { color: var(--chinh); font-weight: 650; }
.thanh-duoi a.chon .o-tab { background: var(--chinh-nhat); }
.thanh-duoi a:active .o-tab { transform: scale(.94); }
.thanh-tren .nut-lui, .thanh-tren .tieu-de-dt { display: none; }
.so-menu {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--do); color: #fff;
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.thanh-tren .so-menu { position: absolute; top: 2px; right: 0; margin: 0; }
.noi-dung { margin: var(--tren) 0 0 var(--menu); padding: 20px 24px 48px; max-width: 1400px; min-height: calc(100vh - var(--tren)); }
.nen-menu { display: none; }

/* ===== Thành phần ===== */
.dau-trang { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dau-trang .gian { flex: 1; }
.dau-trang .phu { color: var(--phu); font-size: 14px; }
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 16px; margin-bottom: 16px; }
.the.khong-dem { padding: 0; overflow: hidden; }
.nut {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--vien); background: #fff; color: var(--chu); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.nut:hover { background: var(--nen); text-decoration: none; }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; }
.nut.chinh:hover { background: var(--chinh-dam); }
.nut.nhat { background: var(--chinh-nhat); border-color: transparent; color: var(--chinh-dam); }
.nut.nguy { color: var(--do); }
.nut.nguy.dac { background: var(--do); border-color: var(--do); color: #fff; }
.nut.luc { background: var(--luc); border-color: var(--luc); color: #fff; }
.nut.nho { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.nut:disabled { opacity: .55; cursor: default; }
.nut-icon { border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--phu); display: inline-flex; }
.nut-icon:hover { background: var(--nen); color: var(--chu); }
.hang-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.huy-hieu {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--xam-nhat); color: var(--phu); white-space: nowrap;
}
.huy-hieu.vang { background: var(--vang-nhat); color: var(--vang); }
.huy-hieu.cam { background: var(--cam-nhat); color: var(--cam); }
.huy-hieu.xanh { background: var(--chinh-nhat); color: var(--chinh-dam); }
.huy-hieu.luc { background: var(--luc-nhat); color: var(--luc); }
.huy-hieu.do { background: var(--do-nhat); color: var(--do); }
.bao { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; border: 1px solid transparent; }
.bao.vang { background: var(--vang-nhat); color: #6b4000; border-color: #f3dcb0; }
.bao.do { background: var(--do-nhat); color: var(--do); border-color: #f5c6c2; }
.bao.luc { background: var(--luc-nhat); color: var(--luc); border-color: #c4e3c6; }
.bao.xanh { background: var(--chinh-nhat); color: var(--chinh-dam); border-color: #c5ddf6; }
.trong { text-align: center; color: var(--phu); padding: 36px 16px; }
.trong .bt { width: 40px; height: 40px; opacity: .45; display: block; margin: 0 auto 8px; }
.xuong { height: 14px; border-radius: 6px; margin: 10px 0; background: linear-gradient(90deg, #eceff3 25%, #f6f8fa 50%, #eceff3 75%); background-size: 200% 100%; animation: anh 1.2s infinite; }
.xuong.cao { height: 80px; }
@keyframes anh { to { background-position: -200% 0; } }
.phu { color: var(--phu); }
.nho-chu { font-size: 13px; }
.dam { font-weight: 600; }

/* ===== Bảng ===== */
.bang-cuon { overflow-x: auto; }
table.bang { width: 100%; border-collapse: collapse; font-size: 14px; }
.bang th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--phu); background: #fafbfc; padding: 9px 10px; border-bottom: 2px solid var(--vien); white-space: nowrap; }
.bang td { padding: 9px 10px; border-bottom: 1px solid var(--vien); vertical-align: top; }
.bang tr:last-child td { border-bottom: 0; }
.bang tr.bam { cursor: pointer; }
.bang tr.bam:hover td { background: #f7fafd; }
.bang .chon-o { width: 36px; }
.phan-trang { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 16px; color: var(--phu); font-size: 14px; border-top: 1px solid var(--vien); }

/* ===== Biểu mẫu ===== */
.loc { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--vien); }
.loc .o-tim { flex: 1 1 260px; }
.loc select, .loc input { min-width: 150px; width: auto; flex: 0 1 auto; }
.loc .o-tim input { width: 100%; }
.loc > div:not(.o-tim) input[type=date] { width: auto; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--chu); background: #fff; border: 1px solid var(--vien); border-radius: 6px; padding: 8px 10px; min-height: 38px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(21, 101, 192, .25); border-color: var(--chinh); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--chinh); vertical-align: -3px; }
label.nhan { display: block; font-size: 13.5px; color: var(--phu); margin-bottom: 4px; font-weight: 500; }
label.nhan .bat-buoc { color: var(--do); }
.luoi-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.luoi-form .rong { grid-column: 1 / -1; }
.luoi-form .goi-y { font-size: 12.5px; color: var(--phu); margin-top: 4px; }
.tich { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }

/* ===== Thẻ, tab ===== */
.tab { display: flex; gap: 4px; border-bottom: 1px solid var(--vien); margin-bottom: 16px; overflow-x: auto; }
.tab button {
  border: 0; background: none; font: inherit; padding: 10px 14px; color: var(--phu); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500;
}
.tab button.chon { color: var(--chinh); border-color: var(--chinh); }
.tab button .so-menu { margin-left: 6px; }
.dong-tt { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; font-size: 14.5px; }
.dong-tt dt { color: var(--phu); }
.dong-tt dd { margin: 0; word-break: break-word; }
.luoi-so { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.o-so { background: #fff; border: 1px solid var(--vien); border-radius: 12px; padding: 14px; box-shadow: var(--bong); display: flex; align-items: center; gap: 12px; color: var(--phu); transition: transform .12s, box-shadow .12s; }
a.o-so:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 30, 60, .1); }
.o-so .gia-tri { font-size: 24px; font-weight: 700; line-height: 1.15; color: var(--chu); }
.o-so .ten { color: var(--phu); font-size: 13.5px; }

.luoi-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cot-bd { display: grid; grid-template-columns: 150px 1fr 48px; gap: 8px; align-items: center; font-size: 14px; margin: 6px 0; }
.cot-bd .thanh { height: 14px; background: var(--chinh-nhat); border-radius: 7px; overflow: hidden; }
.cot-bd .thanh span { display: block; height: 100%; background: var(--chinh); border-radius: 7px; }
.bd-thang { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bd-thang .cot { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; }
.bd-thang .khoi { width: 100%; max-width: 30px; border-radius: 4px 4px 0 0; }
.bd-thang .khoi.dat { background: #66a3e0; } .bd-thang .khoi.vp { background: #e57373; border-radius: 0; }
.bd-thang .nhan-thang { font-size: 11px; color: var(--phu); }
.chu-thich { display: flex; gap: 16px; font-size: 13px; color: var(--phu); margin-top: 8px; }
.chu-thich i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }

/* Dòng thời gian lịch sử kiểm tra */
.dong-thoi-gian { position: relative; padding-left: 24px; }
.dong-thoi-gian::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--vien); }
.moc { position: relative; margin-bottom: 16px; }
.moc::before { content: ""; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--luc); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--vien); }
.moc.vp::before { background: var(--do); }
.moc .the { margin-bottom: 0; }

/* Tệp */
.ds-tep { display: flex; flex-direction: column; gap: 6px; }
.tep { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #f8fafc; border: 1px solid #e6ebf0; border-radius: 8px; font-size: 14px; }
.tep a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tep .phu { font-size: 12.5px; }
.vung-tai {
  border: 2px dashed #c4d3e3; border-radius: 10px; padding: 14px; text-align: center; color: var(--phu); cursor: pointer; background: #fbfdff; font-size: 14px;
}
.vung-tai:hover, .vung-tai.keo { border-color: var(--chinh); color: var(--chinh); }

/* Chọn người / cơ sở */
.o-chon { position: relative; }
.the-chon { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.the-chon span { background: var(--chinh-nhat); color: var(--chinh-dam); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; }
.the-chon button { border: 0; background: rgba(13, 71, 161, .1); color: inherit; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.goi-y-ds { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; background: #fff; border: 1px solid var(--vien); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); max-height: 280px; overflow-y: auto; margin-top: 4px; }
.goi-y-ds div { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.goi-y-ds div:hover, .goi-y-ds div.chon { background: var(--chinh-nhat); }
.goi-y-ds small { color: var(--phu); display: block; }

/* Lượt kiểm tra trong việc */
.luot { border: 1px solid var(--vien); border-radius: var(--bo); margin-bottom: 12px; background: #fff; }
.luot .dau { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.luot .than { border-top: 1px solid var(--vien); padding: 14px; }
.trao-doi .tin { padding: 10px 12px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; }
.trao-doi .tin.toi { background: var(--chinh-nhat); }

/* Phân quyền */
.bang-pq th, .bang-pq td { text-align: center; }
.bang-pq th:first-child, .bang-pq td:first-child { text-align: left; position: sticky; left: 0; background: inherit; }
.bang-pq tr.dm td { background: #f4f7fb; font-weight: 600; cursor: pointer; }
.bang-pq tr.dm td:first-child::before { content: "▸ "; color: var(--phu); }
.bang-pq tr.dm.mo td:first-child::before { content: "▾ "; }
.bang-pq td { background: #fff; }

/* ===== Hộp thoại, toast ===== */
.hop-nen { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.hop { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.hop.rong { width: min(820px, 100%); }
.hop .dau-hop { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--vien); gap: 8px; }
.hop .dau-hop h2 { margin: 0; flex: 1; }
.hop .than-hop { padding: 18px; overflow-y: auto; }
.hop .chan-hop { padding: 12px 18px; border-top: 1px solid var(--vien); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toast-khung { position: fixed; top: 68px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2933; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); font-size: 14.5px; max-width: 380px; animation: hien .2s; }
.toast.loi { background: var(--do); }
.toast.tot { background: var(--luc); }
@keyframes hien { from { opacity: 0; transform: translateY(-6px); } }

/* ===== Đăng nhập ===== */
/* Giống màn chào app khu phố: nền xanh chuyển sắc nửa trên, thẻ đăng nhập nổi */
.man-chao { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: calc(56px + env(safe-area-inset-top)) 20px 28px;
  background: radial-gradient(120% 60% at 20% 0%, #4b91ff 0%, var(--chinh) 45%, var(--chinh-dam) 100%) top / 100% 46% no-repeat, var(--nen); }
.man-chao .logo { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 22px; background: #fff; color: var(--chinh); box-shadow: 0 10px 30px rgba(0, 20, 70, .3); }
.man-chao .logo .bt { width: 46px; height: 46px; stroke-width: 1.8; }
.man-chao h1 { color: #fff; margin: 16px 0 2px; font-size: 26px; font-weight: 700; text-align: center; }
.man-chao > p { color: rgba(255, 255, 255, .85); margin: 0 0 22px; text-align: center; }
.khung-dn { background: #fff; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; border-radius: 22px; box-shadow: 0 10px 40px rgba(16, 32, 64, .12); }
.khung-dn h2 { margin: 0; font-size: 19px; }
.khung-dn .bao { margin: 0; }
.khung-dn input[type=tel], .khung-dn input[type=password] { min-height: 48px; padding: 12px 14px; border-radius: 12px; font-size: 16px; background: #f8f9fc; }
.khung-dn .nut { width: 100%; min-height: 50px; font-size: 16px; border-radius: 14px; }

/* ===== Điện thoại ===== */
@media (max-width: 900px) {
  /* Kiểu app điện thoại (giống app khu phố): thanh trên trắng mờ có nút quay lại + tên trang, tab dưới thay menu trái */
  .thanh-tren { height: calc(var(--tren) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 4px; gap: 4px; color: var(--chu); box-shadow: none;
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid transparent; transition: border-color .2s; }
  .thanh-tren.co-vien { border-bottom-color: var(--vien); }
  .thanh-tren button { color: var(--chu); }
  .thanh-tren button:hover { background: none; }
  .thanh-tren .nut-menu, .thanh-tren .ten-khung, .thanh-tren .gian, .thanh-tren .nguoi-dung, .thanh-tren .nut-chuong, .thanh-tren .nut-ra { display: none; }
  .thanh-tren .nut-lui { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; padding: 0; flex: none; }
  .thanh-tren .nut-lui:active { background: var(--vien-nhat); }
  .thanh-tren .nut-lui .bt { width: 24px; height: 24px; }
  .thanh-tren .tieu-de-dt { display: block; flex: 1; min-width: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.trang-goc .thanh-tren { padding-left: 16px; }
  body.trang-goc .thanh-tren .nut-lui { display: none; }
  body.trang-chu .thanh-tren { display: none; }
  .menu-trai, .nen-menu { display: none !important; }
  .thanh-duoi { display: flex; }
  .noi-dung { margin: calc(var(--tren) + env(safe-area-inset-top)) 0 0; padding: 14px 16px calc(var(--cao-tab) + 28px + env(safe-area-inset-bottom)); min-height: 0; }
  body.trang-chu .noi-dung { margin-top: 0; padding-top: 0; }
  .dau-trang h1 { display: none; }
  .dau-trang:not(:has(.phu)):not(:has(.hang-nut > *)) { display: none; }
  .dau-chu { margin: 0 -16px; padding: calc(14px + env(safe-area-inset-top)) 16px 30px; border-radius: 0 0 28px 28px; }
  .nhanh { margin: -18px 0 0; }
  .luoi-chuc-nang { grid-template-columns: repeat(4, 1fr); gap: 16px 6px; padding: 16px 8px; }
  .o-chuc-nang b { font-size: 12px; }
  .the { border-color: transparent; border-radius: 16px; }
  .nut { border-radius: 12px; min-height: 42px; }
  input, select, textarea { min-height: 46px; border-radius: 12px; background: #f8f9fc; }
  .luot .dau > div:first-child { flex: 1 1 100%; }
  .luoi-form, .luoi-2 { grid-template-columns: 1fr; }
  .dong-tt { grid-template-columns: 1fr; gap: 0 0; }
  .dong-tt dd { margin-bottom: 8px; }
  h1 { font-size: 19px; }
  .loc > * { flex: 1 1 100%; }
  .loc select, .loc input { min-width: 0; width: 100%; }
  input, select, textarea { font-size: 16px; } /* iPhone không tự phóng to */
  /* Bảng thành thẻ */
  table.bang.the-dt thead { display: none; }
  table.bang.the-dt, .bang.the-dt tbody, .bang.the-dt tr, .bang.the-dt td { display: block; width: 100%; }
  .bang.the-dt tr { padding: 10px 14px; border-bottom: 1px solid var(--vien); }
  .bang.the-dt td { border: 0; padding: 2px 0; }
  .bang.the-dt td[data-nhan]::before { content: attr(data-nhan) ": "; color: var(--phu); font-size: 13px; }
  .bang.the-dt td.chon-o { width: auto; }
  .cot-bd { grid-template-columns: 110px 1fr 40px; }
  .hop-nen { align-items: flex-end; padding: 0; }
  .hop { border-radius: 16px 16px 0 0; max-height: 92vh; }
  .toast-khung { left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Khuôn mặt / vân tay */
.khung-dn .hoac { display: flex; align-items: center; gap: 10px; color: var(--phu); font-size: 13px; }
.khung-dn .hoac::before, .khung-dn .hoac::after { content: ""; flex: 1; height: 1px; background: var(--vien); }
.khung-dn .nut-khuon-mat { background: #fff; color: var(--chu); border-color: var(--vien); }
.khung-dn .nut-khuon-mat .bt { width: 22px; height: 22px; color: var(--chinh); }
.ds-khoa { display: flex; flex-direction: column; margin: 8px 0 12px; }
.dong-khoa { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--vien-nhat); }
.dong-khoa:last-child { border-bottom: 0; }

/* Nút gạt bật/tắt (giống app khu phố) */
.cong-tac { position: relative; flex: none; width: 50px; height: 30px; border-radius: 15px; background: #d5dae2; border: 0; cursor: pointer; transition: background .2s; padding: 0; }
.cong-tac::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.cong-tac.bat { background: var(--luc); }
.cong-tac.bat::after { transform: translateX(20px); }
.cong-tac:disabled { opacity: .5; cursor: default; }
.dong-cong-tac { display: flex; align-items: center; gap: 12px; }
.dong-cong-tac .o-bt.vua { width: 40px; height: 40px; border-radius: 12px; }
.dong-cong-tac .giua-dong { flex: 1; min-width: 0; }

/* Ô tìm kiếm có nút Tìm */
.o-tim { display: flex; gap: 8px; align-items: stretch; }
.o-tim input { flex: 1; min-width: 0; }
.o-tim .nut-tim { flex: none; }
@media (max-width: 480px) { .o-tim .nut-tim span { display: none; } .o-tim .nut-tim { padding: 8px 12px; } }

/* Chuyển đăng nhập ⇄ đăng ký */
.man-chao .chuyen-dn { margin: 18px 0 0; color: var(--phu); font-size: 14.5px; }
.man-chao .chuyen-dn a { font-weight: 600; }
.khung-dn .luoi-form { grid-template-columns: 1fr; }
