body {
  font-family: Arial, sans-serif;
  padding: 14px;
  margin: 0;
  background: #f5f5f5;
}

h2,
h3 {
  margin-top: 0;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
}

.card {
  background: #ffffff;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.top-panel {
  margin-bottom: 15px;
}

.status-bar {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
  color: #333333;
  font-size: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-group-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field-label {
  font-size: 11px;
  color: #666666;
  margin-bottom: 2px;
}

.client-field-group .field-label {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 600;
  color: #333333;
  white-space: nowrap;
}

.client-field-group #clientSelect {
  min-width: 320px;
  height: 42px;
  padding: 8px 12px;
  font-size: 16px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
  padding: 8px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  box-sizing: border-box;
  background: #ffffff;
  color: #212529;
}

select option {
  background: #ffffff;
  color: #212529;
}

button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #0b5ed7;
  color: #ffffff;
}

button.secondary {
  background: #6c757d;
}

button.remove {
  background: #c62828;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: #eeeeee;
  color: #666666;
}

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

th,
td {
  padding: 8px;
  border-bottom: 1px solid #e5e5e5;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f2f2f2;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
}

.header-left {
  justify-content: flex-start;
}

.header-center {
  justify-content: center;
  text-align: center;
}

.header-right {
  justify-content: flex-end;
}

.title {
  font-size: 28px;
  font-weight: 700;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  margin-left: 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1f4f8b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mode-badge[hidden] {
  display: none;
}

.retail-landing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  max-width: 420px;
  margin: 0 auto 16px;
}

.retail-landing-title {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.retail-landing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.retail-landing-actions button {
  min-width: 120px;
  height: 42px;
}

.section-header {
  margin-bottom: 12px;
}

.no-title-header {
  display: block;
}

.product-tools-panel {
  width: 100%;
  display: grid;
  gap: 10px;
}

.bulk-add-row {
  display: grid;
  grid-template-columns: 150px 150px auto;
  gap: 10px;
  align-items: end;
}

.product-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(
      240px,
      1.4fr
    );
  gap: 10px;
  align-items: end;
}

.inline-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bulk-add-row .inline-input-group {
  align-items: end;
}

.bulk-add-row .inline-input-group input {
  width: 100%;
}

.product-filter-row .inline-input-group,
.product-filter-row .inline-input-group select,
.product-filter-row .inline-input-group input {
  width: 100%;
}

.inline-label {
  font-size: 12px;
  color: #666666;
  white-space: nowrap;
}

.product-search-input {
  min-width: 0;
}

.empty-note {
  color: #666666;
  font-style: italic;
}

.product-empty-note,
.order-empty-note {
  margin-top: 12px;
}

.order-pad-header {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.order-pad-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.currency {
  text-align: right;
}

.order-pad-header-row h3 {
  margin-bottom: 0;
}

.order-summary-metadata-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  align-items: center;
}

.order-summary-status {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.order-summary-client {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.order-summary-totals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: baseline;
}

.order-summary-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  white-space: nowrap;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button,
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input {
  width: 55px;
  min-width: 55px;
  max-width: 55px;
  padding: 4px;
  appearance: textfield;
  text-align: center;
}

.price-input {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  padding: 4px 6px;
  appearance: textfield;
  text-align: right;
}

.bulk-input.qty-input,
.bulk-input.price-input {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.checkbox-column {
  width: 34px;
}

.id-column {
  width: 70px;
}

.product-id-cell {
  font-size: 12px;
  text-align: center;
}

.product-cell {
  line-height: 1.2;
}

.product-name {
  font-weight: 600;
}

.product-subtext {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #666666;
}

.product-meta-cell {
  line-height: 1.2;
  text-align: center;
}

.product-category-text {
  display: block;
  font-size: 12px;
  color: #666666;
  font-weight: 600;
}

.product-id-label {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.1;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-id-value {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: #666666;
}

.product-price-cell {
  text-align: right;
  white-space: nowrap;
}

.client-price-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  border-radius: 999px;
  background: #fff3cd;
  color: #7a5a00;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.stacked-meta-column {
  text-align: center;
}

.product-select-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #0b5ed7;
  transform: scale(1.15);
}

.product-table tbody tr {
  cursor: pointer;
}

.product-table tbody tr:hover {
  background: #f7fbff;
}

.product-table th,
.product-table td,
.order-table th,
.order-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vaultwarden-panel {
  margin-bottom: 16px;
  padding: 18px;
}

.vaultwarden-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.vaultwarden-panel-title {
  font-size: 22px;
  font-weight: 700;
}

.vaultwarden-panel-status {
  font-size: 14px;
  font-weight: 600;
  color: #666666;
  white-space: nowrap;
}

.vaultwarden-panel-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(240px, 320px) auto;
  gap: 12px;
  align-items: end;
}

