:root {
  --pos-ui-bg: #f3f6fa;
  --pos-ui-surface: #ffffff;
  --pos-ui-surface-soft: #f8fafc;
  --pos-ui-border: #b8c5d6;
  --pos-ui-border-strong: #8fa3ba;
  --pos-ui-text: #172033;
  --pos-ui-muted: #64748b;
  --pos-ui-primary: #2563eb;
  --pos-ui-primary-dark: #1d4ed8;
  --pos-ui-danger: #be123c;
  --pos-ui-success: #047857;
  --pos-ui-warning: #b45309;
  --pos-ui-radius: 10px;
  --pos-ui-control-height: 36px;
  --pos-ui-grid-font-size: 13px;
  --pos-ui-font-family: "Manrope", sans-serif;
}

body.pos-ui-v2 {
  color: var(--pos-ui-text);
  background: var(--pos-ui-bg) !important;
  font-family: var(--pos-ui-font-family);
  font-size: 15px;
}

body.pos-ui-v2 button,
body.pos-ui-v2 input,
body.pos-ui-v2 select,
body.pos-ui-v2 textarea {
  font-family: var(--pos-ui-font-family);
}

body.pos-ui-v2 .pos-page-shell,
body.pos-ui-v2 main[class*="pos-"] {
  width: 100%;
  max-width: none;
  padding: 8px 10px;
}

body.pos-ui-v2 .pos-page-shell {
  min-height: 100%;
}

body.pos-ui-v2 .pos-page-topbar,
body.pos-ui-v2 .pos-standard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  margin: -8px -10px 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--pos-ui-border);
  background: var(--pos-ui-surface-soft);
}

body.pos-ui-v2 .pos-page-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

body.pos-ui-v2 .pos-page-topbar-actions:empty {
  display: none;
}

body.pos-ui-v2 .pos-page-title,
body.pos-ui-v2 .pos-standard-title {
  color: var(--pos-ui-text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

body.pos-ui-v2 .pos-page-card,
body.pos-ui-v2 .pos-standard-card,
body.pos-ui-v2 section.rounded-xl,
body.pos-ui-v2 main > section {
  border-color: var(--pos-ui-border) !important;
  border-radius: var(--pos-ui-radius);
  background: var(--pos-ui-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

body.pos-ui-v2 .pos-page-card {
  padding: 10px;
}

body.pos-ui-v2 .pos-page-shell > .bg-white.rounded-xl,
body.pos-ui-v2 .pos-page-shell > form.bg-white.rounded-xl {
  border: 1px solid var(--pos-ui-border) !important;
  border-radius: var(--pos-ui-radius) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}

body.pos-ui-v2 .pos-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--pos-ui-control-height);
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

body.pos-ui-v2 .pos-btn-primary {
  border-color: var(--pos-ui-primary);
  color: #fff;
  background: var(--pos-ui-primary);
}

body.pos-ui-v2 .pos-btn-primary:hover {
  border-color: var(--pos-ui-primary-dark);
  background: var(--pos-ui-primary-dark);
}

body.pos-ui-v2 .pos-btn-secondary,
body.pos-ui-v2 .pos-btn-outline {
  border-color: var(--pos-ui-primary);
  color: var(--pos-ui-primary);
  background: #fff;
}

body.pos-ui-v2 .pos-btn-secondary:hover,
body.pos-ui-v2 .pos-btn-outline:hover {
  background: #eff6ff;
}

body.pos-ui-v2 .pos-btn-danger {
  border-color: #e11d48;
  color: #fff;
  background: #e11d48;
}

body.pos-ui-v2 .pos-btn-danger:hover {
  border-color: #be123c;
  background: #be123c;
}

body.pos-ui-v2 .pos-btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

body.pos-ui-v2 .pos-page-topbar-actions .pos-btn {
  min-height: var(--pos-ui-control-height);
  padding: 6px 13px;
  font-size: 13px;
}

body.pos-ui-v2 .pos-control {
  width: 100%;
  min-height: var(--pos-ui-control-height);
  padding: 6px 10px;
  border: 1px solid var(--pos-ui-border);
  border-radius: 8px;
  color: var(--pos-ui-text);
  background: #fff;
  font-size: 14px;
}

body.pos-ui-v2 textarea.pos-control {
  min-height: 72px;
}

body.pos-ui-v2 .pos-page-card :where(input[type="text"], input[type="search"], input[type="date"], input[type="email"], input[type="number"], input[type="tel"], select, textarea):not(.pos-control):not(.pos-filter-input):not(.pos-column-filter):not(.column-filter) {
  min-height: var(--pos-ui-control-height);
  border-color: var(--pos-ui-border) !important;
  border-radius: 8px !important;
  background: #fff;
}

body.pos-ui-v2 .pos-page-card > :is(h2, h3),
body.pos-ui-v2 .pos-section-head :is(h2, h3, h4, h5) {
  color: var(--pos-ui-text);
  font-weight: 700;
}

body.pos-ui-v2 .pos-page-card + .pos-page-card {
  margin-top: 8px;
}

/* Compatibility surface for legacy functional dialogs. The business markup
   stays intact while every page gets the same radius, border and action bar. */
body.pos-ui-v2 [id$="-modal"] > .relative.bg-white,
body.pos-ui-v2 [id$="Modal"] > .relative.bg-white,
body.pos-ui-v2 [role="dialog"].bg-white {
  border: 1px solid var(--pos-ui-border) !important;
  border-radius: 12px !important;
  background: var(--pos-ui-surface) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2) !important;
}

body.pos-ui-v2 [id$="-modal"] > .relative.bg-white > :first-child,
body.pos-ui-v2 [id$="Modal"] > .relative.bg-white > :first-child {
  border-color: var(--pos-ui-border) !important;
}

body.pos-ui-v2 [id$="-modal"] .pos-modal-actions,
body.pos-ui-v2 [id$="Modal"] .pos-modal-actions {
  border-top: 1px solid var(--pos-ui-border);
  background: var(--pos-ui-surface-soft);
}

body.pos-ui-v2 :is(.tgs-detail-modal-card, .lookup-detail-modal__panel, .quy-modal > .bg-white, .shop-theme-confirm__box) {
  border: 1px solid var(--pos-ui-border) !important;
  border-radius: 12px !important;
  background: var(--pos-ui-surface) !important;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2) !important;
}

/* Page-specific widgets keep their information architecture, but inherit one
   surface language instead of introducing another theme per function. */
body.pos-ui-v2 :is(.dashboard-card, .training-sidebar, .training-content, .lesson-card, .quy-card, .lookup-profile) {
  border: 1px solid var(--pos-ui-border) !important;
  border-radius: var(--pos-ui-radius) !important;
  background: var(--pos-ui-surface) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}

body.pos-ui-v2 .training-sidebar-header {
  border-bottom: 1px solid var(--pos-ui-border);
  border-radius: var(--pos-ui-radius) var(--pos-ui-radius) 0 0;
  color: var(--pos-ui-text);
  background: var(--pos-ui-surface-soft) !important;
}

body.pos-ui-v2 .training-tab-item .tab-trigger.active {
  border-left-color: var(--pos-ui-primary);
  color: var(--pos-ui-primary);
  background: #eff6ff;
}

body.pos-ui-v2 .training-tab-item .tab-trigger.active .tab-icon,
body.pos-ui-v2 .lesson-number {
  color: #fff;
  background: var(--pos-ui-primary) !important;
}

body.pos-ui-v2 .quy-hero {
  border-radius: var(--pos-ui-radius);
  background: var(--pos-ui-primary) !important;
}

body.pos-ui-v2 :is(.lookup-detail-modal__header, .lookup-detail-modal__footer) {
  border-color: var(--pos-ui-border) !important;
  background: var(--pos-ui-surface-soft) !important;
}

body.pos-ui-v2 .pos-text-muted {
  color: var(--pos-ui-muted);
}
body.pos-ui-v2 .pos-text-danger {
  color: var(--pos-ui-danger);
}
body.pos-ui-v2 .pos-text-success {
  color: var(--pos-ui-success);
}

body.pos-ui-v2 .pos-module-app {
  width: 100%;
}

body.pos-ui-v2 .pos-module-app > .pos-page-topbar {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--pos-ui-border);
  border-radius: var(--pos-ui-radius);
}

