/* Home demo page styles merged from Kinsight-demo (content) + Kinsight (nav layout) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary-color: #4A7DFF;
  --primary-hover: #3A6AE8;
  --primary-light: #EBF1FF;
  --secondary-color: #FFB800;
  --background-color: #F5F7FA;
  --card-background: #FFFFFF;
  --text-primary: rgba(0,0,0,.85);
  --text-secondary: rgba(0,0,0,.65);
  --text-muted: rgba(0,0,0,.45);
  --border-color: #EBEEF5;
  --success-color: #52C41A;
  --warning-color: #FAAD14;
  --danger-color: #FF6B6B;
  --chart-blue: #4A7DFF;
  --chart-yellow: #FFB800;
  --chart-orange: #FF9F43;
  --chart-green: #52C41A;
  --chart-pink: #FF6B9D;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #F0F2F5;
  color: var(--text-primary);
  font-size: 14px;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* ====== Kinsight chrome (topbar + sidebar) ====== */
.app-topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 16px;
}
.brand { font-size: 20px; font-weight: 400; line-height: 1; color: #111; }
.top-actions { display: inline-flex; align-items: center; gap: 18px; color: rgba(0,0,0,.85); font-size: 14px; }
.top-link { display: inline-flex; align-items: center; gap: 6px; color: rgba(0,0,0,.85); text-decoration: none; font-weight: 600; }
.top-link img { width: 14px; height: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#f5d6b4,#d3a77f); border: 1px solid #eee; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 230px;
  background: #fff;
  border-right: 1px solid var(--border-color);
  padding: 14px 0;
}
.nav-group { margin-bottom: 10px; }
.nav-item {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 0 24px;
  color: #252626;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  cursor: pointer;
}
.nav-item:hover { color: rgba(50,107,251,0.8); }
.nav-item img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.nav-item.active { color: #326bfb; }
.nav-arrow { margin-left: auto; color: #8C8C8C; font-size: 14px; font-weight: 400; }
.nav-item.active .nav-arrow { color: #326bfb; }
.sub-nav { display: flex; flex-direction: column; }
.sub-item {
  display: flex;
  align-items: center;
  padding: 14px 18px 14px 58px;
  color: #252626;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
}
.sub-item:hover { color: rgba(50,107,251,0.8); }
.sub-item.active { color: #326bfb; background: rgba(50,107,251,0.08); font-weight: 500; }

.content { flex: 1; padding: 16px; overflow: auto; }
.page { width: 100%; min-width: 1120px; }

/* ====== Home content ====== */
.home-shell { padding: 4px; }
.home-head { margin-bottom: 14px; }
.home-title {
  font-size: 20px;
  font-weight: 600;
  color: rgba(0,0,0,.85);
}
.brand-highlight { color: #1677FF; font-weight: 700; }

.card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-title { font-size: 16px; font-weight: 600; color: rgba(0,0,0,.85); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.card-header .card-title { margin-bottom: 0; }

.stats-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(251,252,255,0.95) 100%);
  border: 1px solid rgba(231, 236, 245, 0.95);
  border-radius: 24px;
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  min-height: 88px;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: auto 18px 16px auto;
  width: 132px;
  height: 132px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(74,125,255,0.10) 0%, rgba(74,125,255,0) 72%);
  pointer-events: none;
}
.stat-card::after {
  content: '';
  position: absolute;
  left: 24px;
  right: 24px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.2) 100%);
  pointer-events: none;
}
.stat-card:hover {
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
  border-color: rgba(214, 224, 240, 0.98);
}
.stat-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  align-items: center;
  column-gap: 16px;
  width: 100%;
  margin-bottom: 16px;
}
.stat-icon {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  justify-self: center;
  align-self: center;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
  opacity: 0.95;
}
.stat-icon.blue {
  background: linear-gradient(180deg, rgba(232,240,255,0.92) 0%, rgba(214,228,255,0.78) 100%);
  color: rgba(22,119,255,0.88);
}
.stat-icon.orange {
  background: linear-gradient(180deg, rgba(255,244,224,0.9) 0%, rgba(255,232,192,0.75) 100%);
  color: rgba(250,173,20,0.92);
}
.stat-icon svg { width: 42px; height: 42px; }
.stat-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
  width: 100%;
  min-height: 92px;
  padding-top: 2px;
}
.stat-label {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0, 0, 0, .85);
  margin: 0 0 14px;
  letter-spacing: 0.1px;
  text-align: left;
}
.stat-number-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  min-width: 0;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1.4px;
  color: #1D2B6F;
  line-height: 0.96;
}
.stat-unit {
  font-size: 18px;
  color: rgba(29,43,111,.72);
  font-weight: 600;
}
.stat-breakdown {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 13px;
  color: rgba(0,0,0,.38);
  line-height: 1.5;
}
.stat-chip {
  display: inline;
  width: auto;
  text-align: left;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  white-space: nowrap;
  box-shadow: none;
}
.stat-chip + .stat-chip::before {
  content: ' | ';
  color: rgba(0,0,0,.28);
  margin: 0 6px;
}

.case-revenue-section {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}
.coverage-layout {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 16px;
}
.coverage-chart-box {
  border: 1px solid #EEF1F5;
  border-radius: 10px;
  background: #fff;
  min-height: 300px;
}
.echart-box {
  width: 100%;
  height: 300px;
}
.wordcloud-echart {
  height: 340px;
}

/* 饼图 + 右侧自定义图例 */
.pie-with-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  padding: 8px 16px 8px 8px;
}
.pie-echart {
  flex: 0 0 312px;
  height: 336px;
}
.pie-legend-list {
  flex: 0 0 148px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: 336px;
  padding-left: 12px;
}
.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 4px;
  border-radius: 5px;
  transition: background var(--transition-fast);
  cursor: default;
  direction: rtl;
}
.pie-legend-item:hover {
  background: #F5F7FA;
}
.pie-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.pie-legend-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: rgba(0,0,0,.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}


