:root {
  --ink: #17202a;
  --muted: #637083;
  --line: #d9e0e8;
  --surface: #ffffff;
  --page: #f4f7f9;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning-bg: #fff2d6;
  --warning-ink: #8a4b00;
  --shadow: 0 10px 24px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 16px rgba(20, 33, 45, 0.06);
  backdrop-filter: blur(12px);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.brand .lastUpdated {
  margin-top: 4px;
  font-size: 12px;
}

.cartSummary {
  display: grid;
  width: min(680px, 58vw);
  min-width: 420px;
  gap: 8px;
  padding: 10px;
  background: #edf7f5;
  border: 1px solid #c5e4df;
  border-radius: 8px;
}

.cartSummaryTop {
  display: grid;
  grid-template-columns: minmax(118px, auto) minmax(56px, auto) auto;
  align-items: center;
  gap: 12px;
}

.summaryLabel {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.cartSummary strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
}

.headerCartProducts {
  max-height: 70px;
  overflow: auto;
  padding-top: 8px;
  border-top: 1px solid #c5e4df;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.headerCartProduct {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
}

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

.headerCartProductQty {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.headerCartRemove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
}

.headerCartRemove:hover {
  background: #ffffff;
  border-color: #efb7b2;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primaryBtn {
  min-height: 42px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-weight: 700;
}

.primaryBtn:hover:not(:disabled) {
  background: var(--accent-dark);
}

.secondaryBtn {
  min-height: 34px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: #ffffff;
  border: 1px solid #b9d8d4;
  border-radius: 6px;
  font-weight: 700;
}

.secondaryBtn:hover:not(:disabled) {
  border-color: var(--accent);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 22px auto 36px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) minmax(180px, 260px);
  gap: 12px;
  margin-bottom: 14px;
}

.filterField {
  display: grid;
  gap: 7px;
}

.filterField label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filterField input,
.filterField select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  outline: none;
}

.filterField select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 12px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.filterField input:focus,
.filterField select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14), var(--shadow);
}

.cartPanel {
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cartPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
}

.cartPanelHeader h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.cartDetails {
  display: grid;
}

.cartEmpty {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 13px;
}

.cartItem {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 78px 110px 116px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.cartItem:last-child {
  border-bottom: 0;
}

.cartItemName {
  min-width: 0;
}

.cartItemName strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
}

.cartItemMeta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.cartItemQty,
.cartItemPrice,
.cartItemTotal {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.tableWrap {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tableHeader,
.productRow {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 92px 128px 140px 142px;
  gap: 14px;
  align-items: center;
}

.tableHeader {
  padding: 12px 16px;
  color: var(--muted);
  background: #eef3f6;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.productRow {
  min-height: 78px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.productRow:last-child {
  border-bottom: 0;
}

.productRow.expired {
  background: #fffaf0;
}

.productName {
  min-width: 0;
}

.productName strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  background: #eef3f6;
  border: 1px solid #dce5ec;
  border-radius: 999px;
  color: var(--muted);
}

.badge.expiredBadge {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border-color: #ffd88c;
}

.stock,
.price {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.special {
  color: var(--accent-dark);
}

.qtyControl {
  display: grid;
  grid-template-columns: 38px 46px 38px;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.qtyControl button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
}

.qtyControl button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.qtyValue {
  display: grid;
  place-items: center;
  height: 38px;
  background: #f7fafc;
  border: 1px solid #dce5ec;
  border-radius: 6px;
  font-weight: 700;
}

.empty {
  padding: 44px 16px;
  color: var(--muted);
  text-align: center;
}

.noScriptNotice {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 20;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--danger);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    padding: 12px;
  }

  .cartSummary {
    width: 100%;
    min-width: 0;
  }

  .cartSummaryTop {
    grid-template-columns: 1fr 64px auto;
  }

  .shell {
    width: min(100% - 20px, 1240px);
    margin-top: 14px;
  }

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

  .cartItem {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cartItemQty,
  .cartItemPrice,
  .cartItemTotal {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .cartItemQty::before {
    content: "Qty";
    color: var(--muted);
    font-weight: 400;
  }

  .cartItemPrice::before {
    content: "Special price";
    color: var(--muted);
    font-weight: 400;
  }

  .cartItemTotal::before {
    content: "Line total";
    color: var(--muted);
    font-weight: 400;
  }

  .tableHeader {
    display: none;
  }

  .productRow {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 14px;
  }

  .stock,
  .price {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .stock::before {
    content: "Stock";
    color: var(--muted);
    font-weight: 400;
  }

  .retail::before {
    content: "Retail price";
    color: var(--muted);
    font-weight: 400;
  }

  .special::before {
    content: "Special price";
    color: var(--muted);
    font-weight: 400;
  }

  .qtyControl {
    grid-template-columns: 44px 1fr 44px;
    justify-content: stretch;
  }

  .qtyControl button,
  .qtyValue {
    width: 100%;
    height: 42px;
  }
}

@media (max-width: 480px) {
  .brand h1 {
    font-size: 19px;
  }

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

  .cartSummaryTop {
    grid-template-columns: 1fr 54px;
  }

  .primaryBtn {
    grid-column: 1 / -1;
  }
}