body.pos-ui-v2 .pos-tabs {
  display: flex;
  width: 100%;
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--pos-ui-border);
  border-radius: var(--pos-ui-radius);
  background: var(--pos-ui-surface);
}

body.pos-ui-v2 .pos-tab {
  display: inline-flex;
  min-height: var(--pos-ui-control-height);
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--pos-ui-muted);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

body.pos-ui-v2 .pos-tab:hover {
  color: var(--pos-ui-primary);
  background: #eff6ff;
}

body.pos-ui-v2 .pos-tab.active {
  border-color: var(--pos-ui-primary);
  color: #fff;
  background: var(--pos-ui-primary);
}

body.pos-ui-v2 .pos-panel {
  display: none;
  width: 100%;
}
body.pos-ui-v2 .pos-panel.active {
  display: block;
}
body.pos-ui-v2 .pos-panel.hidden:not(.active) {
  display: none;
}

body.pos-ui-v2 .pos-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pos-ui-border);
}

body.pos-ui-v2 .pos-section-head h5,
body.pos-ui-v2 .pos-section-head p {
  margin: 0;
}

body.pos-ui-v2 .pos-section-head p {
  margin-top: 3px;
  color: var(--pos-ui-muted);
  font-size: 13px;
}

body.pos-ui-v2 .pos-filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(170px, 1fr);
  gap: 8px;
  width: min(100%, 680px);
}

body.pos-ui-v2 .pos-record-list {
  display: grid;
  gap: 8px;
  min-height: 90px;
}

body.pos-ui-v2 .pos-record-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--pos-ui-border);
  border-radius: 8px;
  background: var(--pos-ui-surface);
  cursor: pointer;
}

body.pos-ui-v2 .pos-record-card:hover {
  border-color: var(--pos-ui-border-strong);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.1);
}

body.pos-ui-v2 .pos-record-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--pos-ui-text);
  font-weight: 700;
}

body.pos-ui-v2 .pos-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

body.pos-ui-v2 .pos-actions,
body.pos-ui-v2 .pos-form-actions,
body.pos-ui-v2 .pos-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

body.pos-ui-v2 .pos-checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

body.pos-ui-v2 .pos-toast.show {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: block !important;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--pos-ui-success);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  font-size: 14px;
}

body.pos-ui-v2 .pos-toast:not(.show) {
  display: none;
}

body.pos-ui-v2 .pos-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

body.pos-ui-v2 .pos-modal.hidden {
  display: none;
}

body.pos-ui-v2 .pos-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

body.pos-ui-v2 .pos-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  max-height: 90vh;
  padding: 14px;
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

body.pos-ui-v2 .pos-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pos-ui-border);
}

body.pos-ui-v2 input:not([type="checkbox"]):not([type="radio"]),
body.pos-ui-v2 select,
body.pos-ui-v2 textarea,
body.pos-ui-v2 .pos-filter-input {
  border-width: 1px !important;
  border-style: solid !important;
  border-color: var(--pos-ui-border) !important;
  color: var(--pos-ui-text);
  background: #fff;
  font-size: 14px;
}

body.pos-ui-v2 .pos-filter-input {
  width: 100%;
  margin: 0;
  padding: 0 10px;
  border-radius: 8px;
}

body.pos-ui-v2 .pos-filter-label {
  display: block;
  min-width: 0;
}

