/* ==========================================================================
   site.css — Stocktake frontend styles

   Sections:
   1. Global base
   2. Results grid
   3. Edit quantity modal & keypad
   4. Responsive / product grid
   5. Layout & page shell
   6. Header & user actions
   7. Filters & searchable selects
   8. Summary cards
   9. Login modal
   10. Change password modal
   ========================================================================== */
/* ==========================================================================
   Global base styles
   ========================================================================== */
body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 2000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: #004ac6;
  color: #fff;
  border-radius: 0.5rem;
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.btn-primary-action:disabled,
.btn-secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.field-invalid {
  border-color: #ba1a1a !important;
  box-shadow: 0 0 0 2px rgba(186, 26, 26, 0.15);
}

.zebra-row:nth-child(even) {
  background-color: #F8FAFC;
}

/* ==========================================================================
   Results grid (edited rows, table layout)
   ========================================================================== */
/* Edited rows */
.edited-row {
  background-color: #fef2f2 !important;
  box-shadow: inset 4px 0 0 #dc2626;
}

.edited-row:nth-child(even) {
  background-color: #fee2e2 !important;
}

.edited-row-text {
  color: #b91c1c !important;
}

.edited-qty-text {
  color: #dc2626 !important;
  font-weight: 700;
}

.edited-row .row-action-cell {
  color: inherit;
}

.edited-row .edit-quantity-btn {
  position: relative;
  z-index: 1;
}

#editQuantityModal .edit-qty-modal-dialog {
  width: min(calc(100% - 2rem), 32rem);
  max-width: 32rem;
  margin: 1rem auto;
}

#editQuantityModal .edit-qty-modal {
  border-radius: 1rem;
  background: #ffffff;
}

#editQuantityModal .edit-qty-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
}

#editQuantityModal .edit-qty-modal-title {
  font-size: 1.375rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: #191b23;
}

#editQuantityModal .edit-qty-modal-body {
  padding: 1.25rem 1.5rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#editQuantityModal .edit-qty-product-info {
  margin: 0;
  padding: 0.375rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 600;
  color: #191b23;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#editQuantityModal .edit-qty-quantities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
}

#editQuantityModal .edit-qty-qty-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

#editQuantityModal .edit-qty-qty-label {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #434655;
}

#editQuantityModal .edit-qty-qty-display,
#editQuantityModal .edit-qty-qty-input {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.375rem 0.625rem;
  border: 2px solid #c3c6d7;
  border-radius: 0.75rem;
  background: #ffffff;
  font-size: 1.375rem;
  line-height: 1.5rem;
  font-weight: 700;
  color: #191b23;
  text-align: center;
}

#editQuantityModal .edit-qty-qty-display--old {
  color: #2563eb;
}

#editQuantityModal .edit-qty-qty-input {
  width: 100%;
  cursor: default;
  background: #fef9e7;
}

#editQuantityModal .edit-qty-qty-input.field-invalid {
  border-color: #ba1a1a;
  box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.15);
  background: #fef9e7;
}

#editQuantityModal .edit-qty-qty-input.edited-qty-text {
  color: #dc2626;
}

#editQuantityModal .edit-qty-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.375rem;
}

#editQuantityModal .edit-qty-keypad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid #9ee0a8;
  border-radius: 0.875rem;
  background: #c8facd;
  font-size: 1.375rem;
  line-height: 1;
  font-weight: 700;
  color: #191b23;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: background-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  user-select: none;
}

#editQuantityModal .edit-qty-keypad-btn:hover {
  background: #b8f0c0;
}

#editQuantityModal .edit-qty-keypad-btn:active {
  transform: scale(0.98);
  background: #a8e8b2;
}

#editQuantityModal .edit-qty-keypad-btn--action {
  font-size: 1.125rem;
  color: #434655;
}

#editQuantityModal .edit-qty-modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: #f8fafc;
}

