<view class="container">
  <view class="hero fade-up">
    <view class="hero-badge">OPS DASHBOARD</view>
    <view class="hero-title">垃圾信息运营看板</view>
    <view class="hero-sub">覆盖发布、拦截、申诉、样本与模型状态，支持日常运营与风险监控。</view>
  </view>

  <view class="card fade-up fade-up-delay-1" wx:if="{{kpis.length}}">
    <view class="card-title">核心指标</view>
    <view class="grid-2">
      <view class="kpi" wx:for="{{kpis}}" wx:key="label">
        <view class="kpi-value">{{item.value}}</view>
        <view class="kpi-label">{{item.label}}</view>
      </view>
    </view>
  </view>

  <view class="card fade-up fade-up-delay-2" wx:if="{{stats && stats.threshold}}">
    <view class="card-title">检测阈值配置</view>
    <view class="row"><text class="label">当前阈值</text><text class="value">{{stats.threshold_text}}</text></view>
    <view class="row"><text class="label">更新时间</text><text class="value">{{stats.threshold.updated_at || '--'}}</text></view>
  </view>

  <view class="card fade-up fade-up-delay-2" wx:if="{{stats && stats.model_info}}">
    <view class="card-title">模型信息</view>
    <view class="row"><text class="label">模型版本</text><text class="value">{{stats.model_info.version || '未训练'}}</text></view>
    <view class="row"><text class="label">训练时间</text><text class="value">{{stats.model_info.trained_at || '--'}}</text></view>
    <view class="row"><text class="label">样本数量</text><text class="value">{{stats.model_info.sample_count || 0}}</text></view>
  </view>

  <view class="card fade-up fade-up-delay-3" wx:if="{{bars.length}}">
    <view class="card-title">近 7 天发布趋势</view>
    <view class="list-item" wx:for="{{bars}}" wx:key="date">
      <view class="row">
        <text class="label">{{item.label}}</text>
        <text class="value">{{item.value}} 条</text>
      </view>
      <view class="progress-track">
        <view class="progress-fill-safe" style="width: {{item.percent_text}};"></view>
      </view>
    </view>
  </view>

  <view class="card fade-up fade-up-delay-3" wx:if="{{sourceDist.length}}">
    <view class="card-title">训练样本来源</view>
    <view class="list-item" wx:for="{{sourceDist}}" wx:key="name">
      <view class="row"><text class="item-title">{{item.name}}</text><text class="value">{{item.value}}</text></view>
    </view>
  </view>

  <view class="card fade-up fade-up-delay-3" wx:if="{{topKeywords.length}}">
    <view class="card-title">高频风险词</view>
    <view class="chip-group">
      <text class="tag" wx:for="{{topKeywords}}" wx:key="token">{{item.token}} × {{item.count}}</text>
    </view>
  </view>
</view>
