* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: #eef2f6;
  color: #1f2d3d;
  font-size: 15px;
  overflow: hidden;
}
button, input, select { font: inherit; }
button {
  border: 1px solid #1d6fb8;
  border-radius: 3px;
  background: #2582d8;
  color: #fff;
  min-height: 32px;
  padding: 0 12px;
  cursor: pointer;
}
button.secondary {
  background: #fff;
  color: #2d4054;
  border-color: #b9c6d3;
}
button.secondary.danger {
  color: #c0392b;
  border-color: #d9a7a1;
}
button.plain {
  background: transparent;
  color: #eaf4ff;
  border: 0;
}
button.plain.dark { color: #405263; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select {
  width: 100%;
  min-height: 32px;
  border: 1px solid #c5cfda;
  border-radius: 2px;
  background: #fff;
  padding: 4px 8px;
}
input.input-error,
select.input-error {
  border-color: #d33f2f;
  box-shadow: 0 0 0 2px rgba(211, 63, 47, .12);
}
input[readonly] {
  background: #f3f6f9;
  color: #4d5b68;
}
input[type="checkbox"].row-check,
th input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  padding: 0;
}
label {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: #405263;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
}
th, td {
  border: 1px solid #d8e0e8;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
  height: 42px;
}
th:first-child, td:first-child {
  width: 42px;
  text-align: center;
}
th:last-child, td:last-child {
  width: 78px;
}
th {
  background: #f3f6fa;
  color: #34495e;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr:hover td { background: #eaf5ff; }
tbody tr.selected td { background: #d9ecff; }
.hidden { display: none !important; }
.wide { grid-column: 1 / -1; }

.login-shell {
  min-height: calc(100vh - 24px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: 4px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(31, 41, 51, .08);
}
.login-panel h1 { margin: 0 0 22px; }
#loginForm {
  grid-template-columns: 1fr;
  gap: 12px;
}
#loginForm > button[type="submit"] {
  justify-self: center;
  min-width: 120px;
}
.login-captcha-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 150px auto;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.login-captcha-image {
  display: block;
  width: 150px;
  height: 42px;
  border: 1px solid #b9c7d5;
  border-radius: 3px;
  background: #f4f7fa;
  cursor: pointer;
}
.login-captcha-refresh {
  white-space: nowrap;
}
.site-filing {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #d8e0e8;
  background: rgba(255, 255, 255, .96);
  font-size: 13px;
  color: #68737d;
  z-index: 8;
}
.site-filing a { color: inherit; text-decoration: none; }
.site-filing a:hover { color: #1976c9; text-decoration: underline; }
@media (max-width: 520px) {
  .login-panel { padding: 22px 18px; }
  #loginForm > label { grid-template-columns: 74px minmax(0, 1fr); }
  .login-captcha-row { grid-template-columns: 1fr 126px; }
  .login-captcha-refresh { grid-column: 1 / -1; justify-self: start; }
  .login-captcha-image { width: 126px; }
}
.muted { color: #68737d; font-size: 13px; }
.linked-field-note {
  margin: 0;
  padding: 8px 10px;
  background: #f5f8fb;
  border: 1px solid #d8e0e8;
  color: #68737d;
  font-size: 13px;
}
.linked-field-note.error-text {
  background: #fff5f5;
  border-color: #f0b8b8;
  color: #b42318;
}

.erp-shell {
  height: calc(100vh - 24px);
  display: grid;
  grid-template-columns: 154px 1fr;
  grid-template-rows: 46px 1fr;
}
.erp-header {
  grid-column: 1 / -1;
  background: #1976c9;
  color: #fff;
  display: grid;
  grid-template-columns: 154px auto minmax(120px, 1fr) minmax(120px, 240px) auto;
  align-items: center;
  gap: 14px;
  padding-right: 14px;
}
.erp-logo {
  height: 46px;
  display: grid;
  place-items: center;
  background: #0f5ea6;
  font-size: 19px;
  font-weight: 700;
}
.erp-title { font-size: 16px; font-weight: 600; }
.top-quick-links {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.top-quick-links button {
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 3px;
}
.top-quick-links button:hover {
  background: rgba(255,255,255,.24);
}
#message {
  color: #fff8c7;
  min-width: 180px;
  text-align: right;
  font-size: 14px;
}
#userBadge { color: #dbeeff; }
.header-account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}
.header-account-actions .plain {
  color: #fff;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 4px;
  min-height: 28px;
  padding: 3px 10px;
}
.header-account-actions .plain:hover {
  background: rgba(255,255,255,.16);
}
.logout-button {
  background: rgba(255,255,255,.12);
}
.erp-menu {
  background: #263747;
  padding-top: 8px;
}
.menu-group {
  position: relative;
}
.erp-menu button {
  width: 100%;
  border: 0;
  border-radius: 0;
  min-height: 40px;
  text-align: left;
  background: transparent;
  color: #d6e1ea;
  padding-left: 22px;
}
.erp-menu button.active {
  background: #fff;
  color: #1976c9;
  border-left: 4px solid #1976c9;
  padding-left: 18px;
}
.menu-flyout {
  display: none;
  position: absolute;
  left: 154px;
  top: 0;
  z-index: 30;
  width: 178px;
  padding: 8px 0;
  background: #fff;
  border: 1px solid #d8e0e8;
  box-shadow: 0 12px 28px rgba(20, 35, 50, .18);
}
.menu-group:hover .menu-flyout,
.menu-group:focus-within .menu-flyout {
  display: block;
}
.menu-flyout button {
  min-height: 38px;
  padding: 0 18px;
  color: #2d4054;
  background: #fff;
}
.menu-flyout button:hover,
.menu-flyout button.active {
  background: #eef6ff;
  color: #1976c9;
  border-left: 0;
  padding-left: 18px;
}
.erp-main {
  min-width: 0;
  padding: 10px;
  height: calc(100vh - 46px);
  min-height: 0;
  overflow: hidden;
}
.tab { display: none; }
.tab.active { display: grid; gap: 10px; height: 100%; min-height: 0; }
#boms.tab.active {
  grid-template-rows: auto auto minmax(260px, 1.35fr) 8px minmax(180px, .65fr);
}
#materials.tab.active {
  grid-template-rows: auto auto minmax(0, 1fr);
}
#config.tab.active {
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  align-items: stretch;
}
#inventory.tab.active {
  grid-template-rows: minmax(0, 1fr);
}

