const UGD2=window.UG_GUIDE_DATA;
function UgScoreSection(){
const {ugStyles,UgField,UgTable,ugChanceFor,ugPctOf}=window;
const {Badge}=window.ScorebuddyDesignSystem_ee75f2;
const [ex,setEx]=React.useState('ipmi');
const [cat,setCat]=React.useState('General');
const [score,setScore]=React.useState('');
const s=parseFloat(score);
let out=null;
if(!isNaN(s)){
const p=ugPctOf(ex,s), pool=UGD2.pool[ex];
const rankAll=Math.max(1,Math.round((100-p)/100*pool.n));
const share=pool.share[cat]||1, rankCat=Math.max(1,Math.round(rankAll*share));
const calls=pool.calls?pool.calls[cat]:null;
const secRows=UGD2.P.filter(pr=>pr.exam===ex&&pr.sectional).map(pr=>[pr.name,pr.sect[cat]?pr.sect[cat].join(' / '):'—',<Badge tone="neutral">Sectional</Badge>,'shortlists on per-section floors (QA-SA / QA-MCQ / Verbal), not on the total — use the sectional inputs on the fit tab']);
const rows=secRows.concat(UGD2.P.filter(pr=>pr.exam===ex&&pr.cut[cat]!=null&&!pr.scale&&!pr.sectional).map(pr=>{const c=ugChanceFor(pr,cat,s);return [pr.name,(pr.est?'≈ ':'')+pr.cut[cat],<Badge tone={c[1]==='warning'?'neutral':c[1]}>{c[0]}</Badge>,c[2]];}));
out=<div>
<div style={{fontFamily:'var(--font-body)',fontSize:19,marginTop:12,color:'var(--text-body)'}}>Roughly the <span style={{fontFamily:'var(--font-display)',fontSize:46,fontWeight:800,color:'var(--brand-accent)'}}>{p.toFixed(1)}</span><span style={{fontSize:23,fontWeight:700,color:'var(--brand-accent)'}}> percentile</span></div>
<div style={ugStyles.kv}><b>Approx. all-India rank</b> ≈ {rankAll.toLocaleString('en-IN')} of {pool.label} &nbsp;·&nbsp; <b>Approx. rank within {cat}</b> ≈ {rankCat.toLocaleString('en-IN')}</div>
{calls?<div style={ugStyles.kv}><b>Interview calls issued in {cat} (2026)</b>: {calls}{pool.seats&&pool.seats[cat]?' for '+pool.seats[cat]+' seats':''} — a category rank inside that number is roughly what a call takes.</div>:null}
{rows.length?<UgTable head={['Programme on this exam',cat+' cutoff','Chance','Why']} rows={rows} rightFrom={1} wrapCols={[2,3]}></UgTable>:null}
<div style={ugStyles.hint}>Percentile is an estimate (for IPMAT Indore, anchored on RTI shortlist counts rather than coaching tables — see the note below); rank = that percentile applied to the 2026 positive-score pool, with category shares from RTI data — treat both as ±15%. "Chance" compares your score with the latest published shortlist cutoff only; the interview and academics decide the seat.</div>
</div>;}
return <div>
<h2 style={ugStyles.h2}>Convert a score to a <span style={{color:'var(--brand-accent)'}}>percentile &amp; rank</span></h2>
<p style={ugStyles.lede}>None of these exams publishes an official conversion table; the bands below are reconstructed from real scorecards. Accurate to a few marks.</p>
<div style={ugStyles.panel}>
<div style={{display:'flex',gap:10,flexWrap:'wrap',alignItems:'end'}}>
<UgField label="Category"><select value={cat} onChange={e=>setCat(e.target.value)} style={ugStyles.select}>{UGD2.cats.map(c=><option key={c}>{c}</option>)}</select></UgField>
<UgField label="Exam"><select value={ex} onChange={e=>setEx(e.target.value)} style={ugStyles.select}><option value="ipmi">IPMAT Indore (of 360)</option><option value="ipmr">IPMAT Rohtak (of 480)</option><option value="jip">JIPMAT (of 400)</option></select></UgField>
<UgField label="Score"><input type="number" value={score} onChange={e=>setScore(e.target.value)} placeholder="e.g. 220" style={ugStyles.input}></input></UgField>
</div>
{out}
</div>
<h2 style={ugStyles.h2}>Score bands <span style={{color:'var(--brand-accent)'}}>by percentile</span></h2>
<UgTable head={['Percentile','IPMAT Indore /360','IPMAT Rohtak /480','JIPMAT /400']} rows={UGD2.s2p}></UgTable>
<h2 style={ugStyles.h2}>JIPMAT — <span style={{color:'var(--brand-accent)'}}>finer table</span></h2>
<UgTable head={['Score (of 400)','Percentile']} rows={UGD2.jipFine}></UgTable>
<div style={{...ugStyles.callout,borderLeftColor:'var(--red-500)'}}><b>How the IPMAT Indore column was built — read this.</b> IIM Indore publishes no percentile table, and it doesn't select on percentile: it applies sectional floors, then ranks survivors <b>within each category</b> on a normalised composite (ATS, weighted 25 : 25 : 50 across QA-SA : QA-MCQ : Verbal). The coaching-site "score vs percentile" tables in circulation are largely one templated table copied across sites and disagree with the hard numbers. So this column is anchored on RTI facts instead: 17,916 candidates scored positive in 2026 and only 838 (4.7%) cleared the floors, which puts the General shortlist zone (roughly 165-190 marks) at about the 95-97th percentile; the RTI-cited "164 marks ≈ 95th percentile" agrees. Above that the curve is steep — the highest verified score is 292/360 (2025). Treat every value as ±10 marks, and remember your <b>category rank</b> is what actually matters at Indore.</div>
<div style={ugStyles.callout}>Anchors: at IIM Indore ~838 interview calls a year (293 General); ~328 on JIPMAT was IIM Bodh Gaya's General first-list score in 2026; 363/480 was IIM Rohtak's General shortlist score in 2026.</div>
</div>;}

