/* ==========================================================================
   SVG 图表引擎样式（配合 assets/minichart.js）
   颜色一律走设计令牌，主题切换时图表自动跟随，无需二次处理
   ========================================================================== */

.mc-wrap {
  margin:8px 0 14px;
  padding:14px 14px 10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--card);
}

.mc-wrap--compact { padding:10px 10px 8px; }

/* .trend 原本是旧版 flex 柱条容器（固定高度 150px + align-items:flex-end）。
   换成 SVG 图表后必须退回普通块，否则图表会被压扁并向上溢出盖住标题。 */
.trend--chart {
  display:block;
  height:auto;
  padding-top:0;
}

.mc-wrap .mc {
  width:100%;
  height:auto;
  display:block;
  overflow:visible;
}

.mc-title {
  font-size:13px;
  font-weight:600;
  color:var(--ink);
  margin-bottom:8px;
}

.mc-note {
  font-size:11px;
  color:var(--ink4);
  margin-top:8px;
  line-height:1.6;
}

/* ---- 坐标轴与网格 ---- */
.mc-grid {
  stroke:var(--line-soft);
  stroke-width:1;
}

.mc-zero {
  stroke:var(--line-strong);
  stroke-width:1;
}

.mc-axis {
  font-size:11px;
  fill:var(--ink4);
}

.mc-cat {
  font-size:12px;
  fill:var(--ink2);
}

.mc-val {
  font-size:11px;
  font-weight:600;
  fill:var(--ink2);
}

/* 负值条形够长时，数值标签压在条形内侧，用白字保证可读 */
.mc-val--onbar {
  fill:#fff;
}

.mc-donut__total {
  font-size:20px;
  font-weight:700;
  fill:var(--ink);
}

/* ---- 图例 ---- */
.mc-legend {
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  margin-top:10px;
  padding-top:10px;
  border-top:1px dashed var(--line-soft);
}

.mc-legend__i {
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--ink3);
}

.mc-legend__i i {
  width:10px;
  height:10px;
  border-radius:3px;
  flex:none;
}

/* ---- 数据入场：柱体生长、折线描边、扇区展开 ---- */
.mc-bar {
  transform-origin:center bottom;
  animation:mc-grow .62s cubic-bezier(.22, 1, .36, 1) backwards;
}

.mc-line {
  stroke-dasharray:1200;
  stroke-dashoffset:1200;
  animation:mc-draw 1s cubic-bezier(.22, 1, .36, 1) forwards;
}

.mc-area {
  opacity:0;
  animation:mc-fade .7s .18s ease-out forwards;
}

.mc-dot {
  opacity:0;
  animation:mc-pop .34s .5s ease-out forwards;
}

.mc-arc {
  opacity:0;
  transform-origin:200px 130px;
  animation:mc-arc .6s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes mc-grow {
  from { transform:scaleY(0); opacity:.35; }
  to { transform:scaleY(1); opacity:1; }
}

@keyframes mc-draw {
  to { stroke-dashoffset:0; }
}

@keyframes mc-fade {
  to { opacity:1; }
}

@keyframes mc-pop {
  from { opacity:0; transform:scale(.4); }
  to { opacity:1; transform:scale(1); }
}

@keyframes mc-arc {
  from { opacity:0; transform:scale(.86); }
  to { opacity:1; transform:scale(1); }
}

/* 尊重系统的减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .mc-bar, .mc-line, .mc-area, .mc-dot, .mc-arc {
    animation:none !important;
    opacity:1 !important;
    transform:none !important;
    stroke-dashoffset:0 !important;
  }
}
