:root {
  /* 单一主色：白标主题会覆盖 --blue / --blue-2 */
  --blue: #6060e8;
  --blue-2: #4f4fd6;
  --blue-soft: #efeffc;
  --blue-ring: rgba(96, 96, 232, 0.16);
  --bg: #f8f8f8;
  --bg-subtle: #fbfbfc;
  --card: #ffffff;
  --border: #ececf1;
  --border-strong: #dddde6;
  --text: #1d2129;
  --text-2: #4e5969;
  --muted: #86909c;
  --green: #178a50;
  --green-bg: #eaf7f0;
  --red: #c83830;
  --red-bg: #fdeeee;
  --amber: #b87713;
  --amber-bg: #fdf4e6;
  --shadow-sm: 0 1px 2px rgba(23, 34, 51, 0.06);
  --shadow-md: 0 4px 12px rgba(23, 34, 51, 0.06);
  --radius: 8px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system,
    BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

a {
  text-decoration: none;
  color: var(--blue);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* 细滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: #c7ced9 transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-thumb {
  background: #c7ced9;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #aeb7c5;
  background-clip: padding-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 248px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.logo {
  position: relative;
  padding: 20px 18px 18px 62px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.logo::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.28), transparent 52%),
    var(--blue);
  box-shadow: 0 6px 16px rgba(96, 96, 232, .22);
}

.logo span {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.sidebar nav {
  padding: 10px 10px 24px;
  flex: 1;
  overflow-y: auto;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 1px 0;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sidebar nav a:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.sidebar nav a:active {
  transform: translateY(1px);
}

.sidebar nav a.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
  border-color: transparent;
}

.nav-group {
  margin: 2px 0;
}

.nav-group-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  border-radius: 8px;
  font-family: inherit;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-group-title:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.nav-group-title::after {
  content: "";
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s ease;
}

.nav-group-title .ui-icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
}

.nav-group:not(.open) .nav-group-title::after {
  transform: rotate(-90deg);
}

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

.nav-group.open .nav-group-items {
  display: block;
}

.nav-group-items a {
  padding-left: 38px;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 248px;
  right: 0;
  height: 84px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 26px;
  z-index: 10;
}

.topbar-heading {
  min-width: 0;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.topbar-breadcrumb .ui-icon {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

.topbar h1 {
  font-size: 24px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-status-badge,
.industry-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 500;
}

.header-status-badge strong {
  margin: 0 2px;
  color: var(--text-2);
}

.header-description {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

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

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
}

.global-search input::placeholder {
  color: var(--muted);
}

.global-search kbd {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  background: var(--bg-subtle);
  font-family: inherit;
  font-size: 11px;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-2);
  background: #fff;
  cursor: pointer;
}

.icon-action:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 700;
}

.user-menu-trigger #user-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.user-menu-chevron {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
  color: var(--muted);
  transition: transform .16s ease;
}

.user-menu.open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.user-menu.open .user-dropdown {
  display: block;
}

.user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text-2);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.user-dropdown button:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

/* Main */
.main {
  margin-left: 248px;
  padding: 110px 28px 56px;
  min-height: 100vh;
  max-width: 1728px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 0.22s ease;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card h3 {
  margin: 20px 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Form */
.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-row label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 8px;
  color: var(--text-2);
  cursor: pointer;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row select,
.form-row textarea {
  width: 100%;
  max-width: 460px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

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

.form-row input:hover,
.form-row select:hover,
.form-row textarea:hover {
  border-color: var(--border-strong);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.engine-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.engine-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  margin: 0;
  cursor: pointer;
  transition: color 0.16s ease;
}

.engine-checks label:hover {
  color: var(--blue);
}

/* Buttons */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.08s ease, box-shadow 0.16s ease;
}

.btn-primary:hover {
  background: var(--blue-2);
  box-shadow: 0 3px 10px var(--blue-ring);
}

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

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.08s ease;
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--blue);
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Summary cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.summary-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue);
  opacity: 0.75;
}

.summary-item .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.summary-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

/* 商家首页仪表盘 */
.dashboard-filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.dashboard-filter-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 13px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-2);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.filter-pill .ui-icon {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
  color: var(--muted);
}

.filter-pill.active {
  color: var(--blue);
  border-color: rgba(96, 96, 232, .34);
  background: var(--blue-soft);
}

.filter-pill.active .ui-icon {
  color: var(--blue);
}

.filter-dropdown {
  position: relative;
}

.filter-pill .filter-value {
  color: inherit;
  white-space: nowrap;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 60;
  display: none;
  min-width: 148px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(23, 34, 51, .14);
}

.filter-dropdown.open .filter-menu {
  display: grid;
  gap: 2px;
}

.filter-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  color: #1d2129;
  background: #fff;
  text-align: left;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.filter-menu button:hover,
.filter-menu button.selected {
  color: var(--blue);
  background: var(--blue-soft);
}

.filter-pill .filter-chevron {
  width: 13px;
  height: 13px;
  flex-basis: 13px;
  margin-left: -1px;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dash-kpi {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.dash-kpi::before {
  content: none;
}

.dash-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  color: var(--blue);
  background: var(--blue-soft);
}

.dash-kpi-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.dash-kpi-value {
  margin-top: 14px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--blue);
}