.production-reservation-shell { display: grid; gap: 10px; }
.reservation-transfer-panel { border: 1px solid #cfd9e6; background: #fff; padding: 10px; }
.reservation-transfer-form { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr) 160px minmax(220px, 1fr) auto; gap: 8px; align-items: end; }
.reservation-transfer-form label { display: grid; grid-template-columns: 1fr; gap: 4px; }
.reservation-transfer-form .pick-label { min-height: 28px; padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid #d8e0e8; background: #f7f9fb; color: #33495f; }
.reservation-list-card .table-wrap,
.reservation-log-card .table-wrap { max-height: 360px; overflow: auto; }
#productionReservationPickerModal .reservation-picker-panel { width: min(1480px, calc(100vw - 48px)); }
#productionReservationPickerModal .modal-table-wrap { min-height: 300px; max-height: calc(100vh - 300px); overflow: auto; }
.manual-adjusted-tag { display: inline-block; color: #a55200; background: #fff2d8; border: 1px solid #e8a94f; padding: 2px 6px; }
.non-stock-tag { display: inline-block; color: #52606d; background: #eef2f5; border: 1px solid #cbd5df; padding: 2px 6px; }
.production-setting-guides { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.production-setting-guides article { border-left: 3px solid #2682cf; background: #f6f9fc; padding: 10px; }
.production-setting-guides p { margin: 6px 0; line-height: 1.7; }
.help-tab { height: 100%; min-height: 0; }
.help-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100%; min-height: 0; background: #fff; }
.help-sidebar { border-right: 1px solid #d4dce6; padding: 14px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.help-meta { display: grid; gap: 4px; margin-bottom: 6px; }
.help-meta strong { font-size: 18px; }
#helpToc { display: grid; gap: 2px; }
#helpToc button { text-align: left; color: #16324d; background: transparent; border: 0; padding: 8px; }
#helpToc button:hover { background: #eaf3fb; }
.help-content { min-width: 0; overflow: auto; padding: 16px 28px 48px; }
.help-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px; background: #fff; padding-bottom: 10px; border-bottom: 1px solid #d9e1ea; }
.help-search-results { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.help-article { max-width: 1100px; padding: 18px 0 26px; border-bottom: 1px solid #d9e1ea; scroll-margin-top: 54px; }
.help-article h2 { margin: 0 0 10px; color: #145f9e; }
.help-purpose { font-size: 15px; line-height: 1.8; }
.help-block h3 { font-size: 15px; margin: 14px 0 6px; }
.help-block li { margin: 5px 0; line-height: 1.65; }

@media (max-width: 1100px) {
  .reservation-transfer-form { grid-template-columns: 1fr 1fr; }
  .production-setting-guides { grid-template-columns: 1fr; }
  .help-shell { grid-template-columns: 220px minmax(0, 1fr); }
}
.resizable-columns-table {
  table-layout: fixed;
}
.resizable-columns-table th,
.resizable-columns-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resizable-columns-table th:first-child,
.resizable-columns-table td:first-child,
.resizable-columns-table th:last-child,
.resizable-columns-table td:last-child {
  width: auto;
}
.resizable-columns-table td > .link-button,
.resizable-columns-table td > .summary-link {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
#production.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
#sales.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
#finance.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
#reports.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
#priceManagement.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
#accessoryGroups.tab.active,
#users.tab.active,
#logs.tab.active {
  grid-template-rows: minmax(0, 1fr);
}
.query-bar {
  background: #fff;
  border: 1px solid #d8e0e8;
  padding: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.query-bar label { min-width: 260px; }
.query-actions, .action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.action-bar {
  background: #fff;
  border: 1px solid #d8e0e8;
  padding: 8px 10px;
}
.split-action {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.split-action > button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.split-arrow {
  width: 30px;
  padding: 0;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: #1976c9;
}
.batch-menu {
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 10;
  min-width: 112px;
  background: #fff;
  border: 1px solid #d8e0e8;
  box-shadow: 0 8px 18px rgba(20, 35, 50, .12);
}
.batch-menu button {
  display: block;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #2d4054;
  text-align: left;
  padding: 0 12px;
}
.batch-menu button:hover {
  background: #eaf5ff;
  color: #1976c9;
}
.table-card, .edit-card {
  background: #fff;
  border: 1px solid #d8e0e8;
  min-height: 0;
  overflow: hidden;
}
.table-card {
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) auto;
  max-height: 100%;
}
.table-card > .table-wrap,
.table-card > .main-table,
.table-card > .detail-table {
  min-height: 0;
  max-height: 100%;
}
.card-title {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #f7f9fb;
  border-bottom: 1px solid #d8e0e8;
  color: #2d4054;
  font-weight: 600;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  min-height: 0;
  max-height: 100%;
  min-width: 0;
  scrollbar-gutter: stable both-edges;
}
.column-settings {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #fff;
  border-bottom: 1px solid #d8e0e8;
}
.column-settings.in-title {
  position: relative;
  top: auto;
  z-index: 6;
  min-height: 28px;
  padding: 0;
  background: transparent;
  border-bottom: 0;
}
.column-settings-toggle {
  min-height: 28px;
}
.column-settings-menu {
  position: absolute;
  top: 34px;
  left: 8px;
  z-index: 12;
  min-width: 180px;
  max-height: 280px;
  overflow: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #b9c6d3;
  box-shadow: 0 8px 18px rgba(20, 35, 50, .16);
}
.column-settings-menu.column-settings-floating {
  position: fixed;
  z-index: 1000;
}
.column-settings-menu label {
  grid-template-columns: 20px 1fr;
  min-height: 30px;
  padding: 0 10px;
  gap: 6px;
  cursor: pointer;
}
.column-settings-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  min-height: 30px;
}
.column-settings-item.dragging-setting {
  opacity: .45;
}
.column-settings-drag {
  color: #8a98a7;
  cursor: move;
  text-align: center;
  font-weight: 700;
  user-select: none;
}
.column-settings-item label {
  padding-left: 0;
}
.column-settings-menu input {
  width: 14px;
  min-height: 14px;
  padding: 0;
}
.has-column-settings th {
  top: 36px;
}
.column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}
.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  width: 1px;
  background: transparent;
}
.column-resize-handle:hover::after {
  background: #2f80d1;
}
body.resizing-column,
body.resizing-column * {
  cursor: col-resize !important;
  user-select: none !important;
}
.table-sort-button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  min-height: 0;
  cursor: pointer;
}
.table-sort-button:hover {
  color: #1976c9;
}
.main-table, .detail-table {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}
.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  border-top: 1px solid #d8e0e8;
  background: #f7f9fb;
  color: #405263;
  flex: 0 0 auto;
}
.pager-summary {
  white-space: nowrap;
}
.pager-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pager-controls button {
  min-height: 28px;
  padding: 0 8px;
}
.pager-controls label {
  min-height: 28px;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
}
.pager-controls select {
  min-height: 28px;
  padding: 0 24px 0 8px;
}
.table-resizer {
  height: 8px;
  cursor: row-resize;
  position: relative;
}
.table-resizer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 2px;
  background: #c8d4df;
}
.table-resizer:hover::before {
  background: #1976c9;
}
body.resizing-table {
  cursor: row-resize;
  user-select: none;
}
.edit-card {
  padding: 0 10px 10px;
}
.grid.two-rows {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}
.user-admin-layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}
.permission-admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  min-height: calc(100vh - 92px);
}
.permission-group-sidebar {
  background: #fff;
  border: 1px solid #d6e0ea;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
}
.permission-sidebar-title {
  font-weight: 700;
  padding: 6px 4px 10px;
  border-bottom: 1px solid #e6edf5;
  margin-bottom: 4px;
}
.permission-group-filter {
  text-align: left;
  background: transparent;
  color: #243447;
  border: 0;
  border-radius: 4px;
  min-height: 34px;
  justify-content: flex-start;
}
.permission-group-filter:hover,
.permission-group-filter.active {
  background: #e8f1ff;
  color: #1769c2;
}
.permission-group-actions {
  padding: 4px 0 8px;
  border-bottom: 1px solid #e6edf5;
  margin-bottom: 4px;
}
.permission-group-actions button {
  width: 100%;
}
.permission-group-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: auto;
}
.permission-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px;
  border-radius: 4px;
}
.permission-group-row.active {
  background: #e8f1ff;
}
.permission-group-row .permission-group-filter {
  min-width: 0;
}
.permission-group-icon {
  border: 0;
  background: transparent;
  color: #536579;
  min-height: 28px;
  width: 28px;
  padding: 0;
  font-size: 16px;
}
.permission-group-icon:hover {
  background: #edf4ff;
  color: #1769c2;
}
.permission-group-icon.danger:hover {
  color: #b42318;
  background: #fff1f1;
}
.permission-user-main {
  background: #fff;
  border: 1px solid #d6e0ea;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.permission-user-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid #e6edf5;
}
.accessory-group-layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  grid-template-rows: minmax(220px, .45fr) minmax(260px, .55fr);
  gap: 10px;
  min-height: 0;
}
.accessory-group-form {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 0 12px 12px;
}
.accessory-group-form .card-title {
  margin: 0 -12px 2px;
}
.accessory-group-form label {
  grid-template-columns: 72px minmax(0, 1fr);
}
.accessory-group-list-card {
  grid-column: 2;
  grid-row: 1;
}
.accessory-group-items-card {
  grid-column: 1 / -1;
  grid-row: 2;
}
.accessory-group-items-card .card-title {
  justify-content: space-between;
}
.accessory-group-items-card .card-title button {
  min-height: 28px;
}
.user-form {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 0 12px 12px;
}
.user-form .card-title {
  margin: 0 -12px 2px;
}
.user-form label {
  grid-template-columns: 72px minmax(0, 1fr);
}
.user-help {
  margin: -2px 0 0 72px;
  color: #68737d;
  font-size: 13px;
  line-height: 1.5;
}
.user-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 72px;
}
.user-form-actions button {
  width: auto;
  min-width: 92px;
}
#usersTable th:first-child,
#usersTable td:first-child {
  width: auto;
  text-align: left;
}
#usersTable th:last-child,
#usersTable td:last-child {
  width: 120px;
}
.edit-card .card-title {
  margin: 0 -10px 10px;
}
.edit-card.user-form .card-title {
  margin: 0 -12px 2px;
}
.config-pages {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  align-self: stretch;
  width: 100%;
}
.price-management-pages {
  min-height: 0;
  overflow: hidden;
  align-self: start;
  width: 100%;
  height: 100%;
}
.config-page {
  display: none;
  min-height: 0;
  height: 100%;
}
.config-page.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}
.price-management-page {
  display: none;
  min-height: 0;
  height: 100%;
}
.price-management-page.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}
.price-management-page[data-price-management-page-panel="pricingAdjustments"].active {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}
.price-management-page[data-price-management-page-panel="pricingAdjustments"] .config-page-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}
.price-management-page[data-price-management-page-panel="pricingAdjustments"] .table-wrap {
  min-height: 0;
  overflow: auto;
}
.config-card {
  grid-template-rows: 36px auto minmax(0, 1fr) auto;
}
.config-page-card {
  max-height: 100%;
  height: 100%;
  display: grid;
  min-height: 0;
  overflow: hidden;
}
.config-page-card .table-wrap {
  min-height: 0;
  overflow: auto;
}
.config-page-card .table-pager {
  border-top: 1px solid #d8e0e8;
  flex: 0 0 auto;
}
.config-page[data-config-page-panel="units"] .config-page-card,
.config-page[data-config-page-panel="categories"] .config-page-card,
.config-page[data-config-page-panel="productCategories"] .config-page-card,
.config-page[data-config-page-panel="suppliers"] .config-page-card,
.config-page[data-config-page-panel="pricingRules"] .config-page-card {
  grid-template-rows: 36px auto minmax(0, 1fr) auto;
}
.config-page[data-config-page-panel="warehouses"] .config-page-card {
  grid-template-rows: 36px auto auto minmax(0, 1fr) auto;
}
.config-page[data-config-page-panel="locations"] .location-config-card {
  grid-template-rows: 36px auto minmax(0, 1fr);
}
.location-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #d8e0e8;
}
.location-tabs button { background: #fff; color: #35516d; border-color: #b9c9d8; }
.location-tabs button.active { background: #1f7fd2; color: #fff; border-color: #1f7fd2; }
.location-tab-panel { display: none; min-height: 0; overflow: auto; padding: 12px; }
.location-tab-panel.active { display: block; }
.location-tab-panel .form-grid {
  max-width: 1180px;
}
.location-config-card > .location-tab-panel > form {
  padding: 0 12px 10px;
}
.location-tab-panel .setting-note {
  margin: 0 12px 10px;
}
.location-tab-panel .modal-table-wrap {
  min-height: 180px;
  overflow: auto;
  border-top: 1px solid #d8e0e8;
  border-bottom: 1px solid #d8e0e8;
}
.location-move-history-card {
  margin-top: 12px;
  grid-template-rows: 36px auto minmax(220px, 1fr) auto;
}
.location-move-history-card .query-bar {
  border-left: 0;
  border-right: 0;
}
.location-move-history-card .main-table {
  max-height: 420px;
  overflow: auto;
}
.config-page[data-config-page-panel="inventorySettings"] .config-page-card,
.config-page[data-config-page-panel="templateSettings"] .config-page-card {
  grid-template-rows: 36px minmax(0, 1fr);
}
.inventory-settings-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.config-page[data-config-page-panel="templateSettings"] .inventory-settings-content {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}
.inventory-settings-content.system-settings-shell {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.inventory-settings-content > .table-wrap {
  min-height: 0;
  overflow: auto;
}
.recycle-bin-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  min-height: 0;
}
.recycle-bin-card .table-wrap {
  min-height: 0;
  overflow: auto;
}
.config-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #d8e0e8;
}
.supplier-config-form {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, .7fr) minmax(200px, 1.4fr) auto auto;
}

