<?php

// CA Planner + Calculator. Paste with snippet TYPE = PHP. Do NOT include opening <?php tag.
echo <<<'CTPLANNERHTML'
<style>

  :root{
    --dark:#1A1A2E; --gold:#E8A020; --gold-light:#F5C842;
    --green:#22C55E; --blue:#3B82F6; --orange:#F97316; --red:#E11D48; --teal:#059669;
    --slate:#64748B; --border:#E5E7EB; --row-alt:#F9FAFB;
  }#ct-planner-app *{box-sizing:border-box;}#ct-planner-app{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;color:var(--dark);background:#fff;line-height:1.5;}#ct-planner-app .wrap{max-width:920px;margin:0 auto;padding:0 16px;}#ct-planner-app a{color:inherit;}#ct-planner-app /* Hero */
  .hero{background:linear-gradient(160deg,var(--dark) 0%,#272750 100%);color:#fff;padding:48px 16px 56px;text-align:center;}#ct-planner-app .badge{display:inline-block;background:rgba(232,160,32,0.22);border:1px solid rgba(232,160,32,0.55);color:var(--gold-light);font-size:11px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;padding:6px 16px;border-radius:50px;margin-bottom:18px;}#ct-planner-app .hero h1{font-size:32px;font-weight:900;line-height:1.18;margin:0 0 14px;max-width:680px;margin-left:auto;margin-right:auto;}#ct-planner-app .hero h1 span{color:var(--gold-light);}#ct-planner-app .hero p.sub{font-size:15px;color:rgba(255,255,255,0.82);max-width:560px;margin:0 auto 28px;}#ct-planner-app .cta-btn{display:inline-block;background:var(--gold);color:var(--dark);font-weight:800;font-size:15px;padding:14px 32px;border-radius:10px;text-decoration:none;box-shadow:0 8px 24px rgba(232,160,32,0.35);transition:transform .15s ease;}#ct-planner-app .cta-btn:hover{transform:translateY(-2px);}#ct-planner-app .cta-sub{margin-top:10px;font-size:12px;color:rgba(255,255,255,0.6);}#ct-planner-app /* Trust strip */
  .trust-strip{background:#fff;border-bottom:1px solid var(--border);padding:18px 16px;}#ct-planner-app .trust-row{display:flex;flex-wrap:wrap;justify-content:center;gap:10px 28px;font-size:12.5px;color:var(--slate);font-weight:600;}#ct-planner-app .trust-row span{display:flex;align-items:center;gap:6px;}#ct-planner-app /* Section heading */
  .section{padding:48px 0 8px;}#ct-planner-app .section h2{font-size:22px;font-weight:900;margin:0 0 6px;text-align:center;}#ct-planner-app .section p.lead{font-size:13.5px;color:var(--slate);text-align:center;max-width:520px;margin:0 auto 28px;}#ct-planner-app /* Tabs */
  .tabs{display:flex;gap:8px;justify-content:center;margin-bottom:24px;flex-wrap:wrap;}#ct-planner-app .tab-btn{background:#fff;border:1.5px solid var(--border);color:var(--slate);font-weight:700;font-size:13px;padding:9px 20px;border-radius:50px;cursor:pointer;transition:all .15s ease;}#ct-planner-app .tab-btn.active{background:var(--dark);border-color:var(--dark);color:#fff;}#ct-planner-app .exam-panel{display:none;}#ct-planner-app .exam-panel.active{display:block;}#ct-planner-app /* Group / paper accordion */
  .group{background:#F8F8FC;border:1px solid var(--border);border-radius:14px;margin-bottom:16px;overflow:hidden;}#ct-planner-app .group > summary{cursor:pointer;list-style:none;background:var(--dark);padding:13px 18px;font-weight:800;font-size:14.5px;color:#fff;display:flex;align-items:center;justify-content:space-between;}#ct-planner-app .group > summary::-webkit-details-marker{display:none;}#ct-planner-app .group > summary .meta{font-weight:500;font-size:11.5px;color:var(--gold-light);}#ct-planner-app .group-body{padding:14px 14px 4px;}#ct-planner-app .paper{background:#fff;border:1px solid var(--border);border-radius:12px;margin-bottom:12px;overflow:hidden;}#ct-planner-app .paper > summary{cursor:pointer;list-style:none;padding:12px 16px;font-weight:700;font-size:13.5px;display:flex;justify-content:space-between;align-items:center;}#ct-planner-app .paper > summary::-webkit-details-marker{display:none;}#ct-planner-app .paper > summary .meta{font-weight:500;font-size:11px;color:var(--slate);}#ct-planner-app .paper-body{padding:4px 16px 12px;}#ct-planner-app .day-row{display:flex;gap:10px;align-items:flex-start;padding:8px 0;border-bottom:1px solid var(--border);font-size:12.5px;}#ct-planner-app .day-row:last-child{border-bottom:none;}#ct-planner-app .day-badge{color:#fff;font-weight:700;font-size:10.5px;padding:4px 9px;border-radius:6px;white-space:nowrap;min-width:42px;text-align:center;flex-shrink:0;}#ct-planner-app .day-label{font-weight:700;}#ct-planner-app /* Calculator */
  #ct-planner-app .calc-box{background:#F8F8FC;border:1px solid var(--border);border-radius:16px;padding:22px;margin:0 0 20px;}#ct-planner-app .calc-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px;}#ct-planner-app .field label{font-size:11px;font-weight:700;color:var(--slate);text-transform:uppercase;letter-spacing:0.4px;display:block;margin-bottom:5px;}#ct-planner-app .field select, #ct-planner-app .field input{width:100%;padding:10px 12px;border-radius:8px;border:1px solid var(--border);font-size:13.5px;color:var(--dark);background:#fff;}#ct-planner-app .calc-result-banner{background:#fff;border:1px solid var(--border);border-radius:10px;padding:10px 16px;font-size:12.5px;color:var(--slate);margin:14px 0;}#ct-planner-app .calc-result-banner strong{color:var(--dark);}#ct-planner-app .clamp-warning{background:#FFF7ED;border:1px solid #FDBA74;border-radius:10px;padding:12px 16px;font-size:12.5px;color:#7C2D12;margin-bottom:14px;}#ct-planner-app .compressed-tag{color:var(--red);font-weight:700;font-size:10.5px;}#ct-planner-app /* Testimonials */
  .testi-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-bottom:10px;}
  @media(max-width:600px){#ct-planner-app .testi-grid{grid-template-columns:1fr;}}#ct-planner-app .testi-card{background:#fff;border:1px solid var(--border);border-radius:14px;padding:18px;position:relative;}#ct-planner-app .testi-card .quote-mark{font-size:32px;color:var(--gold);font-weight:900;line-height:1;margin-bottom:6px;display:block;}#ct-planner-app .testi-text{font-size:13px;color:var(--dark);margin-bottom:12px;line-height:1.55;}#ct-planner-app .testi-footer{display:flex;align-items:center;justify-content:space-between;font-size:11.5px;color:var(--slate);font-weight:700;}#ct-planner-app .result-pill{display:inline-block;background:#F0FDF4;color:#14532D;border:1px solid #86EFAC;font-size:10.5px;font-weight:800;padding:3px 10px;border-radius:50px;}#ct-planner-app /* Final CTA */
  .final-cta{background:linear-gradient(160deg,var(--dark) 0%,#272750 100%);color:#fff;border-radius:20px;padding:40px 28px;text-align:center;margin:48px 0 20px;}#ct-planner-app .final-cta h2{font-size:24px;font-weight:900;margin:0 0 10px;color:#fff;}#ct-planner-app .final-cta h2 span{color:var(--gold-light);}#ct-planner-app .final-cta p{font-size:13.5px;color:rgba(255,255,255,0.78);max-width:480px;margin:0 auto 24px;}#ct-planner-app .final-points{display:flex;flex-wrap:wrap;gap:10px 22px;justify-content:center;margin-bottom:26px;font-size:12px;color:rgba(255,255,255,0.85);}#ct-planner-app .final-points span{display:flex;align-items:center;gap:6px;}#ct-planner-app footer{text-align:center;padding:24px 16px 40px;font-size:11.5px;color:var(--slate);}#ct-planner-app .info-note{background:#EFF6FF;border:1px solid #93C5FD;border-radius:10px;padding:13px 18px;font-size:12.5px;color:#1E3A5F;margin-bottom:20px;}

</style>
<div id="ct-planner-app">
<div class="hero">
  <div class="wrap">
    <div class="badge">CA Foundation · Inter · Final · Nov 2026 Target</div>
    <h1>The Day-Wise Study Planner Behind <span>Hundreds of CA Passes</span></h1>
    <p class="sub">Unit-wise study days, cycle tests built in after every 2–3 chapters, and a calculator that rebuilds your entire plan the moment your timeline changes. Built and used by CharteredTeam's own test planner students.</p>
    <a class="cta-btn" href="https://charteredteam.com/test-series-for-ca" target="_blank" rel="noopener">Join the Test Planner →</a>
    <div class="cta-sub">Daily evaluation · chapter-wise feedback · all 3 levels covered</div>
  </div>
</div>

<div class="trust-strip">
  <div class="trust-row">
    <span>✅ Real student results below — not stock testimonials</span>
    <span>✅ Works for Foundation, Inter & Final</span>
    <span>✅ Plan adjusts to your exact days left</span>
  </div>
</div>

<div class="wrap">

  <div class="section">
    <h2>Your Day-Wise Planner</h2>
    <p class="lead">Pick your level. Every paper is broken into short study blocks, each followed by a cycle test on exactly those chapters — so nothing gets revised cold before the final exam.</p>

    <div class="tabs" id="examTabs">
      <button class="tab-btn active" data-exam="inter">CA Inter</button>
      <button class="tab-btn" data-exam="final">CA Final</button>
      <button class="tab-btn" data-exam="foundation">CA Foundation</button>
    </div>

    <div id="plannerHost"></div>
  </div>

  <div class="section" id="calculator">
    <h2>Auto-Adjusting Days Calculator</h2>
    <p class="lead">Got 60 days? 45? Just 30? Tell it how many days are actually left, and the plan above compresses or stretches automatically — test days always stay fixed milestones.</p>

    <div class="calc-box">
      <div class="calc-grid">
        <div class="field">
          <label>Exam</label>
          <select id="calcExam"></select>
        </div>
        <div class="field">
          <label>Group</label>
          <select id="calcGroup"></select>
        </div>
      </div>
      <div class="calc-grid">
        <div class="field">
          <label>Paper</label>
          <select id="calcPaper"></select>
        </div>
        <div class="field">
          <label>Days available</label>
          <input type="number" id="calcDays" min="1" value="45">
        </div>
      </div>
      <div id="calcClampWarning"></div>
      <div class="calc-result-banner" id="calcBanner"></div>
      <div id="calcOutput"></div>
    </div>
    <p style="font-size:11.5px;color:var(--slate);line-height:1.6;">How it works: study days between cycle tests are scaled proportionally to their original chapter load, then chapters are redistributed evenly across the new day count. Test days are always preserved as fixed milestones with their original coverage intact, even on a tighter runway.</p>
  </div>

  <div class="section">
    <h2>Real Students. Real Results.</h2>
    <p class="lead">Messages from students who followed this exact day-wise plan and test cycle — across all three levels.</p>
    <div class="testi-grid" id="testiGrid"></div>
  </div>

  <div class="final-cta">
    <h2>This planner is the free part. <span>The test planner is where the gains happen.</span></h2>
    <p>The day-wise schedule gets you organized. What actually moves your score is detailed, chapter-wise evaluation on every test — which is what students above kept crediting for their results.</p>
    <div class="final-points">
      <span>📝 Evaluated copies, not just scores</span>
      <span>📊 Daily progress tracking</span>
      <span>🎯 All papers, all 3 levels</span>
      <span>💬 Direct feedback from mentors</span>
    </div>
    <a class="cta-btn" href="https://charteredteam.com/test-series-for-ca" target="_blank" rel="noopener">Join the Test Planner →</a>
  </div>

</div>

<footer>CharteredTeam · charteredteam.com</footer>

<script>
const DATA = {"inter": {"label": "CA Inter", "groups": {"Group 1": [{"name": "Paper 1 - Advanced Accounting", "color": "#22C55E", "days": [{"t": "S", "c": ["Ch1: Introduction to Accounting Standards", "Ch2: Framework for Preparation & Presentation of FS"]}, {"t": "S", "c": ["Ch3: Applicability of Accounting Standards", "Ch4: Presentation & Disclosure-based AS (1,3,17,18,20,24,25)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Assets-based AS (2,10,13,16,19,26,28)", "Ch6: Liabilities-based AS (15,19)"]}, {"t": "S", "c": ["Ch7: AS on Items Impacting FS (4,5,11,22)", "Ch8: Revenue-based AS (7,9)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Other AS (12,14)", "Ch10: AS for CFS (21,23,27)", "Ch11: Financial Statements of Companies"]}, {"t": "S", "c": ["Unit 1: Preparation of Financial Statements", "Unit 2: Cash Flow Statement"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch12: Buyback of Securities", "Ch13: Amalgamation of Companies"]}, {"t": "S", "c": ["Ch14: Reconstruction of Companies", "Ch15: Branches incl. Foreign Branches"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 2 - Corporate and Other Laws", "color": "#3B82F6", "days": [{"t": "S", "c": ["Part I: Company Law & LLP", "Ch1: Preliminary"]}, {"t": "S", "c": ["Ch2: Incorporation of Company", "Ch3: Prospectus & Allotment of Securities"]}, {"t": "S", "c": ["Ch4: Share Capital and Debentures"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Acceptance of Deposits", "Ch6: Registration of Charges"]}, {"t": "S", "c": ["Ch7: Management & Administration", "Ch8: Declaration & Payment of Dividend"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Accounts of Companies", "Ch10: Audit and Auditors"]}, {"t": "S", "c": ["Ch11: Companies Incorporated Outside India", "Ch12: The LLP Act, 2008"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Part II: Other Laws", "Ch1: The General Clauses Act, 1897"]}, {"t": "S", "c": ["Ch2: Interpretation of Statutes", "Ch3: FEMA, 1999"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 3 - Taxation", "color": "#E11D48", "days": [{"t": "S", "c": ["Ch1: Basic Concepts", "Ch2: Residence & Scope of Total Income"]}, {"t": "S", "c": ["Ch3: Heads of Income", "Ch4: Income of Other Persons in Assessee's Total Income"]}, {"t": "S", "c": ["Ch5: Aggregation of Income, Set-Off & Carry Forward of Losses", "Ch6: Deductions from Gross Total Income"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch7: Advance Tax, TDS & TCS", "Ch8: Filing Return of Income & Self Assessment", "Ch9: Tax Liability - Computation & Optimisation"]}, {"t": "S", "c": ["GST Ch1: GST in India - Introduction", "GST Ch2: Supply under GST", "GST Ch3: Charge of GST"]}, {"t": "T", "l": null}, {"t": "S", "c": ["GST Ch4: Place of Supply", "GST Ch5: Exemptions from GST", "GST Ch6: Time of Supply"]}, {"t": "S", "c": ["GST Ch7: Value of Supply", "GST Ch8: Input Tax Credit", "GST Ch9: Registration"]}, {"t": "T", "l": null}, {"t": "S", "c": ["GST Ch10: Tax Invoice, Credit & Debit Notes", "GST Ch11: Accounts and Records", "GST Ch12: E-Way Bill"]}, {"t": "S", "c": ["GST Ch13: Payment of Tax", "GST Ch14: TDS & TCS", "GST Ch15: Returns"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}], "Group 2": [{"name": "Paper 4 - Cost and Management Accounting", "color": "#F97316", "days": [{"t": "S", "c": ["Ch1: Introduction to Cost & Management Accounting", "Ch2: Material Cost"]}, {"t": "S", "c": ["Ch3: Employee Cost & Direct Expenses", "Ch4: Overheads - Absorption Costing Method"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Activity Based Costing", "Ch6: Cost Sheet"]}, {"t": "S", "c": ["Ch7: Cost Accounting System", "Ch8: Unit & Batch Costing"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Job Costing", "Ch10: Process & Operation Costing"]}, {"t": "S", "c": ["Ch11: Joint Products & By Products", "Ch13: Standard Costing"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch12: Service Costing", "Ch14: Marginal Costing"]}, {"t": "S", "c": ["Ch15: Budget and Budgetary Control"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 5 - Auditing and Ethics", "color": "#059669", "days": [{"t": "S", "c": ["Ch1: Nature, Objective & Scope of Audit"]}, {"t": "S", "c": ["Ch2: Audit Strategy, Planning & Programme"]}, {"t": "S", "c": ["Ch3: Risk Assessment & Internal Control"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch4: Audit Evidence", "Ch5: Audit of Items of Financial Statements"]}, {"t": "S", "c": ["Ch6: Audit Documentation"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch7: Completion and Review"]}, {"t": "S", "c": ["Ch8: Audit Report"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Special Features of Audit of Different Entities", "Ch10: Audit of Banks"]}, {"t": "S", "c": ["Ch11: Ethics & Terms of Audit Engagements"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 6 - FM & SM", "color": "#E8A020", "days": [{"t": "S", "c": ["Ch1: Scope & Objectives of Financial Management"]}, {"t": "S", "c": ["Ch2: Types of Financing"]}, {"t": "S", "c": ["Ch3: Financial Analysis & Planning - Ratio Analysis"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch4: Cost of Capital", "Ch5: Financing Decisions - Capital Structure"]}, {"t": "S", "c": ["Ch6: Financing Decisions - Leverages"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch7: Investment Decisions", "Ch8: Dividend Decision"]}, {"t": "S", "c": ["Ch9: Management of Working Capital", "SM Ch1: Introduction to Strategic Management"]}, {"t": "T", "l": null}, {"t": "S", "c": ["SM Ch2: Strategic Analysis - External Environment", "SM Ch3: Strategic Analysis - Internal Environment"]}, {"t": "S", "c": ["SM Ch4: Strategic Choices", "SM Ch5: Strategy Implementation & Evaluation"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}]}}, "final": {"label": "CA Final", "groups": {"Group 1": [{"name": "Paper 1 - Financial Reporting", "color": "#22C55E", "days": [{"t": "S", "c": ["Ch1: Introduction to Indian Accounting Standards", "Ch2: Conceptual Framework for Financial Reporting"]}, {"t": "S", "c": ["Ch3: Ind AS on Presentation of Items (1,34,7)", "Ch4: Ind AS on Measurement-based Policies (8,10,113)"]}, {"t": "S", "c": ["Ch9: Ind AS 115 - Revenue from Contracts with Customers"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Ind AS on Assets (2,16,23,36,38,40,105,116)"]}, {"t": "S", "c": ["Ch5 (continued): Ind AS on Assets"]}, {"t": "S", "c": ["Ch10: Other Ind AS (41,20,102)"]}, {"t": "S", "c": ["Ch10 (continued): Other Ind AS"]}, {"t": "S", "c": ["Practice & Revision: Chapter 5"]}, {"t": "S", "c": ["Practice & Revision: Chapter 10"]}, {"t": "S", "c": ["Practice & Revision: Chapter 5"]}, {"t": "S", "c": ["Full Revision: Chapter 5 & Chapter 10"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch6: Ind AS on Liabilities (19,37)"]}, {"t": "S", "c": ["Ch6 (continued): Ind AS on Liabilities"]}, {"t": "S", "c": ["Ch7: Ind AS on Items Impacting FS (12,21)"]}, {"t": "S", "c": ["Ch7 (continued)"]}, {"t": "S", "c": ["Ch8: Ind AS on Disclosures (24,33,108)"]}, {"t": "S", "c": ["Ch8 (continued)"]}, {"t": "S", "c": ["Ch11: Accounting & Reporting of Financial Instruments"]}, {"t": "S", "c": ["Ch11 (continued)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch12: Ind AS 103 - Business Combinations"]}, {"t": "S", "c": ["Ch12 (continued)"]}, {"t": "S", "c": ["Ch13: Consolidated & Separate FS of Group Entities (110,111,28,27)"]}, {"t": "S", "c": ["Ch13 (continued)"]}, {"t": "S", "c": ["Ch14: Ind AS 101 - First-time Adoption of Ind AS"]}, {"t": "S", "c": ["Ch15: Analysis of Financial Statements"]}, {"t": "S", "c": ["Ch16: Professional & Ethical Duty of a CA"]}, {"t": "S", "c": ["Ch17: Accounting and Technology"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 2 - Advanced Financial Management", "color": "#3B82F6", "days": [{"t": "S", "c": ["Ch1: Financial Policy & Corporate Strategy", "Ch2: Risk Management"]}, {"t": "S", "c": ["Ch3: Advanced Capital Budgeting Decisions", "Ch4: Security Analysis"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Security Valuation"]}, {"t": "S", "c": ["Ch5 (continued)"]}, {"t": "S", "c": ["Ch6: Portfolio Management"]}, {"t": "S", "c": ["Ch6 (continued)"]}, {"t": "S", "c": ["Ch7: Securitization"]}, {"t": "S", "c": ["Ch7 (continued)"]}, {"t": "S", "c": ["Ch8: Mutual Funds"]}, {"t": "S", "c": ["Ch8 (continued)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Derivatives Analysis & Valuation"]}, {"t": "S", "c": ["Ch9 (continued)"]}, {"t": "S", "c": ["Ch10: Foreign Exchange Exposure & Risk Management"]}, {"t": "S", "c": ["Ch10 (continued)"]}, {"t": "S", "c": ["Ch11: International Financial Management"]}, {"t": "S", "c": ["Ch11 (continued)"]}, {"t": "S", "c": ["Practice & Revision: Chapter 9"]}, {"t": "S", "c": ["Full Revision: Chapter 9, 10 & 11"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch12: Interest Rate Risk Management"]}, {"t": "S", "c": ["Ch12 (continued)"]}, {"t": "S", "c": ["Ch13: Business Valuation"]}, {"t": "S", "c": ["Ch13 (continued)"]}, {"t": "S", "c": ["Ch14: Mergers, Acquisitions & Corporate Restructuring"]}, {"t": "S", "c": ["Ch14 (continued)"]}, {"t": "S", "c": ["Ch15: Startup Finance"]}, {"t": "S", "c": ["Ch15 (continued)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 3 - Advanced Auditing, Assurance & Professional Ethics", "color": "#F97316", "days": [{"t": "S", "c": ["Ch1: Quality Control", "Ch2: General Auditing Principles & Auditor's Responsibilities"]}, {"t": "S", "c": ["Ch3: Audit Planning, Strategy & Execution", "Ch4: Materiality, Risk Assessment & Internal Control"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Audit Evidence"]}, {"t": "S", "c": ["Ch5 (continued)"]}, {"t": "S", "c": ["Ch6: Completion and Review"]}, {"t": "S", "c": ["Ch6 (continued)"]}, {"t": "S", "c": ["Ch7: Reporting"]}, {"t": "S", "c": ["Ch8: Specialised Areas"]}, {"t": "S", "c": ["Ch9: Audit-related Services"]}, {"t": "S", "c": ["Ch10: Review of Financial Information"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch11: Prospective Financial Info & Other Assurance Services"]}, {"t": "S", "c": ["Ch11 (continued)"]}, {"t": "S", "c": ["Ch12: Digital Auditing & Assurance"]}, {"t": "S", "c": ["Ch12 (continued)"]}, {"t": "S", "c": ["Ch13: Group Audits"]}, {"t": "S", "c": ["Ch13 (continued)"]}, {"t": "S", "c": ["Ch14: Audit of Banks & NBFCs"]}, {"t": "S", "c": ["Ch14 (continued)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch15: Audit of Public Sector Undertakings"]}, {"t": "S", "c": ["Ch15 (continued)"]}, {"t": "S", "c": ["Ch16: Internal Audit"]}, {"t": "S", "c": ["Ch16 (continued)"]}, {"t": "S", "c": ["Ch17: Due Diligence, Investigation & Forensic Audit"]}, {"t": "S", "c": ["Ch17 (continued)"]}, {"t": "S", "c": ["Ch18: SDG & ESG Assurance"]}, {"t": "S", "c": ["Ch19: Professional Ethics & Liabilities of Auditors"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}], "Group 2": [{"name": "Paper 4 - Direct Tax Laws & International Taxation", "color": "#E11D48", "days": [{"t": "S", "c": ["Ch1: Basic Concepts", "Ch2: Incomes Not Forming Part of Total Income", "Ch3: Profits & Gains of Business or Profession"]}, {"t": "S", "c": ["Ch4: Capital Gains", "Ch5: Income from Other Sources", "Ch6: Income of Other Persons in Assessee's Total Income"]}, {"t": "S", "c": ["Ch7: Aggregation of Income, Set-Off & Carry Forward of Losses", "Ch8: Deductions from Gross Total Income"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Assessment of Various Entities"]}, {"t": "S", "c": ["Ch9 (continued)"]}, {"t": "S", "c": ["Ch10: Assessment of Trusts, Institutions & Political Parties"]}, {"t": "S", "c": ["Ch10 (continued)"]}, {"t": "S", "c": ["Ch11: Tax Planning, Avoidance & Evasion"]}, {"t": "S", "c": ["Ch11 (continued)"]}, {"t": "S", "c": ["Ch12: Taxation of Digital Transactions"]}, {"t": "S", "c": ["Ch12 (continued)"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch13: Deduction, Collection & Recovery of Tax"]}, {"t": "S", "c": ["Ch14: Income Tax Authorities"]}, {"t": "S", "c": ["Ch15: Assessment Procedure"]}, {"t": "S", "c": ["Ch16: Appeals and Revision"]}, {"t": "S", "c": ["Ch17: Dispute Resolution"]}, {"t": "S", "c": ["Ch18: Miscellaneous Provisions"]}, {"t": "S", "c": ["Ch19: Provisions to Counteract Unethical Tax Practices"]}, {"t": "S", "c": ["Ch20: Tax Audit & Ethical Compliances"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch21: Non-Resident Taxation"]}, {"t": "S", "c": ["Ch22: Double Taxation Relief"]}, {"t": "S", "c": ["Ch23: Advance Rulings"]}, {"t": "S", "c": ["Ch24: Transfer Pricing"]}, {"t": "S", "c": ["Ch25: Fundamentals of BEPS"]}, {"t": "S", "c": ["Ch26: Application & Interpretation of Tax Treaties"]}, {"t": "S", "c": ["Ch27: Overview of Model Tax Conventions"]}, {"t": "S", "c": ["Ch28: Latest Developments in International Taxation"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 5 - Indirect Tax Laws", "color": "#059669", "days": [{"t": "S", "c": ["Ch1: Supply under GST", "Ch2: Charge of GST"]}, {"t": "S", "c": ["Ch3: Place of Supply", "Ch4: Exemptions from GST"]}, {"t": "S", "c": ["Ch5: Time of Supply", "Ch6: Value of Supply"]}, {"t": "T", "l": "Module 1 Test"}, {"t": "S", "c": ["Ch7: Input Tax Credit"]}, {"t": "S", "c": ["Ch7 (continued)"]}, {"t": "S", "c": ["Ch8: Registration"]}, {"t": "S", "c": ["Ch9: Tax Invoice, Credit & Debit Notes"]}, {"t": "S", "c": ["Ch10: Accounts and Records; E-way Bill"]}, {"t": "S", "c": ["Ch11: Payment of Tax"]}, {"t": "S", "c": ["Ch12: Electronic Commerce Transactions"]}, {"t": "S", "c": ["Ch13: Returns"]}, {"t": "T", "l": "Module 2 Test"}, {"t": "S", "c": ["Ch14: Import & Export under GST", "Ch15: Refunds"]}, {"t": "S", "c": ["Ch16: Job Work", "Ch17: Assessment and Audit"]}, {"t": "S", "c": ["Ch18: Inspection, Search, Seizure & Arrest", "Ch19: Demands and Recovery"]}, {"t": "S", "c": ["Ch20: Liability to Pay Tax in Certain Cases", "Ch21: Offences and Penalties"]}, {"t": "S", "c": ["Ch22: Appeals and Revisions", "Ch23: Advance Ruling"]}, {"t": "S", "c": ["Ch24: Miscellaneous Provisions"]}, {"t": "T", "l": "Module 3 Test"}, {"t": "S", "c": ["Customs Ch1: Levy of & Exemptions from Customs Duty"]}, {"t": "S", "c": ["Customs Ch1 (continued)"]}, {"t": "S", "c": ["Customs Ch2: Types of Duty"]}, {"t": "S", "c": ["Customs Ch3: Classification of Imported & Export Goods"]}, {"t": "S", "c": ["Customs Ch4: Valuation under the Customs Act, 1962"]}, {"t": "S", "c": ["Customs Ch5: Importation, Exportation & Transportation of Goods"]}, {"t": "S", "c": ["Customs Ch7: Refund"]}, {"t": "S", "c": ["Customs Ch8: Foreign Trade Policy"]}, {"t": "T", "l": "Module 4 Test"}, {"t": "S", "c": ["Full Syllabus Revision"]}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 6 - Integrated Business Solutions (Open-Book)", "color": "#E8A020", "days": [{"t": "S", "c": ["Full Syllabus Revision - case-study & open-book index building"]}, {"t": "S", "c": ["Full Syllabus Revision - fact-mapping practice"]}, {"t": "S", "c": ["Full Syllabus Revision - MCQ drilling & integration practice"]}, {"t": "T", "l": "Full Mock Test 1 (4 hrs)"}, {"t": "S", "c": ["Feedback correction window + targeted revision"]}, {"t": "T", "l": "Full Mock Test 2 (4 hrs)"}]}]}}, "foundation": {"label": "CA Foundation", "groups": {"Foundation": [{"name": "Paper 1 - Accounting", "color": "#22C55E", "days": [{"t": "S", "c": ["Ch1: Theoretical Framework", "Unit 1: Meaning & Scope of Accounting", "Unit 2: Accounting Concepts, Principles & Conventions"]}, {"t": "S", "c": ["Unit 3: Capital & Revenue Expenditure/Receipts", "Unit 4: Contingent Assets & Liabilities", "Unit 5: Accounting Policies"]}, {"t": "S", "c": ["Unit 6: Measurement Discipline - Valuation Principles", "Unit 7: Accounting Standards"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch2: Accounting Process - Unit 1: Journal Entries", "Unit 2: Ledgers", "Unit 3: Trial Balance", "Unit 4: Subsidiary Books"]}, {"t": "S", "c": ["Unit 5: Cash Book", "Unit 6: Rectification of Errors", "Ch3: Bank Reconciliation Statement", "Ch4: Inventories", "Ch5: Depreciation & Amortisation"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch6: Bills of Exchange & Promissory Notes"]}, {"t": "S", "c": ["Ch7: Preparation of Final Accounts of Sole Proprietors"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch8: Financial Statements of Not-for-Profit Organisations", "Ch9: Accounts from Incomplete Records"]}, {"t": "S", "c": ["Ch10: Partnership & LLP Accounts", "Ch11: Company Accounts"]}, {"t": "T", "l": null}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 2 - Business Laws", "color": "#3B82F6", "days": [{"t": "S", "c": ["Ch2: The Indian Contract Act, 1872"]}, {"t": "S", "c": ["Ch2 (continued)"]}, {"t": "S", "c": ["Full Revision: Chapter 2"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch1: Indian Regulatory Framework"]}, {"t": "S", "c": ["Ch3: The Sale of Goods Act, 1930"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch4: The Indian Partnership Act, 1932"]}, {"t": "S", "c": ["Ch5: The Limited Liability Partnership Act, 2008"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch6: The Companies Act, 2013"]}, {"t": "S", "c": ["Ch7: The Negotiable Instruments Act, 1881"]}, {"t": "T", "l": null}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 3 - Quantitative Aptitude", "color": "#F97316", "days": [{"t": "S", "c": ["Ch1: Ratio & Proportion, Indices, Logarithms", "Ch2: Equations"]}, {"t": "S", "c": ["Ch3: Linear Inequalities", "Ch4: Mathematics of Finance"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch5: Permutations & Combinations", "Ch6: Sequence & Series - AP & GP"]}, {"t": "S", "c": ["Ch7: Sets, Relations, Functions & Limits/Continuity", "Ch8: Differential & Integral Calculus in Business"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch9: Number Series, Coding-Decoding & Odd Man Out", "Ch10: Direction Tests"]}, {"t": "S", "c": ["Ch11: Seating Arrangements", "Ch12: Blood Relations"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch13: Statistical Representation of Data & Sampling", "Ch14: Central Tendency & Dispersion", "Ch15: Probability"]}, {"t": "S", "c": ["Ch16: Theoretical Distributions", "Ch17: Correlation & Regression", "Ch18: Index Numbers"]}, {"t": "T", "l": null}, {"t": "T", "l": "Full Syllabus Test"}]}, {"name": "Paper 4 - Business Economics", "color": "#059669", "days": [{"t": "S", "c": ["Ch1: Nature & Scope of Business Economics"]}, {"t": "S", "c": ["Ch1 (continued)"]}, {"t": "S", "c": ["Ch2: Theory of Demand & Supply"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch3: Theory of Production & Cost", "Ch4: Price Determination in Different Markets"]}, {"t": "S", "c": ["Ch5: Business Cycles"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch6: Determination of National Income"]}, {"t": "S", "c": ["Ch7: Public Finance"]}, {"t": "T", "l": null}, {"t": "S", "c": ["Ch8: Money Market", "Ch9: International Trade"]}, {"t": "S", "c": ["Ch10: Indian Economy"]}, {"t": "T", "l": null}, {"t": "T", "l": "Full Syllabus Test"}]}]}}};

const DARK="#1A1A2E", GOLD="#E8A020", RED="#E11D48", GREEN="#22C55E";

function escapeHtml(s){
  return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
}

/* ---------- Planner rendering (static, full plan) ---------- */
function renderDayRow(n, kind, color, label, chapters, extraTag){
  const text = chapters && chapters.length ? " — " + chapters.map(escapeHtml).join("  |  ") : "";
  return `<div class="day-row">
    <div class="day-badge" style="background:${color};">Day ${n}</div>
    <div><span class="day-label" style="color:${color};">${escapeHtml(label)}</span>${extraTag||""}${text}</div>
  </div>`;
}

function renderPaper(paper, openFirst){
  let rows = "";
  let n = 0;
  let numTests = 0;
  paper.days.forEach(d=>{
    n++;
    if(d.t==="S"){
      rows += renderDayRow(n, "S", GOLD, "Study Day", d.c, "");
    } else {
      numTests++;
      const label = d.l || "Cycle Test";
      const color = (d.l && d.l.indexOf("Full")>=0) ? GREEN : RED;
      rows += renderDayRow(n, "T", color, label, null, "");
    }
  });
  return `<details class="paper" ${openFirst?"open":""}>
    <summary>${escapeHtml(paper.name)}<span class="meta">${n} days · ${numTests} tests</span></summary>
    <div class="paper-body">${rows}</div>
  </details>`;
}

function renderGroup(name, papers, openFirst){
  const totalDays = papers.reduce((a,p)=>a+p.days.length,0);
  let body = "";
  papers.forEach((p,i)=>{ body += renderPaper(p, i===0 && openFirst); });
  return `<details class="group" open>
    <summary>${escapeHtml(name)}<span class="meta">${totalDays} days across ${papers.length} paper${papers.length>1?"s":""}</span></summary>
    <div class="group-body">${body}</div>
  </details>`;
}

function renderExamPlanner(examKey){
  const exam = DATA[examKey];
  let html = "";
  let first = true;
  Object.keys(exam.groups).forEach(gname=>{
    html += renderGroup(gname, exam.groups[gname], first);
    first = false;
  });
  return html;
}

function showExam(examKey){
  document.querySelectorAll('.tab-btn').forEach(b=>b.classList.toggle('active', b.dataset.exam===examKey));
  document.getElementById('plannerHost').innerHTML = renderExamPlanner(examKey);
}

document.querySelectorAll('.tab-btn').forEach(btn=>{
  btn.addEventListener('click', ()=> showExam(btn.dataset.exam));
});
showExam('inter');

/* ---------- Calculator ---------- */
function allocateLargestRemainder(weights, total){
  const sum = weights.reduce((a,b)=>a+b,0);
  if(sum===0) return weights.map(()=>0);
  const raw = weights.map(w => (w/sum)*total);
  const floors = raw.map(Math.floor);
  let used = floors.reduce((a,b)=>a+b,0);
  let remainder = total - used;
  const order = raw.map((r,i)=>({i, frac:r-floors[i], w:weights[i]}))
    .filter(x=>x.w>0)
    .sort((a,b)=>b.frac-a.frac);
  for(let k=0;k<remainder && k<order.length;k++) floors[order[k].i]++;
  let leftover = total - floors.reduce((a,b)=>a+b,0);
  if(leftover>0){
    const maxIdx = weights.indexOf(Math.max(...weights));
    floors[maxIdx]+=leftover;
  }
  return floors;
}

function rescalePaper(days, targetDays){
  const segments = [];
  let current = [];
  days.forEach(d=>{
    if(d.t==="S") current.push(d.c);
    else { segments.push({studyGroups:current, testLabel:d.l||"Cycle Test"}); current=[]; }
  });
  if(current.length) segments.push({studyGroups:current, testLabel:null});

  const numTests = segments.filter(s=>s.testLabel).length;
  let clamped = false;
  let effectiveTarget = targetDays;
  if(effectiveTarget < numTests){ effectiveTarget = numTests; clamped = true; }

  const studyBudget = Math.max(0, effectiveTarget - numTests);
  const weights = segments.map(s=>s.studyGroups.length);
  const allocation = allocateLargestRemainder(weights, studyBudget);

  const outDays = [];
  segments.forEach((seg, idx)=>{
    const allotted = allocation[idx];
    const flat = seg.studyGroups.flat();
    if(allotted>0 && flat.length>0){
      const perDay = Math.ceil(flat.length/allotted);
      for(let d=0; d<allotted; d++){
        const chunk = flat.slice(d*perDay, (d+1)*perDay);
        if(chunk.length) outDays.push({t:"S", c:chunk});
      }
    } else if(flat.length>0 && allotted===0){
      outDays.push({t:"S", c:flat, compressed:true});
    }
    if(seg.testLabel){
      outDays.push({t:"T", l:seg.testLabel, covers:flat});
    }
  });
  return {outDays, clamped, minDays:numTests, originalDays: days.length};
}

const calcExamEl = document.getElementById('calcExam');
const calcGroupEl = document.getElementById('calcGroup');
const calcPaperEl = document.getElementById('calcPaper');
const calcDaysEl = document.getElementById('calcDays');

function populateExamSelect(){
  calcExamEl.innerHTML = Object.keys(DATA).map(k=>`<option value="${k}">${DATA[k].label}</option>`).join("");
}
function populateGroupSelect(){
  const exam = DATA[calcExamEl.value];
  calcGroupEl.innerHTML = Object.keys(exam.groups).map(g=>`<option value="${escapeHtml(g)}">${escapeHtml(g)}</option>`).join("");
}
function populatePaperSelect(){
  const exam = DATA[calcExamEl.value];
  const group = exam.groups[calcGroupEl.value] || exam.groups[Object.keys(exam.groups)[0]];
  calcPaperEl.innerHTML = group.map((p,i)=>`<option value="${i}">${escapeHtml(p.name)} (orig. ${p.days.length}d)</option>`).join("");
}

function runCalc(){
  const exam = DATA[calcExamEl.value];
  const group = exam.groups[calcGroupEl.value] || exam.groups[Object.keys(exam.groups)[0]];
  const paper = group[Number(calcPaperEl.value)] || group[0];
  const days = Math.max(1, Number(calcDaysEl.value) || 1);
  const result = rescalePaper(paper.days, days);

  const warnEl = document.getElementById('calcClampWarning');
  if(result.clamped){
    warnEl.innerHTML = `<div class="clamp-warning"><strong>⚠️ Too tight:</strong> ${escapeHtml(paper.name)} needs at least ${result.minDays} day${result.minDays>1?'s':''} just for its tests. Showing the ${result.minDays}-day minimum — chapters before each test are bundled together so nothing is skipped, but expect long single-sitting study blocks.</div>`;
  } else {
    warnEl.innerHTML = "";
  }

  document.getElementById('calcBanner').innerHTML = `Originally <strong>${result.originalDays} days</strong> for ${escapeHtml(paper.name.split('—')[0].split('-')[0].trim())} → rescaled to <strong style="color:${paper.color}">${result.outDays.length} days</strong> for ${days} available.`;

  let rows = "";
  result.outDays.forEach((d,i)=>{
    const n = i+1;
    if(d.t==="S"){
      const tag = d.compressed ? ` <span class="compressed-tag">(compressed)</span>` : "";
      rows += renderDayRow(n, "S", GOLD, "Study Day", d.c, tag);
    } else {
      const color = (d.l && d.l.indexOf("Full")>=0) ? GREEN : RED;
      const coverText = d.covers && d.covers.length ? " — covers: " + d.covers.map(escapeHtml).join("  |  ") : "";
      rows += `<div class="day-row"><div class="day-badge" style="background:${color};">Day ${n}</div><div><span class="day-label" style="color:${color};">${escapeHtml(d.l)}</span>${coverText}</div></div>`;
    }
  });

  document.getElementById('calcOutput').innerHTML = `<div class="paper" open style="border-color:${paper.color}33;">
    <div style="padding:12px 16px;background:linear-gradient(135deg, ${paper.color}22, ${paper.color}11);border-left:4px solid ${paper.color};font-weight:700;font-size:13.5px;">${escapeHtml(paper.name)}</div>
    <div class="paper-body">${rows}</div>
  </div>`;
}

calcExamEl.addEventListener('change', ()=>{ populateGroupSelect(); populatePaperSelect(); runCalc(); });
calcGroupEl.addEventListener('change', ()=>{ populatePaperSelect(); runCalc(); });
calcPaperEl.addEventListener('change', runCalc);
calcDaysEl.addEventListener('input', runCalc);

populateExamSelect();
calcExamEl.value = "inter";
populateGroupSelect();
populatePaperSelect();
runCalc();

/* ---------- Testimonials ---------- */
const TESTIMONIALS = [
  {text:"Cleared both groups in one attempt — 157 in Group 1, 158 in Group 2. Followed the planner exactly, including the branch accounts chapters she almost skipped.", name:"Simran Soni", tag:"CA Inter — Both Groups Cleared"},
  {text:"On her 6th attempt, finally scored under the top 10% nationally. Credited the test planner specifically for turning around her weakest paper, Taxation.", name:"Asiya Fatima", tag:"CA Inter — Under 10%"},
  {text:"After multiple earlier attempts, cleared on the 5th try and said the evaluation feedback was the difference — \"truly appreciate the time and effort invested.\"", name:"Tithi Patel", tag:"CA Final — Cleared"},
  {text:"Came back from an unsuccessful Group 1 attempt to clear both groups by January, calling it a comeback built entirely on following the test schedule.", name:"Kanishka Gupta", tag:"CA Inter — Comeback Pass"},
  {text:"Cleared CA Final Group 1 with 152 marks, then asked for the Group 2 planner the same week — straight back into the next cycle.", name:"Nivedita", tag:"CA Final — Group 1 Cleared"},
  {text:"First-attempt CA Final clear, on record asking that ICAI \"expect same answers for full marks\" after months of evaluated practice tests.", name:"Aayushi Biyani", tag:"CA Final — First Attempt"},
  {text:"261 marks in CA Foundation, with a note that the guidance throughout the journey made the biggest difference, not just the content.", name:"Shiv Narayan", tag:"CA Foundation — 261 Marks"},
  {text:"Cleared on the 3rd attempt after losing hope earlier — said the test series \"helped me identify my mistakes\" when nothing else had worked.", name:"Siddhi Soni", tag:"CA Foundation — 3rd Attempt"},
  {text:"After 4 failed attempts, cleared CA Foundation on the 5th — describing the mentor's guidance as the turning point: \"the day I met u... a day to remember lifetime.\"", name:"Sakshi Khandelwal", tag:"CA Foundation — 5th Attempt"},
  {text:"230 marks on a first CA Foundation attempt, with specific credit to the test planner for \"understanding my problem areas.\"", name:"Daksh Sharma", tag:"CA Foundation — First Attempt"},
];

function renderTestimonials(){
  document.getElementById('testiGrid').innerHTML = TESTIMONIALS.map(t => `
    <div class="testi-card">
      <span class="quote-mark">"</span>
      <div class="testi-text">${escapeHtml(t.text)}</div>
      <div class="testi-footer">
        <span>${escapeHtml(t.name)}</span>
        <span class="result-pill">${escapeHtml(t.tag)}</span>
      </div>
    </div>
  `).join("");
}
renderTestimonials();

function ctEmitHeight(){
  try {
    if(window.parent && window.parent !== window){
      var h = document.getElementById('ct-planner-app').scrollHeight;
      window.parent.postMessage({ctPlannerHeight:h}, "*");
    }
  } catch(e){}
}
window.addEventListener('load', ctEmitHeight);
document.addEventListener('click', function(){ setTimeout(ctEmitHeight, 120); });
['calcExam','calcGroup','calcPaper','calcDays'].forEach(function(id){
  var el = document.getElementById(id);
  if(el){ el.addEventListener('change', function(){ setTimeout(ctEmitHeight,60); }); el.addEventListener('input', function(){ setTimeout(ctEmitHeight,60); }); }
});

</script>
</div>

CTPLANNERHTML;