* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f4f6fa; color: #22242a; font-size: 14px;
}
button, input, select { font-family: inherit; font-size: 14px; }

/* 登录 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #4a67f5 100%);
}
.login-card {
  width: 380px; background: #fff; border-radius: 20px; padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15); text-align: center;
}
.logo {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 24px;
  background: linear-gradient(135deg, #6a83ff, #4a67f5); color: #fff;
  font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 32px; }
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; font-size: 13px; color: #8a8f9a; margin-bottom: 8px; }
.form-group input, .form-group select {
  width: 100%; padding: 12px 14px; border: 1px solid #e4e7ed; border-radius: 8px; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: #4a67f5; }
.btn-primary {
  background: #4a67f5; color: #fff; border: none; border-radius: 8px;
  padding: 12px 24px; cursor: pointer; font-weight: 600;
}
.btn-primary:hover { background: #3b56e0; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: #f2f3f5; color: #555; border: none; border-radius: 8px;
  padding: 10px 20px; cursor: pointer;
}
.login-card .btn-primary { width: 100%; margin-top: 10px; }
.login-tip { color: #e5484d; margin-top: 16px; font-size: 13px; min-height: 18px; }

/* 主布局 */
.main-view { min-height: 100vh; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid #eef0f4;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.brand { font-size: 18px; font-weight: 700; color: #4a67f5; }
.topbar-right { display: flex; align-items: center; gap: 16px; color: #666; }
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 200px;
  flex-shrink: 0;            /* 关键：禁止被右侧内容挤压变窄 */
  background: #fff;
  border-right: 1px solid #eef0f4;
  padding: 20px 0;
}
.menu-item {
  padding: 14px 20px;
  cursor: pointer;
  color: #555;
  border-left: 3px solid transparent;
  white-space: nowrap;       /* 菜单文字不换行、不裁切 */
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-item:hover { background: #f7f8fb; }
.menu-item.active { background: rgba(74,103,245,0.06); color: #4a67f5; border-left-color: #4a67f5; font-weight: 600; }
.content { flex: 1; min-width: 0; padding: 28px 32px; overflow-x: auto; }  /* min-width:0 防止表格撑破 flex 布局 */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; }

/* 表格 */
.table-wrap { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(20,24,40,0.04); }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid #f0f1f4; }
.data-table th { background: #fafbfc; color: #8a8f9a; font-weight: 500; font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table td img { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; }
.tag-status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; }
.tag-status.on { background: #e8f8f0; color: #1a9e65; }
.tag-status.off { background: #f2f3f5; color: #999; }
.row-actions button {
  border: none; background: none; cursor: pointer; color: #4a67f5; margin-right: 12px; padding: 4px;
}
.row-actions button.danger { color: #e5484d; }
.pagination { margin-top: 20px; display: flex; gap: 8px; justify-content: center; }
.pagination button {
  border: 1px solid #e4e7ed; background: #fff; border-radius: 6px; padding: 6px 14px; cursor: pointer;
}
.pagination button.active { background: #4a67f5; color: #fff; border-color: #4a67f5; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-dialog {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 92vh; display: flex; flex-direction: column;
}
.modal-large { max-width: 860px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px; border-bottom: 1px solid #eef0f4;
}
.modal-header h3 { font-size: 18px; }
.close { font-size: 28px; cursor: pointer; color: #999; line-height: 1; }
.modal-body { padding: 24px 28px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 28px; border-top: 1px solid #eef0f4;
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #444; }
.checkbox-label input { width: auto; }

/* 图片上传 */
.image-upload {
  width: 100%; height: 180px; border: 2px dashed #d8dce4; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; color: #aab0bb;
}
.image-upload img { width: 100%; height: 100%; object-fit: cover; }

/* 分类图片上传（小尺寸） */
.cat-image-upload { height: 130px; font-size: 13px; }

/* 颜色输入行 */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row-preview {
  width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0;
  background: #4a67f5; border: 1px solid rgba(0,0,0,0.08);
}
.color-row input[type=text] { flex: 1; }
.color-inline {
  position: relative; width: 38px; height: 38px; flex-shrink: 0;
  border: 1px solid #e4e7ed; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.color-inline input[type=color] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.field-hint { font-size: 12px; color: #9ca3af; margin-top: 6px; line-height: 1.5; }

/* 富文本编辑器 */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px;
  background: #f7f8fb; border: 1px solid #e4e7ed; border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.editor-toolbar button {
  border: 1px solid #e4e7ed; background: #fff; border-radius: 5px;
  padding: 5px 10px; cursor: pointer; color: #444; min-width: 34px;
}
.editor-toolbar button:hover { border-color: #4a67f5; color: #4a67f5; }

/* 字体颜色选择器 */
.tool-color-wrap { position: relative; }
.color-palette {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 24px);
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.color-swatch {
  width: 24px; height: 24px;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  transition: transform .12s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-custom {
  position: relative;
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 1px dashed #b8bdc7;
  color: #888;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.color-custom input[type=color] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.rich-editor {
  min-height: 320px; padding: 16px; border: 1px solid #e4e7ed; border-radius: 0 0 8px 8px;
  outline: none; line-height: 1.8; font-size: 15px; overflow-y: auto; max-height: 50vh;
}
.rich-editor:empty:before { content: attr(data-placeholder); color: #bbb; }
.rich-editor img { max-width: 100%; height: auto; }

.notice {
  background: rgba(74,103,245,0.07); color: #5a6a9e; padding: 14px 18px;
  border-radius: 8px; margin-bottom: 20px; line-height: 1.6; font-size: 13px;
}

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #323233; color: #fff; padding: 12px 24px; border-radius: 8px;
  z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