/* 打印模板设计器必须覆盖通用弹窗样式：放在文件末尾，避免被 .modal-panel 后置规则压回小窗口 */
#printTemplateDesignerModal {
  place-items: center !important;
  padding: 12px !important;
}

#printTemplateDesignerModal .print-template-designer-panel {
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 24px) !important;
  max-height: calc(100vh - 24px) !important;
  max-width: none !important;
  display: grid !important;
  grid-template-rows: 42px auto minmax(0, 1fr) auto !important;
  padding: 0 !important;
  overflow: hidden !important;
}

#printTemplateDesignerModal .modal-title {
  margin: 0 !important;
}

#printTemplateDesignerModal .print-template-topbar {
  grid-template-columns: 150px minmax(260px, 1fr) 220px 110px 110px 130px 120px !important;
}

#printTemplateDesignerModal .print-template-designer-body {
  grid-template-columns: 240px minmax(600px, 1fr) 300px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#printTemplateDesignerModal .print-template-property {
  min-width: 280px !important;
}

#printTemplateDesignerModal .print-template-canvas-wrap {
  min-width: 0 !important;
  min-height: 0 !important;
}

#printTemplateDesignerModal .modal-actions {
  margin: 0 !important;
  padding: 10px 12px !important;
}

#printTemplateDesignerModal .palette-section button,
#printTemplateDesignerModal .template-field-group button {
  background: #fff !important;
  color: #20364a !important;
  border: 1px solid #cfd9e3 !important;
  border-radius: 4px !important;
  box-shadow: none !important;
}

#printTemplateDesignerModal .palette-section button:hover,
#printTemplateDesignerModal .template-field-group button:hover {
  background: #f3f8ff !important;
  border-color: #8db8e8 !important;
}

#printTemplateDesignerModal .template-canvas-element.kind-table {
  border: 1px solid #5f7285 !important;
  padding: 0 !important;
  background: #fff !important;
}

#printTemplateDesignerModal .template-table-preview {
  width: 100%;
  height: 100%;
  display: block;
  font-size: inherit;
  color: #1f2d3d;
}

#printTemplateDesignerModal .template-table-title {
  padding: 2px 4px;
  border-bottom: 1px solid #5f7285;
  font-size: 11px;
}

#printTemplateDesignerModal .template-table-preview table {
  width: 100%;
  height: auto;
  border-collapse: collapse;
  table-layout: fixed;
}

#printTemplateDesignerModal .template-table-preview th,
#printTemplateDesignerModal .template-table-preview td {
  border: 1px solid #5f7285;
  padding: 2px 3px;
  font-size: 11px;
  font-weight: 400;
  text-align: center;
}

#printTemplateDesignerModal .template-table-preview th {
  position: relative;
}

#printTemplateDesignerModal .template-column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

#printTemplateDesignerModal .template-column-resize-handle:hover {
  background: rgba(47, 128, 237, .25);
}

#printTemplateDesignerModal .template-table-preview thead tr {
  height: 8mm;
}

#printTemplateDesignerModal .template-table-preview tbody tr {
  height: var(--template-row-h, 8mm);
}

#printTemplateDesignerModal .template-table-properties {
  display: block;
}

#printTemplateDesignerModal .template-table-properties.hidden {
  display: none !important;
}

#printTemplateDesignerModal .template-table-column-picker {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

#printTemplateDesignerModal .template-table-column-row {
  display: grid;
  grid-template-columns: minmax(92px, .9fr) minmax(80px, 1fr);
  gap: 6px;
  align-items: center;
}

#printTemplateDesignerModal .template-table-column-row .inline-check {
  padding: 0;
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.warehouse-config-card {
  grid-template-rows: 36px auto auto minmax(260px, 1fr);
}

.warehouse-config-form {
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr) minmax(150px, .8fr) minmax(120px, .6fr) 120px;
  align-items: center;
}

.warehouse-config-form label:not(.inline-check) {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.warehouse-config-form .inline-check {
  min-height: 32px;
  justify-content: flex-start;
}

.warehouse-remark-field {
  grid-column: 1 / span 4;
}

.warehouse-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.warehouse-form-actions button {
  min-width: 92px;
}

.warehouse-table-wrap {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

.wide-config {
  grid-column: 1 / -1;
  min-height: 280px;
}
.pricing-config-card {
  grid-column: 1 / -1;
  min-height: 320px;
}
.pricing-rule-form {
  grid-template-columns: minmax(160px, 1fr) minmax(140px, .8fr) minmax(130px, .7fr) minmax(120px, .6fr) minmax(260px, 1.4fr) minmax(100px, .55fr) minmax(160px, 1fr) auto auto;
}
.compact-action-bar {
  border-left: 0;
  border-right: 0;
  border-top: 0;
}
.table-inline-input,
.table-inline-select {
  width: 100%;
  min-width: 110px;
  min-height: 28px;
}
.table-inline-input[type="number"] {
  min-width: 90px;
}
.pricing-rule-modal-panel {
  width: min(920px, calc(100vw - 40px));
}
.inventory-pages {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.inventory-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.inventory-page.active {
  display: grid;
  grid-row: 1;
  width: 100%;
  align-self: stretch;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}
.inventory-page-card {
  height: 100%;
}
.materials-pages {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.materials-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.materials-page.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.sales-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.sales-page.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}
.finance-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.finance-page.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}
.finance-page .table-card {
  grid-template-rows: auto 36px minmax(0, 1fr) auto;
}

.finance-transactions-card .card-title .muted {
  margin-left: auto;
  font-weight: 400;
}
.finance-page .query-bar {
  border: 0;
  border-bottom: 1px solid #d8e0e8;
}
.finance-page .query-bar label {
  min-width: 220px;
}
.reports-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.reports-page.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}
.inventory-doc-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  grid-template-rows: minmax(220px, .45fr) minmax(260px, .55fr);
  gap: 10px;
}
.inventory-doc-form {
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  padding: 0 12px 12px;
}
.inventory-doc-form .card-title {
  grid-column: 1 / -1;
  margin: 0 -12px 2px;
}
.inventory-doc-form label {
  grid-column: 1 / -1;
  grid-template-columns: 76px minmax(0, 1fr);
}
.inventory-doc-list-card {
  grid-column: 2;
  grid-row: 1;
}
.inventory-doc-items-card {
  grid-column: 2;
  grid-row: 2;
}
.purchase-order-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.purchase-order-layout .inventory-doc-form {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 8px 12px;
  padding-bottom: 10px;
}
.purchase-order-layout .inventory-doc-form label {
  grid-column: auto;
  grid-template-columns: 76px minmax(0, 1fr);
}
.purchase-order-layout .inventory-doc-form .wide,
.purchase-order-layout .purchase-order-adders,
.purchase-order-layout .user-form-actions {
  grid-column: 1 / -1;
}
.purchase-order-layout .inventory-doc-list-card,
.purchase-order-layout .inventory-doc-items-card {
  grid-column: 1;
}
.purchase-order-layout .inventory-doc-list-card {
  grid-row: 2;
}
.purchase-order-layout .inventory-doc-items-card {
  grid-row: 3;
}
.inventory-list-title {
  height: auto;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid #d8e0e8;
  background: #f7f9fb;
  font-weight: 600;
}
.inventory-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.purchase-order-page-card {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 8px;
}
.purchase-order-query-bar {
  gap: 8px 12px;
}
.purchase-order-query-bar label {
  flex: 1 1 360px;
  min-width: 300px;
}
.purchase-order-action-bar {
  min-height: 42px;
}
.inbound-page-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
}
.inbound-status-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d8e0e8;
  background: #fff;
}
.inbound-status-tabs button {
  min-width: 92px;
  min-height: 36px;
  color: #405263;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.inbound-status-tabs button.active {
  color: #1976c9;
  border-bottom-color: #1976c9;
}
.inbound-query-bar {
  gap: 8px 12px;
}
.inbound-query-bar label {
  flex: 1 1 210px;
  min-width: 210px;
  grid-template-columns: 76px minmax(0, 1fr);
}
.inbound-action-bar {
  min-height: 42px;
}
.inbound-list-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.inbound-doc-link {
  display: inline;
  width: auto;
  min-width: 0;
  padding: 0;
}
.inbound-status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid #aebdca;
  color: #405263;
  background: #f6f8fa;
}
.inbound-status-tag.received {
  color: #07814c;
  border-color: #55c996;
  background: #effcf5;
}
.inbound-status-tag.partial {
  color: #9a5b00;
  border-color: #e9b75f;
  background: #fff8e8;
}
.inbound-status-tag.voided {
  color: #b42318;
  border-color: #e2a39e;
  background: #fff4f3;
}
#inboundDocModal {
  place-items: stretch;
  padding: 12px 18px 12px 168px;
}
#inboundDocModal .inbound-doc-panel {
  width: auto;
  max-width: none;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: grid;
  grid-template-rows: 42px auto auto minmax(0, 1fr);
  gap: 0;
  padding: 0 14px 12px;
}
.inbound-doc-panel .modal-title {
  margin-bottom: 0;
}
.inbound-doc-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #d8e0e8;
}
.inbound-doc-form label {
  grid-template-columns: 88px minmax(0, 1fr);
}
.inbound-source-field,
.inbound-remark-field {
  grid-column: span 2;
}
.inbound-source-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}
.inbound-doc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px 0;
}
.inbound-detail-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
#inboundItemsTable {
  min-width: 1810px;
}

