/* ─── Stats section ─── */
    .stats-pane {
      height: 100%; overflow-y: auto; overflow-x: hidden;
      display: flex; flex-direction: column;
      background: var(--bg2); grid-column: 2/4;
    }
    /* Head */
    .stats-head {
      flex-shrink: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
      padding: 16px 20px 12px; background: var(--surface);
      border-bottom: 1px solid var(--border);
    }
    .stats-title { font-size: 20px; font-weight: 800; color: var(--text); margin-right: 6px; }
    .stats-period-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
    .sptab {
      padding: 7px 14px; border-radius: 18px; border: none; background: transparent;
      color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer;
      transition: background .12s, color .12s; font-family: inherit;
    }
    .sptab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
    .sptab:hover:not(.active) { background: rgba(255,255,255,.06); color: var(--text); }
    .stats-custom-range {
      display: flex; align-items: center; gap: 6px; margin-left: 4px;
    }
    .stats-date-inp {
      background: var(--bg3); border: 1px solid var(--border); border-radius: 7px;
      padding: 5px 8px; color: var(--text); font-family: inherit; font-size: 12px;
      outline: none; color-scheme: dark;
    }
    .stats-date-inp:focus { border-color: var(--accent); }
    .stats-apply-btn {
      padding: 5px 11px; border-radius: 7px; border: none;
      background: var(--accent); color: #fff; font-size: 12px; font-weight: 500;
      cursor: pointer; font-family: inherit;
    }
    .stats-head-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
    .stats-dl-btn {
      display: flex; align-items: center; gap: 5px; padding: 6px 12px;
      border-radius: 8px; border: 1px solid var(--border); background: var(--bg3);
      color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer;
      transition: background .13s; font-family: inherit;
    }
    .stats-dl-btn:hover { background: var(--bg4); }
    .stats-dl-btn i { font-size: 14px; }
    /* Summary cards */
    .stats-cards-row {
      flex-shrink: 0; display: flex; gap: 10px; flex-wrap: wrap;
      padding: 14px 20px 10px;
    }
    .stat-card {
      flex: 1; min-width: 110px;
      background: var(--bg); border-radius: 12px; padding: 12px 14px;
      border: 1px solid rgba(255,255,255,.06);
    }
    .stat-num { font-size: 22px; font-weight: 700; letter-spacing: -.5px; color: var(--text); }
    .stat-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .stat-delta { font-size: 11px; margin-top: 3px; }
    .stat-delta.up { color: var(--green); }
    .stat-delta.dn { color: var(--red); }
    /* Body: charts + demographics */
    .stats-body {
      flex: 1; min-height: 0;
      display: grid; grid-template-columns: 1fr 300px; gap: 0;
    }
    .stats-charts {
      display: flex; flex-direction: column; gap: 0;
      padding: 0 0 20px; border-right: 1px solid var(--border);
      overflow-y: auto;
    }
    .stats-demo {
      display: flex; flex-direction: column; gap: 0;
      overflow-y: auto;
    }
    .chart-card {
      background: var(--bg); margin: 12px 16px 0;
      border-radius: 12px; border: 1px solid rgba(255,255,255,.06);
      padding: 14px 16px;
    }
    .chart-title {
      font-size: 12.5px; font-weight: 600; color: var(--text);
      margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;
    }
    .chart-legend {
      display: flex; gap: 12px;
    }
    .chart-legend-item {
      display: flex; align-items: center; gap: 5px;
      font-size: 11px; color: var(--muted);
    }
    .chart-legend-dot {
      width: 8px; height: 8px; border-radius: 50%;
    }
    .stats-chart-canvas { width: 100%; display: block; }
    /* Demo panels */
    .demo-card {
      border-bottom: 1px solid var(--border); padding: 14px 14px;
    }
    .demo-title { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .4px; }
    .hbar-row { display: flex; flex-direction: column; gap: 6px; }
    .hbar-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
    .hbar-label { width: 70px; flex-shrink: 0; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .hbar-track { flex: 1; background: rgba(255,255,255,.07); border-radius: 3px; height: 6px; overflow: hidden; }
    .hbar-fill { height: 100%; border-radius: 3px; }
    .hbar-val { width: 36px; text-align: right; color: var(--text); font-size: 11px; flex-shrink: 0; }
    .stats-error-banner {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      padding: 60px 20px; text-align: center; grid-column: 1/-1;
    }
    .stats-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
    .stats-loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; }