#editQuantityModal .edit-qty-footer-btn {
  min-height: 2.5rem;
  border-radius: 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.25rem;
  font-weight: 700;
  touch-action: manipulation;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

#editQuantityModal .edit-qty-footer-btn:active {
  transform: scale(0.98);
}

#editQuantityModal .edit-qty-footer-btn--cancel {
  border: 2px solid #c3c6d7;
  background: #ffffff;
  color: #191b23;
}

#editQuantityModal .edit-qty-footer-btn--cancel:hover {
  background: #f8fafc;
}

#editQuantityModal .edit-qty-footer-btn--update {
  border: 2px solid #2563eb;
  background: #2563eb;
  color: #ffffff;
}

#editQuantityModal .edit-qty-footer-btn--update:hover {
  background: #004ac6;
  border-color: #004ac6;
}

@media (min-width: 768px) {
  #editQuantityModal .edit-qty-modal-header,
  #editQuantityModal .edit-qty-modal-body,
  #editQuantityModal .edit-qty-modal-footer {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  #editQuantityModal .edit-qty-modal-dialog {
    width: min(calc(100% - 2.5rem), 28rem);
    max-width: 28rem;
  }

  #editQuantityModal .edit-qty-modal-header,
  #editQuantityModal .edit-qty-modal-body,
  #editQuantityModal .edit-qty-modal-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  #editQuantityModal .edit-qty-modal-header {
    padding-top: 1rem;
    padding-bottom: 0.75rem;
  }

  #editQuantityModal .edit-qty-modal-title {
    font-size: 1.25rem;
    line-height: 1.625rem;
  }

  #editQuantityModal .edit-qty-modal-body {
    padding-top: 1rem;
    padding-bottom: 0.875rem;
    gap: 0.875rem;
  }

  #editQuantityModal .edit-qty-product-info {
    font-size: 1.0625rem;
    line-height: 1.375rem;
  }

  #editQuantityModal .edit-qty-qty-block {
    gap: 0.375rem;
  }

  #editQuantityModal .edit-qty-qty-label {
    font-size: 0.8125rem;
    line-height: 1.125rem;
  }

  #editQuantityModal .edit-qty-qty-display,
  #editQuantityModal .edit-qty-qty-input {
    min-height: 2.375rem;
    padding: 0.3125rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1.375rem;
  }

  #editQuantityModal .edit-qty-keypad {
    gap: 0.625rem;
    margin-top: 0.25rem;
  }

  #editQuantityModal .edit-qty-keypad-btn {
    min-height: 2.5rem;
    font-size: 1.25rem;
    border-radius: 0.75rem;
  }

  #editQuantityModal .edit-qty-keypad-btn--action {
    font-size: 1rem;
  }

  #editQuantityModal .edit-qty-modal-footer {
    padding-top: 0.625rem;
    padding-bottom: 0.75rem;
    gap: 0.625rem;
  }

  #editQuantityModal .edit-qty-footer-btn {
    min-height: 2.375rem;
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   Responsive styles
   ========================================================================== */
@media (max-width: 575.98px) {
  #editQuantityModal .edit-qty-modal-dialog {
    margin: 0.5rem;
    width: calc(100% - 1rem);
    max-width: none;
  }

  #editQuantityModal .edit-qty-modal-footer {
    grid-template-columns: 1fr;
  }
}

.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.product-grid-table {
  min-width: 48rem;
}

.product-grid-table .product-grid-th {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #4b5563;
}

.product-grid-table .product-grid-th-qty-inline {
  display: none;
}

.product-grid-table .product-grid-th-qty-stacked {
  display: block;
}

.product-grid-table .product-grid-th-line {
  display: block;
  font-weight: 700;
  line-height: 1.15;
}

@media (min-width: 640px) {
  .product-grid-table .product-grid-th {
    padding: 0.625rem 1.5rem;
  }
}

.product-grid-table .product-grid-td {
  padding: 0.4375rem 1rem;
  vertical-align: middle;
  font-size: 1rem;
  line-height: 1.375rem;
  font-weight: 600;
}