#productionIssueModal {
  place-items: stretch;
  padding: 8px 10px 8px 168px;
}

#productionIssueModal .inbound-doc-panel {
  width: auto;
  max-width: none;
  height: calc(100vh - 16px);
  max-height: calc(100vh - 16px);
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0 14px 10px;
}

#productionIssueModal .inventory-doc-form {
  grid-row: auto;
  grid-column: auto;
}

#productionIssueModal .production-issue-items-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#productionIssueModal .production-issue-items-card .table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.production-issue-order-picker {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto auto;
  gap: 8px 12px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
}

#productionIssueOrderPickerModal {
  place-items: stretch;
  padding: 4px;
}

.production-issue-order-picker-panel {
  width: calc(100vw - 8px) !important;
  max-width: calc(100vw - 8px) !important;
  height: calc(100vh - 8px) !important;
  max-height: calc(100vh - 8px) !important;
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0 14px 10px;
  overflow: hidden;
}

.production-issue-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto auto;
  gap: 8px 12px;
  align-items: end;
  padding: 10px 0;
}

.production-issue-picker-toolbar .production-issue-date-filter,
#productionIssueOrderPickerSummary {
  grid-column: 1 / -1;
}

.production-issue-order-picker > label {
  margin: 0;
}

.production-issue-date-filter {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.production-issue-date-filter .field-caption {
  font-weight: 600;
}

.production-issue-date-filter input[type="date"] {
  width: 160px;
}

.production-issue-date-filter button.active {
  background: #2582d8;
  color: #fff;
  border-color: #1d6fb8;
}

#productionIssueOrderSelect {
  min-height: 132px;
}

#productionIssueOrderFilterSummary {
  grid-column: 1 / -1;
}

.production-issue-order-actions {
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}

#productionIssueModal.production-issue-view-mode .production-issue-order-picker {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 8px 10px;
}

#productionIssueModal.production-issue-view-mode .production-issue-date-filter,
#productionIssueModal.production-issue-view-mode .production-issue-order-search-field,
#productionIssueModal.production-issue-view-mode #productionIssueOrderFilterSummary {
  display: none;
}

#productionIssueModal.production-issue-view-mode .production-issue-order-select-field {
  grid-column: 1;
}

#productionIssueModal.production-issue-view-mode #productionIssueOrderSelect {
  min-height: 32px;
  height: 32px;
}

#productionIssueModal.production-issue-view-mode .production-issue-order-actions {
  grid-column: 2;
}

@media (max-width: 1000px) {
  #productionIssueModal {
    padding: 6px;
  }
  #productionIssueModal .inbound-doc-panel {
    height: calc(100vh - 12px);
    max-height: calc(100vh - 12px);
  }
  .production-issue-order-picker {
    grid-template-columns: 1fr;
  }
  .production-issue-date-filter,
  #productionIssueOrderFilterSummary {
    grid-column: 1;
  }
}

#productionIssueViewModal {
  place-items: stretch;
  padding: 4px;
}

.production-issue-view-panel {
  width: calc(100vw - 8px) !important;
  max-width: calc(100vw - 8px) !important;
  height: calc(100vh - 8px) !important;
  max-height: calc(100vh - 8px) !important;
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0 14px 10px;
  overflow: hidden;
}

.production-issue-view-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #d8e0e8;
}

.production-issue-view-summary label {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.production-issue-linked-order {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #c5cfda;
  background: #fff;
}

.production-issue-view-items-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.production-issue-view-status-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-bottom: 1px solid #d8e0e8;
  background: #f7f9fb;
}

.production-issue-view-status-filter button {
  min-height: 30px;
  background: #fff;
  color: #2d4054;
  border-color: #b9c6d3;
}

.production-issue-view-status-filter button.active {
  background: #2582d8;
  color: #fff;
  border-color: #1d6fb8;
}

.production-issue-view-status-filter button span {
  display: inline-block;
  min-width: 20px;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .08);
  text-align: center;
}

.production-issue-view-items-card .table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

@media (max-width: 1000px) {
  #productionIssueViewModal { padding: 6px; }
  .production-issue-view-panel { height: calc(100vh - 12px); max-height: calc(100vh - 12px); }
  .production-issue-view-summary { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
#inboundItemsTable .inbound-warehouse-select {
  min-width: 160px;
  width: 100%;
}
#inboundItemsTable .inbound-location-select {
  min-width: 250px;
  width: 100%;
}
#inboundPurchaseOrderPickerModal .inbound-picker-panel,
#inboundMaterialPickerModal .inbound-picker-panel {
  width: calc(100vw - 210px);
  max-width: none;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  grid-template-rows: 42px auto minmax(0, 1fr) auto auto;
}
.inbound-picker-toolbar {
  flex-wrap: wrap;
}
.inbound-picker-toolbar label {
  min-width: 230px;
}

.stocktake-page-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  padding: 12px;
}
.stocktake-status-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #d8e0e8;
}
.stocktake-status-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #4d5b68;
  min-height: 38px;
  padding: 0 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
}
.stocktake-status-tabs button.active {
  color: #1976c9;
  border-bottom-color: #1976c9;
  font-weight: 600;
}
.stocktake-query-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
}
.stocktake-query-bar label {
  grid-template-columns: 74px minmax(0, 1fr);
}
.stocktake-action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.stocktake-list-card {
  overflow: auto;
}
.stocktake-doc-link {
  font-weight: 600;
  margin-right: 0;
}

.field-help-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 3px;
  border-radius: 50%;
  border: 1px solid #8fb8df;
  color: #1976c9;
  background: #eef7ff;
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
}

#stocktakeDocModal {
  place-items: stretch;
  padding: 12px 18px 12px 168px;
}
#stocktakeMaterialPickerModal {
  z-index: 40;
}
#stocktakeDocModal .stocktake-doc-panel,
#mwStocktakeModal .stocktake-doc-panel,
#mwVoidStocktakeModal .stocktake-doc-panel,
#mwTransferModal .stocktake-doc-panel {
  width: auto;
  max-width: none;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: grid;
  grid-template-rows: 42px auto auto auto minmax(0, 1fr);
  gap: 0;
  padding: 0 14px 12px;
}
#mwStocktakeModal,
#mwVoidStocktakeModal {
  place-items: stretch;
  padding: 12px 18px 12px 18px;
}
#mwStocktakeModal .query-bar,
#mwVoidStocktakeModal .query-bar {
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid #d8e0e8;
}
#mwStocktakeModal .stocktake-create-bar {
  background: #f7fbff;
}
#mwStocktakeModal .query-bar label,
#mwVoidStocktakeModal .query-bar label {
  min-width: 220px;
  grid-template-columns: 72px minmax(0, 1fr);
}
#mwStocktakeModal #mwStocktakeItemSearch {
  min-width: 260px;
}
#mwStocktakeModal #mwStocktakeRemark {
  min-width: 260px;
}
#mwStocktakeModal .stocktake-summary,
#mwVoidStocktakeModal .stocktake-summary {
  margin: 8px 0 0;
}
#mwStocktakeModal .stocktake-doc-actions,
#mwVoidStocktakeModal .stocktake-doc-actions {
  align-items: center;
  flex-wrap: wrap;
  min-height: 48px;
  padding: 8px 0;
}
#mwStocktakeModal .stocktake-detail-card,
#mwVoidStocktakeModal .stocktake-detail-card {
  min-height: 0;
  height: 100%;
}
.stocktake-doc-panel .modal-title {
  margin-bottom: 0;
}
.stocktake-doc-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #d8e0e8;
}
.stocktake-doc-form label {
  grid-template-columns: 86px minmax(0, 1fr);
}
.stocktake-remark-field {
  grid-column: span 2;
}
.stocktake-doc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px 0;
}
.stocktake-detail-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr) auto;
  gap: 0;
}
.stocktake-detail-card .card-title {
  font-weight: 600;
  color: #2d4054;
  font-size: 15px;
  padding: 10px 0;
  border-bottom: 1px solid #d8e0e8;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.production-pages {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.production-page {
  display: none;
  height: 100%;
  min-height: 0;
}
.production-page.active {
  display: block;
}
.production-page-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  padding: 12px;
}
.production-query-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
}
.production-query-bar label {
  grid-template-columns: 92px minmax(260px, 1fr);
}
.production-action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.production-list-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) auto;
}
#productionOrderModal {
  place-items: stretch;
  padding: 12px 18px 12px 168px;
}
#productionOrderModal .production-order-panel {
  width: auto;
  max-width: none;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: grid;
  grid-template-rows: 42px auto auto minmax(0, 1fr);
  gap: 0;
  padding: 0 14px 12px;
}
.production-order-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #d8e0e8;
}
.production-order-form label {
  grid-template-columns: 86px minmax(0, 1fr);
}
.production-product-search-field,
.production-product-selected-field {
  grid-column: span 2;
}
.production-product-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}
.production-product-search-control input {
  min-width: 0;
}
.integer-quantity-input {
  width: 82px;
  max-width: 100%;
}
.production-product-picker-panel {
  width: calc(100vw - 210px);
  max-width: none;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  grid-template-rows: 42px auto minmax(0, 1fr) auto auto;
}
.production-remark-field {
  grid-column: span 2;
}
.production-order-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px 0;
}
.production-products-card,
.production-detail-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr) auto;
}
.production-selected-product {
  color: #1677d2;
  font-weight: 600;
}

