/* Giao diện sáng, chữ to rõ (Be Vietnam Pro), ô nhập có viền, màu chính xanh dương. */
:root {
  --gray-50: #f6f8fa; --gray-100: #eef1f5; --gray-200: #e3e8ee; --gray-300: #cfd6df; --gray-400: #aab4c0; --gray-500: #8592a0; --gray-600: #5f6b78;
  --gray-700: #444f5b; --gray-800: #2b333c; --gray-900: #151a20;
  --ink: var(--gray-800); --muted: var(--gray-600); --line: var(--gray-200); --bg: #f4f6f9; --panel: #fff;
  --pri: #1d5fa8; --pri-hover: #174d89; --pri-bg: #e8f1fb;
  --blue: #1d6fd1; --blue-bg: #e7f1fd; --green: #1e8a52; --green-bg: #e3f5ea; --orange: #c75d0a; --orange-bg: #fff0e3;
  --red: #c9302c; --red-bg: #fdecec; --yellow: #a26b00; --yellow-bg: #fff6d6; --cyan: #00788f; --cyan-bg: #e0f6fa; --purple: #5b3cc4; --purple-bg: #f1edff;
  --radius: 8px; --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 0 0 1px rgba(16, 24, 40, .06); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18), 0 0 0 1px rgba(16, 24, 40, .08);
  --nav-h: 58px;
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
[x-cloak] { display: none !important; }
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; margin: 0; color: var(--gray-900); }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; color: var(--gray-900); }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
code { background: var(--gray-100); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- Thanh điều hướng trên ---------- */
.navbar { position: sticky; top: 0; z-index: 40; height: var(--nav-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.navbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--gray-900); min-width: 220px; }
.navbar .brand:hover { text-decoration: none; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--pri); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 38px; background: var(--gray-50); }
.search .ico { position: absolute; left: 13px; top: 12px; color: var(--gray-500); pointer-events: none; }
.search .kbd { position: absolute; right: 10px; top: 10px; font-size: 12px; color: var(--gray-500); border: 1px solid var(--gray-300); border-radius: 5px; padding: 0 5px; background: #fff; }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; max-height: 460px; overflow-y: auto; }
.search-pop .grp { font-size: 12px; color: var(--muted); padding: 8px 10px 2px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 6px; color: var(--ink); }
.search-pop a:hover, .search-pop a.on { background: var(--pri-bg); text-decoration: none; }
.search-pop .sub { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.navbar .sp { flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pri-bg); color: var(--pri); display: grid; place-items: center; font-weight: 700; font-size: 15px; cursor: pointer; border: 0; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown-menu .hd { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dropdown-menu a, .dropdown-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--gray-100); text-decoration: none; }

/* ---------- Bố cục ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.side { padding: 14px 12px 40px; position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); overflow-y: auto; background: #fff; border-right: 1px solid var(--line); }
.nav-group { margin: 18px 0 6px; padding: 0 12px; font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: var(--radius); color: var(--gray-700); font-weight: 500; }
.nav a:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.nav a.on { background: var(--pri-bg); color: var(--pri); font-weight: 600; }
.nav .ic { width: 20px; display: grid; place-items: center; color: var(--gray-500); }
.nav a.on .ic { color: var(--pri); }
.main { min-width: 0; }
.content { padding: 0 28px 70px; max-width: 1500px; margin: 0 auto; }
.burger { display: none; }

.page-head { position: sticky; top: var(--nav-h); z-index: 20; background: var(--bg); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 0 14px; }
.page-head .sp { flex: 1; }
.crumbs { width: 100%; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: -2px; }
.crumbs a { color: var(--muted); }
.crumbs span::before { content: "›"; margin-right: 8px; color: var(--gray-400); }
.kbd-hint { font-size: 11px; opacity: .7; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* ---------- Khối ---------- */
.card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.section-title { font-size: 17px; font-weight: 600; color: var(--gray-900); margin: 0 0 14px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 18px 20px; margin: 0; color: var(--ink); display: block; }
.kpi:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.kpi .l { color: var(--muted); font-size: 14px; font-weight: 500; }
.kpi .v { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Khối thu gọn trong form */
.sec + .sec { border-top: 1px solid var(--line); }
.sec-h { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 16px 20px; font: inherit; font-size: 16px; font-weight: 600; color: var(--gray-900); cursor: pointer; text-align: left; }
.sec-h:hover { background: var(--gray-50); }
.sec-h .small { font-weight: 400; flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-h .caret { margin-left: auto; color: var(--gray-500); transition: transform .15s; transform: rotate(-90deg); }
.sec-h .small + .caret { margin-left: 0; }
.sec-h .caret.on { transform: none; }
.sec-b { padding: 0 20px 20px; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; border: 1px solid var(--gray-300); background: #fff; color: var(--gray-800); padding: 0 16px; border-radius: var(--radius);
  cursor: pointer; font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--gray-50); border-color: var(--gray-400); text-decoration: none; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.pri:hover { background: var(--pri-hover); }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #f1c4c2; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--gray-100); }
.btn:disabled { opacity: .5; cursor: default; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Ô nhập ---------- */
input, select, textarea { font: inherit; font-size: 15px; color: var(--gray-900); border: 1px solid var(--gray-300); border-radius: var(--radius); padding: 0 12px; height: 40px; background: #fff; min-width: 0; }
textarea { padding: 9px 12px; min-height: 76px; height: auto; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(29, 95, 168, .15); }
input:disabled, select:disabled, textarea:disabled { background: var(--gray-50); color: var(--gray-800); border-color: var(--gray-200); opacity: 1; }
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--pri); vertical-align: -3px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; color: var(--gray-700); font-weight: 500; }
.field.err input, .field.err select { border-color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 24px; }
.form-grid .wide { grid-column: 1 / -1; }

/* ---------- Bảng ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.t th, .t td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.t th { background: var(--gray-50); font-size: 13px; color: var(--gray-600); font-weight: 600; position: sticky; top: 0; white-space: nowrap; text-transform: none; }
.t td.n, .t th.n { text-align: right; white-space: nowrap; }
.t tbody tr:hover { background: #f8fafc; }
.t tr.click { cursor: pointer; }
.t tfoot td { font-weight: 700; background: var(--gray-50); border-top: 2px solid var(--line); }
.t input, .t select { height: 36px; width: 100%; }
.t input.n { text-align: right; }
.t select { min-width: 100px; }
.modal .t select { min-width: 140px; }
.t .sub td { background: #fbfcfd; font-size: 14px; }
.t td b { color: var(--gray-900); font-weight: 600; }

/* ---------- Nhãn trạng thái ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--gray-100); color: var(--gray-700);
  font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--green-bg); color: var(--green); } .chip.warn { background: var(--orange-bg); color: var(--orange); }
.chip.err { background: var(--red-bg); color: var(--red); } .chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.teal { background: var(--cyan-bg); color: var(--cyan); } .chip.purple { background: var(--purple-bg); color: var(--purple); }
.chip.yellow { background: var(--yellow-bg); color: var(--yellow); }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; } .bold { font-weight: 600; }
.red { color: var(--red); } .green { color: var(--green); }
.progress { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: var(--pri); border-radius: 99px; }

/* ---------- Tab ---------- */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--gray-300); margin: 4px 0 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 0; cursor: pointer; font: inherit; font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs button:hover { color: var(--gray-900); }
.tabs button.on { color: var(--pri); border-color: var(--pri); }

/* ---------- Danh sách có thanh lọc trái ---------- */
.list-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.facets { position: sticky; top: calc(var(--nav-h) + 80px); }
.facet { margin-bottom: 18px; }
.facet h4 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; padding: 0 10px; }
.facet button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: 7px; font: inherit; font-size: 14px; color: var(--gray-700); cursor: pointer; text-align: left; }
.facet button:hover { background: #fff; }
.facet button.on { background: var(--pri-bg); color: var(--pri); font-weight: 600; }
.facet button .c { margin-left: auto; font-size: 12px; color: var(--gray-500); background: var(--gray-100); border-radius: 99px; padding: 0 8px; }
.facet button.on .c { background: #fff; color: var(--pri); }
.facet .clear { color: var(--pri); font-size: 13px; padding: 0 10px; background: none; border: 0; cursor: pointer; }
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list-tools input[type=search], .list-tools .q { flex: 1; min-width: 220px; }

/* ---------- Bình luận & lịch sử ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--gray-200); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--gray-400); }
.tl-item.cmt::before { border-color: var(--pri); background: var(--pri); }
.tl-item .who { font-weight: 600; color: var(--gray-900); }
.tl-item .when { color: var(--muted); font-size: 13px; margin-left: 6px; }
.tl-item .txt { margin-top: 3px; color: var(--gray-700); white-space: pre-wrap; word-break: break-word; }
.tl-item.cmt .txt { background: var(--gray-50); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; color: var(--gray-900); }
.comment-box { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.comment-box textarea { min-height: 48px; }

/* ---------- Hộp thoại ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: grid; place-items: start center; padding: 50px 14px; overflow-y: auto; z-index: 60; }
.modal { background: #fff; border-radius: 12px; width: min(860px, 100%); box-shadow: var(--shadow-lg); }
.modal.wide { width: min(1240px, 100%); }
.modal header { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; flex: 1; font-size: 18px; }
.modal .body { padding: 20px 22px; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.alert { padding: 12px 14px; border-radius: var(--radius); background: var(--red-bg); color: #9b1c1c; margin-bottom: 14px; }
.alert.info { background: var(--blue-bg); color: #164f93; } .alert.warn { background: var(--yellow-bg); color: #6b4700; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 99; max-width: 440px; }
.toast { background: #fff; color: var(--gray-900); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); border-left: 4px solid var(--green); }
.toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--orange); }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #eaf2fb, #f6f8fa); }
.login .card { width: min(420px, 100%); padding: 32px; }
.login .brand { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; font-weight: 700; font-size: 17px; color: var(--gray-900); }
.login .brand .logo { width: 42px; height: 42px; font-size: 16px; }
.stack > * + * { margin-top: 14px; }

/* ---------- Tổng quan ---------- */
.ws-title { font-size: 17px; font-weight: 700; color: var(--gray-900); margin: 26px 0 12px; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px 18px; font-weight: 600; color: var(--gray-900); }
.shortcut:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.shortcut > .bar { flex-wrap: nowrap; min-width: 0; color: var(--gray-800); }
.shortcut > .bar svg { color: var(--pri); }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.link-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px 20px; }
.link-card h4 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--gray-900); }
.link-card a { display: block; padding: 5px 0; color: var(--gray-700); }
.link-card a:hover { color: var(--pri); }
.chart { display: flex; align-items: flex-end; gap: 8px; overflow: hidden; height: 210px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .stack-bar { width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; height: 175px; justify-content: flex-start; }
.chart .stack-bar i { display: block; width: 100%; }
.chart .stack-bar i:last-child { border-radius: 4px 4px 0 0; }
.chart .lb { font-size: 12px; color: var(--muted); white-space: nowrap; }
.c0 { background: #2f74c0; } .c1 { background: #17a2b8; } .c2 { background: #f0a020; } .c3 { background: #2f9e5b; } .c4 { background: #d9534f; } .c5 { background: #7a5bd1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.unit-card { border-radius: var(--radius); padding: 14px 16px; background: var(--gray-50); border: 1px solid var(--line); }
.unit-card .t1 { font-weight: 700; color: var(--gray-900); }
.cont-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.kg-over { color: var(--red); font-weight: 700; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--pri), #6fb1f2, var(--pri)); z-index: 100; animation: busy 1s infinite linear; background-size: 200% 100%; }
@keyframes busy { from { background-position: 0 0; } to { background-position: 200% 0; } }

@media (max-width: 1150px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } .list-layout { grid-template-columns: 1fr; } .facets { position: static; display: flex; flex-wrap: wrap; gap: 6px 18px; } .facet { margin-bottom: 6px; } }
@media (max-width: 760px) {
  :root { font-size: 15px; --nav-h: 56px; }
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 70; left: 0; top: 0; height: 100vh; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .burger { display: inline-flex; }
  .navbar { padding: 0 10px; gap: 8px; }
  .navbar .brand { min-width: 0; }
  .navbar .brand span, .navbar > .chip { display: none; }
  .content { padding: 0 12px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .kpi .v { font-size: 22px; }
  .search .kbd { display: none; }
  .modal-bg { padding: 10px 6px; }
  .chart .lb { font-size: 10px; transform: rotate(-45deg); }
  .search { max-width: none; }
  h1 { font-size: 20px; }
}

/* ===================== Menu nhóm (accordion) + menu thu nhỏ + menu ngang ===================== */
.nav { display: flex; flex-direction: column; gap: 2px; }
.ng-h { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: var(--radius);
  font: inherit; font-size: 15px; font-weight: 600; color: var(--gray-800); cursor: pointer; text-align: left; }
.ng-h:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.ng-h .ic { width: 22px; display: grid; place-items: center; color: var(--gray-500); flex: none; }
.ng-h .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ng-h .cnt { font-size: 12px; font-weight: 600; color: var(--gray-500); background: var(--gray-100); border-radius: 99px; padding: 0 7px; }
.ng-h .chev { color: var(--gray-400); transition: transform .18s; transform: rotate(-90deg); display: grid; }
.ng.open .ng-h .chev { transform: none; }
.ng.act > a.ng-h, a.ng-h.on { background: var(--pri-bg); color: var(--pri); }
.ng.act .ng-h .ic, a.ng-h.on .ic { color: var(--pri); }
.ng.act:not(.open) > div > .ng-h { color: var(--pri); }
.ng-b { margin: 2px 0 8px 23px; padding-left: 12px; border-left: 2px solid var(--gray-200); display: flex; flex-direction: column; gap: 1px; }
.ng-b a { display: block; padding: 7px 12px; border-radius: 7px; color: var(--gray-600); font-size: 14px; font-weight: 500; position: relative; }
.ng-b a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.ng-b a.on { color: var(--pri); background: var(--pri-bg); font-weight: 600; }
.ng-b a.on::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 2px; background: var(--pri); border-radius: 2px; }
.ng-t { display: none; }
.side { display: flex; flex-direction: column; }
.side .nav { flex: 1; }
.side-toggle { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 9px 12px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--gray-500); font: inherit; font-size: 13px; cursor: pointer; border-radius: 0; }
.side-toggle:hover { color: var(--gray-900); }

