:root {
  color-scheme: light;
  --amazon-dark:   #131921;
  --amazon-mid:    #232f3e;
  --amazon-nav2:   #37475a;
  --amazon-hover:  #c7511f;
  --orange:        #febd69;
  --orange-btn:    #f0a30a;
  --orange-dark:   #d9941a;
  --orange-hover:  #e08c09;
  --yellow-btn:    #ffd814;
  --yellow-dark:   #f7ca00;
  --teal:          #007185;
  --ink:           #0f1111;
  --muted:         #565959;
  --line:          #dddddd;
  --soft:          #f3f3f3;
  --paper:         #ffffff;
  --danger:        #c40000;
  --success:       #007600;
  --shadow:        0 2px 5px rgba(15,17,17,0.15);
  --shadow-card:   0 1px 3px rgba(15,17,17,0.13), 0 1px 2px rgba(15,17,17,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  font-family: "Amazon Ember", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  background: var(--soft);
  color: var(--ink);
  line-height: 1.5;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.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;
}

.utility-bar {
  background: var(--amazon-dark);
  color: #ccc;
  font-size: 12px;
}
.utility-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px clamp(12px, 2vw, 20px);
  max-width: 1600px;
  margin: 0 auto;
}
.utility-left { color: #ccc; }
.utility-right { display: flex; gap: 14px; }
.utility-link {
  color: #ccc;
  text-decoration: none;
  white-space: nowrap;
}
.utility-link:hover { color: var(--orange); text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px clamp(12px, 2vw, 20px);
  background: var(--amazon-mid);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  text-decoration: none;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
}
.brand:hover { border-color: var(--paper); }
.brand-k {
  font-size: 22px;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: -1px;
}
.brand-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--paper);
  letter-spacing: -0.5px;
}
.brand-dot {
  font-size: 12px;
  color: var(--orange);
  font-weight: 700;
  margin-left: 1px;
  align-self: flex-end;
  padding-bottom: 2px;
}

.search { display: flex; flex: 1; min-width: 0; }
.search-inner {
  display: flex;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--orange-btn);
}
.search-inner:focus-within { border-color: var(--orange-dark); }

.search-category {
  flex: 0 0 auto;
  height: 40px;
  border: none;
  border-right: 1px solid #bbb;
  border-radius: 0;
  background: #f3f3f3;
  color: #111;
  padding: 0 6px 0 8px;
  font-size: 12px;
  width: 80px;
  cursor: pointer;
}

#search-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: none;
  border-radius: 0;
  padding: 0 10px;
  font-size: 15px;
  background: #fff;
  color: #111;
}
#search-input:focus { outline: none; }

.search-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 40px;
  border: none;
  border-radius: 0 3px 3px 0;
  background: var(--orange-btn);
  color: #111;
  display: grid;
  place-items: center;
  transition: background 120ms;
}
.search-btn:hover { background: var(--orange-dark); }

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  color: #fff;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 3px;
  cursor: default;
}
.account-info:hover { border-color: var(--paper); }
.account-greeting { font-size: 11px; color: #ccc; }
.account-name { font-size: 13px; font-weight: 700; color: #fff; }

.cart-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 4px 8px;
  border: 2px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #fff;
  white-space: nowrap;
  transition: border-color 120ms;
}
.cart-button:hover { border-color: var(--paper); }
.cart-icon { flex-shrink: 0; }
.cart-label { font-size: 13px; font-weight: 700; }
.cart-badge {
  position: absolute;
  top: 4px;
  left: 22px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--orange);
  color: #111;
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  padding: 0 3px;
}

.subnav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 4px clamp(12px, 2vw, 20px);
  background: var(--amazon-nav2);
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }

.tab-button {
  flex: 0 0 auto;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #fff;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}
.tab-button:hover { border-color: #fff; }
.tab-button.active { border-color: var(--orange); color: var(--orange); }

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0,1fr) 340px;
  gap: 14px;
  align-items: start;
  padding: 14px clamp(12px, 2vw, 20px) 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.filters {
  position: sticky;
  top: 66px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px;
  min-width: 0;
}

.filter-block + .filter-block {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.filter-block h2,
.cart-head h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.filter-list {
  display: grid;
  gap: 4px;
}

.filter-option,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--teal);
  font-size: 13px;
  cursor: pointer;
}
.filter-option:hover, .check-row:hover { color: var(--amazon-hover); }

.filter-option input, .check-row input {
  width: 14px; height: 14px;
  min-height: unset;
  accent-color: var(--orange-btn);
}

.filter-option span { color: inherit; }

select, input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 0 8px;
  background: #fff;
  font-size: 13px;
}
select:focus, input:focus {
  outline: none;
  border-color: #e77600;
  box-shadow: 0 0 0 3px rgba(228,121,17,.25);
}

.catalog {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 0 0;
}
.breadcrumb a { color: var(--teal); text-decoration: none; }
.breadcrumb a:hover { color: var(--amazon-hover); text-decoration: underline; }
.breadcrumb-sep { margin: 0 6px; color: var(--muted); }

.catalog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 16px;
}
.catalog-head h1 {
  margin: 0 0 2px;
  font-size: 22px;
  font-weight: 700;
}
.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.catalog-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.catalog-toolbar select { width: auto; min-height: 34px; font-size: 13px; }

.status {
  min-height: 22px;
  font-size: 13px;
  color: var(--muted);
}
.status.error { color: var(--danger); }
.status.success { color: var(--success); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.empty-catalog {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.product-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 160ms, transform 160ms;
  position: relative;
}
.product-card:hover {
  box-shadow: 0 4px 12px rgba(15,17,17,0.18);
  transform: translateY(-2px);
}

.product-card::before {
  content: attr(data-badge);
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 3px;
}
.product-card[data-badge]::before { display: block; }

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: contain;
  padding: 20px;
  background: var(--paper);
  border-bottom: 1px solid #f0f0f0;
  image-rendering: pixelated;
}