function UgSectSection(){
const {ugStyles,UgTable}=window;
const cats=UGD2.cats, y=UGD2.indSect, pool=UGD2.pool.ipmi;
const indRows=cats.map(c=>{const a=y['2026'][c],b=y['2025'][c],d=y['2024'][c];return [c,...a,<b>{a[0]+a[1]+a[2]}</b>,...b,...d];});
const atsRows=cats.map(c=>[c,UGD2.indAts[c],pool.calls[c],pool.seats[c],(pool.calls[c]/pool.seats[c]).toFixed(1)+'×']);
const rohRows=Object.entries(UGD2.rohHist).map(([c,v])=>[c,...v,UGD2.pool.ipmr.calls[c]??'—']);
const jipRows=[];Object.entries(UGD2.jipSect).forEach(([inst,m])=>{Object.entries(m).forEach(([c,v])=>{jipRows.push([inst,c,...v.map(x=>x==null?'—':x)]);});});
return <div>
<h2 style={ugStyles.h2}>Sectional cutoffs — <span style={{color:'var(--brand-accent)'}}>IIM Indore IPMAT</span> (minimum marks per section, by category)</h2>
<p style={ugStyles.lede}>Indore never publishes an overall cutoff. You must clear the floor in <b>every</b> section — then your composite score decides the interview call. Three years shown so you can see the drift.</p>
<UgTable head={['Category','2026 QA-SA /60','QA-MCQ /120','Verbal /180','Sum','2025 QA-SA','QA-MCQ','Verbal','2024 QA-SA','QA-MCQ','Verbal']} rows={indRows}></UgTable>
<div style={ugStyles.callout}>Notice the pattern: the Verbal floor is by far the highest (111/180 for General in 2026 ≈ 62%) while the QA-MCQ floor has fallen from 35 to 27 over three years — verbal ability is what most often trips people at the section stage.</div>
<h2 style={ugStyles.h2}>IIM Indore composite (ATS) <span style={{color:'var(--brand-accent)'}}>interview-call ranges</span>, 2026</h2>
<UgTable head={['Category','ATS range of shortlisted candidates','Interview calls','Seats','Calls per seat']} rows={atsRows}></UgTable>
<h2 style={ugStyles.h2}>IPMAT Rohtak — <span style={{color:'var(--brand-accent)'}}>overall cutoff history</span> (out of 480)</h2>
<p style={ugStyles.lede}>Rohtak publishes no sectional cutoffs — only an overall shortlist score.</p>
<UgTable head={['Category','2026','2025','2024','2026 interview calls']} rows={rohRows}></UgTable>
<h2 style={ugStyles.h2}>JIPMAT — <span style={{color:'var(--brand-accent)'}}>sectional floors</span></h2>
<UgTable head={['Institute','Category','Quant','DI-LR','Verbal','Overall']} rows={jipRows} rightFrom={2}></UgTable>
<div style={ugStyles.callout}>Bodh Gaya's 2026 row is in raw marks (the institute switched from percentile floors to mark floors); the 2025 rows are percentiles. IIM Jammu's percentile floors are fixed year to year and are confirmed on the institute's own policy page. All are floors — the actual first-list closing score at Bodh Gaya was 328/400 for General in 2026 (333 in 2025); Jammu publishes no closing score because its merit adds board marks after the floor.</div>
</div>;}

