/* VTKho — giao diện: menu sáng chia nhóm, chữ lớn, số liệu nổi bật, bảng thoáng, nhãn trạng thái có chấm màu.
   Mọi màu là token trên :root; chế độ tối định nghĩa lại token (theo hệ điều hành, hoặc nút chuyển → data-theme). */
@import url('/css/fonts.css');

:root {
  color-scheme: light;
  --brand: #0f766e;
  --brand-hover: #115e59;
  --brand-strong: #0b4f4a;
  --brand-soft: #e3f4f1;
  --brand-soft-2: #c9ebe5;
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #eef2f1;
  --text: #0f1d1b;
  --text-2: #3d4b48;
  --muted: #6b7a77;
  --line: #e2e8e6;
  --line-strong: #cfd8d5;
  --ok: #15803d; --ok-soft: #e4f5e9;
  --warn: #b45309; --warn-soft: #fff3d6;
  --err: #c62828; --err-soft: #fdeaea;
  --info: #1d5fc4; --info-soft: #e6effd;
  --violet: #6d4ed8; --violet-soft: #efeafd;
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e8ecea;
  --shadow-sm: 0 1px 2px rgba(15, 35, 30, .05);
  --shadow: 0 1px 2px rgba(15, 35, 30, .04), 0 6px 20px rgba(15, 35, 30, .06);
  --shadow-lg: 0 24px 60px rgba(10, 25, 22, .22);
  --radius: 16px;
  --radius-sm: 10px;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #2bb5a6; --brand-hover: #4cc8ba; --brand-strong: #7fdcd1; --brand-soft: #123532; --brand-soft-2: #18453f;
    --bg: #0f1413; --surface: #171d1c; --surface-2: #1c2321; --surface-3: #232b29;
    --text: #e8efed; --text-2: #c2cdca; --muted: #8d9b98; --line: #2a3331; --line-strong: #3a4542;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270c; --err: #f87171; --err-soft: #3a1717;
    --info: #6ea8ff; --info-soft: #14243d; --violet: #a78bfa; --violet-soft: #241b3d;
    --series-1: #3987e5; --series-2: #d95926; --grid: #2a3331;
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #2bb5a6; --brand-hover: #4cc8ba; --brand-strong: #7fdcd1; --brand-soft: #123532; --brand-soft-2: #18453f;
  --bg: #0f1413; --surface: #171d1c; --surface-2: #1c2321; --surface-3: #232b29;
  --text: #e8efed; --text-2: #c2cdca; --muted: #8d9b98; --line: #2a3331; --line-strong: #3a4542;
  --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270c; --err: #f87171; --err-soft: #3a1717;
  --info: #6ea8ff; --info-soft: #14243d; --violet: #a78bfa; --violet-soft: #241b3d;
  --series-1: #3987e5; --series-2: #d95926; --grid: #2a3331;
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 650; margin: 0 0 14px; }
h3 { font-size: 15.5px; font-weight: 650; margin: 0 0 10px; }
p { margin: 0 0 8px; }
.hidden, [hidden] { display: none !important; }
.ico { flex: none; display: block; }