@media (min-width: 640px) {
  .product-grid-table .product-grid-td {
    padding: 0.5rem 1.5rem;
  }
}

.product-grid-table .product-grid-th-barcode,
.product-grid-table .product-grid-barcode,
.product-grid-table .product-grid-th-scan-time,
.product-grid-table .product-grid-scan-time {
  width: 1%;
  white-space: nowrap;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.product-grid-table .product-grid-th-barcode,
.product-grid-table .product-grid-barcode {
  max-width: 15ch;
}

.product-grid-table .product-grid-th-scan-time,
.product-grid-table .product-grid-scan-time {
  max-width: 9.5rem;
}

.product-grid-table .product-grid-th-qty,
.product-grid-table .product-grid-qty {
  width: 1%;
  white-space: nowrap;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  max-width: 4.5rem;
}

.product-grid-table .product-grid-qty {
  text-align: center;
}

.product-grid-table .product-grid-th-qty {
  white-space: normal;
}

.product-grid-table .product-grid-th-old-qty,
.product-grid-table .product-grid-th-new-qty {
  text-align: right;
}

@media (min-width: 640px) {
  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode,
  .product-grid-table .product-grid-th-scan-time,
  .product-grid-table .product-grid-scan-time {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .product-grid-table .product-grid-th-qty,
  .product-grid-table .product-grid-qty {
    padding-left: 0.625rem;
    padding-right: 0.625rem;
    max-width: 4.75rem;
  }
}

.product-grid-table .product-grid-barcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1.20rem;
  line-height: 1.375rem;
  font-weight: 700;
}

.product-grid-table .product-grid-th-scan-time,
.product-grid-table .product-grid-scan-time {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.product-grid-table .product-grid-scan-time {
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.product-grid-table .product-grid-th-product-name,
.product-grid-table .product-grid-product-name {
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 12rem;
}

@media (min-width: 640px) {
  .product-grid-table .product-grid-product-name {
    max-width: 18rem;
  }
}

.product-grid-table .product-grid-qty {
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
}

.product-grid-table .product-grid-qty .edited-qty-text {
  font-size: inherit;
  line-height: inherit;
}

.product-grid-table .edit-quantity-btn {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
}

.product-grid-table .product-grid-th-action,
.product-grid-table .product-grid-action {
  width: 1%;
  max-width: 3rem;
  white-space: nowrap;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.custom-scrollbar::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #E2E8F0;
  border-radius: 10px;
}

.loading-overlay {
  backdrop-filter: blur(2px);
}

.spinner-icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner-icon {
    animation: none;
  }

  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Layout, header, filter controls (searchable selects)
   ========================================================================== */
/* Header & input panel */
.searchable-select {
  position: relative;
}

.searchable-select-control {
  position: relative;
  width: 100%;
}

.searchable-select-input--clearable {
  padding-right: 2.5rem;
}

.searchable-select-clear {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transform: translateY(-50%);
  touch-action: manipulation;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.searchable-select-clear:hover {
  background-color: #f1f5f9;
  color: #334155;
}

.searchable-select-clear:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.searchable-select-clear .material-symbols-outlined {
  font-size: 1.125rem;
}

.searchable-select-clear[hidden] {
  display: none;
}

.searchable-select-input:disabled ~ .searchable-select-clear {
  display: none;
}

.page-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.375rem 0.5rem;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.5rem 0.75rem;
}

.page-shell-main {
  margin-top: 4rem;
  margin-bottom: 2rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-decoration: none;
}

.header-logo {
  display: block;
  height: 2rem;
  width: auto;
  object-fit: contain;
}

.header-brand-text {
  min-width: 0;
  line-height: 1.15;
  letter-spacing: 0.02em;
  font-size: 0.875rem;
  font-weight: 700;
  color: #00A1EC;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1023.98px) {
  .header-brand {
    overflow: visible;
    align-items: center;
  }

  .header-brand-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: 100%;
  }
}

@media (min-width: 640px) and (max-width: 1023.98px) {
  .page-shell-header {
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 1rem;
    flex-wrap: nowrap;
  }

  .page-shell-main {
    margin-top: 4rem;
    margin-bottom: 2.5rem;
  }

  .header-brand {
    gap: 0.5625rem;
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-logo {
    height: 2.25rem;
  }

  .header-brand-text {
    font-size: 1rem;
  }
}

@media (min-width: 1024px) {
  .page-shell-header {
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
  }

  .page-shell-main {
    margin-top: 4rem;
    margin-bottom: 2.5rem;
  }

  .header-brand {
    gap: 0.625rem;
    flex: 0 1 auto;
  }

  .header-logo {
    height: 2.5rem;
  }

  .header-brand-text {
    font-size: 1.5rem;
  }
}

.input-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: end;
}

.input-panel-field--compact {
  min-width: 0;
}

/* ==========================================================================
   Summary cards
   ========================================================================== */
.summary-header-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.summary-logo-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: fit-content;
  max-width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0.625rem 0.75rem;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #c3c6d7;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.summary-logo-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.empty-state-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: 8rem;
  padding-inline: 0;
  object-fit: contain;
}

@media (min-width: 640px) {
  .empty-state-logo {
    height: 10rem;
  }
}

@media (min-width: 640px) {
  .input-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023.98px) {
  .page-shell-main {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  .page-shell-header {
    max-width: none;
  }

  .input-panel,
  #emptyState,
  #productListSection > section[aria-labelledby="productTableCaption"] {
    border-radius: 0;
    border-left-width: 0;
    border-right-width: 0;
    box-shadow: none;
  }

  #productListSection > section:first-child {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .summary-panel-grid {
    gap: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  #mainContent {
    gap: 1.25rem;
  }

  .input-panel {
    padding: 1.25rem !important;
  }

  .input-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
  }

  .input-panel-field--action {
    grid-column: auto;
    min-width: 0;
  }

  .input-panel-search-btn {
    min-height: 3.25rem;
  }

  .summary-scan-area-value {
    font-size: 1.125rem;
    line-height: 1.5rem;
  }

  .summary-card-value {
    font-size: 1.125rem;
    line-height: 1.5rem;
  }

  #productListSection {
    width: 100%;
    min-width: 0;
  }

  #productListSection > section[aria-labelledby="productTableCaption"] {
    margin-left: 1rem;
    margin-right: 1rem;
    width: auto;
    max-width: none;
    border-radius: 0.75rem;
    border-left-width: 1px;
    border-right-width: 1px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }

  .table-scroll-wrap {
    overflow-x: hidden;
    width: 100%;
  }

  .product-grid-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }

  .product-grid-table .product-grid-th,
  .product-grid-table .product-grid-td {
    overflow: hidden;
    min-width: 0;
  }

  .product-grid-table .product-grid-barcode {
    font-size: 1.125rem;
    line-height: 1.375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-grid-table .product-grid-scan-time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-grid-table .edit-quantity-btn {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
  }

  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode {
    width: 14%;
    max-width: 14%;
  }

  .product-grid-table .product-grid-th-scan-time,
  .product-grid-table .product-grid-scan-time {
    width: 11%;
    max-width: 11%;
  }

  .product-grid-table .product-grid-th-product-name,
  .product-grid-table .product-grid-product-name {
    width: 20%;
    min-width: 0;
    max-width: 20%;
    font-size: 0.875rem;
    line-height: 1.25rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .product-grid-table .product-grid-th-qty,
  .product-grid-table .product-grid-qty {
    width: 4%;
    max-width: 4%;
    overflow: hidden;
  }

  .product-grid-table .product-grid-th-qty {
    white-space: normal;
    font-size: 0.6875rem;
    line-height: 1.1;
    padding-left: 0.125rem;
    padding-right: 0.125rem;
  }

  .product-grid-table .product-grid-th-qty .product-grid-th-line {
    line-height: 1.1;
  }

  .product-grid-table .product-grid-qty {
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
    line-height: 1.125rem;
    padding-left: 0;
    padding-right: 0;
  }

  .product-grid-table .product-grid-th-action,
  .product-grid-table .product-grid-action {
    width: 4%;
    max-width: 4%;
    margin-right: 0.5rem;
  }

  .product-grid-table .product-grid-th {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
  }

  .product-grid-table .product-grid-td {
    padding: 0.4375rem 0.625rem;
  }
}

@media (max-width: 1023.98px) {
  .product-grid-table .product-grid-qty {
    padding-left: 0;
    padding-right: 0;
  }

  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode,
  .product-grid-table .product-grid-th-scan-time,
  .product-grid-table .product-grid-scan-time,
  .product-grid-table .product-grid-th-product-name,
  .product-grid-table .product-grid-product-name {
    padding-left: 0.125rem;
    padding-right: 0.125rem;
  }
}

@media (max-width: 767.98px) {
  #mainContent,
  .page-shell-main,
  #productListSection,
  #productListSection > section,
  .table-scroll-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #mainContent {
    overflow-x: hidden;
  }

  .table-scroll-wrap {
    overflow-x: hidden;
  }

  .product-grid-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
  }

  .product-grid-table .product-grid-th,
  .product-grid-table .product-grid-td {
    overflow: visible;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
  }

  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode {
    width: 20%;
    max-width: 20%;
  }

  .product-grid-table .product-grid-th-scan-time,
  .product-grid-table .product-grid-scan-time {
    width: 16%;
    max-width: 16%;
  }

  .product-grid-table .product-grid-th-product-name,
  .product-grid-table .product-grid-product-name {
    width: auto;
    min-width: 0;
    max-width: none;
    font-size: 0.8125rem;
    line-height: 1.25rem;
  }

  .product-grid-table .product-grid-th-qty,
  .product-grid-table .product-grid-qty {
    width: 5%;
    max-width: 5%;
  }

  .product-grid-table .product-grid-th-qty {
    font-size: 0.6875rem;
    line-height: 1.1;
  }

  .product-grid-table .product-grid-qty {
    font-size: 0.8125rem;
    line-height: 1.125rem;
  }

  .product-grid-table .product-grid-th-action,
  .product-grid-table .product-grid-action {
    width: 8%;
    max-width: 8%;
    vertical-align: middle;
  }

  .product-grid-table .product-grid-barcode {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode,
  .product-grid-table .product-grid-th-scan-time,
  .product-grid-table .product-grid-scan-time,
  .product-grid-table .product-grid-th-qty,
  .product-grid-table .product-grid-qty,
  .product-grid-table .product-grid-th-product-name,
  .product-grid-table .product-grid-product-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
  .product-grid-table .product-grid-th-barcode,
  .product-grid-table .product-grid-barcode {
    padding-left: 0.375rem;
  }

  .product-grid-table .product-grid-qty {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (min-width: 1024px) {
  .product-grid-table .product-grid-th-qty-inline {
    display: inline;
  }

  .product-grid-table .product-grid-th-qty-stacked {
    display: none;
  }

  .product-grid-table .product-grid-th-qty {
    white-space: nowrap;
  }

  .input-panel-grid {
    grid-template-columns:
      minmax(9rem, 0.95fr)
      minmax(9rem, 0.95fr)
      minmax(9rem, 0.95fr)
      minmax(9rem, 0.95fr)
      auto;
    gap: 0.625rem 0.75rem;
  }

  .input-panel-field--action {
    grid-column: auto;
  }

  .summary-header-panel {
    flex-direction: row;
    align-items: stretch;
    gap: 1rem;
  }

  .summary-logo-panel {
    flex: 0 0 auto;
    width: fit-content;
    justify-self: start;
    align-self: stretch;
  }

  .summary-logo-image {
    max-height: 3rem;
  }

  .summary-header-panel .summary-panel-grid {
    flex: 1 1 auto;
    min-width: 0;
  }

  #editQuantityModal .edit-qty-modal-dialog,
  #editQuantityModal .modal-dialog {
    width: min(calc(100% - 3rem), 32rem);
    max-width: 32rem;
  }

  #editQuantityModal .edit-qty-product-info {
    font-size: 1.25rem;
    line-height: 1.625rem;
  }

  #editQuantityModal .edit-qty-qty-display,
  #editQuantityModal .edit-qty-qty-input {
    min-height: 2.75rem;
    font-size: 1.5rem;
    line-height: 1.625rem;
  }

  #editQuantityModal .edit-qty-keypad {
    gap: 0.875rem;
  }

  #editQuantityModal .edit-qty-keypad-btn {
    min-height: 3rem;
    font-size: 1.5rem;
  }

  #editQuantityModal .edit-qty-footer-btn {
    min-height: 2.75rem;
    font-size: 1rem;
  }
}

