:root {
  color-scheme: light;
  --bg: #e9ecef;
  --panel: #f7f8f9;
  --line: #1f2933;
  --muted-line: #a4adb8;
  --field: #ffffff;
  --text: #18212b;
  --muted: #607080;
  --accent: #00cfd4;
  --danger: #e11d48;
  --blue: #2454d6;
  --navy: #17365d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 16px;
}

.loginPanel {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 72px 16px 16px;
}

.loginBox {
  width: min(360px, 100%);
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.loginBox h1 {
  margin: 0 0 18px;
  font-size: 20px;
}

.loginStatus {
  margin: 0 0 14px;
  color: var(--muted);
}

.cognitoButton {
  display: block;
  min-height: 32px;
  border: 1px solid #1d4ed8;
  background: #2454d6;
  color: #ffffff;
  line-height: 32px;
  margin-bottom: 14px;
  text-align: center;
  text-decoration: none;
}

.cognitoButton:hover {
  background: #1d4ed8;
}

.loginBox p {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1380px;
  margin: 0 auto 12px;
  gap: 16px;
}

.topbarBrand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}

.topbar p {
  color: var(--muted);
  margin-top: 2px;
}

.topMenuButton {
  display: none;
  place-items: center;
  gap: 3px;
  width: 34px;
  min-height: 31px;
  padding: 6px;
}

.topMenuButton span {
  display: block;
  width: 17px;
  height: 2px;
  background: var(--line);
}

.status {
  min-width: 112px;
  padding: 7px 10px;
  border: 1px solid var(--muted-line);
  background: var(--field);
  text-align: center;
}

.topbarControls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.tenantPicker {
  display: grid;
  gap: 3px;
}

.tenantPicker span {
  color: var(--muted);
  font-size: 12px;
}

.tenantPicker select {
  min-width: 180px;
  height: 31px;
  border: 1px solid var(--muted-line);
  background: var(--field);
  color: var(--text);
  padding: 3px 7px;
}

.userStatus {
  display: grid;
  gap: 3px;
  min-width: 124px;
}

.userStatus span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appBody {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  max-width: 1380px;
  margin: 0 auto;
  align-items: start;
}

.appNav {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 96px);
  border: 2px solid var(--line);
  background: #eeeeee;
  padding: 8px;
}

.navBackdrop {
  display: none;
}

.navMain {
  display: grid;
  gap: 6px;
}

.navItem {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  padding: 4px 7px;
  text-align: left;
}

.navItem.selected {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.navIcon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--muted-line);
  background: #ffffff;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.navText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navFooter {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--muted-line);
}

.navFooter span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewPanel {
  min-width: 0;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  border: 2px solid #6a9cff;
  background: #d7d7d7;
}

.searchPane {
  border-right: 1px solid var(--line);
  padding: 14px;
  background: var(--panel);
}

.searchForm label {
  display: block;
  color: var(--danger);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.searchFilters {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--muted-line);
}

.searchFilters label {
  margin: 0;
  color: var(--text);
  font-weight: 400;
  text-transform: none;
}

.searchFilters label > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.filterGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.filterCheck {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.filterCheck input {
  width: 15px;
  height: 15px;
}

.filterCheck span {
  margin: 0 !important;
}

.searchRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
}

input,
.ordersSearch select {
  width: 100%;
  height: 28px;
  border: 1px solid var(--muted-line);
  background: var(--field);
  padding: 3px 7px;
}

input[readonly] {
  color: var(--blue);
}

