/* TCKH – Bưu điện thành phố Quảng Ninh. Giao diện theo bộ nhận diện chung của đơn vị (như kpi.buudienquangninh.vn). */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e5e9f0; --line-2: #d3dae5;
  --brand: #004b8e; --brand-d: #003d75; --brand-soft: #e8f0f9; --brand-2: #ffc600;
  --side: #0f1b33; --side-2: #18284a; --side-tx: #b6c2d9;
  --ok: #15803d; --err: #c62828; --err-bg: #fdecec; --warn-bg: #fff5db; --warn-tx: #8a5a00;
  --head: #eef3f9; --hover: #fff8e1; --zebra: #f8fafd;
  --g-info: #1f4e78; --g-price: #7f6000; --g-src: #5b2c83; --g-qty: #375623; --g-val: #203864; --g-note: #595959;
  --m-open: #5b6b82; --m-nhap: #2e8b57; --m-xuat: #d9622b; --m-close: #1f5fa8; --m-rev: #9a7400;
  --t-open: #e9edf3; --t-nhap: #e4f2e9; --t-xuat: #fbebe2; --t-close: #e3ecf8; --t-rev: #fbf2d6; --t-info: #e6eff8; --t-price: #fbf4df; --t-src: #efeaf6;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 6px rgba(15,23,42,.04);
  --navy: #004b8e; --navy2: #0b5fae; --vn-yellow: #ffc600; --vn-orange: #f7a600; --vn-cream: #fff8e1;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.55 "Be Vietnam Pro", "Segoe UI", system-ui, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 8px; letter-spacing: -.3px; font-weight: 700; }