.input-panel-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.input-panel-field--action {
  min-width: 8.5rem;
}

.input-panel-label {
  font-size: 0.9375rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #191b23;
}

.input-panel-label--action {
  visibility: hidden;
}

.input-panel-control {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.375rem;
  color: #191b23;
  background-color: #ffffff;
  border: 1px solid #525252;
  border-radius: 0.75rem !important;
  box-sizing: border-box;
}

.input-panel .searchable-select-input.input-panel-control,
.input-panel .input-panel-select.searchable-select-input {
  border-radius: 0.75rem !important;
  border: 1px solid #525252 !important;
  appearance: none;
  -webkit-appearance: none;
}

.input-panel-control:focus {
  outline: none;
}

.input-panel-control:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.input-panel-select-wrap {
  width: 100%;
}

.input-panel-select.searchable-select-input {
  background-color: #ffffff;
  font-size: 1rem;
  line-height: 1.375rem;
}

.input-panel-select.searchable-select-input:disabled {
  background-color: #f1f5f9;
  opacity: 0.65;
}

.input-panel-search-btn {
  min-height: 2.75rem;
  padding: 0.4375rem 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.summary-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
}

.summary-scan-area-card,
.summary-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.625rem 0.75rem !important;
}

@media (min-width: 640px) {
  .summary-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .summary-panel-grid {
    grid-template-columns: minmax(10rem, 1.1fr) repeat(4, minmax(0, 1fr));
  }

  .summary-scan-area-card {
    grid-column: auto;
  }
}

