:root {
  --sidebar-bg: #304156;
  --sidebar-bg-sub: #1f2d3d;
  --sidebar-text: #bfcbd9;
  --sidebar-active: #409eff;
  --sidebar-active-bg: #263445;
  --header-h: 50px;
  --tabs-h: 34px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #303133;
  background: #f0f2f5;
}

#app { height: 100vh; }

/* ---------- Layout ---------- */
.admin-layout { display: flex; height: 100vh; }
.admin-sidebar {
  width: 210px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.28s;
  overflow: hidden;
}
.admin-sidebar.is-collapse { width: 64px; }
.admin-sidebar__logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg-sub);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}
.admin-sidebar__logo span { color: var(--sidebar-active); }
.admin-sidebar__menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.admin-sidebar__menu::-webkit-scrollbar { width: 6px; }
.admin-sidebar__menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* Menu items */
.menu-item {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 44px;
  color: var(--sidebar-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  user-select: none;
}
.menu-item:hover { background: var(--sidebar-active-bg); color: #fff; }
.menu-item.is-active { background: var(--sidebar-active); color: #fff; }
.menu-item .el-icon { margin-right: 16px; font-size: 16px; }
.menu-item__text { flex: 1; }
.menu-item__arrow { transition: transform 0.2s; font-size: 12px; }
.menu-item.is-open .menu-item__arrow { transform: rotate(90deg); }

.menu-sub {
  background: var(--sidebar-bg-sub);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.menu-sub.is-open { max-height: 600px; }
.menu-sub .menu-item { padding-left: 52px; height: 40px; font-size: 13px; }

/* ---------- Main ---------- */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
}
.admin-header__collapse {
  cursor: pointer;
  font-size: 20px;
  color: #5a5e66;
  margin-right: 16px;
}
.admin-header__collapse:hover { color: var(--sidebar-active); }
.admin-header__breadcrumb { flex: 1; }
.admin-header__actions { display: flex; align-items: center; gap: 16px; }
.admin-header__action {
  color: #5a5e66;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 50px;
}
.admin-header__action:hover { color: var(--sidebar-active); background: rgba(64,158,255,0.06); }
.admin-header__avatar {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 0 8px;
  height: 50px;
}
.admin-header__avatar:hover { background: rgba(64,158,255,0.06); }

/* ---------- Big Data Product Selection ---------- */
.bdp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 1px solid #ebeef5; margin-bottom: 12px;
}
.bdp-stats { font-size: 14px; color: #606266; }
.bdp-stats b { font-size: 16px; }
.bdp-head__right { display: flex; align-items: center; gap: 12px; }
.bdp-body { display: flex; gap: 12px; }
.bdp-tree { width: 280px; flex-shrink: 0; border: 1px solid #ebeef5; border-radius: 4px; padding: 8px; }
.bdp-tree__toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.bdp-tree__list { max-height: 540px; overflow-y: auto; }
.bdp-node__fam {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 4px; font-weight: 600; color: #303133; cursor: pointer; font-size: 13px;
}
.bdp-node__fam:hover { color: var(--sidebar-active); }
.bdp-arrow { font-size: 10px; color: #909399; width: 12px; }
.bdp-node__subs { padding-left: 18px; }
.bdp-node__cat {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 4px; cursor: pointer; font-size: 13px; color: #606266;
}
.bdp-node__cat:hover { background: #f5f7fa; }
.bdp-count { color: #c0c4cc; font-size: 12px; margin-left: auto; }
.bdp-table { flex: 1; min-width: 0; }
.bdp-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid #ebeef5; }

/* ---------- Home sections editor ---------- */
.home-card {
  border: 1px solid #ebeef5; border-radius: 6px; margin-bottom: 14px; background: #fafbfc;
}
.home-card__head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid #ebeef5; background: #f5f7fa; border-radius: 6px 6px 0 0;
}
.home-card__idx { font-weight: 700; color: #606266; font-size: 13px; }
.home-card__movers { display: flex; }
.home-card__body { padding: 12px; }
.home-card__thumb { margin-top: 6px; max-width: 120px; max-height: 70px; border-radius: 4px; border: 1px solid #ebeef5; }
.form-section-title {
  margin: 18px 0 10px; padding: 6px 10px; font-size: 14px; font-weight: 600;
  color: #303133; background: #f0f2f5; border-radius: 4px; border-left: 3px solid var(--sidebar-active, #1540a8);
}

/* ---------- Product catalog editor ---------- */
.pcat-layout { display: flex; gap: 12px; margin-top: 8px; }
.pcat-fams { width: 220px; flex-shrink: 0; border: 1px solid #ebeef5; border-radius: 6px; max-height: 640px; overflow-y: auto; }
.pcat-fam { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f0f2f5; }
.pcat-fam:hover { background: #f5f7fa; }
.pcat-fam.is-active { background: #ecf5ff; color: var(--sidebar-active, #1540a8); font-weight: 600; border-left: 3px solid var(--sidebar-active, #1540a8); padding-left: 9px; }
.pcat-fam em { color: #c0c4cc; font-style: normal; font-size: 11px; }
.pcat-edit { flex: 1; min-width: 0; }
.pcat-fam-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pcat-fam-head h4 { margin: 0; font-size: 15px; }
.pcat-cats-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; }
.pcat-cat { border: 1px solid #ebeef5; border-radius: 6px; padding: 10px; margin-bottom: 12px; background: #fafbfc; }
.pcat-cat-head { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.pcat-prods { width: 100%; }

/* ---------- Replacement editor ---------- */
.rep-section { margin-top: 14px; border: 1px solid #ebeef5; border-radius: 6px; padding: 10px; background: #fafbfc; }
.rep-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rep-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; flex-wrap: wrap; }
.acat-group-label { padding: 8px 12px 4px; font-size: 11px; font-weight: 600; color: #909399; text-transform: uppercase; letter-spacing: .5px; border-top: 1px solid #f0f2f5; }
.acat-group-label:first-child { border-top: none; }

/* ---------- Tabs ---------- */
.admin-tabs {
  height: var(--tabs-h);
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
  overflow-x: auto;
}
.admin-tab {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  margin-right: 4px;
  border: 1px solid #d8dce5;
  border-radius: 3px;
  background: #fff;
  color: #495060;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.admin-tab.is-active { background: var(--sidebar-active); color: #fff; border-color: var(--sidebar-active); }
.admin-tab__close { margin-left: 6px; font-size: 12px; opacity: 0.6; }
.admin-tab__close:hover { opacity: 1; }

/* ---------- Content ---------- */
.admin-content {
  flex: 1;
  padding: 16px;
  overflow: auto;
  background: #f0f2f5;
}
.admin-card {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ---------- Toolbar (search/filter) ---------- */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-toolbar__right { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Table ---------- */
.admin-table { width: 100%; }
.admin-table .el-table { font-size: 13px; }
.admin-table .cell-thumb {
  width: 60px; height: 34px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid #ebeef5;
}

/* ---------- Pagination ---------- */
.admin-pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------- Form ---------- */
.admin-form { max-width: 900px; }
.admin-form .el-form-item__label { font-weight: 500; }
.body-block {
  border: 1px solid #ebeef5;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fafafa;
}
.body-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.body-block__type { width: 120px; }

/* ---------- Login ---------- */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #304156 0%, #1f2d3d 100%);
}
.login-card {
  width: 380px;
  padding: 32px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-card__title {
  text-align: center;
  margin: 0 0 24px;
  font-size: 22px;
  color: #303133;
}
.login-card__title span { color: var(--sidebar-active); }

/* ---------- Empty ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #909399;
}
.empty-state .el-icon { font-size: 48px; margin-bottom: 12px; }
