/* ===== Nền tảng ===== */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--bg-body);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.neg { color: var(--danger-text); }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Khung ứng dụng ===== */
.top-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-height);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.toggle-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; color: var(--text-secondary);
}
.toggle-menu-btn:hover { background: var(--bg-hover); }
.logo { display: flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 700; font-size: 17px; white-space: nowrap; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo .icon { width: 22px; height: 22px; }
.logo small { font-weight: 500; font-size: 12px; color: var(--text-muted); }
.context-bar { display: flex; align-items: center; gap: 8px; margin-left: 12px; flex: 1; min-width: 0; }
.context-bar label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.context-bar label { flex: 0 1 auto; min-width: 0; }
.context-bar select { height: 32px; max-width: 260px; min-width: 120px; }
.user-menu { display: flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; }
.user-name { font-weight: 500; color: var(--text); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-secondary); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--primary); }

.main-container { display: flex; padding-top: var(--header-height); min-height: 100vh; }
.sidebar {
  position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 40;
  width: var(--sidebar-width);
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 10px 0 24px;
  transition: transform .2s ease;
}
.menu-group { margin-top: 10px; }
.menu-group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 11px 20px; border: 0; border-left: 3px solid #8fc9f5;
  background: #304b64; color: #fff; font: inherit; font-size: 13px;
  font-weight: 800; line-height: 1.4; letter-spacing: .025em; text-transform: uppercase;
  text-align: left; cursor: pointer;
}
.menu-group-title:hover { background: #284158; }
.menu-group-title:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.menu-group-chevron { flex-shrink: 0; font-size: 22px; line-height: 1; }
.menu-group-title[aria-expanded="true"] .menu-group-chevron { transform: rotate(90deg); }
.menu-list[hidden] { display: none; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-item a {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 20px;
  color: var(--sidebar-text); text-decoration: none; border-left: 3px solid transparent;
}
.menu-item a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-hover); text-decoration: none; }
.menu-item.active a { background: var(--sidebar-active); color: #fff; border-left-color: var(--success); font-weight: 500; }
.menu-item .icon { width: 17px; height: 17px; opacity: .9; }
.content-area { flex: 1; min-width: 0; margin-left: var(--sidebar-width); padding: 16px 20px 32px; }
.mobile-overlay { display: none; }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .content-area { margin-left: 0; }

@media (max-width: 1100px) {
  .context-bar label span, .logo small { display: none; }
  .context-bar select { max-width: 190px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .content-area { margin-left: 0; padding: 12px 16px 24px; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .mobile-overlay { display: block; position: fixed; inset: var(--header-height) 0 0 0; background: rgba(0,0,0,.3); z-index: 39; }
  .top-nav { flex-wrap: wrap; height: auto; min-height: var(--header-height); padding: 7px 12px; }
  .context-bar { order: 3; flex-basis: 100%; margin: 4px 0 0; overflow-x: auto; }
  .main-container { padding-top: 92px; }
  .sidebar { top: 92px; }
  .user-name { display: none; }
  .logo small { display: none; }
}

/* ===== Tiêu đề trang & thanh công cụ ===== */
.page-header-panel {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 10px 14px; margin-bottom: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.ph-title { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: var(--primary-dark); text-transform: uppercase; letter-spacing: .01em; }
.ph-title .icon { width: 20px; height: 20px; color: var(--primary); }
.ph-sub { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.page-header-panel .crumbs { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }

/* ===== Nút ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--button-height); padding: 0 14px;
  border: 1px solid var(--border-input); border-radius: 2px;
  background: #fff; color: var(--text-secondary);
  font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success-strong); border-color: var(--success-strong); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0b8165; border-color: #0b8165; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger-text); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: var(--danger-hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 0; height: auto; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 2px 2px 0; }
.btn-group .btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); z-index: 1; }

/* Menu thả xuống (xuất Excel/PDF/Word) */
.dropdown { position: relative; display: inline-flex; }
.dropdown .btn .caret { width: 14px; height: 14px; margin-left: -2px; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; min-width: 190px; padding: 4px 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 14px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; white-space: nowrap; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-hover); color: var(--primary-dark); outline: none; }
.file-tag { display: inline-block; min-width: 42px; padding: 2px 0; border-radius: 2px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-align: center; }
.file-xlsx { background: #1d6f42; }
.file-pdf { background: #b30b00; }
.file-docx { background: #2b579a; }

/* ===== Thẻ & lưới ===== */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .grid > .card, .row > .card { margin-top: 0; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); }
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary-dark); text-transform: uppercase; }
.card-header .toolbar { margin-left: auto; }
.card-body { padding: 14px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.split-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .split-layout { grid-template-columns: minmax(0, 1fr); } }

/* Bảng điều hướng bộ lọc bên trái (kiểu "Tất cả phiếu") */
.facet-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0; }
.facet-title { padding: 8px 14px 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.facet-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 14px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text-secondary);
}
.facet-item:hover { background: var(--bg-hover); }
.facet-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.facet-item .count { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 10px; background: #eef2f6; font-size: 12px; text-align: center; }

/* ===== KPI ===== */
.kpi { padding: 14px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--text-muted); }
.kpi .icon.bg { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; color: var(--primary); opacity: .18; }

/* ===== Bảng dữ liệu ===== */
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.tall { max-height: calc(100vh - 230px); }
table.kt-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.kt-table th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 10px; background: var(--bg-muted); border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; text-align: left; white-space: nowrap;
}
.kt-table th.num { text-align: right; }
.kt-table th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.kt-table th button.sort:focus-visible { outline: 2px solid var(--primary); }
.kt-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.kt-table tbody tr:hover td { background: var(--bg-hover); }
.kt-table tbody tr.clickable { cursor: pointer; }
.kt-table tbody tr.clickable:focus-visible td { background: var(--primary-light); outline: none; }
.kt-table tfoot td { position: sticky; bottom: 0; background: #f4f7fa; font-weight: 700; color: var(--text); border-top: 1px solid var(--border); }
.kt-table tr.group-row td { background: #f9fafb; font-weight: 700; color: var(--primary-dark); }
.kt-table .stt { width: 48px; color: var(--text-muted); text-align: center; }
.table-state { padding: 36px 16px; text-align: center; color: var(--text-muted); }
.table-state .icon { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: .6; }
.table-state.error { color: var(--danger-text); }
.pager { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border-light); font-size: 13px; flex-wrap: wrap; }
.pager .spacer { flex: 1; }

/* ===== Badge trạng thái ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.badge-draft { background: #eef2f6; color: #475569; }
.badge-approved { background: var(--info-bg); color: var(--info-text); }
.badge-posted { background: var(--success-bg); color: var(--success-text); }
.badge-open { background: var(--success-bg); color: var(--success-text); }
.badge-review { background: var(--warning-bg); color: var(--warning-text); }
.badge-locked { background: var(--danger-bg); color: var(--danger-text); }
.badge-warn { background: var(--warning-bg); color: var(--warning-text); }
.badge-muted { background: #f1f5f9; color: #64748b; }
.badge-info { background: var(--info-bg); color: var(--info-text); }

/* ===== Biểu mẫu ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-group.span-2 { grid-column: span 2; }
.form-group.full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-group.span-2 { grid-column: auto; } }
.form-group > label, .form-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-group .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; height: var(--control-height); padding: 0 10px;
  border: 1px solid var(--border-input); border-radius: 2px; background: #fff; color: var(--text);
}
textarea.form-control { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
select.form-control { padding-right: 6px; }
.form-control:focus { border-color: var(--primary); box-shadow: var(--focus-ring); outline: none; }
.form-control:disabled, .form-control[readonly] { background: var(--bg-input-disabled); color: var(--text-secondary); }
.form-control[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(253, 57, 122, .15); }
.form-control.num { text-align: right; }
.field-error { color: var(--danger-text); font-size: 12px; min-height: 0; }
.field-hint { color: var(--text-muted); font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.filter-bar .form-group { min-width: 140px; }
.filter-bar .grow { flex: 1; min-width: 200px; }

/* ===== Thông báo ===== */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); border: 1px solid; font-size: 13px; }
.alert .icon { margin-top: 1px; }
.alert-info { background: var(--info-bg); border-color: #c7d3fa; color: var(--info-text); }
.alert-warning { background: var(--warning-bg); border-color: #ffd9a8; color: var(--warning-text); }
.alert-danger { background: var(--danger-bg); border-color: #fbb6cb; color: var(--danger-text); }
.alert-success { background: var(--success-bg); border-color: #9ee6c9; color: var(--success-text); }
.alert + .alert, .alert + .card, .card + .alert { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== Hộp thoại ===== */
dialog.kt-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); color: var(--text-secondary);
}
dialog.kt-dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog.kt-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.dialog-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.dialog-header h3 { font-size: 16px; color: var(--primary-dark); font-weight: 700; }
.dialog-header .icon-btn { margin-left: auto; }
.dialog-body { padding: 16px; overflow: auto; max-height: calc(100vh - 180px); }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-light); background: #fafbfc; }

/* ===== Toast ===== */
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); background: #1f2937; color: #fff; box-shadow: var(--shadow-lg); font-size: 13px; }
.toast.success { background: #065f46; }
.toast.error { background: #9f1239; }

/* ===== Thanh tải ===== */
#apiLoadingBar { position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 999; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
#apiLoadingBar.show { opacity: 1; }
#apiLoadingBar .bar { position: absolute; top: 0; left: -40%; height: 100%; width: 40%; border-radius: 3px; background: var(--primary); animation: barSlide 1.1s ease-in-out infinite; }
@keyframes barSlide { 0% { left: -40%; } 50% { left: 30%; } 100% { left: 100%; } }

/* ===== Đăng nhập & thiết lập ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg-body); }
.login-card { width: min(640px, 100%); background: #fff; border-radius: var(--radius-xl); box-shadow: 0 10px 30px rgba(0, 0, 0, .08); padding: 22px 26px; }
.login-title { text-align: center; color: var(--primary); font-size: 20px; font-weight: 700; margin-bottom: 16px; text-transform: uppercase; }
.login-body { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: center; }
.login-logo { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--border); padding-right: 18px; min-height: 200px; }
.login-logo svg { width: 150px; height: 150px; }
.login-foot { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 10px; }
@media (max-width: 600px) { .login-body { grid-template-columns: 1fr; } .login-logo { border: 0; padding: 0; min-height: 0; } .login-logo svg { width: 90px; height: 90px; } }
.setup-page { max-width: 980px; margin: 0 auto; padding: 24px 16px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--border); font-weight: 500; font-size: 13px; }
.step .n { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: #e2e8f0; font-size: 12px; font-weight: 700; }
.step.done .n { background: var(--success-strong); color: #fff; }
.step.current { border-color: var(--primary); color: var(--primary-dark); }
.step.current .n { background: var(--primary); color: #fff; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--text-muted); font-weight: 600; }
dl.kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* ===== Bút toán ===== */
.journal-head { display: grid; grid-template-columns: 160px 1fr 220px; gap: 12px 16px; }
@media (max-width: 900px) { .journal-head { grid-template-columns: 1fr; } }
.je-table td { padding: 4px 6px; }
.je-table td .form-control { height: 32px; }
.je-table .col-account { min-width: 220px; }
.je-table .col-money { width: 150px; }
.je-table .col-dim { min-width: 140px; }
.je-table .col-del { width: 40px; text-align: center; }
.je-table tbody tr.row-error td { background: #fff5f8; }
.je-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border-light); background: #fafbfc; }
.je-summary .val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.je-summary .ok { color: var(--success-text); }
.je-summary .bad { color: var(--danger-text); }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border-light); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--text-muted); white-space: nowrap; min-width: 128px; }