.vaultwarden-field-group {
  display: flex;
  flex-direction: column;
}

.vaultwarden-field-group input {
  height: 42px;
  font-size: 16px;
}

select:disabled {
  background-color: #f2f2f2;
  color: #888888;
  cursor: not-allowed;
}

.retail-shortcut-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.retail-order-shell {
  display: grid;
  gap: 12px;
  padding: 12px 16px 16px;
}

.retail-order-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.retail-order-table-card {
  overflow-x: auto;
  padding: 16px;
}

.retail-order-entry-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 1.2fr)
    minmax(160px, 1.6fr)
    minmax(78px, 0.6fr)
    minmax(90px, 0.7fr)
    minmax(105px, 0.8fr)
    auto
    auto;
  gap: 10px;
  align-items: end;
}

.retail-order-entry-row .field-label {
  font-size: 15px;
  font-weight: 700;
  color: #333333;
  margin-bottom: 5px;
}

.retail-order-entry-row select,
.retail-order-entry-row #txtPrice,
.retail-order-entry-row .status-bar {
  min-height: 48px;
  font-size: 18px;
}

.retail-order-entry-row .status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10% 8px 8px;
  border-color: #cfcfcf;
  border-radius: 6px;
  font-weight: 400;
}

.retail-order-entry-row #comboQuantity {
  text-align: center;
}

.retail-order-entry-row .field-group:has(#comboQuantity) .field-label {
  text-align: center;
}

.retail-order-entry-row #txtPrice {
  padding-right: 10%;
  text-align: right;
}

.retail-order-entry-row .field-group:has(#txtPrice) .field-label,
.retail-order-entry-row .field-group:has(#lblSubTotal) .field-label {
  padding-right: 10%;
  text-align: right;
}

.retail-order-actions {
  justify-content: flex-end;
  margin-right: 0;
  align-self: end;
}

.retail-close-field {
  justify-content: flex-end;
  margin-right: 0;
  align-self: end;
}

.active-button-group.retail-order-actions button,
.active-button-group.retail-close-field button {
  height: 48px;
}

.retail-price-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background: #ffffff;
}

.retail-price-input span {
  padding-left: 8px;
  color: #666666;
}

.retail-price-input input {
  border: 0;
  min-width: 0;
}

.order-table button.remove {
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
}

.retail-order-total-label,
.retail-order-total-value {
  font-weight: 700;
}

.active-button-group .retail-add-button {
  min-width: 180px;
  height: 48px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 700;
}

.retail-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 150px);
  gap: 10px;
  justify-content: start;
}

.retail-shortcut-button {
  width: 150px;
  min-height: 56px;
  white-space: normal;
  line-height: 1.2;
}

.retail-shortcut-back {
  background: #f2f4f7;
}

.vaultwarden-button-group {
  display: flex;
  gap: 10px;
  align-items: end;
}

.vaultwarden-button-group button {
  height: 42px;
  min-width: 120px;
}

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

  .top-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .header-center,
  .header-right {
    justify-content: flex-start;
    text-align: left;
  }

  .bulk-add-row,
  .product-filter-row {
    grid-template-columns: 1fr;
  }

  .order-pad-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-summary-metadata-row {
    justify-content: flex-start;
  }

  .order-summary-totals-row {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 1100px) {
  .vaultwarden-panel-body {
    grid-template-columns: 1fr;
  }

  .vaultwarden-button-group {
    align-items: stretch;
  }
}

.vaultwarden-login-message {
  margin-top: 10px;
  min-height: 20px;
  color: #b00020;
  font-size: 14px;
}

#mainApp {
  display: none;
}

.active-button-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 16px;
}

.active-button-group button {
  height: 36px;
  padding: 0 14px;
}

.bulk-add-row .inline-input-group {
  align-items: end;
}

.bulk-add-row .inline-input-group input {
  width: 100%;
}

.bulk-button-group {
  display: flex;
  align-items: end;
  gap: 10px;
  justify-content: flex-start;
  width: auto;
}
.my-orders-toolbar {
  display: flex;
  align-items: center;
  gap: 16px; /* space BETWEEN search + status */
  margin-bottom: 12px;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px; /* space between label + control */
}

.status-filter-group {
  margin-left: auto;
  gap: 10px;
}

/* Input sizing */
#OrdersSearchInput {
  width: 260px;
  padding: 6px 10px;
}