.dash-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--muted);
}

.dash-kpi-delta.up {
  color: var(--green);
  background: var(--green-bg);
}

.dash-kpi-delta.down {
  color: var(--red);
  background: var(--red-bg);
}

.dash-kpi-delta-label {
  margin-left: 2px;
  color: currentColor;
  opacity: .72;
  font-weight: 500;
}

.dash-kpi-delta.none,
.dash-kpi-note {
  color: var(--muted);
  font-weight: 500;
}

.dash-kpi-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
}

.dash-kpi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 16px;
}

.dash-two-col {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
  gap: 16px;
}

.dashboard-chart-card,
.dashboard-competitor-card {
  min-width: 0;
}

.dashboard-detection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 14px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--bg-subtle);
  font-size: 12px;
}

.dashboard-detection-status .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 10px;
}

.dashboard-detection-status .ui-icon {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card-heading-row h2 {
  margin-bottom: 3px;
}

.card-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-subtle);
}

.segmented-control button {
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: default;
}

.segmented-control button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.competitor-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-size: 12px;
}

.competitor-summary-main {
  color: var(--blue);
  font-weight: 650;
}

.competitor-summary-muted {
  color: var(--text-2);
}

.competitor-summary .dash-kpi-delta {
  margin-top: 0;
}

.dashboard-brand-detail {
  margin-top: 16px;
}

.dash-detail-grid,
.dash-ranking-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.dash-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-ranking-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-detail-card,
.dashboard-rank-card {
  min-width: 0;
}

.table-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}

.table-delta.up {
  color: var(--green);
}

.table-delta.down {
  color: var(--red);
}

.table-delta.none {
  color: var(--muted);
}

.ranking-list {
  display: grid;
  gap: 6px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
}

.ranking-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 700;
}

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

.ranking-main > span,
.ranking-main > a {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.ranking-main > span:last-child,
.ranking-main > a + span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.ranking-item > strong {
  color: var(--text-2);
  font-size: 13px;
}

td.num {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kb-context-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.7fr);
  align-items: end;
  gap: 28px;
}

.kb-context-main {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.kb-merchant-picker {
  max-width: 440px;
  margin-bottom: 0;
}

.kb-identity {
  display: grid;
  gap: 4px;
}

.kb-identity strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
}

.kb-identity span {
  color: var(--muted);
  font-size: 12px;
}

.kb-health {
  display: grid;
  gap: 9px;
}