#stocktakeMaterialPickerModal .stocktake-picker-panel {
  width: calc(100vw - 210px);
  max-width: none;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  grid-template-rows: 42px auto minmax(0, 1fr) auto auto;
}

.purchase-order-doc-panel {
  width: calc(100vw - 32px);
  max-width: none;
  min-width: 0;
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: 42px minmax(190px, max-content) minmax(0, 1fr);
  gap: 0;
}
.purchase-order-doc-form {
  position: relative;
  z-index: 2;
  border: 0;
  border-bottom: 1px solid #d8e0e8;
  overflow: visible;
  background: #fff;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, .8fr) minmax(340px, 1.3fr) minmax(220px, .8fr);
  gap: 10px 16px;
  padding: 4px 0 14px;
}
.purchase-order-doc-form label {
  grid-column: auto;
  grid-template-columns: 72px minmax(0, 1fr);
}
.purchase-order-detail-items {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 0;
}
#purchaseOrderDocModal .purchase-order-doc-form .user-form-actions {
  min-height: 38px;
  align-items: center;
  padding-top: 2px;
  background: #fff;
}
#purchaseOrderDocModal {
  place-items: stretch;
  padding: 12px 18px 12px 168px;
}
#purchaseOrderDocModal .purchase-order-doc-panel {
  width: auto !important;
  max-width: none !important;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px) !important;
  overflow: hidden;
  display: grid;
  grid-template-rows: 42px auto minmax(360px, 1fr) auto;
}
#purchaseOrderDocModal .modal-title {
  margin: 0;
}
#purchaseOrderDocModal .purchase-order-doc-form {
  grid-row: auto;
  align-content: start;
}
#purchaseOrderDocModal .purchase-order-detail-items .table-wrap {
  min-height: 0;
}
#purchaseOrderItemsTable {
  min-width: 1180px;
}
.inventory-list-actions input {
  min-width: 220px;
}
.purchase-order-children {
  flex: 0 0 auto;
  max-height: 160px;
}
.compact-picker-panel {
  width: min(1100px, 94vw);
  height: auto;
  max-height: 82vh;
}
.compact-form-panel {
  width: min(720px, 92vw);
  height: auto;
}
.material-supplier-links-panel {
  border-top: 1px solid #d7e0ea;
  padding-top: 10px;
}
#materialModal .modal-panel {
  width: min(1280px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 40px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
#materialModal .modal-panel .wide {
  grid-column: 1 / -1;
}
.material-supplier-title-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.material-supplier-title-row button {
  margin-left: auto;
}
.material-supplier-link-panel {
  width: min(680px, calc(100vw - 40px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.material-supplier-table-wrap {
  max-height: 180px;
}
.supplier-select {
  min-width: 150px;
  max-width: 220px;
}
.child-order-link {
  white-space: nowrap;
}
.child-doc-no {
  padding-left: 18px;
  color: #0f5ea6;
}
#purchaseOrderDocsTable tr:has(.child-doc-no) td {
  background: #f7fbff;
}
.inventory-line-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 96px auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #e4eaf0;
  border-bottom: 1px solid #e4eaf0;
}
.purchase-order-adders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #e4eaf0;
  border-bottom: 1px solid #e4eaf0;
}
.purchase-order-line {
  grid-template-columns: 58px 88px minmax(0, 1fr);
  padding: 8px;
  border: 1px solid #d8e0e8;
  background: #fbfcfd;
}
.purchase-order-line .qty-input,
.purchase-order-line input[type="number"] {
  min-width: 0;
}
.purchase-order-line .purchase-line-actions {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(90px, 120px) auto;
  gap: 8px;
  align-items: center;
}
.purchase-order-line .purchase-line-actions .muted:only-child {
  grid-column: 1 / -1;
}
.line-label {
  color: #496171;
  white-space: nowrap;
}
.pick-label {
  min-width: 0;
  overflow: hidden;
  color: #20364a;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.muted {
  color: #7b8b99;
  white-space: nowrap;
}
.inline-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.inline-check input {
  width: 14px;
  min-height: 14px;
  padding: 0;
}
.inventory-settings-form {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
}
.template-settings-form {
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr) auto;
  align-items: center;
}
.stocktake-summary {
  padding: 10px 12px;
  background: #eef6ff;
  border: 1px solid #c9ddf3;
  border-radius: 6px;
  font-weight: 600;
  color: #244b72;
}

.config-page[data-config-page-panel="systemSettings"] {
  height: 100%;
  min-height: 0;
  align-self: stretch;
}

.config-page[data-config-page-panel="systemSettings"].active {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.config-page[data-config-page-panel="systemSettings"] .system-settings-card {
  height: 100%;
  max-height: 100%;
  align-self: stretch;
}
.system-settings-card {
  grid-template-rows: 32px minmax(0, 1fr);
  font-size: 12px;
}

.system-settings-card .card-title {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.system-settings-shell {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px 10px;
  overflow: hidden;
}

.system-settings-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 6px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #f7f9fc;
}

.system-settings-nav button {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #385168;
  font-size: 12px;
  text-align: left;
  border-radius: 4px;
}

.system-settings-nav button.active {
  border-color: #9fc5f1;
  background: #e8f2ff;
  color: #0f65b7;
  font-weight: 600;
}

.system-settings-grid {
  min-width: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 8px;
  align-content: start;
}

.system-settings-grid .hidden {
  display: none !important;
}

.setting-section {
  border: 1px solid #d9e2ec;
  background: #fff;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: none;
}

.setting-section-wide {
  grid-column: 1 / -1;
}

.setting-section h3 {
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid #d9e2ec;
  background: #f5f8fb;
  font-size: 12px;
  line-height: 1.25;
  color: #21364a;
}

.setting-section .config-form {
  padding: 8px 10px;
  border-bottom: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.setting-section .config-form label:not(.inline-check) {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.setting-section input,
.setting-section select,
.setting-section button {
  min-height: 26px;
  font-size: 12px;
}

.setting-section button {
  padding: 5px 10px;
}

.setting-section .setting-note,
.setting-section > p {
  margin: 0;
  padding: 6px 10px 8px;
  color: #63788d;
  background: #fbfdff;
  border-top: 1px solid #edf2f7;
  font-size: 12px;
  line-height: 1.45;
}

.system-settings-card > .system-settings-shell > .setting-note {
  grid-column: 1 / -1;
  margin-top: 0;
  border: 1px solid #d9e2ec;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 12px;
}

#topQuickLinksForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  align-items: end;
}

#topQuickLinksForm .quick-link-options {
  max-height: 260px;
  overflow: auto;
  padding: 0;
}

.quick-link-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 6px;
}

#topQuickLinksForm .quick-link-group {
  border-radius: 4px;
}

#topQuickLinksForm .quick-link-parent {
  min-height: 28px;
  padding: 4px 7px;
  gap: 6px;
  font-size: 12px;
}

#topQuickLinksForm .quick-link-children {
  padding: 5px 7px 7px;
  gap: 4px;
}

.production-system-settings-form {
  grid-template-columns: minmax(130px, 1fr) minmax(160px, 1fr) auto !important;
  align-items: center !important;
}

.production-system-settings-form .inline-check {
  min-height: 26px;
  align-items: center;
  font-size: 12px;
}

.production-setting-guides {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 6px;
  padding: 6px 10px 8px;
  background: #fbfdff;
  border-top: 1px solid #edf2f7;
}

.production-setting-guides article {
  padding: 7px 8px;
  border-left: 3px solid #2582d8;
  background: #f6f9fc;
  font-size: 12px;
  line-height: 1.45;
}

.production-setting-guides article p {
  margin: 3px 0 5px;
}

.production-setting-guides article code {
  font-size: 11px;
}

.cleanup-inline-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, auto) minmax(180px, auto) auto;
  gap: 8px;
  align-items: end;
  padding: 8px 10px;
}

.cleanup-inline-panel label {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.cleanup-inline-panel .setting-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.archive-cleanup-section {
  min-height: 0;
}

.archive-cleanup-panel {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr);
  gap: 10px;
  padding: 10px;
  min-height: 0;
}

.archive-cleanup-toolbar {
  display: grid;
  grid-template-columns: auto auto auto minmax(240px, 1fr);
  gap: 8px;
  align-items: center;
}

.archive-cleanup-toolbar button {
  width: auto;
  justify-self: start;
}

.archive-cleanup-summary {
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid #cfe0f3;
  background: #f3f8ff;
  color: #28506f;
  font-weight: 600;
}

.archive-cleanup-tabs {
  padding: 0;
  border-bottom: 1px solid #d9e2ec;
}

