/* 统一白蓝风格（第二种）：不依赖暗色旧样式 */
:root {
  --brand: #0d6efd;
  --brand-soft: #e7f1ff;
  --page-bg: #f0f2f5;
  --card: #ffffff;
  --text: #212529;
  --muted: #6c757d;
}

* { box-sizing: border-box; }

body.theme-light,
body.bg-body-tertiary,
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg) !important;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* —— 登录页：蓝顶白底 —— */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--page-bg);
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(13, 110, 253, 0.12);
  border: 1px solid #e3e8ef;
}

.login-head {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 1.35rem 1.25rem 1.2rem;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-sub {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.login-body {
  background: #fff;
  padding: 1.5rem 1.4rem 1.6rem;
}

.login-body .form-label {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.login-body .form-control {
  background: var(--brand-soft) !important;
  border: 1px solid #cfe2ff !important;
  color: var(--text) !important;
}

.login-body .form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
  border-color: var(--brand) !important;
}

.login-body .btn-primary {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  font-weight: 600;
}

/* —— 主站顶栏 / 商品卡 —— */
.navbar.bg-primary {
  background: var(--brand) !important;
}

.product-card {
  background: #fff !important;
  transition: box-shadow .15s ease, border-color .15s ease;
  border: 1px solid #e9ecef !important;
}

.product-card.selected {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, .2);
}

.card-thumb img,
.card-thumb .object-fit-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* 商品卡：固定一小块方形缩略图 */
.product-col {
  max-width: 100%;
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 160px;
  overflow: hidden;
  background: #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb-img.is-broken {
  display: none;
}

.card-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f3f5;
}

.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  line-height: 1.25;
  color: var(--text);
  font-size: 0.8rem;
}

.product-preview-hit {
  cursor: pointer;
}

.product-title.product-preview-hit:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-thumb-wrap.product-preview-hit:hover .card-thumb-img {
  transform: scale(1.03);
  transition: transform 0.18s ease;
}

.card-thumb-wrap .card-thumb-img {
  transition: transform 0.18s ease;
}

/* 商品详情预览弹层 */
#productPreviewModal .modal-dialog {
  max-width: min(1100px, 96vw);
}

#productPreviewBody {
  overflow-x: hidden;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

@media (max-width: 767.98px) {
  .preview-layout {
    grid-template-columns: 1fr;
  }
}

.preview-col-media,
.preview-col-info {
  min-width: 0;
  max-width: 100%;
}

.preview-main-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: min(460px, 52vh);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
}

.preview-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 7.5rem;
  overflow: auto;
}

.preview-thumb {
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #f1f3f5;
  cursor: pointer;
  flex: 0 0 auto;
}

.preview-thumb.is-active,
.preview-thumb:hover {
  border-color: var(--brand);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-block {
  width: 100%;
  max-width: 100%;
}

.preview-meta {
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.preview-var-table {
  width: 100%;
  max-width: 100%;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
  position: relative;
  z-index: 0;
}

#productPreviewBody .preview-var-table table {
  width: 100%;
  margin: 0;
  caption-side: top;
  border-collapse: collapse;
  position: static !important;
  float: none !important;
  left: auto !important;
  top: auto !important;
}

#productPreviewBody .preview-var-table th,
#productPreviewBody .preview-var-table td {
  position: static !important;
  float: none !important;
  white-space: nowrap;
}

.preview-var-img {
  width: 52px;
  padding: 0.25rem !important;
}

.preview-var-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--bs-border-color, #dee2e6);
  display: block;
}

.preview-body-html {
  max-height: 240px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  /* 隔离描述 HTML 内联样式，避免污染弹层其它表格/布局 */
  isolation: isolate;
  contain: content;
  position: relative;
  z-index: 0;
  clear: both;
}

.preview-body-html * {
  max-width: 100% !important;
}

.preview-body-html table {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto;
  position: static !important;
  float: none !important;
}

.preview-body-html img,
.preview-body-html video,
.preview-body-html iframe {
  max-width: 100% !important;
  height: auto !important;
  float: none !important;
  position: static !important;
}

.preview-body-html style,
.preview-body-html script {
  display: none !important;
}

.navbar .badge {
  font-weight: 600;
}

/* 右上角品牌过滤下拉 */
.brand-exclude-menu {
  min-width: 280px;
  max-width: min(360px, 92vw);
  z-index: 1080;
}

.brand-exclude-menu textarea {
  resize: vertical;
  min-height: 10rem;
  line-height: 1.4;
}

/* 采集控制台：大量窗口号紧凑列表 */
.profile-list {
  max-height: min(420px, 55vh);
  overflow: auto;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.5rem;
  border-bottom: 1px solid #f1f3f5;
  font-size: 0.78rem;
  min-height: 1.85rem;
}

.profile-row:last-child {
  border-bottom: 0;
}

.profile-row.is-off {
  opacity: 0.55;
  background: #fafbfc;
}

.profile-row .profile-id {
  flex: 0 1 9.5rem;
  max-width: 9.5rem;
  font-size: 0.75rem;
}

.profile-row .profile-stats {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  white-space: nowrap;
  min-width: 4.8rem;
}

.profile-row .stat-sep {
  opacity: 0.45;
  margin: 0 0.08rem;
}

.profile-row .stat-pill {
  color: #334155;
}

.profile-row .stat-cap {
  color: #b45309;
}

.profile-row .stat-403 {
  color: #b91c1c;
}

.profile-row .profile-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
}

.profile-row .form-check-input {
  margin: 0;
  width: 0.9rem;
  height: 0.9rem;
}

/* 写入店铺列表：强制加宽 + 横向滚动 */
.shops-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.shops-table {
  width: max-content;
  min-width: 1600px;
  table-layout: auto;
}

.shops-table th,
.shops-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.shops-table .col-domain {
  min-width: 15rem;
}

.shops-table .col-name {
  min-width: 4rem;
}

.shops-table .col-owner {
  min-width: 10rem;
}

.shops-table .col-check {
  min-width: 22rem;
}

.shops-table .col-products,
.shops-table .col-written {
  min-width: 5rem;
}

.shops-table .col-orders {
  min-width: 8rem;
}

.shops-table .col-limits {
  min-width: 13rem;
}

.shops-table .col-actions {
  min-width: 16rem;
}

.shops-owner-select {
  min-width: 8rem;
  width: 8rem;
}

.shops-limit-input {
  width: 4.75rem;
  min-width: 4.75rem;
}

