/* 后台整体布局:左侧菜单 + 右侧内容 */

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  color: #333;
  background: #f5f6f8;
}

.layout { display: flex; min-height: 100vh; }

/* ---------- 侧边菜单 ---------- */

.sidebar {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #2b3245;
  color: #aeb9c9;
}

.logo {
  padding: 18px 16px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav { flex: 1; padding: 10px 0; }

.nav a {
  display: block;
  padding: 11px 20px;
  color: #aeb9c9;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav a.active {
  color: #fff;
  background: rgba(255, 80, 0, 0.15);
  border-left-color: #ff5000;
}

/* 侧边栏分组标题(点击展开/收起) */
.nav-group-title {
  padding: 14px 20px 4px;
  font-size: 12px;
  color: #7d8899;
  letter-spacing: 1px;
  user-select: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-group-title:hover { color: #aeb9c9; }
.nav-group-arrow {
  transition: transform 0.15s;
  font-size: 11px;
}
.nav-group-title.collapsed .nav-group-arrow { transform: rotate(-90deg); }

.nav-group-items.collapsed { display: none; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.who { font-size: 13px; margin-bottom: 8px; }
.who::before { content: "👤 "; }

.sidebar-foot button {
  width: 100%;
  padding: 6px 0;
  border: 1px solid #4a5468;
  border-radius: 4px;
  background: none;
  color: #aeb9c9;
  font-size: 13px;
  cursor: pointer;
}
.sidebar-foot button:hover { border-color: #ff5000; color: #ff6a26; }

.home-link {
  display: block;
  margin-top: 10px;
  text-align: center;
  color: #8a96ab;
  font-size: 12px;
}
.home-link:hover { color: #fff; }

/* ---------- 主区域 ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}
.topbar h1 { margin: 0; font-size: 17px; color: #333; }

.view { display: none; padding: 16px 22px 30px; }
.view.active { display: block; }

.block-title { font-size: 14px; color: #666; margin: 16px 0 4px; }

/* ---------- 登录页 ---------- */

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2b3245 0%, #3d2c3f 100%);
}

.login-card {
  width: 320px;
  padding: 34px 30px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
  color: #ff5000;
  text-align: center;
}
.login-sub {
  margin: 6px 0 22px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.login-card input {
  margin-bottom: 12px;
  padding: 9px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #ff5000; }

.login-err {
  min-height: 18px;
  margin-bottom: 6px;
  color: #c62828;
  font-size: 12px;
}

.login-card button {
  padding: 9px 0;
  border: none;
  border-radius: 4px;
  background: #ff5000;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login-card button:hover { background: #e64800; }

/* ---------- 筛选栏 ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filters select,
.filters input {
  padding: 6px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}

.filters input[type="search"] { width: 220px; }

.filters button {
  padding: 6px 18px;
  border: none;
  border-radius: 4px;
  background: #ff5000;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.filters button:hover { background: #e64800; }

.filters .btn-plain {
  border: 1px solid #d9d9d9;
  background: #fff;
  color: #555;
}
.filters .btn-plain:hover { border-color: #ff5000; color: #ff5000; background: #fff; }

.filters .check-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}
.filters .check-inline input { width: auto; }

/* ---------- 统计标签 ---------- */

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }

.chip {
  padding: 3px 10px;
  border-radius: 12px;
  background: #f0f1f3;
  font-size: 12px;
  white-space: nowrap;
}
.chip.good    { background: #e6f7e9; color: #2e7d32; }
.chip.neutral { background: #fff7e0; color: #a07400; }
.chip.bad     { background: #fdeaea; color: #c62828; }
.chip.unknown { background: #eeeeee; color: #757575; }

/* ---------- 表格 ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #fafafa;
  font-weight: 600;
  white-space: nowrap;
  z-index: 1;
}

td.empty {
  text-align: center;
  color: #999;
  padding: 40px 0;
}

td.num-bad { color: #c62828; font-weight: 600; }
td.err-cell { color: #c62828; word-break: break-all; }

td.cell-id {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.badge.good    { background: #e6f7e9; color: #2e7d32; }
.badge.neutral { background: #fff7e0; color: #a07400; }
.badge.bad     { background: #fdeaea; color: #c62828; }
.badge.unknown { background: #eeeeee; color: #757575; }

/* 采集日志状态 */
.badge.st-done    { background: #e6f7e9; color: #2e7d32; }
.badge.st-running { background: #e3f2fd; color: #1565c0; }
.badge.st-error   { background: #fdeaea; color: #c62828; }
.badge.st-aborted { background: #eeeeee; color: #757575; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 4px;
}

.content .main  { white-space: pre-wrap; word-break: break-word; }
.content .append {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #eee;
  color: #888;
  white-space: pre-wrap;
  word-break: break-word;
}

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  margin: 2px;
  cursor: pointer;
  border: 1px solid #eee;
}
.thumb:hover { border-color: #ff5000; }

.reply { color: #555; white-space: pre-wrap; word-break: break-word; }

/* ---------- 商品行 ---------- */

.product-pic {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #eee;
  display: block;
}

.product-title {
  font-weight: 600;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-sub {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: #999;
  font-size: 12px;
}

.level-chips { white-space: nowrap; }
.level-chips .chip { margin: 1px 4px 1px 0; }

.btn-view {
  padding: 5px 12px;
  border: 1px solid #ff5000;
  border-radius: 4px;
  background: #fff;
  color: #ff5000;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-view:hover { background: #ff5000; color: #fff; }

.btn-del {
  padding: 5px 12px;
  border: 1px solid #c62828;
  border-radius: 4px;
  background: #fff;
  color: #c62828;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 8px;
}
.btn-del:hover { background: #c62828; color: #fff; }

/* ---------- 分页 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  color: #666;
}

.pager button {
  padding: 5px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager button:not(:disabled):hover { border-color: #ff5000; color: #ff5000; }

/* ---------- 评价弹窗 ---------- */

body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.hidden { display: none; }

.modal-box {
  background: #fff;
  border-radius: 8px;
  width: min(1100px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
}

.modal-title { display: flex; gap: 10px; min-width: 0; }

.modal-title h2 {
  margin: 0 0 4px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-all;
}

.modal-pic {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #eee;
  flex-shrink: 0;
}

.modal-meta { color: #999; font-size: 12px; }

.modal-head > button {
  border: none;
  background: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}
.modal-head > button:hover { color: #333; }

.modal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}
.modal-filters select,
.modal-filters input {
  padding: 5px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.modal-filters input[type="search"] { width: 190px; }

.modal-body { overflow: auto; }
.modal-body table { margin-top: 0; }

.modal-box .pager { border-top: 1px solid #eee; }