.archive-cleanup-panel [data-archive-cleanup-panel] {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.archive-cleanup-panel [data-archive-cleanup-panel].hidden {
  display: none !important;
}

.archive-cleanup-panel h4 {
  margin: 0;
  padding: 0 0 6px;
  font-size: 13px;
  color: #21364a;
}

.archive-cleanup-panel .table-wrap {
  min-height: 320px;
  max-height: calc(100vh - 360px);
  overflow: auto;
  border: 1px solid #d9e2ec;
}

@media (max-width: 1000px) {
  .system-settings-shell {
    grid-template-columns: 1fr;
  }
  .system-settings-nav {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }
  .system-settings-nav button {
    text-align: center;
  }
  .system-settings-grid,
  .production-setting-guides,
  .cleanup-inline-panel,
  #topQuickLinksForm {
    grid-template-columns: 1fr;
  }
  .setting-section-wide {
    grid-column: span 1;
  }
  .setting-section .config-form,
  .production-system-settings-form {
    grid-template-columns: 1fr !important;
  }
  .setting-section .config-form label:not(.inline-check),
  .cleanup-inline-panel label {
    grid-template-columns: 1fr;
  }
}
.template-design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 14px;
}

.template-design-card {
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  background: #fff;
  padding: 14px;
}

.template-design-card h3 {
  margin: 0 0 8px;
  color: #20364a;
}

.template-design-card p {
  min-height: 44px;
  margin: 0 0 12px;
  color: #607282;
  line-height: 1.5;
}

.template-simple-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #d8e0e8;
}

.template-simple-title {
  font-weight: 700;
  color: #20364a;
  margin-bottom: 4px;
}

.template-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.template-toolbar select {
  height: 34px;
}

.template-type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px 14px 0;
}

.template-type-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  text-align: left;
  border: 1px solid #d8e0e8;
  background: #fff;
  color: #20364a;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

.template-type-card.active {
  border-color: #2f80ed;
  box-shadow: 0 0 0 2px rgba(47, 128, 237, .12);
}

.template-type-card strong {
  font-size: 20px;
}

.template-type-card small {
  grid-column: 1 / -1;
  color: #607282;
}

.default-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e8f4ff;
  color: #1d66b2;
  font-size: 12px;
}

.print-template-designer-panel {
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr) auto;
  padding: 0;
  overflow: hidden;
}

#printTemplateDesignerModal {
  place-items: center;
  padding: 16px;
}

.print-template-designer-panel .modal-title {
  margin: 0;
}

.print-template-topbar {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1fr) 220px 130px 120px;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #d8e0e8;
}

.print-template-designer-body {
  display: grid;
  grid-template-columns: 240px minmax(520px, 1fr) 280px;
  gap: 12px;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.print-template-palette,
.print-template-property {
  overflow: auto;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.print-template-topbar label,
.print-template-property label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  align-items: start;
}

.print-template-topbar .inline-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 22px;
}

.print-template-property input,
.print-template-property select,
.print-template-topbar input,
.print-template-topbar select {
  width: 100%;
  min-width: 0;
}

.palette-section h4,
.print-template-property h4 {
  margin: 8px 0;
}

.palette-section button,
.template-field-group button {
  width: 100%;
  margin: 4px 0;
  text-align: left;
}

.template-field-group {
  margin-bottom: 10px;
}

.template-field-group strong {
  display: block;
  margin: 8px 0 4px;
  color: #40566d;
}

.print-template-canvas-wrap {
  overflow: auto;
  display: grid;
  place-items: start center;
  background: #eef3f8;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
  min-height: 0;
}

.print-template-canvas {
  position: relative;
  width: calc(var(--paper-w, 210) * 3px);
  height: calc(var(--paper-h, 297) * 3px);
  background: #fff;
  box-shadow: 0 10px 30px rgba(32, 54, 74, .18);
  overflow: hidden;
}

.template-canvas-element {
  position: absolute;
  border: 1px dashed #91a4b7;
  background: rgba(255, 255, 255, .85);
  color: #1f2d3d;
  padding: 1px 3px;
  cursor: move;
  overflow: hidden;
  user-select: none;
}

.template-canvas-element.selected {
  border-color: #2f80ed;
  background: rgba(47, 128, 237, .08);
  box-shadow: 0 0 0 2px rgba(47, 128, 237, .16);
}

.template-canvas-element .template-resize-handle {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border: 1px solid #2f80ed;
  background: #fff;
  cursor: nwse-resize;
  display: none;
  z-index: 2;
}

.template-canvas-element.selected .template-resize-handle {
  display: block;
}

.template-canvas-element.kind-line {
  border: 0;
  border-top: 2px solid #1f2d3d;
  padding: 0;
  background: transparent;
}

.template-canvas-element.kind-line .template-resize-handle {
  top: -5px;
  bottom: auto;
  cursor: ew-resize;
}

#printTemplateDesignerModal .template-barcode-preview {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  align-items: stretch;
  padding: 2px;
}

#printTemplateDesignerModal .template-barcode-preview div {
  background: #111;
}

#printTemplateDesignerModal .template-barcode-preview div:nth-child(2n) {
  width: 55%;
}

#printTemplateDesignerModal .template-barcode-preview small {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 10px;
}

.property-divider {
  margin: 12px 0 8px;
  padding-top: 10px;
  border-top: 1px solid #d8e0e8;
  color: #607282;
  font-weight: 600;
}

.print-template-designer-panel .modal-actions {
  padding: 10px 12px;
  margin: 0;
  background: #fff;
}

@media (max-width: 1100px) {
  .print-template-designer-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
  }
  #printTemplateDesignerModal {
    padding: 0;
  }
  .print-template-topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .print-template-designer-body {
    grid-template-columns: 210px minmax(460px, 1fr) 260px;
  }
}
.template-production-setting {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 10px;
  border-left: 3px solid #1976c9;
  background: #f7f9fb;
}
.inventory-settings-card {
  grid-template-rows: 36px minmax(0, 1fr);
}
.inventory-settings-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.config-section-title {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-top: 1px solid #d8e0e8;
  border-bottom: 1px solid #d8e0e8;
  background: #f7f9fb;
  font-weight: 600;
}
.material-control-rule-form {
  grid-template-columns: 110px minmax(180px, 1.3fr) minmax(190px, 1.4fr) auto auto 100px minmax(160px, 1fr) auto auto;
  align-items: center;
}
.material-control-rule-table-wrap {
  min-height: 0;
  max-height: none;
}
.template-table-wrap {
  min-height: 0;
  max-height: none;
}
.config-page[data-config-page-panel="templateSettings"] .inventory-settings-content {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}
.setting-note {
  padding: 12px 14px;
  color: #607282;
  line-height: 1.6;
  border-top: 1px solid #d8e0e8;
  background: #fbfcfd;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid button { width: fit-content; min-width: 92px; }
.inline-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.inline-select button {
  min-width: 86px;
  padding: 0 8px;
  white-space: nowrap;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  padding: 48px 20px 64px;
  background: rgba(18, 31, 44, .36);
}
.modal.hidden { display: none !important; }
.modal-free-position {
  display: block;
}
.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 112px);
  overflow: auto;
  background: #fff;
  border: 1px solid #9fb4c8;
  box-shadow: 0 18px 50px rgba(20, 35, 50, .28);
  padding: 0 14px 14px;
}

.permission-panel {
  width: min(960px, 94vw);
  height: 90vh;
  max-height: 90vh;
  font-size: 13px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.permission-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  border-bottom: 1px solid #e5e7eb;
}
.permission-toolbar button {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 13px;
}
.permission-group-edit-bar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(260px, 1fr);
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafcff;
}
.permission-group-edit-bar label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.permission-group-edit-bar .wide {
  grid-column: 1 / -1;
}
.permission-subtitle {
  font-weight: 700;
  padding: 2px 0 6px;
  color: #1f2d3d;
}
.permission-subtitle::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  background: #1976e9;
}