/* ===== Biểu đồ ===== */
.chart { width: 100%; height: 220px; display: block; }
.chart .bar-rev { fill: var(--primary); }
.chart .bar-exp { fill: var(--warning); }
.chart text { font-size: 11px; fill: var(--text-muted); font-family: var(--font-family); }
.chart .axis { stroke: var(--border); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ===== SQL ===== */
.sql-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; }
@media (max-width: 900px) { .sql-layout { grid-template-columns: minmax(0, 1fr); } }
.sql-editor { width: 100%; min-height: 160px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; padding: 10px; border: 1px solid var(--border-input); border-radius: 2px; resize: vertical; tab-size: 2; }
.schema-tree { max-height: calc(100vh - 220px); overflow: auto; font-size: 13px; }
.schema-tree details { border-bottom: 1px solid var(--border-light); }
.schema-tree summary { padding: 6px 10px; cursor: pointer; font-weight: 500; color: var(--text); }
.schema-tree ul { list-style: none; margin: 0; padding: 0 10px 6px 22px; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.schema-tree li button { all: unset; cursor: pointer; }
.schema-tree li button:hover { color: var(--primary); text-decoration: underline; }
.kt-table td.cell-null { color: var(--text-light); font-style: italic; }
.icon.flip { transform: rotate(180deg); }
.bare-outlet { min-height: 100vh; }
input.check { width: 16px; height: 16px; }

/* Màn hình vừa: bảng lọc trái chuyển thành hàng nút phía trên bảng */
@media (max-width: 1200px) {
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .facet-panel { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
  .facet-panel .facet-title { display: none; }
  .facet-item { width: auto; border-radius: 16px; padding: 5px 12px; }
  .facet-item.active { box-shadow: inset 0 0 0 1px var(--primary); }
}
.filter-bar .form-group { flex: 0 1 auto; }
.filter-bar .grow { flex: 1 1 220px; }
.filter-bar select.form-control { max-width: 280px; }
.chart { height: auto; max-height: 260px; }
.card-header { flex-wrap: wrap; }
.je-table { min-width: 940px; }
.je-table td input.num { min-width: 130px; }
.je-table td select { min-width: 110px; }
.je-table .col-account select, .je-table td:nth-child(2) select { min-width: 220px; }

/* Nhập hóa đơn nhiều dòng: giữ nhãn và tổng tiền rõ trên màn hình nhỏ. */
.invoice-line { padding: 16px; margin-bottom: 12px; }
.invoice-line h4 { margin: 0 0 12px; }
fieldset.card { padding: 16px; min-width: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