body.pos-ui-v2 .pos-filter-label-text {
  display: block;
  margin-bottom: 4px;
  color: var(--pos-ui-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  text-transform: uppercase;
}

body.pos-ui-v2 input:not([type="checkbox"]):not([type="radio"]),
body.pos-ui-v2 select,
body.pos-ui-v2 .pos-filter-input {
  min-height: var(--pos-ui-control-height);
}

body.pos-ui-v2 input:focus,
body.pos-ui-v2 select:focus,
body.pos-ui-v2 textarea:focus {
  border-color: var(--pos-ui-primary) !important;
  outline: 0;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

body.pos-ui-v2 .pos-filter-grid,
body.pos-ui-v2 [class*="filter-grid"] {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

@media (max-width: 767px) {
  body.pos-ui-v2 .pos-filter-grid,
  body.pos-ui-v2 [class*="filter-grid"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  body.pos-ui-v2 .pos-filter-grid.has-extra {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

body.pos-ui-v2 .pos-page-card:has(.pos-filter-grid),
body.pos-ui-v2 section:has([class*="filter-grid"]),
body.pos-ui-v2 .pos-filter-panel {
  padding: 8px !important;
}

body.pos-ui-v2 .pos-filter-panel label {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

body.pos-ui-v2 .pos-group-filter {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

body.pos-ui-v2 .pos-group-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.pos-ui-v2 .pos-group-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--pos-ui-border);
  border-radius: 999px;
  background: var(--pos-ui-surface);
  color: var(--pos-ui-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

body.pos-ui-v2 .pos-group-filter-chip:hover {
  border-color: var(--pos-ui-primary);
  color: var(--pos-ui-primary);
}

body.pos-ui-v2 .pos-group-filter-chip.active {
  border-color: var(--pos-ui-primary);
  background: var(--pos-ui-primary);
  color: #fff;
}

body.pos-ui-v2 .pos-group-filter-count {
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  text-align: center;
  font-size: 11px;
}

body.pos-ui-v2 .pos-group-filter-chip.active .pos-group-filter-count {
  background: rgb(255 255 255 / 22%);
  color: #fff;
}

body.pos-ui-v2 .pos-ui-normalized > .pos-standard-topbar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -8px -10px 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--pos-ui-border);
  background: var(--pos-ui-surface-soft);
}

body.pos-ui-v2 .pos-standard-card {
  padding: 8px !important;
  border: 1px solid var(--pos-ui-border) !important;
  border-radius: var(--pos-ui-radius) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}

body.pos-ui-v2 .pos-smart-grid-wrap {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 190px);
  overflow: auto !important;
  border: 1px solid var(--pos-ui-border);
  border-radius: var(--pos-ui-radius);
  background: var(--pos-ui-surface);
  scrollbar-color: #94a3b8 #eef2f7;
  scrollbar-width: thin;
}

body.pos-ui-v2 .pos-smart-grid-wrap.is-compact {
  max-height: 360px;
}

body.pos-ui-v2 table.pos-smart-grid {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--pos-ui-text);
  font-size: var(--pos-ui-grid-font-size) !important;
  line-height: 1.25;
}

body.pos-ui-v2 table.pos-smart-grid th,
body.pos-ui-v2 table.pos-smart-grid td {
  height: 30px;
  max-width: 0;
  padding: 2px 8px !important;
  overflow: hidden;
  border-right: 1px solid var(--pos-ui-border);
  border-bottom: 1px solid var(--pos-ui-border);
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

body.pos-ui-v2 table.pos-smart-grid th:last-child,
body.pos-ui-v2 table.pos-smart-grid td:last-child {
  border-right: 0;
}

body.pos-ui-v2 table.pos-smart-grid thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  color: #172033;
  background: #eaf0f7 !important;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

body.pos-ui-v2 table.pos-smart-grid thead tr.pos-smart-grid-filter-row th,
body.pos-ui-v2 table.pos-smart-grid thead tr[class*="filter-row"] th {
  top: 30px;
  z-index: 4;
  height: 32px;
  padding: 3px 5px !important;
  background: #f8fafc !important;
  cursor: default;
}

body.pos-ui-v2 table.pos-smart-grid .pos-smart-grid-filter {
  width: 100%;
  min-width: 0;
  height: 25px !important;
  min-height: 25px !important;
  padding: 2px 6px !important;
  border: 1px solid #bdc9d8 !important;
  border-radius: 5px;
  font-size: 12px !important;
  font-weight: 400;
}

body.pos-ui-v2 table.pos-smart-grid tbody tr:nth-child(even) td {
  background: #f8fafc;
}

body.pos-ui-v2 table.pos-smart-grid tbody tr:hover td {
  background: #eff6ff;
}

body.pos-ui-v2 table.pos-smart-grid tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 4;
  height: 31px;
  color: #172033;
  background: #eaf0f7 !important;
  font-weight: 700;
  box-shadow: 0 -1px 0 var(--pos-ui-border-strong);
}

body.pos-ui-v2 table.pos-smart-grid th[aria-sort="ascending"]::after,
body.pos-ui-v2 table.pos-smart-grid th[aria-sort="descending"]::after {
  display: inline-block;
  margin-left: 5px;
  color: var(--pos-ui-primary);
  font-size: 10px;
}

body.pos-ui-v2 table.pos-smart-grid th[aria-sort="ascending"]::after {
  content: "▲";
}

body.pos-ui-v2 table.pos-smart-grid th[aria-sort="descending"]::after {
  content: "▼";
}

body.pos-ui-v2 .pos-grid-stt {
  width: 54px;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

body.pos-ui-v2 .pos-grid-number,
body.pos-ui-v2 .pos-grid-money {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

body.pos-ui-v2 .pos-grid-empty,
body.pos-ui-v2 .pos-grid-feedback {
  padding: 20px 10px !important;
  color: var(--pos-ui-muted);
  text-align: center !important;
}

body.pos-ui-v2 .pos-grid-reset-btn {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--pos-ui-border-strong);
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}

body.pos-ui-v2 .pos-grid-reset-btn:hover {
  border-color: var(--pos-ui-primary);
  color: var(--pos-ui-primary);
  background: #eff6ff;
}

body.pos-ui-v2 .pos-page-topbar-actions .pos-table-tools {
  padding: 0;
}

.pos-excel-export-btn {
  --pos-excel-export-progress: 0%;
  position: relative;
  isolation: isolate;
  min-width: 128px;
  overflow: hidden;
}

.pos-excel-export-btn::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: var(--pos-excel-export-progress);
  background: linear-gradient(90deg, #0f766e 0%, #16a34a 100%);
  opacity: 0;
  transition:
    width 0.2s ease,
    opacity 0.16s ease,
    background 0.16s ease;
}

.pos-excel-export-btn.is-exporting::before,
.pos-excel-export-btn.is-export-complete::before,
.pos-excel-export-btn.is-export-error::before {
  opacity: 1;
}

.pos-excel-export-btn.is-export-error::before {
  background: #dc2626;
}

.pos-excel-export-btn .pos-excel-export-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pos-excel-export-btn:disabled {
  cursor: wait;
  opacity: 1 !important;
}

body.pos-ui-v2 table.pos-smart-grid td > .rounded-full,
body.pos-ui-v2 table.pos-smart-grid td > span[class*="bg-"] {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
}

body.pos-ui-v2 .pos-form-section {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--pos-ui-border);
  border-radius: var(--pos-ui-radius);
  background: var(--pos-ui-surface);
}

body.pos-ui-v2 .pos-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 9px 10px;
  border-top: 1px solid var(--pos-ui-border);
  background: rgba(248, 250, 252, 0.96);
  backdrop-filter: blur(5px);
}

body.pos-ui-v2 [class*="modal"] > [class*="rounded"],
body.pos-ui-v2 [role="dialog"] {
  border: 1px solid var(--pos-ui-border);
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.28);
}

@media (max-width: 767px) {
  body.pos-ui-v2 .pos-page-shell,
  body.pos-ui-v2 main[class*="pos-"] {
    padding: 6px;
  }

  body.pos-ui-v2 .pos-page-topbar,
  body.pos-ui-v2 .pos-standard-topbar {
    margin: -6px -6px 6px;
    padding: 6px;
  }

  body.pos-ui-v2 .pos-page-topbar-actions {
    gap: 5px;
    overflow-x: auto;
  }

  body.pos-ui-v2 .pos-smart-grid-wrap {
    max-height: calc(100vh - 170px);
  }
}

/* Report-specific column defaults live here so reports share one visual system. */
.pos-stock-report {
  --pos-stock-col-stt: 48px;
  --pos-stock-col-sku: 108px;
  --pos-stock-col-name: 180px;
  --pos-stock-col-alias: 150px;
  --pos-stock-col-qty: 88px;
  --pos-stock-col-price: 104px;
  --pos-stock-col-amount: 118px;
  --pos-stock-col-in_transit: 96px;
  --pos-stock-col-max: 78px;
  --pos-stock-col-need: 100px;
  --pos-stock-col-unit: 58px;
  --pos-stock-freeze-stt: 48px;
  --pos-stock-freeze-sku: 108px;
}

.pos-stock-table-wrap {
  min-height: 300px;
}

.pos-stock-report .stock-negative {
  color: var(--pos-ui-danger);
}

body.pos-ui-v2 .pos-stock-report {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #eef4fb;
}

.pos-stock-workspace {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.pos-stock-workspace.is-filter-collapsed {
  grid-template-columns: 38px minmax(0, 1fr);
}

.pos-stock-report .pos-report-filter-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 4px;
  border-color: #aebfd3;
  background: #f7f9fc;
  box-shadow: none;
}

.pos-stock-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -21px 0 8px 2px;
  padding: 0 6px;
  width: max-content;
  color: #24364d;
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 700;
}

.pos-stock-filter-title button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #aebfd3;
  border-radius: 5px;
  color: #2459b8;
  background: #fff;
  font-size: 18px;
  line-height: 1;
}