button {
  min-height: 28px;
  border: 1px solid #7d8791;
  background: linear-gradient(#ffffff, #e9edf2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: #425466;
}

.results {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.resultRow {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px;
  text-align: left;
}

.resultRow.selected {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.resultRow span {
  font-weight: 700;
}

.resultRow small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resultNav {
  display: grid;
  grid-template-columns: 32px 32px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.resultNav span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.detailPane {
  padding: 14px;
  min-width: 0;
}

.detailGrid {
  display: grid;
  grid-template-columns: minmax(480px, 632px) 240px;
  gap: 24px;
  align-items: start;
}

.fields {
  border: 2px solid var(--line);
  background: #eeeeee;
}

.inventoryHeader {
  min-height: 162px;
}

.fields label {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.fields label > span:first-child {
  text-align: right;
}

.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.twoCol label {
  grid-template-columns: 86px minmax(0, 1fr);
}

.checkLine {
  display: flex;
  gap: 6px;
}

.checkLine input {
  width: 16px;
  height: 16px;
}

.detailPricingGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  border-top: 2px solid var(--line);
}

.identityFields {
  padding: 4px 0;
}

.pricingFields {
  align-content: start;
  display: grid;
  padding: 4px 8px 4px 0;
  border-left: 2px solid var(--line);
}

.pricingFields label {
  grid-template-columns: 56px 76px;
  padding: 3px 0 3px 8px;
}

.pricingFields input {
  justify-self: end;
  text-align: right;
  width: 76px;
}

.pictureBox {
  margin: 0;
  display: grid;
  gap: 6px;
}

#pictureFallback {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 188px;
  border: 1px solid var(--muted-line);
  background: #ffffff;
  color: #30437c;
}

#pictureFallback strong {
  display: block;
  color: #1f2933;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 400;
}

#pictureFallback span {
  margin-top: 18px;
  font-size: 26px;
  text-align: center;
}

#stockImage {
  width: 240px;
  height: 188px;
  object-fit: contain;
  border: 1px solid var(--muted-line);
  background: #ffffff;
}

[hidden] {
  display: none !important;
}

figcaption {
  color: var(--muted);
  text-align: center;
}

.sizePanel {
  --size-table-width: 356px;
  margin-top: 16px;
  width: var(--size-table-width);
  max-width: 100%;
}

.inventoryControls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 8px;
  width: 100%;
}

.inventoryControls label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inventoryControls label span {
  color: var(--muted);
  font-size: 12px;
}

.inventoryControls select {
  height: 28px;
  width: 100%;
  border: 1px solid var(--muted-line);
  background: var(--field);
}

.sizeRange {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.sizeRange strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.sizeTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--field);
  table-layout: fixed;
}

.sizeTable th:nth-child(1),
.sizeTable td:nth-child(1) {
  width: 72px;
}

.sizeTable th:nth-child(2),
.sizeTable td:nth-child(2) {
  width: 104px;
}

.sizeTable th:nth-child(3),
.sizeTable td:nth-child(3) {
  width: 104px;
}

.sizeTable th:nth-child(4),
.sizeTable td:nth-child(4) {
  width: 76px;
}

.sizeTable th,
.sizeTable td {
  border: 1px solid var(--line);
  height: 27px;
  padding: 3px 8px;
}

.sizeTable th {
  background: #eeeeee;
  color: var(--navy);
  font-weight: 700;
  text-align: left;
}

.sizeTable td:nth-child(1),
.sizeTable td:nth-child(3),
.sizeTable td:nth-child(4),
.sizeTable th:nth-child(1),
.sizeTable th:nth-child(3),
.sizeTable th:nth-child(4) {
  text-align: right;
}

.sizeTable td:nth-child(4),
.sizeTable th:nth-child(4) {
  text-align: center;
}

.sizeTable tfoot td {
  background: #eeeeee;
  font-weight: 700;
}

.sizeTable tfoot td:nth-child(2) {
  text-align: right;
}

.sizeTable tbody tr:not(.notOffered) td:nth-child(2) {
  color: var(--danger);
}

.notOffered {
  background: #d7d7d7;
  color: #8a8f96;
}

.ordersWindow {
  min-height: 720px;
  border: 2px solid #6a9cff;
  background: #d7d7d7;
  padding: 14px;
}

.ordersSearch {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) 110px minmax(180px, 1.4fr) 110px 70px;
  gap: 8px;
  align-items: end;
  max-width: 920px;
}

.invoicesSearch {
  grid-template-columns:
    minmax(180px, 1.4fr)
    110px
    minmax(180px, 1.2fr)
    94px
    72px
    132px
    132px
    70px;
  max-width: 1180px;
}

.ordersSearch label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inlineCheck {
  align-self: center;
  padding-top: 14px;
}

.ordersSearch span,
.ordersStatusLine {
  color: var(--muted);
  font-size: 12px;
}

.ordersStatusLine {
  margin: 10px 0 8px;
  min-height: 18px;
}

.ordersTableWrap {
  overflow: auto;
  border: 2px solid var(--line);
  background: #ffffff;
}