.permission-grid {
  display: grid;
  grid-template-columns: minmax(380px, 42%) minmax(460px, 1fr);
  gap: 12px;
  padding: 14px 28px 18px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.permission-box {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.permission-box-title {
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  font-size: 14px;
}

.permission-tree,
.permission-actions {
  padding: 12px;
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
}

.permission-menu-node {
  margin-bottom: 6px;
}

.permission-menu-label,
.permission-page-label,
.permission-action-label {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 26px;
  cursor: pointer;
  font-size: 13px;
}
.permission-menu-label input,
.permission-page-label input,
.permission-action-label input {
  width: 15px;
  height: 15px;
  accent-color: #1976e9;
}

.permission-page-list {
  margin-left: 20px;
  border-left: 1px dashed #d7dde8;
  padding-left: 10px;
}

.permission-page-label.active {
  background: #e8f1ff;
  border-radius: 6px;
  padding-left: 5px;
}

.permission-section-title {
  font-weight: 700;
  margin: 4px 0 10px;
  font-size: 13px;
}

.permission-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px 18px;
  margin-top: 10px;
}
.resizable-modal-panel {
  min-width: min(360px, calc(100vw - 32px));
  min-height: min(260px, calc(100vh - 32px));
}
.modal-resize-grip {
  position: sticky;
  float: right;
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  z-index: 30;
  cursor: nwse-resize;
  border-right: 3px solid #6f8aa3;
  border-bottom: 3px solid #6f8aa3;
  background: rgba(255, 255, 255, .92);
  opacity: .75;
}
.modal-resize-grip::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #9fb4c8;
  border-bottom: 2px solid #9fb4c8;
}
.modal-resize-grip:hover {
  opacity: 1;
  border-color: #2582d8;
}
.modal-title-resize-grip {
  margin-left: auto;
  margin-right: 12px;
  padding: 4px 10px;
  border: 1px solid #9fb4c8;
  border-radius: 3px;
  background: #fff;
  color: #2d4054;
  font-size: 12px;
  cursor: nwse-resize;
}
.modal-title-resize-grip:hover {
  border-color: #2582d8;
  color: #0969da;
}
body.resizing-modal {
  user-select: none;
  cursor: nwse-resize;
}
.combo-panel {
  width: min(1280px, calc(100vw - 64px));
  max-height: calc(100vh - 76px);
  display: grid;
  grid-template-rows: 42px auto minmax(260px, 1fr) auto auto;
  gap: 0;
}
.picker-panel {
  width: min(1120px, calc(100vw - 72px));
  max-height: calc(100vh - 92px);
  display: grid;
  grid-template-rows: 42px auto minmax(180px, 1fr) auto auto auto;
}
#bomItemsPreviewModal .picker-panel {
  width: min(1680px, calc(100vw - 48px));
}
.history-panel {
  width: min(1180px, calc(100vw - 72px));
}
.modal-title {
  height: 42px;
  margin: 0 -14px 12px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d8e0e8;
  background: #f7f9fb;
  font-weight: 600;
}
.modal-title-both {
  justify-content: space-between;
}
.modal-title-both span {
  flex: 1;
  text-align: center;
}
.combo-panel .modal-title {
  margin-bottom: 0;
}
.modal-section {
  padding: 12px 0;
  border-bottom: 1px solid #e4eaf0;
}
.section-title,
.section-title-row {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #2d4054;
  font-weight: 600;
}
.section-title::before,
.section-title-row::before {
  content: "";
  width: 4px;
  height: 18px;
  background: #2582d8;
}
.section-title-row {
  justify-content: flex-start;
}
.combo-basic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px 22px;
  padding-top: 8px;
}
.combo-basic-grid label {
  grid-template-columns: 86px minmax(0, 1fr);
}
.combo-basic-grid .wide {
  grid-column: 1 / -1;
}
.required-field {
  color: #b42318;
}
.inline-field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.inline-field-with-action select,
.inline-field-with-action input {
  width: 100%;
}
.quick-link-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
#topQuickLinksForm {
  display: block;
  padding: 12px;
}
#topQuickLinksForm .quick-link-options {
  max-height: 360px;
  overflow: auto;
  padding: 4px;
}
#topQuickLinksForm .quick-link-group {
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  background: #fbfdff;
  overflow: hidden;
}
#topQuickLinksForm .quick-link-parent {
  min-height: 36px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-weight: 600;
  background: #f7f9fb;
}
#topQuickLinksForm .quick-link-parent span {
  min-width: 0;
}
#topQuickLinksForm .quick-link-toggle {
  min-height: 24px;
  padding: 0 8px;
  color: #1976c9;
}
#topQuickLinksForm .quick-link-children {
  padding: 8px;
  display: grid;
  gap: 6px;
}
#topQuickLinksForm .quick-link-children.hidden {
  display: none;
}
#topQuickLinksForm .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #d8e0e8;
  border-radius: 4px;
  background: #fbfdff;
}
#topQuickLinksForm .inline-check:hover {
  border-color: #8bbbe8;
  background: #f2f8ff;
}
#topQuickLinksForm > button[type="submit"] {
  display: block;
  width: auto;
  min-width: 120px;
  margin: 12px 0 0 auto;
  padding: 0 16px;
}
.form-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  color: #b42318;
  background: #fff1f0;
  border: 1px solid #ffccc7;
}
.combo-items-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.modal-table-wrap {
  min-height: 240px;
  overflow: auto;
  border: 1px solid #d8e0e8;
}
.inventory-stock-purchase-panel {
  width: min(1280px, calc(100vw - 80px));
  max-height: calc(100vh - 90px);
}
.inventory-stock-shortage-panel {
  width: min(1480px, calc(100vw - 64px));
  max-height: calc(100vh - 90px);
}
.inventory-stock-tx-panel {
  width: min(1280px, calc(100vw - 80px));
  max-height: calc(100vh - 90px);
}
.picker-selected {
  padding-top: 10px;
}
.picker-selected .section-title-row {
  min-height: 28px;
}
.selected-table-wrap {
  min-height: 128px;
  max-height: 190px;
}

#salesOrderModal {
  place-items: center;
  padding: 18px;
}

#salesOrderModal .wide-panel {
  width: calc(100vw - 36px);
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: 42px auto minmax(0, 1fr) auto;
  overflow: hidden;
}

#salesOrderModal .modal-title {
  margin-bottom: 0;
}

#salesOrderModal .modal-section {
  min-height: 0;
  overflow: hidden;
}

#salesOrderModal .modal-table-wrap {
  height: 100%;
  min-height: 0;
  overflow: auto;
}
#purchaseOrderMaterialPickerModal .purchase-order-picker-panel,
#purchaseOrderProductPickerModal .purchase-order-picker-panel {
  width: min(1680px, calc(100vw - 32px));
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  grid-template-rows: 42px auto minmax(260px, var(--purchase-picker-list-height, 56vh)) auto 8px minmax(170px, 1fr) auto;
  overflow: hidden;
}

.wide-picker-panel,
#salesOrderItemPickerModal .picker-panel,
#accessoryPickerModal .picker-panel {
  width: min(1680px, calc(100vw - 32px));
  height: calc(100vh - 128px);
  max-height: calc(100vh - 128px);
  overflow: hidden;
}

#salesOrderItemPickerModal .modal-table-wrap,
#accessoryPickerModal .modal-table-wrap {
  min-height: 0;
  height: calc(100vh - 210px);
  max-height: calc(100vh - 210px);
  overflow: auto;
}

/* 表格弹窗统一尽量满屏，并允许右下角自由拖拽调整宽度/高度 */
.modal-panel:has(.modal-table-wrap) {
  width: min(1680px, calc(100vw - 32px));
  height: calc(100vh - 128px);
  max-height: calc(100vh - 128px);
  min-width: min(760px, calc(100vw - 32px));
  min-height: min(420px, calc(100vh - 128px));
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-panel:has(.modal-table-wrap) .modal-table-wrap {
  min-height: 0;
  max-height: none;
  flex: 1 1 220px;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}
.modal-panel:has(.modal-table-wrap) .table-pager,
.modal-panel:has(.modal-table-wrap) .modal-actions,
.modal-panel:has(.modal-table-wrap) .section-title-row,
.modal-panel:has(.modal-table-wrap) .query-bar,
.modal-panel:has(.modal-table-wrap) .modal-title {
  flex: 0 0 auto;
}
#purchaseOrderMaterialPickerModal .picker-toolbar,
#purchaseOrderProductPickerModal .picker-toolbar {
  flex-wrap: wrap;
}
#purchaseOrderMaterialPickerModal .picker-toolbar label,
#purchaseOrderProductPickerModal .picker-toolbar label {
  width: auto;
}
#purchaseOrderMaterialPickerModal #purchaseOrderMaterialPickerCategory,
#purchaseOrderProductPickerModal #purchaseOrderProductPickerCategory {
  min-width: 260px;
}
#purchaseOrderMaterialPickerModal #purchaseOrderMaterialPickerSearch,
#purchaseOrderProductPickerModal #purchaseOrderProductPickerSearch {
  min-width: min(520px, calc(100vw - 760px));
}
#purchaseOrderMaterialPickerModal .purchase-order-picker-list-wrap,
#purchaseOrderProductPickerModal .purchase-order-picker-list-wrap,
#purchaseOrderMaterialPickerModal .picker-selected,
#purchaseOrderProductPickerModal .picker-selected,
#purchaseOrderMaterialPickerModal .selected-table-wrap,
#purchaseOrderProductPickerModal .selected-table-wrap {
  min-height: 0;
}
#purchaseOrderMaterialPickerModal .picker-selected,
#purchaseOrderProductPickerModal .picker-selected {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding-top: 0;
}
#purchaseOrderMaterialPickerModal .selected-table-wrap,
#purchaseOrderProductPickerModal .selected-table-wrap {
  max-height: none;
  height: 100%;
}
#purchaseOrderMaterialPickerModal .modal-actions,
#purchaseOrderProductPickerModal .modal-actions {
  margin-top: 10px;
}
.picker-table-resizer {
  margin: 0 -14px;
}
.picker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.picker-toolbar label {
  width: min(420px, 100%);
}
.qty-input {
  width: 86px;
  min-height: 28px;
}
.supplier-input {
  width: 160px;
  min-height: 28px;
}
.purchase-remark-input {
  width: 180px;
  min-height: 28px;
}
#purchaseOrderItemsTable,
#purchaseItemsTable {
  min-width: 1660px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e4eaf0;
  padding-top: 12px;
}
.combo-panel .modal-actions {
  border-top: 0;
}
.alert-panel {
  width: min(420px, calc(100vw - 40px));
  min-height: auto;
}
.alert-message {
  min-height: 54px;
  padding: 16px 0;
  color: #2d4054;
  line-height: 1.6;
  white-space: pre-wrap;
}
.progress-panel {
  width: min(460px, calc(100vw - 40px));
  min-height: auto;
}
.progress-message {
  padding: 14px 0 8px;
  color: #2d4054;
  line-height: 1.5;
}
.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7f1;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2582d8;
  transition: width .18s ease;
}
.progress-bar.indeterminate {
  width: 35%;
  animation: progress-slide 1.2s infinite ease-in-out;
}
.progress-detail {
  min-height: 24px;
  padding-top: 8px;
  color: #607282;
}
@keyframes progress-slide {
  0% { margin-left: -35%; }
  50% { margin-left: 55%; }
  100% { margin-left: 100%; }
}
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #1d6fb8;
  background: #2582d8;
  color: white;
  border-radius: 3px;
  cursor: pointer;
}
.file-button input { display: none; }
.tag {
  display: inline-block;
  border-radius: 2px;
  padding: 1px 6px;
  background: #e8f3ff;
  color: #1976c9;
  border: 1px solid #c8e2fb;
}
.danger-link {
  color: #c0392b;
  background: transparent;
  border: 0;
  padding: 0;
  min-height: 0;
}
.link-button {
  color: #1976c9;
  background: transparent;
  border: 0;
  min-height: 0;
  padding: 0;
  margin-right: 10px;
  border-radius: 0;
  line-height: 20px;
}
.link-button:hover {
  color: #0f5ea6;
  text-decoration: underline;
}
.link-button.danger {
  color: #c0392b;
}
.summary-link {
  font-weight: 600;
}
.modal-drag-handle {
  cursor: move;
}
.modal-drag-handle button,
.modal-drag-handle input,
.modal-drag-handle select,
.modal-drag-handle textarea,
.modal-drag-handle a {
  cursor: auto;
}
body.dragging-modal {
  user-select: none;
  cursor: move;
}