@media (max-width: 1023.98px) {
  .summary-header-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 0.625rem;
    align-items: stretch;
  }

  .summary-panel-grid {
    display: contents;
    padding: 0;
    gap: 0;
  }

  .summary-logo-panel {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: stretch;
    width: fit-content;
    height: 100%;
  }

  .summary-scan-area-card {
    grid-column: 2;
    grid-row: 1;
  }

  .summary-panel-grid > .summary-metric-card:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
  }

  .summary-panel-grid > .summary-metric-card:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }

  .summary-panel-grid > .summary-metric-card:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
  }

  .summary-panel-grid > .summary-metric-card:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
  }
}

.summary-card-label {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #737686;
}

.summary-scan-area-value {
  margin: 0.25rem 0 0;
  font-size: 1.25rem;
  line-height: 1.5rem;
  font-weight: 700;
  color: #191b23;
  word-break: break-word;
}

.summary-card-value {
  margin: 0.125rem 0 0;
  font-size: 1.25rem;
  line-height: 1.5rem;
  font-weight: 600;
  color: #191b23;
}

.searchable-select-input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background-color: #f1f5f9;
}

.searchable-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.searchable-select-option,
.searchable-select-empty {
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  line-height: 1.375rem;
  color: #1e293b;
}

.searchable-select-option {
  cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
  background-color: #f1f5f9;
}