.kb-health-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.kb-health-heading strong {
  color: var(--text);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.kb-health-track {
  height: 7px;
  overflow: hidden;
  background: var(--bg-subtle);
  border-radius: 99px;
}

.kb-health-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.kb-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.kb-stat {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-stat span {
  color: var(--muted);
  font-size: 11px;
}

.kb-stat strong {
  color: var(--text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.kb-section-tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  overflow-x: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-section-tabs button {
  flex: 1 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.kb-section-tabs button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.kb-section-tabs button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 1px 4px rgba(25, 42, 70, 0.08);
}

.kb-tab-panel {
  margin-top: 16px;
}

.kb-notice {
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.kb-notice.success {
  color: #25633d;
  background: #effaf3;
  border-color: #ccebd8;
}

.kb-profile-view {
  display: grid;
  gap: 14px;
}

.kb-profile-lead {
  padding: 20px;
  background: linear-gradient(135deg, #f5f8fd, #fff);
  border: 1px solid #dfe7f3;
  border-radius: 8px;
}

.kb-profile-lead > span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.kb-profile-lead h3 {
  margin: 7px 0 6px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.35;
}

.kb-profile-lead p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.kb-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kb-profile-block {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-profile-wide {
  grid-column: 1 / -1;
}

.kb-profile-block h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
}

.kb-profile-block ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.kb-preline {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.kb-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.kb-chip-list span {
  padding: 4px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 5px;
  font-size: 11px;
}

.kb-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.kb-record {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.kb-record-head > div:first-child {
  min-width: 0;
}

.kb-record-head h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-record-head > div:first-child > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.kb-record-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.kb-record-actions button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.kb-record-actions .danger {
  color: var(--red);
  border-color: #efd2d0;
}

.kb-record-description {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.kb-record-price {
  margin-top: 10px;
  color: var(--red);
  font-size: 18px;
  font-weight: 700;
}

.kb-record-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.kb-record-source {
  display: inline-block;
  margin-top: 10px;
  color: var(--blue);
  font-size: 11px;
}

.kb-target-media {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.kb-target-media > span {
  color: var(--muted);
  font-size: 10px;
}

.kb-target-media > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-target-media a {
  display: block;
  width: 38px;
  height: 38px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.kb-target-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kb-target-media em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.kb-media-file-icon.compact {
  width: 36px;
  height: 36px;
  border: 0;
  font-size: 9px;
}

.kb-media-picker {
  display: grid;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-picker-item {
  display: grid;
  grid-template-columns: 20px 44px minmax(0, 1fr) 104px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.kb-picker-item:last-child {
  border-bottom: 0;
}

.kb-picker-item > input {
  width: auto;
}

.kb-picker-preview {
  display: grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  place-items: center;
}

.kb-picker-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kb-picker-info {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.kb-picker-info strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-picker-info small {
  color: var(--muted);
  font-size: 10px;
}

.kb-picker-item select {
  height: 32px;
  min-width: 0;
}

.kb-picker-item select:disabled {
  opacity: 0.45;
}

.kb-picker-empty {
  padding: 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.kb-fact-record .kb-record-actions {
  max-width: 62%;
}

.kb-fact-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.kb-fact-toolbar input {
  flex: 1 1 260px;
}

.kb-fact-toolbar select {
  width: 150px;
}

.kb-empty {
  display: grid;
  min-height: 150px;
  gap: 5px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  place-content: center;
  text-align: center;
}

.kb-empty strong {
  color: var(--text-2);
  font-size: 13px;
}

.kb-empty span {
  font-size: 11px;
}

.kb-editor-backdrop {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(16, 25, 40, 0.42);
}

.kb-editor {
  display: flex;
  width: min(560px, 100%);
  height: 100%;
  flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 50px rgba(18, 35, 62, 0.18);
  animation: kb-editor-in 0.2s ease-out;
}

.kb-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.kb-editor-head span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.kb-editor-head h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.kb-editor-head button {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 20px;
}

.kb-editor-body {
  flex: 1;
  padding: 20px 22px 28px;
  overflow-y: auto;
}

.kb-editor-form {
  display: grid;
}

.kb-editor-actions {
  position: sticky;
  bottom: -28px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding: 14px 0 0;
  background: #fff;
  border-top: 1px solid var(--border);
}

body.kb-editor-open {
  overflow: hidden;
}

@keyframes kb-editor-in {
  from { transform: translateX(28px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.kb-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.7fr;
  gap: 8px;
}

.kb-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.kb-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.kb-item-title {
  font-weight: 600;
}

.kb-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kb-item-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.kb-compact-select {
  width: auto;
  min-width: 140px;
}

.kb-media-form {
  padding: 14px;
  margin-top: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-media-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 12px;
}

.kb-media-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-pending-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.kb-pending-file {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-pending-file-preview {
  display: grid;
  width: 58px;
  height: 58px;
  overflow: hidden;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  place-items: center;
}

.kb-pending-file-preview img,
.kb-pending-file-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kb-pending-file-info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.kb-pending-file-info strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-pending-file-info span {
  color: var(--muted);
  font-size: 10px;
}

.kb-pending-file-remove {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  place-items: center;
}

.kb-pending-file-remove:hover {
  color: var(--red);
  border-color: var(--red);
}

.kb-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--text-2);
  font-size: 12px;
}

.kb-check input {
  width: auto;
}

.kb-media-upload-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.kb-media-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.kb-media-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  min-height: 160px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.kb-media-preview {
  display: grid;
  min-height: 150px;
  overflow: hidden;
  background: #eef1f6;
  place-items: center;
}

.kb-media-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kb-media-preview > a {
  display: block;
  width: 100%;
  height: 100%;
}

.kb-media-preview video {
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: cover;
}

.kb-media-preview-missing {
  padding: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.kb-media-file-icon {
  display: grid;
  width: 54px;
  height: 54px;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  place-items: center;
}

.kb-media-body {
  min-width: 0;
  padding: 12px;
}

.kb-media-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kb-media-heading strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-media-body p {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.55;
}

.kb-media-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.kb-media-tags,
.kb-media-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.kb-media-tags span {
  padding: 2px 6px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 4px;
  font-size: 10px;
}

.kb-analysis-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 10px;
}

.kb-analysis-details {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.6;
}

.kb-analysis-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
}

.kb-analysis-details > div {
  margin-top: 6px;
}

.kb-analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.kb-analysis-actions button {
  min-height: 30px;
}

.kb-media-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px;
}

.kb-media-link button {
  width: auto;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.kb-media-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.kb-media-actions select {
  flex: 1;
  min-width: 0;
  height: 32px;
}

.kb-media-actions button {
  flex: 0 0 auto;
  height: 32px;
}

.kb-media-actions button.danger {
  color: var(--red);
  border-color: rgba(198, 79, 87, 0.35);
}

.dash-rank-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
}

.dash-rank-badge .rank-no {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}

.dash-rank-badge .rank-text {
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1200px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .global-search {
    width: 176px;
  }

  .user-menu-trigger #user-name {
    max-width: 72px;
  }
}

@media (max-width: 980px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-two-col {
    grid-template-columns: 1fr;
  }

  .dash-detail-grid,
  .dash-ranking-grid {
    grid-template-columns: 1fr;
  }

  .global-search,
  .icon-action {
    display: none;
  }
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.table-wrap select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

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

th,
td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: var(--bg-subtle);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: #f4f7fb;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td .muted,
th .muted {
  font-size: 13px;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.tag-green {
  background: var(--green-bg);
  color: var(--green);
}

.tag-red {
  background: var(--red-bg);
  color: var(--red);
}

.tag-gray {
  background: #eef1f5;
  color: #55606f;
}

/* Report content */
.report-md {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.78;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.detection-report-card #report-box:not(:empty) {
  margin-top: 16px;
}

.detection-report-card #report-box h2 {
  margin-top: 0;
}

.report-ready {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.report-ready h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.report-ready p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.report-ready-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.report-viewer-open {
  overflow: hidden;
}

.report-viewer {
  position: fixed;
  inset: 0;
  z-index: 700;
}

.report-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 25, 38, 0.62);
  backdrop-filter: blur(3px);
}

.report-viewer-panel {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #eef1f6;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(18, 25, 38, 0.28);
}

.report-viewer-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.report-back {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}

.report-viewer-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-viewer-title span {
  color: var(--muted);
  font-size: 11px;
}

.report-viewer-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.report-viewer-scroll {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.report-loading {
  max-width: 520px;
  margin: 80px auto;
  padding: 32px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.report-doc {
  max-width: 1080px;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.report-doc.report-legacy {
  padding: 28px;
}

.report-cover {
  position: relative;
  min-height: 260px;
  padding: 48px 52px;
  overflow: hidden;
  color: #f7f9fc;
  background: linear-gradient(135deg, #1a2234 0%, #25324a 58%, #1b2940 100%);
}

.report-cover::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -150px;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 56px rgba(255, 255, 255, 0.025), 0 0 0 112px rgba(255, 255, 255, 0.018);
}

.report-cover-kicker {
  color: #aeb9cf;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.report-cover h1 {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 14px 0 10px;
  font-size: 32px;
  line-height: 1.28;
}

.report-cover > p {
  margin: 0;
  color: #c6d0df;
  font-size: 14px;
}

.report-cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.report-cover-meta span {
  padding: 5px 10px;
  color: #dbe2ed;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  font-size: 12px;
}

.report-score {
  position: absolute;
  right: 52px;
  bottom: 40px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.report-score strong {
  font-size: 42px;
  line-height: 1;
}

.report-score span {
  margin-top: 6px;
  color: #b7c2d5;
  font-size: 11px;
}

.report-toc {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 10px 22px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

.report-toc a {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--muted);
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
}

.report-toc a:hover {
  color: var(--blue);
  background: var(--bg-subtle);
}

.report-section {
  padding: 34px 42px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 56px;
}

.report-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.report-section-head > span {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.report-section-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.report-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-kpi {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.report-kpi-value {
  margin: 5px 0;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.15;
}

.report-kpi-delta {
  font-size: 12px;
}

.report-kpi-delta.positive,
.report-insight.positive h3 {
  color: var(--green);
}

.report-kpi-delta.risk,
.report-insight.risk h3 {
  color: var(--red);
}

.report-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.report-insight {
  padding: 14px;
  background: var(--bg-subtle);
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
}

.report-insight.risk {
  border-left-color: var(--red);
}

.report-insight.warning {
  border-left-color: #d98a1f;
}

.report-insight.positive {
  border-left-color: var(--green);
}

.report-insight h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.report-insight p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.report-gauge-panel {
  margin-top: 14px;
}

.report-chart-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-chart-panel h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.report-chart {
  width: 100%;
  height: 300px;
}

.report-chart-compact {
  height: 250px;
}

.report-chart-gauge {
  height: 180px;
}

.report-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-table-wrap table {
  min-width: 680px;
}

.report-article-list {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-article-list h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.report-article-list ol {
  margin: 0;
  padding-left: 20px;
}

.report-article-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.report-article-list li:last-child {
  border-bottom: 0;
}

.report-article-list a {
  color: var(--blue);
  text-decoration: none;
}

.report-article-list li span {
  float: right;
  margin-left: 12px;
  color: var(--muted);
}

.report-action-list {
  display: grid;
  gap: 10px;
}

.report-action {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-action-rank {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--blue);
  background: #edf0ff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  place-items: center;
}

.report-action h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.report-action p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.report-completeness {
  padding: 14px;
  background: #fff8e8;
  border: 1px solid #ead7a8;
  border-radius: 6px;
  font-size: 12px;
}

.report-completeness p {
  margin: 6px 0;
  color: #735f32;
}

.report-completeness ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #735f32;
}

.report-completeness li + li {
  margin-top: 5px;
}

.report-completeness li strong {
  margin-right: 8px;
}

.report-source-details {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.report-source-details summary {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 12px;
}

.report-source-details pre {
  max-height: 520px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
}

.report-bar-row {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 48px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  font-size: 12px;
}

.report-bar-track {
  height: 8px;
  overflow: hidden;
  background: #e9edf4;
  border-radius: 2px;
}

.report-bar-track span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
}

.report-empty {
  color: var(--muted);
  font-size: 12px;
}

.engine-coverage {
  margin-bottom: 16px;
  padding: 13px 15px;
  background: #fff8e8;
  border: 1px solid #ead7a8;
  border-radius: 10px;
}

.engine-coverage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.engine-coverage-head strong {
  font-size: 13px;
}

.engine-coverage-head span {
  color: #735f32;
  font-size: 12px;
}

.engine-coverage ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.engine-coverage li {
  display: flex;
  gap: 10px;
  padding-top: 7px;
  color: #66552e;
  font-size: 12px;
  line-height: 1.55;
}

.engine-coverage li + li {
  margin-top: 5px;
  border-top: 1px solid rgba(115, 95, 50, 0.14);
}

.engine-coverage li strong {
  flex: 0 0 auto;
  min-width: 62px;
}

.hidden {
  display: none !important;
}

body.logged-out .sidebar,
body.logged-out .topbar,
body.logged-out .main,
body.logged-out .agent-floating {
  display: none;
}

.login-screen {
  display: none;
  min-height: 100dvh;
  background: var(--bg);
}

body.logged-out .login-screen {
  display: block;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(480px, 0.95fr);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #f4f7fb;
  background: linear-gradient(135deg, #152238 0%, #0d1628 52%, #0a1322 100%);
}

.login-brand-glow {
  position: absolute;
  width: 560px;
  height: 560px;
  right: -180px;
  top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 96, 232, 0.42) 0%, rgba(96, 96, 232, 0.12) 46%, transparent 70%);
  filter: blur(8px);
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.login-brand-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.login-brand-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(220, 231, 246, 0.72);
}

.login-brand-rule {
  width: 44px;
  height: 3px;
  margin: 26px 0 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #7ea6f5);
}

.login-brand-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
}

.login-brand-copy {
  margin: 18px 0 0;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.8;
  color: rgba(220, 231, 246, 0.78);
}

.login-brand-points {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.login-brand-points li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(220, 231, 246, 0.9);
}

.login-brand-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ea6f5;
  box-shadow: 0 0 0 4px rgba(126, 166, 245, 0.14);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(96, 96, 232, 0.06), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 30px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  padding: 0 0 18px;
  border-bottom: none;
  font-size: 21px;
}

.login-logo::before {
  content: none;
  display: none;
}

.login-form {
  margin-bottom: 14px;
}

.login-form .form-row input {
  max-width: none;
}

.login-form .btn-primary {
  width: 100%;
  margin-top: 4px;
  padding: 11px 20px;
  font-size: 15px;
}

.login-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
  border: 1px solid #f6c7c7;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

/* 提问资产库 */
.qa-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.qa-toolbar select,
.qa-toolbar input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.qa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fff;
  transition: border-color 0.16s ease;
}

.qa-item:hover {
  border-color: var(--border-strong);
}

.qa-item-main {
  flex: 1;
  min-width: 0;
}

.qa-item-q {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

.qa-item-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.qa-history {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
}

.qa-history summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.qa-history-list {
  padding: 4px 12px 12px;
  display: grid;
  gap: 6px;
}

.qa-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.qa-history-item input {
  margin-top: 3px;
}

/* 富文本编辑器 */
.rt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--bg-subtle);
}

.rt-toolbar button {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.rt-toolbar button:hover {
  background: #fff;
  border-color: var(--border);
  color: var(--blue);
}

.rt-toolbar select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.rt-editor {
  min-height: 320px;
  max-height: 640px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: #fff;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  outline: none;
}

.rt-editor:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}

.rt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.rt-editor h2,
.rt-editor h3 {
  margin: 16px 0 8px;
  line-height: 1.4;
}

.rt-editor blockquote {
  margin: 12px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--blue);
  color: var(--muted);
  background: var(--bg-subtle);
}

.rt-editor img,
.rt-editor video {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}

.rt-emoji-panel {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.rt-emoji-panel button {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
}

.rt-emoji-panel button:hover {
  background: var(--bg-subtle);
}

.rt-media-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 10px;
  margin-top: 4px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.rt-media-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
}

.rt-media-item:hover {
  border-color: var(--blue);
}

.rt-media-item img,
.rt-media-item video {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}

/* 空状态 */
.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  line-height: 1.7;
}

td.muted {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

/* 骨架屏加载 */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e8ecf2;
  border-radius: 6px;
  min-height: 14px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.engine-evidence {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  transition: border-color 0.16s ease;
}

.engine-evidence:hover {
  border-color: var(--border-strong);
}

.engine-evidence summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.engine-answer {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.68;
  margin: 10px 0;
}

.engine-evidence h4 {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.engine-evidence ul {
  margin: 0;
  padding-left: 18px;
}

.engine-evidence li {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.raw-detection-section .engine-evidence {
  padding: 0;
  overflow: hidden;
}

.raw-detection-section .engine-evidence > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  list-style: none;
}

.raw-detection-section .engine-evidence > summary::-webkit-details-marker {
  display: none;
}

.raw-detection-section .engine-evidence > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.raw-detection-section .engine-evidence[open] > summary::after {
  content: "-";
}

.engine-evidence-title {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
}

.engine-evidence-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: right;
}

.engine-result-list {
  border-top: 1px solid var(--border);
}

.engine-result-item {
  padding: 14px;
}

.engine-result-item + .engine-result-item {
  border-top: 1px solid var(--border);
}

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

.engine-result-query {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.engine-result-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.engine-result-stat {
  color: var(--muted);
  font-size: 12px;
  line-height: 22px;
}

.engine-citations {
  margin-top: 10px;
}

.engine-citations summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.engine-no-citation {
  margin: 8px 0 0;
  font-size: 12px;
}

.engine-evidence-table {
  margin: 0 14px 14px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: 8px;
}

.engine-evidence-table h4 {
  margin: 0 0 8px;
}

.engine-evidence-table p {
  margin: 0 0 8px;
}

.citation-audit-row {
  margin-top: 8px;
}

.citation-site {
  font-size: 12px;
}

.raw-detection-details {
  padding: 0;
  overflow: hidden;
}

.raw-detection-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.raw-detection-details > summary::-webkit-details-marker {
  display: none;
}

.raw-detection-details > summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 22px;
  text-align: center;
}

.raw-detection-details[open] > summary::after {
  content: "-";
}

.raw-detection-title {
  font-size: 14px;
  font-weight: 650;
}

.raw-detection-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.raw-detection-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.raw-detection-section {
  padding: 18px 0;
}

.raw-detection-section + .raw-detection-section {
  border-top: 1px solid var(--border);
}

.raw-detection-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 650;
}

.cite-snippet {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.keyword-filter-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.keyword-form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-filter-toolbar input {
  flex: 1 1 280px;
}

.keyword-filter-toolbar select {
  width: 160px;
}

.keyword-manual-entry {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.keyword-manual-entry textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
}

.keyword-manual-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.keyword-manual-actions .muted {
  font-size: 11px;
}

.keyword-group {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.keyword-group:first-child {
  margin-top: 0;
}

.keyword-group h3 {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.keyword-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 5px 4px 9px;
  color: var(--text-2);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.keyword-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-chip button {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  place-items: center;
}

.keyword-chip button:hover {
  color: var(--red);
  border-color: var(--red);
}

.keyword-content-metrics {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.content-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.content-item:last-child {
  border-bottom: none;
}

.content-item h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.content-body {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 6px;
}

.review-auth-btn {
  margin-right: 8px;
  margin-bottom: 8px;
}

.agent-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: 16px;
  min-height: calc(100vh - 140px);
}

.agent-control-panel,
.agent-chat-shell,
.agent-activity-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.06);
}

.agent-control-panel {
  padding: 18px;
}

.agent-control-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.agent-control-head h2,
.agent-chat-head h2 {
  margin: 0;
  font-size: 18px;
}

.agent-control-head p,
.agent-chat-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.agent-orbit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1f8f78);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.agent-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.agent-reference-box {
  margin: 14px 0;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(248, 250, 253, 0.8);
}

.agent-reference-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-reference-actions .btn-secondary {
  padding: 7px 10px;
  font-size: 12px;
}

.agent-history-assets {
  width: 100%;
  min-height: 110px;
  margin-top: 8px;
}

.agent-reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agent-quick {
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.agent-quick:hover {
  border-color: rgba(96, 96, 232, 0.3);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.agent-quick b,
.agent-quick span {
  display: block;
}

.agent-quick b {
  color: var(--text);
  font-size: 13px;
}

.agent-quick span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.agent-capability-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.agent-capability-item {
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.agent-capability-item:first-child {
  border-top: 0;
}

.agent-capability-item b,
.agent-capability-item span {
  display: block;
}

.agent-capability-item b {
  color: var(--text);
  font-size: 13px;
}

.agent-capability-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.agent-chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 680px;
  overflow: hidden;
}

.agent-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.agent-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #18794e;
  font-size: 12px;
  white-space: nowrap;
}

.agent-online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.12);
}

.agent-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(180deg, rgba(247, 249, 252, 0.8), rgba(255, 255, 255, 0.95));
}

#agent-conversation {
  margin-top: 12px;
}

.agent-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.agent-message-user {
  flex-direction: row-reverse;
}

.agent-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.agent-message-user .agent-avatar {
  background: #eef3f8;
  color: var(--text-2);
}

.agent-bubble {
  max-width: min(720px, 82%);
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.agent-message-user .agent-bubble {
  border-color: rgba(96, 96, 232, 0.18);
  border-radius: 14px 14px 4px 14px;
  background: var(--blue-soft);
  color: var(--text);
}

.agent-plan {
  margin: 8px 0 14px 42px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12.5px;
}

.agent-plan ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.agent-plan li {
  margin: 5px 0;
  line-height: 1.5;
}

.agent-composer {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.agent-composer input {
  flex: 1;
  min-width: 0;
}

.agent-activity-panel {
  padding: 18px;
  overflow-y: auto;
}

.agent-activity-panel h3 {
  margin-top: 0;
  font-size: 15px;
}

.agent-conversation-item {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-subtle);
  text-align: left;
  cursor: pointer;
}

.agent-conversation-item.active {
  border-color: rgba(96, 96, 232, 0.3);
  background: var(--blue-soft);
}

.agent-conversation-item b,
.agent-conversation-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-conversation-item b {
  color: var(--text);
  font-size: 12.5px;
}

.agent-conversation-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.agent-floating {
  position: fixed;
  right: 24px;
  bottom: 40px;
  z-index: 1100;
}

.agent-float-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 148px;
  height: 52px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 12px 28px rgba(96, 96, 232, .28);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.agent-float-trigger:hover {
  background: var(--blue-2);
  box-shadow: 0 14px 34px rgba(96, 96, 232, .34);
  transform: translateY(-1px);
}

.agent-float-trigger span {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
}

.agent-float-trigger i {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #e5484d;
}

.agent-float-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24);
}

.agent-float-panel.hidden {
  display: none;
}

.agent-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.agent-float-head strong,
.agent-float-head span {
  display: block;
}

.agent-float-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.agent-float-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

.agent-float-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.agent-float-toolbar select {
  min-width: 0;
}

.agent-float-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg-subtle);
}

.agent-float-handoff {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--blue-soft);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.agent-float-run-status {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #fffaf0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.agent-float-run-status button {
  margin-top: 8px;
  margin-right: 6px;
}

.agent-float-handoff button {
  margin-top: 8px;
}

.agent-float-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.agent-float-form input {
  flex: 1;
  min-width: 0;
}

.agent-float-messages .agent-message {
  margin-bottom: 10px;
}

.agent-float-messages .agent-bubble {
  max-width: 88%;
  padding: 9px 11px;
  font-size: 13px;
}

@media (max-width: 1250px) {
  .agent-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .agent-activity-panel {
    grid-column: 1 / -1;
    max-height: 320px;
  }
}

@media (max-width: 860px) {
  .agent-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .agent-chat-shell {
    min-height: 620px;
  }

  .agent-activity-panel {
    grid-column: auto;
  }

  .agent-floating {
    right: 14px;
    bottom: 24px;
  }

  .agent-float-panel {
    position: fixed;
    inset: auto 10px 10px 10px;
    width: auto;
    height: min(72vh, 640px);
  }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #cdd5e1;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 移动端抽屉导航 */
.nav-toggle {
  display: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  margin-right: 6px;
  border-radius: 8px;
}

.nav-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    z-index: 40;
    box-shadow: 0 8px 30px rgba(16, 24, 40, 0.14);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    left: 0;
    height: 72px;
    padding: 0 14px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar-breadcrumb {
    display: none;
  }

  .header-description {
    display: none;
  }

  .user-menu-trigger #user-name {
    display: none;
  }

  .user-menu-trigger {
    padding-right: 6px;
  }

  .main {
    margin-left: 0;
    padding: 92px 14px 40px;
  }

  .card {
    padding: 16px;
  }

  .form-row input[type="text"],
  .form-row input[type="number"],
  .form-row input[type="email"],
  .form-row input[type="password"],
  .form-row select,
  .form-row textarea {
    max-width: 100%;
  }

  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .raw-detection-details > summary {
    padding: 16px;
  }

  .raw-detection-meta {
    display: none;
  }

  .raw-detection-body {
    padding: 0 16px 16px;
  }

  .engine-coverage-head,
  .engine-coverage li {
    display: block;
  }

  .engine-coverage-head span {
    display: block;
    margin-top: 4px;
  }

  .engine-coverage li strong {
    display: block;
    margin-bottom: 2px;
  }

  .engine-evidence-meta {
    display: none;
  }

  .engine-result-head {
    display: block;
  }

  .engine-result-badges {
    justify-content: flex-start;
    margin-top: 6px;
  }

  .dash-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-kpi-value {
    font-size: 26px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: 100dvh;
    padding: 20px;
  }

  .media-filter-card {
    padding: 14px 14px;
  }

  .qa-item {
    flex-direction: column;
    align-items: stretch;
  }

  .qa-item-actions {
    justify-content: flex-start;
    margin-top: 8px;
  }
}

@media (max-width: 600px) {
  .dash-kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.tag-blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.media-task-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
  background: var(--card);
}

.media-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-task-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.media-task-billing {
  margin-top: 6px;
  color: var(--blue);
  font-size: 12px;
}

.media-reference-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.media-reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-reference-add {
  align-self: flex-start;
  padding: 7px 12px;
  font-size: 12px;
}

.media-reference-chip {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
  width: 244px;
  max-width: 100%;
  min-height: 76px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--text-2);
}

.media-reference-preview {
  position: relative;
  width: 68px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: zoom-in;
}

.media-reference-preview:disabled {
  cursor: default;
}

.media-reference-preview img,
.media-reference-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-reference-index,
.media-reference-kind {
  position: absolute;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(12, 20, 36, 0.78);
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 600;
}

.media-reference-index {
  top: 4px;
  left: 4px;
}

.media-reference-kind {
  right: 4px;
  bottom: 4px;
}

.media-reference-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.media-reference-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.media-reference-title,
.media-reference-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-reference-title {
  color: var(--text);
  font-weight: 600;
}

.media-reference-name {
  color: var(--muted);
}

.media-reference-chip .media-reference-remove {
  align-self: start;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(12, 20, 36, 0.06);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.media-reference-chip .media-reference-remove:hover {
  color: var(--red, #d64545);
}

.media-reference-hint,
.media-pricing-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.media-capability-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.media-capability-row select {
  min-width: 132px;
}

.media-task-prompt {
  margin: 10px 0;
  color: var(--text-2);
  line-height: 1.6;
}

.media-task-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.media-task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.25s ease;
}

.media-task-preview {
  display: block;
  width: min(100%, 420px);
  max-height: 360px;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  object-fit: contain;
}

.media-task-preview[data-zoomable="1"] {
  cursor: zoom-in;
}

.media-task-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.media-task-gallery-item {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
}

.media-task-gallery-item img,
.media-task-gallery-item video {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--bg);
  cursor: zoom-in;
}

.media-task-gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text-2);
  font-size: 12px;
}

.media-task-gallery-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-task-gallery-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 12, 20, 0.86);
}