/* ================= Khung ================= */
.sidebar { width: 256px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; z-index: 30; }
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: var(--text); text-decoration: none !important; }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(140deg, #14a294, var(--brand) 55%, #0b4f4a); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(15,118,110,.35); }
.logo-text { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.logo-text span { color: var(--brand); }
.org-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; background: var(--surface-2); }
.org-card .ic-wrap { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.org-card .k { font-size: 12px; color: var(--muted); line-height: 1.2; }
.org-card .v { font-size: 14px; font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.nav-group { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 6px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 44px; border-radius: 11px; color: var(--text-2); font-weight: 550; font-size: 15px; text-decoration: none; position: relative; }
#nav a .ico { color: var(--muted); }
#nav a:hover { background: var(--surface-3); color: var(--text); }
#nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
#nav a.active .ico { color: var(--brand); }
#nav a.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 32px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-search { flex: 1; max-width: 520px; position: relative; }
.top-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { width: 100%; height: 42px; padding-left: 42px; border-radius: 12px; background: var(--surface-2); border-color: var(--line); }
.top-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px Inter, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, #14a294, var(--brand)); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.user-btn .nm { font-weight: 650; font-size: 14px; line-height: 1.2; text-align: left; }
.user-btn .rl { font-size: 12px; color: var(--muted); line-height: 1.2; text-align: left; }
.menu-btn { display: none !important; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 9px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); }
.dropdown .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.dropdown .head { padding: 10px 12px 8px; }
.dropdown .item-row { display: flex; gap: 10px; align-items: flex-start; }
.dropdown .item-row .t { font-weight: 600; }
.rel { position: relative; }

#view { padding: 28px 32px 80px; width: 100%; }

/* ================= Đầu trang ================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 750; margin: 0; letter-spacing: -.02em; line-height: 1.2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.back:hover { color: var(--brand); text-decoration: none; }

/* ================= Thành phần ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .seg + .card, .toolbar + .card, .notice + .card { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.panel-head h2 .ico { color: var(--brand); }
.card.flush .panel-head { padding: 20px 22px 0; }
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.xs { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.pos { color: var(--ok); }
.neg { color: var(--err); }
.c-info { color: var(--info); }
.c-warn { color: var(--warn); }
.strong { font-weight: 700; }
.num-lg { font-variant-numeric: normal; }

.btn { font: inherit; font-size: 14.5px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 11px; padding: 0 16px; height: 42px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(15,118,110,.25); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.btn.soft:hover { background: var(--brand-soft-2); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); background: var(--surface); }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea { font: inherit; font-size: 15px; border: 1px solid var(--line-strong); border-radius: 11px; padding: 0 12px; height: 42px; background: var(--surface); color: var(--text); max-width: 100%; }
textarea { width: 100%; min-height: 90px; padding: 10px 12px; height: auto; }
input[type=file] { padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); padding: 0; }
input.num { text-align: right; width: 130px; }
input.qty { text-align: right; width: 96px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--text-2); font-weight: 600; }
label.f > input, label.f > select, label.f > textarea { font-weight: 400; }
label.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form .wide { grid-column: 1 / -1; }
.form-section { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint { font-size: 13.5px; color: var(--muted); }

/* Ô tìm kiếm có biểu tượng */
.search { position: relative; }
.search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; width: 300px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.flush .toolbar { padding: 18px 22px; border-bottom: 1px solid var(--line); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.num { font-weight: 550; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.total td { font-weight: 750; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
tr.sub td { color: var(--muted); font-size: 14px; padding-top: 9px; padding-bottom: 9px; }
tr.sub td:first-child { padding-left: 30px; }
.card.flush th:first-child, .card.flush td:first-child { padding-left: 22px; }
.card.flush th:last-child, .card.flush td:last-child { padding-right: 22px; }
.cell-main { font-weight: 650; color: var(--text); }
.cell-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; font-weight: 600; }
.row-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--brand); }

/* Nhãn trạng thái (có chấm) */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; padding: 4px 11px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.3; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; padding: 3px 10px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); margin: 2px 4px 2px 0; white-space: nowrap; }
.chip b { font-weight: 700; color: var(--text); }

/* Tab dạng nút (segmented) */
.tabs, .seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 13px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs a, .seg a, .seg button { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14.5px; text-decoration: none !important; border: 0; background: none; cursor: pointer; font-family: inherit; }
.tabs a:hover, .seg a:hover, .seg button:hover { color: var(--text); }
.tabs a.active, .seg .active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.tabs .cnt, .seg .cnt { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.tabs a.active .cnt { background: var(--brand-soft); color: var(--brand-strong); }

/* Thẻ chỉ số */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; text-decoration: none !important; color: inherit; transition: border-color .12s, transform .12s; }
a.kpi:hover { border-color: var(--brand); transform: translateY(-1px); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi .ic { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); }
.kpi .ic.info { background: var(--info-soft); color: var(--info); }
.kpi .ic.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .ic.err { background: var(--err-soft); color: var(--err); }
.kpi .ic.ok { background: var(--ok-soft); color: var(--ok); }
.kpi .ic.violet { background: var(--violet-soft); color: var(--violet); }
.kpi .label { font-size: 14px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.kpi .foot { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--err-soft); color: var(--err); }
.delta.flat { background: var(--surface-3); color: var(--muted); }

