:root {
  --bg-start: #1e3a8a;
  --bg-end: #6d28d9;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --blue: #2563eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

.auth-card {
  display: grid;
  grid-template-columns: 320px 380px;
  width: 100%;
  max-width: 700px;
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

.auth-brand {
  padding: 40px 32px;
  color: #eef2ff;
  background: linear-gradient(160deg, #312e81, #4c1d95);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #312e81;
  background: #c7d2fe;
  border-radius: 14px;
}

.brand-logo--sm {
  width: 34px;
  height: 34px;
  margin: 0;
  font-size: 12px;
  border-radius: 9px;
  background: #e0e7ff;
  color: #3730a3;
}

.auth-brand h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.brand-desc {
  margin: 0 0 24px;
  font-size: 13px;
  color: #c7d2fe;
}

.brand-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 2;
  color: #ddd6fe;
}

.auth-form {
  padding: 40px 36px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 26px;
  background: #f3f4f6;
  border-radius: 10px;
}

.tab {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  font-weight: 600;
}

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

.form.is-hidden {
  display: none;
}

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

.field span {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.field input,
.field textarea,
.field select {
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
  resize: vertical;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9ca3af;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn-primary {
  margin-top: 6px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.06s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: #a5b4fc;
  cursor: not-allowed;
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.message.is-error {
  color: var(--danger);
}

.message.is-success {
  color: var(--success);
}

/* ---------------- 个人中心 ---------------- */

.dashboard-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f5f6fa;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.icon-btn:hover {
  background: #f3f4f6;
}

.icon-btn.is-off {
  color: var(--text-muted);
  background: #f3f4f6;
}

.btn-ghost {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--primary-dark);
  background: #eef2ff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.btn-ghost:hover {
  background: #e0e7ff;
}

.dashboard-main,
.page-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.panel {
  width: 100%;
  padding: 22px 24px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

/* 相邻版块之间保持 20px 上下间距（仅作用于页面主体的直接子版块） */
.page-main > .panel {
  margin-bottom: 20px;
}

.page-main > .panel:last-child {
  margin-bottom: 0;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

/* 同一版块内的次级标题（如「平台策略建议」） */
.panel h3 {
  margin: 26px 0 6px;
  font-size: 15px;
}

.panel-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: #fff;
}

.info-item dt {
  font-size: 13px;
  color: var(--text-muted);
}

.info-item dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

/* ---------------- 通用页面骨架 ---------------- */

.is-hidden {
  display: none !important;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
  color: var(--text);
  background: #f3f4f6;
}

.nav-link.is-active {
  font-weight: 600;
  color: var(--primary-dark);
  background: #eef2ff;
}

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.page-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* 页面标题右侧带操作按钮时的布局（如诊断结果页的导出报告按钮） */
.page-head.has-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-head.has-actions > div {
  min-width: 0;
}

.page-head.has-actions .btn-primary {
  flex: 0 0 auto;
  white-space: nowrap;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.panel-head h2 {
  margin: 0;
}

.empty {
  padding: 26px 0;
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: #9ca3af;
}

/* ---------------- 指标卡 ---------------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* 结果页汇总含官网 / 电话曝光，共 6 张指标卡。 */
.metric-grid.is-six {
  grid-template-columns: repeat(6, 1fr);
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.metric-label {
  font-size: 13px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 28px;
  line-height: 1.1;
}

.metric-value.is-date {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.9;
}

.metric-hint {
  font-size: 12px;
  color: #9ca3af;
}

/* ---------------- 图表 ---------------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 52px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

.bar-name {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: block;
  height: 10px;
  overflow: hidden;
  background: #eef2ff;
  border-radius: 6px;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 6px;
}

.bar-value {
  color: var(--text-muted);
  text-align: right;
}

/* 表格单元格内的占比条：进度条自适应，百分比文字固定宽度右对齐 */
.share-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-cell .bar-track {
  flex: 1;
  min-width: 60px;
}

.share-value {
  min-width: 48px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}

/* 信源分析：窗口最多显示 10 行，其余滚动查看 */
.source-scroll {
  max-height: 490px;
  overflow-y: auto;
}

/* 滚动时表头保持在顶部，避免失去列含义 */
.source-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.source-scroll .col-rank {
  width: 72px;
}

.source-scroll .col-count {
  width: 110px;
}

.source-scroll .col-toggle {
  width: 90px;
}

/* 引用次数后的展开按钮 */
.source-toggle {
  padding: 3px 10px;
  font-size: 12px;
}

.source-empty {
  color: var(--text-muted);
}

/* 展开后追加的网址列表行 */
.source-urls td {
  background: #f9fafb;
}

.source-url-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 4px 8px;
}

.source-url-list a {
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
}

.source-url-list a:hover {
  text-decoration: underline !important;
}

/* 面板标题右侧的操作按钮组 */
.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.pager button {
  min-width: 34px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.pager button:hover:not(:disabled) {
  background: #e5e7eb;
}

.pager button.is-active {
  color: #fff;
  background: var(--primary);
}

.pager button:disabled {
  color: #c4c8d0;
  cursor: not-allowed;
}

.pager .pager-gap {
  padding: 0 2px;
  font-size: 13px;
  color: var(--text-muted);
}

.pager .pager-info {
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------- 数据表格 ---------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.data-table tbody tr.is-clickable:hover {
  background: #f9fafb;
}

/* ---------------- 徽章与标签 ---------------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

.badge.is-high {
  color: #15803d;
  background: #dcfce7;
}

.badge.is-mid {
  color: #b45309;
  background: #fef3c7;
}

.badge.is-low {
  color: #b91c1c;
  background: #fee2e2;
}

/* 无数据或不适用的中性标记 */
.badge.is-none {
  color: #6b7280;
  background: #f3f4f6;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}

.tag.is-positive {
  color: #15803d;
  background: #dcfce7;
}

.tag.is-negative {
  color: #b91c1c;
  background: #fee2e2;
}

/* 平台象限中的「低可见·高推荐」定位 */
.tag.is-info {
  color: #1d4ed8;
  background: #dbeafe;
}

/* 平台象限中的「高可见·低推荐」定位 */
.tag.is-mid {
  color: #b45309;
  background: #fef3c7;
}

.status-running {
  color: var(--primary-dark);
  background: #eef2ff;
}

.status-done {
  color: #15803d;
  background: #dcfce7;
}

.status-failed {
  color: #b91c1c;
  background: #fee2e2;
}

/* ---------------- 进度条 ---------------- */

.progress {
  height: 10px;
  overflow: hidden;
  background: #eef2ff;
  border-radius: 6px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.3s ease;
}

.progress-text {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------------- 按钮补充 ---------------- */

.btn-primary.btn-sm,
.btn-ghost.btn-sm {
  margin-top: 0;
  padding: 8px 16px;
  font-size: 13px;
  letter-spacing: 0;
}

.btn-secondary {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  padding: 6px 12px;
  font-size: 12px;
  color: #b91c1c;
  background: #fee2e2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.btn-danger:hover {
  background: #fecaca;
}

/* ---------------- 两栏布局 ---------------- */

.split {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}

/* ---------------- 列表项 ---------------- */

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.item:hover {
  background: #f8faff;
  border-color: #c7d2fe;
}

.item.is-active {
  background: #eef2ff;
  border-color: var(--primary);
}

.item-main {
  min-width: 0;
}

.item-title {
  font-size: 14px;
  font-weight: 600;
}

.item-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

/* ---------------- 问题库列表：一行多个 + hover 显示删除 ---------------- */

.item-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
}

.item-list--grid > .empty {
  grid-column: 1 / -1;
}

.item--prompt {
  position: relative;
  padding: 10px 32px 10px 12px;
  cursor: default;
}

.item--prompt .item-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.item-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.item--prompt:hover .item-remove,
.item-remove:focus-visible {
  opacity: 1;
}

.item-remove:hover {
  color: #b91c1c;
  background: #fee2e2;
}

/* ---------------- 诊断结果卡片 ---------------- */

.result-card {
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-question {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* 每张结果卡片的回答展开按钮 */
.answer-bar {
  margin-top: 10px;
}

.answer-bar .answer-toggle {
  padding: 6px 12px;
  font-size: 12px;
}

.result-answer {
  max-height: 220px;
  padding: 12px 14px;
  margin: 10px 0 0;
  overflow: auto;
  font-size: 13px;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  background: #f9fafb;
  border-radius: 8px;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.source-link {
  padding: 3px 9px;
  font-size: 12px;
  color: var(--primary-dark);
  text-decoration: none;
  background: #eef2ff;
  border-radius: 999px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.filter-bar input {
  accent-color: var(--primary);
}

/* ---------------- 引擎配置 ---------------- */

.engine-card {
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.engine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.engine-name {
  font-size: 15px;
  font-weight: 600;
}

.engine-code {
  margin-left: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.engine-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 引擎启用开关：开启后该引擎才会出现在诊断的选择列表中 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.switch-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* 未开启的引擎弱化展示，避免误以为可直接使用 */
.engine-card.is-off .engine-fields,
.engine-card.is-off .engine-note {
  opacity: 0.6;
}

.engine-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
}

/* 网页版引擎只有 userToken / Cookie 两个字段 */
.engine-fields[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.engine-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.8;
}

.engine-note code {
  font-family: Consolas, "Courier New", monospace;
  color: var(--primary);
}

.engine-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tip {
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: #3730a3;
  background: #eef2ff;
  border-radius: 10px;
}

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.engine-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 20px;
}

.engine-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}

.engine-option input {
  accent-color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------------- 顶栏账号 + 左侧菜单布局 ---------------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-chip {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  background: #f3f4f6;
  border-radius: 999px;
}

.account-chip strong {
  color: var(--text);
  font-weight: 600;
}

.layout {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 60px;
  align-self: flex-start;
  flex: 0 0 220px;
  width: 220px;
  height: calc(100vh - 60px);
  padding: 20px 12px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav .nav-link {
  padding: 10px 16px;
}

/* 点击顶栏按钮后隐藏侧边导航栏，正文自动占满宽度。 */
.layout.is-sidebar-hidden > .sidebar {
  display: none;
}

.layout > .page-main {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 920px) {
  .metric-grid,
  .metric-grid.is-six {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .engine-fields,
  .engine-fields[data-count="2"] {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-brand span:last-child {
    display: none;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    height: auto;
    padding: 8px 12px;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
}

@media (max-width: 720px) {
  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    padding: 28px 28px 24px;
  }

  .brand-list {
    display: none;
  }

  .auth-form {
    padding: 28px 24px 32px;
  }
}

/* ---------------- 诊断结果页视觉优化 ---------------- */
/* 以下样式仅作用于诊断结果页，通过 .results-page 限定作用范围，避免影响其它页面。 */

/* 各版块标题前加一道彩色色条，区分版块归属 */
.results-page .panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-page .panel-head h2::before {
  content: "";
  flex: none;
  width: 4px;
  height: 16px;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 2px;
}

.results-page #platform-panel .panel-head h2::before {
  background: linear-gradient(180deg, #0d9488, #14b8a6);
}

.results-page #competitor-panel .panel-head h2::before {
  background: linear-gradient(180deg, #d97706, #f59e0b);
}

.results-page #source-panel .panel-head h2::before {
  background: linear-gradient(180deg, #2563eb, #3b82f6);
}

.results-page #list-panel .panel-head h2::before {
  background: linear-gradient(180deg, #64748b, #94a3b8);
}

/* 颜色图例：说明数值分级的三种颜色含义 */
.results-page .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.results-page .legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.results-page .legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.results-page .legend i.is-high {
  background: #22c55e;
}

.results-page .legend i.is-mid {
  background: #f59e0b;
}

.results-page .legend i.is-low {
  background: #ef4444;
}

/* 概览指标卡：顶部色条 + 数值着色，突出得分与曝光表现 */
.results-page .metric-card {
  border-top: 3px solid var(--border);
}

.results-page .metric-card.is-high {
  border-top-color: #22c55e;
}

.results-page .metric-card.is-mid {
  border-top-color: #f59e0b;
}

.results-page .metric-card.is-low {
  border-top-color: #ef4444;
}

.results-page .metric-card.is-high .metric-value {
  color: #15803d;
}

.results-page .metric-card.is-mid .metric-value {
  color: #b45309;
}

.results-page .metric-card.is-low .metric-value {
  color: #b91c1c;
}

/* 表格内的数值统一用彩色胶囊标记强弱 */
.results-page .data-table td .badge {
  font-size: 12.5px;
}

/* 业务解读前的状态圆点 */
.results-page .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  vertical-align: middle;
  border-radius: 50%;
}

.results-page .dot.is-high {
  background: #22c55e;
}

.results-page .dot.is-mid {
  background: #f59e0b;
}

.results-page .dot.is-low {
  background: #ef4444;
}

/* 竞品分析中本品牌所在行高亮，便于与竞品对比 */
.results-page .data-table tbody tr.is-brand-row {
  background: #f5f3ff;
}

.results-page .data-table tbody tr.is-brand-row td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}

/* 信源排名的序号徽标，前三名高亮 */
.results-page .rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 12px;
  color: var(--text-muted);
  background: #f3f4f6;
  border-radius: 6px;
}

.results-page .rank-badge.is-top {
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* 逐条明细卡片：左侧色条按得分强弱着色 */
.results-page .result-card.is-high {
  border-left: 4px solid #22c55e;
}

.results-page .result-card.is-mid {
  border-left: 4px solid #f59e0b;
}

.results-page .result-card.is-low {
  border-left: 4px solid #ef4444;
}

/* 为左侧浮动版块导航在正文列内预留出贴边空间，避免导航与内容重叠 */
.results-page .page-main {
  padding-left: 136px;
}

/* 左侧浮动版块导航：贴住正文左边缘，常驻显示版块名称 */
.results-page .anchor-nav {
  position: fixed;
  top: 50%;
  left: 232px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  transform: translateY(-50%);
  transition: left 0.2s ease;
}

.results-page .anchor-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.results-page .anchor-nav a::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: #cbd5e1;
  border-radius: 50%;
  transition: background 0.15s ease, transform 0.15s ease;
}

.results-page .anchor-nav a:hover {
  color: var(--primary);
  background: #eef2ff;
}

.results-page .anchor-nav a.is-active {
  color: var(--primary);
  font-weight: 600;
  background: #eef2ff;
}

.results-page .anchor-nav a.is-active::before {
  background: var(--primary);
  transform: scale(1.3);
}

/* 平滑跳转后标题不被吸顶栏遮挡 */
.results-page .page-main > .panel {
  scroll-margin-top: 80px;
}

@media (max-width: 760px) {
  .results-page .anchor-nav {
    display: none;
  }

  .results-page .page-main {
    padding-left: 24px;
  }
}