.orders-days-input {
  width: 54px;
  padding: 6px 8px;
  text-align: right;
}

.orders-days-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  white-space: nowrap;
}

.status-filter-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.status-filter-button {
  min-width: 160px;
}

.status-filter-button::after {
  content: " ▾";
  font-size: 12px;
}

.status-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line, #cfd6df);
  border-radius: 6px;
  background: var(--panel, #fff);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.status-filter-menu[hidden] {
  display: none !important;
}

.status-filter-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.status-filter-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.status-filter-actions button {
  width: auto;
  min-width: 72px;
}

.toolbar-group {
  overflow: visible;
}
.bulk-button-group button {
  width: auto;
  min-width: 120px;
}

#addSelectedButton {
  width: auto;
  min-width: 120px;
}

.bulk-button-group {
  display: flex;
  align-items: end;
  gap: 10px;
  justify-content: flex-start;
  width: auto;
}

.bulk-button-group button {
  width: auto;
  min-width: 120px;
}

.order-actions {
  margin-top: 1px;
  display: flex;
  gap: 10px;
}

.clickable-order-row {
  cursor: pointer;
}

.clickable-order-row:hover {
  background: #f5f5f5;
}

.orders-sales-rep-cell,
.orders-actions-cell {
  white-space: nowrap;
}

.orders-table th,
.orders-table td {
  padding-left: 4px;
  padding-right: 4px;
}

.orders-actions-cell button {
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.05;
}

.my-orders-page {
  max-width: 1100px;
  margin: 0 auto;
}

.order-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-new {
  background: #e9ecef;
  color: #495057;
}

.status-draft {
  background: #fff3cd;
  color: #7a5a00;
}

.status-submitted {
  background: #d1e7dd;
  color: #0f5132;
}

.status-strata {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-cancelled {
  background: #f8d7da;
  color: #842029;
}

/* Order entry header/layout refinement */
.top-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.active-button-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-right: 0;
  min-width: 120px;
}

.active-button-group button {
  width: 100%;
  height: 36px;
  padding: 0 14px;
}

.order-pad-header {
  display: block;
  margin-bottom: 12px;
}

.order-pad-main-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: stretch;
}

.order-pad-context-panel,
.order-header-notes {
  min-width: 0;
}

.order-pad-context-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.order-client-field-group {
  max-width: 100%;
}

.order-client-field-group .field-label {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #333333;
}

.order-client-field-group #clientSelect {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 12px;
  font-size: 16px;
}

.order-summary-client,
.order-summary-metadata-row,
.order-summary-totals-row {
  padding: 0;
}

.order-summary-metadata-row,
.order-summary-totals-row {
  justify-content: flex-start;
  gap: 12px 20px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.order-actions button {
  min-width: 120px;
}

.order-header-notes {
  display: grid;
  grid-template-rows: auto minmax(96px, 1fr) auto auto;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  background: #f8f9fb;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
}

.order-notes-title {
  font-size: 14px;
  font-weight: 700;
  color: #333333;
}

.order-notes-window {
  min-height: 96px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  text-align: left;
}

.order-notes-empty {
  color: #666666;
  font-size: 13px;
  font-style: italic;
}

.order-note-text {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  padding: 8px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.order-header-notes button {
  justify-self: end;
  min-width: 110px;
}

.order-note-item {
  padding: 8px 0;
  border-bottom: 1px solid #eeeeee;
}

.order-note-item:last-child {
  border-bottom: none;
}

.order-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
  color: #666666;
  font-size: 12px;
}

.order-note-body {
  color: #333333;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .top-row {
    grid-template-columns: 1fr;
  }

  .header-right {
    justify-content: flex-start;
  }

  .active-button-group {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
    width: 100%;
    max-width: 420px;
  }

  .order-pad-main-panel {
    grid-template-columns: 1fr;
  }

  .order-notes-window {
    max-height: 180px;
  }
}

@media (max-width: 700px) {
  .header-left {
    flex-direction: column;
    gap: 8px;
  }

  .active-button-group,
  .order-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .order-actions button,
  .order-header-notes button {
    width: 100%;
  }
}

.order-note-item-header {
  margin-bottom: 4px;
  color: #666666;
  font-size: 12px;
  font-weight: 700;
}

.order-note-item-text {
  color: #333333;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Order pad cosmetic refinements */
.order-pad-main-panel {
  grid-template-columns: minmax(420px, 1fr) minmax(300px, 360px);
  align-items: stretch;
}

.order-pad-context-panel {
  gap: 12px;
}

.order-client-field-group {
  width: 260px;
  max-width: 100%;
  margin-bottom: 6px;
}

.order-client-field-group #clientSelect {
  width: 100%;
  height: auto;
  min-width: 0;
  padding: 8px;
  font-size: 14px;
}