/* Menu thu nhỏ: chỉ còn biểu tượng, bấm hiện bảng menu con bay ra bên phải */
.layout.ms-mini { grid-template-columns: 72px minmax(0, 1fr); }
.ms-mini .side { padding: 12px 10px; overflow: visible; z-index: 30; }
.ms-mini .ng { position: relative; }
.ms-mini .ng-h { justify-content: center; padding: 11px 0; }
.ms-mini .ng-h .lbl, .ms-mini .ng-h .cnt, .ms-mini .ng-h .chev, .ms-mini .side-toggle .lbl { display: none; }
.ms-mini .ng.act .ng-h { background: var(--pri-bg); }
.ms-mini .ng-b { position: absolute; left: 60px; top: -4px; z-index: 80; margin: 0; padding: 8px; min-width: 230px; background: #fff; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.ms-mini .ng-t { display: block; padding: 6px 12px 8px; font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.ms-mini .ng-b a.on::before { display: none; }
.ms-mini .side-toggle { justify-content: center; padding: 10px 0; }

/* Menu ngang dạng tab */
.topnav { position: sticky; top: var(--nav-h); z-index: 35; display: flex; gap: 4px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tn-item { position: relative; }
.tn-h { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--gray-600); cursor: pointer; white-space: nowrap; }
.tn-h:hover { color: var(--gray-900); text-decoration: none; }
.tn-h.on { color: var(--pri); border-bottom-color: var(--pri); }
.tn-h .chev { display: grid; color: var(--gray-400); transition: transform .18s; }
.tn-h.open .chev { transform: rotate(180deg); }
.tn-pop { position: fixed; margin-top: 2px; min-width: 240px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 90; }
.tn-pop a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--gray-700); font-size: 14px; font-weight: 500; }
.tn-pop a:hover { background: var(--gray-100); text-decoration: none; }
.tn-pop a.on { background: var(--pri-bg); color: var(--pri); font-weight: 600; }
.layout.ms-ngang { grid-template-columns: minmax(0, 1fr); }
.ms-ngang .side { display: none; }
.ms-ngang .page-head { top: calc(var(--nav-h) + 49px); }

