:root {
  --c-bg: #f5f7f9;
  --c-surface: #ffffff;
  --c-primary: #1f5f8b;
  --c-primary-d: #163f5c;
  --c-accent: #c0793c;
  --c-accent-d: #a4632c;
  --c-text: #1f2733;
  --c-muted: #6b7682;
  --c-border: #e4e8ed;
  --c-success: #2e8b6f;
  --c-danger: #c0584b;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 2px 14px rgba(20, 40, 60, .07);
  --shadow-h: 0 6px 22px rgba(20, 40, 60, .12);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---------- layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 0; }
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.section-sub { color: var(--c-muted); margin: 0 0 22px; font-size: 14px; }

/* ---------- header ---------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(20, 40, 60, .03);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--c-primary-d); }
.brand svg { width: 30px; height: 30px; }
.brand small { display: block; font-size: 11px; color: var(--c-muted); font-weight: 500; letter-spacing: .5px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--c-text); font-weight: 500; transition: .15s; }
.nav a:hover { background: var(--c-bg); color: var(--c-primary); }
.nav a.active { background: var(--c-primary); color: #fff; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.cart-link { position: relative; display: flex; align-items: center; color: var(--c-text); }
.cart-link svg { width: 22px; height: 22px; }
.cart-badge { position: absolute; top: -7px; right: -9px; background: var(--c-accent); color: #fff; font-size: 11px; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700; }
.user-box { display: flex; align-items: center; gap: 8px; }
.uname { font-weight: 600; color: var(--c-primary-d); }
.btn { cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 9px 18px; font-weight: 600; transition: .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-d); }
.btn-accent { background: var(--c-accent); color: #fff; }
.btn-accent:hover { background: var(--c-accent-d); }
.btn-ghost { background: transparent; border-color: var(--c-border); color: var(--c-text); }
.btn-ghost:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-danger { background: transparent; border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- hero ---------- */
.hero { background: linear-gradient(135deg, #163f5c 0%, #1f5f8b 55%, #2c7a9c 100%); color: #fff; padding: 60px 0; }
.hero h1 { font-size: 32px; margin: 0 0 12px; font-weight: 800; letter-spacing: .5px; }
.hero p { font-size: 16px; opacity: .92; max-width: 620px; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.hero-stats { display: flex; gap: 36px; margin-top: 34px; }
.hero-stats .num { font-size: 26px; font-weight: 800; }
.hero-stats .lab { font-size: 13px; opacity: .85; }

/* ---------- module cards ---------- */
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.module-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); transition: .2s; display: flex; flex-direction: column; }
.module-card:hover { box-shadow: var(--shadow-h); transform: translateY(-2px); }
.module-icon { width: 52px; height: 52px; border-radius: 12px; background: #eaf1f6; color: var(--c-primary); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.module-icon svg { width: 28px; height: 28px; }
.module-card h3 { margin: 0 0 8px; font-size: 19px; }
.module-card p { color: var(--c-muted); margin: 0 0 18px; flex: 1; }
.module-card .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tag { font-size: 12px; background: var(--c-bg); color: var(--c-muted); padding: 4px 10px; border-radius: 20px; }

/* ---------- product grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-products { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: .18s; }
.card:hover { box-shadow: var(--shadow-h); transform: translateY(-3px); }
.card-img { aspect-ratio: 1/1; background: #eef1f4; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 16px 16px; }
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.card-sub { color: var(--c-muted); font-size: 12.5px; margin: 0 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { color: var(--c-accent-d); font-weight: 800; font-size: 18px; }
.price small { color: var(--c-muted); font-weight: 500; font-size: 12px; text-decoration: line-through; margin-left: 6px; }
.merchant-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-muted); margin-top: 8px; }
.merchant-dot { width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---------- filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.chip { padding: 7px 16px; border-radius: 20px; background: var(--c-surface); border: 1px solid var(--c-border); cursor: pointer; font-size: 13px; transition: .15s; }
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.chip.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.search-box { margin-left: auto; display: flex; gap: 8px; }
.search-box input { padding: 9px 14px; border: 1px solid var(--c-border); border-radius: 8px; width: 240px; outline: none; }
.search-box input:focus { border-color: var(--c-primary); }

/* ---------- detail ---------- */
.detail { display: grid; grid-template-columns: 1fr 1fr 300px; gap: 24px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.gallery-main { aspect-ratio: 1/1; background: #eef1f4; border-radius: var(--radius-s); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumbs img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumbs img.active { border-color: var(--c-primary); }
.detail-info h1 { font-size: 24px; margin: 0 0 6px; }
.detail-price { font-size: 28px; font-weight: 800; color: var(--c-accent-d); margin: 14px 0; }
.detail-price small { font-size: 15px; color: var(--c-muted); text-decoration: line-through; font-weight: 500; margin-left: 10px; }
.detail-meta { color: var(--c-muted); font-size: 13.5px; margin-bottom: 18px; }
.detail-desc { color: #3a4452; line-height: 1.9; margin: 18px 0; white-space: pre-line; }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--c-border); border-radius: 8px; overflow: hidden; }
.qty button { width: 36px; height: 36px; border: none; background: var(--c-bg); cursor: pointer; font-size: 18px; color: var(--c-text); }
.qty input { width: 48px; height: 36px; border: none; text-align: center; outline: none; }
.detail-actions { display: flex; gap: 12px; margin-top: 8px; }
.merchant-card { margin: 0; padding: 18px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius-s); align-self: start; }
.merchant-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.merchant-card-name { font-weight: 700; font-size: 16px; color: var(--c-text); }
.merchant-card-desc { color: var(--c-muted); font-size: 13px; margin-top: 3px; line-height: 1.5; }
.merchant-meta { margin: 12px 0 16px; border-top: 1px dashed var(--c-border); padding-top: 12px; }
.merchant-card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.merchant-card .label { color: var(--c-muted); font-size: 13px; }
.merchant-card .val { font-weight: 700; font-size: 14px; color: var(--c-text); }
.merchant-card .btn-login-inline { color: var(--c-primary); font-weight: 700; cursor: pointer; font-size: 13px; }

/* ---------- product detail bottom (商品详情区) ---------- */
.detail-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--c-border); margin-bottom: 22px; }
.detail-tab { padding: 12px 24px; cursor: pointer; font-size: 15px; color: var(--c-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.detail-tab:hover { color: var(--c-accent); }
.detail-tab.active { color: var(--c-accent); border-bottom-color: var(--c-accent); font-weight: 600; }
.detail-pane { display: none; padding: 4px 0 8px; }
.detail-pane.active { display: block; }
.detail-article { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 26px 30px; box-shadow: var(--shadow); }
.detail-article p { line-height: 1.95; color: #333c47; margin: 0 0 14px; }
.detail-article p:last-child { margin-bottom: 0; }
.detail-images { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.detail-images img { width: 100%; border-radius: var(--radius-s); object-fit: cover; aspect-ratio: 1/1; box-shadow: var(--shadow); }
.spec-table { width: 100%; border-collapse: collapse; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.spec-table th, .spec-table td { padding: 12px 18px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--c-border); }
.spec-table th { background: var(--c-bg); color: var(--c-muted); width: 30%; font-weight: 500; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table tr:hover td { background: rgba(31,95,139,.03); }
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.service-item { display: flex; align-items: flex-start; gap: 14px; padding: 8px; }
.service-icon { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; background: rgba(31,95,139,.08); color: var(--c-accent); display: flex; align-items: center; justify-content: center; }
.service-icon svg { width: 22px; height: 22px; }
.service-title { font-weight: 600; font-size: 15px; color: var(--c-text); }
.service-sub { color: var(--c-muted); font-size: 13px; margin-top: 3px; }
@media (max-width: 768px) {
  .detail-images { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .service-grid { grid-template-columns: 1fr; }
  .detail-tab { padding: 10px 14px; font-size: 14px; }
}

/* ---------- listings ---------- */
.grid-listings { grid-template-columns: repeat(3, 1fr); }
.listing-card .card-img { aspect-ratio: 16/10; }
.listing-cat { position: absolute; top: 10px; left: 10px; background: rgba(31,95,139,.92); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.card-img-wrap { position: relative; }
.listing-meta { display: flex; justify-content: space-between; color: var(--c-muted); font-size: 12.5px; margin-top: 8px; }
.listing-pub { color: var(--c-text); font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.reviewed-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--c-success); font-size: 12px; font-weight: 600; }
.reviewed-badge svg { width: 14px; height: 14px; }

/* ---------- listing detail ---------- */
.article { max-width: 820px; margin: 0 auto; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.article h1 { font-size: 26px; margin: 0 0 10px; }
.article-meta { color: var(--c-muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--c-border); padding-bottom: 16px; margin-bottom: 18px; }
.article-content { line-height: 1.95; color: #333c47; white-space: pre-line; margin-bottom: 22px; }
.article-images { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.article-images img { border-radius: var(--radius-s); width: 100%; object-fit: cover; aspect-ratio: 4/3; }
.contact-box { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius-s); padding: 18px 20px; }
.contact-box .row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.contact-box .label { color: var(--c-muted); }
.contact-box .val { font-weight: 700; }
.phone-hidden { letter-spacing: 2px; }
.btn-login-inline { color: var(--c-primary); font-weight: 700; cursor: pointer; }

/* ---------- forms ---------- */
.form-wrap { max-width: 460px; margin: 30px auto; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.form-wrap h2 { margin: 0 0 6px; font-size: 22px; }
.form-wrap .hint { color: var(--c-muted); margin: 0 0 22px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 14px; }
.field input, .field textarea, .field select { width: 100%; padding: 11px 14px; border: 1px solid var(--c-border); border-radius: 8px; outline: none; transition: .15s; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--c-primary); }
.field textarea { min-height: 130px; resize: vertical; }
.check-row { display: flex; align-items: flex-start; gap: 9px; margin: 12px 0; font-size: 13.5px; color: #445; }
.check-row input { margin-top: 3px; }
.check-row a { color: var(--c-primary); }
.switch-auth { text-align: center; margin-top: 18px; color: var(--c-muted); font-size: 14px; }
.switch-auth a { color: var(--c-primary); font-weight: 600; }

/* ---------- cart / orders ---------- */
.cart-line { display: flex; gap: 16px; align-items: center; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-s); padding: 14px; margin-bottom: 12px; }
.cart-line img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.cart-line .info { flex: 1; }
.cart-line .ttl { font-weight: 700; }
.cart-line .pr { color: var(--c-accent-d); font-weight: 700; }
.cart-summary { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 22px; position: sticky; top: 84px; }
.cart-summary .total { font-size: 22px; font-weight: 800; color: var(--c-accent-d); }
.order-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.order-card .top { display: flex; justify-content: space-between; border-bottom: 1px solid var(--c-border); padding-bottom: 10px; margin-bottom: 10px; }
.order-item { display: flex; justify-content: space-between; color: #445; padding: 3px 0; }

/* ---------- about / legal ---------- */
.prose { max-width: 860px; margin: 0 auto; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); line-height: 1.95; }
.prose h2 { font-size: 20px; margin: 26px 0 10px; color: var(--c-primary-d); }
.prose p { color: #333c47; }
.prose ul { color: #333c47; padding-left: 20px; }

/* ---------- footer ---------- */
.site-footer { background-color: #06121e; background-image: radial-gradient(ellipse at 20% 0%, rgba(30, 92, 150, .55) 0%, transparent 55%), radial-gradient(ellipse at 80% 100%, rgba(22, 63, 92, .7) 0%, transparent 50%), linear-gradient(180deg, #0b1d2e 0%, #06121e 100%); color: #f0f6fa; margin-top: 50px; padding: 40px 0 22px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.footer-grid h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.footer-grid a { color: #cfe0f0; display: block; padding: 4px 0; font-size: 14px; }
.footer-grid a:hover { color: #fff; }
.footer-brand { font-size: 16px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.footer-brand svg { width: 26px; height: 26px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); margin-top: 28px; padding-top: 16px; font-size: 13px; color: #b8cce0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.footer-bottom a { color: #b8cce0; }
.footer-bottom a:hover { color: #fff; }

/* ---------- misc ---------- */
.breadcrumb { color: var(--c-muted); font-size: 13px; margin: 18px 0 0; }
.breadcrumb a { color: var(--c-primary); }
.empty { text-align: center; color: var(--c-muted); padding: 60px 20px; }
.empty svg { width: 56px; height: 56px; opacity: .4; margin-bottom: 12px; }
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 11px 22px; border-radius: 10px; z-index: 200; box-shadow: var(--shadow-h); opacity: 0; transition: .25s; pointer-events: none; font-size: 14px; }
.toast.show { opacity: 1; top: 90px; }
.notice { background: #eaf1f6; border: 1px solid #cfe0ec; color: #1f5f8b; border-radius: var(--radius-s); padding: 12px 16px; font-size: 13.5px; margin-bottom: 18px; }
.muted { color: var(--c-muted); }
.center { text-align: center; }

@media (max-width: 920px) {
  .grid-products { grid-template-columns: repeat(2, 1fr); }
  .grid-listings { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
}
@media (max-width: 560px) {
  .grid-products, .grid-listings { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .article-images { grid-template-columns: 1fr; }
}
