* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1f2933;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid #dde3ea;
}

.topbar p {
  margin: 0 0 4px;
  color: #637083;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.nav-link {
  color: #1769aa;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.balance-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 8px 6px 12px;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #f8fafc;
}

.balance-box span {
  color: #637083;
  font-size: 13px;
}

.balance-box strong {
  min-width: 88px;
  color: #0f766e;
  font-size: 16px;
  text-align: right;
  white-space: nowrap;
}

.balance-box.error strong {
  color: #b42318;
}

.balance-box button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #c9d3df;
  background: #ffffff;
  color: #1769aa;
  font-size: 13px;
}

.balance-box button:hover {
  background: #eef6fb;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 42%) 1fr;
  gap: 18px;
  height: calc(100vh - 78px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.product-panel,
.detail-panel {
  min-height: 0;
  height: 100%;
  background: #ffffff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
}

.product-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-panel {
  overflow-y: auto;
}

.search-form,
.panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5eaf0;
}

.search-form label {
  display: grid;
  gap: 6px;
  flex: 1 1 140px;
  color: #52616f;
  font-size: 13px;
}

.search-form input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  font-size: 14px;
}

button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #1769aa;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: #125482;
}

button:disabled {
  background: #9aa8b7;
  cursor: default;
}

.panel-head {
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span,
.state,
.empty-detail span {
  color: #65758b;
}

.state {
  padding: 14px 16px;
}

.state:empty {
  display: none;
}

.error {
  color: #b42318;
  background: #fff1f0;
}

.product-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: #e5eaf0;
}

.product-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  width: 100%;
  min-height: 116px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #e5eaf0;
  border-radius: 0;
  background: #ffffff;
  color: inherit;
  text-align: left;
}

.product-item:hover,
.product-item.active {
  background: #eef6fb;
}

.product-thumb,
.detail-cover,
.sku-thumb {
  display: block;
  object-fit: cover;
  background: #edf1f5;
}

.product-thumb {
  width: 86px;
  height: 86px;
  border-radius: 6px;
}

.product-name {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #edf1f5;
  color: #425466;
  font-size: 12px;
}

.price {
  color: #b54708;
  font-weight: 700;
}

.empty-detail {
  display: grid;
  gap: 8px;
  padding: 28px;
}

.empty-detail strong {
  font-size: 18px;
}

.detail-view {
  padding: 18px;
}

.detail-header {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5eaf0;
}

.detail-cover {
  width: 180px;
  height: 180px;
  border-radius: 8px;
}

.detail-title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.35;
}

.detail-import-button {
  margin-top: 8px;
}

.detail-section {
  padding-top: 18px;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
}

.summary-item,
.sku-item {
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #ffffff;
}

.summary-item {
  padding: 12px;
}

.summary-item span {
  display: block;
  margin-bottom: 5px;
  color: #65758b;
  font-size: 12px;
}

.sku-list {
  display: grid;
  gap: 10px;
}

.sku-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px;
}

.sku-thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
}

.sku-item p {
  margin: 4px 0;
  color: #52616f;
}

.shop-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #52616f;
  font-size: 13px;
}

.shop-import-button {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.shop-list {
  display: grid;
  gap: 10px;
}

.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #ffffff;
}

.shop-item strong {
  display: block;
  margin-bottom: 6px;
  line-height: 1.35;
}

.shop-item p {
  margin: 0 0 8px;
  color: #52616f;
  line-height: 1.5;
}

.shop-map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: #eef6fb;
  color: #1769aa;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.shop-map-link:hover {
  background: #dceef8;
}

.detail-images {
  display: grid;
  gap: 12px;
}

.detail-images img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #edf1f5;
}

@media (max-width: 920px) {
  .topbar,
  .workspace,
  .detail-header {
    display: block;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }

  .balance-box {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    height: auto;
    padding: 12px;
  }

  .product-panel,
  .detail-panel {
    height: auto;
    margin-bottom: 12px;
  }

  .product-list {
    max-height: 70vh;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-form button {
    width: 100%;
  }

  .detail-cover {
    width: 100%;
    max-width: 260px;
    height: auto;
    aspect-ratio: 1;
    margin-bottom: 14px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .shop-item {
    grid-template-columns: 1fr;
  }

  .shop-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-import-button {
    width: 100%;
  }

  .shop-map-link {
    width: 100%;
  }
}