.doc-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 14px;
  padding: 10px 12px;
  margin: 0 0 12px;
  background: #f7fafc;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
}

.doc-summary div {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.doc-summary span {
  color: #52616f;
  white-space: nowrap;
}

.doc-summary strong {
  color: #102a43;
  font-weight: 600;
  word-break: break-all;
}

.fg-document-view-panel {
  width: min(92vw, 1280px);
  height: min(88vh, 860px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.fg-document-view-panel .modal-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.fg-document-view-panel .modal-table-wrap {
  flex: 1 1 auto;
  min-height: 360px;
  max-height: none;
}
.bound-count-text {
  color: #1976c9;
  font-weight: 600;
}
.negative-stock-confirm-modal {
  place-items: center;
  padding: 20px;
}
.negative-stock-confirm-panel {
  width: min(820px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: 42px auto minmax(180px, 1fr) auto auto;
  overflow: hidden;
}
.negative-stock-warning {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 4px solid #d93025;
  background: #fff5f4;
  color: #33485c;
}
.negative-stock-warning strong {
  color: #c62828;
  font-size: 16px;
}
.negative-stock-table-wrap {
  min-height: 180px;
  max-height: 390px;
  border: 1px solid #d8e0e8;
}
.negative-stock-summary {
  padding: 10px 2px 4px;
  color: #607282;
}
.negative-stock-confirm-panel .modal-actions {
  justify-content: flex-end;
}
.remaining-quantity-text {
  color: #d93025;
  font-weight: 600;
}
.negative-stock {
  color: #d93025;
  font-weight: 700;
}
.bound-count-link {
  margin-right: 0;
}
.thumb {
  width: 50px;
  height: 38px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid #d8e0e8;
  background: #f4f6f8;
}
.image-link { color: #1976c9; text-decoration: none; }
.image-hover {
  position: relative;
  display: inline-block;
}
.image-hover:hover {
  z-index: 80;
}
tbody tr:has(.image-hover:hover) {
  position: relative;
  z-index: 50;
}
td:has(.image-hover:hover) {
  position: relative;
  z-index: 90;
  overflow: visible;
}
.image-popover {
  display: none;
  position: absolute;
  left: 58px;
  top: 0;
  z-index: 120;
  padding: 6px;
  background: #fff;
  border: 1px solid #9fb4c8;
  box-shadow: 0 10px 28px rgba(20, 35, 50, .24);
}
.image-popover img {
  display: block;
  max-width: 360px;
  max-height: 360px;
  object-fit: contain;
}
.image-hover:hover .image-popover {
  display: block;
}
.no-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 38px;
  color: #8a98a8;
  background: #f4f6f8;
  border: 1px solid #d8e0e8;
  border-radius: 2px;
}

@media (max-width: 980px) {
  #stocktakeDocModal {
    padding: 12px;
  }
  #stocktakeDocModal .stocktake-doc-panel {
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .stocktake-doc-form {
    grid-template-columns: 1fr;
  }
  .stocktake-remark-field {
    grid-column: auto;
  }
  #stocktakeMaterialPickerModal .stocktake-picker-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .erp-shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .erp-header { grid-template-columns: 90px 1fr; padding: 0 8px 8px 0; gap: 8px; }
  .erp-menu { display: flex; overflow: auto; padding: 0; }
  .erp-menu button { width: auto; min-width: 112px; }
  .accessory-group-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(220px, 1fr) minmax(240px, 1fr); }
  .accessory-group-list-card,
  .accessory-group-items-card { grid-column: 1; grid-row: auto; }
  .inventory-doc-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(220px, 1fr) minmax(240px, 1fr); }
  .inventory-doc-form,
  .inventory-doc-list-card,
  .inventory-doc-items-card { grid-column: 1; grid-row: auto; }
  .inventory-line-editor { grid-template-columns: 1fr 1fr; }
  .purchase-order-layout .inventory-doc-form { grid-template-columns: 1fr; }
  .purchase-order-adders { grid-template-columns: 1fr; }
  .material-control-rule-form { grid-template-columns: 1fr 1fr; }
  .purchase-order-line { grid-template-columns: 1fr; }
  .purchase-order-line .purchase-line-actions { grid-column: 1; grid-template-columns: 1fr 1fr; }
  #purchaseOrderDocModal {
    padding: 12px;
  }
  .purchase-order-doc-panel {
    width: calc(100vw - 24px);
    min-width: 0;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .purchase-order-doc-form {
    grid-template-columns: 1fr;
  }
  #inboundDocModal {
    padding: 12px;
  }
#inboundDocModal .inbound-doc-panel {
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .inbound-doc-form {
    grid-template-columns: 1fr;
  }
  .production-order-form {
    grid-template-columns: 1fr;
  }
  .production-product-search-field,
  .production-product-selected-field,
  .production-remark-field {
    grid-column: auto;
  }
  #productionProductPickerModal .production-product-picker-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .inbound-source-field,
  .inbound-remark-field {
    grid-column: auto;
  }
  #inboundPurchaseOrderPickerModal .inbound-picker-panel,
  #inboundMaterialPickerModal .inbound-picker-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }
  .user-admin-layout { grid-template-columns: 1fr; }
  .user-help { margin-left: 0; }
  .user-form-actions { padding-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  label { grid-template-columns: 74px minmax(0, 1fr); }
}
.customer-return-modal-panel { width: min(1380px, 98vw); max-height: 96vh; overflow: auto; }
.customer-return-form { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px 14px; padding: 12px; }
.customer-return-form label { display: flex; align-items: center; gap: 8px; }
.customer-return-form label input,.customer-return-form label select { flex: 1; min-width: 0; }
.customer-return-form .wide { grid-column: span 2; }
.customer-return-panel { margin-top: 10px; }
.cr-summary { padding: 10px 14px; background: #f4f8fc; border: 1px solid #ccd9e6; margin: 8px 0; }
.cr-product-card { margin: 10px 0; }
.cr-product-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cr-product-title > span:first-of-type { margin-right: auto; font-weight: 700; }
.cr-product-title input { width: 78px; }
.cr-product-check { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.cr-form-actions select { min-width: 160px; }
.cr-pick-qty { width: 70px; }
.setting-status { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 3px; border: 1px solid #d7e3f0; background: #f7fbff; color: #334e68; }
.setting-status.is-on { border-color: #8dd6a5; background: #edf9f0; color: #16803a; }
.setting-status.is-off { border-color: #f0b7b7; background: #fff5f5; color: #b42318; }
.cr-damaged-row { background: #fff3f0; }
.cr-damaged-row td { color: #8c2f20; }
.cr-damage-group-section { margin-top: 22px; padding-top: 14px; border-top: 1px solid #ccd9e6; }
.customer-return-report-panel { width: min(1450px, 98vw); max-height: 94vh; overflow: auto; }
.customer-return-page-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; gap: 8px; }
.customer-return-page-tabs { margin: 0; }
.cr-page-panel { display: none; min-height: 0; overflow: auto; }
.cr-page-panel.active { display: block; }
.customer-return-list-card,.customer-return-loss-card { min-height: 420px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.customer-return-loss-query { grid-template-columns: repeat(4,minmax(150px,1fr)); }
.customer-return-loss-query .query-actions { grid-column: span 4; }

.config-page[data-config-page-panel="inventorySettings"] .inventory-settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  overflow: auto;
}
.inventory-settings-section {
  flex: 0 0 auto;
  border: 1px solid #ccd9e6;
  background: #fff;
  border-radius: 3px;
  overflow: hidden;
}
.inventory-settings-section .config-section-title { border-top: 0; }
.material-control-rule-table-wrap { max-height: 360px; overflow: auto; }
.return-damage-settings-card .cr-damage-group-section { margin: 0; padding: 0; border: 0; }
.return-damage-settings-card .table-wrap { max-height: 320px; overflow: auto; }
.required-mark { color: #d33; margin-left: 2px; }
@media (max-width: 900px) { .customer-return-form { grid-template-columns: 1fr 1fr; } .customer-return-form .wide { grid-column: span 2; } }
@media (max-width: 900px) { .customer-return-loss-query { grid-template-columns: 1fr 1fr; } .customer-return-loss-query .query-actions { grid-column: span 2; } }