.product-body {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.product-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-title button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 500;
  font-size: 14px;
}
.product-title button:hover { color: var(--amazon-hover); text-decoration: underline; }

.seller {
  color: var(--teal);
  font-size: 12px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.stars { color: #ffa41c; font-size: 14px; letter-spacing: -1px; }
.rating-count { color: var(--teal); }

.price-stack {
  display: grid;
  gap: 2px;
}
.price-ref {
  font-size: 12px;
  color: var(--muted);
}
.price-ref s { text-decoration: line-through; }
.price-current {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.price-current small {
  font-size: 12px;
  font-weight: 400;
  vertical-align: super;
}
.price-shipping {
  font-size: 12px;
  color: var(--muted);
}
.free-price { color: var(--danger); font-weight: 700; }

.property-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.property-badges span {
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 2px 5px;
  background: #f9f9f9;
  color: #555;
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.stock-line {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.product-actions {
  padding: 8px 12px 12px;
  display: grid;
  gap: 6px;
}
.qty-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.qty-row input {
  min-height: 32px;
  font-size: 13px;
}

.add-to-cart-btn {
  width: 100%;
  min-height: 36px;
  border: 1px solid #a88734;
  border-radius: 20px;
  background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
  color: #111;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms;
}
.add-to-cart-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f5d78e, #eeb933);
}
.add-to-cart-btn:disabled {
  background: #d5d9d9;
  border-color: #d5d9d9;
  color: #666;
  cursor: not-allowed;
}

.cart-panel {
  position: sticky;
  top: 66px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  min-width: 0;
}

.cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-head h2 { margin: 0; font-size: 18px; }

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.cart-items { display: grid; gap: 10px; }

.empty-cart {
  padding: 18px;
  border: 1px dashed #bbb;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: 60px minmax(0,1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  background: #fff;
}
.cart-item img {
  width: 60px;
  height: 60px;
  box-sizing: border-box;
  object-fit: contain;
  padding: 6px;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid #f0f0f0;
  image-rendering: pixelated;
}
.cart-item h3 { margin: 0 0 3px; font-size: 13px; line-height: 1.35; }

.cart-controls {
  display: grid;
  grid-template-columns: 60px 1fr 32px;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
}
.cart-controls input { min-width: 0; min-height: 32px; font-size: 12px; }
.cart-controls select { min-height: 32px; font-size: 12px; }

.cart-pricing {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  font-size: 12px;
  color: #444;
}

.checkout {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.checkout label {
  display: grid;
  gap: 4px;
  font-weight: 700;
  font-size: 13px;
}
.checkout-breakdown,
.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.checkout-breakdown { color: #444; font-size: 13px; }
.checkout-total {
  font-size: 17px;
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.primary {
  min-height: 38px;
  border: 1px solid #a88734;
  border-radius: 20px;
  background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
  color: #111;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}
.primary:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f5d78e, #eeb933);
}
.primary:disabled {
  background: #d5d9d9;
  border-color: #d5d9d9;
  color: #888;
  cursor: not-allowed;
}

.product-dialog,
.order-dialog {
  width: min(840px, calc(100vw - 24px));
  border: 0;
  border-radius: 4px;
  padding: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.product-dialog::backdrop,
.order-dialog::backdrop {
  background: rgba(15,23,42,0.6);
}
.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.dialog-layout {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0,1fr);
  gap: 20px;
  padding: 20px;
}
.dialog-layout img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 20px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  image-rendering: pixelated;
}
.dialog-layout h2 { margin: 0 40px 8px 0; }
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}
.detail-table th,
.detail-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
  text-align: left;
  vertical-align: top;
}
.detail-table th { color: var(--muted); font-weight: 400; width: 110px; }

.property-section { margin-top: 14px; }
.property-section h3 { margin: 0 0 7px; font-size: 14px; }
.property-list { display: grid; gap: 6px; }
.property-row {
  display: grid;
  grid-template-columns: minmax(80px,0.34fr) minmax(0,1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 8px;
  background: #fafafa;
}
.property-row span { color: var(--muted); font-size: 12px; }
.property-row strong { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }

.order-dialog { padding: 20px; }
.order-list { display: grid; gap: 10px; }
.order-row {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  font-size: 13px;
}
.payment-links { display: grid; gap: 8px; margin-top: 12px; }
.payment-links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--teal);
  border-radius: 4px;
  color: #fff;
  background: var(--teal);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0 4px;
}
.page-button {
  min-width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--teal);
  font-weight: 600;
  font-size: 13px;
}
.page-button:hover:not(:disabled):not(.active) {
  background: #f0f0f0;
  border-color: #bbb;
}
.page-button.active {
  border-color: #e77600;
  background: #fef0e6;
  color: #c45500;
  cursor: default;
}
.page-button:disabled {
  color: #ccc;
  background: #fafafa;
  cursor: not-allowed;
}
.page-gap {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .shell { grid-template-columns: 200px minmax(0,1fr); }
  .cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, calc(100vw - 32px));
    z-index: 100;
    border-radius: 0;
    box-shadow: -4px 0 16px rgba(0,0,0,0.25);
    transform: translateX(110%);
    transition: transform 200ms ease;
    max-height: 100vh;
    overflow: auto;
  }
  .cart-panel.open { transform: translateX(0); }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .account-info { display: none; }
  .search { grid-column: 1 / -1; order: 3; margin-top: 4px; }
  .shell { grid-template-columns: 1fr; padding-top: 10px; }
  .filters { position: static; }
  .catalog-head { flex-direction: column; }
  .dialog-layout { grid-template-columns: 1fr; }
}