h2 { font-size: 16px; margin: 28px 0 12px; font-weight: 600; }
h2.sec { display: flex; align-items: center; gap: 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; }
h2.sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 860px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
/* ---------- tiêu đề trang */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.hero.slim { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.hero h1 { color: var(--text); }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--brand); }
.hero-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--line-2); color: #334155; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.chip svg { width: 14px; height: 14px; }
.chip.ok { border-color: #bfe3cb; background: #effaf3; color: var(--ok); }
.signer { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.signer input { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; width: 160px; color: var(--text); background: #fff; }

details.rule { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; }
details.rule summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.rule ul { margin: 8px 0 4px; padding-left: 20px; color: #334155; }

/* ---------- thẻ số liệu */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 20px; }
.stat { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); overflow: hidden; }
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.stat-l { color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.stat-v { font-size: 24px; font-weight: 700; margin-top: 12px; letter-spacing: -.4px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.up { color: var(--ok); font-weight: 600; } .down { color: var(--err); font-weight: 600; }
.warn-tx { color: var(--warn-tx); font-weight: 600; }

/* ---------- panel / dashboard */
.dash-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); margin-bottom: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 16px; }
.dash-grid .panel { margin-bottom: 0; }
.panel header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.panel h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.panel-sub { font-size: 12px; color: var(--muted); }

.hbars { display: flex; flex-direction: column; gap: 4px; }
.hb { display: grid; grid-template-columns: minmax(120px, 38%) 1fr auto; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.hb:hover { background: var(--hover); }
.hb-l { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; }
.hb-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.hb-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.hb-t { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.hb-b { height: 100%; border-radius: 6px; }
.hb-v { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; min-width: 64px; text-align: right; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.issues { display: flex; flex-direction: column; gap: 8px; }
.issue { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--text); background: #fff; transition: background .12s; }
.issue:hover { background: var(--hover); }
.issue .ii { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; }
.issue .ii svg { width: 16px; height: 16px; }
.issue b { display: block; font-size: 13.5px; font-weight: 600; }
.issue small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.issue.crit .ii { background: #fdeaea; color: #c62828; }
.issue.warn .ii { background: #fff3d6; color: #b45309; }
.issue.info .ii { background: #e8f0fe; color: var(--brand); }
.issue.ok .ii { background: #e6f6ec; color: var(--ok); }

/* ---------- màn hình chưa có dữ liệu */
.empty { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 32px 36px; margin-bottom: 8px; box-shadow: var(--shadow); }
.empty-ico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.empty-ico svg { width: 26px; height: 26px; }
.empty h2 { margin: 16px 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.empty p { margin: 0 0 20px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; display: flex; flex-direction: column; gap: 0; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 22px 52px; }
.steps li:last-child { padding-bottom: 4px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 14px; display: grid; place-items: center; border: 1px solid #d5e0fb; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 1px; background: var(--line-2); }
.steps b { display: block; font-weight: 600; font-size: 14px; } .steps span { font-size: 12.5px; color: var(--muted); }

/* ---------- ô nghiệp vụ */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile { --c: var(--brand); display: flex; flex-direction: column; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: .15s; box-shadow: var(--shadow); }
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); box-shadow: 0 8px 22px rgba(15,23,42,.08); }
.tile .ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.tile .ico svg { width: 21px; height: 21px; }
.tile h3 { margin: 14px 0 4px; font-size: 15px; font-weight: 600; }
.tile p { margin: 0; color: var(--muted); font-size: 13px; }
.tile .go { margin-top: auto; padding-top: 14px; font-size: 13px; font-weight: 600; color: var(--c); display: inline-flex; align-items: center; gap: 4px; }
.tile .go svg { width: 15px; height: 15px; transition: transform .15s; }
.tile:hover .go svg { transform: translateX(3px); }
.tile.disabled { pointer-events: none; background: #fafbfc; box-shadow: none; }
.tile.disabled .ico { color: #94a3b8; background: #eef1f5; }
.tile.disabled h3 { color: #64748b; }
.tile .soon-tag { align-self: flex-start; margin-top: auto; padding: 1px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #64748b; }
.tile.disabled p { margin-bottom: 14px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.drop { border: 2px dashed #c3cfe2; border-radius: var(--radius); padding: 32px; text-align: center; background: #fff; cursor: pointer; transition: .15s; }
.drop.over, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop b { color: var(--brand); }
.drop-ico { width: 48px; height: 48px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.drop-ico svg { width: 24px; height: 24px; }

/* ---------- nút */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none;
  padding: 8px 15px; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,.08); transition: .12s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.ghost { background: #fff; color: #1e293b; border-color: var(--line-2); }
.btn.ghost:hover { background: var(--head); }
.btn.gold { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.gold:hover { background: #116632; border-color: #116632; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 10px; font-size: 12px; font-weight: 500; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- bảng */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; background: #fff; }
th, td { border-bottom: 1px solid var(--line); border-right: 1px solid #eff2f6; padding: 7px 10px; vertical-align: middle; }
th { background: var(--head); color: #334155; font-weight: 600; text-align: center; position: sticky; top: 0; z-index: 2; font-size: 12.5px; }
th.l { text-align: left; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr:hover td { background: #eef4ff; }
td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.c { text-align: center; }
td.b { font-weight: 600; }
td.code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; white-space: nowrap; color: #334155; }
td.neg, .neg { color: var(--err); font-weight: 600; }
tr.total td, tfoot td { background: #fff6d6 !important; font-weight: 700; border-top: 2px solid #1e3a8a; position: sticky; bottom: 0; z-index: 1; }
td.warn, span.warn, td.cell-warn { background: var(--warn-bg) !important; color: var(--warn-tx); }
td.cell-input { background: #ffeedd !important; }
td.cell-input input { width: 78px; text-align: right; font: inherit; padding: 3px 6px; border: 1px solid #f0a868; border-radius: 6px; background: #fff; }
.table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.table-wrap.flat { box-shadow: none; max-height: none; }
.table-wrap table { min-width: 980px; }
.table-wrap.flat table { min-width: 640px; }
.table-wrap td:first-child a { white-space: nowrap; }
#nxtTable th, #ganTable th, #tongTable th { white-space: nowrap; }
#nxtTable tbody td:nth-child(2) { min-width: 260px; }
#nxtTable thead tr:first-child th[colspan] { white-space: normal; }
#ganTable { min-width: 1200px; }
#nxtTable thead tr:nth-child(2) th, #tongTable thead tr:nth-child(2) th { top: 33px; }
tr.hide-q { display: none; }
a.sup { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; text-decoration: none; color: var(--text); }
a.sup:hover { color: var(--brand); text-decoration: underline; }

/* nhóm cột: dải đậm + tiêu đề nhạt */
th.g-info, th.g-price, th.g-src, th.g-qty, th.g-val, th.g-note, th.g-open, th.g-nhap, th.g-xuat, th.g-close, th.g-rev { color: #fff; letter-spacing: .3px; text-transform: uppercase; font-size: 11.5px; }
th.g-info { background: var(--g-info); } th.g-price { background: var(--g-price); } th.g-src { background: var(--g-src); }
th.g-qty { background: var(--g-qty); } th.g-val { background: var(--g-val); } th.g-note { background: var(--g-note); }
th.g-open { background: var(--m-open); } th.g-nhap { background: var(--m-nhap); } th.g-xuat { background: var(--m-xuat); } th.g-close { background: var(--m-close); } th.g-rev { background: var(--m-rev); }
th.s-info { background: var(--t-info); } th.s-price { background: var(--t-price); } th.s-src { background: var(--t-src); }
th.s-open { background: var(--t-open); } th.s-nhap { background: var(--t-nhap); } th.s-xuat { background: var(--t-xuat); } th.s-close { background: var(--t-close); }
table.balance th { white-space: nowrap; }

td.bar-cell { position: relative; padding-bottom: 10px; }
td.bar-cell i { position: absolute; left: 10px; bottom: 4px; height: 3px; border-radius: 2px; max-width: calc(100% - 20px); opacity: .85; }
.delta { font-weight: 600; } .delta.up { color: var(--ok); } .delta.down { color: var(--err); }

/* ---------- nhãn */
.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #e3f4ea; color: var(--ok); }
.badge.miss { background: var(--err-bg); color: var(--err); }
.badge.opt { background: #eef1f6; color: var(--muted); }
.badge.src, .badge.prs { background: #e3ecf8; color: #1f4e78; }
.badge.prs2 { background: #fff; color: #1f4e78; border: 1px solid #9db8dc; }
.badge.kiot { background: #efeaf6; color: #5b2c83; }
.nc { display: inline-block; padding: 0 7px; margin: 1px 3px 1px 0; border-radius: 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.nc.warn { background: #fff0c2; color: #8a5a00; } .nc.crit { background: #fde2e2; color: #b42318; } .nc.info { background: #ffe4cc; color: #9a4a00; }
.nc.opt { background: #eef1f6; color: #475467; } .nc.lk { background: #efeaf6; color: #5b2c83; }
td.notes { white-space: nowrap; }

/* ---------- tab, thanh công cụ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 1px solid transparent; border-bottom: 0; background: none; padding: 8px 14px; border-radius: 7px 7px 0 0; cursor: pointer; font: inherit; color: var(--muted); }
.tabs.pills { border: 0; gap: 8px; }
.tabs.pills button { --c: var(--brand); display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); border-radius: 20px; background: #fff; color: #334155; padding: 6px 14px; font-weight: 600; font-size: 13px; }
.tabs.pills button:hover { border-color: var(--c); }
.tabs.pills button.active { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.15); }
.tabs.pills button.active .dot { background: #fff !important; }
.tabs.pills .cnt { font-size: 11px; padding: 0 6px; border-radius: 8px; background: rgba(0,0,0,.07); }
.tabs.pills button.active .cnt { background: rgba(255,255,255,.25); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: #334155; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--brand); color: #fff; }

.alert { border-radius: 10px; padding: 11px 15px; margin: 10px 0 14px; }
.alert.warn { background: var(--warn-bg); border: 1px solid #f0d58a; }
.alert.err { background: var(--err-bg); border: 1px solid #f2b8b1; }
.alert.info { background: var(--brand-soft); border: 1px solid #cfdcfa; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
select { font: inherit; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; }
input[type=search] { font: inherit; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 8px; min-width: 260px; background: #fff; }
input[type=search]:focus, .signer input:focus, select:focus { outline: 3px solid #dbe6ff; border-color: var(--brand); }

.toast { position: fixed; right: 20px; bottom: 20px; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: none; }
.tip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; background: #0f172a; color: #fff; font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: 8px;
  white-space: pre-line; max-width: 340px; opacity: 0; transition: opacity .12s; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.tip.show { opacity: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #cfdcfa; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- thẻ phần hành (trang Tổng quan) */
.areas { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.area-card { --c: var(--brand); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: .15s; }
.area-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.area-card .ah { display: flex; align-items: center; gap: 12px; }
.area-card .ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.area-card h3 { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--vnp-navy); }
.area-card p { margin: 10px 0 10px; color: var(--muted); font-size: 13px; }
.area-card ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.area-card li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; }
.area-card li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.area-card li.soon { color: #94a3b8; } .area-card li.soon::before { background: #cbd5e1; }
.area-card li em { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 0 7px; border-radius: 8px; background: #eef1f5; color: #7b8799; }
.area-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.area-card .foot b { color: var(--c); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.area-card .foot svg { width: 15px; height: 15px; }
.area-card.locked { pointer-events: none; opacity: .55; filter: grayscale(.6); }
.lvl { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.lvl.edit { background: #e3f4ea; color: var(--ok); } .lvl.view { background: var(--brand-soft); color: var(--brand); } .lvl.none { background: #eef1f6; color: #7b8799; } .lvl.admin { background: #fff3cc; color: #8a5a00; }

/* ---------- trang Thiết lập: nhân sự & phân quyền */
.perm-wrap table { min-width: 1180px; }
.perm-wrap td:first-child { min-width: 250px; }
.perm-wrap td { vertical-align: middle; }
.perm-wrap select { width: 100%; min-width: 110px; font-size: 12.5px; }
.perm-wrap select.p-edit { background: #effaf3; border-color: #bfe3cb; color: var(--ok); font-weight: 600; }
.perm-wrap select.p-view { background: var(--brand-soft); border-color: #c6dbf3; color: var(--brand); font-weight: 600; }
.perm-wrap tr.off td { color: #94a3b8; background: #fafbfc !important; }
.u-name { display: flex; align-items: center; gap: 10px; }
.u-name .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.u-name.admin .av { background: #fff3cc; color: #8a5a00; }
.u-name b { display: block; font-weight: 600; }
.u-name small { display: block; color: var(--muted); font-size: 11.5px; }
.acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.btn.danger { background: #fff; color: var(--err); border-color: #f2b8b1; }
.btn.danger:hover { background: var(--err-bg); }
.form { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: #334155; }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea { font: inherit; font-weight: 400; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--text); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 3px solid #d6e6f8; border-color: var(--brand); }
.form .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.perm-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-column: 1 / -1; }
.perm-pick .pp { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fafcff; }
.perm-pick .pp b { display: block; font-size: 13px; margin-bottom: 6px; color: var(--vnp-navy); }
.perm-pick .seg button { font-size: 12.5px; padding: 5px 10px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.log li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 12px; }
.log li span { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.locked-box { text-align: center; padding: 48px 24px; }
.locked-box .empty-ico { margin: 0 auto 12px; }


/* =====================================================================
   GIAO DIỆN THEO BỘ NHẬN DIỆN CHUNG CỦA ĐƠN VỊ (giống kpi.buudienquangninh.vn):
   đầu trang trắng viền vàng + logo · khối vàng tiêu đề & ô số liệu · tab chữ HOA gạch chân cam ·
   tiêu đề khung có vạch cam · bảng đầu navy chữ HOA · nút bo tròn · chân trang kem.
   ===================================================================== */
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; width: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; font-family: Roboto, "Segoe UI", system-ui, Arial, sans-serif; }
.main-wrap { flex: 1; }
main { padding: 0 0 40px; }

/* ---- đầu trang */
.top { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 3px solid var(--vn-yellow); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.top .wrap { min-height: 66px; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.vn-brand { display: flex; gap: 10px; align-items: center; text-decoration: none; min-width: 0; flex: 1; }
.vn-logo-vnp { height: 72px; width: auto; flex: none; display: block; margin: 2px 0; }
.vn-brand-txt { display: flex; flex-direction: column; line-height: 1.25; padding-left: 12px; border-left: 1px solid #d6dbe1; min-width: 0; }
.vn-brand-t { font-weight: 700; font-size: 15px; color: var(--navy); letter-spacing: .2px; }
.vn-brand-s { font-size: 12px; color: #6b7280; }
.top-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font: inherit; font-size: 13px; color: #444; background: #fff; text-decoration: none; border: 1px solid #d6dbe1; border-radius: 20px; padding: 5px 12px; white-space: nowrap; cursor: pointer; }
.pill:hover { border-color: var(--navy); color: var(--navy); }
.pill.period { cursor: default; color: #6b7280; }
.pill.period:hover { border-color: #d6dbe1; color: #6b7280; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.who .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--vn-yellow); color: var(--navy); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.who select { font: inherit; font-size: 13px; font-weight: 500; color: var(--navy); background: #fff; border: 1px solid #d6dbe1; border-radius: 20px; padding: 5px 10px; max-width: 260px; cursor: pointer; }
.who select:hover { border-color: var(--navy); }

/* ---- khối vàng: tiêu đề trang + ô số liệu */
section.hero { padding: 20px 0 6px; }
#heroSlot { background: var(--vn-yellow); border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,.25); padding: 18px 22px 20px; max-width: calc(1440px - 32px); width: calc(100% - 32px); }
#heroSlot .hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; background: none; }
#heroSlot .eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #7a5b00; }
#heroSlot h1 { color: var(--navy); text-transform: uppercase; font-size: 22px; font-weight: 700; letter-spacing: .2px; margin: 2px 0 4px; }
#heroSlot .hero-d { margin: 0 0 6px; color: #3d3d3d; max-width: 900px; }
#heroSlot .chips { margin-top: 6px; }
#heroSlot .chip { background: #fff; border-color: #fff; color: #212529; border-radius: 20px; }
#heroSlot .chip.ok { background: #e8f7ee; border-color: #e8f7ee; color: #1b7a3d; }
#heroSlot .signer { color: #3d3d3d; font-weight: 500; }
#heroSlot .signer input { border: 0; border-radius: 20px; padding: 7px 14px; }
#heroSlot .hero-act { align-self: center; }
#heroSlot .btn.ghost { background: #fff; border-color: #fff; color: var(--navy); }
#heroSlot .btn.ghost:hover { border-color: var(--navy); }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.stat-k { background: #fff; border: 1px solid #e5e7eb; border-top: 4px solid var(--navy); border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,.08); padding: 10px 16px; min-width: 0; }
.stat-k b { display: block; color: var(--navy); font-size: 28px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-k.txt b { font-size: 17px; line-height: 1.9; }
.stat-k.warn b { color: #d32f2f; }
.stat-k span { display: block; color: #6b7280; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- thanh tab: chữ HOA, tab đang chọn gạch chân cam */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; align-items: flex-end; margin: 14px 0 0; border-bottom: 1px solid #e5e7eb; }
.tabs .tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; margin-bottom: -1px; color: #444; font-weight: 500; font-size: 14px; text-transform: uppercase; text-decoration: none;
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs .tab svg { width: 15px; height: 15px; }
.tabs .tab:hover { color: var(--navy); }
.tabs .tab.on { color: var(--navy); border-bottom-color: var(--vn-orange); font-weight: 700; }
.tabs .tab .so { background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.tabs .tab.locked { color: #a3abb5; }
.tabs .tab.locked svg { width: 13px; height: 13px; }
.tabs .tab.set { margin-left: auto; }
/* hàng chức năng của tab đang mở */
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.subtabs:empty { margin: 0 0 16px; }
.subtabs .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 20px; background: #fff; border: 1px solid #d6dbe1; color: #004b8e; font-size: 13px; font-weight: 500; text-decoration: none; }
.subtabs .chip svg { width: 15px; height: 15px; }
.subtabs a.chip:hover { border-color: var(--navy); }
.subtabs .chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.subtabs .chip.soon { color: #9aa3ad; cursor: default; }
.subtabs .chip em { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: #f1f3f6; color: #8a94a0; }

/* ---- khung, tiêu đề: vạch cam, chữ navy HOA */
.card, .panel, .empty, .tile, .area-card, .stat, details.rule, .table-wrap { border-radius: 12px; border-color: #e5e7eb; box-shadow: 0 2px 4px rgba(0,0,0,.08); }
.panel h3, .empty h2, h2.sec { color: var(--navy); text-transform: uppercase; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.panel header h3, .empty h2 { display: flex; align-items: center; gap: 8px; }
.panel header h3::before, .empty h2::before { content: ""; width: 4px; height: 16px; background: var(--vn-orange); border-radius: 2px; flex-shrink: 0; }
h2.sec { gap: 8px; }
h2.sec::before { content: ""; width: 4px; height: 16px; background: var(--vn-orange); border-radius: 2px; flex-shrink: 0; }
h2.sec::after { display: none; }
#view > h2 { color: var(--navy); text-transform: uppercase; font-size: 15px; }
.stat { border-top: 4px solid var(--navy); }
.stat-v { color: var(--navy); font-size: 26px; }
.stat-l { text-transform: uppercase; font-size: 12px; letter-spacing: .3px; }
details.rule { background: #fff8e1; border: 1px solid var(--vn-yellow); border-left: 4px solid var(--vn-orange); }
details.rule summary { color: var(--navy); }
.alert.info { background: #e8f0f9; border: 1px solid #cfe0f3; border-left: 4px solid var(--navy); }
.alert.warn { background: #fff8e1; border: 1px solid var(--vn-yellow); border-left: 4px solid var(--vn-orange); }
.alert.err { border-left: 4px solid #d32f2f; }
.area-card { border-top: 4px solid var(--navy); }
.area-card h3 { color: var(--navy); text-transform: uppercase; font-size: 14.5px; }
.area-card .ico, .tile .ico { color: var(--navy); background: #e8f0f9; }
.tile h3 { color: var(--navy); }
.tile .go, .area-card .foot b { color: var(--navy); }
.steps li::before { background: var(--vn-yellow); color: var(--navy); border-color: var(--vn-yellow); }
.empty-ico, .drop-ico { background: #e8f0f9; color: var(--navy); }

/* ---- bảng: đầu navy chữ trắng HOA, dòng chẵn xanh rất nhạt, di chuột nền kem */
th { background: #004b8e; color: #fff; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .2px; border-right-color: rgba(255,255,255,.14); }
th[class*="s-"] { color: #1f2d3d; }
tbody tr:nth-child(even) td { background: rgba(0,75,142,.03); }
tbody tr:hover td { background: #fff8e1; }
.card > table { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
tr.total td, tfoot td { background: #fff8e1 !important; border-top-color: var(--navy); }

/* ---- nút: bo tròn; chính navy; Tải Excel vàng */
.btn { border-radius: 30px; padding: 7px 16px; font-weight: 500; background: #004b8e; border-color: #004b8e; color: #fff; box-shadow: none; }
.btn:hover { background: #003d75; border-color: #003d75; }
.btn.ghost { background: transparent; border-color: #d6dbe1; color: #0b5fae; }
.btn.ghost:hover { background: transparent; border-color: var(--navy); color: var(--navy); }
.btn.gold { background: var(--vn-yellow); border-color: var(--vn-yellow); color: #212529; font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.btn.gold:hover { background: #ffb800; border-color: #ffb800; color: #212529; }
.btn.danger { background: #fff; color: #d32f2f; border-color: #f2b8b1; }
.btn.small { padding: 3px 12px; font-size: 12.5px; }
select, input[type=search] { border-radius: 20px; padding: 6px 12px; border-color: #d6dbe1; }
.perm-wrap select { border-radius: 20px; }
.form input, .form select, .form textarea { border-radius: 20px; padding: 8px 14px; }
.badge.miss { background: #fdecea; color: #d32f2f; }
.drop { background: #fff8e1; border: 2px dashed #d6dbe1; border-radius: 12px; }
.drop.over, .drop:hover { border-color: #0b5fae; background: #eef3f9; }
.drop b { color: var(--navy); }
.toast { background: #004b8e; border-radius: 30px; }
.tabs.pills button.active { background: var(--navy); border-color: var(--navy); }
.seg button.active { background: var(--navy); }

/* ---- chân trang kem, viền trên vàng */
.vn-foot { background: #fff8e1; border-top: 3px solid var(--vn-yellow); margin-top: auto; }
.vn-foot-in { max-width: 1440px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 10px 30px; justify-content: space-between; align-items: center; }
.vn-foot-t { font-weight: 700; color: var(--navy); font-size: 15px; }
.vn-foot-s, .vn-foot-n { font-size: 12.5px; color: #6b7280; }
.vn-foot-n { max-width: 560px; }

/* Tồn kho theo điểm bán (chức năng của chị Hiền, giữ nguyên khi đổi giao diện) */
tr.grp-row td { background: #e8f0f9 !important; color: #004b8e; font-weight: 700; border-top: 1px solid #c7d8ee; }
#tkTable td.n.b { font-weight: 700; background: #f8fafc; }
#tkTable td:nth-child(2) { min-width: 280px; }
#tkTable th:first-child, #tkTable td:first-child { white-space: nowrap; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } .empty { grid-template-columns: 1fr; gap: 24px; } }
@media (max-width: 860px) { .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .tabs .tab.set { margin-left: 0; } .hb { grid-template-columns: minmax(90px, 40%) 1fr auto; } .empty { padding: 24px 20px; } }
@media (max-width: 700px) {
  #heroSlot { padding: 14px 16px; } #heroSlot h1 { font-size: 18px; }
  .vn-brand-s, .pill.period, .top-r > .pill { display: none; } .vn-logo-vnp { height: 56px; } .vn-brand-t { font-size: 13.5px; }
  .vn-brand-t { white-space: nowrap; } .top-r { width: 100%; justify-content: flex-end; padding-bottom: 8px; } .who select { max-width: 240px; } .tabs .tab { padding: 8px 9px; font-size: 13px; }
  .hero-stats { grid-template-columns: 1fr 1fr; } .stat-k b { font-size: 22px; }
}
@media print {
  .top, .tabs, .subtabs, .vn-foot, .btn, .toolbar, details.rule, .hero-stats { display: none !important; }
  #heroSlot { box-shadow: none; background: none; padding: 0; }
  .table-wrap { max-height: none; overflow: visible; border: 0; box-shadow: none; }
  th { position: static; }
}
/* Tồn kho: thanh xếp chồng, chú giải màu nhiệt */
.tk-sbars { display: flex; flex-direction: column; gap: 6px; }
.tk-sbar { display: grid; grid-template-columns: 120px 1fr 92px; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 3px 4px; border-radius: 6px; }
.tk-sbar:hover { background: #f1f5fb; }
.tk-sbar .l { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-sbar .b { display: flex; height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; }
.tk-sbar .b i { display: block; height: 100%; }
.tk-sbar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.tk-sbar .v small { display: block; font-weight: 400; color: #6b7280; font-size: 11px; }
.tk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; font-size: 11.5px; color: #6b7280; }
.tk-legend span { margin-right: 4px; }
.tk-legend i { font-style: normal; padding: 2px 8px; border-radius: 4px; border: 1px solid #dfe5ec; color: #1f2937; }
.tk-legend i.neg-k { background: #ffc7ce; color: #9c0006; border-color: #f5a3ad; font-weight: 600; }
td.tk-0 { color: #cbd5e1; text-align: center; }
td.tk-neg { background: #ffc7ce !important; color: #9c0006; font-weight: 700; }
.tk-heat td:first-child { white-space: nowrap; }
.tk-heat th { white-space: nowrap; font-size: 12px; }
#tkTable th small.muted { color: rgba(255,255,255,.75); font-weight: 400; }
#tkTable th:nth-child(n+4), #tkTable td:nth-child(n+4) { width: 74px; min-width: 64px; }
#tkTable th:nth-child(3), #tkTable td:nth-child(3) { width: 52px; }
/* ===== Đối chiếu SL Kiot – PRS (Kế toán dòng tiền) ===== */
.kp-mat td.d { cursor: pointer; text-align: right; font-variant-numeric: tabular-nums; }
.kp-mat td.d:hover { outline: 1px solid var(--navy); outline-offset: -1px; }
.kp-mat td.pos { color: #1d4ed8; background: #eef4ff; font-weight: 600; }
.kp-mat td.neg { color: #b42318; background: #fff1f0; font-weight: 600; }
.kp-mat td.z { color: #b8c2d0; }
.kp-mat td.sel { outline: 2px solid var(--navy); outline-offset: -2px; }
.kp-mat th.bc { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 12px; min-width: 30px; padding: 8px 4px; vertical-align: bottom; }
.kp-mat tr.ok td { color: var(--muted); }
.kp-pos { color: #1d4ed8; font-weight: 600; } .kp-neg { color: #b42318; font-weight: 600; }
.kp-det { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kp-det h4 { margin: 6px 0 8px; }
.kp-scroll { max-height: 340px; overflow: auto; }
@media (max-width: 900px) { .kp-det { grid-template-columns: 1fr; } }
.kp-iss select, .kp-iss input { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; width: 100%; box-sizing: border-box; }
.kp-sug { font-size: 12px; color: #0a7a3d; margin-top: 2px; }
.panel.kp-warn { border-left: 4px solid var(--vn-orange, #f39200); }
.panel h4 { margin: 14px 0 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