.media-lightbox.hidden {
  display: none;
}

.media-lightbox img,
.media-lightbox video {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.media-lightbox video {
  background: #000;
}

.media-lightbox img.hidden,
.media-lightbox video.hidden {
  display: none;
}

.media-lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.media-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* 媒体市场（对齐软文街 kol.cn） */
.media-filter-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.filter-row:last-child {
  border-bottom: 0;
}
.filter-label {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  line-height: 28px;
  min-width: 76px;
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.filter-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 20px;
  background: #f1f4f8;
  user-select: none;
  transition: color 0.16s ease, background 0.16s ease;
}
.filter-pill:hover {
  color: var(--blue);
}
.filter-pill.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.media-price-input {
  width: 100px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.media-price-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}
.media-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-top: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.media-item:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.media-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}
.media-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.media-badge {
  background: var(--amber-bg);
  color: var(--amber);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 7px;
}
.media-badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.media-badge.red {
  background: var(--red);
  color: #fff;
}
.media-price {
  margin-left: auto;
  color: var(--red);
  font-size: 18px;
  font-weight: 700;
}
.btn-order {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 22px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.08s ease;
}
.btn-order:hover {
  background: var(--blue-2);
}
.btn-order:active {
  transform: translateY(1px);
}
.media-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.media-detail {
  color: var(--text-2);
  font-size: 13px;
  line-height: 26px;
}
.media-detail .k {
  color: var(--muted);
  margin-right: 4px;
}
.media-detail.ai .v {
  color: var(--blue);
  font-weight: 500;
}

