: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: 0.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:first-child
  th.is-grid-column-draggable {
  cursor: grab;
}

body.pos-ui-v2
  table.pos-smart-grid
  thead
  tr:first-child
  th.is-grid-column-draggable:active {
  cursor: grabbing;
}

body.pos-ui-v2
  table.pos-smart-grid
  thead
  tr:first-child
  th.is-grid-column-dragging {
  opacity: 0.55;
}

body.pos-ui-v2
  table.pos-smart-grid
  thead
  tr:first-child
  th.is-grid-column-drop-target {
  box-shadow: inset 3px 0 0 var(--pos-ui-primary);
}

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;
}

.pos-smart-grid-filter-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 21px minmax(32px, 1fr);
  align-items: center;
  gap: 2px;
  width: 100%;
}

body.pos-ui-v2
  table.pos-smart-grid
  .pos-smart-grid-filter-wrap
  .pos-smart-grid-filter {
  min-width: 0;
  width: 100%;
  padding-right: 24px !important;
}

body.pos-ui-v2
  table.pos-smart-grid
  .pos-smart-grid-filter-wrap
  input[type="search"]::-webkit-search-cancel-button,
body.pos-ui-v2
  table.pos-smart-grid
  .pos-smart-grid-filter-wrap
  input[type="search"]::-webkit-search-decoration {
  display: none;
  appearance: none;
}

.pos-smart-grid-filter-operator,
.pos-smart-grid-filter-menu-button,
.pos-smart-grid-filter-clear {
  width: 100%;
  height: 22px;
  min-height: 22px;
  padding: 0 2px;
  border: 1px solid #b7c6d8;
  border-radius: 3px;
  background: #fff;
  color: #475569;
  font-size: 10px;
  line-height: 20px;
}

.pos-smart-grid-filter-operator {
  display: none;
}

.pos-smart-grid-filter-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0 3px;
  border-color: #9fb1c6;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  height: 20px;
  min-height: 20px;
}

.pos-smart-grid-filter-menu-button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.pos-smart-grid-filter-menu-button span {
  font-size: 7px;
  line-height: 1;
}

.pos-smart-grid-filter-menu-button:hover,
.pos-smart-grid-filter-menu-button:focus-visible {
  border-color: #2563eb;
  background: #eaf2ff;
  color: #175bd5;
  outline: none;
}

.pos-smart-grid-filter-clear {
  position: absolute;
  right: 2px;
  top: 50%;
  z-index: 1;
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
  padding: 0;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
}

.pos-smart-grid-filter-clear:hover {
  border-color: #ef4444;
  color: #dc2626;
}

.pos-smart-grid-filter-menu {
  position: fixed;
  z-index: 10050;
  max-height: min(620px, calc(100vh - 16px));
  overflow: auto;
  padding: 8px;
  border: 1px solid #94a8bf;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
  color: #334155;
  font-size: 12px;
}

.pos-smart-grid-filter-conditions {
  margin-bottom: 8px;
  padding: 7px;
  border: 1px solid #b8c6d8;
  border-radius: 6px;
  background: #f4f7fb;
  color: #334155;
  font-family: inherit;
  font-size: 12px;
}

