:root,
[data-theme="light"] {
  --pico-primary: #111827;
  --pico-primary-hover: #374151;
  --pico-primary-background: #111827;
  --pico-primary-hover-background: #1f2937;
  --pico-primary-border: #111827;
  --pico-primary-hover-border: #1f2937;
  --pico-primary-focus: rgba(17, 24, 39, 0.14);
  --pico-color: #111827;
  --pico-muted-color: #6b7280;
  --pico-border-color: #e5e7eb;
  --pico-form-element-border-color: #d1d5db;
  --pico-form-element-active-border-color: #111827;
  --pico-form-element-focus-color: rgba(17, 24, 39, 0.12);
  --pico-background-color: #f8f9fa;
  --pico-card-background-color: #ffffff;
  --pico-font-family-sans-serif: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --pico-font-size: 87.5%;
  --pico-line-height: 1.45;
  --pico-border-radius: 6px;
}

body {
  margin: 0;
  background: #f8f9fa;
  color: #111827;
}

.shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 顶部栏：紧凑单行 46px */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0;
}
.topbar-inner {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand:hover { color: #374151; text-decoration: none; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name {
  font-size: 13px;
  color: #4b5563;
}
.logout-form { margin: 0; }
.btn-ghost {
  margin: 0;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: transparent;
  color: #4b5563;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  width: auto;
}
.btn-ghost:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

.workspace {
  padding-top: 14px;
  padding-bottom: 28px;
}

/* 主面板与紧凑工具栏 */
.panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 0;
  border-bottom: 1px solid #eef0f3;
  background: #ffffff;
}

.toolbar input[type="search"],
.toolbar select,
.toolbar button {
  height: 32px;
  margin: 0;
  font-size: 13px;
  line-height: 1;
  border-radius: 6px;
  box-sizing: border-box;
}

.toolbar input[type="search"] {
  flex: 1 1 260px;
  max-width: 380px;
  padding: 0 10px 0 30px;
  border-radius: 6px;
  background-position: center left 9px;
  background-size: 14px auto;
}

.toolbar select {
  width: auto;
  min-width: 96px;
  padding: 0 28px 0 10px;
  background-position: center right 8px;
  background-size: 12px auto;
}

