:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1d2733; --muted: #6b7684; --line: #dfe4ea;
  --brand: #1f4e78; --brand-2: #e8eff6; --good: #1e7d4f; --good-bg: #e3f4ea;
  --bad: #b3261e; --bad-bg: #fbe7e5; --mid: #a15c00; --mid-bg: #fdf0dc;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0 0 2px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok, .good-t { color: var(--good); font-weight: 600; }
.bad-t { color: var(--bad); font-weight: 600; }

.topbar { display: flex; align-items: center; gap: 18px; background: var(--brand); color: #fff;
  padding: 0 18px; min-height: 52px; flex-wrap: wrap; }
.topbar a { color: #dce8f3; text-decoration: none; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 20px; color: var(--brand); margin-bottom: 4px; }
.logo { background: #f2b33d; color: #1f2d3d; border-radius: 6px; padding: 1px 6px; font-size: 13px; }
.topbar nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar nav a { padding: 15px 11px; border-bottom: 3px solid transparent; }
.topbar nav a.on, .topbar nav a:hover { color: #fff; border-bottom-color: #f2b33d; }
.me { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.me form { margin: 0; }
button.link { background: none; border: 0; color: #dce8f3; cursor: pointer; font: inherit; text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
body.center .wrap { display: flex; justify-content: center; padding-top: 10vh; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { width: 100%; max-width: 440px; }
.form label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.form label.inline, label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #c8d0d9;
  border-radius: 7px; background: #fff; color: var(--ink); margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0e2; border-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: #f3f5f7; color: #4a5562; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.formactions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.formactions form { margin: 0; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid #c8d0d9; background: #fff;
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f1f4f7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #183f61; }
.btn.danger { color: var(--bad); border-color: #e6b3ae; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.full { width: 100%; margin-top: 6px; padding: 10px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--good-bg); border-color: #b9e1c9; color: #165c3a; }
.flash.error { background: var(--bad-bg); border-color: #f0bdb8; color: #8a1c15; }
.flash.info { background: var(--brand-2); border-color: #c6d8ea; }

.weekpick { display: flex; gap: 4px; align-items: center; margin: 0; }
.weekpick select { width: auto; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; margin: 0; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.grid { width: 100%; border-collapse: collapse; background: var(--card); }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: #f0f3f7; font-size: 12px; color: #44505e; font-weight: 700; white-space: nowrap; }
.grid td form { margin: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid tr.total td { font-weight: 700; background: #f7f9fb; }
.grid tr.inactive td { opacity: .55; }
.grid td input, .grid td select { margin: 0; padding: 5px 8px; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { width: 150px; }
.empty { background: var(--card); border: 1px dashed #c8d0d9; border-radius: 10px; padding: 30px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.dat { background: var(--good-bg); color: var(--good); }
.tag.khong_dat { background: var(--bad-bg); color: var(--bad); }
.tag.lock { background: #eceff3; color: #44505e; }
.sev { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; white-space: nowrap; }
.sev.hi { background: var(--bad); color: #fff; }
.sev.mid { background: var(--mid-bg); color: var(--mid); }
.sev.lo { background: #eceff3; color: #44505e; }

.result-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.result-pick .lbl { font-weight: 600; font-size: 13px; margin-right: 4px; }
.choice { display: inline-flex !important; align-items: center; gap: 8px; padding: 9px 16px !important;
  border: 2px solid var(--line); border-radius: 9px; cursor: pointer; margin: 0 !important; }
.choice.dat:has(input:checked) { border-color: var(--good); background: var(--good-bg); }
.choice.khong_dat:has(input:checked) { border-color: var(--bad); background: var(--bad-bg); }
.failbox { border-left: 4px solid var(--bad); background: #fdf6f5; padding: 12px 14px; border-radius: 0 8px 8px 0; margin-bottom: 14px; }

/* ---------- report ---------- */
.report { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px 26px; }
.rhead { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px solid var(--brand); padding-bottom: 10px; margin-bottom: 14px; }
.rtitle { font-size: 19px; font-weight: 800; color: var(--brand); letter-spacing: .3px; }
.rsub { color: var(--muted); }
.rmeta { text-align: right; }
.grade { display: inline-block; font-weight: 800; font-size: 16px; padding: 2px 14px; border-radius: 20px; }
.g-tot { background: var(--good-bg); color: var(--good); }
.g-kha { background: var(--mid-bg); color: var(--mid); }
.g-kem { background: var(--bad-bg); color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 4px; }
.tile { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .v.sm { font-size: 18px; padding: 4px 0; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile.good .v { color: var(--good); }
.tile.bad .v { color: var(--bad); }
.delta { font-weight: 700; white-space: nowrap; }
.delta.good { color: var(--good); } .delta.bad { color: var(--bad); } .delta.flat { color: var(--muted); font-weight: 400; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.note { background: #f7f9fb; border-radius: 8px; padding: 8px 10px; white-space: pre-line; }
.wrap-text { white-space: pre-line; min-width: 220px; }
.trend { display: flex; gap: 10px; align-items: flex-end; }
.tcol { flex: 1; text-align: center; font-size: 12px; }
.tbar { display: flex; align-items: flex-end; justify-content: center; }
.tstack { width: 70%; max-width: 46px; display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; background: #eceff3; }
.tpass { background: #7fb79a; } .tfail { background: #d9776f; }
.tcol.cur .tpass { background: var(--good); } .tcol.cur .tfail { background: var(--bad); }
.tcol.cur .tl { font-weight: 800; color: var(--ink); }
.trate { font-weight: 700; height: 18px; }
.tn { font-weight: 700; }
.tl { color: var(--muted); }
.legend { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: -1px; }
.sw.pass { background: var(--good); } .sw.fail { background: var(--bad); }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 34px; text-align: center; }
.sign .line { height: 56px; }

@media (max-width: 760px) {
  .row, .twocol { grid-template-columns: 1fr; gap: 0; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .topbar nav a { padding: 10px 8px; }
  .report { padding: 14px; }
  .rhead { flex-direction: column; }
  .rmeta { text-align: left; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm 10mm; }
  body { background: #fff; font-size: 11px; }
  .no-print, .topbar, .flash { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .report { border: 0; padding: 0; }
  .tiles { grid-template-columns: repeat(5, 1fr); }
  .twocol { grid-template-columns: 1fr 1fr; }
  .grid th, .grid td { padding: 4px 6px; }
  .tile .v { font-size: 20px; }
  h2 { font-size: 13px; margin: 12px 0 6px; break-after: avoid; }
  tr, .tile, .avoid-break { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* customers */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.docs-card { padding: 12px 14px; margin: 0; }
.docs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.grid.compact th, .grid.compact td { padding: 4px 6px; font-size: 13px; }
.docs-card .tablewrap, .docs-card table { max-height: none; }
.link-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.link-x:hover { color: var(--bad); }
.docs-hint { align-self: end; margin-bottom: 14px; }

/* bulk entry */
.grid.bulk td { padding: 4px 5px; vertical-align: middle; }
.grid.bulk input, .grid.bulk select { margin: 0; padding: 6px 8px; min-width: 110px; }
.grid.bulk td.idx { width: 28px; text-align: right; }
.grid.bulk td.err { color: var(--bad); font-size: 12px; min-width: 140px; }
.grid.bulk tr.rowerr td { background: #fdf6f5; }
details.paste summary { cursor: pointer; }
details.paste textarea { font-family: Consolas, monospace; font-size: 13px; }
.grid.bulk tr.rowlate td { background: #fff7ed; }
.grade-sm { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.grade-sm.g-tot { background: var(--good-bg); color: var(--good); }
.grade-sm.g-kha { background: var(--mid-bg); color: var(--mid); }
.grade-sm.g-kem { background: var(--bad-bg); color: var(--bad); }

/* ---------- menu nhóm ---------- */
.topbar .dd { position: relative; }
.topbar .dd > button { background: none; border: 0; color: #dce8f3; font: inherit; padding: 15px 11px; cursor: pointer;
  border-bottom: 3px solid transparent; }
.topbar .dd > button.on, .topbar .dd:hover > button, .topbar .dd:focus-within > button { color: #fff; border-bottom-color: #f2b33d; }
.topbar .dd .menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 190px; z-index: 50; padding: 4px 0; }
.topbar .dd:hover .menu, .topbar .dd:focus-within .menu { display: block; }
.topbar .dd .menu a { display: block; color: var(--ink); padding: 8px 14px; border: 0; }
.topbar .dd .menu a:hover, .topbar .dd .menu a.on { background: var(--brand-2); color: var(--brand); }

/* ---------- kinh doanh ---------- */
.tag.st-nhap { background: #eceff3; color: #44505e; }
.tag.st-cho_gia { background: var(--mid-bg); color: var(--mid); }
.tag.st-co_gia { background: #e3edfb; color: #1d4f91; }
.tag.st-da_gui { background: #e8e3fb; color: #4b2d91; }
.tag.st-chot { background: var(--good-bg); color: var(--good); }
.tag.st-truot { background: var(--bad-bg); color: var(--bad); }
.tag.ps-moi { background: #eceff3; color: #44505e; } .tag.ps-cham_soc { background: #e3edfb; color: #1d4f91; }
.tag.ps-bao_gia { background: #e8e3fb; color: #4b2d91; } .tag.ps-thanh_cong { background: var(--good-bg); color: var(--good); }
.tag.ps-dung { background: #f3f3f3; color: #888; }
.g-tot-t { color: var(--good); font-weight: 700; } .g-dat-t { color: var(--mid); font-weight: 700; }
.g-thap-t, .g-lo-t { color: var(--bad); font-weight: 700; }
tr.r-expired td { color: #9aa3ad; text-decoration: line-through; }
tr.r-soon td { background: #fff8eb; }
.best { color: var(--good); font-weight: 800; }
.items td { padding: 4px 5px; }
.items input, .items select { padding: 5px 6px; font-size: 13px; }
.items .sec { width: 150px; } .items .cur { width: 72px; } .items .qty { width: 62px; } .items .unit { width: 92px; }
.items .price, .items .cost { width: 112px; text-align: right; }
.items .amt { text-align: right; white-space: nowrap; min-width: 100px; font-weight: 600; }
.items .del { background: none; border: 0; color: #b0b7c0; font-size: 18px; cursor: pointer; }
.items .del:hover { color: var(--bad); }
.items tr.secrow td { background: var(--brand-2); font-weight: 700; color: var(--brand); font-size: 12px; }
.costcol { background: #fbf7ee; }
.sumbox { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.rate-pick { border: 1px dashed #c8d0d9; border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; background: #fafbfc; }
.rate-pick table { font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: 3px 0; } .timeline li b { display: inline-block; min-width: 150px; }
.notes .note { border-left: 3px solid var(--brand-2); padding: 6px 10px; margin-bottom: 8px; }
.wait-late { color: var(--bad); font-weight: 700; }
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .dash, .sumbox, .twocol { grid-template-columns: 1fr; } .row { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr) !important; } }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .row3 { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 10px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.subtabs a { padding: 4px 12px; border-radius: 20px; background: #eceff3; color: #44505e; text-decoration: none; font-size: 13px; font-weight: 600; }
.subtabs a.on { background: var(--brand); color: #fff; } .subtabs a.warn:not(.on) { background: var(--mid-bg); color: var(--mid); }
.cnt { font-size: 11px; opacity: .75; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.task form { margin: 0; } .task .tt { flex: 1; }
.task .chk { width: 22px; height: 22px; border: 2px solid #9aa5b1; border-radius: 5px; background: #fff; cursor: pointer; color: var(--good); font-weight: 800; padding: 0; line-height: 1; }
.task.done .tt { text-decoration: line-through; color: var(--muted); } .task.done .chk { border-color: var(--good); }
.task.late .tt b { color: var(--bad); }
.task .del { background: none; border: 0; color: #b0b7c0; font-size: 18px; cursor: pointer; }
button.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.cmp td, .cmp th { font-size: 13px; } .cmp tr.miss td { color: #9aa3ad; }
.unitpick { display: flex; flex-wrap: wrap; gap: 6px; } .unitpick label { display: inline-flex !important; align-items: center; gap: 4px; font-weight: 600; font-size: 12px; margin: 0 !important; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.unitpick input { width: 48px; margin: 0; padding: 3px 5px; }

/* =================== THEME 5 STAR (đỏ · navy · gold) =================== */
:root {
  --red: #C8102E; --red-dk: #9d0c24; --navy: #1A2E5A; --navy-dk: #0F1E3D; --gold: #D4A017; --gold-lt: #fbf3dc;
  --brand: #1A2E5A; --brand-2: #eaf0f9; --bg: #f3f5fa; --line: #dde3ee; --ink: #16213a; --muted: #67718a;
  --shadow: 0 1px 2px rgba(15,30,61,.05), 0 6px 18px rgba(15,30,61,.06);
}
body { font-family: "Be Vietnam Pro", "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--navy); }
h1 { color: var(--navy-dk); font-weight: 800; letter-spacing: -.2px; }
h2 { color: var(--navy); font-weight: 700; display: flex; align-items: center; gap: 8px; }
h2::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: linear-gradient(180deg, var(--red), var(--gold)); flex: none; }
.report h2::before, .grid h2::before { display: none; }

/* header */
.topbar { display: block; background: #fff; color: var(--ink); padding: 0; min-height: 0; position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(15,30,61,.10); }
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 22px; }
.topbar .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topbar .brand img { height: 46px; width: auto; display: block; }
.bname { display: block; font-weight: 800; color: var(--red); letter-spacing: .4px; font-size: 15px; line-height: 1.2; }
.bsub { display: block; font-size: 12px; color: var(--navy); font-weight: 500; }
.topbar .me { gap: 14px; }
.topbar .me a.who { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; line-height: 1.25; }
.topbar .me a.who small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--red), var(--navy)); }
.topbar button.link { color: var(--muted); }
.topbar button.link:hover { color: var(--red); }
.navbar { background: linear-gradient(90deg, var(--navy-dk), var(--navy)); padding: 0 12px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 2px; }
.topbar nav a, .topbar .dd > button { color: #d5deef; padding: 12px 13px; font-weight: 500; font-size: 14px; border-bottom: 3px solid transparent; }
.topbar nav > a.on, .topbar nav > a:hover, .topbar .dd > button.on, .topbar .dd:hover > button, .topbar .dd:focus-within > button {
  color: #fff; border-bottom-color: var(--gold); background: rgba(255,255,255,.06); }
.topbar .dd .menu { border-radius: 0 0 10px 10px; border-top: 3px solid var(--gold); }
.topbar .dd .menu a { color: var(--ink); padding: 9px 16px; font-size: 14px; border-bottom: 0; }
.topbar .dd .menu a:hover, .topbar .dd .menu a.on { background: var(--brand-2); color: var(--navy); }
.deco { height: 3px; background: linear-gradient(90deg, var(--red), var(--navy) 45%, var(--gold)); }

/* layout & cards */
.wrap { max-width: 1240px; padding: 22px 18px 56px; }
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tablewrap { border-radius: 12px; box-shadow: var(--shadow); }
.empty { border-radius: 12px; }
.grid th { background: #eef2f9; color: var(--navy); font-weight: 700; letter-spacing: .2px; }
.grid tbody tr:hover td { background: #f8faff; }
.tile { background: #fff; border-radius: 12px; border: 1px solid var(--line); border-top: 3px solid var(--navy); box-shadow: var(--shadow); }
.tile.good { border-top-color: var(--good); } .tile.bad { border-top-color: var(--red); }
.tile .k { color: var(--muted); text-transform: none; }
.report { border-radius: 12px; box-shadow: var(--shadow); }
.rhead { border-bottom: 0; position: relative; padding-bottom: 12px; }
.rhead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--red), var(--navy) 45%, var(--gold)); }
.rleft { display: flex; align-items: center; gap: 14px; }
.rlogo { height: 54px; width: auto; }
.rtitle { color: var(--navy-dk); }

/* buttons & inputs */
.btn { border-radius: 8px; font-weight: 600; transition: background .15s, box-shadow .15s; }
.btn.primary { background: linear-gradient(135deg, var(--navy), var(--navy-dk)); border-color: var(--navy-dk); box-shadow: 0 2px 6px rgba(15,30,61,.25); }
.btn.primary:hover { background: var(--navy-dk); }
.btn.danger { color: var(--red); border-color: #efb8c0; }
.btn.danger:hover { background: #fff1f3; }
input, select, textarea { border-radius: 8px; border-color: #ccd5e3; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(26,46,90,.15); border-color: var(--navy); }
.flash.ok { border-left: 4px solid var(--good); } .flash.error { border-left: 4px solid var(--red); } .flash.info { border-left: 4px solid var(--navy); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--red); }
.subtabs a.on { background: var(--navy); }
.best { color: var(--gold); }

/* login */
body.center { background: radial-gradient(1200px 600px at 10% 0%, rgba(200,16,46,.18), transparent 60%),
  radial-gradient(900px 500px at 100% 100%, rgba(212,160,23,.18), transparent 60%), linear-gradient(135deg, var(--navy-dk), var(--navy)); min-height: 100vh; }
.card.login { padding: 28px 30px 26px; border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-logo { display: block; height: 96px; margin: 0 auto 6px; }
.login-co { text-align: center; font-weight: 800; color: var(--red); letter-spacing: .6px; font-size: 16px; }
.card.login .deco { margin: 10px 0 8px; border-radius: 2px; }
.card.login h1 { text-align: center; }

@media (max-width: 760px) {
  .brandbar { padding: 6px 12px; } .bsub { display: none; } .topbar .brand img { height: 38px; }
  .topbar .me a.who span:last-child { display: none; }
}
@media print { .topbar, .deco { display: none !important; } body { background: #fff; } .card, .tile, .report, .tablewrap { box-shadow: none; } }

/* ---- lô hàng, kế toán, phân tích, cổng khách hàng ---- */
.alert-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); margin-right: 4px; vertical-align: 1px; }
.alert-dot.hi { background: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.15); }
.steps { display: flex; gap: 3px; min-width: 90px; }
.steps .stp { flex: 1; height: 7px; border-radius: 4px; background: #e3e7ee; }
.steps .stp.on { background: var(--navy); }
.tag.ss-pending { background: var(--mid-bg); color: var(--mid); }
.tag.ss-handling { background: #e3edfb; color: #1d4f91; }
.tag.ss-done { background: var(--good-bg); color: var(--good); }
.tag.ss-cancelled { background: #eceff3; color: #44505e; }
nav.anchors { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; position: sticky; top: 98px; z-index: 5; background: var(--bg, #f4f6fa); padding: 6px 0; }
nav.anchors a { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--navy); text-decoration: none; font-size: 13px; font-weight: 600; }
nav.anchors a:hover { border-color: var(--navy); }
.track { display: flex; gap: 0; overflow-x: auto; padding: 4px 0; }
.tstep { flex: 1; min-width: 110px; text-align: center; position: relative; font-size: 13px; color: var(--muted); }
.tstep::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: #e3e7ee; z-index: 0; }
.tstep:first-child::before { display: none; }
.tstep.on::before { background: var(--navy); }
.tstep .dot { position: relative; z-index: 1; display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; background: #fff; border: 2px solid #d3d9e3; font-weight: 700; margin-bottom: 6px; }
.tstep.on .dot { background: var(--navy); border-color: var(--navy); color: #fff; }
.tstep.on { color: var(--ink); }
.tstep b { display: block; font-weight: 600; } .tstep small { display: block; font-size: 11px; color: var(--muted); }
table.kv th { text-align: left; width: 38%; color: var(--muted); font-weight: 600; }
.big { font-size: 20px; font-weight: 800; color: var(--navy); text-align: right; }
a.tile { color: inherit; text-decoration: none; display: block; } a.tile:hover { border-color: var(--navy); }
.tile .s.up { color: var(--good); } .tile .s.down { color: var(--bad); }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hb { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 2px 0; }
.hb:hover { background: #f5f7fb; }
.hb-k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-t { height: 12px; background: transparent; }
.hb-f { height: 100%; background: var(--navy); border-radius: 0 4px 4px 0; min-width: 2px; }
.hb-f.neg { background: var(--red); }
.hb-v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 70px; text-align: right; }
.vbars { display: flex; gap: 6px; align-items: flex-end; height: 190px; padding-top: 4px; }
.vb { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; font-size: 11px; }
.vb-t { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vb-f { width: 55%; max-width: 30px; background: #9fb0cf; border-radius: 4px 4px 0 0; min-height: 2px; }
.vb.cur .vb-f { background: var(--navy); } .vb-f.neg { background: var(--red); }
.vb-n { height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vb-l { color: var(--muted); padding-top: 4px; } .vb.cur .vb-l { color: var(--ink); font-weight: 700; }
.vb:hover .vb-f { background: var(--gold); }
details summary { cursor: pointer; color: var(--navy); font-weight: 600; margin: 8px 0; }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr 1fr !important; } nav.anchors { position: static; } }
#progress .task.done .tt { text-decoration: none; color: var(--ink); }
#progress .task.done .chk { background: var(--good); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.toolbar a { padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font-weight: 600; font-size: 13px; text-decoration: none; }
.toolbar a:hover { border-color: var(--navy); }
.toolbar .cnt { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; opacity: 1; text-align: center; font-size: 11px; }
td.neg, b.neg { color: var(--bad); } b.pos { color: var(--good); }
.bankmatch label.inline { display: block; margin: 2px 0; font-size: 13px; }
details.card > summary { margin: 0; }
.repwrap { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.replist { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 110px; }
.replist a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.replist a small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.replist a:hover { background: #fff; border-color: var(--line); }
.replist a.on { background: var(--navy); color: #fff; } .replist a.on small { color: #c9d3e8; }
.rco { font-weight: 800; color: var(--navy-dk); font-size: 15px; }
.rmeta { text-align: right; }
table.rep td, table.rep th { font-size: 13px; padding: 6px 8px; }
table.rep tr.total td { font-weight: 800; border-top: 2px solid var(--navy); background: #f3f5fa; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 28px; page-break-inside: avoid; }
.signs div { display: flex; flex-direction: column; gap: 2px; min-height: 110px; }
.signs span { font-size: 12px; color: var(--muted); font-style: italic; }
.signs em { margin-top: auto; font-style: normal; font-weight: 600; }
@media (max-width: 900px) { .repwrap { grid-template-columns: 1fr; } .replist { position: static; flex-direction: row; flex-wrap: wrap; } }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .repwrap { display: block; }
  .report.printable { box-shadow: none; border: 0; padding: 0; }
  table.rep td, table.rep th { font-size: 11px; padding: 4px 5px; }
  table.rep thead { display: table-header-group; }
  table.rep tr { page-break-inside: avoid; }
  .flash { display: none; }
}
table.rep td:first-child { white-space: nowrap; }
/* phân tích kinh doanh */
.bi-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.bi-tabs a { padding: 10px 16px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.bi-tabs a.on { color: var(--navy); border-bottom-color: var(--red); }
.bi-views { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.bi-views a { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.bi-views a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.bi-filter { align-items: center; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: 6px 10px; font-size: 12.5px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; } .seg a.on { background: var(--navy); color: #fff; }
.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.c-grid { stroke: #e6e9ef; stroke-width: 1; } .c-zero { stroke: #b9c1cf; stroke-width: 1; }
.c-ax { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.c-cross { stroke: #9aa5b8; stroke-width: 1; stroke-dasharray: 3 3; }
.c-tip { display: none; position: absolute; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(15,30,61,.14); padding: 8px 10px; font-size: 12.5px; pointer-events: none; white-space: nowrap; }
.c-tip div { margin-top: 2px; }
.c-tip i, .c-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.c-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.stack100 { display: flex; height: 16px; border-radius: 5px; overflow: hidden; background: #eceff3; gap: 2px; margin: 6px 0; }
.stack100 span { display: block; height: 100%; }
.hb-f.muted { background: #b8c1d3; }
.mtabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 10px; flex-wrap: wrap; }
.mtabs a { padding: 8px 14px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; font-size: 14px; }
.mtabs a.on { color: var(--navy); border-bottom-color: var(--red); }
.mtabs .cnt { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #eceff3; color: var(--ink); font-size: 11px; text-align: center; opacity: 1; }
details.addline > summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #f3f5fa; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.bulkbar input, .bulkbar select { width: auto; margin: 0; }
.dropzone { border: 2px dashed #b9c3d6; text-align: center; background: #fbfcfe; }
.dropzone.over { border-color: var(--navy); background: #eef2fa; }
.dz-in { max-width: 640px; margin: 0 auto; } .dz-icon { font-size: 28px; color: var(--navy); }
.dropzone input[type=file] { margin: 10px auto; max-width: 420px; }
.invwrap { display: grid; grid-template-columns: minmax(260px, 36%) minmax(0, 1fr); gap: 16px; align-items: start; }
.invprev { position: sticky; top: 110px; padding: 8px; max-height: calc(100vh - 130px); overflow: auto; }
.invprev iframe { width: 100%; height: calc(100vh - 160px); border: 0; }
.invprev img { width: 100%; cursor: zoom-in; } .invprev img.zoom { width: 200%; cursor: zoom-out; }
.invsum { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 0; font-size: 14px; }
.okc { color: var(--good); font-style: normal; font-weight: 700; } .badc { color: var(--bad); font-style: normal; font-weight: 700; }
pre.rawtext { white-space: pre-wrap; font-size: 12px; max-height: 400px; overflow: auto; background: #f7f8fb; padding: 10px; border-radius: 8px; }
@media (max-width: 900px) { .invwrap { grid-template-columns: 1fr; } .invprev { position: static; } }
.donebar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 8px; font-size: 13px; }
.donebar span { padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.donebar span.ok { background: var(--good-bg); color: var(--good); } .donebar span.wait { background: var(--mid-bg); color: var(--mid); }
table.revedit input, table.revedit select { margin: 0; }
table.revedit input.n { width: 70px; text-align: right; } table.revedit input.w { width: 130px; }
table.revedit td:first-child input { min-width: 220px; }
.copyrow { margin-top: 12px; gap: 14px; } .copyrow form { background: #f6f8fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.copyrow .inline-form { display: flex; gap: 6px; margin: 6px 0; } .copyrow .inline-form input { margin: 0; flex: 1; }
table.revedit input.pt { min-width: 150px; } table.revedit input.iv { width: 110px; }
.waitc { color: var(--mid); font-weight: 600; } 
table.revedit select { min-width: 74px; }
