* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #app { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f0f2f5; }

/* FOUC 防闪：Vue 挂载前隐藏未渲染模板 */
[v-cloak] { display: none !important; }

/* 加载中遮罩（Vue 挂载前短暂显示） */
.loading-mask {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #07c160, #00a854);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; z-index: 9999;
}
.loading-mask .spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 登录页（现代左右分栏） ===== */
.login-page {
  height: 100%;
  display: flex;
  align-items: stretch;
  background: #f0f2f5;
}
.login-left {
  flex: 1;
  background: linear-gradient(135deg, #07c160 0%, #00a854 45%, #0a7d3a 100%);
  color: #fff;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.login-left::after {
  content: '';
  position: absolute;
  bottom: -120px; left: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.login-left-content { position: relative; z-index: 2; }
.login-left .brand-logo { font-size: 64px; margin-bottom: 24px; }
.login-left h1 { font-size: 32px; font-weight: 700; letter-spacing: 1px; }
.login-left .login-sub { font-size: 15px; opacity: 0.9; margin-top: 12px; line-height: 1.6; }
.login-features { margin-top: 48px; }
.login-feature-item { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 14px; opacity: 0.95; }
.login-feature-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.login-right {
  width: 460px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-box { width: 100%; max-width: 360px; }
.login-brand { text-align: center; margin-bottom: 36px; }
.login-brand .brand-icon { font-size: 48px; }
.login-brand h2 { font-size: 22px; color: #1a1a1a; margin-top: 12px; font-weight: 600; }
.login-brand .brand-desc { font-size: 13px; color: #999; margin-top: 8px; }
.login-btn { width: 100%; margin-top: 8px; height: 44px; font-size: 15px; letter-spacing: 2px; }
.login-tip { text-align: center; color: #bbb; font-size: 12px; margin-top: 20px; }
@media (max-width: 768px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
}

/* ===== 主框架 ===== */
.layout { height: 100%; }
.sidebar { background: #001529; transition: width 0.2s; overflow-x: hidden; }
.logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.logo-icon { font-size: 24px; }
.logo-text { font-size: 17px; font-weight: 700; white-space: nowrap; }
.side-menu { border-right: none; }
.side-menu .el-menu-item { height: 52px; }
.side-menu .el-menu-item.is-active { background: #07c160 !important; }

.topbar {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  padding: 0 24px;
}
.topbar-title { font-size: 17px; font-weight: 600; color: #1a1a1a; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-info { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #333; outline: none; }
.user-avatar { background: #07c160; }

.main-content { background: #f0f2f5; padding: 20px; }
.card-title { font-weight: 600; font-size: 15px; }
.card-header-between { display: flex; align-items: center; justify-content: space-between; }

/* ===== 统计卡片 ===== */
.stat-card {
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: #fff;
}
.stat-icon { font-size: 44px; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 14px; opacity: 0.9; margin-top: 6px; }

/* ===== 商品管理 ===== */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; }
.product-cell { display: flex; align-items: center; gap: 12px; }
.product-thumb { width: 48px; height: 48px; border-radius: 8px; background: #f5f7fa; flex-shrink: 0; }
.product-cell-name { font-size: 14px; color: #1a1a1a; max-width: 300px; }
.product-cell-code { font-size: 12px; color: #999; margin-top: 2px; }
.price-red { color: #f56c6c; font-weight: 600; }

/* ===== 商品图片预览列 ===== */
.product-thumb-lg { width: 72px; height: 72px; border-radius: 8px; background: #f5f7fa; flex-shrink: 0; cursor: pointer; }

/* ===== 图片上传框 ===== */
.img-upload-box {
  width: 120px; height: 120px; border: 1px dashed #d9d9d9; border-radius: 8px;
  position: relative; overflow: hidden; cursor: pointer; background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s;
}
.img-upload-box:hover { border-color: #07c160; }
.img-preview { width: 100%; height: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; }
.img-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #bfbfbf; }
.img-placeholder span { font-size: 12px; }
.img-file-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ===== 轮播图预览 ===== */
.banner-preview { width: 120px; height: 60px; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.banner-preview-emoji { font-size: 28px; }
.banner-preview-lg { width: 100%; height: 140px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; color: #fff; }
.banner-preview-text { flex: 1; }
.bp-title { font-size: 18px; font-weight: 700; }
.bp-sub { font-size: 13px; opacity: 0.9; margin-top: 6px; }
.bp-emoji { font-size: 48px; }

/* ===== 溯源管理 ===== */
.trace-product-list { max-height: 620px; overflow-y: auto; }
.trace-product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.trace-product-item:hover { background: #f5f7fa; }
.trace-product-item.active { background: #e8f8ef; border-color: #07c160; }
.tp-img { width: 44px; height: 44px; border-radius: 8px; background: #f5f7fa; flex-shrink: 0; }
.tp-info { flex: 1; min-width: 0; }
.tp-name { font-size: 13px; color: #1a1a1a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-code { font-size: 11px; color: #999; margin-top: 2px; }
.trace-node-head { display: flex; align-items: center; justify-content: space-between; }
.trace-node-title { font-weight: 600; font-size: 14px; }
.trace-node-desc { font-size: 13px; color: #666; margin: 8px 0; line-height: 1.6; }
.trace-node-meta { font-size: 12px; color: #999; }

.el-card { border-radius: 10px; }
.el-table { border-radius: 8px; }

/* ===== 弹窗开关动画：禁用淡入淡出，避免部分浏览器/webview 下 transitionend 不触发导致弹窗无法关闭 ===== */
.el-overlay,
.el-overlay-dialog,
.el-overlay .el-dialog,
.el-message-box,
.el-drawer,
.el-drawer__body {
  transition: none !important;
  animation: none !important;
}