.pos-stock-workspace.is-filter-collapsed .pos-report-filter-card {
  padding: 6px;
}

.pos-stock-workspace.is-filter-collapsed .pos-stock-filter-title {
  margin: -17px auto 0;
  padding: 0;
  background: transparent;
}

.pos-stock-workspace.is-filter-collapsed .pos-stock-filter-title span,
.pos-stock-workspace.is-filter-collapsed .pos-group-filter,
.pos-stock-workspace.is-filter-collapsed .pos-stock-result-count,
.pos-stock-workspace.is-filter-collapsed .pos-stock-actions {
  display: none !important;
}

.pos-stock-workspace.is-filter-collapsed .pos-stock-filter-title button {
  transform: rotate(180deg);
}

.pos-stock-report .pos-group-filter {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
}

.pos-stock-report .pos-group-filter-options {
  align-content: flex-start;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}

.pos-stock-report .pos-group-filter-chip {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.pos-stock-result-count {
  flex: 0 0 auto;
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
}

.pos-stock-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #c7d2df;
}

.pos-stock-actions .pos-table-tools {
  display: grid;
  gap: 6px;
  padding: 0;
}

body.pos-ui-v2 .pos-stock-actions .pos-btn,
body.pos-ui-v2 .pos-stock-actions .pos-grid-reset-btn,
body.pos-ui-v2 .pos-stock-actions .pos-excel-export-btn {
  width: 100%;
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.pos-stock-report .pos-stock-table-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 8px;
  border-radius: 4px;
  border-color: #9fb3c9;
  box-shadow: none;
}

body.pos-ui-v2 .pos-stock-report .pos-stock-table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

.pos-stock-report #pos-stock-table {
  min-width: 1128px;
}

body.pos-ui-v2 .pos-stock-report.is-density-compact #pos-stock-table th,
body.pos-ui-v2 .pos-stock-report.is-density-compact #pos-stock-table td {
  height: 24px;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  font-size: 11px;
}

body.pos-ui-v2 .pos-stock-report.is-density-compact #pos-stock-table thead tr:first-child th {
  height: 29px;
}

body.pos-ui-v2 .pos-stock-report.is-density-compact #pos-stock-table thead tr.pos-smart-grid-filter-row th {
  top: 29px;
  height: 27px;
}

body.pos-ui-v2 .pos-stock-report.is-density-compact #pos-stock-table .pos-smart-grid-filter {
  height: 22px !important;
  min-height: 22px !important;
}

.pos-stock-report #pos-stock-table :is(th, td):nth-child(1) {
  position: sticky;
  left: 0;
}

.pos-stock-report #pos-stock-table :is(th, td):nth-child(2) {
  position: sticky;
  left: var(--pos-stock-freeze-stt);
}

.pos-stock-report #pos-stock-table :is(th, td):nth-child(3) {
  position: sticky;
  left: calc(var(--pos-stock-freeze-stt) + var(--pos-stock-freeze-sku));
  box-shadow: 2px 0 0 #9fb3c9;
}

.pos-stock-report #pos-stock-table tbody td:nth-child(-n+3) {
  z-index: 2;
  background: #fff;
}

.pos-stock-report #pos-stock-table tbody tr:nth-child(even) td:nth-child(-n+3) {
  background: #f8fafc;
}

.pos-stock-report #pos-stock-table thead th:nth-child(-n+3) {
  z-index: 7;
}

.pos-stock-report #pos-stock-table thead tr.pos-smart-grid-filter-row th:nth-child(-n+3) {
  z-index: 6;
}

