* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* 顶部栏 */
.header {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e4e7ed;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: #2c3e50;
  letter-spacing: 1px;
}

/* 主体 */
.main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* 左侧导航 */
.sidebar {
  flex: 0 0 180px;
  background: #fff;
  border-right: 1px solid #e4e7ed;
  padding: 12px 0;
}

.nav-item {
  padding: 12px 24px;
  font-size: 15px;
  color: #606266;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover {
  background: #f5f7fa;
  color: #2c3e50;
}

.nav-item.active {
  background: #ecf5ff;
  color: #409eff;
  border-left-color: #409eff;
  font-weight: bold;
}

/* 右侧内容 */
.content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.content h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #2c3e50;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar h2 {
  margin-bottom: 0;
}

.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 表格 */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
  white-space: nowrap;
}

.table th {
  background: #fafafa;
  color: #606266;
  font-weight: bold;
}

.table tbody tr:hover {
  background: #f5f9ff;
}

.table .col-no {
  width: 56px;
  text-align: center;
  color: #909399;
}

.table .col-op {
  width: 180px;
}

.filter-row th {
  padding: 6px 8px;
  background: #fff;
}

.filter-row input {
  width: 100%;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 12px;
  color: #333;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  outline: none;
}

.filter-row input:focus {
  border-color: #409eff;
}

.empty {
  display: none;
  padding: 32px 0;
  text-align: center;
  color: #909399;
  font-size: 14px;
}

.empty.show {
  display: block;
}

/* 等级标记 */
.badge {
  display: inline-block;
  min-width: 32px;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
}

.badge-high {
  background: #e7f6ec;
  color: #2f855a;
}

.badge-mid {
  background: #fdf3e0;
  color: #9c6500;
}

.badge-low {
  background: #f0f0f0;
  color: #808080;
}

.badge-over {
  background: #fcebeb;
  color: #a32d2d;
  font-weight: bold;
}

/* 按钮 */
.btn-primary,
.btn-plain,
.link {
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.btn-primary {
  padding: 8px 18px;
  font-size: 14px;
  color: #fff;
  background: #409eff;
  border: none;
}

.btn-primary:hover {
  background: #337ecc;
}

.btn-plain {
  padding: 8px 18px;
  font-size: 14px;
  color: #606266;
  background: #fff;
  border: 1px solid #dcdfe6;
}

.btn-plain:hover {
  background: #f5f7fa;
}

.link {
  padding: 2px 4px;
  margin-right: 8px;
  font-size: 12px;
  color: #409eff;
  background: none;
  border: none;
}

.link:hover {
  color: #337ecc;
  text-decoration: underline;
}

.link.danger {
  color: #e47470;
}

/* 弹窗 */
body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: 560px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  background: #fff;
  border-radius: 10px;
}

.modal-box h3 {
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 500;
  color: #2c3e50;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #606266;
}

.form-grid input,
.form-grid select {
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #333;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: #409eff;
}

.field-full {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 13px;
  color: #606266;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
}

.dropdown {
  position: relative;
  margin-top: 6px;
}

.dropdown-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  color: #333;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  cursor: pointer;
}

.dropdown-toggle:hover,
.dropdown-toggle.open {
  border-color: #409eff;
}

#product-display.placeholder {
  color: #a8abb2;
}

.caret {
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: #909399;
  margin-top: 4px;
  flex: none;
}

.dropdown-menu {
  position: fixed;
  z-index: 100;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-search {
  padding: 8px;
  border-bottom: 1px solid #ebeef5;
}

.dropdown-search input {
  width: 100%;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 12px;
  color: #333;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  outline: none;
}

.dropdown-search input:focus {
  border-color: #409eff;
}

.dropdown-list {
  max-height: 200px;
  overflow: auto;
  padding: 4px 0;
}

.dropdown-item,
.form-grid .dropdown-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  color: #333;
  background: none;
  border: none;
  cursor: pointer;
}

.dropdown-item:hover {
  background: #f5f7fa;
}

.dropdown-item input {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: none;
  cursor: pointer;
}

.dropdown-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item.add-item {
  color: #409eff;
}

