:root {
  --top: #0798bd;
  --top-dark: #174980;
  --active: #f6a10a;
  --line: #f2a900;
  --grid: #b9c6d2;
  --ink: #2b2f33;
  --muted: #68717c;
  --panel: #ffffff;
  --bg: #f6f7f9;
  --blue: #1184d6;
}

/* 会员信息管理：沿用旧系统的筛选区、横向完整字段表和黄白相间明细行。 */
.member-window {
  min-height: calc(100vh - 170px);
  padding: 12px 14px;
  background: #f7f8fa;
}

.member-toolbar {
  margin: 0;
}

.member-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 8px 12px;
  align-items: end;
  padding: 10px;
  border: 1px solid #a6c0cf;
  border-top: 0;
  background: #eaf4f8;
}

.member-filter-grid label,
.member-consumption-filter label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #334a60;
  font-weight: 700;
  white-space: nowrap;
}

.member-filter-grid input,
.member-filter-grid select,
.member-consumption-filter input {
  min-width: 0;
  width: 100%;
  height: 29px;
}

.member-table-zone {
  min-height: 290px;
  overflow: auto;
  border: 1px solid #9fb8c7;
  border-top: 0;
  background: #fff;
}

#customersTable .member-data-table {
  width: max-content;
  min-width: 1280px;
  table-layout: fixed;
}

#customersTable .member-data-table th {
  height: 33px;
  color: #263644;
  background: #d7e8ef;
  border-color: #9dafb8;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

#customersTable .member-data-table td {
  height: 28px;
  border-color: #c5cfd5;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#customersTable .member-data-table tbody tr:nth-child(even) td {
  background: #fff4cf;
}

#customersTable .member-data-table tbody tr.selected-row td,
#customersTable .member-data-table tbody tr.selected-row:nth-child(even) td {
  background: #cfe6ff;
  box-shadow: inset 0 -1px 0 #4d92c8, inset 0 1px 0 #4d92c8;
}

.member-totals {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  padding: 8px 12px;
  border: 1px solid #9fb8c7;
  border-top: 0;
  color: #d72323;
  background: #eaf4f8;
  font-weight: 800;
}

.member-editor {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #8fb2c5;
  background: #f4fbff;
}

.member-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px 12px;
}

.member-editor-grid label {
  display: grid;
  gap: 3px;
  color: #334a60;
  font-weight: 700;
}

.member-editor-grid input,
.member-editor-grid select {
  min-width: 0;
  height: 30px;
}

.member-editor-wide {
  grid-column: span 2;
}

.member-consumption-panel {
  margin-top: 14px;
  border: 1px solid #9fb8c7;
  background: #f7fbfd;
}

.member-consumption-panel .section-head {
  padding: 7px 10px;
  border-bottom: 1px solid #9fb8c7;
}

.member-consumption-panel .section-head span {
  color: #587084;
  font-size: 13px;
}

.member-consumption-filter {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 9px 10px;
  background: #eaf4f8;
}

.member-consumption-filter input {
  min-width: 150px;
}

@media (max-width: 1180px) {
  .member-filter-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .member-editor-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 720px) {
  .member-window { padding: 8px; }
  .member-filter-grid,
  .member-editor-grid { grid-template-columns: 1fr; }
  .member-editor-wide { grid-column: span 1; }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 24, 40, 0.35);
}

.modal-card {
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid #6e9fbd;
  box-shadow: 0 16px 40px rgba(20, 45, 67, 0.3);
  background: linear-gradient(#eaf8fb, #f7fcfe);
  padding: 12px;
}

.modal-card h3 {
  margin: -12px -12px 12px;
  padding: 8px 12px;
  color: #fff;
  background: linear-gradient(#1d5b93, #4c91b2);
  font-size: 15px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-box {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: white;
  border: 1px solid #d7dce2;
  border-radius: 4px;
}

.login-box h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 5px;
  font-size: 14px;
  color: #4a5562;
}

input, select {
  min-height: 34px;
  border: 1px solid #c7d3df;
  border-radius: 3px;
  padding: 5px 8px;
  background: white;
}

.legacy-title {
  height: 31px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: white;
  background: linear-gradient(#1f67a9, #123f77);
  font-size: 14px;
}

.legacy-nav {
  height: 72px;
  display: flex;
  align-items: stretch;
  background: var(--top);
  color: white;
}

.module-tab {
  min-width: 96px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #d8f2fb;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.module-tab.active {
  background: var(--active);
  color: white;
}

.legacy-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.legacy-search input {
  width: 220px;
  height: 31px;
}

.legacy-search button,
.power-btn,
.tab-strip a,
.tab-strip button,
.inline-tools button,
.legacy-form-row button,
.legacy-form-grid button {
  min-height: 32px;
  border: 1px solid #0d8fbb;
  border-radius: 3px;
  background: #0b9dcc;
  color: white;
  padding: 0 12px;
  text-decoration: none;
}

.power-btn {
  background: #087da1;
}

#userBadge {
  color: white;
  font-weight: 700;
  white-space: nowrap;
}

.tab-strip {
  height: 41px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding-left: 6px;
  background: #d9eef9;
  border-bottom: 2px solid #49b7d7;
}

.tab-strip button,
.tab-strip a {
  min-height: 32px;
  background: #eaf7fc;
  color: #21657e;
  border-color: #9fd3e5;
  font-weight: 700;
}

.legacy-content {
  min-height: calc(100vh - 144px);
  padding: 22px 78px;
  background: #fbfbfc;
}

.message {
  border: 1px solid #ffd29d;
  background: #fff7ed;
  color: #7a3d00;
  padding: 9px 12px;
  border-radius: 3px;
  margin-bottom: 14px;
}

.module-home,
.page {
  display: none;
  min-width: 0;
}

.module-home.active,
.page.active {
  display: block;
}

.module-group,
.legacy-section {
  margin-bottom: 22px;
  padding-bottom: 26px;
  border-bottom: 2px solid var(--line);
}

.module-title,
.legacy-section h3 {
  margin: 0 0 22px;
  font-size: 19px;
  color: #596170;
  letter-spacing: 0;
  font-weight: 700;
}

.module-title::before,
.legacy-section h3::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 3px solid #5aa5ff;
  border-radius: 4px;
  background: #eff7ff;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 128px));
  gap: 30px 38px;
}

.module-tile {
  width: 116px;
  min-height: 94px;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #3d4752;
  text-align: center;
}

.module-tile .tile-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 4px solid #4a99ff;
  border-radius: 8px;
  color: #2d83df;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(#f8fcff, #eaf4ff);
}

.module-tile:hover .tile-icon {
  border-color: #20b56b;
}

.module-tile span {
  font-size: 16px;
  font-weight: 700;
}

.filter-row,
.legacy-form-row,
.legacy-form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.legacy-form-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.employee-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.employee-role-form {
  margin-top: 10px;
}

.role-permission-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--grid);
  background: #fff;
}

.role-permission-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
}

.two-forms {
  display: grid;
  gap: 18px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.summary-cards div {
  min-height: 100px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 16px;
  color: white;
  background: #0b9dcc;
  border-radius: 4px;
}

.summary-cards div:first-child {
  background: #147bd0;
}

.summary-cards span,
.monitor-row span {
  font-size: 17px;
  font-weight: 700;
}

.summary-cards strong {
  font-size: 28px;
  letter-spacing: 0;
}

.monitor-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  padding: 20px;
  background: white;
  border: 1px solid #d7dce2;
  border-radius: 4px;
}

.monitor-row div {
  display: grid;
  place-items: center;
  gap: 12px;
}

.monitor-row strong {
  font-size: 24px;
  color: #1682cf;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h3 { margin: 0; }
.inline-tools {
  display: flex;
  gap: 8px;
}

.inline-tools input {
  width: 320px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--grid);
  background: white;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th, td {
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--grid);
  white-space: nowrap;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f0f3f6;
  color: #111;
  font-size: 15px;
  font-weight: 800;
}

table[data-resize-ready="1"] th {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 14px;
}

table[data-resize-ready="1"] td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-col-resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  z-index: 6;
  display: block;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}

.table-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 2px;
  height: calc(100% - 8px);
  background: rgba(31, 134, 181, .32);
}

.table-col-resize-handle:hover,
body.table-column-resizing .table-col-resize-handle {
  background: rgba(31, 134, 181, .16);
}

.table-col-resize-handle:hover::after,
body.table-column-resizing .table-col-resize-handle::after {
  background: #1f86b5;
}

body.table-column-resizing {
  cursor: col-resize;
  user-select: none;
}