.pos-stock-report #pos-stock-table tfoot td:nth-child(-n+3) {
  z-index: 6;
}

.pos-stock-report #pos-stock-table tfoot td {
  left: auto !important;
  box-shadow: none;
}

.pos-bctk-report {
  --pos-bctk-col-stt: 48px;
  --pos-bctk-col-default: 112px;
  --pos-bctk-col-pbh: 118px;
  --pos-bctk-col-ngay: 138px;
  --pos-bctk-col-sku: 98px;
  --pos-bctk-col-ten: 180px;
  --pos-bctk-col-qty: 64px;
  --pos-bctk-col-dvt: 58px;
  --pos-bctk-col-nhom: 140px;
  --pos-bctk-col-ly_do: 72px;
  --pos-bctk-col-tra_lai: 68px;
  --pos-bctk-col-kh_ten: 150px;
  --pos-bctk-col-kh_dt: 108px;
  --pos-bctk-col-kh_dchi: 170px;
  --pos-bctk-col-kh_ns: 92px;
  --pos-bctk-col-ghi_chu: 150px;
  --pos-bctk-col-nv_ten: 130px;
  --pos-bctk-col-nv_ma: 76px;
  --pos-bctk-col-httt: 104px;
  --pos-bctk-col-kenh: 90px;
  --pos-bctk-col-so_lo: 100px;
  --pos-bctk-col-exp: 92px;
}

/*
 * BẢNG BÁO CÁO KHÔNG ĐƯỢC GIÃN CỘT ĐỀU.
 *
 * Bảng kiểu `width:100%` + auto-layout sẽ đẩy phần thừa vào TỪNG cột một, nên
 * cột nào cũng nở ra dù chỉ chứa một con số nhỏ (STT, ĐVT, SL cần nhập…) — nhìn
 * bảng rời rạc, và Excel xuất theo bề rộng thật của cột nên cũng rộng lem nhem.
 *
 * Cách xử lý giống màn Đơn hàng: cột số/ngắn giữ nguyên bề rộng px đã khai ở
 * trên, phần dư dồn hết vào cột CHỮ dài (tên hàng / tên khách). Cột nào không
 * có width auto mà vẫn bị giãn là do auto-layout — nên ép table-layout fixed.
 */
.pos-stock-report #pos-stock-table,
.pos-bctk-report #pos-bctk-table {
  table-layout: fixed;
  width: 100%;
}

/* Cột chữ dài (tên hàng/tên khách) nhận TOÀN BỘ phần dư. width:auto phải thắng
   width var đang khai inline trên <col> nên cần !important. Cột số/ngắn không
   liệt kê ở đây sẽ giữ nguyên px khai phía trên — không bị giãn đều nữa. */
.pos-stock-report #pos-stock-table col[data-stock-key="name"],
.pos-bctk-report #pos-bctk-table col[data-bctk-key="ten"],
.pos-bctk-report #pos-bctk-table col[data-bctk-key="kh_ten"] {
  width: auto !important;
  min-width: 160px;
}

.pos-report-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

.pos-report-filter-grid .pos-report-filter-search {
  grid-column: span 3;
}

.pos-report-filter-grid.has-kind .pos-report-filter-search {
  grid-column: span 2;
}

.pos-report-filter-grid.is-search-only .pos-report-filter-search {
  grid-column: span 5;
}

.pos-report-filter-card {
  margin-bottom: 8px;
}

.pos-bctk-table-wrap {
  min-height: 260px;
}

.pos-bctk-report .pos-bctk-stt {
  color: #475569;
}

/* Sổ kho theo mặt hàng: bố cục làm việc dạng HTsoft, chỉ áp dụng cho ledger. */
body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"] {
  --pos-bctk-col-stt: 50px;
  --pos-bctk-col-sku: 108px;
  --pos-bctk-col-ten: 250px;
  --pos-bctk-col-default: 88px;
  --pos-bctk-col-ton_dau: 88px;
  --pos-bctk-col-nhap: 68px;
  --pos-bctk-col-nhap_lai: 76px;
  --pos-bctk-col-nhap_nb: 88px;
  --pos-bctk-col-xuat_nb: 88px;
  --pos-bctk-col-xuat_ban: 78px;
  --pos-bctk-col-xuat_tra: 76px;
  --pos-bctk-col-xuat_dc: 102px;
  --pos-bctk-col-dc_signed: 108px;
  --pos-bctk-col-khac: 66px;
  --pos-bctk-col-ton_cuoi: 86px;
  --pos-bctk-col-dvt: 56px;
  --pos-ledger-freeze-stt: 50px;
  --pos-ledger-freeze-sku: 108px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #eef4fb;
}

.pos-ledger-workspace {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.pos-ledger-workspace.is-filter-collapsed {
  grid-template-columns: 38px minmax(0, 1fr);
}

.pos-bctk-report[data-report-type="ledger"] .pos-report-filter-card {
  align-self: stretch;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 4px;
  border-color: #aebfd3;
  background: #f7f9fc;
  box-shadow: none;
}

.pos-ledger-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -21px 0 8px 2px;
  padding: 0 6px;
  width: max-content;
  color: #24364d;
  background: #f7f9fc;
  font-size: 11px;
  font-weight: 700;
}

.pos-ledger-filter-title button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #aebfd3;
  border-radius: 5px;
  color: #2459b8;
  background: #fff;
  font-size: 18px;
  line-height: 1;
}

.pos-ledger-workspace.is-filter-collapsed .pos-report-filter-card {
  padding: 6px;
}

.pos-ledger-workspace.is-filter-collapsed .pos-ledger-filter-title {
  margin: -17px auto 0;
  padding: 0;
  background: transparent;
}

.pos-ledger-workspace.is-filter-collapsed .pos-ledger-filter-title span,
.pos-ledger-workspace.is-filter-collapsed .pos-filter-grid,
.pos-ledger-workspace.is-filter-collapsed .pos-ledger-current-store,
.pos-ledger-workspace.is-filter-collapsed .pos-ledger-actions {
  display: none !important;
}

.pos-ledger-workspace.is-filter-collapsed .pos-ledger-filter-title button {
  transform: rotate(180deg);
}

.pos-bctk-report[data-report-type="ledger"] .pos-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 6px;
}