.searchable-select-option.is-selected {
  background-color: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.searchable-select-empty {
  color: #64748b;
  cursor: default;
}

/* ==========================================================================
   Login gate modal
   ========================================================================== */
/* Login gate */
.stocktake-app--locked {
  display: none;
}

#loginModal .login-modal-dialog {
  max-width: 28rem;
}

#loginModal .login-modal {
  border-radius: 0.75rem;
}

#loginModal .login-modal-header {
  padding: 0.75rem 1.25rem;
  background: #fff;
}

#loginModal .login-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #191b23;
}

#loginModal .login-modal-body {
  padding: 1rem 1.25rem 1.25rem;
  background: #fff;
}

#loginModal .login-modal-description {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: #434655;
}

#loginModal .login-field + .login-field {
  margin-top: 0.875rem;
}

#loginModal .login-field-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #191b23;
}

#loginModal .login-field-input {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #c3c6d7;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #191b23;
  background: #fff;
}

#loginModal .login-field-input:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

#loginModal .login-field-input.field-invalid {
  border-color: #ba1a1a;
}

#loginModal .login-field-error,
#loginModal .login-form-error {
  margin: 0.375rem 0 0;
  font-size: 0.8125rem;
  color: #ba1a1a;
}

#loginModal .login-modal-footer {
  padding: 0.5rem 1.25rem 0.75rem;
  background: #fff;
  justify-content: flex-end;
}

