(()=>{const h=window.React,F=window.KIND_REGISTRY;if(!h)return;const s=h.createElement,z=h.useState,e={bg:"var(--app-bg,#0e0e10)",surface:"var(--app-surface,#1a1a1c)",elevated:"var(--app-elevated,#2a2a2e)",rule:"var(--app-rule,rgba(255,255,255,.07))",ruleSoft:"var(--app-rule-soft,rgba(255,255,255,.04))",ink:"var(--app-ink,#e6e3da)",inkSoft:"var(--app-ink-soft,rgba(230,227,218,.62))",inkFaint:"var(--app-ink-faint,rgba(230,227,218,.38))",accent:"var(--app-accent,#00f3ff)",accentDim:"var(--app-accent-dim,rgba(0,243,255,.16))",accentInk:"var(--app-accent-ink,#0e0e10)",success:"var(--app-success,#00d4b8)",warn:"var(--app-warn,#f8d974)",fail:"var(--app-fail,#f43f6c)",pending:"var(--app-pending,#b06bff)",pendingDim:"var(--app-pending-dim,rgba(176,107,255,.16))",mono:'var(--app-font-mono,"JetBrains Mono",SFMono-Regular,monospace)'},v=4182,L=7500,P=6040,C=9,A="10 Jul 2026",j=152,D=201,I="LLM +28%",M=[{label:"MTD spend",value:"\u20AC4,182",delta:"+18%",note:"of \u20AC7,500 cap",tone:"accent"},{label:"Run-rate close",value:"\u20AC6,040",delta:"Modeled",note:"\u2248 \u20AC201 / day",tone:"pending"},{label:"Biggest mover",value:"LLM",delta:"+28%",note:"OpenRouter + Anthropic",tone:"fail"},{label:"Budget headroom",value:"\u20AC3,318",delta:"44% left",note:"9 days remaining",tone:"success"}],$=[{k:"LLM",v:1840,tone:"accent"},{k:"GCP",v:1210,tone:"success"},{k:"Stripe fees",v:612,tone:"pending"},{k:"Darvis",v:340,tone:"warn"},{k:"FX",v:180,tone:"faint"}],R=$.reduce((n,i)=>n+i.v,0),T=[96,104,88,112,120,108,132,124,140,118,150,138,128,160,145,152,168,158,172,164,180,175,168,190,182,178,196,188,205,198],B=[{id:"llm",icon:"\u25C6",title:"LLM spend",metric:"\u20AC1,840",budget:"\u20AC2,000",budgetLabel:"\u20AC1,840",budgetPct:92,tone:"near",delta:"+28%",dtone:"hot",human:"OpenRouter + Anthropic",updated:"06:00",state:"modeled"},{id:"gcp",icon:"\u2601",title:"GCP compute",metric:"\u20AC1,210",budget:"\u20AC1,400",budgetLabel:"\u20AC1,210",budgetPct:86,tone:"under",delta:"+6%",dtone:"up",human:"GCP billing export",updated:"04:00",state:"live"},{id:"stripe",icon:"\u25A4",title:"Stripe fees",metric:"\u20AC612",budget:"\u20AC800",budgetLabel:"\u20AC612",budgetPct:77,tone:"under",delta:"+3%",dtone:"up",human:"Stripe API \xB7 hourly",updated:"06:40",state:"live"},{id:"darvis",icon:"\u25C8",title:"Darvis",metric:"\u20AC340",budget:"\u20AC500",budgetLabel:"\u20AC340",budgetPct:68,tone:"under",delta:"\u22124%",dtone:"down",human:"Darvis invoice \xB7 monthly",updated:"Jun 28",state:"modeled"},{id:"fx",icon:"\u21C4",title:"FX exposure",metric:"\u20AC180",budget:"\u20AC250",budgetLabel:"\u20AC180",budgetPct:72,tone:"under",delta:"+12%",dtone:"up",human:"ECB reference rates",updated:"06:00",state:"modeled"},{id:"bank",icon:"\u25A3",title:"Bank fees",metric:"\u2014",budget:"\u20AC250",budgetLabel:"\u2014",budgetPct:0,tone:"under",delta:"No data",dtone:"up",human:"Wise API",updated:"failed 05:12",state:"error"}],O=["All","Matched","Pending","Flagged"],G=[{id:"ap-204",vendor:"Google Cloud",date:"Jun 28",category:"Cloud infra",amount:"\u20AC1,210.44",ocr:.97,status:"matched",hasDoc:!0},{id:"ap-203",vendor:"Anthropic",date:"Jun 27",category:"LLM",amount:"\u20AC1,200.00",ocr:.98,status:"matched",hasDoc:!0},{id:"ap-202",vendor:"OpenRouter",date:"Jun 27",category:"LLM",amount:"\u20AC640.00",ocr:.99,status:"matched",hasDoc:!0},{id:"ap-201",vendor:"Stripe",date:"Jun 27",category:"Payment fees",amount:"\u20AC612.10",ocr:null,status:"matched",hasDoc:!1},{id:"ap-200",vendor:"Hetzner",date:"Jun 26",category:"Cloud infra",amount:"\u20AC89.00",ocr:.71,status:"pending",hasDoc:!0},{id:"ap-199",vendor:"Notion Labs",date:"Jun 25",category:"Tooling",amount:"\u20AC16.00",ocr:.99,status:"matched",hasDoc:!0},{id:"ap-198",vendor:"Figma",date:"Jun 24",category:"Tooling",amount:"\u20AC45.00",ocr:.62,status:"flagged",hasDoc:!0}],_="\u20AC3,812.54",W="Matched total \xB7 2 pending review \xB7 1 flagged",U=[{cat:"LLM inference",spent:"\u20AC1,840",cap:"\u20AC2,000",spentPct:92,projPct:124,tone:"near",forecast:"\u20AC2,480",forecastNote:"+\u20AC480 over cap",over:!0,state:"modeled"},{cat:"Cloud infra",spent:"\u20AC1,210",cap:"\u20AC1,400",spentPct:86,projPct:125,tone:"near",forecast:"\u20AC1,750",forecastNote:"+\u20AC350 over cap",over:!0,state:"live"},{cat:"Payment fees",spent:"\u20AC612",cap:"\u20AC800",spentPct:77,projPct:110,tone:"under",forecast:"\u20AC885",forecastNote:"+\u20AC85 over cap",over:!0,state:"live"},{cat:"Data / OCR",spent:"\u20AC340",cap:"\u20AC500",spentPct:68,projPct:98,tone:"under",forecast:"\u20AC490",forecastNote:"within cap",over:!1,state:"modeled"},{cat:"FX / other",spent:"\u20AC180",cap:"\u20AC250",spentPct:72,projPct:105,tone:"under",forecast:"\u20AC262",forecastNote:"+\u20AC12 over cap",over:!0,state:"modeled"},{cat:"Marketing ops",spent:"\u2014",cap:"\u20AC400",spentPct:0,projPct:0,tone:"under",forecast:"\u2014",forecastNote:"awaiting first sync",over:!1,state:"empty"}],V=[{stage:"Bookings",value:"\u20AC48,200",width:100,tone:"accent"},{stage:"Invoiced",value:"\u20AC44,100",width:91,tone:"accent"},{stage:"Collected",value:"\u20AC39,800",width:83,tone:"success"},{stage:"Recognized",value:"\u20AC31,500",width:65,tone:"pending"},{stage:"Deferred",value:"\u20AC12,600",width:40,tone:"warn"}];function m(n){return{accent:e.accent,success:e.success,warn:e.warn,fail:e.fail,pending:e.pending,faint:e.inkFaint,under:e.success,near:e.warn,over:e.fail}[n]||e.ink}function J(n){return n==="hot"?e.fail:n==="down"?e.success:e.accent}function Y(n){return n==="live"?{label:"Live",color:e.success,dashed:!1}:n==="modeled"?{label:"Modeled",color:e.pending,dashed:!0}:{label:"Sync failed",color:e.fail,dashed:!1}}function K(n){if(n==null)return{label:"auto",color:e.inkFaint,pct:100};const i=Math.round(n*100),f=n<.8?e.fail:n<.9?e.warn:e.success;return{label:`${i}%`,color:f,pct:i}}function X(n){return n==="matched"?e.success:n==="pending"?e.warn:e.fail}function H(n,i,f){const d=n/i,u=f/i,y=a=>a*Math.PI/180,l=a=>[104+82*Math.cos(y(a)),104+82*Math.sin(y(a))],t=(a,r)=>{const[o,c]=l(a),[g,b]=l(r),Q=r-a>180?1:0;return`M ${o.toFixed(1)} ${c.toFixed(1)} A 82 82 0 ${Q} 1 ${g.toFixed(1)} ${b.toFixed(1)}`};return{track:t(150,390),value:t(150,150+240*d),proj:t(150+240*d,150+240*Math.min(u,1)),pct:Math.round(d*100)}}function Z(n,i){const x=Math.min(...n),k=Math.max(...n),p=l=>6+l/(n.length-1)*428,d=l=>124-(l-x)/(k-x)*118;let u=`M ${p(0).toFixed(1)} ${d(n[0]).toFixed(1)}`;n.forEach((l,t)=>{t&&(u+=` L ${p(t).toFixed(1)} ${d(l).toFixed(1)}`)});const y=`${u} L ${p(n.length-1).toFixed(1)} ${124 .toFixed(1)} L ${p(0).toFixed(1)} ${124 .toFixed(1)} Z`;return{line:u,area:y,refY:d(i).toFixed(1),w:440,h:130}}const E="costs-suite-style";function q(){if(document.getElementById(E))return;const n=`
    .costssuite{display:flex;flex-direction:column;gap:14px;height:100%;min-height:0;font-size:14px;line-height:1.45;color:${e.ink};font-family:var(--app-font-body,"Inter",system-ui,sans-serif);overflow:auto;}
    .costssuite *,.costssuite *::before,.costssuite *::after{box-sizing:border-box;}
    .costssuite button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;padding:0;}
    .costssuite .mono{font-family:${e.mono};font-variant-numeric:tabular-nums;}

    /* ---- tab switch ---- */
    .costssuite .cs-tabs{display:flex;align-items:center;gap:2px;background:${e.elevated};border:1px solid ${e.rule};border-radius:8px;padding:3px;flex-wrap:wrap;width:fit-content;}
    .costssuite .cs-tabs button{padding:8px 14px;border-radius:6px;font-size:12.5px;font-weight:600;color:${e.inkSoft};text-transform:uppercase;letter-spacing:.04em;font-family:${e.mono};}
    .costssuite .cs-tabs button.on{background:${e.accentDim};color:${e.accent};}

    /* ---- KPI strip (always visible) ---- */
    .costssuite .cs-kpi-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;flex:0 0 auto;}
    .costssuite .cs-kpi-tile{background:${e.surface};border:1px solid ${e.rule};border-radius:12px;padding:14px 16px;}
    .costssuite .cs-kpi-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px;}
    .costssuite .cs-kpi-label{font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.12em;color:${e.inkFaint};}
    .costssuite .cs-kpi-delta{font-family:${e.mono};font-size:10px;padding:2px 8px;border-radius:999px;white-space:nowrap;}
    .costssuite .cs-kpi-value{font-family:${e.mono};font-weight:700;font-size:1.7rem;color:${e.ink};line-height:1;}
    .costssuite .cs-kpi-note{font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};margin-top:8px;}

    /* ---- projection banner ---- */
    .costssuite .cs-banner{display:flex;align-items:center;gap:14px;padding:11px 16px;border-radius:10px;background:${e.pendingDim};border:1px solid ${e.pending};flex-wrap:wrap;}
    .costssuite .cs-banner .dot{width:8px;height:8px;border-radius:50%;background:${e.pending};flex-shrink:0;}
    .costssuite .cs-banner .txt{flex:1;min-width:220px;font-size:12.5px;color:${e.inkSoft};}
    .costssuite .cs-banner .txt b{color:${e.ink};font-weight:600;}
    .costssuite .cs-banner .legend{display:flex;align-items:center;gap:14px;font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.05em;}
    .costssuite .cs-legend-item{display:flex;align-items:center;gap:6px;}
    .costssuite .cs-legend-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0;}

    /* ---- generic card ---- */
    .costssuite .cs-card{background:${e.surface};border:1px solid ${e.rule};border-radius:12px;padding:20px;}
    .costssuite .cs-card-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px;gap:10px;}
    .costssuite .cs-overline{font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.14em;color:${e.inkFaint};}
    .costssuite .cs-tag-modeled{display:inline-flex;align-items:center;gap:6px;font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:${e.pending};border:1px dashed ${e.pending};padding:3px 8px;border-radius:999px;white-space:nowrap;}

    /* ---- overview hero ---- */
    .costssuite .cs-hero{display:grid;grid-template-columns:1.35fr 1fr;gap:16px;}
    .costssuite .cs-gauge-row{display:grid;grid-template-columns:200px 1fr;gap:20px;align-items:center;}
    .costssuite .cs-gauge-wrap{position:relative;width:200px;height:132px;}
    .costssuite .cs-gauge-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-top:10px;}
    .costssuite .cs-gauge-mtd{font-family:${e.mono};font-weight:700;font-size:1.7rem;color:${e.ink};line-height:1;}
    .costssuite .cs-gauge-cap{font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};margin-top:4px;}
    .costssuite .cs-gauge-pct{font-family:${e.mono};font-size:10px;color:${e.accent};margin-top:2px;}
    .costssuite .cs-gauge-legend{display:flex;flex-direction:column;gap:12px;}
    .costssuite .cs-gl-row{display:flex;align-items:center;gap:8px;font-family:${e.mono};font-size:10.5px;color:${e.inkSoft};text-transform:uppercase;letter-spacing:.05em;}
    .costssuite .cs-gl-sw{width:10px;height:10px;border-radius:2px;flex-shrink:0;}
    .costssuite .cs-gl-sw.dash{background:none;border:1.5px dashed ${e.pending};}
    .costssuite .cs-gl-val{font-family:${e.mono};font-size:1rem;font-weight:700;color:${e.ink};margin-top:3px;margin-left:18px;}
    .costssuite .cs-gl-foot{display:flex;align-items:center;gap:8px;padding-top:8px;border-top:1px solid ${e.rule};font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};}
    .costssuite .cs-comp{margin-top:20px;padding-top:16px;border-top:1px solid ${e.rule};}
    .costssuite .cs-comp-bar{display:flex;height:12px;border-radius:999px;overflow:hidden;background:${e.bg};}
    .costssuite .cs-comp-bar>span{height:100%;display:block;}
    .costssuite .cs-comp-legend{display:flex;flex-wrap:wrap;gap:12px 18px;margin-top:14px;}
    .costssuite .cs-comp-item{display:flex;align-items:center;gap:8px;}
    .costssuite .cs-comp-sw{width:9px;height:9px;border-radius:2px;flex-shrink:0;}
    .costssuite .cs-comp-nm{font-size:12px;color:${e.ink};font-weight:500;}
    .costssuite .cs-comp-sub{font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};margin-top:1px;}

    /* ---- sparkline ---- */
    .costssuite .cs-spark-avg{display:flex;align-items:baseline;gap:8px;margin:4px 0 10px;}
    .costssuite .cs-spark-avg .n{font-family:${e.mono};font-weight:700;font-size:1.4rem;color:${e.ink};}
    .costssuite .cs-spark-avg .u{font-family:${e.mono};font-size:11px;color:${e.inkFaint};}
    .costssuite .cs-spark-svg{width:100%;height:140px;}
    .costssuite .cs-spark-foot{display:flex;justify-content:space-between;align-items:center;margin-top:10px;padding-top:12px;border-top:1px solid ${e.rule};font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};flex-wrap:wrap;gap:6px;}

    /* ---- source cards ---- */
    .costssuite .cs-src-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px;}
    .costssuite .cs-src-card{background:${e.surface};border:1px solid ${e.rule};border-radius:12px;padding:18px;}
    .costssuite .cs-src-card.dashed{border-style:dashed;border-color:${e.pending};}
    .costssuite .cs-src-card.error{border-color:${e.fail};}
    .costssuite .cs-src-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px;gap:8px;}
    .costssuite .cs-src-id{display:flex;align-items:center;gap:10px;}
    .costssuite .cs-src-ic{width:32px;height:32px;border-radius:8px;background:${e.elevated};display:flex;align-items:center;justify-content:center;font-size:15px;flex-shrink:0;}
    .costssuite .cs-src-title{font-size:13.5px;font-weight:600;color:${e.ink};}
    .costssuite .cs-src-code{font-family:${e.mono};font-size:10px;color:${e.inkFaint};text-transform:uppercase;letter-spacing:.05em;margin-top:2px;}
    .costssuite .cs-src-state{display:inline-flex;align-items:center;gap:5px;font-family:${e.mono};font-size:9.5px;text-transform:uppercase;letter-spacing:.06em;padding:3px 8px;border-radius:999px;white-space:nowrap;}
    .costssuite .cs-src-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0;}
    .costssuite .cs-src-metric-row{display:flex;align-items:baseline;gap:10px;margin-bottom:6px;}
    .costssuite .cs-src-metric{font-family:${e.mono};font-weight:700;font-size:1.7rem;line-height:1;color:${e.ink};}
    .costssuite .cs-src-delta{font-family:${e.mono};font-size:11px;padding:2px 8px;border-radius:999px;}
    .costssuite .cs-src-bar{height:5px;background:${e.bg};border-radius:999px;overflow:hidden;margin:12px 0 8px;}
    .costssuite .cs-src-bar>span{display:block;height:100%;}
    .costssuite .cs-src-budget{display:flex;justify-content:space-between;font-family:${e.mono};font-size:10.5px;margin-bottom:14px;}
    .costssuite .cs-src-foot{display:flex;justify-content:space-between;align-items:center;padding-top:12px;border-top:1px solid ${e.rule};gap:10px;}
    .costssuite .cs-src-human{font-family:${e.mono};font-size:10px;color:${e.inkFaint};}
    .costssuite .cs-src-retry{font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:${e.fail};border:1px solid ${e.fail};padding:4px 10px;border-radius:6px;flex-shrink:0;}

    /* ---- ledger / AP inbox ---- */
    .costssuite .cs-ledger{background:${e.surface};border:1px solid ${e.rule};border-radius:12px;overflow:hidden;}
    .costssuite .cs-ledger-head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid ${e.rule};flex-wrap:wrap;}
    .costssuite .cs-ledger-title{font-weight:600;font-size:1rem;color:${e.ink};}
    .costssuite .cs-ledger-sub{font-family:${e.mono};font-size:11px;color:${e.inkFaint};font-weight:400;margin-left:6px;}
    .costssuite .cs-ledger-filters{display:flex;gap:6px;margin-left:auto;flex-wrap:wrap;}
    .costssuite .cs-ledger-filters button{font-family:${e.mono};font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;padding:6px 11px;border-radius:999px;border:1px solid ${e.rule};color:${e.inkSoft};}
    .costssuite .cs-ledger-filters button.on{color:${e.accent};background:${e.accentDim};border-color:${e.accent};}
    .costssuite .cs-ledger-thead,.costssuite .cs-ledger-row{display:grid;grid-template-columns:44px 1.4fr .9fr .9fr 1fr 1fr auto;gap:12px;align-items:center;}
    .costssuite .cs-ledger-thead{padding:10px 18px;background:${e.bg};border-bottom:1px solid ${e.rule};font-family:${e.mono};font-size:9.5px;text-transform:uppercase;letter-spacing:.1em;color:${e.inkFaint};}
    .costssuite .cs-ledger-row{padding:11px 18px;border-bottom:1px solid ${e.ruleSoft};}
    .costssuite .cs-ledger-row:last-of-type{border-bottom:0;}
    .costssuite .cs-ledger-row:hover{background:${e.elevated};}
    .costssuite .cs-doc{width:34px;height:40px;border-radius:5px;border:1px solid ${e.rule};background:${e.bg};display:flex;align-items:center;justify-content:center;font-size:13px;color:${e.inkSoft};}
    .costssuite .cs-doc.err{border-color:${e.fail};color:${e.fail};}
    .costssuite .cs-doc.nodoc{border-style:dashed;color:${e.inkFaint};background:transparent;}
    .costssuite .cs-ledger-vendor{font-size:12.5px;color:${e.ink};font-weight:500;}
    .costssuite .cs-ledger-id{font-family:${e.mono};font-size:10px;color:${e.inkFaint};margin-top:1px;}
    .costssuite .cs-ledger-mono{font-family:${e.mono};font-size:11.5px;color:${e.inkSoft};}
    .costssuite .cs-ocr{display:flex;align-items:center;gap:7px;}
    .costssuite .cs-ocr-bar{width:32px;height:4px;background:${e.bg};border-radius:999px;overflow:hidden;}
    .costssuite .cs-ocr-bar>span{display:block;height:100%;}
    .costssuite .cs-amount{font-family:${e.mono};font-size:12.5px;color:${e.ink};text-align:right;font-weight:500;}
    .costssuite .cs-status{display:inline-flex;align-items:center;gap:5px;font-family:${e.mono};font-size:9.5px;text-transform:uppercase;letter-spacing:.06em;padding:3px 8px;border-radius:999px;justify-self:end;}
    .costssuite .cs-ledger-skel{padding:12px 18px;border-bottom:1px solid ${e.ruleSoft};display:grid;grid-template-columns:44px 1.4fr .9fr .9fr 1fr 1fr auto;gap:12px;align-items:center;font-family:${e.mono};font-size:9.5px;color:${e.inkFaint};text-transform:uppercase;letter-spacing:.06em;}
    .costssuite .cs-ledger-skel .box{height:12px;border-radius:4px;background:${e.elevated};}
    .costssuite .cs-ledger-foot{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;background:${e.elevated};}
    .costssuite .cs-ledger-foot .note{font-family:${e.mono};font-size:10.5px;color:${e.inkFaint};text-transform:uppercase;letter-spacing:.06em;}
    .costssuite .cs-ledger-foot .total{font-family:${e.mono};font-weight:700;font-size:1.2rem;color:${e.ink};}

    /* ---- budgets ---- */
    .costssuite .cs-budgets{display:flex;flex-direction:column;gap:12px;}
    .costssuite .cs-budgets-key{display:flex;align-items:center;gap:16px;font-family:${e.mono};font-size:10px;color:${e.inkFaint};text-transform:uppercase;letter-spacing:.06em;}
    .costssuite .cs-budgets-key .sw{width:12px;height:6px;border-radius:2px;display:inline-block;margin-right:5px;}
    .costssuite .cs-budget-row{background:${e.surface};border:1px solid ${e.rule};border-radius:12px;padding:16px 20px;}
    .costssuite .cs-budget-row.dashed{border-color:${e.pending};border-style:dashed;}
    .costssuite .cs-budget-grid{display:grid;grid-template-columns:1.2fr 2fr 1.2fr;gap:20px;align-items:center;}
    .costssuite .cs-budget-cat{display:flex;align-items:center;gap:9px;}
    .costssuite .cs-budget-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
    .costssuite .cs-budget-nm{font-size:13.5px;font-weight:600;color:${e.ink};}
    .costssuite .cs-budget-state{font-family:${e.mono};font-size:10px;text-transform:uppercase;letter-spacing:.06em;margin-top:4px;margin-left:17px;}
    .costssuite .cs-budget-track{position:relative;height:9px;background:${e.bg};border-radius:999px;overflow:hidden;}
    .costssuite .cs-budget-proj{position:absolute;left:0;top:0;height:100%;border-radius:999px;background:repeating-linear-gradient(45deg,${e.pendingDim} 0 4px,transparent 4px 8px);}
    .costssuite .cs-budget-spent{position:absolute;left:0;top:0;height:100%;border-radius:999px;}
    .costssuite .cs-budget-nums{display:flex;justify-content:space-between;margin-top:7px;font-family:${e.mono};font-size:10.5px;}
    .costssuite .cs-budget-nums .cap{color:${e.inkFaint};}
    .costssuite .cs-budget-fc-label{font-family:${e.mono};font-size:9.5px;color:${e.inkFaint};text-transform:uppercase;letter-spacing:.06em;margin-bottom:3px;text-align:right;}
    .costssuite .cs-budget-fc-val{font-family:${e.mono};font-weight:700;font-size:1.05rem;text-align:right;}

    /* ---- rev-rec funnel ---- */
    .costssuite .cs-funnel{display:flex;flex-direction:column;gap:10px;align-items:center;}
    .costssuite .cs-funnel-step{min-width:180px;}
    .costssuite .cs-funnel-bar{height:52px;border-radius:8px;display:flex;align-items:center;justify-content:space-between;padding:0 18px;border:1px solid;}
    .costssuite .cs-funnel-stage{font-family:${e.mono};font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;}
    .costssuite .cs-funnel-value{font-family:${e.mono};font-weight:700;font-size:1.05rem;color:${e.ink};}
    .costssuite .cs-funnel-pct{text-align:center;font-family:${e.mono};font-size:10px;color:${e.inkFaint};margin-top:3px;}

    @media(max-width:900px){.costssuite .cs-hero{grid-template-columns:1fr;}.costssuite .cs-gauge-row{grid-template-columns:1fr;}.costssuite .cs-budget-grid{grid-template-columns:1fr;}.costssuite .cs-ledger-thead,.costssuite .cs-ledger-row,.costssuite .cs-ledger-skel{grid-template-columns:36px 1fr 1fr auto;}}
    `,i=document.createElement("style");i.id=E,i.textContent=n,document.head.appendChild(i)}function w(n){q();const[i,f]=z("overview"),N=[{id:"overview",label:"Overview"},{id:"sources",label:"Sources"},{id:"ledger",label:"AP Inbox"},{id:"budgets",label:"Budgets & Forecast"},{id:"revrec",label:"Rev-Rec"}];function S(){return s("div",{className:"cs-tabs",key:"tabs"},N.map(t=>s("button",{key:t.id,className:i===t.id?"on":"",onClick:()=>f(t.id)},t.label)))}function x(){return s("div",{className:"cs-kpi-strip",key:"kpi"},M.map(t=>{const a=m(t.tone);return s("div",{className:"cs-kpi-tile",key:t.label},[s("div",{className:"cs-kpi-head",key:"h"},[s("span",{className:"cs-kpi-label",key:"l"},t.label),s("span",{className:"cs-kpi-delta",key:"d",style:{color:a,background:`${a}22`,border:`1px solid ${a}55`}},t.delta)]),s("div",{className:"cs-kpi-value",key:"v"},t.value),s("div",{className:"cs-kpi-note",key:"n"},t.note)])}))}function k(){return s("div",{className:"cs-banner",key:"banner"},[s("span",{className:"dot",key:"d"}),s("div",{className:"txt",key:"t"},[s("span",{key:"o",className:"cs-overline",style:{marginRight:10}},"Projection cycle"),"Most figures are ",s("b",{key:"b"},"modeled")," from last sync \u2014 not billed actuals. Precision is indicative, not final."]),s("div",{className:"legend",key:"l"},[s("span",{className:"cs-legend-item",key:"live",style:{color:e.success}},[s("span",{className:"cs-legend-dot",key:"d",style:{background:e.success}}),"Live"]),s("span",{className:"cs-legend-item",key:"modeled",style:{color:e.pending}},[s("span",{className:"cs-legend-dot",key:"d",style:{border:`1.5px dashed ${e.pending}`,background:"transparent"}}),"Modeled"]),s("span",{className:"cs-legend-item",key:"error",style:{color:e.fail}},[s("span",{className:"cs-legend-dot",key:"d",style:{background:e.fail}}),"Error"])])])}function p(){const t=H(v,L,P),a=Z(T,D),r=s("div",{className:"cs-card",key:"gauge"},[s("div",{className:"cs-card-head",key:"h"},[s("span",{className:"cs-overline",key:"o"},"Monthly burn \xB7 vs budget cap"),s("span",{className:"cs-tag-modeled",key:"t"},"Modeled")]),s("div",{className:"cs-gauge-row",key:"row"},[s("div",{className:"cs-gauge-wrap",key:"g"},[s("svg",{key:"svg",viewBox:"0 0 208 150",width:200,height:132,style:{overflow:"visible"}},[s("path",{key:"track",d:t.track,fill:"none",stroke:e.rule,strokeWidth:14,strokeLinecap:"round"}),s("path",{key:"proj",d:t.proj,fill:"none",stroke:e.pending,strokeWidth:14,strokeLinecap:"round",strokeDasharray:"2 7",opacity:.6}),s("path",{key:"value",d:t.value,fill:"none",stroke:e.accent,strokeWidth:14,strokeLinecap:"round"})]),s("div",{className:"cs-gauge-center",key:"c"},[s("div",{className:"cs-gauge-mtd",key:"m"},`\u20AC${v.toLocaleString("en-US")}`),s("div",{className:"cs-gauge-cap",key:"cap"},`of \u20AC${L.toLocaleString("en-US")} cap`),s("div",{className:"cs-gauge-pct",key:"p"},`${t.pct}% used`)])]),s("div",{className:"cs-gauge-legend",key:"leg"},[s("div",{key:"spent"},[s("div",{className:"cs-gl-row",key:"r"},[s("span",{className:"cs-gl-sw",key:"s",style:{background:e.accent}}),"Spent to date"]),s("div",{className:"cs-gl-val",key:"v",style:{color:e.ink}},`\u20AC${v.toLocaleString("en-US")}`)]),s("div",{key:"proj"},[s("div",{className:"cs-gl-row",key:"r"},[s("span",{className:"cs-gl-sw dash",key:"s"}),"Projected close"]),s("div",{className:"cs-gl-val",key:"v",style:{color:e.pending}},[`\u20AC${P.toLocaleString("en-US")} `,s("span",{key:"s",style:{fontSize:"0.7rem",color:e.inkFaint,fontWeight:500}},"run-rate")])]),s("div",{className:"cs-gl-foot",key:"f"},`Renews ${A} \xB7 ${C} days left`)])]),s("div",{className:"cs-comp",key:"comp"},[s("div",{className:"cs-overline",key:"o",style:{marginBottom:12}},"Spend composition"),s("div",{className:"cs-comp-bar",key:"b"},$.map(c=>s("span",{key:c.k,style:{width:`${(c.v/R*100).toFixed(2)}%`,background:m(c.tone)},title:c.k}))),s("div",{className:"cs-comp-legend",key:"l"},$.map(c=>s("div",{className:"cs-comp-item",key:c.k},[s("span",{className:"cs-comp-sw",key:"sw",style:{background:m(c.tone)}}),s("div",{key:"t"},[s("div",{className:"cs-comp-nm",key:"n"},c.k),s("div",{className:"cs-comp-sub",key:"s"},`\u20AC${c.v.toLocaleString("en-US")} \xB7 ${(c.v/R*100).toFixed(1)}%`)])])))])]),o=s("div",{className:"cs-card",key:"spark"},[s("div",{className:"cs-card-head",key:"h"},[s("span",{className:"cs-overline",key:"o"},"Daily spend \xB7 30 days"),s("span",{key:"a",style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:e.mono,fontSize:10,color:e.success,textTransform:"uppercase",letterSpacing:".08em"}},[s("span",{key:"d",style:{width:7,height:7,borderRadius:"50%",background:e.success,display:"inline-block"}}),"Actuals"])]),s("div",{className:"cs-spark-avg",key:"avg"},[s("span",{className:"n",key:"n"},`\u20AC${j}`),s("span",{className:"u",key:"u"},"avg / day")]),s("svg",{key:"svg",className:"cs-spark-svg",viewBox:`0 0 ${a.w} ${a.h}`,preserveAspectRatio:"none"},[s("defs",{key:"defs"},s("linearGradient",{id:"costsSparkFill",x1:"0",y1:"0",x2:"0",y2:"1"},[s("stop",{key:"s0",offset:"0%",stopColor:e.accent,stopOpacity:.28}),s("stop",{key:"s1",offset:"100%",stopColor:e.accent,stopOpacity:0})])),s("path",{key:"area",d:a.area,fill:"url(#costsSparkFill)"}),s("path",{key:"line",d:a.line,fill:"none",stroke:e.accent,strokeWidth:2,strokeLinejoin:"round"}),s("line",{key:"rr",x1:6,y1:a.refY,x2:a.w-6,y2:a.refY,stroke:e.pending,strokeWidth:1.4,strokeDasharray:"5 5",opacity:.85})]),s("div",{className:"cs-spark-foot",key:"foot"},[s("span",{key:"rr"},`Modeled run-rate \u20AC${D}/day`),s("span",{key:"bm"},["Biggest mover \xB7 ",s("span",{key:"v",style:{color:e.fail}},I)])])]);return s("div",{className:"cs-hero",key:"view"},[r,o])}function d(){return s("div",{className:"cs-src-grid",key:"view"},B.map(t=>{const a=Y(t.state),r=m(t.tone),o=J(t.dtone),c=t.state==="error";return s("div",{key:t.id,className:`cs-src-card${a.dashed?" dashed":""}${c?" error":""}`},[s("div",{className:"cs-src-head",key:"h"},[s("div",{className:"cs-src-id",key:"i"},[s("span",{className:"cs-src-ic",key:"ic"},t.icon),s("div",{key:"t"},[s("div",{className:"cs-src-title",key:"n"},t.title),s("div",{className:"cs-src-code",key:"c"},t.id)])]),s("span",{className:"cs-src-state",key:"s",style:{color:a.color,border:`1px ${a.dashed?"dashed":"solid"} ${a.color}`}},[s("span",{className:"cs-src-dot",key:"d",style:{background:a.dashed?"transparent":a.color}}),a.label])]),s("div",{className:"cs-src-metric-row",key:"m"},[s("span",{className:"cs-src-metric",key:"v",style:c?{color:e.inkFaint}:void 0},t.metric),s("span",{className:"cs-src-delta",key:"d",style:{color:o,background:`${o}22`,border:`1px solid ${o}55`}},t.delta)]),s("div",{className:"cs-src-bar",key:"b"},s("span",{style:{width:`${t.budgetPct}%`,background:r}})),s("div",{className:"cs-src-budget",key:"bl"},[s("span",{key:"l",style:{color:e.inkFaint}},`${t.budgetLabel} of ${t.budget}`),s("span",{key:"t",style:{color:r,textTransform:"uppercase",letterSpacing:".05em"}},t.tone==="under"?"Under":t.tone==="near"?"Near cap":"Over")]),s("div",{className:"cs-src-foot",key:"f"},[s("span",{className:"cs-src-human",key:"h"},`${t.human} \xB7 ${t.updated}`),c?s("button",{className:"cs-src-retry",key:"r"},"Retry"):null])])}))}function u(){const[t,a]=z("All"),r=G.filter(o=>t==="All"?!0:o.status===t.toLowerCase());return s("div",{className:"cs-ledger",key:"view"},[s("div",{className:"cs-ledger-head",key:"h"},[s("span",{className:"cs-ledger-title",key:"t"},["AP inbox ",s("span",{className:"cs-ledger-sub",key:"s"},"receipts \xB7 OCR-matched")]),s("div",{className:"cs-ledger-filters",key:"f"},O.map(o=>s("button",{key:o,className:t===o?"on":"",onClick:()=>a(o)},o)))]),s("div",{className:"cs-ledger-thead",key:"th"},["Doc","Vendor","Date","Category","OCR","Amount","Status"].map((o,c)=>s("span",{key:o,style:c>=5?{textAlign:"right"}:void 0},o))),...r.map(o=>{const c=K(o.ocr),g=X(o.status);return s("div",{className:"cs-ledger-row",key:o.id},[s("span",{className:`cs-doc${o.hasDoc?o.ocr!=null&&o.ocr<.8?" err":"":" nodoc"}`,key:"doc"},o.hasDoc?"\u25A4":"\u25CB"),s("div",{key:"v"},[s("div",{className:"cs-ledger-vendor",key:"n"},o.vendor),s("div",{className:"cs-ledger-id",key:"i"},o.id)]),s("span",{className:"cs-ledger-mono",key:"d"},o.date),s("span",{className:"cs-ledger-mono",key:"c"},o.category),s("div",{className:"cs-ocr",key:"o"},[s("span",{key:"l",style:{color:c.color,fontFamily:e.mono,fontSize:11}},c.label),s("span",{className:"cs-ocr-bar",key:"b"},s("span",{style:{width:`${c.pct}%`,background:c.color}}))]),s("span",{className:"cs-amount",key:"a"},o.amount),s("span",{className:"cs-status",key:"s",style:{color:g,border:`1px solid ${g}55`,background:`${g}18`}},o.status)])}),s("div",{className:"cs-ledger-skel",key:"skel"},[s("span",{className:"box",key:"b1",style:{height:40}}),s("span",{className:"box",key:"b2"}),s("span",{className:"box",key:"b3"}),s("span",{className:"box",key:"b4"}),s("span",{className:"box",key:"b5"}),s("span",{className:"box",key:"b6"}),s("span",{key:"b7"},"Ingesting\u2026")]),s("div",{className:"cs-ledger-foot",key:"foot"},[s("span",{className:"note",key:"n"},W),s("span",{className:"total",key:"t"},_)])])}function y(){return s("div",{className:"cs-budgets",key:"view"},[s("div",{className:"cs-budgets-key",key:"key"},[s("span",{key:"s"},[s("span",{className:"sw",key:"sw",style:{background:e.success}}),"Spent"]),s("span",{key:"p"},[s("span",{className:"sw",key:"sw",style:{background:`repeating-linear-gradient(45deg, ${e.pending} 0 3px, transparent 3px 6px)`}}),"Projected"]),s("span",{key:"f",style:{marginLeft:"auto",color:e.inkFaint}},`Forecast = run-rate \xD7 ${C} days left`)]),...U.map(t=>{const a=m(t.tone),r=t.state==="modeled",o=t.state==="empty",c=o?e.inkFaint:r?e.pending:e.success,g=o?"No live data \xB7 modeled cap":r?"Modeled from last sync":"Live \xB7 billed actuals",b=o?e.inkFaint:t.over?e.fail:e.success;return s("div",{className:`cs-budget-row${r?" dashed":""}`,key:t.cat},s("div",{className:"cs-budget-grid"},[s("div",{className:"cs-budget-cat",key:"c"},[s("span",{className:"cs-budget-dot",key:"d",style:{background:o?"transparent":c}}),s("div",{key:"t"},[s("div",{className:"cs-budget-nm",key:"n"},t.cat),s("div",{className:"cs-budget-state",key:"s",style:{color:c}},g)])]),s("div",{key:"bar"},[s("div",{className:"cs-budget-track",key:"t"},[s("span",{className:"cs-budget-proj",key:"p",style:{width:`${Math.min(t.projPct,100)}%`}}),s("span",{className:"cs-budget-spent",key:"s",style:{width:`${Math.min(t.spentPct,100)}%`,background:a}})]),s("div",{className:"cs-budget-nums",key:"n"},[s("span",{key:"s"},[t.spent," ",s("span",{className:"cap",key:"c"},`/ ${t.cap}`)]),s("span",{key:"f",style:{color:b}},t.forecastNote)])]),s("div",{key:"fc"},[s("div",{className:"cs-budget-fc-label",key:"l"},"Forecast close"),s("div",{className:"cs-budget-fc-val",key:"v",style:{color:b}},t.forecast)])]))})])}function l(){return s("div",{className:"cs-card",key:"view"},[s("div",{className:"cs-card-head",key:"h"},[s("div",{key:"t"},[s("div",{className:"cs-overline",key:"o",style:{marginBottom:8}},"Revenue recognition \xB7 pipeline"),s("div",{key:"b",style:{fontWeight:600,fontSize:"1.15rem",color:e.ink}},"Bookings \u2192 recognized")]),s("span",{className:"cs-tag-modeled",key:"tag"},"Modeled \xB7 ASC 606")]),s("div",{className:"cs-funnel",key:"f"},V.map(t=>{const a=m(t.tone);return s("div",{className:"cs-funnel-step",key:t.stage,style:{width:`${t.width}%`}},[s("div",{className:"cs-funnel-bar",key:"bar",style:{background:`${a}18`,borderColor:`${a}55`}},[s("span",{className:"cs-funnel-stage",key:"s",style:{color:a}},t.stage),s("span",{className:"cs-funnel-value",key:"v"},t.value)]),s("div",{className:"cs-funnel-pct",key:"p"},`${t.width}% of bookings`)])}))])}return s("div",{className:"costssuite"},[S(),x(),k(),i==="overview"?p():i==="sources"?d():i==="ledger"?u():i==="budgets"?y():l()])}w.displayName="CostsSuiteView",window.COSTS_SUITE_VIEW_FN=w,window.VIEWS=window.VIEWS||{},window.VIEWS.costsSuite=w,F&&(F.costsSuite={id:"costsSuite",label:"Costs",workspaceLabel:"Costs Suite",workspaceIcon:"payments",description:"Self-monitored spend/burn dashboard: monthly burn gauge, spend composition, cost sources (LLM/GCP/Stripe/Darvis/FX/Bank), AP inbox receipt ledger, per-category budgets & forecast, ASC-606 rev-rec funnel.",defaultView:"costsSuite",defaultDetail:"none",agentTreatment:"implicit",primaryAction:{label:"New budget",kind:"primary",icon:"add"},secondaryActions:[{label:"Sync now",icon:"sync"}],heroKpis:M.map(n=>({label:n.label,value:n.value,trend:"flat"}))})})();