@media (max-width: 860px) {
  .report-viewer-panel {
    inset: 0;
    border: 0;
    border-radius: 0;
  }

  .report-viewer-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .report-viewer-actions {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .report-viewer-actions button {
    flex: 0 0 auto;
  }

  .report-viewer-scroll {
    padding: 0;
  }

  .report-doc {
    border: 0;
    border-radius: 0;
  }

  .report-cover {
    min-height: 230px;
    padding: 32px 20px 68px;
  }

  .report-cover h1 {
    font-size: 26px;
  }

  .report-score {
    right: 20px;
    bottom: 22px;
  }

  .report-score strong {
    font-size: 32px;
  }

  .report-section {
    padding: 26px 18px;
  }

  .report-kpi-grid,
  .report-insight-grid,
  .report-two-col {
    grid-template-columns: 1fr;
  }

  .report-chart {
    height: 270px;
  }

  .report-chart-compact {
    height: 230px;
  }

  .report-ready {
    align-items: flex-start;
    flex-direction: column;
  }

  .kb-media-form-grid,
  .kb-media-list {
    grid-template-columns: 1fr;
  }

  .kb-context-card {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .kb-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kb-section-tabs button {
    flex: 0 0 auto;
  }

  .kb-profile-grid,
  .kb-record-grid {
    grid-template-columns: 1fr;
  }

  .kb-profile-wide {
    grid-column: auto;
  }

  .kb-fact-toolbar {
    flex-wrap: wrap;
  }

  .kb-fact-toolbar select {
    width: 100%;
  }

  .kb-fact-record .kb-record-actions {
    max-width: none;
  }

  .kb-picker-item {
    grid-template-columns: 20px 42px minmax(0, 1fr);
  }

  .kb-picker-item select {
    grid-column: 2 / -1;
    width: 100%;
  }

  .kb-editor {
    width: 100%;
  }

  .keyword-filter-toolbar {
    flex-wrap: wrap;
  }

  .keyword-filter-toolbar select {
    width: 100%;
  }

  .keyword-manual-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .kb-media-item {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  #view-brand-kb .card-heading-row {
    align-items: stretch;
    flex-direction: column;
  }

  .kb-media-toolbar {
    justify-content: flex-start;
  }

  .kb-media-actions {
    flex-wrap: wrap;
  }

  .kb-media-actions select {
    flex-basis: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  body > *:not(#report-viewer) {
    display: none !important;
  }

  #report-viewer {
    position: static;
  }

  .report-viewer-backdrop,
  .report-viewer-topbar,
  .report-toc {
    display: none !important;
  }

  .report-viewer-panel {
    position: static;
    display: block;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report-viewer-scroll {
    overflow: visible;
    padding: 0;
  }

  .report-doc {
    max-width: none;
    border: 0;
    border-radius: 0;
  }

  .report-section {
    break-inside: avoid;
  }

  .report-source-details {
    display: none;
  }

  @page {
    size: A4;
    margin: 12mm;
  }
}
