// OLLYMEN Store OS — shared components & icons
const { useState, useEffect, useMemo, useRef } = React;

/* ---------------- Icons (inline, stroke-based, no emoji) ---------------- */
const I = {
  logo: (p={}) => (
    <svg viewBox="0 0 24 24" width={p.s||16} height={p.s||16} fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">
      <path d="M4 14c0-4 3.6-7 8-7s8 3 8 7"/>
      <path d="M3 14h18"/>
      <path d="M6 14c.4 2.5 2.7 4 6 4s5.6-1.5 6-4"/>
      <circle cx="9" cy="11.5" r=".7" fill="currentColor" stroke="none"/>
    </svg>
  ),
  home:    (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/><path d="M10 20v-6h4v6"/></svg>,
  store:   (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M3 9l1.2-4h15.6L21 9"/><path d="M3 9v10h18V9"/><path d="M3 9c0 1.8 1.3 3 3 3s3-1.2 3-3"/><path d="M9 9c0 1.8 1.3 3 3 3s3-1.2 3-3"/><path d="M15 9c0 1.8 1.3 3 3 3s3-1.2 3-3"/></svg>,
  list:    (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M8 6h12"/><path d="M8 12h12"/><path d="M8 18h12"/><circle cx="4" cy="6" r="1"/><circle cx="4" cy="12" r="1"/><circle cx="4" cy="18" r="1"/></svg>,
  box:     (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M3 7l9-4 9 4-9 4z"/><path d="M3 7v10l9 4 9-4V7"/><path d="M12 11v10"/></svg>,
  phone:   (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="7" y="3" width="10" height="18" rx="2"/><circle cx="12" cy="17.5" r=".7" fill="currentColor" stroke="none"/></svg>,
  grad:    (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M12 3l10 4-10 4L2 7z"/><path d="M6 9v5c0 2 3 4 6 4s6-2 6-4V9"/></svg>,
  board:   (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M8 4v16"/><path d="M3 10h5"/><path d="M3 14h5"/></svg>,
  chart:   (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M4 20V4"/><path d="M4 20h16"/><path d="M8 16v-4"/><path d="M12 16v-7"/><path d="M16 16v-9"/></svg>,
  bell:    (p={}) => <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M6 16V11a6 6 0 0 1 12 0v5l1.5 2H4.5z"/><path d="M10 20a2 2 0 0 0 4 0"/></svg>,
  search:  (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>,
  plus:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round"><path d="M12 5v14M5 12h14"/></svg>,
  chev:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="m9 6 6 6-6 6"/></svg>,
  chevd:   (p={}) => <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="m6 9 6 6 6-6"/></svg>,
  clock:   (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>,
  cam:     (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.2"/></svg>,
  pin:     (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M12 22s7-7.6 7-13a7 7 0 1 0-14 0c0 5.4 7 13 7 13z"/><circle cx="12" cy="9" r="2.5"/></svg>,
  alert:   (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d="M12 3 2 21h20z"/><path d="M12 10v4"/><circle cx="12" cy="17.5" r=".8" fill="currentColor" stroke="none"/></svg>,
  check:   (p={}) => <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><path d="m5 12 5 5L20 7"/></svg>,
  dots:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><circle cx="5" cy="12" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="19" cy="12" r="1.5"/></svg>,
  arrow:   (p={}) => <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h14"/><path d="m13 6 6 6-6 6"/></svg>,
  upload:  (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M12 16V4"/><path d="m6 10 6-6 6 6"/><path d="M4 20h16"/></svg>,
  user:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 20c1.5-3.5 4.6-5 8-5s6.5 1.5 8 5"/></svg>,
  copy:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></svg>,
  filter:  (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M4 5h16"/><path d="M7 12h10"/><path d="M10 19h4"/></svg>,
  refresh: (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M4 12a8 8 0 0 1 14-5l2 2"/><path d="M20 4v4h-4"/><path d="M20 12a8 8 0 0 1-14 5l-2-2"/><path d="M4 20v-4h4"/></svg>,
  link:    (p={}) => <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1"/><path d="M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1"/></svg>,
  flame:   (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M12 22c4 0 7-3 7-7 0-4-3-6-3-9 0 0-2 2-3 2 0-3-3-5-3-5s1 4-2 7-3 5-3 5c0 4 3 7 7 7z"/></svg>,
  wifi:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12a10 10 0 0 1 14 0"/><path d="M8.5 15.5a5 5 0 0 1 7 0"/><circle cx="12" cy="19" r=".8" fill="currentColor" stroke="none"/></svg>,
  battery: (p={}) => <svg viewBox="0 0 24 24" width="20" height="14" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="6" width="17" height="12" rx="2"/><rect x="4" y="8" width="11" height="8" fill="currentColor" rx="1"/><path d="M21 10v4"/></svg>,
  signal:  (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor"><rect x="3" y="14" width="3" height="6" rx="1"/><rect x="8" y="11" width="3" height="9" rx="1"/><rect x="13" y="7" width="3" height="13" rx="1"/><rect x="18" y="3" width="3" height="17" rx="1" opacity=".25"/></svg>,
  drop:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M12 3s6 7 6 11a6 6 0 0 1-12 0c0-4 6-11 6-11z"/></svg>,
  fish:    (p={}) => <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M3 12s3-5 8-5 7 3 10 5c-3 2-5 5-10 5s-8-5-8-5z"/><circle cx="16" cy="11" r=".8" fill="currentColor"/><path d="M3 12c1 1 1 3 0 4"/><path d="M3 12c1-1 1-3 0-4"/></svg>,
  menu:    (p={}) => <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><path d="M4 7h16"/><path d="M4 12h16"/><path d="M4 17h16"/></svg>,
};

/* ---------------- Status badge ---------------- */
function StatusBadge({ kind, label }) {
  const cls = { live: "live", opening: "opening", scout: "scout" }[kind] || "neutral";
  const text = label || ({ live: "운영 중", opening: "오픈 준비", scout: "확장 후보" }[kind]);
  return <span className={`badge ${cls}`}><span className="dot"></span>{text}</span>;
}

/* ---------------- Sidebar ---------------- */
const NAV = [
  { id: "dashboard", label: "대시보드",      icon: "home",  count: null },
  { id: "ops",       label: "운영일지",       icon: "list",  count: 3 },
  { id: "inv",       label: "메뉴 · 재고",    icon: "box",   count: 4 },
  { id: "mobile",    label: "마감 체크리스트", icon: "phone", count: null },
  { id: "onboard",   label: "직원 온보딩",     icon: "grad",  count: 3 },
  { id: "opening",   label: "신규 오픈 보드", icon: "board", count: 18, suffix: "D-" },
  { id: "report",    label: "주간 리포트",     icon: "chart", count: null },
];

function Sidebar({ active, onChange, open, onClose }) {
  const D = window.DATA;
  const [wsOpen, setWsOpen] = useState(false);
  const [workspace, setWorkspace] = useState("all"); // 'all' | store id
  const wsRef = useRef(null);

  useEffect(() => {
    if (!wsOpen) return;
    const close = (e) => { if (wsRef.current && !wsRef.current.contains(e.target)) setWsOpen(false); };
    window.addEventListener("mousedown", close);
    return () => window.removeEventListener("mousedown", close);
  }, [wsOpen]);

  const handle = (id) => { onChange(id); onClose && onClose(); };

  const currentWs = workspace === "all"
    ? { name: `All Stores (${D.stores.length})`, sub: "전체 통합 뷰" }
    : (() => {
        const s = D.stores.find(x => x.id === workspace);
        return { name: s.name, sub: s.tag + " · " + ({ live: "운영 중", opening: "오픈 준비", scout: "확장 후보" }[s.status]) };
      })();

  return (
    <>
    <aside className={`sidebar ${open ? "open" : ""}`}>
      <div className="sb-brand">
        <div className="sb-mark">올</div>
        <div className="sb-title">
          OLLYMEN
          <small>Store OS · v1.4</small>
        </div>
      </div>

      <div style={{ position: "relative" }} ref={wsRef}>
        <button className={`sb-store ${wsOpen ? "active" : ""}`} onClick={() => setWsOpen(v => !v)}>
          <div className={`avatar olive sm`}>{workspace === "all" ? "전체" : D.stores.find(s => s.id === workspace).short.slice(0, 2)}</div>
          <div style={{ minWidth: 0, flex: 1, textAlign: "left" }}>
            <div className="label">CURRENT WORKSPACE</div>
            <div className="name" style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
              {currentWs.name}
            </div>
          </div>
          <span className="chev" style={{ transform: wsOpen ? "rotate(180deg)" : "rotate(0deg)", transition: "transform .18s" }}>{I.chevd()}</span>
        </button>

        {wsOpen && (
          <div className="ws-dropdown">
            <div className="ws-h">매장 전환</div>
            <button className="ws-item" onClick={() => { setWorkspace("all"); setWsOpen(false); }}>
              <div className="avatar sm" style={{ background: "var(--surface-3)", color: "var(--ink-2)" }}>전체</div>
              <div style={{ flex: 1, minWidth: 0 }}>
                <div className="ws-name">All Stores</div>
                <div className="ws-sub">전체 {D.stores.length}개 매장 통합 뷰</div>
              </div>
              {workspace === "all" && <span className="ws-check">{I.check()}</span>}
            </button>
            <div className="ws-divider"></div>
            {D.stores.map(s => (
              <button key={s.id} className="ws-item" onClick={() => { setWorkspace(s.id); setWsOpen(false); }}>
                <div className={`avatar sm ${s.status === "live" ? "olive" : ""}`} style={s.status === "opening" ? { background: "var(--burnt-wash)", color: "var(--burnt)", boxShadow: "inset 0 0 0 1px oklch(0.84 0.06 60)" } : s.status === "scout" ? { background: "var(--surface-3)", color: "var(--ink-2)" } : null}>
                  {s.short.slice(0, 2)}
                </div>
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div className="ws-name">{s.name}</div>
                  <div className="ws-sub">
                    <span className="mono">{s.tag}</span>
                    <span> · </span>
                    <StatusBadge kind={s.status} />
                  </div>
                </div>
                {workspace === s.id && <span className="ws-check">{I.check()}</span>}
              </button>
            ))}
            <div className="ws-divider"></div>
            <button className="ws-action">{I.plus()} 새 지점 추가</button>
            <button className="ws-action">{I.copy()} 운영 기준 복제</button>
          </div>
        )}
      </div>

      <div className="sb-section">Workspace</div>
      <nav className="sb-nav">
        {NAV.slice(0, 1).map(n => (
          <NavItem key={n.id} n={n} active={active === n.id} onClick={() => handle(n.id)} />
        ))}
      </nav>

      <div className="sb-section">Operations</div>
      <nav className="sb-nav">
        {NAV.slice(1, 5).map(n => (
          <NavItem key={n.id} n={n} active={active === n.id} onClick={() => handle(n.id)} />
        ))}
      </nav>

      <div className="sb-section">Expansion</div>
      <nav className="sb-nav">
        {NAV.slice(5).map(n => (
          <NavItem key={n.id} n={n} active={active === n.id} onClick={() => handle(n.id)} />
        ))}
      </nav>

      <div className="sb-footer">
        <div className="sb-user">
          <div className="avatar">고대</div>
          <div style={{ minWidth: 0, flex: 1 }}>
            <div style={{ fontWeight: 600, fontSize: 12.5 }}>고대수</div>
            <div className="mono" style={{ color: "var(--muted)", fontSize: 11 }}>Owner · 본사</div>
          </div>
          <button className="iconbtn">{I.dots()}</button>
        </div>
      </div>
    </aside>
    <div className={`sb-backdrop ${open ? "open" : ""}`} onClick={onClose}></div>
    </>
  );
}

function NavItem({ n, active, onClick }) {
  const Icon = I[n.icon];
  return (
    <button className={`sb-item ${active ? "active" : ""}`} onClick={onClick}>
      <Icon />
      <span>{n.label}</span>
      {n.count != null && (
        <span className="count">{n.suffix || ""}{n.count}</span>
      )}
    </button>
  );
}

/* ---------------- Topbar ---------------- */
function Topbar({ crumbs, onLogout, onMenu }) {
  return (
    <div className="topbar">
      <button className="hamburger" onClick={onMenu} aria-label="메뉴">{I.menu()}</button>
      <div className="crumbs">
        {crumbs.map((c, i) => (
          <React.Fragment key={i}>
            {i > 0 && <span className="sep">/</span>}
            {i === crumbs.length - 1 ? <strong>{c}</strong> : <span className="crumb-hide">{c}</span>}
          </React.Fragment>
        ))}
      </div>
      <div className="tb-tools">
        <div className="tb-search">
          {I.search()}
          <input placeholder="지점 · 메뉴 · 직원 · 작업 검색" />
          <span className="kbd">⌘K</span>
        </div>
        <span className="demo-chip"><span className="dot"></span>DEMO MODE</span>
        <button className="tb-btn">{I.refresh()} <span className="label-md">동기화</span></button>
        <button className="iconbtn" title="알림">{I.bell()}</button>
        <button className="iconbtn" title="로그아웃" onClick={onLogout}>{I.user()}</button>
      </div>
    </div>
  );
}

/* ---------------- Progress bar ---------------- */
function Bar({ value, color = "ink", tall }) {
  const [w, setW] = useState(0);
  useEffect(() => {
    const id = requestAnimationFrame(() => {
      // small extra delay so the rise + bar fill don't overlap perfectly
      setTimeout(() => setW(Math.max(0, Math.min(100, value))), 60);
    });
    return () => cancelAnimationFrame(id);
  }, [value]);
  return (
    <div className={`bar ${tall ? "tall" : ""}`}>
      <i className={color} style={{ width: `${w}%`, transition: "width .9s cubic-bezier(.2,.7,.2,1)" }}></i>
    </div>
  );
}

/* ---------------- Count-up hook ---------------- */
function useCountUp(target, ms = 800, deps = []) {
  const [v, setV] = useState(0);
  useEffect(() => {
    const max = Number(target);
    if (!isFinite(max)) { setV(target); return; }
    let raf, start;
    const tick = (t) => {
      if (!start) start = t;
      const p = Math.min(1, (t - start) / ms);
      const eased = 1 - Math.pow(1 - p, 3);
      setV(max * eased);
      if (p < 1) raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => raf && cancelAnimationFrame(raf);
  }, deps);
  return v;
}

function formatCount(v, target) {
  const s = String(target);
  if (s.includes("/")) return s; // pass-through like "3 / 1"
  if (s.includes(".")) return Number(v).toFixed(1);
  return Math.round(v).toLocaleString();
}

/* ---------------- Metric card ---------------- */
function Metric({ k, v, unit, sub, delta, deltaDir, spark, accent }) {
  const animated = useCountUp(v, 750, [v]);
  const display = formatCount(animated, v);
  return (
    <div className="card metric rise" style={accent ? { borderLeft: `3px solid var(--${accent})` } : null}>
      <div className="k">{k}</div>
      <div className="v tnum">{display}{unit && <span className="unit">{unit}</span>}</div>
      {sub && <div className="muted" style={{ fontSize: 12 }}>{sub}</div>}
      {delta && <div className={`delta ${deltaDir || ""}`}>{delta}</div>}
      {spark}
    </div>
  );
}

/* ---------------- Tiny SVG sparkline ---------------- */
function Spark({ pts, color = "var(--ink-2)", fill = "var(--surface-3)" }) {
  const w = 200, h = 36;
  const max = Math.max(...pts), min = Math.min(...pts);
  const norm = pts.map((p, i) => {
    const x = (i / (pts.length - 1)) * w;
    const y = h - ((p - min) / (max - min || 1)) * (h - 4) - 2;
    return [x, y];
  });
  const d = norm.map((p, i) => `${i ? "L" : "M"}${p[0].toFixed(1)} ${p[1].toFixed(1)}`).join(" ");
  const a = `${d} L${w} ${h} L0 ${h} Z`;
  return (
    <svg className="spark" viewBox={`0 0 ${w} ${h}`} preserveAspectRatio="none">
      <path className="fill" d={a} fill={fill}/>
      <path className="draw" d={d} fill="none" stroke={color} strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round"/>
      {/* trailing dot */}
      <circle cx={norm[norm.length - 1][0]} cy={norm[norm.length - 1][1]} r="2.4" fill={color} style={{ animation: "fadein .4s ease-out 1.5s both" }}/>
    </svg>
  );
}

/* ---------------- Checkbox ---------------- */
function Check({ checked, onClick, size = 18 }) {
  return (
    <button
      className={`chk ${checked ? "checked" : ""}`}
      style={{ width: size, height: size }}
      onClick={onClick}
      type="button"
    >
      <svg viewBox="0 0 24 24"><path d="m5 12 5 5L20 7"/></svg>
    </button>
  );
}

/* ---------------- Tabs ---------------- */
function Tabs({ items, active, onChange }) {
  return (
    <div className="tabs">
      {items.map(t => (
        <button key={t.id} className={`tab ${active === t.id ? "active" : ""}`} onClick={() => onChange(t.id)}>
          {t.label}{t.count != null && <span className="cnt">{t.count}</span>}
        </button>
      ))}
    </div>
  );
}

/* ---------------- Card header ---------------- */
function CardHead({ title, sub, right }) {
  return (
    <div className="card-h">
      <div>
        <div className="t">{title}</div>
        {sub && <div className="sub" style={{ marginTop: 1 }}>{sub}</div>}
      </div>
      <div className="spacer"></div>
      {right}
    </div>
  );
}

/* ---------------- Empty placeholder ---------------- */
function Placeholder({ label, height = 160 }) {
  return (
    <div style={{
      height, borderRadius: 10,
      background:
        "repeating-linear-gradient(135deg, var(--surface-3) 0 8px, var(--surface) 8px 16px)",
      border: "1px dashed var(--line-strong)",
      color: "var(--muted)", fontFamily: "var(--font-mono)", fontSize: 12,
      display: "grid", placeItems: "center", textAlign: "center", padding: 12,
    }}>
      {label}
    </div>
  );
}

Object.assign(window, {
  I, StatusBadge, Sidebar, Topbar, Bar, Metric, Spark, Check, Tabs, CardHead, Placeholder, NAV,
  useCountUp, formatCount,
});
