body.baoku-admin-insights .analytics-dashboard.baoku-analytics-legacy-hidden {
  display: none !important;
}

.baoku-analytics-v2 {
  --insight-gold: #e3bd62;
  --insight-gold-soft: #f2d98e;
  --insight-green: #55d99a;
  --insight-blue: #72a8ff;
  --insight-purple: #aa86ff;
  --insight-muted: #91a199;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.baoku-analytics-v2 * { box-sizing: border-box; }

.baoku-insights-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  border: 1px solid rgba(227, 189, 98, .25);
  border-radius: 18px;
  background:
    radial-gradient(circle at 85% 20%, rgba(227, 189, 98, .12), transparent 38%),
    linear-gradient(135deg, rgba(24, 34, 30, .98), rgba(11, 17, 15, .98));
  box-shadow: inset 0 1px rgba(255,255,255,.025), 0 16px 40px rgba(0,0,0,.15);
}

.baoku-insights-hero-copy { min-width: 0; }
.baoku-insights-hero .baoku-insights-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--insight-gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}
.baoku-insights-hero h2 { margin: 0; font-size: 21px; line-height: 1.25; color: #f6f4ec; }
.baoku-insights-hero p { margin: 7px 0 0; color: #9daba5; font-size: 13px; line-height: 1.65; }
.baoku-insights-updated { color: #72817a; }

.baoku-insights-toolbar,
.baoku-insights-periods { display: flex; align-items: center; gap: 8px; }
.baoku-insights-toolbar { flex: none; }
.baoku-insights-periods {
  padding: 4px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(5, 9, 8, .58);
}
.baoku-insights-periods button,
.baoku-insights-refresh {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  padding: 0 13px;
  color: #91a099;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}
.baoku-insights-periods button:hover { color: #eee8d8; background: rgba(255,255,255,.05); }
.baoku-insights-periods button.active { color: #151914; background: linear-gradient(180deg, #f0d690, #d8b158); box-shadow: 0 7px 18px rgba(227,189,98,.18); }
.baoku-insights-refresh {
  border: 1px solid rgba(227,189,98,.22);
  color: #dac47f;
  background: rgba(227,189,98,.06);
}
.baoku-insights-refresh:hover { border-color: rgba(227,189,98,.45); background: rgba(227,189,98,.11); }
.baoku-insights-refresh:disabled { opacity: .55; cursor: wait; }

.baoku-insights-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.baoku-insight-metric {
  position: relative;
  min-width: 0;
  padding: 17px 17px 15px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(20,29,26,.98), rgba(11,16,14,.98));
}
.baoku-insight-metric::after {
  content: "";
  position: absolute;
  inset: auto -16px -32px auto;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric-accent, var(--insight-gold)) 12%, transparent);
  filter: blur(3px);
}
.baoku-insight-metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.baoku-insight-metric small { color: #899891; font-size: 12px; font-weight: 700; }
.baoku-insight-metric-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  color: var(--metric-accent, var(--insight-gold));
  background: color-mix(in srgb, var(--metric-accent, var(--insight-gold)) 10%, transparent);
  font-size: 12px;
}
.baoku-insight-metric strong { display: block; margin-top: 12px; color: #f7f5ed; font-size: 25px; line-height: 1; letter-spacing: -.035em; }
.baoku-insight-metric p { position: relative; z-index: 1; margin: 8px 0 0; color: #68766f; font-size: 11px; }

.baoku-insights-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 14px; align-items: stretch; }
.baoku-insights-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 17px;
  background: linear-gradient(150deg, rgba(17,25,22,.98), rgba(9,14,12,.98));
  box-shadow: inset 0 1px rgba(255,255,255,.018);
}
.baoku-insights-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 0; }
.baoku-insights-card-head h3 { margin: 0; color: #f1efe7; font-size: 15px; }
.baoku-insights-card-head p { margin: 6px 0 0; color: #74827b; font-size: 11px; line-height: 1.5; }
.baoku-insights-legend { display: flex; align-items: center; gap: 12px; color: #7f8e87; font-size: 10px; white-space: nowrap; }
.baoku-insights-legend span { display: inline-flex; align-items: center; gap: 5px; }
.baoku-insights-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--legend-color); }
.baoku-chart-shell { width: 100%; padding: 8px 12px 10px; }
.baoku-chart-shell svg { display: block; width: 100%; height: 256px; overflow: visible; }
.baoku-chart-grid { stroke: rgba(255,255,255,.055); stroke-width: 1; }
.baoku-chart-axis { fill: #596861; font-size: 10px; font-family: inherit; }
.baoku-chart-value { fill: #aeb9b3; font-size: 9px; font-family: inherit; font-weight: 700; }
.baoku-chart-line { fill: none; stroke: #62d79d; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 3px 6px rgba(84,219,157,.28)); }
.baoku-chart-dot { fill: #0d1512; stroke: #70e2ad; stroke-width: 2.5; }

.baoku-source-card { display: flex; flex-direction: column; }
.baoku-source-body { display: grid; grid-template-columns: 150px minmax(0,1fr); align-items: center; gap: 10px; padding: 16px 18px 20px; min-height: 277px; }
.baoku-source-donut { position: relative; width: 142px; height: 142px; }
.baoku-source-donut svg { width: 100%; height: 100%; filter: drop-shadow(0 12px 20px rgba(0,0,0,.24)); }
.baoku-source-donut-center { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; pointer-events: none; }
.baoku-source-donut-center small { color: #718078; font-size: 10px; }
.baoku-source-donut-center strong { max-width: 95px; margin-top: 3px; overflow: hidden; color: #f0dd9f; font-size: 13px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.baoku-source-list { display: grid; gap: 11px; min-width: 0; }
.baoku-source-row { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; gap: 9px; }
.baoku-source-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--source-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--source-color) 10%, transparent); }
.baoku-source-name { min-width: 0; overflow: hidden; color: #b5c0ba; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.baoku-source-count { color: #eef0e8; font-size: 11px; font-weight: 800; }
.baoku-source-count small { margin-left: 4px; color: #65736c; font-weight: 600; }
.baoku-empty { display: grid; min-height: 190px; place-items: center; color: #64736b; font-size: 12px; }

.baoku-device-list { display: grid; gap: 15px; padding: 20px; }
.baoku-device-row { display: grid; gap: 7px; }
.baoku-device-meta { display: flex; justify-content: space-between; gap: 12px; color: #abb6b0; font-size: 12px; }
.baoku-device-meta strong { color: #e8e9e2; }
.baoku-device-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.055); }
.baoku-device-track span { display: block; width: var(--device-width); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a57e31, #efd27f); box-shadow: 0 0 14px rgba(227,189,98,.22); }

.baoku-pages-card { padding-bottom: 8px; }
.baoku-pages-table-wrap { overflow-x: auto; padding: 11px 20px 14px; }
.baoku-pages-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.baoku-pages-table th { padding: 10px 12px; color: #6e7d75; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid rgba(255,255,255,.07); }
.baoku-pages-table td { padding: 12px; color: #a9b5af; border-bottom: 1px solid rgba(255,255,255,.045); }
.baoku-pages-table tbody tr:last-child td { border-bottom: 0; }
.baoku-pages-table tbody tr:hover td { background: rgba(227,189,98,.025); }
.baoku-pages-table .path { max-width: 520px; overflow: hidden; color: #e5e7df; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.baoku-pages-table .num { width: 110px; color: #e7d393; font-weight: 800; text-align: right; }

.baoku-insights-loading,
.baoku-insights-error { display: grid; min-height: 360px; place-items: center; border: 1px solid rgba(255,255,255,.07); border-radius: 17px; background: rgba(11,17,15,.9); color: #7d8b84; }
.baoku-insights-loading > div,
.baoku-insights-error > div { display: grid; justify-items: center; gap: 12px; text-align: center; }
.baoku-insights-loader { width: 30px; height: 30px; border: 2px solid rgba(227,189,98,.16); border-top-color: var(--insight-gold); border-radius: 50%; animation: baoku-insight-spin .8s linear infinite; }
.baoku-insights-error button { min-height: 36px; border: 1px solid rgba(227,189,98,.3); border-radius: 9px; padding: 0 14px; color: #e0c576; background: rgba(227,189,98,.08); cursor: pointer; }
@keyframes baoku-insight-spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .baoku-insights-grid { grid-template-columns: 1fr; }
  .baoku-source-body { grid-template-columns: 180px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .baoku-insights-hero { align-items: stretch; flex-direction: column; padding: 17px; }
  .baoku-insights-toolbar { justify-content: space-between; }
  .baoku-insights-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .baoku-insight-metric strong { font-size: 22px; }
  .baoku-insights-card-head { flex-direction: column; padding: 16px 16px 0; }
  .baoku-chart-shell { min-width: 680px; }
  .baoku-insights-card:has(.baoku-chart-shell) { overflow-x: auto; }
  .baoku-source-body { grid-template-columns: 142px minmax(0, 1fr); }
  .baoku-pages-table-wrap { padding-inline: 14px; }
}

@media (max-width: 520px) {
  .baoku-insights-metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .baoku-insight-metric:last-child { grid-column: 1 / -1; }
  .baoku-insight-metric { padding: 14px; }
  .baoku-insights-periods button { padding-inline: 10px; }
  .baoku-insights-refresh { padding-inline: 11px; }
  .baoku-source-body { grid-template-columns: 1fr; justify-items: center; }
  .baoku-source-list { width: 100%; }
}