.empty {
  padding: 12px;
  color: var(--muted);
}

.print-area { display: none; }

.legacy-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .28);
}

.legacy-dialog-panel {
  width: min(1120px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  border: 1px solid #557c9c;
  border-radius: 3px;
  background: #f3fbff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

.label-range-panel {
  width: min(510px, 94vw);
  grid-template-rows: auto 1fr auto;
  border: 2px solid #6f8ba5;
  background: #edf6fb;
}

.legacy-dialog-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  color: white;
  background: linear-gradient(#1f67a9, #123f77);
  font-size: 14px;
}

.legacy-dialog-title button,
.label-option-bar button {
  min-height: 28px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  color: #102b3f;
  font-weight: 800;
}

.purchase-report-panel {
  width: min(1500px, 96vw);
  background: #7d7d7d;
}

.purchase-report-toolbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px;
  border-bottom: 1px solid #8eb4c9;
  background: linear-gradient(#dff8ff, #88b8c9);
}

.purchase-report-toolbar button {
  min-height: 26px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  color: #102b3f;
  font-weight: 800;
}

.purchase-report-preview {
  overflow: auto;
  padding: 18px;
  background: #818181;
}

.purchase-report-paper {
  width: 270mm;
  min-height: 190mm;
  margin: 0 auto;
  padding: 14mm 10mm;
  border: 1px solid #1d4770;
  background: white;
  color: #111;
  font-family: SimSun, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
}

.purchase-report-paper h2 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 2px;
}

.purchase-report-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 16px;
  margin-bottom: 4px;
  font-weight: 700;
}

.purchase-report-page-row {
  margin: 4px 0;
  font-weight: 700;
}

.purchase-report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.purchase-report-table th,
.purchase-report-table td {
  min-height: 24px;
  border: 1px solid #333;
  padding: 2px 4px;
  overflow: visible;
  text-align: center;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.purchase-report-table th {
  background: #d6d6d6;
  font-weight: 800;
}

.purchase-report-table .report-col-name {
  min-width: 34mm;
}

.purchase-report-table .report-col-barcode,
.purchase-report-table .report-col-certificate {
  min-width: 24mm;
}

.purchase-report-table .report-col-remark {
  min-width: 24mm;
}

.purchase-report-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
  font-weight: 800;
}

.label-option-bar {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 7px;
  border-bottom: 1px solid #9ec0d4;
  background: #eaf8fd;
}

.label-option-bar label {
  min-width: 128px;
  display: grid;
  gap: 3px;
  color: #31485a;
}

.label-option-bar select,
.label-option-bar input {
  min-height: 27px;
  border-radius: 2px;
}

.label-range-body {
  display: grid;
  gap: 18px;
  padding: 42px 58px 22px;
  background: #f4fbff;
  color: #173247;
  font-size: 20px;
}

.label-range-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.label-range-line input {
  width: 17px;
  height: 17px;
}

.label-range-inputs {
  display: grid;
  grid-template-columns: 1fr 100px 28px 100px;
  align-items: center;
  gap: 12px;
  margin-top: -6px;
}

.label-range-inputs input {
  min-height: 36px;
  border: 1px solid #8fb0c2;
  border-radius: 2px;
  padding: 2px 8px;
  text-align: center;
  font-size: 18px;
}

.label-range-inputs input:disabled {
  background: #edf1f4;
  color: #8a9aa5;
}

#labelRangeTotal {
  grid-column: 1 / -1;
  color: #d71920;
  font-weight: 800;
  white-space: nowrap;
  font-size: 14px;
}

.label-range-note {
  padding: 0;
  border: 0;
  background: transparent;
  color: #ff2222;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.label-range-actions {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 16px 8px 30px;
  border-top: 0;
  background: #f4fbff;
}

.label-range-actions button {
  min-width: 102px;
  min-height: 44px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  color: #102b3f;
  font-size: 20px;
  font-weight: 800;
}

#labelCopyInput {
  width: 78px;
}

#labelZoomSelect {
  width: 92px;
}

#labelPreviewCount {
  margin-left: auto;
  color: #d71920;
  font-weight: 800;
  white-space: nowrap;
}

.label-dialog-panel {
  width: min(1340px, 96vw);
}

.purchase-import-panel {
  width: min(860px, 92vw);
  grid-template-rows: auto 1fr;
}

.purchase-import-body {
  min-height: 360px;
  padding: 42px 36px 28px;
  color: #5f6d7f;
  background: linear-gradient(#f9fcff, #e8f2f7);
  font-size: 16px;
}

.purchase-import-body p {
  margin: 0 0 20px;
  line-height: 1.45;
}

.purchase-import-file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 74px 180px 8px 0;
}

.legacy-small-btn,
.purchase-import-form button {
  min-height: 30px;
  border: 1px solid #9eb6c5;
  border-radius: 2px;
  padding: 0 18px;
  color: #31445c;
  background: linear-gradient(#fff, #dbe8ef);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
  font-weight: 700;
}

.purchase-import-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
}

.purchase-import-form label {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  color: #5f6d7f;
}

.purchase-import-form input[readonly] {
  height: 32px;
  border: 1px solid #b9cbd7;
  background: #fff;
  padding: 0 8px;
}

.purchase-import-form #purchaseImportSubmitBtn {
  grid-column: 2;
}

.purchase-import-form #purchaseImportCancelBtn {
  grid-column: 2;
}

.purchase-import-result {
  min-height: 24px;
  margin-top: 12px;
  color: #1f5c86;
  font-weight: 700;
}

.purchase-batch-panel {
  width: min(760px, 94vw);
  grid-template-rows: auto 1fr auto;
}

.purchase-batch-body {
  min-height: 520px;
  padding: 14px;
  background: #eaf3f7;
  color: #4b5d70;
}

.purchase-batch-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 34px;
  padding: 4px 8px 22px;
}

.purchase-batch-fields label,
.purchase-batch-filter-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.purchase-batch-fields label {
  grid-template-columns: 20px 68px minmax(0, 1fr);
}

.purchase-batch-fields label::after {
  content: "";
}

.purchase-batch-fields input[type="checkbox"] {
  grid-column: 1;
}

.purchase-batch-fields label {
  color: #5a6878;
}

.purchase-batch-fields select,
.purchase-batch-fields input,
.purchase-batch-filter-grid select,
.purchase-batch-filter-grid input {
  width: 100%;
  min-width: 0;
  height: 31px;
  border: 1px solid #c0d0da;
  border-radius: 2px;
  padding: 3px 7px;
  background: #fff;
  box-sizing: border-box;
}

.purchase-batch-fields input:disabled,
.purchase-batch-fields select:disabled {
  background: #eef3f6;
  color: #8a99a7;
}

.purchase-batch-wide {
  grid-column: 1 / -1;
  grid-template-columns: 20px 92px minmax(0, 1fr) !important;
}

.purchase-batch-filter {
  margin: 0;
  border: 1px solid #afc6d3;
  padding: 12px 16px 22px;
  background: #e8f2f7;
}

.purchase-batch-filter legend {
  padding: 0 6px;
  color: #4a6478;
  font-weight: 700;
}

.purchase-batch-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 42px;
}

.purchase-batch-filter-grid label {
  grid-template-columns: 82px minmax(0, 1fr);
}

.purchase-batch-filter-grid label span {
  justify-self: center;
  color: #667789;
}

.purchase-batch-match-count {
  min-height: 22px;
  padding: 10px 4px 0;
  color: #1f5c86;
  font-weight: 700;
  text-align: right;
}

.purchase-batch-actions {
  display: flex;
  justify-content: center;
  gap: 58px;
  padding: 10px;
  border-top: 1px solid #a8c0ce;
  background: #e7f1f7;
}

.purchase-batch-actions button {
  min-width: 118px;
  min-height: 34px;
  border: 1px solid #9eb6c5;
  border-radius: 2px;
  background: linear-gradient(#fff, #d7e6ee);
  color: #33475b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  font-size: 16px;
  font-weight: 900;
}

.gold-material-window {
  padding: 18px;
}

.gold-material-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0;
}

.gold-material-panel,
.gold-material-ledger-panel {
  border: 1px solid #b9cad4;
  border-radius: 4px;
  padding: 14px;
  background: #f8fcff;
}

.gold-material-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.gold-material-form label,
.gold-material-filter label {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.gold-material-form input,
.gold-material-form select,
.gold-material-filter input,
.gold-material-filter select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.gold-material-wide {
  grid-column: 1 / -1;
}

.gold-material-form button {
  grid-column: 1 / -1;
  justify-self: start;
}

.gold-material-tip {
  margin: 12px 0 0;
  color: #486879;
  line-height: 1.6;
}

.gold-material-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  background: #eaf4f8;
  border: 1px solid #c3d4de;
}

