/* Clear Mint — Reconciliation engine. window.PageReconciliation (overrides the
   cm-pages-banking fallback). Reads every imported OFX/CC transaction, matches it to
   an account, scores match confidence, classifies type, flags duplicates, detects
   recurring patterns, and lets the user Confirm / Edit / Ignore / Create Rule. User
   decisions + rules persist on CM.S (_reconStatus / _reconRules) and never mutate the
   original OFX data. Depends on cm-charts + cm-components + cm-app-kit + cm-recurring. */
(function(){
const { MetricCard, ChartCard, DataTable, KpiRow, StatusPill, Tabs } = window;
const I = window.CMIcon;
const G='#10915F', BL='#3E7CC4', AM='#B5740F', PU='#8A6E9E', RD='var(--red-500)', SL='#9AA7B2', GOLD='#C99A2E';
const TABS = ['Overview','All Transactions','Matched','Needs Review','Recurring Matches','Duplicates','Rules'];
const TYPES = ['Income','Expense','Bill','Subscription','Transfer','Credit Card Payment','Loan','Mortgage','Insurance'];

const clean = (s)=> window.cleanVendorName ? window.cleanVendorName(s) : String(s||'').trim();
function typeOf(t){
  const c=t.cat||'Other'; const isCr=(+t.cr||0)>0;
  if(c==='Credit Card Payment') return 'Credit Card Payment';
  if(c==='Transfer'||c==='Savings') return 'Transfer';
  if(c==='Debt Payment') return /mortgage/i.test(t.desc||'')?'Mortgage':'Loan';
  if(c==='Insurance') return 'Insurance';
  if(c==='Subscriptions') return 'Subscription';
  if(c==='Income') return 'Income';
  if(c==='Housing'||c==='Utilities'||c==='Education'||c==='Childcare') return 'Bill';
  return isCr ? 'Income' : 'Expense';
}
function confBadge(c){
  const col = c>=95?G : c>=85?'#2E8B57' : c>=70?GOLD : RD;
  return <span className="num" style={{fontWeight:800,fontSize:12,color:'#fff',background:col,borderRadius:999,padding:'2px 9px'}}>{c}%</span>;
}
function statusPill(s){
  if(s==='Confirmed') return <StatusPill tone="green" icon={<I.Check size={12}/>}>Confirmed</StatusPill>;
  if(s==='Matched') return <StatusPill tone="green">Matched</StatusPill>;
  if(s==='Needs Review') return <StatusPill tone="amber">Needs Review</StatusPill>;
  if(s==='Ignored') return <StatusPill tone="slate">Ignored</StatusPill>;
  if(s==='Duplicate') return <StatusPill tone="red">Duplicate</StatusPill>;
  return <StatusPill tone="slate">{s}</StatusPill>;
}

function PageReconciliation(){
  const CM = window.useStore ? window.useStore() : window.CM;
  const BrandIcon = window.BrandIcon;
  const fmt = CM.M, fmt0 = CM.M0;
  const S = CM.S;
  const [tab,setTab] = React.useState('Overview');
  const [q,setQ] = React.useState('');
  const [typeF,setTypeF] = React.useState('All');
  const [confF,setConfF] = React.useState('All');
  const [period,setPeriod] = React.useState('month');
  const [selL,setSelL] = React.useState({});
  const [selR,setSelR] = React.useState({});

  const accounts = S.accounts||[], cards = S.cards||[];
  const acctName = (t)=> t.account || (t.acctIdx!=null&&accounts[t.acctIdx]&&accounts[t.acctIdx].name) || t.card || (t.cardIdx!=null&&cards[t.cardIdx]&&cards[t.cardIdx].name) || 'Unassigned';
  const status = S._reconStatus||{};
  const rules = S._reconRules||[];

  // recurring vendor set (cadence-detected)
  const groups = (window.CMrecurring&&window.CMrecurring.buildGroups)?window.CMrecurring.buildGroups(S.bankTx):[];
  const recurSet = {}; groups.forEach(g=>{ recurSet[clean(g.name).toLowerCase()]=g; });

  function confidenceOf(t){
    let c=66;
    if(t.ref) c+=18;                                   // FITID present
    if((t.cat||'Other')!=='Other') c+=10;              // categorized
    if(recurSet[clean(t.desc).toLowerCase()]) c+=14;   // recurring pattern
    return Math.min(100,c);
  }

  // build reconciled rows (never mutates source)
  const raw = [].concat((S.bankTx||[]).map((t,i)=>({t,k:'b'+i})), (S.ccTx||[]).map((t,i)=>({t,k:'c'+i})));
  const seen = {};
  let rows = raw.map(({t,k})=>{
    const id = t.id || t.ref || k;
    const amt = (+t.dr||0)>0 ? -(+t.dr) : (+t.cr||0);
    const dkey = t.ref ? ('f'+t.ref) : ((t.acctIdx)+'|'+(t.date&&new Date(t.date).toISOString().slice(0,10))+'|'+Math.round(Math.abs(amt)*100)+'|'+clean(t.desc).slice(0,16).toLowerCase());
    const dup = !!seen[dkey]; seen[dkey]=true;
    let type=typeOf(t), cat=t.cat||'Other', conf=confidenceOf(t), source = t.ref?'FITID match':'category model';
    const rule = rules.find(r=> r.active!==false && r.keyword && (t.desc||'').toLowerCase().indexOf(String(r.keyword).toLowerCase())>=0);
    if(rule){ type=rule.type||type; cat=rule.category||cat; conf=100; source='rule: '+(rule.name||rule.keyword); }
    else if(recurSet[clean(t.desc).toLowerCase()]) source='recurring pattern';
    let st = status[id] || (dup ? 'Duplicate' : ((conf>=95||(rule&&rule.autoConfirm)) ? 'Confirmed' : conf>=85 ? 'Matched' : 'Needs Review'));
    return { id, date:t.date, ts:CM.toTs(t.date)||0, desc:clean(t.desc)||'—', orig:t.desc||'', amt, type, cat, conf, status:st, account:acctName(t), dup, ref:t.ref };
  }).sort((a,b)=> a.ts-b.ts);   /* bank-statement order: oldest → newest */

  // period scope — governs both the KPI key figures and every tab below
  const periodLabel = window.cmPeriodLabel?window.cmPeriodLabel(period):'';
  const prows = window.cmInPeriod ? rows.filter(r=>window.cmInPeriod(r.date, period)) : rows;

  // summaries (period-scoped)
  const total=prows.length, dups=prows.filter(r=>r.dup).length;
  const review=prows.filter(r=>r.status==='Needs Review').length;
  const matched=prows.filter(r=>r.status==='Matched'||r.status==='Confirmed').length;
  const incomeM=prows.filter(r=>r.type==='Income'&&!r.dup&&r.status!=='Ignored').reduce((s,r)=>s+Math.abs(r.amt),0);
  const expenseM=prows.filter(r=>['Expense','Bill','Subscription'].indexOf(r.type)>=0&&!r.dup&&r.status!=='Ignored').reduce((s,r)=>s+Math.abs(r.amt),0);
  const accuracy = total ? Math.round(matched/Math.max(1,total-dups)*100) : 0;
  const entries = [].concat((S.bills||[]).map(b=>({name:b.name||b.desc,amount:+b.amount||0,kind:'Bill',auto:!!b._auto})),(S.earnings||[]).map(e=>({name:e.source||e.desc,amount:+e.amount||0,kind:'Income',auto:!!e._auto})),(S.subscriptions||[]).map(s=>({name:s.name,amount:+s.price||0,kind:'Subscription',auto:!!s._auto})));

  // actions
  const setSt = (id,val)=> CM.mutate(function(){ (CM.S._reconStatus=CM.S._reconStatus||{})[id]=val; });
  const editCat = (r)=>{ const nv=window.prompt('Vendor / description (sets the logo)', r.orig||r.desc); if(nv===null) return; const nc=window.prompt('Category', r.cat); CM.mutate(function(){ (CM.S.bankTx||[]).concat(CM.S.ccTx||[]).forEach(function(t){ if((t.id||t.ref)===r.id){ if(nv) t.desc=nv; if(nc) t.cat=nc; } }); (CM.S._reconStatus=CM.S._reconStatus||{})[r.id]='Confirmed'; }); };
  const createRule = (r)=>{ const kw=window.prompt('Create rule — match description containing:', r.desc.split(' ')[0]); if(!kw) return; const ty=window.prompt('Transaction type', r.type)||r.type; const cat=window.prompt('Category', r.cat)||r.cat; const auto=window.confirm('Auto-confirm future matches?'); CM.mutate(function(){ (CM.S._reconRules=CM.S._reconRules||[]).push({name:kw,keyword:kw,type:ty,category:cat,autoConfirm:auto,active:true}); }); };
  const addRule = ()=>{ const kw=window.prompt('Match if description contains:'); if(!kw) return; const ty=window.prompt('Transaction type ('+TYPES.join(' / ')+')','Bill')||'Bill'; const cat=window.prompt('Category','')||''; const auto=window.confirm('Auto-confirm matches for this rule?'); CM.mutate(function(){ (CM.S._reconRules=CM.S._reconRules||[]).push({name:kw,keyword:kw,type:ty,category:cat,autoConfirm:auto,active:true}); }); };
  const delRule = (i)=> CM.mutate(function(){ (CM.S._reconRules||[]).splice(i,1); });

  // tab filtering (over the period-scoped set)
  let view = prows;
  if(tab==='Matched') view = prows.filter(r=>r.status==='Matched'||r.status==='Confirmed');
  else if(tab==='Needs Review') view = prows.filter(r=>r.status==='Needs Review');
  else if(tab==='Duplicates') view = prows.filter(r=>r.dup);
  if(q) view = view.filter(r=>(r.desc+' '+r.orig+' '+r.account).toLowerCase().includes(q.toLowerCase()));
  if(typeF!=='All') view = view.filter(r=>r.type===typeF);
  if(confF!=='All') view = view.filter(r=> confF==='High'?r.conf>=95 : confF==='Medium'?(r.conf>=70&&r.conf<95) : r.conf<70);

  const cols = [
    { header:'Date', cell:r=><span className="num" style={{fontSize:13,color:'var(--ink-600)',fontWeight:600,whiteSpace:'nowrap'}}>{CM.FD(r.date)}</span> },
    { header:'Transaction', cell:r=>(<div className="cm-cell-lead"><BrandIcon name={r.orig} size={32} radius={8}/><div style={{minWidth:0}}><div className="cm-cell-primary" style={{whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',maxWidth:230}}>{r.desc}</div><div className="cm-cell-sub" style={{whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',maxWidth:230}}>{r.account} · {r.orig}</div></div></div>) },
    { header:'Type', cell:r=><span className="cm-pill cm-pill-slate" style={{fontWeight:700,fontSize:11}}>{r.type}</span> },
    { header:'Category', cell:r=><span className="num" style={{fontSize:12.5,color:'var(--ink-500)',fontWeight:600}}>{r.cat}</span> },
    { header:'Amount', align:'right', cell:r=><span className="num" style={{fontWeight:700,color:r.amt<0?'var(--ink-900)':G}}>{(r.amt<0?'-':'+')+fmt(Math.abs(r.amt)).slice(1)}</span> },
    { header:'Confidence', cell:r=>confBadge(r.conf) },
    { header:'Status', cell:r=>statusPill(r.status) },
    { header:'Actions', align:'right', cell:r=>(
      <div style={{display:'inline-flex',gap:6,whiteSpace:'nowrap'}}>
        {r.status!=='Confirmed' && <span title="Confirm this match" onClick={()=>setSt(r.id,'Confirmed')} style={tb(G)}>Confirm</span>}
        <span title="Edit category" onClick={()=>editCat(r)} style={tb(BL)}>Edit</span>
        <span title="Create a rule from this" onClick={()=>createRule(r)} style={tb(GOLD)}>Rule</span>
        <span title="Ignore this transaction" onClick={()=>setSt(r.id,'Ignored')} style={tb(SL)}>Ignore</span>
      </div>) },
  ];

  return (
    <div>
      <div style={{display:'flex',justifyContent:'space-between',alignItems:'center',gap:10,flexWrap:'wrap',marginBottom:14}}>
        <span className="t-caption">Key figures &amp; tabs below reflect <b style={{color:'var(--ink-700)'}}>{periodLabel}</b></span>
        {window.PeriodBar ? <window.PeriodBar value={period} onChange={setPeriod}/> : null}
      </div>
      <KpiRow>
        <MetricCard label="OFX Transactions" value={total.toLocaleString()} sub={periodLabel}/>
        <MetricCard label="Matched" labelColor="var(--green-600)" value={matched.toLocaleString()} sub={accuracy+'% reconciled'}/>
        <MetricCard label="Needs Review" labelColor="#B5740F" value={review.toLocaleString()} sub="awaiting confirmation"/>
        <MetricCard label="Duplicates Ignored" value={dups.toLocaleString()} sub="flagged automatically"/>
      </KpiRow>

      <div style={{margin:'4px 0 16px'}}><Tabs tabs={TABS} value={tab} onChange={setTab}/></div>

      {tab==='Overview' && (
        <div>
          {window.RecurringSuggestions ? <window.RecurringSuggestions/> : null}
          <div className="cm-grid-3 cm-mb-24">
            <ChartCard title="Income Matched"><div className="num" style={{fontSize:30,fontWeight:800,color:G}}>{fmt0(incomeM)}</div><div className="t-caption" style={{marginTop:4}}>Confirmed deposits this dataset</div></ChartCard>
            <ChartCard title="Expenses Matched"><div className="num" style={{fontSize:30,fontWeight:800,color:RD}}>{fmt0(expenseM)}</div><div className="t-caption" style={{marginTop:4}}>Bills, subscriptions & spending</div></ChartCard>
            <ChartCard title="Recurring Detected"><div className="num" style={{fontSize:30,fontWeight:800,color:PU}}>{groups.length}</div><div className="t-caption" style={{marginTop:4}}>Patterns across your accounts</div></ChartCard>
          </div>
          {(function(){
            const bankList = prows.filter(r=>!r.dup).slice(0,60);
            const selLArr = entries.filter((e,i)=>selL[i]);
            const selRArr = bankList.filter((r,i)=>selR[i]);
            const sumL = selLArr.reduce((s,e)=>s+Math.abs(e.amount),0);
            const sumR = selRArr.reduce((s,r)=>s+Math.abs(r.amt),0);
            const diff = Math.round((sumL-sumR)*100)/100;
            const can = selLArr.length>0 && selRArr.length>0 && Math.abs(diff)<0.01;
            const reconcile = ()=>{ CM.mutate(function(){ selLArr.forEach(function(e){ var b=(CM.S.bills||[]).find(function(x){return (x.name||x.desc)===e.name && !x.paid;}); if(b){ b.paid=true; b.paidDate=new Date().toISOString().slice(0,10); } }); selRArr.forEach(function(r){ (CM.S._reconStatus=CM.S._reconStatus||{})[r.id]='Confirmed'; }); }); setSelL({}); setSelR({}); };
            const row=(rk,sel,on,logo,title,sub,amt,col)=>(
              <div key={rk} onClick={on} style={{display:'flex',alignItems:'center',gap:12,padding:'13px 15px',borderRadius:12,cursor:'pointer',marginBottom:9,border:'1.5px solid '+(sel?'#2E7D5B':'var(--line)'),background:sel?'var(--mint-50)':'#fff',boxShadow:sel?'0 0 0 1px #2E7D5B inset':'0 1px 2px rgba(28,42,32,.05)'}}>
                <span style={{width:18,height:18,borderRadius:5,border:'1.5px solid '+(sel?'#10915F':'var(--line)'),background:sel?'#10915F':'#fff',flex:'0 0 18px',display:'inline-flex',alignItems:'center',justifyContent:'center',color:'#fff',fontSize:12}}>{sel?'✓':''}</span>
                <BrandIcon name={logo} size={36} radius={9}/>
                <div style={{flex:1,minWidth:0}}><div style={{fontWeight:700,fontSize:14,color:'var(--ink-900)',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'}}>{title}</div><div className="t-caption" style={{marginTop:2}}>{sub}</div></div>
                <span className="num" style={{fontWeight:800,fontSize:15,color:col}}>{amt}</span>
              </div>);
            return (
            <div className="cm-mb-24">
              <div className="cm-card cm-card-pad" style={{marginBottom:16}}>
                <div style={{display:'flex',alignItems:'center',gap:24,flexWrap:'wrap'}}>
                  <div><div className="t-caption">To Receive</div><div className="num" style={{fontWeight:800,fontSize:18,color:'#10915F'}}>{fmt(selLArr.filter(e=>e.kind==='Income').reduce((s,e)=>s+Math.abs(e.amount),0))}</div></div>
                  <div><div className="t-caption">To Pay</div><div className="num" style={{fontWeight:800,fontSize:18,color:'var(--red-500)'}}>{fmt(selLArr.filter(e=>e.kind!=='Income').reduce((s,e)=>s+Math.abs(e.amount),0))}</div></div>
                  <div><div className="t-caption">Transactions</div><div className="num" style={{fontWeight:800,fontSize:18}}>{fmt(sumR)}</div></div>
                  <div><div className="t-caption">Difference</div><div className="num" style={{fontWeight:800,fontSize:18,color:Math.abs(diff)<0.01&&(selLArr.length||selRArr.length)?'#10915F':'var(--red-500)'}}>{fmt(diff)}</div></div>
                  <button className="cm-btn cm-btn-primary" style={{marginLeft:'auto'}} disabled={!can} onClick={reconcile}>Reconcile</button>
                </div>
                <div className="t-caption" style={{marginTop:10,display:'flex',gap:18,flexWrap:'wrap'}}><span><b style={{color:'var(--ink-900)'}}>1</b> Select bills / income</span><span><b style={{color:'var(--ink-900)'}}>2</b> Select transactions</span><span><b style={{color:'var(--ink-900)'}}>3</b> Reconcile when the difference is $0.00</span></div>
              </div>
              <div className="cm-grid-2b">
                <ChartCard title="Bills & Income" action={<span className="cm-pill cm-pill-slate" style={{fontWeight:700}}>{entries.length}</span>}>
                  <div style={{maxHeight:460,overflow:'auto'}}>
                    {entries.length?entries.map((e,i)=>row('l'+i,!!selL[i],()=>setSelL(p=>{var n=Object.assign({},p); if(n[i])delete n[i]; else n[i]=true; return n;}), e.name, e.name, e.kind+(e.auto?' \u00b7 predicted':' \u00b7 entered'), fmt(e.amount), 'var(--ink-900)')):<div className="t-caption" style={{textAlign:'center',padding:'30px 0'}}>No entries yet.</div>}
                  </div>
                </ChartCard>
                <ChartCard title="Bank Transactions" action={<span className="cm-pill cm-pill-slate" style={{fontWeight:700}}>{bankList.length}</span>}>
                  <div style={{maxHeight:460,overflow:'auto'}}>
                    {bankList.map((r,i)=>row('r'+i,!!selR[i],()=>setSelR(p=>{var n=Object.assign({},p); if(n[i])delete n[i]; else n[i]=true; return n;}), r.orig, r.desc, CM.FDshort(r.date)+' \u00b7 '+r.account, (r.amt<0?'-':'+')+fmt(Math.abs(r.amt)).slice(1), r.amt<0?'var(--ink-900)':'#10915F'))}
                  </div>
                </ChartCard>
              </div>
            </div>); })()}
          <ChartCard title="Reconciliation Accuracy">
            <div style={{display:'flex',alignItems:'center',gap:18,flexWrap:'wrap'}}>
              <div className="num" style={{fontSize:46,fontWeight:800,color:accuracy>=90?G:'#B5740F'}}>{accuracy}%</div>
              <div style={{flex:1,minWidth:200}}>
                <div style={{height:10,borderRadius:999,background:'var(--mint-100)',overflow:'hidden'}}><div style={{height:'100%',width:accuracy+'%',background:accuracy>=90?G:GOLD}}/></div>
                <div className="t-caption" style={{marginTop:8}}>{matched} of {total-dups} non-duplicate transactions matched with high confidence. {review} still need your review.</div>
              </div>
            </div>
          </ChartCard>
        </div>
      )}

      {tab==='Recurring Matches' && (
        <ChartCard>
          {groups.length ? <DataTable minWidth={680} columns={[
            { header:'Bill / Source', cell:g=><div className="cm-cell-lead"><BrandIcon name={g.name} size={32} radius={8}/><div className="cm-cell-primary">{g.name}</div></div> },
            { header:'Type', cell:g=><span className="cm-pill cm-pill-slate" style={{fontWeight:700,fontSize:11}}>{g.isCr?'Income':'Bill / Expense'}</span> },
            { header:'Frequency', cell:g=><span style={{fontWeight:600,fontSize:13,color:'var(--ink-600)'}}>{g.cadence}</span> },
            { header:'Usual Amount', align:'right', cell:g=><span className="num" style={{fontWeight:700}}>{fmt(g.amount)}</span> },
            { header:'Seen', cell:g=><span className="num" style={{color:'var(--ink-500)'}}>{g.count}×</span> },
            { header:'Next', cell:g=><span className="num" style={{color:'var(--ink-500)',fontSize:13}}>{g.nextDate?CM.FD(new Date(g.nextDate)):'—'}</span> },
            { header:'Confidence', cell:g=>confBadge(Math.min(99,80+g.count*3)) },
          ]} rows={groups.sort((a,b)=>b.count-a.count)}/> : <div className="t-caption" style={{textAlign:'center',padding:'40px 0'}}>No recurring patterns yet — import a few months of statements.</div>}
        </ChartCard>
      )}

      {tab==='Rules' && (
        <ChartCard title="Reconciliation Rules" action={<button className="cm-btn cm-btn-primary" onClick={addRule}><I.Plus size={16}/>New Rule</button>}>
          {rules.length ? <DataTable minWidth={620} columns={[
            { header:'Rule', cell:(r,i)=><span style={{fontWeight:700,color:'var(--ink-900)'}}>{r.name}</span> },
            { header:'Match', cell:r=><span className="num" style={{fontSize:12.5,color:'var(--ink-500)'}}>desc contains “{r.keyword}”</span> },
            { header:'Type', cell:r=><span className="cm-pill cm-pill-slate" style={{fontWeight:700,fontSize:11}}>{r.type}</span> },
            { header:'Category', cell:r=><span className="num" style={{fontSize:12.5,color:'var(--ink-500)'}}>{r.category||'—'}</span> },
            { header:'Auto', cell:r=> r.autoConfirm?<StatusPill tone="green">Auto</StatusPill>:<StatusPill tone="slate">Review</StatusPill> },
            { header:'', align:'right', cell:(r,i)=><span onClick={()=>delRule(rules.indexOf(r))} style={ab(RD)} title="Delete rule">{'✕'}</span> },
          ]} rows={rules}/> : <div className="t-caption" style={{textAlign:'center',padding:'40px 0'}}>No rules yet. Confirm a transaction’s “Create Rule” action, or add one here — rules auto-apply to every future import.</div>}
        </ChartCard>
      )}

      {(tab==='All Transactions'||tab==='Matched'||tab==='Needs Review'||tab==='Duplicates') && (
        <ChartCard>
          <div style={{display:'flex',gap:10,alignItems:'center',marginBottom:14,flexWrap:'wrap'}}>
            <div className="st-searchbox" style={{maxWidth:240,flex:'1 1 160px'}}><I.Search size={16}/><input placeholder="Search transactions…" value={q} onChange={e=>setQ(e.target.value)}/></div>
            <select className="cm-select" value={typeF} onChange={e=>setTypeF(e.target.value)} aria-label="Type"><option>All</option>{TYPES.map(t=><option key={t}>{t}</option>)}</select>
            <select className="cm-select" value={confF} onChange={e=>setConfF(e.target.value)} aria-label="Confidence"><option value="All">All confidence</option><option value="High">High (95%+)</option><option value="Medium">Medium (70–94%)</option><option value="Low">Low (&lt;70%)</option></select>
            <span className="t-caption" style={{marginLeft:'auto'}}>{view.length.toLocaleString()} shown · {periodLabel}</span>
          </div>
          {view.length ? <DataTable columns={cols} rows={view.slice(0,80)} minWidth={920}/> : <div className="t-caption" style={{textAlign:'center',padding:'40px 0'}}>{total?'Nothing here — adjust the filters.':'Import an OFX statement to begin reconciling.'}</div>}
          {view.length>80 && <div className="t-caption" style={{textAlign:'center',marginTop:12}}>Showing 80 of {view.length.toLocaleString()} — narrow with search or filters.</div>}
        </ChartCard>
      )}
    </div>
  );
}
function ab(color){ return { display:'inline-flex',alignItems:'center',justifyContent:'center',width:28,height:28,borderRadius:8,background:'var(--mint-50)',color:color,cursor:'pointer' }; }
function tb(color){ return { fontSize:12,fontWeight:700,color:color,cursor:'pointer',padding:'5px 9px',borderRadius:7,background:'var(--mint-50)',whiteSpace:'nowrap' }; }
window.PageReconciliation = PageReconciliation;
})();