function UgExamsSection(){
const {ugStyles,UgTable}=window;
return <div>
<h2 style={ugStyles.h2}>How each exam <span style={{color:'var(--brand-accent)'}}>is built</span></h2>
<UgTable head={['Exam','Sections','Max marks','Marking','Time','Opens the door to']} rows={UGD2.patterns} rightFrom={2} wrapCols={[1,3,4,5]}></UgTable>
<h2 style={ugStyles.h2}>How crowded <span style={{color:'var(--brand-accent)'}}>is the door?</span></h2>
<UgTable head={['Exam','Test-takers','Seats → odds','Interview calls']} rows={UGD2.stats} rightFrom={99} wrapCols={[1,2,3]}></UgTable>
</div>;}

function UgCompareSection(){
const {ugStyles,UgTable}=window;
const FEES=window.UG_GUIDE_FEES;
const cmpRows=UGD2.P.map(p=>[p.name,p.programme,p.years,UGD2.exams[p.exam][0],p.seats??'—',p.fees,p.elig,p.outcome]);
const max=Math.max(...FEES.map(f=>f[1]));
return <div>
<h2 style={ugStyles.h2}>Compare <span style={{color:'var(--brand-accent)'}}>the programmes</span></h2>
<p style={ugStyles.lede}>Duration, seats, fees and the eligibility rules that quietly disqualify people. Sorted the way most students shortlist: IIMs first.</p>
<UgTable head={['Programme','Degree','Yrs','Exam','Seats','Fees','Eligibility','What graduates go on to']} rows={cmpRows} rightFrom={2} wrapCols={[1,3,5,6,7]}></UgTable>
<h2 style={ugStyles.h2}>Fees at a glance <span style={{color:'var(--brand-accent)'}}>(approximate total, ₹ lakh)</span></h2>
<div style={ugStyles.panel}>
{FEES.map(([n,v])=><div key={n} style={{display:'grid',gridTemplateColumns:'210px 1fr 84px',gap:10,alignItems:'center',padding:'3px 0'}}>
<div style={{fontFamily:'var(--font-body)',fontSize:15.5,color:'var(--text-body)',textAlign:'right',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis'}}>{n}</div>
<div style={{height:16}}><div style={{height:'100%',width:(v/max*100).toFixed(1)+'%',background:'var(--brand-primary)',borderRadius:'0 4px 4px 0',minWidth:2}}></div></div>
<div style={{fontFamily:'var(--font-body)',fontSize:15.5,fontWeight:700,fontVariantNumeric:'tabular-nums',color:'var(--brand-accent)'}}>₹{v} L</div>
</div>)}
<div style={ugStyles.hint}>Approximate totals; IIM 5-yr figures where years 4-5 follow MBA fees are estimated. Hostel/mess partly included depending on institute.</div>
</div>
</div>;}

function UgCoursesSection(){
const {ugStyles}=window;
return <div>
<h2 style={ugStyles.h2}>Which course? <span style={{color:'var(--brand-accent)'}}>A plain-language map</span></h2>
<p style={ugStyles.lede}>The degree name matters less than the college, but each route has a distinct flavour, exam set and career pipeline. Ten families, side by side.</p>
{UGD2.courses.map(c=><div key={c.name} style={{...ugStyles.panel,margin:'12px 0'}}>
<h3 style={{margin:'0 0 6px',fontFamily:'var(--font-display)',fontWeight:700,fontSize:18,color:'var(--brand-accent)'}}>{c.name}</h3>
<p style={{margin:'0 0 8px',fontFamily:'var(--font-body)',fontSize:15.5,color:'var(--text-body)',lineHeight:1.6}}>{c.what}</p>
<div style={ugStyles.kv}><b>Exams</b> {c.exams}</div>
<div style={ugStyles.kv}><b>Where</b> {c.colleges}</div>
<div style={ugStyles.kv}><b>Fees</b> {c.fees}</div>
<div style={ugStyles.kv}><b>Suits</b> {c.suits}</div>
<div style={{...ugStyles.kv,marginTop:8,paddingTop:8,borderTop:'1px solid var(--border-default)'}}><b>Future scope</b> {c.scope}</div>
</div>)}
</div>;}

function UgKnowSection(){
const {ugStyles}=window;
return <div>
<h2 style={ugStyles.h2}>Ten things <span style={{color:'var(--brand-accent)'}}>worth knowing</span></h2>
<div style={{display:'grid',gridTemplateColumns:'repeat(auto-fill,minmax(330px,1fr))',gap:12,marginTop:14}}>
{UGD2.gtk.map(([h,p])=><div key={h} style={{...ugStyles.panel,margin:0}}>
<h3 style={{margin:'0 0 6px',fontFamily:'var(--font-display)',fontWeight:700,fontSize:18.5,color:'var(--brand-accent)'}}>{h}</h3>
<p style={{margin:0,fontFamily:'var(--font-body)',fontSize:16,color:'var(--text-body)',lineHeight:1.55}}>{p}</p></div>)}
</div>
</div>;}

function UgGuidePage(){
const {Badge,Tag}=window.ScorebuddyDesignSystem_ee75f2;
const TABS=[['fit','Check your fit'],['score','Score → percentile & rank'],['sect','Sectional cutoffs'],['exams','The exams'],['compare','Compare programmes'],['courses','Courses explained'],['know','Worth knowing']];
const [tab,setTab]=React.useState('fit');
const {ugStyles,UgFitSection}=window;
return <div>
<section style={{padding:'56px 48px 8px',maxWidth:1180,margin:'0 auto'}}>
<Badge tone="brand">2027 CYCLE · IPMAT · JIPMAT · CUET · BBA/BMS</Badge>
<h1 style={{fontFamily:'var(--font-display)',fontWeight:800,fontSize:48,color:'var(--text-heading)',margin:'16px 0 12px'}}>UG Management <span style={{color:'var(--brand-accent)'}}>Guide 2027</span></h1>
<p style={{fontFamily:'var(--font-body)',fontSize:18.5,color:'var(--text-body)',lineHeight:1.6,maxWidth:800,margin:0}}>Every serious undergraduate management route in India in one place: the 5-year IIM IPMs (IPMAT / JIPMAT), the new 4-year IIM degrees launched in 2026, and the top BBA / BMS programmes outside the IIMs. Enter your scores to see where you stand.</p>
</section>
<section style={{padding:'20px 48px 60px',maxWidth:1180,margin:'0 auto'}}>
<p style={{fontFamily:'var(--font-body)',fontSize:14.5,color:'var(--text-body)',margin:'0 0 14px'}}>Taking the IIM Bangalore B.Sc. test? See the <a href="iimb-ug-sample-paper.html" style={{fontWeight:700}}>IIMB UG sample paper</a>, with the admit card link and exam pattern.</p>
<div style={{display:'flex',gap:8,flexWrap:'wrap',borderBottom:'1px solid var(--border-default)',paddingBottom:14,position:'sticky',top:73,background:'var(--color-bg-page)',zIndex:5,paddingTop:6}}>
{TABS.map(([id,l])=><Tag key={id} active={tab===id} onClick={()=>{setTab(id);scrollTo(0,0);}}>{l}</Tag>)}
</div>
{tab==='fit'&&<UgFitSection></UgFitSection>}
{tab==='score'&&<UgScoreSection></UgScoreSection>}
{tab==='sect'&&<UgSectSection></UgSectSection>}
{tab==='exams'&&<UgExamsSection></UgExamsSection>}
{tab==='compare'&&<UgCompareSection></UgCompareSection>}
{tab==='courses'&&<UgCoursesSection></UgCoursesSection>}
{tab==='know'&&<UgKnowSection></UgKnowSection>}
<p style={{fontFamily:'var(--font-body)',fontSize:14,color:'var(--text-muted)',marginTop:40,paddingTop:18,borderTop:'1px solid var(--border-default)',lineHeight:1.6}}>Compiled August 2026 for students entering in 2027. Figures reflect the 2026 admission cycle (2025 where 2026 wasn't published); first-batch programmes have no history and are marked as such. Every institute revises its policy annually — confirm on its own site before applying. Not admissions advice.</p>
</section>
</div>;}
window.UgGuidePage=UgGuidePage;