.ordersTable,
.orderLinesTable {
  border-collapse: collapse;
  table-layout: fixed;
}

.ordersTable {
  width: max-content;
  min-width: 820px;
}

.invoicesTable {
  min-width: 1160px;
}

.orderLinesTable {
  width: 100%;
}

.ordersTable th,
.ordersTable td,
.orderLinesTable th,
.orderLinesTable td {
  border: 1px solid var(--line);
  height: 27px;
  padding: 3px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ordersTable > thead th {
  background: #eeeeee;
  color: var(--navy);
  font-weight: 700;
  text-align: left;
}

.orderLinesTable th {
  background: #eeeeee;
  color: var(--danger);
  font-weight: 400;
  text-align: left;
}

.ordersTable th:nth-child(1),
.ordersTable td:nth-child(1) {
  width: 36px;
  text-align: center;
}

.ordersTable th:nth-child(2),
.ordersTable td:nth-child(2) {
  width: 86px;
}

.ordersTable th:nth-child(3),
.ordersTable td:nth-child(3),
.ordersTable th:nth-child(12),
.ordersTable td:nth-child(12) {
  width: 56px;
}

.ordersTable th:nth-child(4),
.ordersTable td:nth-child(4) {
  width: 84px;
}

.ordersTable th:nth-child(5),
.ordersTable td:nth-child(5) {
  width: 170px;
}

.ordersTable th:nth-child(6),
.ordersTable td:nth-child(6) {
  width: 120px;
}

.ordersTable th:nth-child(7),
.ordersTable td:nth-child(7),
.ordersTable th:nth-child(8),
.ordersTable td:nth-child(8) {
  width: 96px;
}

.ordersTable th:nth-child(9),
.ordersTable td:nth-child(9),
.ordersTable th:nth-child(10),
.ordersTable td:nth-child(10),
.ordersTable th:nth-child(11),
.ordersTable td:nth-child(11) {
  width: 82px;
  text-align: right;
}

.ordersTable.customerColumnsHidden > thead th:nth-child(4),
.ordersTable.customerColumnsHidden > thead th:nth-child(5),
.ordersTable.customerColumnsHidden > tbody > .orderSummaryRow > td:nth-child(4),
.ordersTable.customerColumnsHidden > tbody > .orderSummaryRow > td:nth-child(5),
.ordersTable.customerColumnsHidden > tfoot td:nth-child(4),
.ordersTable.customerColumnsHidden > tfoot td:nth-child(5) {
  display: none;
}

.invoicesTable th:nth-child(2),
.invoicesTable td:nth-child(2) {
  width: 88px;
}

.invoicesTable th:nth-child(3),
.invoicesTable td:nth-child(3),
.invoicesTable th:nth-child(4),
.invoicesTable td:nth-child(4),
.invoicesTable th:nth-child(5),
.invoicesTable td:nth-child(5) {
  width: 52px;
  text-align: center;
}

.invoicesTable th:nth-child(11),
.invoicesTable td:nth-child(11),
.invoicesTable th:nth-child(14),
.invoicesTable td:nth-child(14),
.invoicesTable th:nth-child(15),
.invoicesTable td:nth-child(15),
.invoicesTable th:nth-child(16),
.invoicesTable td:nth-child(16) {
  width: 62px;
}

.invoicesTable th:nth-child(6),
.invoicesTable td:nth-child(6),
.invoicesTable th:nth-child(10),
.invoicesTable td:nth-child(10) {
  width: 96px;
}

.invoicesTable th:nth-child(7),
.invoicesTable td:nth-child(7) {
  width: 82px;
}

.invoicesTable th:nth-child(8),
.invoicesTable td:nth-child(8),
.invoicesTable th:nth-child(9),
.invoicesTable td:nth-child(9),
.invoicesTable th:nth-child(12),
.invoicesTable td:nth-child(12) {
  width: 86px;
  text-align: right;
}

.invoicesTable th:nth-child(13),
.invoicesTable td:nth-child(13) {
  width: 110px;
}

.ordersTable tfoot td {
  background: #eeeeee;
  font-weight: 700;
}

.ordersTable tfoot td:nth-child(4),
.ordersTable tfoot td:nth-child(5),
.ordersTable tfoot td:nth-child(6),
.ordersTable tfoot td:nth-child(8) {
  text-align: right;
}

.invoicesTable tfoot td:nth-child(4),
.invoicesTable tfoot td:nth-child(5) {
  text-align: right;
}

.orderSummaryRow {
  cursor: pointer;
}

.orderSummaryRow.oddOrder td {
  background: #ffffff;
}

.orderSummaryRow.evenOrder td {
  background: #f5f5f5;
}

.orderSummaryRow:hover td {
  background: #f6fbff;
}

.expandButton {
  width: 22px;
  min-height: 22px;
  line-height: 18px;
  padding: 0;
}

.orderDetailRow td {
  padding: 8px;
  background: #f7f8f9;
  white-space: normal;
}

.orderDetailBox {
  min-height: 34px;
  color: var(--muted);
}

.orderLinesTable th:nth-child(1),
.orderLinesTable td:nth-child(1) {
  width: 120px;
  text-align: left;
}

.orderLinesTable th:nth-child(2),
.orderLinesTable td:nth-child(2) {
  text-align: left;
}

.orderLinesTable th:nth-child(3),
.orderLinesTable td:nth-child(3),
.orderLinesTable th:nth-child(4),
.orderLinesTable td:nth-child(4) {
  width: 60px;
}

.orderLinesTable th:nth-child(5),
.orderLinesTable td:nth-child(5),
.orderLinesTable th:nth-child(6),
.orderLinesTable td:nth-child(6),
.orderLinesTable th:nth-child(7),
.orderLinesTable td:nth-child(7),
.orderLinesTable th:nth-child(8),
.orderLinesTable td:nth-child(8),
.orderLinesTable th:nth-child(9),
.orderLinesTable td:nth-child(9) {
  width: 74px;
  text-align: right;
}

.orderLinesTable th:nth-child(10),
.orderLinesTable td:nth-child(10) {
  width: 82px;
}

.invoiceLinesTable th:nth-child(1),
.invoiceLinesTable td:nth-child(1) {
  width: 104px;
}

.invoiceLinesTable th:nth-child(2),
.invoiceLinesTable td:nth-child(2) {
  width: 260px;
}

.invoiceLinesTable th:nth-child(3),
.invoiceLinesTable td:nth-child(3) {
  width: 58px;
}

.invoiceLinesTable th:nth-child(4),
.invoiceLinesTable td:nth-child(4),
.invoiceLinesTable th:nth-child(5),
.invoiceLinesTable td:nth-child(5),
.invoiceLinesTable th:nth-child(7),
.invoiceLinesTable td:nth-child(7) {
  width: 66px;
  text-align: right;
}

.invoiceLinesTable th:nth-child(6),
.invoiceLinesTable td:nth-child(6) {
  width: 74px;
  text-align: right;
}

.invoiceLinesTable th:nth-child(8),
.invoiceLinesTable td:nth-child(8) {
  width: 78px;
  text-align: right;
}

.invoiceLinesTable th:nth-child(9),
.invoiceLinesTable td:nth-child(9) {
  width: 44px;
  text-align: center;
}

@media (max-width: 820px) {
  .shell {
    padding: 10px;
  }

  .topbar {
    align-items: start;
  }

  .topMenuButton {
    display: grid;
  }

  .topbarControls {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: end;
  }

  .tenantPicker select {
    min-width: 170px;
  }

  .appBody {
    grid-template-columns: 1fr;
  }

  .appNav {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    width: min(288px, 82vw);
    min-height: 100vh;
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: 0 10px 24px rgb(0 0 0 / 24%);
  }

  .navOpen .appNav {
    transform: translateX(0);
  }

  .navBackdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    background: rgb(0 0 0 / 45%);
  }

  .workspace,
  .detailGrid {
    grid-template-columns: 1fr;
  }

  .searchPane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .fields label,
  .twoCol label {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .fields label > span:first-child {
    text-align: left;
  }

  .twoCol {
    grid-template-columns: 1fr;
  }

  .detailPricingGrid,
  .filterGrid {
    grid-template-columns: 1fr;
  }

  .pricingFields {
    border-left: 0;
    border-top: 2px solid var(--line);
    padding: 4px 8px;
  }

  #stockImage,
  .pictureBox {
    width: 100%;
  }

  .ordersSearch {
    grid-template-columns: 1fr 1fr;
  }

  .ordersSearch button {
    grid-column: 1 / -1;
  }
}