.btn-primary {
  width: auto;
  padding: 0 14px;
  background: #111827;
  border: 1px solid #111827;
  color: #ffffff;
  font-weight: 500;
  white-space: nowrap;
}
.btn-primary:hover {
  background: #1f2937;
  border-color: #1f2937;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn-outline:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.htmx-indicator { opacity: 0; transition: opacity 120ms ease; margin-left: auto; }
.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request { opacity: 1; }

/* 核心数据表格 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f3f5;
  background: transparent;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.col-platform { width: 76px; white-space: nowrap; }
.col-shop { width: 190px; max-width: 200px; }
.col-price { width: 130px; white-space: nowrap; }
.col-time { width: 145px; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
}
.thumb-link { flex: 0 0 44px; display: block; }
.product-info { min-width: 0; }
.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.38;
  color: #111827;
  text-decoration: none;
}
.product-title:hover { color: #0f766e; text-decoration: underline; }
.product-id {
  margin-top: 2px;
  font-size: 11px;
  color: #9ca3af;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.shop-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.price {
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.photo-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid #eef0f3;
  display: block;
}
.photo-hero {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  display: block;
}
.photo-gallery {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid #e5e7eb;
  display: block;
}
.photo-trigger {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  width: auto;
  cursor: zoom-in;
  line-height: 0;
}
.photo-placeholder {
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: #9ca3af;
  font-size: 11px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  flex-shrink: 0;
}

/* 表格底部统计与分页 */
.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #eef0f3;
  background: #fafafa;
  font-size: 12px;
  color: #6b7280;
}
.footer-meta { display: flex; align-items: center; gap: 10px; }
.clear-link { color: #0f766e; text-decoration: none; font-weight: 500; }
.clear-link:hover { text-decoration: underline; }

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  text-decoration: none;
}
.page-btn:hover { border-color: #111827; color: #111827; text-decoration: none; }
.page-btn.is-current {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
  font-weight: 600;
}
.page-btn.is-disabled { opacity: 0.4; pointer-events: none; }
.page-ellipsis { padding: 0 3px; color: #9ca3af; }

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: #6b7280;
  font-size: 13px;
}
.empty-state p { margin: 0 0 12px; }

/* 标签 */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-neutral { background: #f3f4f6; color: #374151; }
.badge-tag { background: #ecfdf5; color: #065f46; }
.badge-ok { background: #ecfdf5; color: #047857; }
.badge-warn { background: #fffbeb; color: #b45309; }
.badge-muted { background: #f3f4f6; color: #6b7280; }
.badge-taobao { background: #fff7ed; color: #c2410c; }
.badge-tmall { background: #fef2f2; color: #b91c1c; }
.badge-etsy { background: #fef3c7; color: #92400e; }

.muted { color: #6b7280; }
.small-text { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.break-word { overflow-wrap: anywhere; word-break: break-word; }
.strike { text-decoration: line-through; margin-left: 6px; font-size: 13px; }

/* 详情页 */
.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.back-link {
  font-size: 13px;
  color: #4b5563;
  text-decoration: none;
  font-weight: 500;
}
.back-link:hover { color: #111827; text-decoration: underline; }

.detail-title-row {
  margin-bottom: 12px;
}
.detail-title-row h1 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  color: #111827;
}
.meta-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 14px;
}
.detail-main { display: grid; gap: 12px; min-width: 0; }
.detail-side { min-width: 0; }

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0;
}
.card h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
  color: #111827;
}
.card h3 {
  font-size: 12.5px;
  font-weight: 600;
  color: #4b5563;
  margin: 14px 0 8px;
}
.card h3:first-child { margin-top: 0; }

.product-overview {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.hero-price {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.kv-list {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.kv-list > div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}
.kv-list dt { color: #6b7280; }
.kv-list dd { margin: 0; overflow-wrap: anywhere; }

.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.image-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.description-body { font-size: 13px; line-height: 1.7; color: #374151; overflow-wrap: anywhere; }
.description-body p { margin: 0 0 8px; }
.compact-table th, .compact-table td { padding: 6px 10px; font-size: 12.5px; }
.param-name { width: 28%; color: #6b7280; font-weight: 500; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stat-grid > div {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  display: flex;
  flex-direction: column;
}
.review-item {
  margin: 0 0 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border-left: 2px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
}
.review-item p { margin: 0 0 4px; }
.review-item footer { font-size: 11.5px; color: #6b7280; }

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.rec-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid #eef0f3;
  border-radius: 6px;
}
.rec-info { min-width: 0; font-size: 12.5px; }
.rec-info a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #111827;
  text-decoration: none;
}
.rec-info a:hover { text-decoration: underline; }

.meta-stack { margin: 0; display: grid; gap: 8px; font-size: 12.5px; }
.meta-stack dt { font-size: 11.5px; color: #6b7280; }
.meta-stack dd { margin: 1px 0 0; }

.field-list { list-style: none; padding: 0; margin: 4px 0 0; }
.field-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
}
.field-list li:last-child { border-bottom: 0; }
.side-details { margin-top: 12px; border-top: 1px solid #f1f3f5; padding-top: 10px; }
.side-details summary { font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 4px; }

.alert {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* 登录与错误页 */
.login-wrap { display: grid; place-items: center; padding-top: 10vh; }
.login-card {
  width: min(360px, 100%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
}
.login-card h1 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.login-card label { font-size: 12.5px; color: #4b5563; margin-bottom: 4px; }
.login-card input { height: 36px; font-size: 13px; padding: 0 10px; margin-bottom: 12px; }
.btn-block { width: 100%; height: 36px; font-size: 13px; }

.error-card {
  max-width: 460px;
  margin: 10vh auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
}
.error-card h1 { font-size: 17px; margin: 0 0 8px; }

.lightbox-card { max-width: min(92vw, 960px); width: auto; }
.lightbox-body { display: grid; place-items: center; }
.lightbox-body img { max-width: 100%; max-height: 75vh; border-radius: 5px; }

@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .shell { padding: 0 12px; }
  .product-overview { flex-direction: column; }
  .kv-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