.pie-legend-count {
  font-size: 12px;
  font-weight: 600;
  color: rgba(0,0,0,.75);
  white-space: nowrap;
  direction: ltr;
  flex-shrink: 0;
}
.pie-legend-pct {
  font-size: 11px;
  color: rgba(0,0,0,.35);
  white-space: nowrap;
  min-width: 24px;
  text-align: right;
  direction: ltr;
  flex-shrink: 0;
}

.case-header { margin-bottom: 10px; }
.case-switcher { display: inline-flex; gap: 8px; }
.case-card {
  position: relative;
  overflow: hidden;
}
.case-card::after {
  content: '';
  position: absolute;
  inset: auto -60px -80px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(74, 125, 255, 0.12) 0%, rgba(74, 125, 255, 0) 70%);
  pointer-events: none;
}
.case-content {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 0.95fr);
  gap: 18px;
  align-items: center;
  min-height: 300px;
}
.case-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0 4px;
}

.case-name { font-size: 22px; font-weight: 600; color: rgba(0,0,0,.85); margin-bottom: 12px; line-height: 1.35; transition: opacity .2s; }
.case-desc {
  max-width: 420px;
  font-size: 14px;
  color: rgba(0,0,0,.45);
  line-height: 1.8;
  margin-bottom: 14px;
  transition: opacity .2s;
}
.case-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.case-tag {
  font-size: 12px;
  padding: 4px 10px;
  color: #326bfb;
  background: rgba(50, 107, 251, 0.1);
  border-radius: 999px;
}

.case-visual {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.case-visual-glow {
  position: absolute;
  right: 4%;
  bottom: 6%;
  width: 240px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 167, 255, 0.22) 0%, rgba(124, 167, 255, 0.08) 42%, rgba(124, 167, 255, 0) 72%);
  filter: blur(8px);
}
.case-visual-svg {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  height: auto;
  opacity: 1;
  transition: opacity .2s ease;
}
.case-visual-svg svg {
  display: block;
  width: 100%;
  height: auto;
}
.case-visual[data-visual-type="causal"] .case-visual-glow {
  background: radial-gradient(circle, rgba(90, 120, 255, 0.18) 0%, rgba(90, 120, 255, 0.06) 42%, rgba(90, 120, 255, 0) 72%);
}
.case-visual[data-visual-type="device"] .case-visual-glow {
  background: radial-gradient(circle, rgba(124, 167, 255, 0.18) 0%, rgba(124, 167, 255, 0.05) 42%, rgba(124, 167, 255, 0) 72%);
}

.btn-primary {
  color: var(--primary-color);
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition: opacity var(--transition-fast);
  box-shadow: none;
  align-self: flex-start;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-primary::after { content: ' →'; transition: transform var(--transition-fast); }
.btn-primary:hover { opacity: .5; }
.btn-primary:hover::after { transform: translateX(3px); }

.case-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0,0,0,.45);
  transition: all var(--transition-normal);
  flex-shrink: 0;
}
.case-arrow:hover { background: var(--primary-light); color: var(--primary-color); }
.case-arrow svg { width: 16px; height: 16px; }

.filter-select {
  padding: 6px 12px;
  border: 1px solid #E8ECF0;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  color: rgba(0,0,0,.65);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.filter-select:hover { border-color: var(--primary-color); }
.filter-select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(74, 125, 255, 0.1); }

.revenue-stats-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.large-chart {
  width: 100%;
  height: 340px;
  position: relative;
}

.detail-section { margin-bottom: 4px; }
.table-scroll {
  width: 100%;
  overflow: auto;
}
.detail-table {
  min-width: 1040px;
}
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th, .ranking-table td { padding: 12px 8px; text-align: left; font-size: 13px; white-space: nowrap; }
.ranking-table th { color: rgba(0,0,0,.45); font-weight: 500; border-bottom: 1px solid #E8ECF0; }
.ranking-table tbody tr { transition: background var(--transition-fast); }
.ranking-table tbody tr:hover { background: var(--background-color); }
.ranking-table td { color: rgba(0,0,0,.75); border-bottom: 1px solid #F4F6F9; }

.table-link {
  color: #326bfb;
  font-weight: 400;
}
.table-link:hover {
  opacity: .75;
  text-decoration: underline;
}
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
}
.type-audience {
  color: #4A7DFF;
  background: rgba(74, 125, 255, 0.1);
}
.type-model {
  color: #FA8C16;
  background: rgba(250, 140, 22, 0.1);
}

body > div > main > div > div > section.case-revenue-section > div.card.case-card{
  padding-left: 40px;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: 3px 3px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}
.metric-badge-up {
  color: #52C41A;
  background: rgba(82, 196, 26, 0.10);
  border: 1px solid rgba(82, 196, 26, 0.18);
}
.metric-badge-down {
  color: #F5222D;
  background: rgba(245, 34, 45, 0.10);
  border: 1px solid rgba(245, 34, 45, 0.18);
}
.text-up { color: #16A34A; font-weight: 400; }
.text-down { color: #DC2626; font-weight: 400; }

@media (max-width: 1360px) {
  .sidebar { width: 200px; }
  .content { padding: 12px; }
  .page { min-width: 980px; }
  .stats-section { grid-template-columns: repeat(2, 1fr); }
  .case-revenue-section { grid-template-columns: 1fr; }
  .coverage-layout { grid-template-columns: 1fr; }
  .revenue-stats-section { grid-template-columns: 1fr; }
}
