.insights { margin: -6px 0 22px; }
.insights[hidden] { display: none; }
.insights-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.insights-toggle { display: flex; align-items: center; gap: 12px; padding: 4px 10px 4px 4px; border: 0; border-radius: 14px; background: none; color: inherit; text-align: left; transition: background .2s; }
.insights-toggle:hover { background: var(--primary-50); }
.insights-title strong { display: block; font-family: var(--font-heading); font-size: 15px; font-weight: 600; line-height: 1.2; }
.insights-title small { display: block; color: var(--muted); font-size: 12px; }
.insights-toggle .chev { color: var(--muted); transition: transform .3s var(--ease); }
.insights.collapsed .insights-toggle .chev { transform: rotate(-90deg); }
.insights.collapsed .insights-grid { display: none; }
.insights.collapsed { margin-bottom: 14px; }
.insights-head .btn-icon .spin { display: inline-block; animation: insightsSpin .8s linear infinite; }
@keyframes insightsSpin { to { transform: rotate(360deg); } }

.insights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.insight-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); animation: fadeUp .5s var(--ease) both; transition: box-shadow .3s var(--ease), border-color .3s; }
.insight-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-100); }
.insight-card.is-loading { padding: 20px; min-height: 290px; }
@media (min-width: 1200px) { .insight-card.wide { grid-column: span 2; } }

.insight-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px 6px; }
.ic-icon { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--primary-50); color: var(--primary-600); font-size: 16px; }
.ic-title { min-width: 0; flex: 1 1 130px; }
.ic-title h6 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ic-title small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.chart-switch { display: inline-flex; flex-shrink: 0; margin-left: auto; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.chart-switch button { width: 28px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; transition: background .2s, color .2s; }
.chart-switch button:hover { color: var(--primary-600); }
.chart-switch button.active { background: var(--surface); color: var(--primary-600); box-shadow: var(--shadow-xs); }

.insight-card-body { flex: 1; padding: 8px 16px 16px; min-height: 0; }
.ic-canvas { position: relative; }
.ic-canvas.plot { height: 228px; }
.ic-round { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: 14px; align-items: center; height: 228px; }
.ic-round .ic-canvas { height: 144px; }
.ic-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ic-center strong { font-family: var(--font-heading); font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; }
.ic-center span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ic-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 228px; overflow-y: auto; }
.ic-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; gap: 1px 8px; padding: 5px 6px; border-radius: 8px; font-size: 12.5px; }
.ic-legend .val { grid-column: 2; display: flex; align-items: baseline; gap: 6px; }
.ic-legend li[data-legend] { cursor: pointer; }
.ic-legend li[data-legend]:hover, .ic-legend li[data-legend]:focus-visible { background: var(--primary-50); outline: none; }
.ic-legend i { width: 10px; height: 10px; border-radius: 3px; }
.ic-legend .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.ic-legend strong { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.ic-legend small { color: var(--muted-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ic-empty { height: 228px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted-2); font-size: 13px; border: 1px dashed var(--border); border-radius: 12px; }
.ic-empty i { font-size: 26px; opacity: .6; }

@media (max-width: 767.98px) {
  .insights { margin-top: -10px; }
  .insights-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 2px 2px 8px; scrollbar-width: none; }
  .insights-grid::-webkit-scrollbar { display: none; }
  .insight-card { flex: 0 0 86%; scroll-snap-align: center; }
  .ic-round { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; height: 200px; }
  .ic-round .ic-canvas { height: 120px; }
  .ic-canvas.plot, .ic-empty { height: 200px; }
  .ic-legend { max-height: 200px; }
}
@media (prefers-reduced-motion: reduce) { .insight-card { animation: none; } }