.dropdown-item.item-disabled {
  color: #a8abb2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* 产品分类侧栏（纵向） */
.products-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.category-panel {
  flex: 0 0 170px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  padding: 10px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-title {
  padding: 6px 16px 10px;
  font-size: 12px;
  font-weight: bold;
  color: #909399;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px 9px 13px;
  font-size: 13px;
  color: #606266;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.2s, color 0.2s;
}

.category-item:hover {
  background: #f5f7fa;
  color: #2c3e50;
}

.category-item.active {
  background: #ecf5ff;
  color: #409eff;
  border-left-color: #409eff;
  font-weight: bold;
}

.category-item .count {
  font-size: 12px;
  color: #a8abb2;
}

.category-item.active .count {
  color: #409eff;
}

.chip-del {
  border: none;
  background: none;
  padding: 0 2px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  color: #a8abb2;
  cursor: pointer;
  flex: none;
}

.chip-del:hover {
  color: #e47470;
}

.btn-category-add {
  margin: 10px 12px 4px;
  padding: 6px 0;
  font-family: inherit;
  font-size: 12px;
  color: #409eff;
  background: none;
  border: 1px dashed #b1d2f7;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-category-add:hover {
  border-color: #409eff;
}

/* 分类选择下拉（输入 + 点选） */
.field-combo {
  position: relative;
  display: flex;
  flex-direction: column;
}

.field-combo input {
  padding-right: 26px;
}

.combo-toggle {
  position: absolute;
  right: 8px;
  top: 26px;
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: #909399;
  cursor: pointer;
}

.combo-toggle:hover {
  color: #409eff;
}

.combo-menu {
  position: fixed;
  z-index: 100;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.combo-item {
  padding: 7px 10px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.combo-item:hover {
  background: #f5f9ff;
  color: #409eff;
}

.combo-item.current {
  color: #409eff;
  font-weight: bold;
}

.products-main {
  flex: 1;
  min-width: 0;
}

/* 基础设置 */
.setting-title {
  font-size: 15px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 4px;
}

.setting-tip {
  font-size: 12px;
  color: #a8abb2;
  margin-bottom: 14px;
}

.setting-add {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.setting-add input {
  flex: 1;
  max-width: 320px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #333;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  outline: none;
}

.setting-add input:focus {
  border-color: #409eff;
}

/* 二级导航分组 */
.nav-parent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: bold;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
}

.nav-parent:hover {
  color: #409eff;
}

.nav-parent .nav-arrow {
  font-size: 12px;
  color: #909399;
  transition: transform 0.2s;
}

.nav-parent.collapsed .nav-arrow {
  transform: rotate(-90deg);
}

.nav-children.collapsed {
  display: none;
}

.nav-children .nav-item.sub-item {
  padding-left: 36px;
  font-size: 14px;
  border-left: none;
}

.nav-children .nav-item.sub-item.active {
  border-left: 3px solid #409eff;
  padding-left: 33px;
}

#source-table {
  max-width: 560px;
}

#source-table .col-op {
  width: 120px;
}

.placeholder-text {
  padding: 24px 0;
  text-align: center;
  color: #909399;
  font-size: 14px;
}

/* 基础信息页：右侧维护区宽度收窄到原可用宽度的 2/3 */
#settings-view .products-main {
  flex: 0 0 auto;
  width: calc((100% - 186px) * 5 / 6);
}

/* 资讯编辑 */
.modal-box.modal-lg {
  width: 720px;
  max-width: 94vw;
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cover-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cover-row input {
  flex: 1;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  color: #606266;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 1px solid #dcdfe6;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #fafafa;
}

.editor-btn {
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  color: #606266;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  cursor: pointer;
}

.editor-btn:hover {
  color: #409eff;
  border-color: #409eff;
}

.editor {
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  border: 1px solid #dcdfe6;
  border-radius: 0 0 6px 6px;
  outline: none;
}

.editor:focus {
  border-color: #409eff;
}

.editor img {
  max-width: 100%;
  height: auto;
  margin: 6px 0;
}

.editor h3 {
  margin: 8px 0;
  font-size: 15px;
}
