
  // ── Helpers ────────────────────────────────────────────────────
  // Read a feature flag from window.MINIONS_FEATURES (injected into the slim
  // HTML head before this IIFE). Mirrors MinionsFeatures.isOn from the classic
  // dashboard without pulling features-client.js into the slim bundle.
  function slimFeatureOn(id) {
    var f = window.MINIONS_FEATURES || { flags: {}, defaults: {} };
    if (Object.prototype.hasOwnProperty.call(f.flags || {}, id)) return f.flags[id] === true;
    return !!(f.defaults && f.defaults[id] === true);
  }

  function escHtml(s) {
    return String(s == null ? '' : s)
      .replace(/&/g, '&amp;')
      .replace(/</g, '&lt;')
      .replace(/>/g, '&gt;')
      .replace(/"/g, '&quot;')
      .replace(/'/g, '&#39;');
  }

  function relTime(iso) {
    if (!iso) return '';
    var t = typeof iso === 'number' ? iso : Date.parse(iso);
    if (isNaN(t)) return '';
    var s = Math.floor((Date.now() - t) / 1000);
    if (s < 0) s = 0;
    if (s < 60) return s + 's ago';
    var m = Math.floor(s / 60);
    if (m < 60) return m + 'm ago';
    var h = Math.floor(m / 60);
    if (h < 24) return h + 'h ago';
    var d = Math.floor(h / 24);
    return d + 'd ago';
  }

