:root {
  --do: #a3123a; --do-dam: #7f0c2c; --do-nhat: #fbeaef; --nen: #f5f4f2; --giay: #fff; --chu: #24211f; --mo: #6d6661; --ke: #e0dcd7; --ke-dam: #cbc5be;
  --xam: #f0eeeb; --le: #f3b9c6; --xanh: #14734a; --xanh-nhat: #e2f2ea; --vang: #8a5a00; --vang-nhat: #fdf1d8; --loi: #c01530; --lam: #1f5f99;
  --f: "Be Vietnam Pro", system-ui, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 13.5px/1.45 var(--f); color: var(--chu); background: var(--nen); display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--do); }
[hidden] { display: none !important; }
.an-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 2px solid var(--lam); outline-offset: 1px; }
h1 { font-size: 17px; font-weight: 600; margin: 0; }
h2 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.mo { color: var(--mo); } .loi { color: var(--loi); }

/* đầu trang */
.dau { position: relative; z-index: 40; display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 14px; background: var(--do); color: #fff; flex: none; }
.logo { display: inline-flex; align-items: baseline; gap: 5px; text-decoration: none; color: #fff; font-size: 19px; letter-spacing: -.01em; width: 190px; padding-left: 6px; }
.logo b { font-weight: 700; } .logo span { font-weight: 400; }
.logo.lon { color: var(--do); font-size: 34px; width: auto; padding: 0; }
.tim { flex: 1; max-width: 460px; }
.tim input { width: 100%; height: 34px; border: 0; border-radius: 4px; padding: 0 12px; background: #fff; color: var(--chu); }
.dau-phai { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nut-dau { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 4px; color: #fff; cursor: pointer; }
.nut-dau:hover, .nut-dau[aria-expanded=true], .nguoi:hover { background: var(--do-dam); }
#mo-menu { display: none; }
.nguoi { border: 0; background: none; color: #fff; height: 40px; padding: 0 10px; border-radius: 4px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.noi { position: absolute; right: 12px; top: 54px; background: var(--giay); color: var(--chu); border: 1px solid var(--ke); box-shadow: 0 10px 30px rgb(40 10 20 / .18); padding: 18px 20px; display: flex; gap: 26px; max-width: calc(100vw - 24px); max-height: calc(100vh - 70px); overflow: auto; }
.noi.nho { display: block; min-width: 230px; padding: 14px 16px; }
.noi h3 { margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: var(--mo); }
.o-ud { display: grid; grid-template-columns: repeat(2, 92px); gap: 6px; }
.o-ud a { display: grid; justify-items: center; gap: 6px; padding: 12px 4px; text-align: center; text-decoration: none; color: var(--chu); font-size: 12px; border-radius: 6px; }
.o-ud a:hover { background: var(--do-nhat); } .o-ud svg { width: 30px; height: 30px; color: var(--do); }

/* thân */
.chi-dt { display: none !important; }
.than { flex: 1; display: flex; min-height: 0; }
.menu { width: 222px; flex: none; overflow: auto; background: var(--giay); border-right: 1px solid var(--ke); padding: 10px 0 30px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 7px 16px; text-decoration: none; color: var(--chu); }
.menu a svg { width: 18px; height: 18px; color: var(--mo); flex: none; }
.menu a:hover { background: var(--xam); }
.menu a.dang, .menu a.dang svg { color: var(--do); font-weight: 600; }
.menu .con a { padding-left: 44px; position: relative; }
.menu .con a.dang::before { content: ""; position: absolute; left: 27px; top: 5px; bottom: 5px; width: 3px; background: var(--do); }
.menu .nhom { display: flex; align-items: center; gap: 10px; padding: 12px 16px 5px; font-weight: 600; }
.menu .nhom svg { width: 18px; height: 18px; color: var(--do); }
.chinh { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: auto; outline: 0; }
.thanh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 16px; background: var(--giay); border-bottom: 1px solid var(--ke); position: sticky; left: 0; flex: none; }
.thanh h1 { color: var(--do); margin-right: auto; }
.trong { padding: 16px; }

/* nút, ô nhập */
.nut { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ke-dam); background: var(--giay); border-radius: 4px; cursor: pointer; white-space: nowrap; }
.nut:hover { border-color: var(--do); color: var(--do); } .nut svg { width: 16px; height: 16px; }
.nut.chinh-nut { background: var(--do); border-color: var(--do); color: #fff; font-weight: 500; } .nut.chinh-nut:hover { background: var(--do-dam); color: #fff; }
.nut.nguy { color: var(--loi); } .nut:disabled { opacity: .5; cursor: default; }
input:not([type=checkbox]):not([type=radio]), select, textarea { border: 1px solid var(--ke-dam); border-radius: 4px; padding: 5px 9px; background: #fff; min-height: 32px; }
textarea { width: 100%; min-height: 62px; resize: vertical; }
.o { display: grid; gap: 4px; } .o > span { font-size: 12.5px; color: var(--mo); }
.luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; } .luoi .rong { grid-column: 1 / -1; }
.hang { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .cuoi { justify-content: flex-end; margin-top: 16px; }

/* bảng */
.vung { flex: 1; overflow: auto; background: var(--giay); min-height: 160px; }
table.b { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; font-variant-numeric: tabular-nums; }
table.b th, table.b td { border-right: 1px solid var(--ke); border-bottom: 1px solid var(--ke); padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
table.b thead th { position: sticky; top: 0; z-index: 3; background: var(--giay); font-weight: 600; border-bottom-color: var(--ke-dam); user-select: none; }
table.b thead tr:nth-child(2) th { top: 33px; }
table.b th.sx { cursor: pointer; } table.b th.sx:hover { color: var(--do); }
table.b .so { text-align: right; } table.b .giua { text-align: center; }
table.b tbody tr:hover td { background: #faf6f4; }
table.b td.xuong { white-space: normal; }
table.b .keo { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 1; touch-action: none; }
table.b .keo:hover, table.b .keo.dang { background: var(--do); opacity: .5; }
table.b .ghim { position: sticky; z-index: 2; background: var(--giay); } table.b thead .ghim { z-index: 5; }
table.b td.nghi, table.b th.nghi { background: var(--xam); } table.b td.le, table.b th.le { background: var(--le); }
table.b td.o-cong { text-align: center; cursor: pointer; padding: 6px 2px; } table.b td.o-cong:hover { box-shadow: inset 0 0 0 2px var(--do); }
table.b td.o-cong.do { color: var(--loi); font-weight: 500; } table.b td.o-cong sup { font-size: 9.5px; line-height: 0; color: var(--lam); } table.b td.o-cong.sua-tay { text-decoration: underline dotted var(--lam) 2px; text-underline-offset: 4px; }
table.b td.p-do { color: var(--loi); } table.b tfoot td { position: sticky; bottom: 0; background: var(--xam); font-weight: 600; z-index: 2; } table.b tfoot .ghim { z-index: 4; }
.chan { padding: 8px 16px; color: var(--mo); background: var(--giay); border-top: 1px solid var(--ke); display: flex; gap: 8px 20px; flex-wrap: wrap; flex: none; }
.chan b { font-weight: 600; color: var(--chu); }
.the { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--xam); } .the.xanh { background: var(--xanh-nhat); color: var(--xanh); } .the.vang { background: var(--vang-nhat); color: var(--vang); } .the.do { background: var(--do-nhat); color: var(--do); }
.loc-dang { cursor: pointer; background: var(--do-nhat); color: var(--do); border: 0; border-radius: 12px; padding: 3px 10px; }
.trong-rong { padding: 40px 16px; text-align: center; color: var(--mo); }
td.chon-ca { cursor: cell; text-align: center !important; padding: 6px 3px !important; font-size: 11.5px; } td.chon-ca.md { color: #a59e97; } td.chon-ca.lark { color: var(--lam); } td.chon-ca.moi { background: var(--vang-nhat) !important; font-weight: 600; }

/* hộp thoại */
dialog { border: 1px solid var(--ke); border-radius: 6px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 16px 50px rgb(40 10 20 / .28); color: inherit; max-height: calc(100vh - 40px); }
dialog.rong { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgb(30 15 20 / .35); }
.hop-dau { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--ke); position: sticky; top: 0; background: var(--giay); z-index: 2; } .hop-dau h1 { color: var(--do); font-size: 15px; flex: 1; }
.hop-than { padding: 14px 16px 18px; }
.dong { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--mo); width: 32px; height: 32px; }
.the-tab { display: flex; gap: 2px; border-bottom: 1px solid var(--ke); margin-bottom: 12px; overflow: auto; } .the-tab button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--mo); border-bottom: 2px solid transparent; white-space: nowrap; } .the-tab button[aria-selected=true] { color: var(--do); border-color: var(--do); font-weight: 600; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; } dl.kv dt { color: var(--mo); } dl.kv dd { margin: 0; } dl.kv .dau-muc { grid-column: 1 / -1; font-weight: 600; color: var(--chu); margin-top: 8px; }

/* GPS */
.gps { max-width: 460px; width: 100%; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 14px; }
.gps-o { background: var(--giay); border: 1px solid var(--ke); border-radius: 8px; padding: 18px; }
.dong-ho { font-size: 46px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gps-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .gps-nut button { height: 76px; border-radius: 8px; border: 0; font-size: 18px; font-weight: 600; color: #fff; background: var(--xanh); cursor: pointer; } .gps-nut button.ra { background: var(--do); } .gps-nut button:disabled { background: #bdb7b1; cursor: default; }
.vi-tri { display: flex; gap: 10px; align-items: flex-start; } .vi-tri::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #bdb7b1; margin-top: 5px; flex: none; } .vi-tri.ok::before { background: var(--xanh); } .vi-tri.xa::before { background: var(--loi); }
.ds { list-style: none; margin: 0; padding: 0; } .ds li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--ke); } .ds li:last-child { border: 0; } .ds b { font-variant-numeric: tabular-nums; min-width: 48px; }

/* phân công */
.pc { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; padding: 16px; } .pc section { background: var(--giay); border: 1px solid var(--ke); border-radius: 6px; padding: 12px 14px; } .pc h2 { margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; } .pc h3 { margin: 10px 0 4px; font-size: 12.5px; color: var(--lam); font-weight: 600; } .pc p { margin: 2px 0; display: flex; justify-content: space-between; gap: 10px; }

/* báo nhanh + đăng nhập */
#bao { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; } #bao div { background: #2b2624; color: #fff; padding: 10px 16px; border-radius: 6px; max-width: min(520px, calc(100vw - 32px)); } #bao div.sai { background: var(--loi); }
.dn { display: grid; place-items: center; min-height: 100vh; } .dn-hop { background: var(--giay); border: 1px solid var(--ke); border-radius: 10px; padding: 40px 36px; text-align: center; width: min(380px, calc(100vw - 32px)); } #nut { min-height: 44px; display: grid; place-items: center; margin: 20px 0 10px; }
.tien-trinh { height: 8px; background: var(--ke); border-radius: 4px; overflow: hidden; margin: 10px 0; } .tien-trinh i { display: block; height: 100%; background: var(--do); transition: width .2s; }

@media (max-width: 860px) {
  #mo-menu { display: grid; } .logo { width: auto; padding: 0; } .tim { max-width: none; } .nguoi { display: none; }
  .menu { position: fixed; inset: 54px auto 0 0; z-index: 30; width: 260px; transform: translateX(-102%); transition: transform .18s; } .menu.mo-ra { transform: none; box-shadow: 8px 0 24px rgb(40 10 20 / .16); } .chi-dt { display: flex !important; }
  .dau { gap: 6px; padding: 0 8px; } .thanh { padding: 10px 12px; } .thanh h1 { width: 100%; }
  table.b .ghim:not(.ghim-dt) { position: static; } table.b thead .ghim:not(.ghim-dt) { position: sticky; left: auto !important; z-index: 3; }
  table.b .ghim-dt { left: 0 !important; }
  .noi { flex-direction: column; gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