.gold-material-filter label {
  min-width: 260px;
}

.gold-material-totals {
  justify-content: flex-end;
}

.gold-material-ledger-panel {
  margin-top: 16px;
}

@media (max-width: 900px) {
  .gold-material-layout { grid-template-columns: 1fr; }
}

.label-preview-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.label-preview-area {
  position: relative;
  overflow: auto;
  padding: 14px;
  background: #dfe7ee;
}

.label-edit-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  overflow: auto;
  border-left: 1px solid #9ec0d4;
  background: #f6fbff;
}

.label-edit-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #b7cfdd;
  background: #eaf8fd;
  color: #173247;
}

#labelEditSelectedText {
  color: #d71920;
  font-weight: 800;
}

.label-edit-form {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 10px;
}

.label-edit-form label {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #31485a;
  font-size: 13px;
}

.label-edit-form input {
  width: 100%;
  min-height: 26px;
  border: 1px solid #8fb0c2;
  border-radius: 2px;
  padding: 2px 5px;
  background: white;
}

.label-edit-actions {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #b7cfdd;
}

.label-edit-actions button {
  width: 100%;
  min-height: 30px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  color: #102b3f;
  font-weight: 800;
}

.label-edit-help {
  padding: 8px 10px 10px;
  color: #7a4f00;
  background: #fffbe5;
  border-top: 1px solid #eadb9b;
  font-size: 12px;
  line-height: 1.45;
}

.label-add-back {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #b7cfdd;
  background: #f9fdff;
}

.label-add-back strong {
  color: #173247;
}

.label-deleted-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.label-deleted-fields button {
  min-height: 26px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fff, #d8edf5);
  color: #102b3f;
  font-weight: 800;
}

.label-deleted-empty {
  color: #7d8e99;
  font-size: 12px;
}

.label-item-context-menu {
  position: fixed;
  z-index: 120;
  min-width: 190px;
  padding: 4px 0;
  border: 1px solid #8fa4b2;
  background: #f8f8f8;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .25);
}

.label-item-context-menu button {
  width: 100%;
  min-height: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border: 0;
  border-radius: 0;
  padding: 4px 12px;
  background: transparent;
  color: #111;
  text-align: left;
  font-weight: 700;
}

.label-item-context-menu button:hover {
  background: #dcecff;
}

.label-item-context-menu span {
  color: #555;
  font-weight: 400;
}

.jewelry-label-sheet {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6mm;
}

.label-preview-area .jewelry-label-sheet {
  transform: scale(var(--label-preview-scale, 2.5));
  transform-origin: top left;
}

.label-preview-area .jewelry-label {
  margin: 8mm 20mm 20mm 8mm;
}

.jewelry-label {
  width: var(--label-width, 30mm);
  height: var(--label-height, 52mm);
  position: relative;
  display: block;
  overflow: visible;
  padding: 0;
  border: 1px solid #111;
  background: white;
  color: #111;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 8px;
  line-height: 1.18;
  break-inside: avoid;
  page-break-inside: avoid;
}

.jewelry-label.selected {
  outline: 2px solid #1c8bd1;
  outline-offset: 2px;
}

.label-item {
  position: absolute;
  z-index: 1;
  min-height: 3mm;
  min-width: 4mm;
  overflow: visible;
  padding: .2mm .4mm;
  cursor: move;
  line-height: 1.18;
  user-select: none;
  box-sizing: border-box;
}

.label-item:focus {
  outline: none;
}

.label-item.selected-item {
  outline: 1px dashed #168bd2;
  background: rgba(255, 248, 201, .82);
}

.label-item-resize {
  display: none;
}

.label-item.selected-item .label-item-resize {
  position: absolute;
  display: block;
  width: 9px;
  height: 9px;
  border: 1px solid #0a72b5;
  border-radius: 50%;
  background: #93d34f;
}

.label-item.selected-item .resize-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.label-item.selected-item .resize-n { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.label-item.selected-item .resize-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.label-item.selected-item .resize-e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.label-item.selected-item .resize-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.label-item.selected-item .resize-s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.label-item.selected-item .resize-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.label-item.selected-item .resize-w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.label-item-name {
  margin-right: .6mm;
}

.label-item-title {
  font-weight: 800;
}

.label-item .label-editable {
  display: inline;
  min-width: 0;
  cursor: text;
  white-space: pre-wrap;
  user-select: text;
}

.label-topline,
.label-footline {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  min-width: 0;
}

.label-topline strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.label-topline span,
.label-footline {
  color: #333;
  font-size: 7px;
}

.label-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 2mm;
  min-height: 0;
  overflow: hidden;
}

.label-main div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-barcode-bars {
  width: 100%;
  height: 8mm;
  padding: 1mm 0 .5mm;
  box-sizing: border-box;
}

.label-barcode-item .label-barcode-bars {
  height: calc(100% - 3mm);
  min-height: 3mm;
}

.barcode-svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: #111;
  shape-rendering: crispEdges;
}

.label-barcode-text {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: pre;
  font-family: "Courier New", monospace;
  font-size: 1em;
  letter-spacing: 0;
}

.label-footline span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-editable {
  display: inline-block;
  min-width: 4mm;
  max-width: 100%;
  padding: 0 1px;
  border-bottom: 1px dotted #9bb6c8;
  outline: 0;
  vertical-align: baseline;
}

.label-editable:focus {
  background: #fff8c9;
  box-shadow: 0 0 0 1px #2d8bd8 inset;
}

.label-editable::spelling-error,
.label-editable::grammar-error {
  text-decoration: none;
}

.label-guide {
  position: absolute;
  z-index: 200;
  pointer-events: none;
  border-color: #39a9e8;
  opacity: .9;
}

.label-guide-x {
  top: 0;
  bottom: 0;
  border-left: 1px dashed #39a9e8;
}

.label-guide-left {
  top: 0;
  bottom: 0;
  border-left: 2px solid #00a1ff;
  color: #006ca8;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  text-indent: 4px;
  white-space: nowrap;
}

.label-guide-y {
  left: 0;
  right: 0;
  border-top: 1px dashed #39a9e8;
}

.purchase-window {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border: 1px solid #7aa3bd;
  background: #f5fbff;
}

/* 进货单列表：始终撑满当前工作区，表格内容较多时在列表内部滚动。 */
#purchaseListView {
  min-height: calc(100vh - 170px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: stretch;
}

#purchaseListView #purchaseOrdersTable {
  min-height: calc(100vh - 330px);
  max-height: none;
  height: 100%;
}

#purchaseListView #purchaseOrdersTable .table-wrap {
  min-height: calc(100vh - 330px);
  max-height: none;
  height: 100%;
  margin: 0;
  overflow: auto;
}

/* 桌面端窗口固定为工作区高度，避免浏览器/桌面壳对内容高度计算不一致而出现只显示一小段表格。 */
#page-purchase.active { height: calc(100vh - 190px); }
#page-purchase.active #purchaseListView { height: 100%; min-height: 0; }
#page-purchase.active #purchaseOrdersTable,
#page-purchase.active #purchaseOrdersTable .table-wrap { min-height: 0; }

.major-category-hint {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #b9d9c7;
  background: #effaf3;
  color: #27613e;
}

