@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 {
  --bg: #f3f1fa;
  --surface: #ffffff;
  --ink: #2b2545;
  --muted: #7d7696;
  --line: #e7e1f4;
  --purple: #8b7cf6;
  --purple-deep: #6d5ce7;
  --purple-soft: #f1edff;
  --blue: #4c8dff;
  --blue-soft: #eef4ff;
  --green: #2ecc71;
  --red: #de2910;
  --orange: #f59e0b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(110, 90, 180, 0.08);
  --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(--ink);
  background:
    radial-gradient(1000px 420px at 0% -10%, rgba(155,130,255,.18), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(255,180,210,.12), transparent 50%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: 110px;
}

a { color: var(--purple-deep); text-decoration: none; }
button, select, input { font: inherit; }

.shell { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; }

.topnav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-radius: 999px; padding: 10px 14px 10px 16px;
  box-shadow: 0 6px 20px rgba(110,90,180,.07);
  margin-bottom: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--ink); text-decoration: none;
}
.brand i {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(145deg, #b9a8ff, #7c6af0);
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(124,106,240,.32);
}
.brand i svg { width: 20px; height: 20px; }
.brand em { font-style: normal; color: var(--purple); }
.navs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.navs a {
  color: var(--muted); padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: .9rem; text-decoration: none;
}
.navs a:hover { background: var(--purple-soft); color: var(--purple-deep); }
.navs a.on {
  background: linear-gradient(135deg, #9b8cff, #7b68ee);
  color: #fff; box-shadow: 0 8px 18px rgba(123,104,238,.28);
}
.navs a.ghost { font-size: .8rem; }
.cart-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: #fff; color: var(--purple-deep);
  font-size: .72rem; margin-left: 4px;
}
.navs a.on .cart-count { background: rgba(255,255,255,.95); }

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.page-head h1 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 800; }
.page-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #eefaf3; color: #1f9d62; border-radius: 999px;
  padding: 8px 12px; font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.sync-pill b {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px rgba(46,204,113,.18);
}

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 8px; margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 14px; font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .bar {
  width: 4px; height: 16px; border-radius: 4px;
  background: linear-gradient(180deg, var(--blue), var(--purple));
  display: inline-block;
}
.card h2 span { color: var(--muted); font-size: .82rem; font-weight: 600; }

