@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --c-bg: #f4f2fb;
  --c-bg-soft: #ebe6ff;
  --c-surface: #ffffff;
  --c-ink: #2a2540;
  --c-muted: #7a7394;
  --c-line: #e6e0f5;
  --c-primary: #8b7cf6;
  --c-primary-deep: #6d5ce7;
  --c-primary-soft: #f0ecff;
  --c-mint: #3ecf8e;
  --c-mint-deep: #2bb673;
  --c-rose: #ff6b8a;
  --c-amber: #f5a524;
  --c-sky: #5bb8ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 28px rgba(110, 90, 180, 0.08);
  --shadow-soft: 0 4px 16px rgba(110, 90, 180, 0.06);
  --font: 'Nunito', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--c-ink);
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(155, 130, 255, 0.22), transparent 55%),
    radial-gradient(700px 380px at 92% 0%, rgba(255, 170, 200, 0.18), transparent 50%),
    radial-gradient(600px 300px at 50% 100%, rgba(120, 210, 255, 0.12), transparent 55%),
    var(--c-bg);
}

a { color: var(--c-primary-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.cart-shell { max-width: 1120px; margin: 0 auto; padding: 20px 18px 100px; }

/* —— top nav —— */
.cart-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px;
  padding: 10px 14px 10px 18px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 22px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--c-ink); text-decoration: none; font-weight: 800;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(145deg, #b9a8ff, #8b7cf6);
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(139, 124, 246, 0.35);
}
.logo-mark svg { width: 22px; height: 22px; }
.logo span { font-size: 1.05rem; letter-spacing: .02em; }
.logo em { font-style: normal; color: var(--c-primary); }

.nav-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav-links a {
  color: var(--c-muted); padding: 8px 14px; border-radius: 999px;
  font-size: .92rem; font-weight: 600; text-decoration: none;
  transition: .18s ease;
}
.nav-links a:hover { color: var(--c-primary-deep); background: var(--c-primary-soft); text-decoration: none; }
.nav-links a.active {
  color: var(--c-primary-deep);
  background: var(--c-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(139,124,246,.25);
}
.cart-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #9b8cff, #7c6af0);
  color: #fff !important; padding: 8px 14px !important;
  box-shadow: 0 8px 18px rgba(124, 106, 240, 0.28);
}
.cart-pill:hover { filter: brightness(1.05); background: linear-gradient(135deg, #9b8cff, #7c6af0) !important; }
.cart-pill b {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: #fff; color: var(--c-primary-deep);
  font-size: .75rem; display: inline-grid; place-items: center;
}

/* —— hero strip —— */
.cart-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding: 4px 6px;
}
.cart-hero h1 {
  margin: 0 0 6px; font-size: clamp(1.55rem, 3vw, 1.95rem); font-weight: 800;
  letter-spacing: .01em;
}
.cart-hero p { margin: 0; color: var(--c-muted); font-size: .95rem; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700;
}
.tag.lilac { background: #ece6ff; color: #6d5ce7; }
.tag.mint { background: #e4faf0; color: #1f9d62; }
.tag.peach { background: #fff0e8; color: #d97706; }

/* —— layout —— */
.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px; align-items: start;
}
@media (max-width: 900px) {
  .cart-layout { grid-template-columns: 1fr; }
  .summary-card { position: static !important; }
}

.panel {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.8);
  overflow: hidden;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 18px;
  border-bottom: 1px solid var(--c-line);
  background: linear-gradient(180deg, #fbfaff, #fff);
}
.panel-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.panel-head .sub { color: var(--c-muted); font-size: .85rem; }

.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  border-radius: 999px; padding: 9px 16px; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
  transition: .18s ease; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: #f3f0fb; color: var(--c-muted);
}
.btn-ghost:hover { background: #ebe5ff; color: var(--c-primary-deep); }
.btn-primary {
  background: linear-gradient(135deg, #a18fff, #7b68ee);
  color: #fff; box-shadow: 0 10px 22px rgba(123, 104, 238, 0.28);
}
.btn-buy {
  background: linear-gradient(135deg, #56e0a0, #2fbf78);
  color: #fff; box-shadow: 0 10px 22px rgba(47, 191, 120, 0.28);
  width: 100%; padding: 14px 18px; font-size: 1.02rem;
}
.btn-buy:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: 10px;
  background: #f5f2fc; color: var(--c-muted);
}
.btn-icon:hover { background: #ffe8ee; color: var(--c-rose); }
.btn-icon.plus:hover, .btn-icon.minus:hover {
  background: var(--c-primary-soft); color: var(--c-primary-deep);
}

/* —— empty —— */
.empty {
  padding: 48px 24px 56px; text-align: center;
}
.empty-art {
  width: min(280px, 70vw); margin: 0 auto 18px;
  filter: drop-shadow(0 12px 24px rgba(139,124,246,.18));
}
.empty h3 { margin: 0 0 8px; font-size: 1.25rem; }
.empty p { margin: 0 0 20px; color: var(--c-muted); line-height: 1.6; }

/* —— items —— */
.cart-list { padding: 8px; display: grid; gap: 8px; }
.cart-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #fcfbff, #fff);
  transition: .2s ease;
}
.cart-item:hover {
  border-color: #e4ddff;
  box-shadow: var(--shadow-soft);
}
.thumb {
  width: 72px; height: 72px; border-radius: 16px;
  display: grid; place-items: center; position: relative;
  background: linear-gradient(145deg, var(--t1, #d9d0ff), var(--t2, #b8a8ff));
  overflow: hidden;
}
.thumb::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.45), transparent 45%);
}
.thumb svg { width: 36px; height: 36px; position: relative; z-index: 1; }
.item-main { min-width: 0; }
.item-title {
  margin: 0 0 6px; font-size: .98rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.chip {
  font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: #f1edff; color: #6d5ce7;
}
.chip.loc { background: #e8f5ff; color: #1f7fbf; }
.chip.line { background: #fff3e6; color: #c27803; }
.chip.stock-ok { background: #e5f9ef; color: #1a9a5c; }
.chip.stock-out { background: #ffe8ee; color: #d6456a; }
.specs {
  color: var(--c-muted); font-size: .84rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.item-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  min-width: 120px;
}
.price {
  color: var(--c-primary-deep); font-weight: 800; font-size: 1.15rem;
  white-space: nowrap;
}
.price small { color: var(--c-muted); font-size: .75rem; font-weight: 600; margin-left: 2px; }
.qty-row { display: inline-flex; align-items: center; gap: 6px; }
.qty-row input {
  width: 42px; text-align: center; border: 1px solid var(--c-line);
  border-radius: 10px; padding: 6px 4px; font: inherit; font-weight: 700;
  color: var(--c-ink); background: #fff;
}
.qty-row input:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(139,124,246,.15);
}
.item-actions { display: flex; gap: 6px; align-items: center; }
.link-buy {
  font-size: .78rem; font-weight: 700; color: var(--c-mint-deep);
  padding: 6px 10px; border-radius: 999px; background: #e8faf1;
  text-decoration: none;
}
.link-buy:hover { filter: brightness(0.98); text-decoration: none; }

@media (max-width: 640px) {
  .cart-item {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .thumb { width: 56px; height: 56px; border-radius: 14px; }
  .item-side {
    grid-column: 1 / -1;
    flex-direction: row; justify-content: space-between; align-items: center;
    min-width: 0;
  }
}

/* —— summary —— */
.summary-card {
  position: sticky; top: 18px;
  padding: 18px;
}
.summary-card h2 { margin: 0 0 14px; font-size: 1.05rem; font-weight: 800; }
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px; font-size: .92rem; color: var(--c-muted);
}
.sum-row strong { color: var(--c-ink); font-weight: 700; }
.sum-total {
  margin: 14px 0 16px; padding: 14px;
  border-radius: 14px; background: var(--c-primary-soft);
  display: flex; justify-content: space-between; align-items: baseline;
}
.sum-total span { color: var(--c-muted); font-size: .88rem; font-weight: 600; }
.sum-total b {
  color: var(--c-primary-deep); font-size: 1.55rem; font-weight: 800;
}
.hint {
  margin: 12px 0 0; color: var(--c-muted); font-size: .78rem; line-height: 1.55;
}
.select-field {
  margin-bottom: 12px;
}
.select-field label {
  display: block; font-size: .78rem; color: var(--c-muted); font-weight: 700;
  margin-bottom: 6px;
}
.select-field select {
  width: 100%; border: 1px solid var(--c-line); border-radius: 12px;
  padding: 10px 12px; font: inherit; background: #fff; color: var(--c-ink);
}
.select-field select:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(139,124,246,.15);
}

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  background: #fff; border: 1px solid var(--c-line);
  padding: 12px 16px; border-radius: 14px; max-width: 360px;
  box-shadow: var(--shadow); display: none; font-weight: 600; font-size: .9rem;
}
.toast.show { display: block; }
.toast.ok { border-color: #9be8c0; }
.toast.err { border-color: #ffb3c4; color: #c0395a; }

.footer-note {
  margin-top: 22px; text-align: center; color: var(--c-muted); font-size: .8rem;
}

.auth-slot { display: inline-flex; align-items: center; gap: 8px; }
.auth-slot .auth-user { font-size: .85rem; font-weight: 700; color: var(--c-muted); }
.auth-slot .ghost, .auth-slot .auth-btn {
  border: 0; background: transparent; color: var(--c-primary-deep); font-weight: 700; cursor: pointer; padding: 6px 8px;
}
.auth-slot .btn-soft-mini {
  border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer;
  background: var(--c-primary-soft); color: var(--c-primary-deep); font-weight: 800;
}
.auth-modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(40,30,70,.45);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.auth-modal.show { display: flex; }
.auth-card {
  position: relative; width: min(400px, 100%); background: #fff; border-radius: 18px;
  padding: 22px; box-shadow: 0 20px 50px rgba(60,40,120,.25);
}
.auth-close { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tabs button { flex: 1; border: 0; border-radius: 10px; padding: 10px; cursor: pointer; background: var(--c-primary-soft); font-weight: 800; }
.auth-tabs button.on { background: var(--c-primary); color: #fff; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: .8rem; font-weight: 700; color: var(--c-muted); }
.auth-form input { border: 1px solid var(--c-line); border-radius: 12px; padding: 10px 12px; }
.auth-form .btn { width: 100%; border: 0; border-radius: 12px; padding: 12px; font-weight: 800; cursor: pointer; background: var(--c-mint); color: #fff; }
.auth-tip { text-align: center; color: var(--c-muted); font-size: .78rem; }
.link-buy { border: 0; background: transparent; color: var(--c-primary-deep); font-weight: 800; cursor: pointer; padding: 0; }
