#cart-dialog {
  box-sizing: border-box;
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 36px);
  padding: 24px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: #f7f9ff;
  box-shadow: 6px 7px 0 var(--ink);
  overflow-y: auto;
}
#cart-dialog::backdrop { background: #17213a88; backdrop-filter: blur(5px); }
#cart-dialog .dialog-head { margin-bottom: 20px; gap: 12px; }
#cart-dialog .dialog-head h2 { font-size: clamp(20px, 4.8vw, 26px); letter-spacing: -.7px; }
#cart-dialog .close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 1px 2px 0 var(--ink);
}
#cart-items { display: grid; gap: 12px; }
#cart-dialog .cart-row {
  display: grid;
  grid-template-columns: 50px minmax(0,1fr);
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1.5px solid #b9c6df;
  border-radius: 15px;
  background: white;
  box-shadow: 0 3px 0 #e2e8f4;
}
.cart-product-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 8px;
  box-sizing: border-box;
  border: 1.5px solid var(--ink);
  border-radius: 13px;
  background: var(--cart-tint,#e5edff);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 25px;
}
.cart-product-icon img { width: 32px; height: 32px; object-fit: contain; }
.cart-product-info { min-width: 0; }
#cart-dialog .cart-row-top { display: grid; gap: 3px; }
#cart-dialog .cart-row-top strong { font-size: 14px; }
#cart-dialog .cart-row-top > span { font-size: 12px; line-height: 1.5; color: var(--muted); }
#cart-dialog .cart-unit-price { margin: 7px 0 0; font-size: 11px; color: #52648a; }
#cart-dialog .qty { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.cart-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; background: #f3f6ff; }
#cart-dialog .cart-stepper button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 18px;
}
#cart-dialog .cart-stepper button:hover { background: #dce7ff; transform: none; }
#cart-dialog .cart-stepper button:disabled { opacity: .35; }
.cart-stepper > span { min-width: 28px; text-align: center; font-size: 13px; font-weight: 800; }
#cart-dialog .qty .remove { margin: 0; padding: 5px; min-height: 36px; min-width: 36px; border: 0; background: transparent; box-shadow: none; color: #a84848; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.cart-line-total { margin-left: auto; font-size: 13px; white-space: nowrap; }
.cart-stock-warning { display: inline-block; margin-top: 6px; font-size: 11px; color: #a84848; }
#cart-summary { margin-top: 18px; padding: 16px; border: 1.5px solid #b9c6df; border-radius: 14px; background: #eaf0ff; }
#cart-summary[hidden] { display: none; }
.cart-summary-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.cart-summary-top small { font-size: 11px; font-weight: 500; }
.cart-summary-top strong { font-size: 21px; letter-spacing: -.5px; }
#cart-summary p { margin: 7px 0 0; font-size: 11px; color: #52648a; line-height: 1.6; }
#cart-dialog .cart-note { margin: 14px 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
#cart-dialog #checkout-link { display: flex; justify-content: center; align-items: center; min-height: 50px; margin-top: 16px; border-radius: 12px; font-size: 14px; box-shadow: 2px 3px 0 var(--ink); }
#cart-dialog #checkout-link[hidden] { display: none; }
#cart-dialog .order-history-link { display: block; margin: 18px 0 0; padding: 0; min-height: 24px; border: 0; background: transparent; box-shadow: none; text-align: center; font-size: 11px; color: var(--muted); }
#cart-dialog #continue { display: block; width: 100%; min-height: 44px; margin-top: 10px; padding: 9px; border: 0; background: transparent; box-shadow: none; font-size: 12px; }
.cart-empty { padding: 24px 12px; text-align: center; }
.cart-empty > span { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border: 2px solid var(--ink); border-radius: 18px; background: #ffe996; box-shadow: 3px 4px var(--ink); font-size: 30px; }
.cart-empty h3 { font-size: 18px; margin-bottom: 7px; }
.cart-empty p { font-size: 12px; color: var(--muted); }
@media(max-width:540px) {
  #cart-dialog { padding: 18px 16px; border-radius: 18px; }
  #cart-dialog .cart-row { padding: 12px; grid-template-columns: 40px minmax(0,1fr); gap: 10px; }
  .cart-product-icon { width: 40px; height: 40px; padding: 6px; border-radius: 10px; }
  .cart-product-icon img { width: 26px; height: 26px; }
  #cart-dialog .cart-stepper button { min-width: 44px; width: 44px; min-height: 44px; height: 44px; }
  #cart-dialog .qty .remove { min-width: 44px; min-height: 44px; }
  .cart-line-total { flex-basis: 100%; margin: 0; }
}
@media(prefers-reduced-motion:no-preference) {
  .cart-product-icon { transition: rotate .2s, translate .2s; }
  .cart-row:hover .cart-product-icon { rotate: -6deg; translate: 0 -2px; }
}