.pos-bctk-report[data-report-type="ledger"] .pos-report-filter-search,
.pos-bctk-report[data-report-type="ledger"] .pos-filter-grid > .pos-btn {
  grid-column: 1 / -1;
}

.pos-bctk-report[data-report-type="ledger"] .pos-filter-label-text {
  font-size: 11px;
}

.pos-bctk-report[data-report-type="ledger"] .pos-filter-input {
  min-width: 0;
  height: 28px;
  min-height: 28px !important;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 11px !important;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-apply {
  margin-top: 1px;
}

.pos-bctk-report[data-report-type="ledger"] .pos-filter-grid > .pos-btn {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-reset {
  background: #fff;
}

.pos-ledger-current-store {
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #b9c8d9;
  background: #fffde2;
  color: #334155;
  font-size: 11px;
}

.pos-ledger-current-store span,
.pos-ledger-current-store strong {
  display: block;
}

.pos-ledger-current-store strong {
  margin-top: 3px;
  overflow: hidden;
  color: #1755c8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-ledger-actions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #c7d2df;
}

.pos-ledger-actions .pos-table-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0;
}

body.pos-ui-v2 .pos-ledger-actions .pos-btn,
body.pos-ui-v2 .pos-ledger-actions .pos-grid-reset-btn,
body.pos-ui-v2 .pos-ledger-actions .pos-excel-export-btn {
  width: 100%;
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.pos-bctk-report[data-report-type="ledger"] .pos-bctk-table-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 8px;
  border-radius: 4px;
  border-color: #9fb3c9;
  box-shadow: none;
}

.pos-bctk-report[data-report-type="ledger"] .pos-bctk-table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table {
  min-width: 1380px;
  font-size: 12px;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table th,
.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table td {
  height: 29px;
  padding: 4px 7px;
  border-right: 1px solid #b5c1ce;
  border-bottom: 1px solid #c5ced8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 34px;
  color: #172033;
  background: #e8eef5;
  font-weight: 700;
}

/* Smart-grid sinh thêm hàng lọc trong thead. Giữ nó ngay dưới hàng tiêu đề
   thay vì để rule ledger top:0 làm hai hàng chồng lên nhau khi cuộn. */
.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table thead tr.pos-smart-grid-filter-row th {
  top: 34px;
  z-index: 4;
}

/* Giữ nhận diện mặt hàng khi cuộn ngang. Offset được JS cập nhật theo đúng
   độ rộng hiện tại, kể cả sau khi người dùng kéo chỉnh cột. */
.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table :is(th, td):nth-child(1) {
  position: sticky;
  left: 0;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table :is(th, td):nth-child(2) {
  position: sticky;
  left: var(--pos-ledger-freeze-stt);
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table :is(th, td):nth-child(3) {
  position: sticky;
  left: calc(var(--pos-ledger-freeze-stt) + var(--pos-ledger-freeze-sku));
  box-shadow: 2px 0 0 #9fb3c9;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tbody td:nth-child(-n+3) {
  z-index: 2;
  background: #fff;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tbody tr:nth-child(even) td:nth-child(-n+3) {
  background: #f7f9fc;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table thead th:nth-child(-n+3) {
  z-index: 7;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table thead tr.pos-smart-grid-filter-row th:nth-child(-n+3) {
  z-index: 6;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tfoot td:nth-child(-n+3) {
  z-index: 6;
}

body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"].is-density-compact #pos-bctk-table th,
body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"].is-density-compact #pos-bctk-table td {
  height: 24px;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  font-size: 11px;
}

body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"].is-density-compact #pos-bctk-table thead tr:first-child th {
  height: 29px;
}

body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"].is-density-compact #pos-bctk-table thead tr.pos-smart-grid-filter-row th {
  top: 29px;
  height: 27px;
}

body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"].is-density-compact #pos-bctk-table .pos-smart-grid-filter {
  height: 22px !important;
  min-height: 22px !important;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tbody tr:hover {
  background: #dbeafe;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table td[data-bctk-key="sku"],
.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table td[data-bctk-key="ten"] {
  color: #1258d5;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table td[data-bctk-key="ton_cuoi"] {
  color: #ef1010;
  font-weight: 700;
}

.pos-bctk-report[data-report-type="ledger"] #pos-bctk-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #fffde2;
  font-weight: 700;
}

.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-ton_dau { background: #d8d8d8 !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-nhap { background: #159515 !important; color: #fff !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-nhap_lai { background: #dcc19a !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-nhap_nb { background: #df6cdb !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-xuat_nb { background: #efe68d !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-xuat_ban { background: #1515df !important; color: #fff !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-xuat_tra { background: #fff600 !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-xuat_dc { background: #f59e0b !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-dc_signed { background: #fed7aa !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-khac { background: #cbd5e1 !important; }
.pos-bctk-report[data-report-type="ledger"] .pos-bctk-head-ton_cuoi { background: #f20d13 !important; color: #fff !important; }

.pos-ledger-legend {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-top: 1px solid #aebfd3;
  background: #f7f9fc;
  color: #334155;
  font-size: 12px;
}

.pos-ledger-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pos-ledger-legend i { width: 17px; height: 17px; border: 1px solid rgba(0, 0, 0, .08); }
.pos-ledger-legend .is-ton-dau { background: #d8d8d8; }
.pos-ledger-legend .is-nhap { background: #159515; }
.pos-ledger-legend .is-nhap-lai { background: #dcc19a; }
.pos-ledger-legend .is-nhap-nb { background: #df6cdb; }
.pos-ledger-legend .is-xuat-nb { background: #efe68d; }
.pos-ledger-legend .is-xuat-ban { background: #1515df; }
.pos-ledger-legend .is-xuat-tra { background: #fff600; }
.pos-ledger-legend .is-xuat-dc { background: #f59e0b; }
.pos-ledger-legend .is-ton-cuoi { background: #f20d13; }

/* Sổ chăm sóc khách hàng dùng cùng bố cục compact, nhưng giữ bảng trung tính. */
body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar {
  --pos-ledger-freeze-stt: 48px;
  --pos-ledger-freeze-sku: 118px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #eef4fb;
}

.pos-bctk-report.is-neutral-sidebar .pos-report-filter-card {
  align-self: stretch;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 4px;
  border-color: #aebfd3;
  background: #f7f9fc;
  box-shadow: none;
}

.pos-bctk-report.is-neutral-sidebar .pos-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 6px;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar .pos-filter-grid.has-extra {
  grid-template-columns: 1fr 1fr;
}

.pos-bctk-report.is-neutral-sidebar .pos-report-filter-search,
.pos-bctk-report.is-neutral-sidebar .pos-report-kind-filter,
.pos-bctk-report.is-neutral-sidebar .pos-filter-grid > .pos-btn {
  grid-column: 1 / -1;
}

.pos-bctk-report.is-neutral-sidebar .pos-filter-label-text {
  font-size: 11px;
}

.pos-bctk-report.is-neutral-sidebar .pos-filter-input {
  min-width: 0;
  height: 28px;
  min-height: 28px !important;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 11px !important;
}

.pos-bctk-report.is-neutral-sidebar .pos-filter-grid > .pos-btn {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.pos-bctk-report.is-neutral-sidebar .pos-bctk-table-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 8px;
  border-radius: 4px;
  border-color: #9fb3c9;
  box-shadow: none;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar .pos-bctk-table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table {
  min-width: 1400px;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar.is-density-compact #pos-bctk-table th,
body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar.is-density-compact #pos-bctk-table td {
  height: 24px;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  font-size: 11px;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar.is-density-compact #pos-bctk-table thead tr:first-child th {
  height: 29px;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar.is-density-compact #pos-bctk-table thead tr.pos-smart-grid-filter-row th {
  top: 29px;
  height: 27px;
}

body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar.is-density-compact #pos-bctk-table .pos-smart-grid-filter {
  height: 22px !important;
  min-height: 22px !important;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table :is(th, td):nth-child(1) {
  position: sticky;
  left: 0;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table :is(th, td):nth-child(2) {
  position: sticky;
  left: var(--pos-ledger-freeze-stt);
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table :is(th, td):nth-child(3) {
  position: sticky;
  left: calc(var(--pos-ledger-freeze-stt) + var(--pos-ledger-freeze-sku));
  box-shadow: 2px 0 0 #9fb3c9;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table tbody td:nth-child(-n+3) {
  z-index: 2;
  background: #fff;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table tbody tr:nth-child(even) td:nth-child(-n+3) {
  background: #f8fafc;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table thead th:nth-child(-n+3) {
  z-index: 7;
}

.pos-bctk-report.is-neutral-sidebar #pos-bctk-table thead tr.pos-smart-grid-filter-row th:nth-child(-n+3),
.pos-bctk-report.is-neutral-sidebar #pos-bctk-table tfoot td:nth-child(-n+3) {
  z-index: 6;
}

/* Điểm nhấn nhẹ theo báo cáo HTsoft: mã/tên/phiếu dễ lần theo, các giá trị
   bán hàng chính màu đỏ; không tô nền nguyên cột như màn Sổ kho. */
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="sku"],
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="ten"],
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="pbh"] {
  color: #175bd5;
}

.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="gia"],
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="gia_dvt"],
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="tien"],
.pos-bctk-report[data-report-type="sales"] #pos-bctk-table td[data-bctk-key="doanh_thu"] {
  color: #ef2828;
}

@media (max-width: 760px) {
  body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .pos-bctk-report.is-neutral-sidebar .pos-report-filter-card {
    margin-bottom: 8px;
  }

  body.pos-ui-v2 .pos-bctk-report.is-neutral-sidebar .pos-bctk-table-wrap {
    height: auto;
    min-height: 380px;
    max-height: calc(100vh - 290px);
  }

  .pos-bctk-report.is-neutral-sidebar #pos-bctk-table :is(th, td):nth-child(-n+3) {
    position: static;
    left: auto;
    box-shadow: none;
  }

  body.pos-ui-v2 .pos-stock-report {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .pos-stock-workspace {
    display: block;
  }

  .pos-stock-report .pos-report-filter-card {
    margin-bottom: 8px;
  }

  body.pos-ui-v2 .pos-stock-report .pos-stock-table-wrap {
    height: auto;
    min-height: 380px;
    max-height: calc(100vh - 290px);
  }

  .pos-stock-report #pos-stock-table :is(th, td):nth-child(-n+3) {
    position: static;
    left: auto;
    box-shadow: none;
  }

  body.pos-ui-v2 .pos-bctk-report[data-report-type="ledger"] {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .pos-ledger-workspace {
    display: block;
  }

  .pos-bctk-report[data-report-type="ledger"] .pos-report-filter-card {
    margin-bottom: 8px;
  }

  .pos-bctk-report[data-report-type="ledger"] .pos-bctk-table-wrap {
    height: auto;
    min-height: 380px;
    max-height: calc(100vh - 290px);
  }

  .pos-bctk-report[data-report-type="ledger"] #pos-bctk-table :is(th, td):nth-child(-n+3) {
    position: static;
    left: auto;
    box-shadow: none;
  }

  .pos-report-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-report-filter-grid .pos-report-filter-search,
  .pos-report-filter-grid.has-kind .pos-report-filter-search,
  .pos-report-filter-grid.is-search-only .pos-report-filter-search,
  .pos-report-filter-grid > .pos-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  body.pos-ui-v2 .pos-section-head {
    display: grid;
    align-items: stretch;
  }

  body.pos-ui-v2 .pos-filter-row {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

/* Các báo cáo còn lại dùng chung khung HTsoft compact. */
body.pos-ui-v2 .pos-report-compact {
  --pos-report-freeze-first: 56px;
  --pos-report-freeze-second: 145px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #eef4fb;
}

.pos-report-workspace {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.pos-report-workspace.is-filter-collapsed { grid-template-columns: 38px minmax(0, 1fr); }
.pos-report-compact .pos-filter-panel { align-self: stretch; min-height: 0; margin: 8px 0 0; padding: 10px !important; }
.pos-report-sidebar-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: max-content; margin: -21px 0 8px 2px; padding: 0 6px; background: #f7f9fc; color: #24364d; font-size: 11px; font-weight: 700; }
.pos-report-sidebar-title button { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid #aebfd3; border-radius: 5px; background: #fff; color: #2459b8; font-size: 18px; }
.pos-report-workspace.is-filter-collapsed .pos-filter-panel { padding: 6px !important; }
.pos-report-workspace.is-filter-collapsed .pos-report-sidebar-title { margin: -17px auto 0; padding: 0; background: transparent; }
.pos-report-workspace.is-filter-collapsed .pos-report-sidebar-title span,
.pos-report-workspace.is-filter-collapsed .pos-filter-grid,
.pos-report-workspace.is-filter-collapsed .pos-report-sidebar-actions { display: none !important; }
.pos-report-workspace.is-filter-collapsed .pos-report-sidebar-title button { transform: rotate(180deg); }

body.pos-ui-v2 .pos-report-compact .pos-filter-grid,
body.pos-ui-v2 .pos-report-compact .pos-category-sales-filter-grid { grid-template-columns: 1fr 1fr; gap: 7px 6px; }
.pos-report-compact .pos-category-picker { grid-column: 1 / -1; }
.pos-report-compact .pos-report-full-field { grid-column: 1 / -1; }
.pos-report-compact .pos-filter-grid > .pos-btn { grid-column: 1 / -1; min-height: 28px; padding: 3px 7px; font-size: 11px; }
.pos-report-compact .pos-filter-input { height: 28px; min-height: 28px !important; padding: 3px 6px; font-size: 11px !important; }
.pos-report-sidebar-actions { display: grid; gap: 6px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #c7d2df; }
.pos-report-sidebar-actions .pos-table-tools { display: grid; gap: 6px; padding: 0; }
body.pos-ui-v2 .pos-report-sidebar-actions :is(.pos-btn, .pos-grid-reset-btn, .pos-excel-export-btn) { width: 100%; min-height: 28px; padding: 3px 7px; font-size: 11px; }
.pos-report-sidebar-summary { color: #64748b; font-size: 11px; line-height: 1.45; }

.pos-operation-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pos-operation-main > .pos-report-table-card { flex: 1 1 auto; }
.pos-operation-main > :is(.pos-pagination, [id$="-pagination"], .pit-pager) { flex: 0 0 auto; }
.pos-operation-list .pos-report-sidebar-actions { margin-top: 12px; }
.pos-operation-list .pos-report-sidebar-actions > a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.pos-report-workspace.is-filter-collapsed :is(.pos-report-sidebar-summary, .pit-stats) { display: none !important; }
.pos-report-compact .pit-stats { display: grid; gap: 5px; margin: 0 0 9px; }
.pos-report-compact .pit-stat { width: 100%; min-height: 28px; padding: 3px 7px; }
.pos-report-compact .pit-stat-body { width: 100%; justify-content: space-between; }
.pos-report-compact .itr-code { color: #175bd5; font-weight: 400; }
.pos-report-compact .itr-confirmed { color: #087f5b; font-weight: 700; text-align: center; }
.pos-report-compact #itr-table tbody td { font-weight: 400; }

.pos-report-compact :is(.pos-report-table-card, .pos-category-sales-table-card) { display: flex; flex-direction: column; min-height: 0; margin-top: 8px; padding: 0 !important; overflow: hidden; }
body.pos-ui-v2 .pos-report-compact :is(.pos-table-scroll-frame, .pos-smart-grid-wrap) { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; }
body.pos-ui-v2 .pos-report-compact table.pos-smart-grid :is(th, td) { height: 24px; padding-top: 2px !important; padding-bottom: 2px !important; font-size: 11px; }
body.pos-ui-v2 .pos-report-compact table.pos-smart-grid thead tr:first-child th { height: 29px; }
body.pos-ui-v2 .pos-report-compact table.pos-smart-grid thead tr.pos-smart-grid-filter-row th { top: 29px; height: 27px; }
body.pos-ui-v2 .pos-report-compact table.pos-smart-grid .pos-smart-grid-filter { height: 22px !important; min-height: 22px !important; }

.pos-report-compact table.pos-smart-grid :is(th, td):nth-child(1) { position: sticky; left: 0; }
.pos-report-compact table.pos-smart-grid :is(th, td):nth-child(2) { position: sticky; left: var(--pos-report-freeze-first); }
.pos-report-compact table.pos-smart-grid :is(th, td):nth-child(3) { position: sticky; left: calc(var(--pos-report-freeze-first) + var(--pos-report-freeze-second)); box-shadow: 2px 0 0 #9fb3c9; }
.pos-report-compact table.pos-smart-grid tbody td:nth-child(-n+3) { z-index: 2; background: #fff; }
.pos-report-compact table.pos-smart-grid tbody tr:nth-child(even) td:nth-child(-n+3) { background: #f8fafc; }
.pos-report-compact table.pos-smart-grid thead th:nth-child(-n+3) { z-index: 7; }
.pos-report-compact table.pos-smart-grid thead tr.pos-smart-grid-filter-row th:nth-child(-n+3),
.pos-report-compact table.pos-smart-grid tfoot td:nth-child(-n+3) { z-index: 6; }

@media (max-width: 760px) {
  body.pos-ui-v2 .pos-report-compact { display: block; height: auto; min-height: 100%; overflow-y: auto; }
  .pos-report-workspace { display: block; }
  .pos-report-compact .pos-filter-panel { margin-bottom: 8px; }
  .pos-report-compact table.pos-smart-grid :is(th, td):nth-child(-n+3) { position: static; left: auto; box-shadow: none; }
  .pos-operation-main { min-height: 520px; }
}

@media (max-width: 640px) {
  body.pos-ui-v2 .pos-form-grid {
    grid-template-columns: 1fr;
  }

  body.pos-ui-v2 .pos-module-app > .pos-page-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}
.pos-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 6px 8px;
    color: var(--pos-ui-muted, #64748b);
    font-size: 13px;
}

.pos-pagination__controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pos-pagination__button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--pos-ui-border, #b8c5d6);
    border-radius: 7px;
    background: #fff;
    color: var(--pos-ui-text, #172033);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.pos-pagination__button:hover:not(:disabled):not(.is-active) {
    background: var(--pos-ui-surface-soft, #f8fafc);
}

.pos-pagination__button.is-active {
    border-color: var(--pos-ui-primary, #2563eb);
    background: var(--pos-ui-primary, #2563eb);
    color: #fff;
}

.pos-pagination__button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pos-pagination__gap {
    padding: 0 2px;
    color: #94a3b8;
}

@media (max-width: 640px) {
    .pos-pagination {
        align-items: flex-start;
        flex-direction: column;
    }
}