.order-summary-client {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
}

.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.order-summary-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
}

.order-summary-label {
  color: #666666;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
}

.order-summary-value {
  color: #222222;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
  padding-right: 14px;
}

.order-summary-status {
  align-items: start;
  gap: 4px;
  white-space: normal;
}

.order-summary-status .order-status-badge {
  justify-self: start;
}

.order-header-notes {
  grid-template-rows: auto 132px;
  min-height: 0;
  align-self: start;
}

.order-note-text {
  min-height: 58px;
  max-height: 90px;
  resize: vertical;
}

.order-notes-window {
  height: 132px;
  min-height: 132px;
  max-height: 132px;
  overflow-y: auto;
}

@media (max-width: 1200px) {
  .order-pad-main-panel {
    grid-template-columns: 1fr;
  }

  .order-summary-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .order-notes-window {
    height: 140px;
    min-height: 140px;
    max-height: 140px;
  }
}

@media (max-width: 800px) {
  .order-summary-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 520px) {
  .order-client-field-group {
    width: 100%;
  }

  .order-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Order pad layout update: client/category/product/search in one row */
.product-filter-row {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(
      180px,
      1fr
    ) minmax(240px, 1.4fr);
}

.client-filter-group #clientSelect,
.product-filter-row #categorySelect,
.product-filter-row #productSelect,
.product-filter-row #productSearch {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 8px;
  font-size: 14px;
}

.top-row {
  align-items: center;
}

.header-left,
.header-right {
  align-items: center;
}

.active-button-group {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  width: auto;
  max-width: none;
}

.active-button-group button {
  width: auto;
  min-width: 92px;
}

.order-pad-context-panel {
  gap: 12px;
}

@media (max-width: 1200px) {
  .product-filter-row {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .active-button-group {
    width: auto;
    max-width: none;
  }
}

@media (max-width: 700px) {
  .product-filter-row {
    grid-template-columns: 1fr;
  }

  .active-button-group {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .active-button-group button {
    width: auto;
  }
}

/* Final order pad header layout: client/actions, 6-card summary row, notes below */
.top-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.header-left,
.header-right {
  align-items: center;
}

.header-right {
  justify-content: flex-end;
}

.active-button-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: auto;
  max-width: none;
  min-width: 0;
  margin-right: 0;
}

.active-button-group button {
  width: auto;
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
}

.order-pad-main-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.order-pad-context-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.order-summary-client {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
}

.order-summary-client .order-summary-label {
  white-space: nowrap;
}

.order-summary-client .order-summary-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 8px;
}

.order-summary-card {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
}

.order-summary-status {
  display: grid;
  gap: 4px;
  align-items: start;
  white-space: normal;
}

.order-summary-status .order-status-badge {
  justify-self: start;
}

.order-header-notes {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  align-self: start;
  padding: 12px;
  background: #f8f9fb;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
}

.order-notes-window {
  height: 140px;
  min-height: 140px;
  max-height: 140px;
  overflow-y: auto;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  text-align: left;
}