/* ==========================================================================
   Change password modal & keypad
   ========================================================================== */
/* Change password modal */
.change-password-modal-backdrop {
  backdrop-filter: blur(4px);
  background-color: rgba(25, 27, 35, 0.4) !important;
}

#changePasswordModal .change-password-modal-dialog {
  width: min(calc(100% - 2rem), 30rem);
  max-width: 30rem;
  margin: 1rem auto;
}

#changePasswordModal .modal-content {
  background: transparent;
  border: 0;
  border-radius: 0;
}

#changePasswordModal .change-password-modal {
  overflow: hidden;
  border: 1px solid #c3c6d7;
  border-radius: 0.5rem;
  background: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

#changePasswordModal .change-password-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #c3c6d7;
  background: #faf8ff;
}

#changePasswordModal .change-password-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: #191b23;
}

#changePasswordModal .change-password-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: 0;
  border-radius: 0.125rem;
  background: transparent;
  color: #434655;
  transition: background-color 0.15s ease;
}

#changePasswordModal .change-password-modal-close:hover {
  background: #e7e7f3;
}

#changePasswordModal .change-password-modal-close .material-symbols-outlined {
  font-size: 1.5rem;
  line-height: 1;
}

#changePasswordModal .change-password-modal-form {
  display: flex;
  flex-direction: column;
}

#changePasswordModal .change-password-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
}

#changePasswordModal .change-password-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#changePasswordModal .change-password-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.33;
  color: #434655;
}

#changePasswordModal .change-password-field-control {
  position: relative;
}

#changePasswordModal .change-password-field-input {
  display: block;
  width: 100%;
  padding: 0.25rem 2.75rem 0.25rem 1rem;
  border: 1px solid #737686;
  border-radius: 0.125rem;
  background: #ffffff;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #191b23;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#changePasswordModal .change-password-field-input::placeholder {
  color: #737686;
}

#changePasswordModal .change-password-field-input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px #004ac6;
}

#changePasswordModal .change-password-field-input.field-invalid {
  border-color: #ba1a1a;
  box-shadow: 0 0 0 1px #ba1a1a;
}

#changePasswordModal .change-password-visibility-btn {
  position: absolute;
  top: 50%;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #434655;
  transform: translateY(-50%);
  cursor: pointer;
}

#changePasswordModal .change-password-visibility-btn .material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
}

#changePasswordModal .change-password-visibility-btn:hover {
  color: #191b23;
}

#changePasswordModal .change-password-field-error,
#changePasswordModal .change-password-form-error {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #ba1a1a;
}

#changePasswordModal .change-password-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #c3c6d7;
  background: #faf8ff;
}

.product-grid-table .product-grid-product-name {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  line-height: 1.15rem;
}