/* Ô số liệu gọn (trong chi tiết) */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px 24px; }
.facts .k { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.facts .v { font-size: 15.5px; font-weight: 600; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stat-strip > div { padding: 16px 18px; border-right: 1px solid var(--line); background: var(--surface); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-strip .v { font-size: 24px; font-weight: 750; margin-top: 4px; letter-spacing: -.01em; }
.stat-strip .s { font-size: 13px; color: var(--muted); }

/* Danh sách việc / hoạt động */
.feed { display: flex; flex-direction: column; }
.feed > a, .feed > div { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.feed > :last-child { border-bottom: 0; }
.feed > a:hover { background: var(--surface-2); border-radius: 10px; }
.feed .fi { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.feed .fi.ok { background: var(--ok-soft); color: var(--ok); } .feed .fi.warn { background: var(--warn-soft); color: var(--warn); }
.feed .fi.info { background: var(--info-soft); color: var(--info); } .feed .fi.err { background: var(--err-soft); color: var(--err); } .feed .fi.brand { background: var(--brand-soft); color: var(--brand); }
.feed .ft { flex: 1; min-width: 0; }
.feed .ft .t { font-weight: 650; }
.feed .ft .s { font-size: 13.5px; color: var(--muted); }
.feed .fr { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.feed .fr b { display: block; font-size: 15px; color: var(--text); }

/* Thanh tỷ lệ */
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-list .bl-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.bar-list .bl-top b { font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--series-1); }

/* Biểu đồ */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .s1 { fill: var(--series-1); } .chart .s2 { fill: var(--series-2); }
.chart rect.hit { fill: transparent; cursor: default; }
.chart g.col:hover rect.mk, .chart g.col:focus rect.mk { opacity: .8; }
.chart g.col:focus { outline: none; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.s1 { background: var(--series-1); } .legend i.s2 { background: var(--series-2); }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13px; min-width: 170px; z-index: 5; }
.tooltip .tt-h { color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.tooltip .tt-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-r i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tooltip .tt-r b { font-size: 14px; font-variant-numeric: tabular-nums; }

/* Trạng thái trống / thông báo */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state { padding: 56px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state .ei { width: 64px; height: 64px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.empty-state .et { font-size: 18px; font-weight: 700; }
.empty-state .es { color: var(--muted); max-width: 440px; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-soft); color: var(--text); border-radius: 13px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.notice .ico { color: var(--warn); margin-top: 1px; }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.notice.info .ico { color: var(--info); }
.tip { display: inline-flex; color: var(--muted); cursor: help; vertical-align: middle; }

/* Hộp thoại */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 20, 18, .5); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 20px; width: min(640px, 100%); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.modal.wide { width: min(1040px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 20px; font-weight: 750; }
.modal-body { padding: 22px 26px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 20px 20px; }

/* Thông báo nổi */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 12px 16px; border-radius: 13px; max-width: 400px; box-shadow: var(--shadow-lg); font-weight: 550; }
.toast .ico { color: var(--brand); }
.toast.ok .ico { color: var(--ok); }
.toast.err { border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.toast.err .ico { color: var(--err); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Đăng nhập */
body.login-mode .sidebar, body.login-mode .topbar { display: none; }
body.login-mode #view { max-width: none; padding: 0; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(150deg, #0b4f4a 0%, #0f766e 50%, #14a294 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h2 { font-size: 40px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; margin: 0 0 18px; max-width: 520px; }
.login-art p { font-size: 17px; opacity: .85; max-width: 460px; }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 14px; font-size: 16px; }
.login-art li { display: flex; align-items: center; gap: 12px; }
.login-art li span { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-box { width: min(400px, 100%); }
.login-box h1 { font-size: 30px; margin: 22px 0 6px; font-weight: 800; letter-spacing: -.02em; }
.login-box .form { grid-template-columns: 1fr; margin-top: 26px; }
.login-box .btn { height: 48px; font-size: 16px; }

/* Dòng hàng trong phiếu */
.line-add { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.line-add .search { flex: 1; min-width: 260px; }
.line-add .search input { width: 100%; height: 46px; }
.lines-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }

/* ================= Màn hình nhỏ ================= */
@media (max-width: 1180px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex !important; }
  .topbar { padding: 0 16px; gap: 10px; }
  .top-search kbd, .user-btn .who { display: none; }
  #view { padding: 20px 16px 80px; }
  .page-head h1 { font-size: 24px; }
  .search input { width: 100%; }
  .toolbar .search { flex: 1; }
  .table-wrap td:first-child { min-width: 170px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .modal-bg { padding: 0; }
  .modal, .modal.wide { border-radius: 0; min-height: 100vh; }
  .modal .actions { border-radius: 0; position: sticky; bottom: 0; }
}
@media (max-width: 560px) { .cols-4 { grid-template-columns: 1fr; } .kpi .value { font-size: 26px; } }

/* bổ sung */
.toolbar .seg, .toolbar .tabs { margin-bottom: 0; }
.fi-sm { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.fi-sm.ok { background: var(--ok-soft); color: var(--ok); } .fi-sm.err { background: var(--err-soft); color: var(--err); } .fi-sm.info { background: var(--info-soft); color: var(--info); }
.fi-sm.warn { background: var(--warn-soft); color: var(--warn); } .fi-sm.brand { background: var(--brand-soft); color: var(--brand); } .fi-sm.violet { background: var(--violet-soft); color: var(--violet); }
.notice .spacer { flex: 1; }
.notice label.f { min-width: 160px; }
.notice { align-items: center; flex-wrap: wrap; }
.page-head h1 .badge { font-size: 14px; }
.kpi .top .strong { font-size: 16px; margin-top: 2px; }
.facts .wide { grid-column: 1 / -1; }
.feed .fr .badge { margin-top: 4px; }
.page-actions .dropdown { min-width: 320px; }
.money-big { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.person-card .stat-strip { margin: 14px 0; }
.mt-xs { margin-top: 6px; }
td .bar-track { width: 140px; height: 6px; }
.feed .ft a.t { color: var(--text); }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.toolbar label.f { min-width: 160px; }
.person-card .panel-head { margin: 4px 0 12px; }
.person-card .panel-head h3 { margin: 0; }
.role-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.role-opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: 13px; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.role-opt input { margin-top: 3px; accent-color: var(--brand); width: 18px; height: 18px; }
.role-opt > span { display: flex; flex-direction: column; gap: 3px; }
label.chk.chip { padding: 8px 12px; font-size: 14px; }
/* sửa bố cục */
.grid > .card, .grid > .kpi { margin-top: 0 !important; }
.cols-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feed .ft a.t { display: inline; padding: 0; border: 0; }
.panel-head a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.nowrap-flex { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
@media (max-width: 900px) { .cols-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-auto .kpi { padding: 16px; } .cols-auto .kpi .value { font-size: 24px; } .cols-auto .kpi .ic { width: 38px; height: 38px; } }
@media (max-width: 420px) { .cols-auto { grid-template-columns: 1fr; } }
.cell { min-width: 0; }
.row > .cell, .nowrap-flex > .cell { flex: 1; }
label.f { position: relative; }
label.f > .tip { position: absolute; right: 2px; top: 0; }
.person-card .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.person-card .stat-strip .v { font-size: 20px; }
td .row { flex-wrap: nowrap; }
.chart-svg { width: 100%; min-height: 280px; }
.chart-svg svg { width: auto; max-width: none; }

/* ảnh chứng từ */
.dropzone { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); color: var(--text-2); }
.dropzone > .ico { color: var(--brand); }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .att-prog { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
label.link { color: var(--brand); font-weight: 650; cursor: pointer; text-decoration: underline; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.att-grid.sm { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.att-grid:empty { display: none; }
.att { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.att-img { display: block; aspect-ratio: 4 / 3; background: var(--surface-3); }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pdf { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--err); font-weight: 700; font-size: 13px; }
.att-cap { padding: 7px 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-cap span { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.att-del { position: absolute; top: 6px; right: 6px; background: color-mix(in srgb, var(--surface) 85%, transparent) !important; }
.lightbox { position: fixed; inset: 0; background: rgba(5, 12, 11, .92); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 60px 70px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-bar { position: absolute; top: 12px; left: 16px; right: 16px; display: flex; gap: 10px; align-items: center; color: #fff; font-weight: 600; }
.lb-bar span { flex: 1; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-nav.prev { left: 14px; } .lb-nav.next { right: 14px; }
.btn.clip { gap: 4px; min-width: 34px; }

/* ghép mã kênh */
.kpi.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 22px; background: var(--brand-soft); border-bottom: 1px solid var(--line); position: sticky; top: 68px; z-index: 5; }
.bulk-bar .strong { margin-right: 6px; color: var(--brand-strong); }
.sug { display: flex; align-items: center; gap: 10px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.pick.on, .pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.pick input { accent-color: var(--brand); width: 18px; height: 18px; }
td input[type=checkbox], th input[type=checkbox] { vertical-align: middle; }

/* thanh công cụ có ô kèm nhãn (Từ ngày / Đến ngày…): căn theo đáy để ô nhập, nhóm nút, biểu tượng (i) thẳng hàng */
.toolbar { align-items: flex-end; }
.toolbar .seg { padding: 2px; }
.toolbar .seg button, .toolbar .seg a { height: 38px; }
.toolbar > .tip, .toolbar > .small > .tip { align-self: flex-end; height: 42px; display: inline-flex; align-items: center; }
.toolbar > .spacer + .small, .toolbar > .small.muted { align-self: center; }

/* Đồng bộ: khối JSON, khóa API */
pre.json { margin: 0; padding: 12px 14px; background: var(--surface-3); border-radius: 10px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; color: var(--text); }
.key-box { display: flex; gap: 8px; align-items: center; padding: 12px 14px; background: var(--surface-3); border-radius: 10px; font: 600 14px ui-monospace, Consolas, monospace; word-break: break-all; }
.key-box code { flex: 1; }
.map-row { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.map-row.wh { grid-template-columns: 1fr 2fr auto; }
.map-row input, .map-row select { width: 100%; }
@media (max-width: 720px) { .map-row, .map-row.wh { grid-template-columns: 1fr; } }
.flow-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.flow-row:last-child { border-bottom: 0; }
