/* 博凯大姜 · 后端管理平台 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #E6F0FB; color: #303133; font-size: 14px;
}
a { color: #E64340; text-decoration: none; }

/* ===== 顶栏(渐变) ===== */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #C8102E 0%, #E64340 55%, #FF7A59 100%);
  color: #fff; padding: 0 24px; box-shadow: 0 2px 10px rgba(200, 16, 46, .28);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand { display: flex; align-items: baseline; gap: 10px; }
.topbar .brand b { font-size: 17px; letter-spacing: 1px; }
.topbar .brand span { font-size: 12px; opacity: .85; }
.topbar .user { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar .user a { color: #fff; opacity: .9; }
.topbar .user a:hover { opacity: 1; text-decoration: underline; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 176px; background: #fff; padding: 10px 0 20px; flex-shrink: 0;
  border-right: 1px solid #EBEEF2;
}
.nav-group { margin-top: 12px; }
.nav-group .group-title {
  font-size: 11px; color: #909399; padding: 2px 20px 4px; letter-spacing: 1px;
}
.nav-item {
  display: block; padding: 7px 20px; color: #606266; font-size: 13.5px;
  border-left: 3px solid transparent; transition: all .15s;
}
.nav-item:hover { color: #E64340; background: #FEF4F4; }
.nav-item.active {
  color: #E64340; font-weight: 600; background: #FEF0F0;
  border-left-color: #E64340;
}
.main { flex: 1; padding: 18px 22px 40px; min-width: 0; }

/* ===== 通用组件 ===== */
.card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(31, 45, 61, .06); margin-bottom: 16px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-head h2 { font-size: 18px; }
.page-head .sub { color: #909399; font-size: 12.5px; margin-top: 4px; }

.btn {
  display: inline-block; border: none; cursor: pointer; font-size: 13px;
  border-radius: 8px; padding: 7px 16px; transition: all .15s; line-height: 1.4;
}
.btn-primary { background: linear-gradient(135deg, #E64340, #FF7A59); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 3px 10px rgba(230, 67, 64, .35); }
.btn-plain { background: #fff; color: #E64340; border: 1px solid #F3B3B2; }
.btn-plain:hover { background: #FEF4F4; }
.btn-gray { background: #F0F2F5; color: #606266; }
.btn-gray:hover { background: #E8EBF0; }
.btn-danger { background: #fff; color: #F56C6C; border: 1px solid #FBD0D0; }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #F0F2F5; }
.table th { font-size: 12.5px; color: #909399; font-weight: 600; background: #FAFBFC; white-space: nowrap; }
.table tr:hover td { background: #FDF7F7; }
.table td { font-size: 13px; vertical-align: middle; }
.table .num { font-variant-numeric: tabular-nums; }
.up { color: #E64340; font-weight: 600; }
.down { color: #0AA858; font-weight: 600; }
.flat { color: #909399; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
  background: #F0F2F5; color: #606266;
}
.tag-red { background: #FEF0F0; color: #E64340; }
.tag-green { background: #EAF7F0; color: #0AA858; }
.tag-blue { background: #EBF3FF; color: #2E7CF6; }
.tag-orange { background: #FFF4E6; color: #E8842B; }
.tag-purple { background: #F3EEFF; color: #7B4CE0; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-item { display: flex; flex-direction: column; gap: 5px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 12.5px; color: #606266; }
.form-item label .req { color: #E64340; margin-left: 2px; }
.form-item input, .form-item select, .form-item textarea {
  border: 1px solid #DCDFE6; border-radius: 8px; padding: 7px 11px; font-size: 13px;
  outline: none; transition: border .15s; font-family: inherit; background: #fff;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: #E64340; }
.form-item textarea { resize: vertical; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(31, 45, 61, .45); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; overflow: auto; padding: 60px 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 640px; max-width: 100%;
  box-shadow: 0 12px 40px rgba(31, 45, 61, .22); animation: pop .18s ease;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid #F0F2F5;
  background: linear-gradient(135deg, #C8102E, #E64340); border-radius: 14px 14px 0 0;
  color: #fff;
}
.modal-head b { font-size: 15px; }
.modal-head .close { cursor: pointer; font-size: 18px; opacity: .85; background: none; border: none; color: #fff; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 10px; }
@keyframes pop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* flash 提示 */
.flash { border-radius: 10px; padding: 10px 16px; margin-bottom: 14px; font-size: 13.5px; }
.flash.success { background: #EAF7F0; color: #0AA858; border: 1px solid #BEE8D2; }
.flash.error { background: #FEF0F0; color: #E64340; border: 1px solid #F9CFCF; }

/* 仪表盘 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(31, 45, 61, .06); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(#E64340, #FF7A59);
}
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { color: #909399; font-size: 12.5px; margin-top: 3px; }
.stat.hl .v { color: #E64340; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #EBEEF2; margin-bottom: 14px; }
.tabs a {
  padding: 8px 16px; color: #606266; font-size: 13.5px; border-bottom: 2px solid transparent;
}
.tabs a.active { color: #E64340; font-weight: 600; border-bottom-color: #E64340; }
.tabs .count {
  display: inline-block; background: #E64340; color: #fff; border-radius: 10px;
  font-size: 11px; padding: 0 6px; margin-left: 4px; vertical-align: 1px;
}

/* 档位横向筛选条 */
.grade-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch; flex-shrink: 0;
}
.grade-tabs::-webkit-scrollbar { height: 0; }
.grade-tabs a {
  flex: 0 0 auto; padding: 5px 15px; font-size: 13px; color: #606266;
  background: #F4F5F7; border: 1px solid #EBEEF2; border-radius: 999px;
  white-space: nowrap; transition: all .15s;
}
.grade-tabs a:hover { color: #E64340; border-color: #f3b6b4; }
.grade-tabs a.active { background: #E64340; color: #fff; border-color: #E64340; font-weight: 600; }

/* 微信文章导入卡片 */
.import-card { margin-bottom: 14px; }
.import-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.import-head b { font-size: 14.5px; }
.import-row { display: flex; gap: 8px; }
.import-input {
  flex: 1; border: 1px solid #DCDFE6; border-radius: 8px; padding: 8px 12px;
  font-size: 13px; outline: none; transition: border-color .15s;
}
.import-input:focus { border-color: #E64340; }
.import-actions { margin-top: 10px; }
.parse-table-wrap { max-height: 420px; overflow: auto; border: 1px solid #EBEEF2; border-radius: 8px; margin-top: 10px; }
.parse-table { margin: 0; }
.parse-table th { position: sticky; top: 0; background: #F8F9FB; z-index: 1; }

/* 价格走势管理 */
.trend-filter { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.trend-filter-form { display: flex; align-items: center; gap: 8px; }
.tf-label { font-size: 13px; color: #4E5969; font-weight: 600; }
.tf-select {
  min-width: 300px; border: 1px solid #DCDFE6; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; outline: none; background: #fff;
}
.tf-select:focus { border-color: #E64340; }
.trend-cur { display: flex; flex-direction: column; gap: 2px; margin-left: auto; text-align: right; }
.tc-name { font-size: 14px; font-weight: 600; }
.tc-meta { font-size: 12px; }
.tc-price { font-size: 22px; font-weight: 700; line-height: 1.2; }
.tc-chg { font-size: 12px; font-weight: 400; color: #86909C; }
.chart-card { margin-bottom: 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.rtabs { display: flex; gap: 4px; }
.rtabs .rt {
  padding: 3px 12px; border-radius: 14px; font-size: 12px; color: #4E5969;
  background: #F2F3F5; border: 1px solid transparent;
}
.rtabs .rt:hover { color: #E64340; }
.rtabs .rt.on { background: #E64340; color: #fff; font-weight: 600; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.ts-item {
  flex: 1; background: #fff; border: 1px solid #EBEEF2; border-radius: 10px;
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ts-item b { font-size: 18px; }
.ts-item span { font-size: 12px; color: #86909C; }
.ck-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4E5969; }
.ck-line input { margin: 0; }

/* tiers 行编辑 */
.tier-row { display: grid; grid-template-columns: 1fr 1fr 1fr 96px 32px; gap: 8px; margin-bottom: 8px; }
.tier-row input, .tier-row select {
  border: 1px solid #DCDFE6; border-radius: 7px; padding: 6px 9px; font-size: 13px; outline: none;
}
.tier-row input:focus, .tier-row select:focus { border-color: #E64340; }
.tier-del { border: none; background: #FEF0F0; color: #E64340; border-radius: 7px; cursor: pointer; }

/* JSON 编辑器 */
.json-editor {
  width: 100%; min-height: 460px; font-family: Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 1.6; border: 1px solid #DCDFE6; border-radius: 10px;
  padding: 14px; outline: none; white-space: pre; overflow: auto; background: #FAFBFC;
}
.json-editor:focus { border-color: #E64340; background: #fff; }

/* 登录页 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #1E3A8A 0%, #2563EB 45%, #60A5FA 100%);
}
.login-card {
  width: 380px; background: #fff; border-radius: 16px; padding: 36px 38px 32px;
  box-shadow: 0 16px 48px rgba(30, 58, 138, .35);
}
.login-card .logo { text-align: center; margin-bottom: 8px; font-size: 22px; font-weight: 700; color: #1E40AF; }
.login-card .tip { text-align: center; color: #909399; font-size: 12.5px; margin-bottom: 24px; }
.login-card .form-item { margin-bottom: 14px; }
.login-card input {
  border: 1px solid #DCDFE6; border-radius: 9px; padding: 10px 13px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: #2563EB; }
.login-card .btn-primary {
  width: 100%; padding: 11px; font-size: 15px; margin-top: 6px;
  background: linear-gradient(135deg, #2563EB, #60A5FA);
}
.login-card .btn-primary:hover { box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }

.actions { display: flex; gap: 6px; white-space: nowrap; }
.muted { color: #909399; }
.empty { text-align: center; color: #909399; padding: 40px 0; }
code.inline { background: #F4F5F7; border-radius: 5px; padding: 1px 7px; font-size: 12.5px; color: #C8102E; }

/* ===== 轮播图管理 ===== */
.banner-thumb {
  width: 160px; height: 64px; object-fit: cover; border-radius: 8px;
  border: 1px solid #EBEEF2; background: #F4F5F7; display: block;
}
.banner-preview {
  width: 320px; max-width: 100%; height: 128px; object-fit: cover;
  border-radius: 8px; border: 1px dashed #DCDFE6; background: #F4F5F7;
}
.upload-area { display: flex; flex-direction: column; gap: 8px; }
.upload-box {
  border: 1.5px dashed #DCDFE6; border-radius: 10px; background: #FAFBFC;
  padding: 22px 16px; text-align: center; font-size: 13px; color: #606266;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.upload-box:hover { border-color: #E64340; background: #FEF7F7; }
.upload-icon { font-size: 22px; color: #C0C4CC; margin-bottom: 6px; }
.upload-ops { display: flex; align-items: center; gap: 10px; }
.upload-size { font-size: 12.5px; color: #0AA858; }

/* 轮播图跳转配置(单选组 + 条件字段) */
.link-config { grid-column: 1 / -1; border-top: 1px dashed #EBEEF2; padding-top: 13px; }
.link-head { font-size: 13px; font-weight: 600; color: #303133; margin-bottom: 9px; }
.link-type-group { display: flex; gap: 26px; flex-wrap: wrap; }
.link-radio {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px;
  color: #303133; cursor: pointer; font-weight: 400; user-select: none;
}
.link-radio input[type="radio"] { accent-color: #E64340; width: 15px; height: 15px; margin: 0; cursor: pointer; }
.link-radio:hover { color: #E64340; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; padding: 6px 8px; border-right: none; border-bottom: 1px solid #EBEEF2; }
  .nav-group { margin: 0; display: flex; }
  .nav-group .group-title { display: none; }
  .nav-item { border-left: none; border-radius: 8px; padding: 6px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .tab-search { width: 100%; margin: 6px 0 4px; }
  .tab-search input { flex: 1; width: auto; }
}

/* ===== 价格在线(货源)管理 ===== */
.table-wrap { overflow-x: auto; }
.src-thumb {
  width: 52px; height: 52px; border-radius: 8px; background: #F4F5F7;
  border: 1px solid #EBEEF2; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #C0C4CC;
}
.src-thumb::before { content: '无图'; }
.src-thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.src-tags { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.src-preview {
  width: 160px; height: 160px; max-width: 100%; object-fit: cover;
  border-radius: 8px; border: 1px dashed #DCDFE6; background: #F4F5F7;
}
.tab-search { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-bottom: 6px; }
.tab-search input {
  border: 1px solid #DCDFE6; border-radius: 8px; padding: 6px 11px;
  font-size: 13px; outline: none; width: 250px; font-family: inherit;
}
.tab-search input:focus { border-color: #E64340; }
.flash.warning { background: #FFF9EC; color: #E6A23C; border: 1px solid #F7DFAD; }

/* ===== 分享管理 ===== */
.tip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; margin-left: 6px;
  background: #C0C4CC; color: #fff; font-size: 11px; cursor: help;
  user-select: none; vertical-align: 1px; flex-shrink: 0;
}
.share-layout {
  display: grid; grid-template-columns: minmax(420px, 1fr) 320px;
  gap: 16px; align-items: start;
}
.share-preview-img {
  width: 100%; max-width: 360px; height: 150px; object-fit: cover;
  border-radius: 8px; border: 1px dashed #DCDFE6; background: #F4F5F7; display: block;
}
.wx-card {
  border: 1px solid #EBEEF2; border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 10px rgba(31, 45, 61, .08);
}
.wx-card-img { position: relative; height: 224px; background: #F4F5F7; }
.wx-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wx-card-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #C0C4CC; font-size: 13px; text-align: center; line-height: 1.7;
}
.wx-card-title {
  padding: 9px 11px 5px; font-size: 13.5px; line-height: 1.45; color: #303133; min-height: 49px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wx-card-meta {
  display: flex; align-items: center; gap: 6px; padding: 0 11px 10px;
  font-size: 11.5px; color: #909399;
}
.wx-card-logo {
  width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(135deg, #C8102E, #FF7A59); flex-shrink: 0;
}
@media (max-width: 860px) {
  .share-layout { grid-template-columns: 1fr; }
}

/* ===== 市场风向 · 微信文章识别 ===== */
.wx-parse { padding: 13px 16px; }
.wx-parse-row { display: flex; gap: 10px; align-items: center; }
.wx-parse-ic {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #07C160, #06AD56);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(7, 193, 96, .3);
}
.wx-parse input {
  flex: 1; border: 1px solid #DCDFE6; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; outline: none;
  font-family: inherit; transition: all .15s; min-width: 0;
}
.wx-parse input:focus {
  border-color: #07C160;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, .13);
}
.btn-wx { background: linear-gradient(135deg, #07C160, #06AD56); color: #fff; flex: none; }
.btn-wx:hover { filter: brightness(1.06); box-shadow: 0 3px 10px rgba(7, 193, 96, .35); }
.btn-wx:disabled { opacity: .65; cursor: not-allowed; filter: none; box-shadow: none; }
.parsed-note {
  padding: 7px 11px; border-radius: 7px;
  background: #E8F8EF; color: #067A43; font-size: 12.5px;
  border: 1px solid #BFE9D2;
}
@media (max-width: 720px) {
  .wx-parse-row { flex-wrap: wrap; }
  .wx-parse input { width: 100%; flex-basis: 100%; order: 3; }
}