.order-note-entry-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.order-note-text {
  width: 100%;
  min-height: 58px;
  max-height: 100px;
  resize: vertical;
  padding: 8px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.order-header-notes button {
  justify-self: end;
  min-width: 110px;
}

@media (max-width: 1200px) {
  .top-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .header-right {
    justify-content: flex-start;
  }

  .active-button-group {
    justify-content: flex-start;
    width: auto;
    max-width: none;
  }

  .order-summary-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 800px) {
  .order-summary-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .order-note-entry-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .active-button-group {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .active-button-group button {
    width: auto;
  }
}

@media (max-width: 520px) {
  .order-summary-client {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .order-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Final order header tightening: selected client left, actions right */
.order-pad-context-panel {
  display: grid;
  grid-template-columns: minmax(320px, 50%) minmax(max-content, 1fr);
  gap: 10px 16px;
  align-items: center;
}

.order-summary-client {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  max-width: none;
  padding: 6px 10px;
}

.order-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

.order-actions button {
  min-width: 118px;
  height: 36px;
  padding: 0 14px;
}

.order-summary-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  gap: 6px;
}

@media (max-width: 1000px) {
  .retail-order-entry-row {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .retail-close-field {
    justify-content: flex-start;
  }

  .order-pad-context-panel {
    grid-template-columns: 1fr;
  }

  .order-summary-client,
  .order-actions,
  .order-summary-grid {
    grid-column: 1;
    grid-row: auto;
  }

  .order-actions {
    justify-content: flex-start;
  }
}

@media (orientation: landscape) and (max-width: 1200px) {
  .retail-order-entry-row {
    grid-template-columns:
      minmax(120px, 1fr)
      minmax(150px, 1.25fr)
      minmax(68px, 0.45fr)
      minmax(78px, 0.55fr)
      minmax(90px, 0.65fr)
      minmax(240px, auto)
      minmax(74px, auto);
    align-items: end;
  }

  .retail-order-actions,
  .retail-close-field {
    grid-column: auto;
    justify-content: stretch;
    margin-right: 0;
  }

  .active-button-group.retail-order-actions button,
  .active-button-group.retail-close-field button,
  .active-button-group .retail-add-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 10px;
    font-size: 14px;
    white-space: nowrap;
  }
}

@media (orientation: portrait) and (max-width: 900px),
  (orientation: portrait) and (max-width: 1024px) and (pointer: coarse) {
  body {
    padding: 8px;
  }

  .retail-order-shell {
    gap: 10px;
    padding: 10px;
  }

  .retail-order-entry-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
  }

  .retail-order-entry-row .field-group:has(#comboCategories),
  .retail-order-entry-row .field-group:has(#comboProduct) {
    grid-column: span 2;
  }

  .retail-order-entry-row .field-group:has(#comboQuantity),
  .retail-order-entry-row .field-group:has(#txtPrice),
  .retail-order-entry-row .field-group:has(#lblSubTotal) {
    grid-column: span 1;
  }

  .retail-order-actions {
    grid-column: span 3;
    justify-content: stretch;
    margin-right: 0;
  }

  .retail-close-field {
    grid-column: span 1;
    justify-content: stretch;
    margin-right: 0;
  }

  .active-button-group.retail-order-actions button,
  .active-button-group.retail-close-field button,
  .active-button-group .retail-add-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .retail-shortcut-card {
    order: 2;
  }

  .retail-order-table-card {
    order: 1;
  }

  .retail-shortcut-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .retail-shortcut-button {
    width: 100%;
    min-height: 60px;
  }
}

@media (orientation: portrait) and (max-width: 520px) {
  .retail-order-entry-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .retail-order-entry-row .field-group:has(#comboCategories),
  .retail-order-entry-row .field-group:has(#comboProduct),
  .retail-order-actions,
  .retail-close-field {
    grid-column: 1 / -1;
  }

  .retail-order-entry-row .field-group:has(#comboQuantity),
  .retail-order-entry-row .field-group:has(#txtPrice),
  .retail-order-entry-row .field-group:has(#lblSubTotal) {
    grid-column: span 1;
  }

  .order-table {
    min-width: 620px;
  }

  .retail-shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Order header compact spacing */
.order-summary-client {
  padding: 6px 10px;
}

.order-summary-grid {
  gap: 6px;
}

.order-summary-card {
  padding: 6px 10px;
  gap: 2px;
}

.order-summary-label {
  line-height: 1.1;
}

.order-summary-value {
  line-height: 1.15;
  padding-right: 16px;
}

.order-header-notes {
  align-self: start;
  margin-top: -6px;
  padding: 8px;
  gap: 6px;
}

.order-notes-window {
  height: 110px;
  min-height: 110px;
  max-height: 110px;
  padding: 8px;
}

.order-note-item {
  padding: 5px 0;
}

.order-note-item-header {
  margin-bottom: 2px;
  line-height: 1.15;
}

.order-note-item-text {
  line-height: 1.25;
}

.order-note-entry-panel {
  gap: 6px;
}

.order-note-text {
  min-height: 48px;
  max-height: 70px;
  padding: 6px 8px;
}

.order-header-notes button {
  min-height: 34px;
  padding: 6px 12px;
}

/* Compact invoice actions and location display */
.order-pad-context-panel {
  grid-template-columns: minmax(260px, 1fr) minmax(120px, 220px) minmax(max-content, 1fr);
}

.order-summary-client {
  grid-column: 1;
  grid-row: 1;
}

.order-summary-location {
  grid-column: 2;
  grid-row: 1;
}

.order-actions {
  grid-column: 3;
  grid-row: 1;
  gap: 6px;
}

.order-actions button {
  min-width: 92px;
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
  line-height: 1;
}

#produceInvoiceButton,
#downloadInvoiceButton {
  min-width: 104px;
}

.order-summary-location .order-summary-value {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .order-pad-context-panel {
    grid-template-columns: 1fr;
  }

  .order-summary-client,
  .order-summary-location,
  .order-actions {
    grid-column: 1;
    grid-row: auto;
  }
}
