:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --line: #dbe3ef;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #1d4ed8;
  --blue2: #2563eb;
  --danger: #c5202f;
  --danger-bg: #fff3f4;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background:
    radial-gradient(1100px 360px at top left, #eff4ff 0%, rgba(239, 244, 255, 0) 55%),
    radial-gradient(900px 320px at top right, #eefaf7 0%, rgba(238, 250, 247, 0) 55%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 32%, #eef3fb 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
.cartWrap { max-width: 1460px; margin: 0 auto; padding: 22px; }
.topHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(194, 206, 228, 0.8);
  border-radius: 22px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 16px 38px rgba(31, 60, 112, 0.06);
  margin-bottom: 14px;
}
.logoLink { display: inline-flex; align-items: center; text-decoration: none; }
.logo { display:block; height: 44px; width: auto; object-fit: contain; }
.headBtns { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.cartTopHeader .btn { min-height: 44px; }
.cartHero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(194, 206, 228, 0.8);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(240,246,255,0.94));
  box-shadow: 0 24px 60px rgba(31, 60, 112, 0.08);
  margin-bottom: 16px;
}
.cartHeroMain { max-width: 820px; }
.cartHero h1 { margin: 0; font-size: 38px; line-height: 1.02; }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 16px; max-width: 720px; }
.headActions { display: flex; gap: 10px; flex-wrap: wrap; }
.heroActions { align-self: center; }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(37, 99, 235, 0.10); }
.btn.primary {
  border-color: #1847bf;
  color: #fff;
  background: linear-gradient(180deg, var(--blue2), var(--blue));
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.18);
}
.btn.ghost { background: rgba(255,255,255,0.84); }
.btn.danger { border-color: #f2c2c7; color: var(--danger); background: var(--danger-bg); }
.actionBack, .softGhost { border-color: #cfdbef; background: rgba(255,255,255,0.84); }
.actionCheckout, .bigPrimary { min-height: 48px; padding-inline: 20px; }
.subtleDanger { background: rgba(255,243,244,0.85); }
.cartLayout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 380px;
  gap: 18px;
  align-items: start;
}
.cartMainCol { display: grid; gap: 12px; }
.cartSectionHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 0 6px;
}
.sectionTitle { font-size: 22px; font-weight: 900; }
.sectionMeta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.cartRail { display: grid; gap: 14px; }
.cartList { display: grid; gap: 12px; }
.lineCard {
  border: 1px solid rgba(208, 219, 238, 0.94);
  border-radius: 18px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 16px 34px rgba(31, 60, 112, 0.06);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.lineTop { display: flex; justify-content: space-between; gap: 12px; }
.lineMain { display: flex; gap: 12px; min-width: 0; }
.linePreview {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  align-items: flex-start;
}
.linePreview:hover .title { color: var(--blue); }
.previewHint { margin-top: 6px; color: var(--blue); font-size: 12px; font-weight: 700; }
.lineThumb {
  width: 82px;
  height: 82px;
  border: 1px solid #d7e1f0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  flex: 0 0 auto;
}
.lineThumb img { width: 100%; height: 100%; object-fit: contain; }
.lineInfo { min-width: 0; }
.title { font-size: 19px; font-weight: 900; line-height: 1.15; }
.unitPrice { font-weight: 900; font-size: 18px; white-space: nowrap; color: #0b2349; }
.breakdown { color: var(--muted); font-size: 12px; margin-top: 4px; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  border: 1px solid #d9e4f4;
  border-radius: 999px;
  padding: 5px 9px;
  color: #334155;
  background: #f8fbff;
}
.lineBottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.qtyControl {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d4deee;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.qtyControl button {
  border: 0;
  background: #f8fbff;
  min-width: 36px;
  height: 38px;
  font-weight: 800;
  cursor: pointer;
}
.qtyControl input {
  width: 76px;
  height: 38px;
  border: 0;
  border-left: 1px solid #d4deee;
  border-right: 1px solid #d4deee;
  text-align: center;
  font-weight: 800;
}
.lineActions { display: flex; align-items: center; gap: 8px; }
.lineTotal { font-size: 22px; font-weight: 900; white-space: nowrap; }
.summaryCard {
  position: sticky;
  top: 16px;
  border: 1px solid rgba(205, 217, 237, 0.92);
  border-radius: 20px;
  background: rgba(255,255,255,0.94);
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 16px 38px rgba(31, 60, 112, 0.08);
}
.recommendCard { position: static; }
.summaryTop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.summaryCard h2 { margin: 0; font-size: 22px; }
.summaryBadge {
  border-radius: 999px;
  padding: 7px 11px;
  background: #edf4ff;
  color: #335a92;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #d9e6fa;
}
.sumRow { display: flex; justify-content: space-between; font-size: 15px; color: #334155; }
.sumRow.total {
  font-size: 23px;
  font-weight: 900;
  color: var(--text);
  padding-top: 10px;
  border-top: 1px solid #dde6f3;
}
.note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.summaryActions { display: grid; gap: 10px; }
.empty {
  border: 1px dashed #c9d3e3;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  padding: 32px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
}
.miniTextBtn {
  border: 0;
  background: transparent;
  color: #335a92;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}
.recList { display: grid; gap: 10px; }
.recCard {
  border: 1px solid #d8e2f1;
  background: #fff;
  border-radius: 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.recCard:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(37, 99, 235, 0.10); border-color: #bdd1ef; }
.recThumb {
  width: 72px; height: 72px; border-radius: 12px; border: 1px solid #e0e8f4; background: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.recThumb img { width: 100%; height: 100%; object-fit: contain; }
.recBody { min-width: 0; display: grid; gap: 6px; }
.recName { font-weight: 900; font-size: 14px; line-height: 1.2; color: #102444; }
.recMeta { font-size: 12px; color: #6b7d99; }
.recBottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.recPrice { font-size: 14px; font-weight: 900; color: #12366d; }
.recCta { font-size: 12px; font-weight: 800; color: #2563eb; }
.productModal { position: fixed; inset: 0; display: none; z-index: 1000; }
.productModal.open { display: block; }
.productModalBackdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.52); backdrop-filter: blur(4px); }
.productModalDialog { position: relative; z-index: 1; width: min(1120px, calc(100vw - 24px)); margin: 4vh auto; background: transparent; border: 0; border-radius: 0; overflow: visible; box-shadow: none; display: grid; grid-template-rows: auto 1fr; }
.productModalHead { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 0 0 10px; border-bottom: 0; background: transparent; }
.productModalTitle { display: none; }
.productModalBody { width: 100%; overflow: auto; padding: 0; background: transparent; }
.cartPreviewShot { border: 1px solid #cfd8ea; border-radius: 18px; background: #f3f4f6; padding: 12px; display: grid; gap: 12px; }
.cartPreviewImageCard { border: 1px solid #cfd8ea; border-radius: 14px; background: #fff; min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cartPreviewImage { width: 100%; height: 220px; object-fit: contain; }
.cartPreviewNoImage { display:flex; align-items:center; justify-content:center; height:220px; color:#64748b; font-weight:700; }
.cartPreviewName { font-size: 24px; font-weight: 900; color: #0b2349; line-height: 1.1; }
.cartPreviewMeta { font-size: 14px; color: #56719c; }
.cartPreviewDesc { margin: 8px 0 0; font-size: 16px; color: #5c6f8e; line-height: 1.45; }
.cartPreviewChips { margin-top: -2px; }
#productModalClose.btn { min-width: 42px; width: 42px; height: 42px; padding: 0; font-size: 20px; border-radius: 999px; background: #fff; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); border-color: #d9e2f0; }

@media (max-width: 1100px) {
  .cartLayout { grid-template-columns: 1fr; }
  .summaryCard { position: static; }
}
@media (max-width: 980px) {
  .cartWrap { padding: 12px; }
  .topHeader { flex-direction: column; align-items: stretch; padding: 14px; }
  .logoLink { justify-content: center; }
  .headBtns { width: 100%; display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .cartHero { flex-direction: column; padding: 18px; }
  .cartHero h1 { font-size: 32px; }
  .heroActions, .headActions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .cartSectionHead { flex-direction: column; align-items: stretch; padding: 0; }
  .lineTop { flex-direction: column; }
  .lineMain { width: 100%; }
  .breakdown { text-align: left; }
  .lineBottom { flex-wrap: wrap; }
  .productModalDialog { width: calc(100vw - 12px); margin: 2vh auto; }
  .productModalBody { padding: 8px; }
  .cartPreviewName { font-size: 22px; }
}
@media (max-width: 640px) {
  .heroActions, .headActions { grid-template-columns: 1fr; }
  .headBtns { grid-template-columns: 1fr; }
  .recCard { grid-template-columns: 60px minmax(0, 1fr); }
  .recThumb { width: 60px; height: 60px; }
}