/* regions */
.regions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  padding-bottom: 10px;
}
.region {
  position: relative; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 14px; padding: 14px 12px 12px;
  transition: .18s ease;
}
.region:hover { border-color: #cfc4ff; transform: translateY(-1px); }
.region.on {
  border-color: var(--purple);
  background: linear-gradient(180deg, #faf8ff, #fff);
  box-shadow: 0 8px 20px rgba(139,124,246,.12);
}
.region .flag-img,
.region .flag-svg {
  width: 40px; height: 28px; border-radius: 4px; display: inline-block;
  margin-bottom: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
  vertical-align: top; background: #fff;
  border: 1px solid rgba(0,0,0,.06);
}
.region .flag-img { object-fit: cover; }
.region .flag-svg svg { width: 100%; height: 100%; display: block; }
.region .name { display: block; font-weight: 800; font-size: .95rem; margin-bottom: 4px; }
.region .meta { color: var(--muted); font-size: .75rem; font-weight: 600; }
.region .badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.badge {
  font-size: .68rem; font-weight: 800; padding: 2px 7px; border-radius: 999px;
}
.badge.green { background: #e6f9ef; color: #1a9a5c; }
.badge.orange { background: #fff3e0; color: #d97706; }
.badge.purple { background: #efe9ff; color: #6d5ce7; }
.badge.blue { background: #e8f1ff; color: #2f6fe4; }
.badge.red { background: #ffe8e6; color: #c0392b; }
.selected-corner {
  position: absolute; top: 0; right: 0;
  background: var(--purple); color: #fff;
  font-size: .68rem; font-weight: 800;
  padding: 4px 10px 5px 12px;
  border-radius: 0 12px 0 12px;
}

.zones { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.zone {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
  font-size: .84rem; font-weight: 700; transition: .15s ease;
}
.zone:hover { border-color: #cfc4ff; }
.zone.on { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* configurator rows */
.cfg-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px; align-items: center;
  padding: 12px 0;
  border-top: 1px solid #f2eef9;
}
.cfg-row:first-of-type { border-top: 0; }
.cfg-label { color: var(--muted); font-size: .88rem; font-weight: 700; }
.cfg-ctrl { min-width: 0; }
.slider-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 12px; align-items: center;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #b7c9ff);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--blue);
  box-shadow: 0 2px 8px rgba(76,141,255,.35); cursor: pointer;
}
.stepper {
  display: inline-flex; align-items: center; gap: 0;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
}
.stepper button {
  width: 34px; height: 34px; border: 0; background: #f7f5fc; color: var(--ink);
  cursor: pointer; font-size: 1.1rem; font-weight: 700;
}
.stepper button:hover { background: var(--blue-soft); color: var(--blue); }
.stepper input {
  width: 64px; border: 0; text-align: center; font-weight: 800; color: var(--ink);
  padding: 6px 0; outline: none;
}
.stepper .unit {
  padding-right: 10px; color: var(--muted); font-size: .78rem; font-weight: 700;
}
.chip-tag {
  font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue); white-space: nowrap;
}

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font-size: .84rem; font-weight: 700;
}
.seg button:hover { border-color: #c5d8ff; }
.seg button.on {
  border-color: var(--blue); color: var(--blue); background: var(--blue-soft);
}
.seg button:disabled { opacity: .4; cursor: not-allowed; }

.os-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; padding-bottom: 12px;
}
.os-item {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px;
  background: #fff; cursor: pointer; text-align: left;
  font-weight: 700; font-size: .86rem;
}
.os-item small { display: block; color: var(--muted); font-size: .72rem; margin-top: 4px; font-weight: 600; }
.os-item.on { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-deep); }

.match-list { display: grid; gap: 8px; padding-bottom: 12px; }
.match-item {
  display: grid; grid-template-columns: minmax(0,1fr) auto auto;
  gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: linear-gradient(180deg, #fcfbff, #fff);
  cursor: pointer;
}
.match-item.on { border-color: var(--purple); box-shadow: 0 6px 16px rgba(139,124,246,.12); }
.match-item h4 { margin: 0 0 4px; font-size: .92rem; }
.match-item p { margin: 0; color: var(--muted); font-size: .78rem; }
.match-side { text-align: right; min-width: 88px; }
.match-item .price { color: #e11d48; font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.match-item .price small { display: block; color: #94a3b8; font-weight: 600; font-size: .72rem; }
.match-item .price.approx { color: #c2410c; font-size: .95rem; }
.match-item .quote-note { margin-top: 4px !important; font-size: .72rem !important; color: #a8a0bf !important; }
.stock-chip {
  display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 800;
}
.stock-chip.stock-ok { background: #e6f9ef; color: #1a9a5c; }
.stock-chip.stock-out { background: #ffe8ee; color: #d6456a; }
.stock-chip.stock-unk { background: #f1f0f5; color: #7d7696; }
.match-item .pick {
  border: 0; background: var(--purple-soft); color: var(--purple-deep);
  border-radius: 999px; padding: 8px 12px; font-weight: 800; cursor: pointer;
}

.loading, .empty { padding: 20px; text-align: center; color: var(--muted); font-weight: 600; }

.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(80,60,140,.08);
}
.buybar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.buy-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.buy-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .72rem; color: var(--muted); font-weight: 700;
}
.buy-fields select {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 110px; background: #fff;
}
.buy-summary .mini { color: var(--muted); font-size: .8rem; font-weight: 600; max-width: 220px; line-height: 1.4; }
.buy-price { text-align: right; }
.buy-price .label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.buy-price .num { color: var(--purple-deep); font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.buy-price .num.is-approx { color: #c2410c; font-size: 1.25rem; }
.buy-price .sub { color: var(--muted); font-size: .75rem; max-width: 280px; }
.buy-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 0; cursor: pointer; border-radius: 12px; font-weight: 800;
  padding: 12px 18px; transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-soft { background: var(--purple-soft); color: var(--purple-deep); }
.btn-buy {
  background: linear-gradient(135deg, #56e0a0, #2ecc71);
  color: #fff; min-width: 140px;
  box-shadow: 0 10px 22px rgba(46,204,113,.28);
}
.btn-buy:disabled, .btn-soft:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

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

.seg.wrap { flex-wrap: wrap; }
.ram-stepper { margin-top: 10px; }
.ram-label { min-width: 64px; text-align: center; font-weight: 800; }

.catalog-filters {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.catalog-filters label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: .78rem; color: var(--muted); font-weight: 700;
}
.catalog-filters input, .catalog-filters select {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.catalog-list { display: flex; flex-direction: column; gap: 10px; }
.catalog-item {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fff;
  cursor: pointer; transition: .15s ease;
}
.catalog-item:hover, .catalog-item.on { border-color: var(--purple); box-shadow: var(--shadow); }
.catalog-item h3 { margin: 0 0 6px; font-size: 1rem; }
.ci-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ci-meta .chip, .catalog-item .chip {
  display: inline-flex; padding: 2px 8px; border-radius: 999px;
  background: var(--purple-soft); color: var(--purple-deep); font-size: .72rem; font-weight: 700;
}
.ci-meta .chip.loc { background: var(--blue-soft); color: #3568c9; }
.ci-spec { color: var(--muted); font-size: .85rem; line-height: 1.45; }
.ci-side { text-align: right; }
.ci-price { font-size: 1.25rem; font-weight: 800; color: var(--purple-deep); margin-bottom: 8px; }
.ci-price small { font-size: .75rem; color: var(--muted); font-weight: 600; }

.auth-slot { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; }
.auth-slot .auth-user { font-size: .85rem; font-weight: 700; color: var(--muted); }
.auth-slot .ghost, .auth-slot .auth-btn {
  border: 0; background: transparent; color: var(--purple-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(--purple-soft); color: var(--purple-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 22px 16px; 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; color: var(--muted);
}
.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(--purple-soft); color: var(--muted); font-weight: 800;
}
.auth-tabs button.on { background: var(--purple); color: #fff; }
.auth-form label {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
  font-size: .8rem; font-weight: 700; color: var(--muted);
}
.auth-form input {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.auth-form .btn { width: 100%; margin-top: 4px; }
.auth-tip { text-align: center; color: var(--muted); font-size: .78rem; margin: 12px 0 0; }

@media (max-width: 800px) {
  .cfg-row { grid-template-columns: 1fr; gap: 8px; }
  .slider-line { grid-template-columns: 1fr; }
  .match-item { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .buy-price { text-align: left; width: 100%; }
  .buy-actions { width: 100%; }
  .buy-actions .btn { flex: 1; }
  .catalog-filters { grid-template-columns: 1fr 1fr; }
  .catalog-item { grid-template-columns: 1fr; }
  .ci-side { text-align: left; display: flex; align-items: center; justify-content: space-between; }
}