.pos-smart-grid-filter-conditions-head {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.pos-smart-grid-filter-conditions-head select,
.pos-smart-grid-filter-condition select,
.pos-smart-grid-filter-condition input {
  width: 100%;
  min-width: 0;
  height: 24px !important;
  min-height: 24px !important;
  padding: 1px 6px;
  border: 1px solid #b7c6d8;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-family: inherit;
  font-size: 12px !important;
  font-weight: 400;
  line-height: 1.25;
}

.pos-smart-grid-filter-condition-list {
  display: grid;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.pos-smart-grid-filter-condition {
  display: grid;
  grid-template-columns: 100px minmax(130px, 1fr) 24px;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 1px 2px;
  border: 1px solid #d5dee9;
  border-radius: 5px;
  background: #fff;
}

.pos-smart-grid-filter-condition:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.pos-smart-grid-filter-condition-add,
.pos-smart-grid-filter-condition-remove {
  height: 24px !important;
  min-height: 24px !important;
  padding: 0 6px;
  border: 1px solid #9fb1c6;
  border-radius: 4px;
  background: #fff;
  color: #175bd5;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px !important;
  line-height: 1.25;
  cursor: pointer;
}

.pos-smart-grid-filter-condition-remove {
  padding: 0;
  color: #dc2626;
  font-size: 16px;
}

.pos-smart-grid-filter-menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -8px -8px 8px;
  padding: 5px 7px 5px 9px;
  border-bottom: 1px solid #cbd5e1;
  background: #e8eef5;
  font-weight: 700;
}

table[data-smart-grid-header-filter="true"]
  thead
  tr:first-child
  th.has-smart-grid-header-filter {
  padding-right: 35px !important;
}

/* Tay kéo mặc định rộng 24px và phủ lên nút lọc. Ở bảng lọc trên header chỉ
   giữ vùng bắt 8px sát mép; đường kéo vẫn rõ nhưng nút phễu bấm trọn vẹn. */
table[data-smart-grid-header-filter="true"]
  thead
  tr:first-child
  .pos-excel-resizer {
  width: 8px;
}

.pos-smart-grid-header-filter-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #91a7bd;
  border-radius: 4px;
  background: linear-gradient(#fff, #edf3f8);
  color: #0f9f73;
  font-size: 10px;
  line-height: 20px;
  transform: translateY(-50%);
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
  touch-action: manipulation;
  z-index: 20;
}

.pos-smart-grid-header-filter-btn:hover,
.pos-smart-grid-header-filter-btn:focus-visible {
  border-color: #078b67;
  background: #e7f8f2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 159, 115, 0.16);
}

.pos-smart-grid-header-filter-btn:active {
  background: #d8f3ea;
  transform: translateY(-50%) scale(0.96);
}

.pos-smart-grid-filter-menu-sort {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.pos-smart-grid-filter-menu-title .pos-smart-grid-filter-menu-sort {
  flex: 0 0 auto;
  gap: 4px;
  margin: 0;
}

.pos-smart-grid-filter-menu-title .pos-smart-grid-filter-menu-sort button {
  min-width: 88px;
  height: 25px;
  padding: 2px 7px;
  background: #fff;
  text-align: center;
}

.pos-smart-grid-filter-menu-sort button {
  padding: 6px 8px;
  border: 1px solid #c2cedc;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.pos-smart-grid-filter-menu-sort button:hover {
  border-color: #0f9f73;
  color: #078b67;
}

.pos-smart-grid-filter-menu-sort button.is-active,
.pos-smart-grid-filter-menu-sort button.is-active:hover {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.pos-smart-grid-filter-menu-custom {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}

.pos-smart-grid-filter-menu-custom select,
.pos-smart-grid-filter-menu-custom input {
  width: 100%;
  height: 30px;
  padding: 3px 7px;
  border: 1px solid #b7c6d8;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 12px;
}

.pos-smart-grid-filter-menu-custom input {
  grid-column: 2;
}

.pos-smart-grid-filter-menu-values {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #d6e0ea;
  border-radius: 4px;
}

.pos-smart-grid-filter-menu-value {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-bottom: 1px solid #edf1f5;
  background: #fff;
  color: #334155;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.pos-smart-grid-filter-menu-value input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #0f9f73;
}

.pos-smart-grid-filter-menu-value small {
  color: #94a3b8;
}

.pos-smart-grid-filter-menu-value:hover {
  background: #edf5ff;
  color: #175bd5;
}

.pos-smart-grid-filter-menu-value.is-clear {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-weight: 700;
}

.pos-smart-grid-filter-menu-actions {
  position: sticky;
  bottom: -8px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px -8px -8px;
  padding: 8px;
  border-top: 1px solid #d6e0ea;
  background: #fff;
  box-shadow: 0 -5px 12px rgba(15, 23, 42, 0.06);
}

.pos-smart-grid-filter-menu-actions button {
  min-width: 76px;
  padding: 6px 12px;
  border: 1px solid #b7c6d8;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-weight: 600;
  cursor: pointer;
}

.pos-smart-grid-filter-menu-actions button.is-primary {
  border-color: #0f9f73;
  background: #0f9f73;
  color: #fff;
}

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);
}

/* Hai khung xem song song tại Báo cáo bán hàng / Tổng hợp bán hàng. */
body.pos-ui-v2 .order-detail-dialog.is-dual {
  height: 92vh;
  max-height: 92vh !important;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-header {
  min-height: 44px;
  padding: 7px 12px !important;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-header h2 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-header .pos-btn {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body.pos-ui-v2 .order-detail-dual-content {
  display: grid;
  grid-template-columns: minmax(380px, 0.78fr) minmax(560px, 1.22fr);
  gap: 10px;
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  padding: 10px;
  background: #eef4fb;
}

body.pos-ui-v2 .order-detail-dual-content.hidden {
  display: none;
}

body.pos-ui-v2 .order-detail-dual-content.is-receipt-collapsed {
  grid-template-columns: 46px minmax(560px, 1fr);
}

body.pos-ui-v2 .order-detail-dual-content.is-record-collapsed {
  grid-template-columns: minmax(380px, 1fr) 46px;
}

body.pos-ui-v2 .order-detail-pane {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--pos-ui-border);
  border-radius: 8px;
  background: #fff;
}

body.pos-ui-v2 .order-detail-pane > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 6px 9px;
  border-bottom: 1px solid var(--pos-ui-border);
  background: #eaf0f7;
  color: #24364d;
  font-size: 12px;
  font-weight: 700;
}

body.pos-ui-v2 .order-detail-pane > h3 button {
  flex: 0 0 auto;
  min-width: 42px;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid #9fb0c4;
  border-radius: 5px;
  background: #fff;
  color: #2459b8;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
}

body.pos-ui-v2 .order-detail-pane > h3 button:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

body.pos-ui-v2 .order-detail-pane.is-collapsed > :not(h3) {
  display: none !important;
}

body.pos-ui-v2 .order-detail-pane.is-collapsed > h3 {
  position: static;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  padding: 7px 4px;
  border-bottom: 0;
}

body.pos-ui-v2 .order-detail-pane.is-collapsed > h3 span {
  writing-mode: vertical-rl;
}

body.pos-ui-v2 .order-detail-pane.is-collapsed > h3 button {
  min-width: 34px;
  padding: 2px 3px;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-actions {
  flex-wrap: nowrap;
  gap: 8px !important;
  padding: 9px 12px !important;
}

body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-actions > button {
  min-width: 0 !important;
  min-height: 40px;
  padding: 7px 10px !important;
  border-radius: 9px;
  font-size: 13px !important;
  line-height: 1.25;
}

body.pos-ui-v2 .order-record-meta {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--pos-ui-border);
}

body.pos-ui-v2 .order-record-meta > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  padding: 6px 8px;
  border-right: 1px solid #d7e0eb;
  border-bottom: 1px solid #d7e0eb;
  font-size: 11px;
}

body.pos-ui-v2 .order-record-meta span,
body.pos-ui-v2 .order-record-note > span {
  color: #64748b;
  font-weight: 600;
}

body.pos-ui-v2 .order-record-meta strong {
  overflow: hidden;
  color: #172033;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.pos-ui-v2 .order-record-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

body.pos-ui-v2 .order-detail-record-pane {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
}

body.pos-ui-v2 #order-detail-record {
  display: block;
}

body.pos-ui-v2 #order-detail-record.hidden {
  display: none;
}