@media (max-width: 767.98px) {
  .product-grid-table .product-grid-product-name {
    padding-top: 0.1875rem;
    padding-bottom: 0.1875rem;
  }
}

#changePasswordModal .change-password-cancel-btn {
  padding: 0.25rem 1.5rem;
  border: 1px solid #c3c6d7;
  border-radius: 9999px;
  background: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: #434655;
  transition: background-color 0.15s ease;
}

#changePasswordModal .change-password-cancel-btn:hover:not(:disabled) {
  background: #e7e7f3;
}

#changePasswordModal .change-password-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 8.5rem;
  padding: 0.25rem 1.5rem;
  border: 0;
  border-radius: 9999px;
  background: #004ac6;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: #ffffff;
  transition: background-color 0.15s ease;
}

#changePasswordModal .change-password-submit-btn:hover:not(:disabled) {
  background: #0058be;
}

#changePasswordModal .change-password-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.375rem;
  min-width: 0;
  flex: 0 0 auto;
  margin-left: auto;
}

.header-user-panel {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  max-width: min(100%, 28rem);
  padding: 0.1875rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.header-user-name {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 9rem;
  padding: 0.3125rem 0.625rem 0.3125rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #191b23;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user-name::before {
  content: "account_circle";
  font-family: "Material Symbols Outlined";
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1;
  color: #2563eb;
  flex-shrink: 0;
}

.header-change-password-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-shrink: 0;
  padding: 0.375rem 0.625rem;
  border: 0;
  border-radius: 9999px;
  background: #ededf9;
  color: #004ac6;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-change-password-icon {
  font-size: 1rem;
  line-height: 1;
  display: none;
}

.header-change-password-btn:hover {
  background: #dce4f7;
  color: #004ac6;
}

.header-change-password-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.header-logout-btn {
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  border: 0;
  border-radius: 9999px;
  background: #fef2f2;
  color: #ba1a1a;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-logout-btn:hover {
  background: #fee2e2;
  color: #ba1a1a;
}

.header-logout-btn:focus-visible {
  outline: 2px solid #ba1a1a;
  outline-offset: 1px;
}

.header-save-btn-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.375rem 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.header-save-btn-top:hover:not(:disabled) {
  background: #004ac6;
}

.header-save-btn-top:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.header-save-btn-top .material-symbols-outlined,
.header-save-btn-top .spinner-icon {
  font-size: 1rem;
}

@media (max-width: 639.98px) {
  .header-user-panel {
    max-width: min(100%, 14rem);
  }

  .header-user-name {
    max-width: 4.75rem;
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
  }

  .header-user-name::before {
    font-size: 1rem;
  }

  .header-change-password-label {
    display: none;
  }

  .header-change-password-icon {
    display: inline;
  }

  .header-change-password-btn {
    padding: 0.375rem;
  }

  .header-logout-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.6875rem;
  }
}

@media (min-width: 640px) {
  .header-actions {
    gap: 0.75rem;
    flex-wrap: nowrap;
  }

  .header-user-panel {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .header-user-name {
    max-width: 11rem;
    padding: 0.375rem 0.75rem 0.375rem 0.625rem;
    font-size: 0.875rem;
  }

  .header-change-password-btn,
  .header-logout-btn {
    font-size: 0.8125rem;
  }

  .header-save-btn-top {
    min-width: 5.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  .header-save-btn-top .material-symbols-outlined,
  .header-save-btn-top .spinner-icon {
    font-size: 1.125rem;
  }
}

@media (min-width: 1024px) {
  .header-save-btn-top {
    min-width: 7rem;
    padding: 0.625rem 1.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
  }
}

@media (min-width: 640px) and (max-width: 1023.98px) {
  .header-user-panel {
    max-width: min(100%, 22rem);
  }

  .header-user-name {
    max-width: 8.5rem;
  }

  .header-change-password-btn {
    padding: 0.375rem 0.5rem;
  }
}