.major-category-dialog-panel { width: min(720px, 94vw); }
.major-category-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; padding: 22px 28px; }
.major-category-form label { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 10px; color: #284f70; font-weight: 700; }
.major-category-form input, .major-category-form select { width: 100%; height: 34px; box-sizing: border-box; border: 1px solid #9bc5dc; border-radius: 3px; padding: 0 8px; }
.major-category-form-actions { grid-column: 1 / -1; display: flex; justify-content: center; gap: 20px; padding-top: 10px; border-top: 1px solid #c7e2f0; }
.major-category-form-actions button { min-width: 112px; min-height: 36px; border: 1px solid #83b6d2; background: linear-gradient(#fff,#d8ebf6); color: #174e78; font-weight: 700; cursor: pointer; }
.major-category-form-actions button[type=submit] { background: linear-gradient(#32c46d,#179a4f); border-color: #158946; color: #fff; }

.sale-payment-window { min-height: calc(100vh - 170px); display: grid; grid-template-rows: auto auto auto minmax(250px, 1fr) auto minmax(180px, .72fr); border: 1px solid #7aa3bd; background: #f5fbff; }
.sale-payment-toolbar { min-height: 58px; }
.sale-payment-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 14px; padding: 8px 10px; border-bottom: 1px solid #a5c8da; background: #eaf8fd; }
.sale-payment-filter label { display: grid; grid-template-columns: auto 160px; align-items: center; gap: 5px; color: #31485a; white-space: nowrap; }
.sale-payment-filter label:nth-child(3) { grid-template-columns: auto minmax(260px, 1fr); }
.sale-payment-filter input { min-width: 0; height: 30px; box-sizing: border-box; border: 1px solid #9fc6dc; background: #fff; }
.sale-payment-filter button { min-height: 31px; min-width: 82px; border: 1px solid #79a7c0; background: linear-gradient(#fff,#c6e5ef); color: #173f5b; font-weight: 800; }
.sale-payment-filter span { color: #e60012; font-weight: 700; }
.sale-payment-grid-title { padding: 5px 10px; border-top: 1px solid #8eb4c9; border-bottom: 1px solid #8eb4c9; background: #d8ecf5; color: #1b5f8c; text-align: center; font-size: 17px; font-weight: 800; letter-spacing: 3px; }
.sale-payment-table { min-height: 0; overflow: auto; background: #fff; }
.sale-payment-table .table-wrap { height: 100%; margin: 0; border: 0; overflow: auto; }
.sale-payment-table .table-wrap table { width: max-content; min-width: 100%; table-layout: fixed; }
.sale-payment-table th { position: sticky; top: 0; z-index: 1; background: #d7e8ef; color: #263644; text-align: center; }
.sale-payment-table td { text-align: center; }
.sale-payment-table tbody tr:nth-child(even) td { background: #fff4cf; }
.sale-payment-table tbody tr { cursor: pointer; }
.sale-payment-table tbody tr.selected-row td { background: #cfe6ff; box-shadow: inset 0 -1px #4d92c8, inset 0 1px #4d92c8; }
.sales-payment-dialog-panel { width: min(920px, 96vw); }
.sales-payment-form { padding: 18px 26px 22px; background: #eef8fc; }
.sales-payment-order-info { display: flex; flex-wrap: wrap; gap: 18px 54px; padding: 2px 8px 14px; border-bottom: 2px solid #49b7d7; color: #385166; font-size: 16px; }
.sales-payment-method-info { display: flex; flex-wrap: wrap; gap: 14px 36px; margin: 12px 8px 0; padding: 9px 12px; border: 1px solid #a9cedd; background: #f9feff; color: #21506f; font-weight: 700; }
.sales-payment-method-info strong { color: #087740; }
.sales-payment-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 56px; padding: 18px 70px; }
.sales-payment-inputs label { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; color: #1d4265; font-size: 22px; font-weight: 800; }
.sales-payment-inputs input, .sales-payment-inputs select { min-width: 0; height: 48px; box-sizing: border-box; border: 1px solid #9bbfd4; background: #fff; color: #111; padding: 0 10px; font-size: 27px; font-weight: 800; text-align: right; }
.sales-payment-inputs input:not([readonly]) { background: #cfe7cf; color: #d50000; }
.sales-payment-inputs #salesPaymentRounding { background: #f6f8fa; color: #687687; }
.sales-payment-inputs #salesPaymentWechat[readonly] { background: #dbeef9; color: #006b9c; cursor: not-allowed; }
.sales-payment-inputs #salesPaymentDifference { color: #d50000; }
.sales-payment-note { padding: 9px 12px; border: 1px solid #b9d9c7; background: #effaf3; color: #27613e; font-weight: 700; }
.sales-payment-form-actions { display: flex; justify-content: center; gap: 110px; padding-top: 18px; }
.sales-payment-form-actions button { min-width: 125px; min-height: 44px; border: 1px solid #7daecd; background: linear-gradient(#fff,#d7ebf7); color: #174e78; font-size: 21px; font-weight: 800; }
.sales-payment-form-actions button[type=submit] { background: linear-gradient(#32c46d,#179a4f); border-color: #158946; color: #fff; }
@media (max-width: 900px) { .major-category-form, .sales-payment-inputs { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; } .sale-payment-filter label, .sale-payment-filter label:nth-child(3) { grid-template-columns: auto minmax(150px, 1fr); } }

.stock-window {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  border: 1px solid #7aa3bd;
  background: #f5fbff;
}

.stock-toolbar {
  min-height: 68px;
}

.stock-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 4px 0;
  border-top: 1px solid #88b2c7;
  background: #eaf8fd;
}

.stock-tabs button {
  min-width: 96px;
  min-height: 28px;
  border: 1px solid #9ab9c9;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: #d9eaf1;
  color: #21394f;
  font-weight: 800;
}

.stock-tabs button.active {
  background: #fff;
  color: #111;
}

.stock-filter-grid {
  display: grid;
  grid-template-columns: 270px 240px 220px 220px 220px 160px;
  gap: 6px 12px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid #9ec0d4;
  border-bottom: 1px solid #9ec0d4;
  background: #f6fbff;
}

.stock-filter-grid label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #40576b;
  white-space: nowrap;
}

.stock-filter-grid label span {
  justify-self: center;
}

.stock-filter-grid input,
.stock-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  padding: 3px 7px;
  background: white;
  box-sizing: border-box;
}

.stock-filter-grid .stock-check {
  grid-template-columns: 18px auto;
  color: #4a5c70;
  font-weight: 700;
}

.stock-filter-grid button {
  min-height: 32px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #21394f;
  font-size: 17px;
  font-weight: 900;
}

.stock-filter-grid button.active,
.stock-toolbar button.active {
  background: linear-gradient(#fff8d4, #f1c96a);
  color: #7a3300;
}

.stock-advanced-compact .stock-filter-grid label:nth-of-type(n+12):nth-of-type(-n+23) {
  display: none;
}

.stock-table-zone {
  min-height: 0;
  overflow: auto;
  background: white;
}

.stock-table-zone .table-wrap {
  height: 100%;
  border: 0;
}

.stock-table-zone table {
  min-width: 2300px;
  table-layout: fixed;
}

.stock-table-zone th {
  background: #d7eaf1;
  border-right-color: #8eb0bf;
  text-align: center;
}

.stock-table-zone tbody tr:nth-child(odd) td {
  background: #fff;
}

.stock-table-zone tbody tr:nth-child(even) td {
  background: #fff5d5;
}

.stock-table-zone tbody tr {
  cursor: pointer;
}

.stock-table-zone tbody tr.selected-row td,
.stock-table-zone tbody tr.selected-row:nth-child(even) td,
.stock-table-zone tbody tr.selected-row:nth-child(odd) td {
  background: #cbe7ff;
  box-shadow: inset 0 -1px 0 #4997c8, inset 0 1px 0 #4997c8;
}

/* 库存查询：商品条码为固定首列，横向查看完整字段时始终可见。 */
.stock-data-table .stock-barcode-column {
  position: sticky;
  left: 0;
}

.stock-data-table th.stock-barcode-column {
  z-index: 8;
  background: #d7eaf1;
  box-shadow: 2px 0 0 #8eb0bf;
}

.stock-data-table tbody tr:nth-child(odd) td.stock-barcode-column {
  z-index: 4;
  background: #fff;
  box-shadow: 2px 0 0 #d4dee3;
}

.stock-data-table tbody tr:nth-child(even) td.stock-barcode-column {
  z-index: 4;
  background: #fff5d5;
  box-shadow: 2px 0 0 #d4dee3;
}

.stock-data-table tbody tr.selected-row td.stock-barcode-column {
  z-index: 5;
  background: #cbe7ff;
  box-shadow: 2px 0 0 #4997c8;
}

.outbound-query-data-table {
  table-layout: fixed;
}

.outbound-query-data-table th {
  position: relative;
  white-space: nowrap;
  overflow: visible;
}

.outbound-query-data-table th > span {
  display: block;
  min-width: 0;
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outbound-query-data-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outbound-query-col-resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  z-index: 6;
  display: block;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.outbound-query-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 2px;
  height: calc(100% - 8px);
  background: transparent;
}

.outbound-query-col-resize-handle:hover,
body.outbound-query-column-resizing .outbound-query-col-resize-handle {
  background: rgba(31, 134, 181, 0.16);
}

.outbound-query-col-resize-handle:hover::after,
body.outbound-query-column-resizing .outbound-query-col-resize-handle::after {
  background: #1f86b5;
}

body.outbound-query-column-resizing,
body.outbound-query-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.stock-totals {
  display: flex;
  justify-content: flex-end;
  gap: 34px;
  padding: 6px 12px;
  border-top: 1px solid #bccdd8;
  background: #e8f0f4;
  color: #d71920;
  font-weight: 900;
}

.stock-photo-panel {
  width: min(720px, 94vw);
  grid-template-rows: auto 1fr auto;
}

.stock-photo-body {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #eef8fc;
}

.stock-photo-info {
  display: grid;
  gap: 6px;
  color: #24465d;
}

.stock-photo-file {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #24465d;
  font-weight: 800;
}

.stock-photo-preview {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px solid #9fbac8;
  background: white;
  color: #7c8c97;
}

.stock-photo-preview img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.stock-photo-body p {
  margin: 0;
  color: #7a4f00;
  font-size: 13px;
}

.stock-column-panel {
  width: min(760px, 94vw);
  grid-template-rows: auto 1fr auto;
}

.stock-column-list {
  max-height: 62vh;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
  overflow: auto;
  padding: 14px;
  background: #eef8fc;
}

.stock-column-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid #bad0dc;
  background: #fff;
  color: #223e51;
  font-weight: 700;
}

.sale-detail-window {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border: 1px solid #7aa3bd;
  background: #eef8fc;
}

.sale-detail-toolbar {
  min-height: 68px;
}

.sale-detail-filter-grid {
  display: grid;
  grid-template-columns: 220px 180px 180px 180px 180px 110px 120px 140px;
  gap: 7px 12px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid #95bacb;
  border-bottom: 1px solid #95bacb;
  background: #e7f5fa;
}

.sale-detail-filter-grid label {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #4a5c70;
  font-weight: 700;
}

.sale-detail-filter-grid label.sale-check {
  grid-template-columns: 18px auto;
  white-space: nowrap;
}

.sale-detail-filter-grid input,
.sale-detail-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  padding: 3px 7px;
  background: white;
}

.sale-detail-filter-grid button {
  min-height: 32px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #111;
  font-weight: 800;
}

.sale-detail-filter-grid #salesKeyword {
  min-width: 260px;
}

.sale-detail-table-zone {
  min-height: 0;
  overflow: auto;
  background: white;
}

.sale-detail-table-zone .table-wrap {
  height: 100%;
  border: 0;
}

.sale-detail-table-zone table {
  min-width: 7550px;
  table-layout: fixed;
}

.sale-detail-table-zone th {
  background: #d7eaf1;
  border-right-color: #8eb0bf;
  text-align: center;
  white-space: nowrap;
}

.sale-detail-table-zone td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.sales-document-items-panel {
  margin-top: 10px;
  border: 2px solid #4d9cc5;
  background: #fff;
}

.sales-document-items-panel h3 {
  margin: 0;
  padding: 7px 12px;
  text-align: center;
  color: #1a6f9e;
  font-size: 18px;
  letter-spacing: 3px;
  background: #e0f3fb;
  border-bottom: 1px solid #9dc6d9;
}

.sales-document-items-panel .table-wrap {
  max-height: 330px;
  border: 0;
}

.sales-document-items-panel table {
  min-width: 1940px;
  table-layout: fixed;
}

.sales-document-items-panel th {
  background: #d7eaf1;
  text-align: center;
}

.sales-document-items-panel td {
  text-align: center;
}

.sales-summary-toolbar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:10px 0 14px; color:#315d7a; font-weight:700; }
.sales-summary-toolbar label { display:flex; align-items:center; gap:7px; }
.sales-summary-toolbar input,.sales-summary-toolbar select { min-height:32px; border:1px solid #a9cbdc; border-radius:3px; padding:0 8px; background:#fff; }
.sales-summary-table-zone .sales-summary-title { font-size:20px; font-weight:700; text-align:center; color:#244d6b; margin:4px 0 10px; }
.sales-summary-table-zone .sales-summary-meta { color:#4b6c82; padding:0 0 8px; }
.sales-summary-table-zone table { min-width:1360px; border-collapse:collapse; }
.sales-summary-table-zone th { background:#d7eaf1; color:#1c435e; white-space:nowrap; }
.sales-summary-table-zone th,.sales-summary-table-zone td { border:1px solid #b5cbd7; padding:7px 8px; text-align:right; white-space:nowrap; }
.sales-summary-table-zone th:nth-child(-n+4),.sales-summary-table-zone td:nth-child(-n+4) { text-align:center; }
.sales-summary-subtotal td { background:#cffff0; font-weight:700; }
.sales-summary-total td { background:#dceef8; color:#174562; font-weight:800; }
.turnover-window { min-height:calc(100vh - 210px); }
.turnover-filter-row { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; padding:10px; border-top:1px solid #b9d3df; border-bottom:1px solid #b9d3df; background:#e7f5fb; color:#315d7a; font-weight:700; }
.turnover-filter-row label,.turnover-grouping { display:flex; align-items:center; gap:6px; white-space:nowrap; }
.turnover-filter-row select,.turnover-filter-row input[type="date"] { min-height:31px; border:1px solid #a9cbdc; border-radius:3px; padding:0 7px; background:#fff; }
.turnover-filter-row button,.report-export-toolbar button { min-height:31px; border:1px solid #8fb2c4; border-radius:3px; background:linear-gradient(#fff,#c8e0ea); color:#21394f; font-weight:700; }
.turnover-grouping input { width:18px; height:18px; accent-color:#3385b5; }
.report-export-toolbar { display:flex; gap:10px; padding:8px 0; color:#315d7a; }
.turnover-table-zone { padding-top:4px; }
.turnover-report-title { margin:4px 0 10px; color:#244d6b; font-size:22px; font-weight:800; text-align:center; }
.turnover-report-meta,.turnover-report-footer { padding:0 10px 9px; color:#4b6c82; }
.turnover-table-zone table { min-width:1080px; border-collapse:collapse; }
.turnover-table-zone th,.turnover-table-zone td { border:1px solid #b5cbd7; padding:7px 10px; text-align:right; white-space:nowrap; }
.turnover-table-zone th { background:#d7eaf1; color:#1c435e; text-align:center; }
.turnover-table-zone th:nth-child(-n+2),.turnover-table-zone td:nth-child(-n+2) { text-align:center; }
.turnover-total td { background:#dceef8; color:#174562; font-weight:800; }
.turnover-print .turnover-report-title { font-size:20px; }
.reports-advanced-panel { width:min(980px,94vw); }
.reports-advanced-groups { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:0; max-height:520px; overflow:auto; border:1px solid #c4dce9; }
.reports-advanced-group { min-width:0; border-right:1px solid #c4dce9; padding:10px; }
.reports-advanced-group h4 { margin:0 0 8px; color:#25577a; }
.reports-advanced-group>div { display:grid; gap:7px; }
.reports-advanced-group label { display:flex; align-items:center; gap:6px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.reports-advanced-group input { width:18px; height:18px; flex:0 0 auto; }
@media (max-width:900px) { .reports-advanced-groups { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.sale-detail-table-zone tbody tr:nth-child(odd) td {
  background: #fff;
}

.sale-detail-table-zone tbody tr:nth-child(even) td {
  background: #fff5d5;
}

.sale-detail-totals {
  display: flex;
  justify-content: flex-end;
  gap: 34px;
  padding: 6px 12px;
  border-top: 1px solid #9ab9c9;
  background: #edf6fa;
  color: #d71920;
  font-weight: 800;
}

.sales-member-panel {
  width: min(1180px, 88vw);
  height: min(560px, 74vh);
  border: 1px solid #628eb0;
  box-shadow: 0 10px 28px rgba(21, 56, 88, .28);
}

.sales-member-body {
  min-height: 0;
  display: grid;
  grid-template-rows: 178px auto 1fr;
  background: #f5fbff;
}

.sales-member-search {
  display: grid;
  grid-template-columns: 470px 1fr;
  gap: 64px;
  align-items: center;
  padding: 34px 56px 14px;
}

.sales-member-search strong {
  display: block;
  margin-bottom: 16px;
  color: #2a4770;
  font-size: 24px;
  letter-spacing: 0;
}

.sales-member-search input {
  width: 390px;
  height: 58px;
  border: 2px solid #c9d6e0;
  background: white;
  font-size: 26px;
  padding: 6px 10px;
}

.sales-member-actions {
  display: flex;
  gap: 38px;
  margin-top: 8px;
}

.sales-member-actions button {
  min-width: 104px;
  min-height: 42px;
  border: 1px solid #a9bac7;
  background: linear-gradient(#f7fbfe, #cadbe6);
  color: #24384d;
  font-size: 18px;
  font-weight: 800;
}

.sales-member-qrcode {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #ff8a00;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.35;
}

.sales-member-qr {
  width: 108px;
  height: 108px;
  border: 6px solid white;
  background:
    linear-gradient(90deg, #111 50%, transparent 0) 0 0 / 12px 12px,
    linear-gradient(#111 50%, transparent 0) 0 0 / 12px 12px,
    #fff;
  box-shadow: 0 0 0 1px #999;
}

.sales-member-tip {
  color: #ff2c2c;
  font-size: 18px;
  font-weight: 800;
  padding: 0 4px 4px;
}

.sales-member-table {
  min-height: 0;
  overflow: auto;
  border-top: 1px solid #9fb8c7;
  background: white;
}

.sales-member-table .table-wrap {
  height: 100%;
  border: 0;
}

.sales-member-table table {
  table-layout: fixed;
}

.sales-member-table th {
  height: 31px;
  background: #d7e8ef;
  border-color: #9dafb8;
  color: #263644;
  text-align: center;
  white-space: nowrap;
}

.sales-member-table td {
  height: 28px;
  border-color: #c5cfd5;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-member-table tbody tr:nth-child(even) td {
  background: #fff4cf;
}

.sales-member-table tbody tr.selected-row td,
.sales-member-table tbody tr.selected-row:nth-child(even) td {
  background: #cfe6ff;
  box-shadow: inset 0 -1px 0 #4d92c8, inset 0 1px 0 #4d92c8;
}

.profit-window {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  border: 1px solid #7aa3bd;
  background: white;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.profit-tabs {
  display: flex;
  gap: 4px;
  padding: 3px 4px 0;
  border-bottom: 2px solid #36b8e5;
  background: #eff8fd;
}

.profit-tabs button {
  min-height: 35px;
  min-width: 118px;
  border: 1px solid #a6cde1;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(#fdfefe, #d9eff8);
  color: #15749c;
  font-weight: 700;
}

.profit-tabs button.active {
  background: linear-gradient(#75d4f7, #17a6d8);
  color: white;
}

.profit-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #b8d9e8;
  background: #f8fdff;
  overflow: hidden;
}

.profit-filter-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 170px;
  min-width: 0;
  white-space: nowrap;
}

.profit-filter-grid label.profit-check {
  grid-template-columns: 18px auto;
  width: auto;
  min-width: 74px;
}

.profit-filter-grid label.profit-keyword {
  width: 270px;
}

.profit-filter-grid > span {
  flex: 0 0 auto;
  color: #21394a;
  font-weight: 700;
}

.profit-filter-grid input,
.profit-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8cbd7;
  background: white;
}

.profit-filter-grid button {
  flex: 0 0 auto;
  min-width: 82px;
  min-height: 32px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #146f9b;
  font-weight: 700;
}

.profit-report-toolbar {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  background: #d7ecf8;
  color: #467084;
  border-bottom: 1px solid #b8d9e8;
}

.profit-report-toolbar button {
  border: 0;
  background: transparent;
  color: #2b6f8d;
  font-weight: 700;
}

.profit-report-toolbar input {
  width: 58px;
  height: 24px;
  text-align: center;
  border: 1px solid #aebdc4;
}

.profit-report-zone {
  min-height: 0;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  background: white;
}

.profit-report-title {
  padding: 12px 0 8px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.profit-report-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 48px;
  padding: 0 64px 6px;
  font-weight: 700;
}

.profit-report-zone .table-wrap {
  border: 0;
}

.profit-report-zone table {
  min-width: 1280px;
  table-layout: fixed;
  border-collapse: collapse;
}

.profit-report-zone th {
  background: #dff1f8;
  border: 1px solid #9aaab2;
  text-align: center;
  white-space: nowrap;
}

.profit-report-zone td {
  border: 1px solid #b4b4b4;
  padding: 6px 4px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profit-report-zone td:first-child,
.profit-report-zone td:nth-child(2),
.profit-report-zone td:nth-child(3),
.profit-report-zone td:nth-child(4),
.profit-report-zone td:nth-child(5) {
  text-align: left;
}

.profit-report-zone tbody tr:nth-child(even) td {
  background: #eef9ff;
}

.profit-total-row {
  padding: 8px 12px;
  background: #dff1f8;
  border-top: 1px solid #a7c4d1;
  font-weight: 800;
}

.stock-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 10px;
  border-top: 1px solid #aac2cf;
  background: #e6f4fa;
}

.stock-dialog-actions button {
  min-width: 110px;
  min-height: 32px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  color: #102b3f;
  font-weight: 800;
}

.outbound-window {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #7aa3bd;
  background: #f5fbff;
}

.outbound-toolbar {
  min-height: 68px;
}

.outbound-filter-grid {
  display: grid;
  grid-template-columns: 290px 58px 128px 128px 210px 170px 240px 240px 98px;
  gap: 6px 10px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid #9ec0d4;
  border-bottom: 1px solid #9ec0d4;
  background: #f6fbff;
}

.outbound-query-filter-grid {
  display: grid;
  grid-template-columns: 220px 150px 190px 150px 170px 74px 138px 156px 170px minmax(220px, 1fr) 96px;
  gap: 6px 8px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid #9ec0d4;
  border-bottom: 1px solid #9ec0d4;
  background: #f6fbff;
  overflow-x: auto;
}

.outbound-filter-grid label,
.outbound-query-filter-grid label,
.outbound-header-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #40576b;
  white-space: nowrap;
}

.outbound-filter-grid input,
.outbound-filter-grid select,
.outbound-query-filter-grid input,
.outbound-query-filter-grid select,
.outbound-header-grid input,
.outbound-header-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  padding: 3px 7px;
  background: white;
  box-sizing: border-box;
}

.outbound-filter-grid button,
.outbound-query-filter-grid button,
.outbound-header-grid button {
  min-height: 32px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #21394f;
  font-size: 17px;
  font-weight: 900;
}

.outbound-date-check {
  grid-template-columns: 18px auto !important;
}

.outbound-header-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 6px 12px;
  align-items: center;
  padding: 8px;
  width: 100%;
  max-width: 100%;
  border-bottom: 1px solid #9ec0d4;
  background: #f6fbff;
}

.outbound-header-grid .outbound-remark {
  grid-column: span 2;
}

.outbound-header-grid .outbound-barcode {
  grid-column: span 2;
}

.outbound-header-grid button {
  width: 100%;
  min-width: 0;
}

#outboundBarcodeInput {
  background: #c7e3c6;
}

.outbound-entry-table {
  min-width: 2340px;
}

.outbound-entry-table input {
  width: 100%;
  height: calc(var(--purchase-row-height, 34px) - 8px);
  border: 0;
  padding: 2px 4px;
  background: transparent;
  box-sizing: border-box;
}

.outbound-list-totals {
  justify-content: flex-start;
}

.legacy-toolbar {
  min-height: 68px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 4px;
  border-bottom: 1px solid #6ca2c3;
  background: linear-gradient(#21558e, #c9f4ef);
}

.legacy-toolbar button {
  min-width: 70px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: rgba(255,255,255,.16);
  color: #102b3f;
  font-weight: 700;
}

.legacy-toolbar button:hover {
  border-color: #5f9fc3;
  background: rgba(255,255,255,.45);
}

.purchase-filter,
.purchase-header-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(110px, 1fr));
  gap: 4px 8px;
  align-items: end;
  padding: 7px;
  border-bottom: 1px solid #9ec0d4;
  background: #eaf8fd;
}

.purchase-filter label,
.purchase-header-grid label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px;
  color: #31485a;
  white-space: nowrap;
  min-width: 0;
}

.purchase-filter input,
.purchase-filter select,
.purchase-header-grid input,
.purchase-header-grid select {
  width: 100%;
  min-width: 0;
  min-height: 27px;
  border-radius: 2px;
  padding: 3px 6px;
  box-sizing: border-box;
}

.purchase-filter button {
  min-height: 31px;
  border: 1px solid #79a7c0;
  border-radius: 2px;
  background: linear-gradient(#fdfefe, #c6e5ef);
  font-weight: 800;
  font-size: 18px;
}

.purchase-header-grid {
  grid-template-columns: 180px 240px 210px 300px minmax(520px, 1fr);
  grid-template-areas:
    "store warehouse date no retailFormula"
    "category supplier original reviewDate purchaseFormula"
    "saleMethod remark remark status checks";
  align-items: center;
  gap: 6px 14px;
}

.purchase-header-grid .wide {
  grid-column: span 2;
}

.purchase-header-grid .header-store { grid-area: store; }
.purchase-header-grid .header-warehouse { grid-area: warehouse; }
.purchase-header-grid .header-date { grid-area: date; }
.purchase-header-grid .header-no { grid-area: no; }
.purchase-header-grid .header-retail-formula { grid-area: retailFormula; }
.purchase-header-grid .header-category { grid-area: category; }
.purchase-header-grid .header-supplier { grid-area: supplier; }
.purchase-header-grid .header-original { grid-area: original; }
.purchase-header-grid .header-review-date { grid-area: reviewDate; }
.purchase-header-grid .header-purchase-formula { grid-area: purchaseFormula; }
.purchase-header-grid .header-sale-method { grid-area: saleMethod; }
.purchase-header-grid .header-remark { grid-area: remark; }
.purchase-header-grid .header-status { grid-area: status; }

.purchase-header-grid .header-checks {
  grid-area: checks;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
}

.purchase-header-grid .checkline {
  display: inline-grid;
  grid-template-columns: 16px auto;
  justify-content: start;
  align-items: center;
  gap: 3px;
  color: #405566;
  font-size: 13px;
}

.purchase-header-grid .header-retail-formula select,
.purchase-header-grid .header-purchase-formula select {
  min-width: 0;
}

.purchase-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  border-top: 1px solid #a8bfcc;
  border-bottom: 1px solid #a8bfcc;
  background: white;
}

.purchase-entry-table {
  min-width: 3035px;
  --purchase-row-height: 34px;
  table-layout: fixed;
}

.purchase-entry-table th,
.purchase-entry-table td {
  padding: 2px 3px;
}

.purchase-entry-table thead {
  user-select: none;
}

.purchase-entry-table th {
  position: relative;
  overflow: visible;
  background: #d7eaf1;
  height: 30px;
  border-bottom: 3px solid #97bed0;
  border-right-color: #8eb0bf;
  padding-right: 10px;
  text-align: center;
  vertical-align: middle;
}

.purchase-col-resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  z-index: 6;
  display: block;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.purchase-entry-table th::before {
  content: "";
  position: absolute;
  left: 0;
  right: 8px;
  bottom: -5px;
  z-index: 1;
  height: 9px;
  cursor: row-resize;
}

.purchase-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 2px;
  height: calc(100% - 8px);
  background: rgba(31, 134, 181, 0.32);
}

.purchase-col-resize-handle:hover,
body.purchase-column-resizing .purchase-col-resize-handle {
  background: rgba(31, 134, 181, 0.16);
}

.purchase-col-resize-handle:hover::after,
body.purchase-column-resizing .purchase-col-resize-handle::after {
  background: #1f86b5;
  box-shadow: inset -1px 0 0 #1f86b5;
}

.purchase-entry-table thead:hover th {
  border-bottom-color: #1f86b5;
  box-shadow: inset 0 -1px 0 #e6f7ff;
}

.purchase-entry-table tbody td {
  height: var(--purchase-row-height, 34px);
  min-height: var(--purchase-row-height, 34px);
  padding-top: 3px;
  padding-bottom: 3px;
  vertical-align: middle;
  overflow: visible;
}

.purchase-entry-table .row-no-col,
.purchase-entry-table .purchase-row-no {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
}

.purchase-entry-table .purchase-row-no {
  border-right: 1px solid #9fb6c4;
  background: #e5edf2;
  color: #1d3950;
  font-weight: 800;
  user-select: none;
}

.purchase-entry-table input,
.purchase-entry-table select {
  width: 100%;
  height: calc(var(--purchase-row-height, 34px) - 8px);
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 2px 4px;
  background: transparent;
  box-sizing: border-box;
  line-height: normal;
}

.purchase-entry-table td:focus-within {
  outline: 2px solid #5da9d4;
  outline-offset: -2px;
}

.purchase-entry-table tr:nth-child(odd) td {
  background: #fff8dc;
}

.purchase-entry-table tr:nth-child(odd) .purchase-row-no,
.purchase-entry-table tr:nth-child(even) .purchase-row-no {
  background: #e5edf2;
}

.purchase-entry-table tr.selected td,
#purchaseOrdersTable tr.selected td {
  background: #cfeaf6;
}

.inventory-count-window {
  grid-template-rows: auto auto 1fr auto auto;
}

.inventory-count-filter-grid {
  display: grid;
  grid-template-columns: 220px 240px 130px 130px 150px minmax(260px, 1fr) 90px;
  gap: 6px 10px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid #9ec0d4;
  border-bottom: 1px solid #9ec0d4;
  background: #eef7fb;
}

.inventory-count-filter-grid label,
.inventory-count-editor-grid label,
.inventory-count-scan-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #21394f;
  font-size: 13px;
}

.inventory-count-filter-grid input,
.inventory-count-filter-grid select,
.inventory-count-editor-grid input,
.inventory-count-editor-grid select,
.inventory-count-scan-grid input {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  padding: 2px 5px;
  background: #fff;
}

.inventory-count-filter-grid button,
.inventory-count-actions button,
.inventory-count-scan-card button,
.inventory-count-scope-card button {
  min-height: 30px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #21394f;
  font-weight: 700;
}

.inventory-count-editor-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.4fr) minmax(420px, 1fr) 240px;
  gap: 8px;
  padding: 8px;
  background: #eef7fb;
  border-top: 1px solid #9ec0d4;
  border-bottom: 1px solid #9ec0d4;
}

.inventory-count-editor-legacy-grid {
  grid-template-columns: 490px 480px 330px;
  align-items: stretch;
  padding: 8px;
  background: linear-gradient(#e8f5f8, #eef9fb);
}

.inventory-count-editor-grid fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid #9ec0d4;
  background: #f8fcfe;
}

.inventory-count-range-panel {
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: auto 42px 42px;
  align-content: start;
}

.inventory-count-range-panel label {
  grid-column: 1 / -1;
}

.inventory-count-range-panel #countChooseScopeBtn {
  grid-column: 1 / 2;
}

.inventory-count-range-panel #countScanBtn {
  grid-column: 2 / 3;
}

.inventory-count-range-panel #countImportBtn {
  grid-column: 2 / 3;
}

.inventory-count-info-panel {
  grid-template-columns: 1fr 1fr !important;
}

.inventory-count-query-actions {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px;
  align-content: start;
}

.inventory-count-query-actions button {
  min-height: 34px;
}

.inventory-count-editor-grid legend {
  padding: 0 5px;
  color: #244a64;
  font-weight: 800;
}

.inventory-count-remark {
  grid-column: 1 / -1;
}

.inventory-count-actions {
  grid-template-columns: 1fr !important;
  align-content: start;
}

.inventory-count-entry-table {
  min-width: 2180px;
}

.inventory-count-entry-table thead tr:first-child th {
  height: 32px;
  text-align: center;
}

.inventory-count-entry-table thead tr:nth-child(2) th {
  height: 24px;
  font-size: 12px;
}

.inventory-count-entry-table .count-qty-input {
  text-align: right;
  font-weight: 700;
}

.inventory-count-entry-table tr.count-done-row td {
  background: #e8f7e9;
}

.inventory-count-scan-card {
  width: min(760px, 92vw);
}

.inventory-count-manual-card {
  width: min(1280px, 96vw);
  max-height: 90vh;
}

.inventory-count-manual-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) minmax(360px, 410px);
  gap: 10px;
  min-height: 620px;
}

.inventory-count-manual-left {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.inventory-count-manual-info,
.inventory-count-stock-info,
.inventory-count-recent-panel {
  margin: 0;
  border: 1px solid #89b2ca;
  background: #edf8fb;
}

.inventory-count-manual-info {
  display: grid;
  grid-template-columns: 110px 210px 120px 1fr 190px;
  gap: 8px 10px;
  align-items: center;
  padding: 8px;
}

.inventory-count-manual-info legend,
.inventory-count-stock-info legend,
.inventory-count-recent-panel legend {
  padding: 0 6px;
  color: #31536b;
  font-weight: 800;
}

.inventory-count-manual-info .barcode-line {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  font-size: 18px;
  font-weight: 800;
}

.inventory-count-manual-info .barcode-line input {
  height: 54px;
  background: #cfe8ce;
  font-size: 22px;
  font-weight: 800;
}

.count-scan-tip {
  grid-column: 2 / 5;
  color: #f01818;
  font-size: 16px;
}

.inventory-count-manual-info > label:not(.barcode-line) {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  font-size: 16px;
  font-weight: 700;
}

.inventory-count-manual-info input {
  height: 32px;
  border: 1px solid #aebfca;
  background: #fff;
  padding: 3px 6px;
}

.count-scan-done {
  grid-column: 1 / 3;
  font-size: 16px;
  font-weight: 800;
  color: #384b64;
}

.count-scan-done strong {
  color: #0c3d76;
  font-size: 20px;
}

.count-scan-buttons {
  grid-column: 3 / 4;
  display: grid;
  gap: 6px;
}

.count-scan-options {
  grid-column: 4 / -1;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.count-scan-options label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.count-scan-options input {
  width: auto;
  height: auto;
}

.inventory-count-stock-info {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 1fr;
  gap: 8px 10px;
  padding: 8px;
}

.inventory-count-stock-info label {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.inventory-count-stock-info label:first-of-type {
  grid-column: span 2;
}

.inventory-count-stock-info input {
  height: 30px;
  border: 1px solid #b8c8d2;
  background: #fff;
  padding: 3px 5px;
}

.inventory-count-recent-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 8px;
  min-width: 0;
}

.inventory-count-recent-table-zone {
  min-height: 0;
  height: 100%;
  max-width: 100%;
  overflow: auto;
}

.inventory-count-recent-table {
  min-width: 544px;
  width: 100%;
  table-layout: fixed;
}

.inventory-count-recent-table th {
  position: relative;
  background: #d7eaf1;
  height: 30px;
  padding-right: 12px;
  user-select: none;
}

.inventory-count-recent-col-resize-handle {
  position: absolute;
  top: 0;
  right: -6px;
  z-index: 6;
  display: block;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.inventory-count-recent-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 2px;
  height: calc(100% - 8px);
  background: rgba(31, 134, 181, 0.32);
}

.inventory-count-recent-col-resize-handle:hover,
body.inventory-count-recent-column-resizing .inventory-count-recent-col-resize-handle {
  background: rgba(31, 134, 181, 0.16);
}

.inventory-count-recent-col-resize-handle:hover::after,
body.inventory-count-recent-column-resizing .inventory-count-recent-col-resize-handle::after {
  background: #1f86b5;
  box-shadow: inset -1px 0 0 #1f86b5;
}

body.inventory-count-recent-column-resizing,
body.inventory-count-recent-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

@media (max-width: 1160px) {
  .inventory-count-manual-layout {
    grid-template-columns: 1fr;
  }

  .inventory-count-recent-panel {
    min-height: 260px;
  }
}

.inventory-count-scope-card {
  width: min(1120px, 94vw);
  max-height: 86vh;
  overflow: auto;
}

.inventory-count-scope-columns {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.inventory-count-scope-group {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 330px;
  border: 1px solid #9db8c8;
  background: #eef8fa;
}

.inventory-count-scope-title {
  padding: 6px 8px 2px;
  color: #244a64;
  font-weight: 800;
}

.inventory-count-scope-tools {
  padding: 0 8px 5px;
  font-size: 12px;
  color: #486073;
}

.inventory-count-scope-tools label,
.inventory-count-scope-list label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.inventory-count-scope-list {
  min-height: 0;
  max-height: 300px;
  overflow: auto;
  margin: 0 8px 8px;
  padding: 5px;
  border: 1px solid #b9ccd8;
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
}

.inventory-count-scope-list input {
  width: auto;
  height: auto;
}

.inventory-count-purchase-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.inventory-count-purchase-row label {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.inventory-count-purchase-row input {
  width: 100%;
  height: 30px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  padding: 2px 5px;
}

.inventory-count-scan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.inventory-count-recent {
  max-height: 130px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid #d3e2ea;
  background: #f7fbfd;
  padding: 6px;
  font-size: 13px;
}

body.purchase-row-resizing,
body.purchase-row-resizing * {
  cursor: row-resize !important;
  user-select: none !important;
}

body.purchase-column-resizing,
body.purchase-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.purchase-row-menu {
  position: fixed;
  z-index: 80;
  min-width: 118px;
  padding: 2px;
  border: 1px solid #6d8fa4;
  border-radius: 2px;
  background: #f7fbff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.purchase-row-menu button {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #102b3f;
  text-align: left;
  font-weight: 800;
}

.purchase-row-menu button:hover {
  background: #cfeaf6;
}

.purchase-totals {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 6px 12px;
  border-top: 1px solid #bccdd8;
  background: #e8f0f4;
  color: #d71920;
  font-weight: 800;
}

.purchase-statusbar {
  min-height: 24px;
  padding: 4px 8px;
  border-top: 1px solid #9eb8c8;
  background: #edf7ff;
  color: #e60012;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#batchOutboundEditorView .stock-totals {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px 28px;
  width: 100%;
  max-width: 100%;
}

.assist-window {
  grid-template-rows: auto auto 1fr auto auto;
}

.assist-filter-grid {
  display: grid;
  grid-template-columns: 260px minmax(320px, 1fr) 170px 170px 82px 260px 90px;
  gap: 6px 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #b8cbd7;
  background: #e7f5fb;
}

.assist-list-filter {
  grid-template-columns: 190px 160px 160px 170px 150px minmax(260px, 1fr) 82px;
}

.assist-editor-filter {
  grid-template-columns: 170px 190px 170px 150px 190px minmax(220px, 1fr) 260px 90px;
}

#skuEditListView,
#skuEditEditorView,
#weightAdjustListView,
#weightAdjustEditorView {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 8px;
}

.assist-filter-grid label {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #4a5c70;
  font-size: 14px;
}

.assist-filter-grid .assist-add {
  grid-template-columns: 90px minmax(0, 1fr);
}

.assist-filter-grid input,
.assist-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8cbd7;
  border-radius: 2px;
  background: white;
}

.assist-filter-grid button {
  min-height: 32px;
  border: 1px solid #8fb2c4;
  border-radius: 2px;
  background: linear-gradient(#fff, #c8e0ea);
  color: #21394f;
  font-weight: 700;
}

.assist-table-zone table {
  table-layout: fixed;
}

.assist-edit-table input,
.assist-edit-table select {
  width: 100%;
  min-width: 0;
  height: 27px;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 2px 4px;
  background: transparent;
  color: #111;
}

.assist-edit-table input:focus,
.assist-edit-table select:focus {
  border-color: #4b95c7;
  background: #fff;
  outline: 0;
}

.assist-edit-table td {
  padding: 0 3px;
}

@media (max-width: 1500px) {
  .outbound-header-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }
}

@media (max-width: 980px) {
  .outbound-header-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

#purchaseOrdersTable {
  overflow: auto;
}

#purchaseOrdersTable table {
  min-width: 1700px;
}

#purchaseOrdersTable tbody tr {
  cursor: pointer;
}

#purchaseOrdersTable tbody tr:nth-child(even) td {
  background: #fff5d5;
}

.color-cell {
  display: inline-block;
  min-width: 86px;
  padding: 2px 6px;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}

@media (max-width: 900px) {
  .legacy-nav {
    height: auto;
    flex-wrap: wrap;
  }
  .module-tab {
    min-height: 46px;
    font-size: 16px;
  }
  .legacy-search {
    width: 100%;
    padding: 8px;
  }
  .legacy-content {
    padding: 16px;
  }
  .filter-row,
  .legacy-form-row,
  .legacy-form-grid,
  .summary-cards {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }
  body > *:not(.print-area) { display: none !important; }
  .print-area {
    display: block;
    padding: 0;
    font-family: Arial, sans-serif;
  }
  .print-area .jewelry-label-sheet {
    display: block;
    gap: 0;
    width: var(--label-width, 30mm);
    transform: none !important;
  }
  .print-area .jewelry-label {
    width: var(--label-width, 30mm) !important;
    height: var(--label-height, 52mm) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none;
    box-sizing: border-box;
    overflow: hidden;
    break-after: auto;
    page-break-after: auto;
  }
  .print-area .jewelry-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .print-area .jewelry-label.selected {
    outline: 0 !important;
    outline-offset: 0 !important;
  }
  .print-area .outside-print-area {
    display: none !important;
  }
  .print-area .label-item-resize {
    display: none !important;
  }
  .print-area .label-editable {
    border-bottom: 0;
    box-shadow: none;
    background: transparent;
  }
  .print-area .purchase-report-paper {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .print-area .purchase-report-table th,
  .print-area .purchase-report-table td {
    min-height: 22px;
    font-size: 10px;
  }
  .receipt {
    width: 58mm;
    font-size: 12px;
    margin: 8mm;
  }
  .label-grid {
    display: grid;
    grid-template-columns: repeat(2, 40mm);
    gap: 4mm;
  }
  .barcode-label {
    border: 1px solid #000;
    padding: 3mm;
    width: 40mm;
    min-height: 25mm;
    font-size: 10px;
  }
  .barcode-text {
    font-family: "Courier New", monospace;
    font-size: 13px;
    letter-spacing: 0;
  }
}