/* Mục trong menu tài khoản */
.dd-label { padding: 8px 12px 4px; font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.dd-sep { height: 1px; background: var(--line); margin: 6px 0; }
.dropdown-menu button.on { color: var(--pri); font-weight: 600; }
.dropdown-menu .tick { display: inline-block; width: 18px; color: var(--pri); }

@media (max-width: 760px) {
  .layout.ms-mini, .layout.ms-ngang { grid-template-columns: 1fr; }
  .ms-mini .side, .ms-ngang .side { display: flex; width: 280px; padding: 14px 12px; }
  .ms-mini .ng-h { justify-content: flex-start; padding: 10px 12px; }
  .ms-mini .ng-h .lbl, .ms-mini .ng-h .cnt, .ms-mini .ng-h .chev { display: initial; }
  .ms-mini .ng-b { position: static; box-shadow: none; margin: 2px 0 8px 23px; padding: 0 0 0 12px; border-left: 2px solid var(--gray-200); min-width: 0; }
  .ms-mini .ng-t { display: none; }
  .topnav { padding: 0 8px; }
  .side-toggle { display: none; }
}

/* ===================== Điện thoại: không tràn ngang, danh sách dạng thẻ ===================== */
.grid > *, .list-layout > *, .layout > *, .content > * { min-width: 0; }
.only-mobile { display: none; }
.m-cards { display: flex; flex-direction: column; }
.m-card { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.m-card:hover { background: var(--gray-50); text-decoration: none; }
.m-card .r1 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.m-card .t { font-weight: 700; color: var(--gray-900); font-size: 16px; }
.m-card .r2 { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.m-card .r2 b { color: var(--gray-800); font-weight: 600; }
.m-card .progress { margin-top: 8px; }
.m-card .act { margin-top: 10px; }
@media (max-width: 760px) {
  .g2, .g3, .g4, .list-layout { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: block; }
  .only-desktop { display: none !important; }
  .page-head { position: static; padding: 14px 0 10px; }
  .page-head .bar { width: 100%; }
  .shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shortcut { padding: 12px; font-size: 14px; }
  .shortcut .chip { display: none; }
  .facets { gap: 4px 10px; }
  .facet { width: 100%; margin-bottom: 4px; }
  .facet > div, .facet { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .facet h4 { width: 100%; padding: 0; margin: 4px 0 0; }
  .facet button { width: auto; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; }
  .card { padding: 16px; }
  .list-tools .q { min-width: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tabs { gap: 18px; }
  .t th, .t td { padding: 10px 10px; }
}
.only-mobile-inline { display: none; }
@media (max-width: 760px) {
  .only-mobile-inline { display: inline-flex; }
  .facets { display: none !important; }
  .facets.show { display: flex !important; flex-wrap: wrap; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px 14px; }
  .list-layout > div:last-child { order: 2; }
  .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .l { font-size: 13px; }
  .kpi .v { font-size: 19px; }
  .kpi .s { font-size: 12px; }
}

/* Báo cáo XK theo năm */
.t th.hl { background: #fff1df; color: #b8650a; }
.t td.hl { color: #b8650a; font-weight: 700; }
.warn-box { border-left: 4px solid #d97706; background: #fffbeb; }
.t td.lh { min-width: 170px; }
.t td.wd { min-width: 240px; }

/* Số dư đầu kỳ */
.num-in { width: 170px; text-align: right; font-variant-numeric: tabular-nums; }
.t tr.chg td { background: #fffbeb; }

/* ===================== Điện thoại: thanh tab dưới, tìm kiếm gọn, thẻ thông tin ===================== */
.tabbar, .s-btn, .s-close, .m-title, .drawer-bg, .m-total { display: none; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 10px 0 0; }
.kv > div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv dd { margin: 1px 0 0; font-size: 14.5px; font-weight: 600; color: var(--gray-900); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.m-card.click { cursor: pointer; }
.m-card.click:active { background: var(--gray-100); }
@media (max-width: 760px) {
  :root { --tab-h: 62px; }
  body { -webkit-tap-highlight-color: transparent; }
  /* Thanh trên: logo + tên màn hình + tìm kiếm + tài khoản */
  .navbar { height: 54px; box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
  .navbar .burger { display: none; }
  .navbar .brand .logo { width: 32px; height: 32px; font-size: 13px; }
  .m-title { display: block; flex: 1; min-width: 0; font-weight: 700; font-size: 16px; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .navbar > .sp { display: none; }
  .search { display: none; }
  .s-btn { display: inline-flex; width: 40px; height: 40px; padding: 0; justify-content: center; color: var(--gray-700); }
  .navbar.s-open .search { display: block; position: absolute; left: 8px; right: 8px; top: 7px; max-width: none; z-index: 5; }
  .navbar.s-open .search input { height: 40px; background: #fff; border-color: var(--pri); padding-right: 40px; font-size: 16px; }
  .navbar.s-open .s-close { display: grid; place-items: center; position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; background: none; color: var(--gray-500); font-size: 16px; }
  .search-pop { position: fixed; top: 54px; left: 0; right: 0; max-height: calc(100vh - 54px - var(--tab-h)); border-radius: 0 0 12px 12px; }
  .avatar { width: 34px; height: 34px; }
  /* Thanh tab dưới đáy */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97); backdrop-filter: saturate(1.6) blur(10px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; font: inherit;
    font-size: 11.5px; font-weight: 600; color: var(--gray-500); cursor: pointer; position: relative; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .on { color: var(--pri); }
  .tabbar .on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--pri); }
  .drawer-bg { display: block; position: fixed; inset: 0; background: rgba(15, 23, 32, .42); z-index: 66; }
  .side { z-index: 68; height: calc(100vh - var(--tab-h)); width: 300px; padding-top: 16px; border-radius: 0 16px 16px 0; }
  .content { padding: 0 12px calc(var(--tab-h) + 28px); }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px); max-width: none; }
  /* Tiêu đề trang + nút thao tác */
  .page-head { gap: 8px; padding: 14px 0 12px; }
  .page-head h1 { width: 100%; font-size: 21px; line-height: 1.3; }
  .page-head .sp { display: none; }
  .page-head .btn { height: 36px; padding: 0 13px; font-size: 14px; }
  .page-head .crumbs { display: none; }
  /* Thẻ, bảng, form */
  .card { border-radius: 12px; margin-bottom: 12px; }
  .card.bar, .card > .bar { gap: 8px; }
  .card.bar input[type=date], .card .bar input[type=date] { flex: 1 1 140px; min-width: 0; }
  .card.bar > .btn.pri { flex: 1 1 100%; justify-content: center; }
  .m-card { padding: 14px 16px; }
  .m-card .r1 .small { text-align: right; }
  .m-total { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 16px; background: var(--pri-bg); border-top: 1px solid var(--line); }
  .m-total div { display: flex; flex-direction: column; font-size: 12px; color: var(--gray-600); }
  .m-total b { font-size: 15px; color: var(--pri); font-variant-numeric: tabular-nums; }
  .grid.units { grid-template-columns: minmax(0, 1fr); }
  .tabs { gap: 20px; margin: 4px -12px 14px; padding: 0 12px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  input, select, textarea { font-size: 16px; }
  .num-in { width: 120px; }
  /* Hộp thoại: dạng tấm trượt từ dưới lên, toàn màn hình */
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; border-radius: 16px 16px 0 0; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
  .modal .body { overflow-y: auto; padding: 16px; }
  .modal header { padding: 14px 16px; }
  .modal footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); position: sticky; bottom: 0; background: #fff; }
  .modal footer .btn { flex: 1; justify-content: center; }
}

/* Chuông việc cần xử lý */
.bell { position: relative; }
.bell-btn { width: 40px; height: 40px; padding: 0; justify-content: center; color: var(--gray-700); position: relative; }
.bell-btn .badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.bell-btn .badge.err { background: var(--red); }
.todo-pop { width: 400px; padding: 0; overflow: hidden; }
.todo-hd { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.todo-list { max-height: min(480px, 70vh); overflow-y: auto; }
.todo-it { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.todo-it:hover { background: var(--gray-50); text-decoration: none; }
.todo-it .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: var(--gray-400); }
.todo-it.err .dot { background: var(--red); } .todo-it.warn .dot { background: var(--orange); } .todo-it.info .dot { background: var(--blue); }
.todo-it .tt { font-weight: 600; font-size: 14.5px; color: var(--gray-900); }
.todo-it .ds { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 2px; }
.todo-it .ng { font-weight: 600; color: var(--gray-600); }
.todo-it.err .ng { color: var(--red); } .todo-it.warn .ng { color: var(--orange); }
@media (max-width: 760px) {
  .todo-pop { position: fixed; top: 54px; left: 0; right: 0; width: auto; border-radius: 0 0 14px 14px; }
  .todo-list { max-height: calc(100vh - 54px - var(--tab-h) - 60px); }
}

/* Quyết toán DN ủy thác */
.settle-sum { border-left: 5px solid var(--gray-400); }
.settle-sum.pay { border-left-color: var(--orange); } .settle-sum.recv { border-left-color: var(--green); }
.settle-sum .big { font-size: 20px; font-weight: 700; color: var(--gray-900); margin: 4px 0 6px; }
.settle-sum.pay .big { color: var(--orange); } .settle-sum.recv .big { color: var(--green); }
.settle-kv { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.settle-kv dd.b { color: var(--pri); font-size: 16px; }
.t td.green { color: var(--green); font-weight: 600; } .t td.orange { color: var(--orange); font-weight: 600; }
@media (max-width: 1150px) { .settle-kv { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .settle-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } .settle-sum .big { font-size: 17px; } }
@media (min-width: 761px) { .only-mobile, .m-cards.only-mobile, .m-total.only-mobile { display: none !important; } }
