:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.topbar {
  background: #0f172a;
  color: #fff;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.14);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 12px #38bdf8;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
}

.container {
  max-width: 1320px;
  margin: 22px auto 60px;
  padding: 0 16px;
}

.notice-bar {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mock-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 20px;
  align-items: start;
}

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

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cat-pill {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.product-card:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.product-card.selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.product-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.product-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.product-desc {
  margin: 6px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.tag-auto {
  background: #dcfce7;
  color: #166534;
}

.tag-manual {
  background: #fef3c7;
  color: #92400e;
}

.tag-stock {
  background: #f1f5f9;
  color: #475569;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
}

.input,
.select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.option-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
}

.summary-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  opacity: 0.92;
}

.btn-full {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 10px;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  background: #fff;
}

.secret-box {
  background: #0f172a;
  color: #38bdf8;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 10px;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-DELIVERED {
  background: #dcfce7;
  color: #166534;
}

.status-DELIVERING,
.status-PROCURING,
.status-PENDING_PAY {
  background: #fef3c7;
  color: #92400e;
}

.status-WAITING_CONFIRM {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-EXPIRED,
.status-CANCELLED {
  background: #f1f5f9;
  color: #64748b;
}

.status-UNCERTAIN,
.status-FAILED,
.status-REFUNDED {
  background: #fee2e2;
  color: #991b1b;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
}

.kpi-val {
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

/* ============================================================
   商品目录扩展样式：分类树 / 搜索排序 / 分页 / 售罄态
   ============================================================ */
.muted-xs {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.shop-layout-3 {
  grid-template-columns: 210px minmax(0, 1fr) minmax(318px, 352px);
}

@media (max-width: 1120px) {
  .shop-layout-3 {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .shop-layout-3 .order-side {
    grid-column: 1 / -1;
    position: static !important;
  }
}

@media (max-width: 860px) {
  .shop-layout-3 {
    grid-template-columns: 1fr;
  }
}

.catalog-side {
  padding: 16px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.search-input {
  width: 100%;
  margin-bottom: 8px;
  font-size: 13px;
  padding: 8px 10px;
}

.sort-row {
  margin-bottom: 10px;
}

.select-sm {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
}

.cat-tree {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cat-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-node {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.cat-node:hover {
  background: #f1f5f9;
}

.cat-node.active {
  background: var(--primary);
  color: #fff;
}

.cat-node.active .cat-count {
  color: #dbeafe;
}

.cat-root {
  font-weight: 700;
  margin-bottom: 4px;
}

.cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-count {
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}

.cat-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-children .cat-node {
  font-size: 12.5px;
  padding: 5px 8px;
}

.product-panel {
  min-height: 420px;
}

.product-list {
  grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
}

.product-path {
  margin-top: 6px;
  font-size: 11.5px;
  color: #94a3b8;
}

.product-card.sold-out {
  opacity: 0.62;
  cursor: not-allowed;
  background: #f8fafc;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.filter-chip {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.filter-clear {
  border: none;
  background: none;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* ============================================================
   后台：同步进度 / 筛选条 / 批量操作条
   ============================================================ */
.sync-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.sync-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.sync-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.admin-filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.bulk-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.admin-thumb {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 16px;
}

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

.admin-cat-icon {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 12px;
}

.admin-cat-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