body.pos-ui-v2 .order-record-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: #334155;
  font-size: 11px;
}

body.pos-ui-v2 .order-record-table :is(th, td) {
  height: 27px;
  padding: 4px 6px;
  overflow: hidden;
  border-right: 1px solid #c7d2df;
  border-bottom: 1px solid #c7d2df;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.pos-ui-v2 .order-record-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eaf0f7;
  color: #24364d;
  text-align: left;
}

body.pos-ui-v2 .order-record-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  height: 29px;
  background: #eaf0f7;
  color: #172033;
  font-weight: 700;
  box-shadow: 0 -1px 0 #8fa3ba;
}

body.pos-ui-v2 .order-record-table :is(th, td):nth-child(1) {
  width: 38px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(2) {
  width: 92px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(3) {
  width: 210px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(4) {
  width: 76px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(5) {
  width: 86px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(6),
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(7),
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(8) {
  width: 100px;
}
body.pos-ui-v2 .order-record-table :is(th, td):nth-child(9) {
  width: 120px;
}

body.pos-ui-v2 .order-record-note {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 7px;
  padding: 8px;
  border-bottom: 1px solid #c7d2df;
  font-size: 11px;
}

body.pos-ui-v2 .order-record-note p {
  margin: 0;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-scroll {
    overflow-y: auto;
  }

  body.pos-ui-v2 .order-detail-dual-content {
    grid-template-columns: 1fr;
    height: auto;
  }

  body.pos-ui-v2
    .order-detail-dual-content:is(.is-receipt-collapsed, .is-record-collapsed) {
    grid-template-columns: 1fr;
  }

  body.pos-ui-v2 .order-detail-pane.is-collapsed {
    max-height: 38px;
  }

  body.pos-ui-v2 .order-detail-pane.is-collapsed > h3 {
    flex-direction: row;
    justify-content: space-between;
    height: 38px;
    padding: 5px 8px;
  }

  body.pos-ui-v2 .order-detail-pane.is-collapsed > h3 span {
    writing-mode: initial;
  }

  body.pos-ui-v2 .order-detail-pane {
    max-height: 70vh;
  }

  body.pos-ui-v2 .order-detail-dialog.is-dual .order-detail-actions {
    flex-wrap: wrap;
  }
}

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: 110px;
  --pos-stock-col-sale_qty: 190px;
  --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);
}

body.pos-ui-v2 .pos-stock-report .pos-group-filter {
  display: block;
  flex: 0 0 auto;
  margin-top: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.pos-ui-v2 .pos-stock-report .pos-group-filter-options {
  display: block !important;
  height: clamp(220px, 32vh, 360px);
  max-height: none;
  overflow: auto;
  padding: 1px 0;
  border: 1px solid var(--pos-ui-border, #cbd5e1);
  border-radius: 5px;
  background: #fff;
}

.pos-stock-report .pos-group-filter__title {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--pos-ui-border, #cbd5e1);
  border-radius: 7px 7px 0 0;
  background: #eaf1f8;
  color: #1e293b;
  font-size: 11px;
  font-weight: 600;
}

.pos-stock-report .pos-group-filter__menu {
  width: 100%;
  padding: 4px;
  border: 1px solid var(--pos-ui-border-strong, #94a3b8);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  background: #fff;
}

.pos-stock-report .pos-group-filter__selected-count {
  overflow: hidden;
  margin-left: auto;
  color: #64748b;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-stock-report .pos-group-filter__select-all,
.pos-stock-report .pos-group-filter-row input {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--pos-accent, #2563eb);
  cursor: pointer;
}

.pos-stock-report .pos-group-filter__search {
  width: 100%;
  min-height: 25px !important;
  height: 25px;
  margin: 0 0 4px;
  padding: 2px 7px !important;
  border-radius: 5px;
  font-size: 10px !important;
}

body.pos-ui-v2
  .pos-stock-report
  .pos-group-filter-options
  > .pos-group-filter-row {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 1px 6px 1px calc(6px + (var(--pos-group-depth) * 13px));
  color: #334155;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.pos-stock-report .pos-group-filter-row:hover,
.pos-stock-report .pos-group-filter-row.active {
  background: #eff6ff;
}

.pos-stock-report .pos-group-filter-name {
  overflow: hidden;
  min-width: 0;
  flex: 1 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-stock-report .pos-group-filter-toggle,
.pos-stock-report .pos-group-filter-toggle-spacer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  order: 1;
  margin: 0;
}

.pos-stock-report .pos-group-filter-toggle {
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.pos-stock-report .pos-group-filter-toggle:hover {
  border-color: var(--pos-accent, #2563eb);
  color: var(--pos-accent, #2563eb);
}

.pos-stock-report .pos-group-filter-row input {
  order: 3;
  margin-left: auto;
}

.pos-stock-result-count {
  flex: 0 0 auto;
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
}

.pos-stock-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  flex: 0 0 auto;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #c7d2df;
}

.pos-stock-actions .pos-table-tools {
  display: contents;
  padding: 0;
}

.pos-stock-actions .pos-excel-export-btn,
.pos-stock-actions .pos-stock-export-short {
  grid-column: 1 / -1;
}

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;
}

.pos-bctk-report[data-report-type="sales"] {
  --pos-bctk-col-qty: 90px;
}

/*
 * 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;
}

.pos-bctk-split-label,
.pos-bctk-return-wrap,
.pos-bctk-grand-total-wrap {
  display: none;
}

.pos-bctk-table-card.is-split-sales {
  overflow: hidden !important;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-split-label {
  display: block;
  flex: 0 0 auto;
  padding: 5px 8px;
  border-top: 1px solid #91a7bd;
  border-bottom: 1px solid #91a7bd;
  background: #dce5ee;
  color: #26384a;
  font-size: 11px;
  font-weight: 700;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-split-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-split-label button {
  min-width: 46px;
  padding: 2px 9px;
  border: 1px solid #8da4bc;
  border-radius: 3px;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-split-label button:hover {
  background: #fff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-table-wrap {
  /* Ghi đè flex-basis:auto của layout báo cáo phía dưới file: nếu để auto,
     phần bán nhiều dòng sẽ chiếm hết chiều cao và ép phần trả lại còn 1 hàng. */
  flex: 1 1 0 !important;
  height: 0 !important;
  min-height: 140px !important;
  max-height: none !important;
  overflow: auto;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-table-wrap.is-section-collapsed {
  display: none !important;
}

@media (max-width: 760px) {
  .pos-bctk-table-card.is-split-sales .pos-bctk-table-wrap {
    flex: 0 0 auto !important;
    width: 100%;
    height: 320px !important;
    min-height: 220px !important;
  }
}

.pos-bctk-table-card.is-split-sales .pos-bctk-return-wrap {
  display: block;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-grand-total-wrap {
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  border-top: 2px solid #7890aa;
  background: #dce5ee;
}

.pos-bctk-table-card.is-split-sales #pos-bctk-grand-total-table {
  width: 100%;
  min-width: 1400px;
  table-layout: fixed;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table)
  tfoot
  td,
.pos-bctk-table-card.is-split-sales #pos-bctk-grand-total-table tfoot td {
  height: 25px;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  background: #eef3f8 !important;
  font-size: 11px;
  font-weight: 700;
}

.pos-bctk-table-card.is-split-sales #pos-bctk-grand-total-table tfoot td {
  background: #dce5ee !important;
}

/* Ba cột đầu dùng chung đúng offset/độ rộng lấy từ bảng tiêu đề phía trên.
   Nhờ vậy cả hàng bán, trả lại và tổng cộng cùng ghim mà không chồng cột. */
.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table, #pos-bctk-grand-total-table)
  :is(th, td):nth-child(1) {
  position: sticky !important;
  left: 0 !important;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table, #pos-bctk-grand-total-table)
  :is(th, td):nth-child(2) {
  position: sticky !important;
  left: var(--pos-ledger-freeze-stt) !important;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table, #pos-bctk-grand-total-table)
  :is(th, td):nth-child(3) {
  position: sticky !important;
  left: calc(
    var(--pos-ledger-freeze-stt) + var(--pos-ledger-freeze-sku)
  ) !important;
  box-shadow: 2px 0 0 #9fb3c9;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table)
  tbody
  td:nth-child(-n + 3) {
  z-index: 3;
  background: #fff !important;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table, #pos-bctk-grand-total-table)
  tfoot
  td:nth-child(-n + 3) {
  z-index: 6;
}

.pos-bctk-table-card.is-split-sales
  :is(#pos-bctk-table, #pos-bctk-return-table, #pos-bctk-grand-total-table)
  tfoot
  td {
  border-left: 1px solid #aebfd3 !important;
  border-right: 1px solid #aebfd3 !important;
  border-bottom: 1px solid #aebfd3 !important;
}

.pos-bctk-table-card.is-split-sales .pos-bctk-return-table {
  width: 100%;
  min-width: 1400px;
  table-layout: fixed;
}

/* HTsoft chỉ dùng một hàng tiêu đề/bộ lọc chung. Giữ thead thứ hai trong DOM
   để Smart Grid vẫn nhận lọc/sắp xếp đồng bộ, nhưng không vẽ lại trên màn hình. */
.pos-bctk-table-card.is-split-sales .pos-bctk-return-table thead {
  display: none;
}

body.pos-ui-v2 .pos-bctk-table-card.is-split-sales .pos-bctk-return-table th,
body.pos-ui-v2 .pos-bctk-table-card.is-split-sales .pos-bctk-return-table td {
  height: 24px;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  font-size: 11px;
}

.pos-bctk-table-card.is-split-sales
  .pos-bctk-return-table
  :is(th, td):nth-child(1) {
  position: sticky;
  left: 0;
}

.pos-bctk-table-card.is-split-sales
  .pos-bctk-return-table
  :is(th, td):nth-child(2) {
  position: sticky;
  left: var(--pos-ledger-freeze-stt);
}

.pos-bctk-table-card.is-split-sales
  .pos-bctk-return-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-table-card.is-split-sales
  .pos-bctk-return-table
  tbody
  td:nth-child(-n + 3) {
  z-index: 2;
  background: #fff;
}

.pos-bctk-table-card.is-split-sales
  .pos-bctk-return-table
  thead
  th:nth-child(-n + 3) {
  z-index: 7;
}

.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="sku"],
.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="ten"],
.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="pbh"] {
  color: #175bd5;
}

.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="gia"],
.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="gia_dvt"],
.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="tien"],
.pos-bctk-report[data-report-type="sales"]
  .pos-bctk-return-table
  td[data-bctk-key="doanh_thu"] {
  color: #ef2828;
}

/* 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;
}

.pos-bctk-report[data-report-type="ledger"] .pos-ledger-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pos-bctk-report[data-report-type="ledger"]
  .pos-ledger-actions
  .pos-table-tools {
  display: contents;
}

.pos-bctk-report[data-report-type="ledger"]
  .pos-ledger-actions
  .pos-excel-export-btn {
  grid-column: 1 / -1;
}

.pos-bctk-report[data-report-type="ledger"]
  .pos-ledger-actions
  :is(.pos-grid-reset-btn, #pos-bctk-refresh) {
  min-width: 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, 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-report-branch-filter,
.pos-bctk-report.is-neutral-sidebar .pos-filter-grid > .pos-btn {
  grid-column: 1 / -1;
}

.pos-htsoft-site-picker {
  display: grid;
}

.pos-htsoft-picker-block {
  overflow: hidden;
  max-height: none;
  border: 1px solid #aebfd3;
  border-radius: 7px;
  background: #fff;
}

.pos-htsoft-picker-head,
.pos-htsoft-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
}

.pos-htsoft-picker-head {
  min-height: 23px;
  border-bottom: 1px solid #aebfd3;
  background: #e8eef5;
  color: #334155;
  font-size: 11px;
}

.pos-htsoft-picker-head > *,
.pos-htsoft-picker-row > * {
  padding: 2px 6px;
}

.pos-htsoft-picker-head > :last-child,
.pos-htsoft-picker-row > :last-child {
  justify-self: center;
}

.pos-htsoft-picker-list {
  height: clamp(220px, 32vh, 360px);
  max-height: none !important;
  margin: 0 4px 4px;
  border: 1px solid #b7c6d8;
  border-radius: 5px;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.pos-htsoft-picker-search {
  padding: 4px;
  border-bottom: 1px solid #d6e0ea;
  background: #f8fafc;
}

.pos-htsoft-picker-search input {
  width: 100%;
  height: 25px;
  min-height: 25px !important;
  padding: 2px 7px;
  border: 1px solid #b7c6d8;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 11px !important;
  outline: none;
}

.pos-htsoft-picker-search input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.pos-htsoft-picker-row {
  min-height: 22px;
  margin: 0;
  border-bottom: 1px solid #d6e0ea;
  color: #334155;
  font-size: 11px;
  cursor: pointer;
}

.pos-htsoft-picker-row:last-child {
  border-bottom: 0;
}

.pos-htsoft-picker-row:hover,
.pos-htsoft-picker-row:has(input:checked) {
  background: #edf5ff;
  color: #175bd5;
}

.pos-htsoft-picker-row.is-disabled {
  cursor: not-allowed;
  color: #94a3b8;
  background: #f8fafc;
  opacity: 0.68;
}

.pos-htsoft-picker-row.is-disabled:hover {
  background: #f8fafc;
}

.pos-htsoft-picker-row.is-disabled input {
  cursor: not-allowed;
}

.pos-htsoft-picker-row.is-current {
  font-weight: 700;
}

.pos-htsoft-picker-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-htsoft-picker-row input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #175bd5;
}

.pos-bctk-report.is-neutral-sidebar .pos-htsoft-picker-head {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  min-height: 28px;
  font-family: var(--pos-ui-font-family, "Manrope", sans-serif);
  font-size: 11px;
  font-weight: 600;
  line-height: normal;
}

.pos-bctk-report.is-neutral-sidebar .pos-htsoft-picker-head > :last-child {
  overflow: hidden;
  justify-self: stretch;
  color: #64748b;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
}

.pos-bctk-report.is-neutral-sidebar .pos-htsoft-picker-search input {
  font-family: var(--pos-ui-font-family, "Manrope", sans-serif);
  font-size: 10px !important;
  font-weight: 400;
  line-height: normal;
}

.pos-bctk-report.is-neutral-sidebar .pos-htsoft-picker-row {
  font-family: var(--pos-ui-font-family, "Manrope", sans-serif);
  font-size: 11px;
  font-weight: 400;
  line-height: normal;
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions .pos-table-tools {
  display: contents;
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions .pos-excel-export-btn {
  grid-column: 1 / -1;
  order: 1;
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions #pos-bctk-reconcile {
  grid-column: 1 / -1;
  order: 2;
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions .pos-grid-reset-btn {
  min-width: 0;
  order: 3;
}

.pos-bctk-report.is-neutral-sidebar .pos-ledger-actions #pos-bctk-refresh {
  min-width: 0;
  order: 4;
}

.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 {
  position: relative;
  display: grid;
  /* Bề rộng khung "Tiêu chí tìm kiếm": mặc định 246px, người dùng KÉO GIÃN được
     (tay nắm .pos-report-sidebar-resizer, pos-ui-system.js lưu theo từng báo cáo). */
  grid-template-columns: var(--pos-report-sidebar-w, 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);
}

/* Tay nắm kéo giãn — nằm đúng trong khe 8px giữa khung lọc và bảng */
.pos-report-sidebar-resizer {
  position: absolute;
  top: 8px;
  bottom: 0;
  left: var(--pos-report-sidebar-w, 246px);
  z-index: 20;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
.pos-report-sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 4px;
  height: 44px;
  border-radius: 3px;
  background: #aebfd3;
  transform: translateY(-50%);
  transition:
    background-color 0.15s ease,
    height 0.15s ease;
}
.pos-report-sidebar-resizer:hover::after,
.pos-report-workspace.is-sidebar-resizing .pos-report-sidebar-resizer::after {
  height: 88px;
  background: #2563eb;
}
.pos-report-workspace.is-sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}
.pos-report-workspace.is-filter-collapsed .pos-report-sidebar-resizer {
  display: none;
}
.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;
  }
  body.pos-ui-v2 .pos-report-compact {
    display: block;
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }
  .pos-report-workspace {
    display: block;
  }
  .pos-report-sidebar-resizer {
    display: none;
  }
  .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;
  }
}
body.pos-ui-v2 .flatpickr-calendar .pos-flatpickr-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

body.pos-ui-v2 .flatpickr-calendar .pos-flatpickr-today {
  min-height: 28px;
  padding: 3px 12px;
  border: 1px solid #2563eb;
  border-radius: 6px;
  background: #fff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

body.pos-ui-v2 .flatpickr-calendar .pos-flatpickr-today:hover,
body.pos-ui-v2 .flatpickr-calendar .pos-flatpickr-today:focus-visible {
  background: #2563eb;
  color: #fff;
  outline: none;
}

body.pos-ui-v2 #pos-sales-collection-report .pos-report-sidebar-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

body.pos-ui-v2
  #pos-sales-collection-report
  .pos-report-sidebar-actions
  .pos-table-tools {
  display: contents;
}

body.pos-ui-v2
  #pos-sales-collection-report
  .pos-report-sidebar-actions
  .pos-excel-export-btn {
  grid-column: 1 / -1;
}

body.pos-ui-v2
  #pos-sales-collection-report
  .pos-report-sidebar-actions
  :is(.pos-grid-reset-btn, #pos-sales-collection-refresh) {
  min-width: 0;
}

/* Báo cáo tồn kho — ô "SL theo ĐVT bán": số / đơn vị / phần lẻ tách màu cho
   các chị đi kiểm kho không đọc nhầm (xem saleQtyCell() ở pos-stock-report.js). */
.pos-stock-report .pos-sq-cell {
  white-space: nowrap;
}
.pos-stock-report .pos-sq-n {
  font-weight: 800;
  color: #0f172a;
  font-size: 1.05em;
}
.pos-stock-report .pos-sq-n.is-neg {
  color: #dc2626;
}
.pos-stock-report .pos-sq-sep {
  color: #94a3b8;
  font-weight: 700;
}
.pos-stock-report .pos-sq-u {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 700;
  line-height: 1.5;
}
.pos-stock-report .pos-sq-r {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 6px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 700;
  line-height: 1.5;
}

/* Báo cáo tồn kho — khối "Kiểm đặc biệt" (mã có phát sinh ở sổ kho) */
.pos-stock-special {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: #fffbeb;
}
.pos-stock-special__title {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}
.pos-stock-special__title small {
  display: block;
  font-weight: 400;
  color: #a16207;
  font-size: 10.5px;
}
.pos-stock-special__dates {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.pos-stock-special__dates input {
  min-width: 0;
  flex: 1 1 0;
  font-size: 11px;
  padding: 2px 4px;
}
.pos-stock-special__dates span {
  color: #a16207;
}
.pos-stock-special .pos-stock-special-btn {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: #f59e0b;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}
.pos-stock-special .pos-stock-special-btn:hover {
  background: #d97706;
}
.pos-stock-special .pos-stock-special-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.pos-stock-workspace.is-filter-collapsed .pos-stock-special {
  display: none;
}
.pos-stock-special-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 10px;
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  font-size: 12px;
}
.pos-stock-special-bar[hidden] {
  display: none;
}
.pos-stock-special-bar span {
  flex: 1 1 320px;
}

/* ── Sửa khung trái Báo cáo tồn kho sau khi thêm khối "Kiểm đặc biệt" ──────
   Khung có chiều cao cố định: danh sách nhóm hàng đang chiếm cứng 32vh đẩy các
   nút dưới cùng (Đặt lại cột / Làm mới) ra khỏi khung. Thu danh sách lại.
   KHÔNG đặt overflow cho .pos-report-filter-card: tiêu đề "Tiêu chí tìm kiếm"
   nằm đè lên viền khung (margin âm) — overflow sẽ cắt mất nó. */
body.pos-ui-v2 .pos-stock-report .pos-group-filter-options {
  height: clamp(120px, 22vh, 300px);
}
.pos-stock-report .pos-stock-actions {
  flex: 0 0 auto;
}

/* Ô ngày của Kiểm đặc biệt: CSS chung .pos-filter-input (14px, đệm 10px) làm
   cắt mất năm "28/09/202…" — ép gọn lại cho vừa khung 246px. */
body.pos-ui-v2
  .pos-stock-report
  .pos-stock-special__dates
  input.pos-filter-input {
  min-height: 28px !important;
  height: 28px;
  padding: 0 3px !important;
  border-radius: 6px;
  font-size: 11.5px !important;
  letter-spacing: -0.2px;
}
.pos-stock-report .pos-stock-special__dates {
  gap: 3px;
}
.pos-stock-report .pos-stock-special__dates span {
  font-size: 11px;
  flex: 0 0 auto;
}

/* Report layout contract
   Templates declare the meaning of each action; this layer owns placement. */
body.pos-ui-v2 .pos-report-layout .pos-report-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

body.pos-ui-v2 .pos-report-layout .pos-report-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.pos-ui-v2 .pos-report-layout .pos-report-filter-heading--standalone {
  margin: -21px 0 9px 2px;
  width: max-content;
  padding: 0 6px;
  background: var(--pos-ui-surface-soft, #f7f9fc);
  color: #24364d;
  font-size: 11px;
  font-weight: 700;
}

body.pos-ui-v2 .pos-report-layout .pos-report-actions .pos-table-tools {
  display: contents;
}

body.pos-ui-v2
  .pos-report-layout
  .pos-report-actions
  :is(.pos-btn, .pos-grid-reset-btn, .pos-excel-export-btn) {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.pos-report-layout .pos-report-actions [data-action-role="primary"] {
  order: 10;
}

.pos-report-layout .pos-report-actions [data-action-role="business"] {
  order: 20;
}

.pos-report-layout .pos-report-actions [data-action-role="export"],
.pos-report-layout .pos-report-actions .pos-excel-export-btn {
  order: 30;
}

.pos-report-layout .pos-report-actions .pos-grid-reset-btn {
  order: 40;
}

.pos-report-layout .pos-report-actions [data-action-role="utility"] {
  order: 50;
}

.pos-report-layout [data-report-action="apply"] {
  grid-column: 1 / -1;
}

.pos-report-layout .pos-stock-card-selected {
  min-height: 18px;
  color: var(--pos-ui-muted, #64748b);
  font-size: 11px;
}

.pos-report-layout .pos-stock-card-stats {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 8px 10px !important;
}

.pos-report-layout .pos-stock-card-table-card {
  flex: 1 1 auto;
}

/* Stock card used a full-width desktop filter before joining the report
   contract. Keep that desktop proportion; only mobile uses the stacked form. */
@media (min-width: 761px) {
  body.pos-ui-v2 #pos-stock-card-report .pos-report-workspace {
    display: flex;
    flex-direction: column;
  }

  body.pos-ui-v2 #pos-stock-card-report .pos-filter-panel {
    align-self: auto;
    flex: 0 0 auto;
  }

  body.pos-ui-v2 #pos-stock-card-report .pos-filter-grid {
    grid-template-columns: minmax(240px, 2fr) minmax(140px, 1fr) minmax(
        140px,
        1fr
      );
  }

  body.pos-ui-v2
    #pos-stock-card-report
    .pos-filter-grid
    > .pos-report-full-field {
    grid-column: 1;
  }

  body.pos-ui-v2
    #pos-stock-card-report
    .pos-filter-grid
    > [data-report-action="apply"] {
    grid-column: 1;
  }

  body.pos-ui-v2
    #pos-stock-card-report
    .pos-filter-grid
    > [data-action-role="preset"] {
    grid-column: 2;
  }

  body.pos-ui-v2 #pos-stock-card-report #sc-selected {
    grid-column: 1 / -1;
  }

  body.pos-ui-v2 #pos-stock-card-report .pos-report-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
