/* ============================================================
   管理后台专用样式（需先加载 style.css 复用变量与品牌栏）
   ============================================================ */
/* 作者样式会覆盖浏览器对 hidden 的默认处理，这里显式兜底 */
[hidden] { display: none !important; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-head {
  padding: 30px 30px 24px;
  color: #fff;
  background: radial-gradient(circle at 88% 10%, rgba(79, 198, 232, .32), transparent 45%),
              linear-gradient(125deg, var(--navy-900), var(--blue-600));
}
.login-head .brand-mark { background: #fff; box-shadow: none; }
.login-head .brand-text strong { color: #fff; }
.login-head .brand-text small { color: rgba(255, 255, 255, .6); }
.login-head h1 { margin: 20px 0 4px; font-size: 22px; letter-spacing: .5px; }
.login-head p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .72); }
.login-body { padding: 26px 30px 30px; }
.login-body label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 600; color: var(--navy-800);
}
.login-body input[type="password"] { font-size: 15px; padding: 12px 14px; }
.login-body .msg { margin-top: 14px; }
.login-foot {
  display: block; margin-top: 18px;
  text-align: center; font-size: 12px; color: var(--muted);
  text-decoration: none;
}
.login-foot:hover { color: var(--blue-600); }

/* ---------- 后台主体 ---------- */
.admin-header { background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-header-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-header-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.link-submit { color: var(--blue-600); text-decoration: none; }
.link-submit:hover { text-decoration: underline; }
.btn-ghost, .btn-outline {
  font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  background: #fff;
  color: var(--blue-600);
  border: 1px solid #cfe0f2;
  transition: all .16s;
}
.btn-ghost svg, .btn-outline svg { width: 15px; height: 15px; flex: none; }
.btn-ghost:hover, .btn-outline:hover { background: #eef6fe; border-color: var(--blue-500); }
.admin-main { padding: 26px 0 64px; }
.admin-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-title h2 { margin: 0; font-size: 22px; color: var(--navy-900); }
.admin-title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* 统计卡片 */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
}
.stat-num { font-size: 26px; line-height: 1.2; font-weight: 700; color: var(--navy-800); }
.stat-label { margin-top: 3px; font-size: 12px; color: var(--muted); }
.stat.is-pending .stat-num { color: var(--amber-dark); }
.stat.is-feature .stat-num { color: var(--blue-600); }
.stat.is-pain .stat-num { color: #c96a12; }
.stat.is-efficiency .stat-num { color: #128665; }

/* 筛选栏 */
.filter-bar {
  display: flex; flex-wrap: nowrap; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.filter-bar select, .filter-bar input {
  font: inherit; font-size: 13px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background-color: #fbfdff; /* 用 background-color，避免覆盖全局 SVG 箭头 */
  color: var(--ink);
  outline: none;
  min-width: 0; /* 允许 flex 收缩，保证一行不换行 */
}
.filter-bar select {
  flex: 0 0 150px;
  background-position: right 14px center;
  background-size: 11px 11px;
  padding-right: 34px;
}
.filter-bar input { flex: 1 1 auto; }
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(33, 137, 212, .12);
}
.filter-bar .btn-outline { flex: 0 0 auto; padding: 8px 18px; white-space: nowrap; }
.list-meta { font-size: 12px; color: var(--muted); margin: 0 2px 12px; }

/* 反馈卡片 */
.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 17px 20px;
  margin-bottom: 12px;
  transition: border-color .16s, box-shadow .16s;
}
.item:hover { border-color: #c8dcee; box-shadow: 0 6px 18px rgba(9, 43, 76, .06); }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.item-id { font-variant-numeric: tabular-nums; color: #9aabbb; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.badge.feature { background: #e7f2fd; color: #1769ad; }
.badge.pain { background: #fdf0e6; color: #c96a12; }
.badge.efficiency { background: #e6f7f2; color: #128665; }
.item-name { color: var(--navy-700); font-weight: 600; }
.item-content {
  font-size: 14px; line-height: 1.8; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  /* 默认最多三行，超出隐藏 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
/* 展开态：取消行数限制，显示完整内容 */
.item-content.expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
/* 展开/折叠按钮：仅超过三行时显示 */
.expand-btn {
  margin-top: 7px;
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; font-size: 12px;
  color: var(--blue-600);
  background: none; border: 0; padding: 2px 0;
  cursor: pointer;
}
.expand-btn[hidden] { display: none; }
.expand-btn svg { width: 13px; height: 13px; }
.expand-btn:hover { color: var(--blue-500); text-decoration: underline; }
.item-foot {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 10px;
  margin-top: 13px; padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted);
}
/* 联系方式占左侧弹性空间，状态下拉框始终靠右，两者保持同一行 */
.item-foot > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.item-foot .status-select { flex: 0 0 auto; }
.status-select {
  font: inherit; font-size: 12px;
  width: auto; /* 覆盖全局 select 的 width:100%，否则下拉撑满整行无法与联系方式同行 */
  padding: 5px 30px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff; /* 用 background-color，避免覆盖全局 SVG 箭头 */
  background-position: right 9px center;
  background-size: 10px 10px;
  color: var(--navy-700);
  cursor: pointer;
  transition: background-color .16s, border-color .16s, color .16s;
}
/* 状态配色：待处理=橙 / 处理中=蓝 / 已处理=绿 */
.status-select.st-0 { color: #b45309; background-color: #fff7ed; border-color: #fed7aa; }
.status-select.st-1 { color: #1d4ed8; background-color: #eff6ff; border-color: #bfdbfe; }
.status-select.st-2 { color: #15803d; background-color: #f0fdf4; border-color: #bbf7d0; }
.empty {
  text-align: center; padding: 54px 20px;
  color: var(--muted); font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 13px;
}

/* 分页 */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 22px; font-size: 13px; color: var(--muted);
}
.pagination button {
  font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 15px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff; color: var(--blue-600);
  cursor: pointer;
}
.pagination button svg { width: 14px; height: 14px; flex: none; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   分析总结：按钮 / 时间范围弹框 / 报告弹框
   ============================================================ */
.admin-title-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-analyze {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: #fff;
  background: linear-gradient(125deg, var(--blue-600), var(--blue-500));
  border: 0; border-radius: 9px;
  padding: 8px 15px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(23, 105, 173, .24);
  transition: transform .16s, box-shadow .16s;
}
.btn-analyze svg { width: 15px; height: 15px; color: var(--amber); flex: none; }
.btn-analyze:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(23, 105, 173, .32); }

.analyze-modal { width: min(440px, 100%); text-align: center; }
.analyze-icon {
  width: 52px; height: 52px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
}
.analyze-icon svg { width: 26px; height: 26px; color: var(--amber); }
.analyze-modal h3 { margin: 0 0 6px; font-size: 20px; color: var(--navy-800); }
.analyze-sub { margin: 0 0 18px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.quick-range { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.quick-range button {
  font: inherit; font-size: 12px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 20px;
  background: #fbfdff; color: var(--navy-700); cursor: pointer; transition: all .15s;
}
.quick-range button:hover { border-color: var(--blue-500); color: var(--blue-600); }
.quick-range button.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.range-fields { display: flex; align-items: flex-end; gap: 10px; }
.range-field { flex: 1; text-align: left; }
.range-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.range-field input {
  width: 100%; font: inherit; font-size: 13px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fbfdff; color: var(--ink); outline: none;
}
.range-field input:focus { border-color: var(--blue-500); }
.range-sep { padding-bottom: 10px; color: var(--muted); font-size: 13px; }
.analyze-preview {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 10px 12px;
  border: 1px solid #cfe3f7; border-radius: 9px;
  background: #f2f8ff; color: var(--blue-600);
  font-size: 12px; line-height: 1.55; text-align: left;
}
.analyze-preview svg { width: 15px; height: 15px; flex: none; }
.analyze-preview.warn { border-color: #f0d9ab; background: #fff9ec; color: #966000; }
.analyze-preview.err { border-color: #f3cbc8; background: #fff5f4; color: #b3261e; }
.analyze-actions { display: flex; gap: 10px; margin-top: 18px; }
.analyze-actions .btn-ghost, .analyze-actions .btn-primary { flex: 1; width: auto; }

.report-modal { width: min(780px, 100%); }
.report-meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.report-scroll {
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  margin-top: 4px; padding-right: 6px;
}
.report-loading, .report-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 260px; text-align: center; color: var(--muted);
}
.report-loading p { margin: 16px 0 4px; font-size: 14px; color: var(--navy-700); }
.report-loading small, .report-empty small { font-size: 12px; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--blue-500);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.report-empty-icon { font-size: 40px; margin-bottom: 10px; }
.report-empty p { margin: 0 0 4px; font-size: 14px; color: var(--navy-700); }
.report-body.markdown { font-size: 14px; line-height: 1.8; color: var(--ink); padding: 4px 2px; }
.markdown h3 { font-size: 17px; color: var(--navy-800); margin: 20px 0 10px; padding-left: 10px; border-left: 3px solid var(--blue-500); }
.markdown h4 { font-size: 15px; color: var(--navy-700); margin: 16px 0 8px; }
.markdown h3:first-child { margin-top: 4px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 24px; }
.markdown li { margin: 6px 0; }
.markdown strong { color: var(--navy-800); }
.markdown code { background: #eef4fb; color: var(--blue-600); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .admin-header-right span { display: none; }
  .admin-title h2 { font-size: 19px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-num { font-size: 22px; }
  .filter-bar { gap: 6px; padding: 12px; }
  .filter-bar select, .filter-bar input { font-size: 12px; }
  .filter-bar select { flex: 0 0 92px; padding: 8px 30px 8px 8px; background-position: right 10px center; }
  .filter-bar input { padding: 8px 8px; }
  .filter-bar .btn-outline { padding: 8px 11px; font-size: 12px; }
  .item { padding: 15px 16px; }
  .admin-title-actions { gap: 7px; }
  .btn-analyze, .filter-bar .btn-outline { font-size: 12px; padding: 8px 11px; }
  .analyze-modal { padding: 26px 20px 22px; }
  .quick-range button { padding: 6px 10px; }
  .report-modal .list-head { flex-wrap: wrap; }
}
