{"id":2487,"date":"2026-07-25T16:59:46","date_gmt":"2026-07-25T16:59:46","guid":{"rendered":"https:\/\/dr-nutrition.ca\/?page_id=2487"},"modified":"2026-07-25T17:12:44","modified_gmt":"2026-07-25T17:12:44","slug":"elementor-2487","status":"publish","type":"page","link":"https:\/\/dr-nutrition.ca\/?page_id=2487","title":{"rendered":"Elementor #2487"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"2487\" class=\"elementor elementor-2487\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9364761 e-flex e-con-boxed e-con e-parent\" data-id=\"9364761\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fe4bebf elementor-widget elementor-widget-html\" data-id=\"fe4bebf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t\r\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><style>\r\n    *{box-sizing:border-box;margin:0;padding:0}\r\n    body{\r\n      font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,sans-serif;\r\n      background:#f0f2f5;padding:15px;min-height:100vh;display:flex;align-items:flex-start;justify-content:center;\r\n    }\r\n    .milk-gmr-wrap{max-width:1400px;width:100%;margin:0 auto}\r\n    .milk-gmr-container{background:#fff;border-radius:20px;box-shadow:0 8px 20px rgba(0,0,0,.1);padding:25px}\r\n    @media (max-width:767px){\r\n      body{padding:8px}.milk-gmr-container{padding:15px}\r\n    }\r\n\r\n    .milk-gmr-header{text-align:center;margin-bottom:30px}\r\n    .milk-gmr-header h1{color:#1a2639;font-size:clamp(24px,5vw,32px);margin-bottom:10px;font-weight:700}\r\n    .milk-gmr-header p{color:#4a5568;font-size:clamp(14px,3vw,16px)}\r\n\r\n    .milk-gmr-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:20px}\r\n    .milk-gmr-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}\r\n    @media (max-width:768px){\r\n      .milk-gmr-grid,.milk-gmr-grid-3{grid-template-columns:1fr;gap:15px}\r\n    }\r\n\r\n    .milk-gmr-section{\r\n      background:#f8fafc;padding:25px;border-radius:16px;margin-bottom:25px;border:1px solid #e2e8f0;\r\n    }\r\n    .milk-gmr-section h3{\r\n      color:#2d3748;font-size:18px;font-weight:700;margin-bottom:20px;border-bottom:3px solid #4299e1;padding-bottom:10px;\r\n    }\r\n    .milk-gmr-subsection{\r\n      background:#fff;padding:20px;border-radius:12px;margin-top:15px;border:1px solid #e2e8f0;\r\n    }\r\n    .milk-gmr-subsection h4{color:#4a5568;font-size:16px;font-weight:600;margin-bottom:15px}\r\n\r\n    .milk-gmr-scenario{\r\n      background:#fff;padding:25px;border-radius:16px;border:2px solid #e2e8f0;height:100%;\r\n    }\r\n    .milk-gmr-scenario.sc1{border-color:#4299e1}\r\n    .milk-gmr-scenario.sc2{border-color:#48bb78}\r\n    .milk-gmr-scenario.sc3{border-color:#805ad5}\r\n    .milk-gmr-scenario h3{color:#1a202c;font-size:18px;font-weight:700;margin-bottom:20px}\r\n\r\n    .milk-gmr-group{margin-bottom:18px}\r\n    .milk-gmr-group label{display:block;margin-bottom:6px;font-weight:600;color:#2d3748;font-size:14px}\r\n    .milk-gmr-group input{\r\n      width:100%;padding:12px 15px;border:2px solid #cbd5e0;border-radius:10px;font-size:16px;\r\n      color:#1a202c;background:#fff;font-weight:500;transition:all .2s;\r\n    }\r\n    .milk-gmr-group input:focus{\r\n      outline:none;border-color:#4299e1;box-shadow:0 0 0 3px rgba(66,153,225,.2);\r\n    }\r\n    .input-hint{font-size:12px;color:#718096;margin-top:4px}\r\n\r\n    .button-group{\r\n      display:flex;flex-wrap:wrap;gap:15px;justify-content:center;margin:30px auto 20px;\r\n    }\r\n    .milk-gmr-btn{\r\n      background:#4299e1;color:#fff;border:none;padding:16px 40px;font-size:18px;font-weight:600;border-radius:12px;\r\n      cursor:pointer;transition:all .2s;box-shadow:0 4px 6px rgba(66,153,225,.3);\r\n      min-width:250px;max-width:100%;\r\n    }\r\n    .milk-gmr-btn.report{\r\n      background:#38a169;box-shadow:0 4px 6px rgba(56,161,105,.3);\r\n    }\r\n    .milk-gmr-btn.report:hover{background:#2f855a}\r\n    .milk-gmr-btn:hover{background:#3182ce;transform:translateY(-2px);box-shadow:0 6px 8px rgba(66,153,225,.4)}\r\n    @media (max-width:768px){\r\n      .milk-gmr-btn{padding:14px 30px;font-size:16px;min-width:200px}\r\n    }\r\n\r\n    .milk-gmr-results{\r\n      background:#fff;padding:25px;border-radius:16px;margin-top:30px;border:2px solid #e2e8f0;display:none;\r\n    }\r\n    .milk-gmr-results h2{\r\n      color:#1a2639;font-size:22px;margin-bottom:20px;border-bottom:3px solid #4299e1;padding-bottom:10px;\r\n    }\r\n\r\n    .summary-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:20px;margin-bottom:30px}\r\n    .summary-card{\r\n      background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;padding:25px;border-radius:16px;\r\n      box-shadow:0 10px 15px -3px rgba(0,0,0,.1);\r\n    }\r\n    .summary-card.positive{background:linear-gradient(135deg,#48bb78 0%,#2f855a 100%)}\r\n    .summary-card.negative{background:linear-gradient(135deg,#f56565 0%,#c53030 100%)}\r\n    .summary-card.purple{background:linear-gradient(135deg,#805ad5 0%,#44337a 100%)}\r\n    .summary-card .label{font-size:16px;opacity:.9;margin-bottom:10px}\r\n    .summary-card .value{font-size:32px;font-weight:700;margin-bottom:5px}\r\n    .summary-card .subtext{font-size:14px;opacity:.8}\r\n    @media (max-width:1024px){.summary-card .value{font-size:28px}}\r\n    @media (max-width:768px){.summary-cards{grid-template-columns:1fr}.summary-card{padding:20px}.summary-card .value{font-size:26px}}\r\n\r\n    .table-container{\r\n      overflow-x:auto;margin:20px 0 30px;border-radius:12px;border:1px solid #e2e8f0;-webkit-overflow-scrolling:touch;\r\n    }\r\n    table{width:100%;border-collapse:collapse;min-width:740px;font-size:15px}\r\n    th{background:#2d3748;color:#fff;padding:15px 12px;font-weight:600;font-size:14px;white-space:nowrap}\r\n    td{padding:12px;border-bottom:1px solid #e2e8f0;color:#1a202c}\r\n    tr:last-child td{border-bottom:none}\r\n    tr:hover{background:#f7fafc}\r\n\r\n    .positive{color:#2f855a!important;font-weight:700}\r\n    .negative{color:#c53030!important;font-weight:700}\r\n\r\n    .warning-box{\r\n      background:#fff5f5;border-left:4px solid #f56565;padding:15px;border-radius:8px;margin:20px 0;color:#742a2a;font-weight:500;\r\n    }\r\n    .info-box{\r\n      background:#ebf8ff;border-left:4px solid #4299e1;padding:15px;border-radius:8px;margin:20px 0;color:#2c5282;font-weight:500;\r\n    }\r\n    .purple-box{\r\n      background:#faf5ff;border-left:4px solid #805ad5;padding:15px;border-radius:8px;margin:20px 0;color:#44337a;font-weight:500;\r\n    }\r\n    \/* mini chart utilities for report page *\/\r\n    .report-chart{display:flex;align-items:center;gap:8px;margin-top:6px}\r\n    .bar{height:20px;background:#4299e1;border-radius:20px;color:#fff;font-size:12px;line-height:20px;padding-left:8px;white-space:nowrap}\r\n    .bar.positive{background:#48bb78}\r\n    .bar.negative{background:#f56565}\r\n    .report-layout{max-width:1200px;margin:0 auto; background:white; padding:35px}\r\n    .report-header{margin-bottom:35px;border-bottom:3px solid #4299e1}\r\n    .report-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:30px;margin:30px 0}\r\n    @media print{body{background:#fff} .milk-gmr-container{box-shadow:none} .milk-gmr-btn{display:none}}\r\n  <\/style><\/p>\r\n<div class=\"milk-gmr-wrap\">\r\n<div class=\"milk-gmr-container\">\r\n<div class=\"milk-gmr-header\">\r\n<h1>\ud83e\udd5b Milk Price GMR Calculator (June 1, 2026 Policy)<\/h1>\r\n<p>Tier 1 \u22642.20 \u2022 Tier 2 = 2.20\u20132.50 (market ratio fraction only) \u2022 Above 2.50 unpaid (Protein + OS)<\/p>\r\n<\/div>\r\n<!-- Common Parameters -->\r\n<div class=\"milk-gmr-section\">\r\n<h3>\ud83d\udcca Common Parameters<\/h3>\r\n<div class=\"milk-gmr-grid\">\r\n<div>\r\n<div class=\"milk-gmr-group\"><label>Fat Price ($\/kg)<\/label> <input id=\"fatPrice\" step=\"0.01\" type=\"number\" value=\"10.92\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Protein Price ($\/kg) (Tier 1)<\/label> <input id=\"proteinPrice\" step=\"0.01\" type=\"number\" value=\"14.72\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>OS Price ($\/kg) (Tier 1)<\/label> <input id=\"osPrice\" step=\"0.01\" type=\"number\" value=\"0.90\" \/><\/div>\r\n<\/div>\r\n<div>\r\n<div class=\"milk-gmr-group\"><label>Market Ratio OS Price ($\/kg) (Tier 2 band)<\/label> <input id=\"ratioOSPrice\" step=\"0.01\" type=\"number\" value=\"0.90\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Market Ratio Protein Price ($\/kg) (Tier 2 band)<\/label> <input id=\"ratioProteinPrice\" step=\"0.01\" type=\"number\" value=\"6.04\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Quota (kg fat \/ day)<\/label> <input id=\"quota\" step=\"0.01\" type=\"number\" value=\"100\" \/>\r\n<div class=\"input-hint\">Scenario 1\u20132 calculate cows needed to hit quota (fat capped). Scenario 3 uses actual cows.<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<div class=\"milk-gmr-subsection\">\r\n<h4>\ud83d\udcb0 Deductions &amp; Variable Costs<\/h4>\r\n<div class=\"milk-gmr-grid-3\">\r\n<div class=\"milk-gmr-group\"><label>Other Deductions ($\/hL)<\/label> <input id=\"otherDeductions\" step=\"0.01\" type=\"number\" value=\"1.50\" \/>\r\n<div class=\"input-hint\">Per hectoliter of paid milk<\/div>\r\n<\/div>\r\n<div class=\"milk-gmr-group\"><label>Variable Cost per Cow ($\/day)<\/label> <input id=\"variableCowCost\" step=\"0.01\" type=\"number\" value=\"3.36\" \/>\r\n<div class=\"input-hint\">Applied to cows used in each scenario<\/div>\r\n<\/div>\r\n<div class=\"milk-gmr-group\"><label>Include Feed Cost in Net?<\/label> <input id=\"includeFeed\" step=\"1\" type=\"number\" value=\"1\" \/>\r\n<div class=\"input-hint\">1 = include feed cost, 0 = ignore feed cost<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<!-- Scenarios 1 & 2 -->\r\n<div class=\"milk-gmr-grid\">\r\n<div class=\"milk-gmr-scenario sc1\">\r\n<h3>\ud83d\udcc8 Scenario 1: Baseline (Quota-based cows)<\/h3>\r\n<div class=\"milk-gmr-group\"><label>Milk (L\/cow\/day)<\/label><input id=\"milk1\" step=\"0.01\" type=\"number\" value=\"35\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Fat %<\/label><input id=\"fat1\" step=\"0.01\" type=\"number\" value=\"4.50\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Protein %<\/label><input id=\"protein1\" step=\"0.01\" type=\"number\" value=\"3.20\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>OS %<\/label><input id=\"os1\" step=\"0.01\" type=\"number\" value=\"5.90\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Feed Cost ($\/cow\/day)<\/label><input id=\"feed1\" step=\"0.01\" type=\"number\" value=\"12.50\" \/><\/div>\r\n<\/div>\r\n<div class=\"milk-gmr-scenario sc2\">\r\n<h3>\ud83d\udcc8 Scenario 2: Improved (Quota-based cows)<\/h3>\r\n<div class=\"milk-gmr-group\"><label>Milk (L\/cow\/day)<\/label><input id=\"milk2\" step=\"0.01\" type=\"number\" value=\"36\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Fat %<\/label><input id=\"fat2\" step=\"0.01\" type=\"number\" value=\"4.20\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Protein %<\/label><input id=\"protein2\" step=\"0.01\" type=\"number\" value=\"3.50\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>OS %<\/label><input id=\"os2\" step=\"0.01\" type=\"number\" value=\"5.90\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Feed Cost ($\/cow\/day)<\/label><input id=\"feed2\" step=\"0.01\" type=\"number\" value=\"13.75\" \/><\/div>\r\n<\/div>\r\n<\/div>\r\n<!-- Scenario 3 -->\r\n<div class=\"milk-gmr-section\" style=\"margin-top: 20px;\">\r\n<h3>\ud83d\udfe3 Scenario 3: Actual Herd (Client's current situation)<\/h3>\r\n<div class=\"milk-gmr-grid\">\r\n<div class=\"milk-gmr-scenario sc3\">\r\n<h3>\ud83d\udc04 Scenario 3 Inputs<\/h3>\r\n<div class=\"milk-gmr-group\"><label>Actual Cows in Milk (#)<\/label> <input id=\"cows3\" step=\"1\" type=\"number\" value=\"64\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Milk (L\/cow\/day)<\/label><input id=\"milk3\" step=\"0.01\" type=\"number\" value=\"35\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Fat %<\/label><input id=\"fat3\" step=\"0.01\" type=\"number\" value=\"4.40\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Protein %<\/label><input id=\"protein3\" step=\"0.01\" type=\"number\" value=\"3.20\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>OS %<\/label><input id=\"os3\" step=\"0.01\" type=\"number\" value=\"5.90\" \/><\/div>\r\n<div class=\"milk-gmr-group\"><label>Feed Cost ($\/cow\/day)<\/label><input id=\"feed3\" step=\"0.01\" type=\"number\" value=\"12.50\" \/><\/div>\r\n<\/div>\r\n<div class=\"milk-gmr-subsection\" style=\"height: 100%; background: #f0f5fa;\">\r\n<h4>\ud83d\udccc Scenario 3 Note<\/h4>\r\n<div style=\"font-size: 14px; line-height: 1.6;\">\r\n<p>This scenario uses your <strong>actual herd size<\/strong>. The calculator automatically:<\/p>\r\n<ul style=\"margin-top: 8px; padding-left: 20px;\">\r\n<li>Calculates fat produced vs. quota<\/li>\r\n<li>Applies quota capping if needed<\/li>\r\n<li>Shows the financial impact of your current herd<\/li>\r\n<\/ul>\r\n<p style=\"margin-top: 12px;\"><strong>Compare with Scenarios 1 &amp; 2<\/strong> to see the potential benefit of optimizing milk components or herd size.<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<!-- TWO BUTTONS: compare + report -->\r\n<div class=\"button-group\"><button class=\"milk-gmr-btn\">\ud83d\udd0d Compare Scenarios<\/button> <button class=\"milk-gmr-btn report\">\ud83d\udcc4\u2728 Generate Client Report (new window)<\/button><\/div>\r\n<!-- Results -->\r\n<div id=\"results\" class=\"milk-gmr-results\">\r\n<h2>\ud83d\udccb Results Summary<\/h2>\r\n<div id=\"summaryCards\" class=\"summary-cards\"> <\/div>\r\n<div id=\"quotaInfo\" class=\"info-box\" style=\"display: none;\"> <\/div>\r\n<div id=\"warningBox\" class=\"warning-box\" style=\"display: none;\"> <\/div>\r\n<div id=\"scenario3Box\" class=\"purple-box\" style=\"display: none;\"> <\/div>\r\n<h2>\ud83d\udcca Detailed Comparison (Scenario 1 vs 2)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Metric<\/th>\r\n<th>Scenario 1<\/th>\r\n<th>Scenario 2<\/th>\r\n<th>Difference<\/th>\r\n<th>% Change<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"comparisonBody\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h2>\ud83d\udcb0 Cost Analysis (Annual) (Scenario 1 vs 2)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Cost Component<\/th>\r\n<th>Scenario 1<\/th>\r\n<th>Scenario 2<\/th>\r\n<th>Difference<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"costBody\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h2>\ud83d\udc04 Revenue Breakdown ($\/cow\/day) (Scenario 1 vs 2)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Revenue Component<\/th>\r\n<th>Scenario 1<\/th>\r\n<th>Scenario 2<\/th>\r\n<th>Difference<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"cowRevBody\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h2>\ud83d\udfe3 Scenario 3 Results (Actual Herd)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Metric<\/th>\r\n<th>Scenario 3<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"s3Body\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h2>\ud83d\udfe3 Scenario 3 Revenue Breakdown ($\/cow\/day)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Revenue Component<\/th>\r\n<th>Scenario 3<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"s3CowBody\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h2>\ud83d\udfe3 Quota Gap Analysis (Scenario 3)<\/h2>\r\n<div class=\"table-container\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<th>Metric<\/th>\r\n<th>Value<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody id=\"s3GapBody\"><\/tbody>\r\n<\/table>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<p><script>\r\n    function getValue(id) {\r\n      const el = document.getElementById(id);\r\n      if (!el) return 0;\r\n      const val = parseFloat(el.value);\r\n      return isNaN(val) ? 0 : val;\r\n    }\r\n\r\n    function formatMoney(num) {\r\n      if (isNaN(num)) return '$0.00';\r\n      return '$' + num.toFixed(2).replace(\/\\B(?=(\\d{3})+(?!\\d))\/g, ',');\r\n    }\r\n\r\n    \/\/ NEW POLICY (Effective June 1, 2026):\r\n    \/\/ Tier1 (base) applies up to SNF ratio 2.20\r\n    \/\/ Tier2 (market ratio) applies only to the fraction between 2.20 and 2.50\r\n    \/\/ Above 2.50 is unpaid for Protein + OS (no-pay ratio raised from 2.30 to 2.50)\r\n    function calcFractions(snfRatio) {\r\n      const baseCap = 2.20;\r\n      const marketCap = 2.50;\r\n      const safe = (snfRatio > 0 ? snfRatio : 1);\r\n\r\n      const baseFraction = Math.min(snfRatio, baseCap) \/ safe;\r\n      const marketFraction = Math.max(0, Math.min(snfRatio, marketCap) - baseCap) \/ safe;\r\n      const unpaidFraction = Math.max(0, snfRatio - marketCap) \/ safe;\r\n\r\n      return { baseFraction, marketFraction, unpaidFraction };\r\n    }\r\n\r\n    \/\/ Scenario 1\u20132: quota-based cows (auto)\r\n    \/\/ Scenario 3: actual herd size (no purchase calculations)\r\n    function calculateScenario(inputs, common, opts = {}) {\r\n      const { milk, fatPct, protPct, osPct, feedCost } = inputs;\r\n\r\n      \/\/ per-cow kg\/day\r\n      const kgFat  = (milk * fatPct)  \/ 100;\r\n      const kgProt = (milk * protPct) \/ 100;\r\n      const kgOS   = (milk * osPct)   \/ 100;\r\n\r\n      \/\/ cows used\r\n      const cowsNeededToFillQuota = Math.ceil(common.quota \/ Math.max(kgFat, 0.000001));\r\n      const cowsUsed = (opts.useActualCows ? Math.max(0, Math.floor(opts.actualCows || 0)) : cowsNeededToFillQuota);\r\n\r\n      \/\/ produced totals by cowsUsed\r\n      const fatProduced  = kgFat  * cowsUsed;\r\n      const milkProduced = milk   * cowsUsed;\r\n      const protProduced = kgProt * cowsUsed;\r\n      const osProduced   = kgOS   * cowsUsed;\r\n\r\n      \/\/ paid fat is capped by quota:\r\n      \/\/ if produced fat < quota -> no scaling (quota not reached)\r\n      \/\/ if produced fat > quota -> scale down paid milk\/prot\/OS to quota proportionally\r\n      const quotaScale = (fatProduced > 0 ? Math.min(1, common.quota \/ fatProduced) : 0);\r\n\r\n      const paidFat    = fatProduced  * quotaScale;\r\n      const paidMilk   = milkProduced * quotaScale; \/\/ L\/day\r\n      const paidProtKg = protProduced * quotaScale;\r\n      const paidOSKg   = osProduced   * quotaScale;\r\n      const paidHL     = paidMilk \/ 100;\r\n\r\n      const snfRatio = (fatPct > 0 ? (protPct + osPct) \/ fatPct : 0);\r\n      const { baseFraction, marketFraction, unpaidFraction } = calcFractions(snfRatio);\r\n\r\n      \/\/ daily paid revenue (by component)\r\n      const fatRevD   = paidFat * common.fatPrice;\r\n\r\n      const protBaseD = (paidProtKg * baseFraction)   * common.proteinPrice;\r\n      const osBaseD   = (paidOSKg   * baseFraction)   * common.osPrice;\r\n\r\n      const protMktD  = (paidProtKg * marketFraction) * common.ratioProteinPrice;\r\n      const osMktD    = (paidOSKg   * marketFraction) * common.ratioOSPrice;\r\n\r\n      const totalRevD = fatRevD + protBaseD + osBaseD + protMktD + osMktD;\r\n      const totalRevA = totalRevD * 365;\r\n\r\n      \/\/ annual costs\r\n      const deductionsA = paidHL * common.otherDeductions * 365;\r\n      const feedA = feedCost * cowsUsed * 365;\r\n      const varCowA = common.variableCowCost * cowsUsed * 365;\r\n\r\n      const netA =\r\n        totalRevA\r\n        - deductionsA\r\n        - (common.includeFeed ? feedA : 0)\r\n        - varCowA;\r\n\r\n      const revenuePerCowDaily = (cowsUsed > 0 ? totalRevD \/ cowsUsed : 0);\r\n\r\n      \/\/ Quota gap info (for Scenario 3)\r\n      const cowsShort = Math.max(0, cowsNeededToFillQuota - cowsUsed);\r\n      const fatShort = Math.max(0, common.quota - fatProduced);\r\n      const milkShort = cowsShort * milk; \/\/ potential extra milk if cows added\r\n\r\n      return {\r\n        kgFat, kgProt, kgOS,\r\n        cowsUsed,\r\n        cowsNeededToFillQuota,\r\n        cowsShort,\r\n        fatShort,\r\n        milkShort,\r\n\r\n        fatProduced, milkProduced, protProduced, osProduced,\r\n        quotaScale,\r\n        paidFat, paidMilk, paidProtKg, paidOSKg, paidHL,\r\n\r\n        snfRatio, baseFraction, marketFraction, unpaidFraction,\r\n\r\n        fatRevD,\r\n        protBaseD, osBaseD,\r\n        protMktD, osMktD,\r\n        totalRevD, totalRevA,\r\n\r\n        deductionsA, feedA, varCowA,\r\n        netA,\r\n        revenuePerCowDaily\r\n      };\r\n    }\r\n\r\n    \/\/ global variables to store last computed scenarios (for report)\r\n    let LAST = { S1: null, S2: null, S3: null, common: null, s1Inputs: null, s2Inputs: null, s3Inputs: null, netDiff12: 0 };\r\n\r\n    function calculate() {\r\n      const common = {\r\n        fatPrice: getValue('fatPrice'),\r\n        proteinPrice: getValue('proteinPrice'),\r\n        osPrice: getValue('osPrice'),\r\n        ratioOSPrice: getValue('ratioOSPrice'),\r\n        ratioProteinPrice: getValue('ratioProteinPrice'),\r\n        quota: getValue('quota'),\r\n        otherDeductions: getValue('otherDeductions'),\r\n        variableCowCost: getValue('variableCowCost'),\r\n        includeFeed: getValue('includeFeed') === 1\r\n      };\r\n\r\n      const s1Inputs = { milk:getValue('milk1'), fatPct:getValue('fat1'), protPct:getValue('protein1'), osPct:getValue('os1'), feedCost:getValue('feed1') };\r\n      const s2Inputs = { milk:getValue('milk2'), fatPct:getValue('fat2'), protPct:getValue('protein2'), osPct:getValue('os2'), feedCost:getValue('feed2') };\r\n      const s3Inputs = { milk:getValue('milk3'), fatPct:getValue('fat3'), protPct:getValue('protein3'), osPct:getValue('os3'), feedCost:getValue('feed3') };\r\n      const cows3 = getValue('cows3');\r\n\r\n      if (common.quota <= 0 || s1Inputs.milk<=0 || s1Inputs.fatPct<=0 || s2Inputs.milk<=0 || s2Inputs.fatPct<=0 || s3Inputs.milk<=0 || s3Inputs.fatPct<=0) {\r\n        alert('Please enter valid values > 0 (quota, milk, fat%).');\r\n        return;\r\n      }\r\n\r\n      \/\/ S1\/S2 (auto cows to quota)\r\n      const S1 = calculateScenario(s1Inputs, common, { useActualCows: false });\r\n      const S2 = calculateScenario(s2Inputs, common, { useActualCows: false });\r\n\r\n      \/\/ S3 actual herd\r\n      const S3 = calculateScenario(s3Inputs, common, { useActualCows: true, actualCows: cows3 });\r\n\r\n      const netDiff12 = S2.netA - S1.netA;\r\n\r\n      \/\/ store in LAST\r\n      LAST = { S1, S2, S3, common, s1Inputs, s2Inputs, s3Inputs, netDiff12, cows3 };\r\n\r\n      \/\/ Summary cards\r\n      let cardsHtml = '';\r\n\r\n      const cls12 = netDiff12 >= 0 ? 'positive' : 'negative';\r\n      cardsHtml += '<div class=\"summary-card '+cls12+'\">' +\r\n        '<div class=\"label\">Scenario 2 vs 1 Net (Annual)<\/div>' +\r\n        '<div class=\"value\">'+(netDiff12>0?'+':'')+formatMoney(netDiff12)+'<\/div>' +\r\n        '<div class=\"subtext\">After deductions + variable cow cost'+(common.includeFeed?' + feed':'')+'<\/div>' +\r\n      '<\/div>';\r\n\r\n      cardsHtml += '<div class=\"summary-card\">' +\r\n        '<div class=\"label\">S1 \u2192 S2 Paid Revenue ($\/cow\/day)<\/div>' +\r\n        '<div class=\"value\">'+formatMoney(S1.revenuePerCowDaily)+' \u2192 '+formatMoney(S2.revenuePerCowDaily)+'<\/div>' +\r\n        '<div class=\"subtext\">Paid revenue \/ cows used<\/div>' +\r\n      '<\/div>';\r\n\r\n      cardsHtml += '<div class=\"summary-card purple\">' +\r\n        '<div class=\"label\">Scenario 3 Net (Annual) - Actual Herd<\/div>' +\r\n        '<div class=\"value\">'+formatMoney(S3.netA)+'<\/div>' +\r\n        '<div class=\"subtext\">Uses actual cows ('+S3.cowsUsed+')<\/div>' +\r\n      '<\/div>';\r\n\r\n      cardsHtml += '<div class=\"summary-card purple\">' +\r\n        '<div class=\"label\">Quota Achievement (S3)<\/div>' +\r\n        '<div class=\"value\">'+(S3.paidFat \/ common.quota * 100).toFixed(1)+'%<\/div>' +\r\n        '<div class=\"subtext\">Paid fat \/ quota ('+S3.paidFat.toFixed(1)+' \/ '+common.quota+' kg)<\/div>' +\r\n      '<\/div>';\r\n\r\n      document.getElementById('summaryCards').innerHTML = cardsHtml;\r\n\r\n      \/\/ Quota info for S1\/S2\r\n      let quotaHtml = '<strong>\ud83d\udcca Quota Analysis (Scenario 1\u20132 auto-cows):<\/strong><br>';\r\n      quotaHtml += 'Quota target: ' + common.quota + ' kg fat\/day<br><br>';\r\n      quotaHtml += 'Scenario 1 cows: <strong>' + S1.cowsUsed + '<\/strong> | Paid fat: ' + S1.paidFat.toFixed(2) + ' | Scale: ' + S1.quotaScale.toFixed(4) + '<br>';\r\n      quotaHtml += 'Scenario 2 cows: <strong>' + S2.cowsUsed + '<\/strong> | Paid fat: ' + S2.paidFat.toFixed(2) + ' | Scale: ' + S2.quotaScale.toFixed(4) + '<br>';\r\n      quotaHtml += '<br>Note: Paid fat is capped so it will never exceed quota.';\r\n      document.getElementById('quotaInfo').style.display = 'block';\r\n      document.getElementById('quotaInfo').innerHTML = quotaHtml;\r\n\r\n      \/\/ Warnings (no-pay threshold now 2.50)\r\n      const warns = [];\r\n      if (S1.snfRatio > 2.50) warns.push('Scenario 1 SNF ratio '+S1.snfRatio.toFixed(3)+' > 2.50');\r\n      if (S2.snfRatio > 2.50) warns.push('Scenario 2 SNF ratio '+S2.snfRatio.toFixed(3)+' > 2.50');\r\n      if (S3.snfRatio > 2.50) warns.push('Scenario 3 SNF ratio '+S3.snfRatio.toFixed(3)+' > 2.50');\r\n\r\n      if (warns.length) {\r\n        document.getElementById('warningBox').style.display = 'block';\r\n        document.getElementById('warningBox').innerHTML =\r\n          '\u26a0\ufe0f <strong>Warning:<\/strong> ' + warns.join(' | ') + ' \u2014 some Protein\/OS may be unpaid above 2.50.';\r\n      } else {\r\n        document.getElementById('warningBox').style.display = 'none';\r\n      }\r\n\r\n      \/\/ Scenario 3 purple box summary\r\n      let s3Box = '<strong>\ud83d\udfe3 Scenario 3 Actual Herd Summary:<\/strong><br>';\r\n      s3Box += 'Actual cows: <strong>'+S3.cowsUsed+'<\/strong> | Fat produced: '+S3.fatProduced.toFixed(2)+' kg\/day | Paid fat: '+S3.paidFat.toFixed(2)+'<br>';\r\n      s3Box += 'Quota: '+common.quota+' kg\/day | Quota utilization: '+(S3.paidFat \/ common.quota * 100).toFixed(1)+'%<br>';\r\n      s3Box += 'Cows needed to fill quota: <strong>'+S3.cowsNeededToFillQuota+'<\/strong> | Current shortage: <strong>'+S3.cowsShort+' cows<\/strong><br>';\r\n      s3Box += 'Potential extra milk if quota filled: '+(S3.milkShort).toFixed(0)+' L\/day';\r\n      document.getElementById('scenario3Box').style.display = 'block';\r\n      document.getElementById('scenario3Box').innerHTML = s3Box;\r\n\r\n      \/\/ Comparison table S1 vs S2\r\n      const metrics = [\r\n        { name: 'SNF Ratio', v1: S1.snfRatio, v2: S2.snfRatio, f: v => v.toFixed(4) },\r\n        { name: 'Cows Used', v1: S1.cowsUsed, v2: S2.cowsUsed, f: v => v },\r\n        { name: 'Milk per Cow (L\/day)', v1: s1Inputs.milk, v2: s2Inputs.milk, f: v => v.toFixed(2) },\r\n        { name: 'Fat %', v1: s1Inputs.fatPct, v2: s2Inputs.fatPct, f: v => v.toFixed(2) },\r\n        { name: 'Protein %', v1: s1Inputs.protPct, v2: s2Inputs.protPct, f: v => v.toFixed(2) },\r\n        { name: 'OS %', v1: s1Inputs.osPct, v2: s2Inputs.osPct, f: v => v.toFixed(2) },\r\n        { name: 'Paid Milk (L\/day)', v1: S1.paidMilk, v2: S2.paidMilk, f: v => Math.round(v) },\r\n        { name: 'Paid Fat (kg\/day)', v1: S1.paidFat, v2: S2.paidFat, f: v => v.toFixed(2) },\r\n        { name: 'Tier1 Fraction (\u22642.20)', v1: S1.baseFraction, v2: S2.baseFraction, f: v => (v*100).toFixed(2)+'%' },\r\n        { name: 'Tier2 Fraction (2.20\u20132.50)', v1: S1.marketFraction, v2: S2.marketFraction, f: v => (v*100).toFixed(2)+'%' }\r\n      ];\r\n\r\n      let comparisonHtml = '';\r\n      for (const m of metrics) {\r\n        const diff = m.v2 - m.v1;\r\n        const pct = (m.v1 !== 0 && typeof m.v1 === 'number') ? ((diff \/ m.v1) * 100).toFixed(1) + '%' : 'N\/A';\r\n        const cls = diff > 0 ? 'positive' : (diff < 0 ? 'negative' : '');\r\n        comparisonHtml += '<tr>' +\r\n          '<td><strong>' + m.name + '<\/strong><\/td>' +\r\n          '<td>' + m.f(m.v1) + '<\/td>' +\r\n          '<td>' + m.f(m.v2) + '<\/td>' +\r\n          '<td class=\"' + cls + '\">' + (diff > 0 ? '+' : '') + (typeof diff === 'number' ? diff.toFixed(4) : '\u2014') + '<\/td>' +\r\n          '<td class=\"' + cls + '\">' + (diff > 0 ? '+' : '') + pct + '<\/td>' +\r\n        '<\/tr>';\r\n      }\r\n      document.getElementById('comparisonBody').innerHTML = comparisonHtml;\r\n\r\n      \/\/ Cost table S1 vs S2 (annual)\r\n      const costHtml =\r\n        '<tr>' +\r\n          '<td><strong>Revenue (Annual)<\/strong><\/td>' +\r\n          '<td>' + formatMoney(S1.totalRevA) + '<\/td>' +\r\n          '<td>' + formatMoney(S2.totalRevA) + '<\/td>' +\r\n          '<td class=\"' + (S2.totalRevA > S1.totalRevA ? 'positive' : 'negative') + '\">' +\r\n            (S2.totalRevA > S1.totalRevA ? '+' : '') + formatMoney(S2.totalRevA - S1.totalRevA) +\r\n          '<\/td>' +\r\n        '<\/tr>' +\r\n        '<tr>' +\r\n          '<td><strong>Other Deductions (Annual)<\/strong><\/td>' +\r\n          '<td>' + formatMoney(S1.deductionsA) + '<\/td>' +\r\n          '<td>' + formatMoney(S2.deductionsA) + '<\/td>' +\r\n          '<td class=\"' + (S2.deductionsA < S1.deductionsA ? 'positive' : 'negative') + '\">' +\r\n            formatMoney(S2.deductionsA - S1.deductionsA) +\r\n          '<\/td>' +\r\n        '<\/tr>' +\r\n        (common.includeFeed\r\n          ? ('<tr>' +\r\n              '<td><strong>Feed Cost (Annual)<\/strong><\/td>' +\r\n              '<td>' + formatMoney(S1.feedA) + '<\/td>' +\r\n              '<td>' + formatMoney(S2.feedA) + '<\/td>' +\r\n              '<td class=\"' + (S2.feedA < S1.feedA ? 'positive' : 'negative') + '\">' +\r\n                formatMoney(S2.feedA - S1.feedA) +\r\n              '<\/td>' +\r\n            '<\/tr>')\r\n          : '') +\r\n        '<tr>' +\r\n          '<td><strong>Variable Cow Cost (Annual)<\/strong><\/td>' +\r\n          '<td>' + formatMoney(S1.varCowA) + '<\/td>' +\r\n          '<td>' + formatMoney(S2.varCowA) + '<\/td>' +\r\n          '<td class=\"' + (S2.varCowA < S1.varCowA ? 'positive' : 'negative') + '\">' +\r\n            formatMoney(S2.varCowA - S1.varCowA) +\r\n          '<\/td>' +\r\n        '<\/tr>' +\r\n        '<tr style=\"background:#e6fffa;font-weight:700;\">' +\r\n          '<td><strong>NET (Annual)<\/strong><\/td>' +\r\n          '<td><strong>' + formatMoney(S1.netA) + '<\/strong><\/td>' +\r\n          '<td><strong>' + formatMoney(S2.netA) + '<\/strong><\/td>' +\r\n          '<td class=\"' + (netDiff12 > 0 ? 'positive' : 'negative') + '\"><strong>' +\r\n            (netDiff12 > 0 ? '+' : '') + formatMoney(netDiff12) +\r\n          '<\/strong><\/td>' +\r\n        '<\/tr>';\r\n      document.getElementById('costBody').innerHTML = costHtml;\r\n\r\n      \/\/ $\/cow\/day breakdown S1 vs S2\r\n      const cowRows = [\r\n        { label: 'Fat ($\/cow\/day)',                   v1: (S1.cowsUsed>0?S1.fatRevD\/S1.cowsUsed:0),      v2: (S2.cowsUsed>0?S2.fatRevD\/S2.cowsUsed:0) },\r\n        { label: 'Protein Tier1 ($\/cow\/day)',         v1: (S1.cowsUsed>0?S1.protBaseD\/S1.cowsUsed:0),   v2: (S2.cowsUsed>0?S2.protBaseD\/S2.cowsUsed:0) },\r\n        { label: 'OS Tier1 ($\/cow\/day)',              v1: (S1.cowsUsed>0?S1.osBaseD\/S1.cowsUsed:0),     v2: (S2.cowsUsed>0?S2.osBaseD\/S2.cowsUsed:0) },\r\n        { label: 'Protein Tier2 (Market) ($\/cow\/day)',v1: (S1.cowsUsed>0?S1.protMktD\/S1.cowsUsed:0),    v2: (S2.cowsUsed>0?S2.protMktD\/S2.cowsUsed:0) },\r\n        { label: 'OS Tier2 (Market) ($\/cow\/day)',     v1: (S1.cowsUsed>0?S1.osMktD\/S1.cowsUsed:0),      v2: (S2.cowsUsed>0?S2.osMktD\/S2.cowsUsed:0) },\r\n        { label: 'TOTAL Paid Revenue ($\/cow\/day)',    v1: (S1.cowsUsed>0?S1.totalRevD\/S1.cowsUsed:0),   v2: (S2.cowsUsed>0?S2.totalRevD\/S2.cowsUsed:0) }\r\n      ];\r\n\r\n      let cowHtml = '';\r\n      for (const r of cowRows) {\r\n        const diff = r.v2 - r.v1;\r\n        const cls = diff > 0 ? 'positive' : (diff < 0 ? 'negative' : '');\r\n        cowHtml +=\r\n          '<tr>' +\r\n            '<td><strong>' + r.label + '<\/strong><\/td>' +\r\n            '<td>' + formatMoney(r.v1) + '<\/td>' +\r\n            '<td>' + formatMoney(r.v2) + '<\/td>' +\r\n            '<td class=\"' + cls + '\">' + (diff > 0 ? '+' : '') + formatMoney(diff) + '<\/td>' +\r\n          '<\/tr>';\r\n      }\r\n      document.getElementById('cowRevBody').innerHTML = cowHtml;\r\n\r\n      \/\/ Scenario 3 rows\r\n      const s3Rows = [\r\n        ['Actual Cows Used', S3.cowsUsed],\r\n        ['SNF Ratio', S3.snfRatio.toFixed(4)],\r\n        ['Fat %', s3Inputs.fatPct.toFixed(2)],\r\n        ['Protein %', s3Inputs.protPct.toFixed(2)],\r\n        ['OS %', s3Inputs.osPct.toFixed(2)],\r\n        ['Produced Fat (kg\/day)', S3.fatProduced.toFixed(2)],\r\n        ['Paid Fat (kg\/day) (capped)', S3.paidFat.toFixed(2)],\r\n        ['Paid Milk (L\/day)', Math.round(S3.paidMilk)],\r\n        ['Quota Scale Applied', S3.quotaScale.toFixed(4)],\r\n        ['Paid Revenue (Daily)', formatMoney(S3.totalRevD)],\r\n        ['Paid Revenue (Annual)', formatMoney(S3.totalRevA)],\r\n        ['Deductions (Annual)', formatMoney(S3.deductionsA)],\r\n        ['Feed (Annual)' + (common.includeFeed?' (included in net)':' (not in net)'), formatMoney(S3.feedA)],\r\n        ['Variable Cow Cost (Annual)', formatMoney(S3.varCowA)],\r\n        ['Net (Annual)', formatMoney(S3.netA)]\r\n      ];\r\n\r\n      let s3Html = '';\r\n      for (const [k,v] of s3Rows) s3Html += '<tr><td><strong>'+k+'<\/strong><\/td><td>'+v+'<\/td><\/tr>';\r\n      document.getElementById('s3Body').innerHTML = s3Html;\r\n\r\n      \/\/ Scenario 3 $\/cow\/day breakdown\r\n      const s3Cow = [\r\n        ['Fat ($\/cow\/day)', (S3.cowsUsed>0?S3.fatRevD\/S3.cowsUsed:0)],\r\n        ['Protein Tier1 ($\/cow\/day)', (S3.cowsUsed>0?S3.protBaseD\/S3.cowsUsed:0)],\r\n        ['OS Tier1 ($\/cow\/day)', (S3.cowsUsed>0?S3.osBaseD\/S3.cowsUsed:0)],\r\n        ['Protein Tier2 (Market) ($\/cow\/day)', (S3.cowsUsed>0?S3.protMktD\/S3.cowsUsed:0)],\r\n        ['OS Tier2 (Market) ($\/cow\/day)', (S3.cowsUsed>0?S3.osMktD\/S3.cowsUsed:0)],\r\n        ['TOTAL Paid Revenue ($\/cow\/day)', (S3.cowsUsed>0?S3.totalRevD\/S3.cowsUsed:0)]\r\n      ];\r\n      let s3CowHtml = '';\r\n      for (const [k,val] of s3Cow) s3CowHtml += '<tr><td><strong>'+k+'<\/strong><\/td><td>'+formatMoney(val)+'<\/td><\/tr>';\r\n      document.getElementById('s3CowBody').innerHTML = s3CowHtml;\r\n\r\n      \/\/ Quota Gap Analysis for Scenario 3\r\n      const s3GapRows = [\r\n        ['Quota (kg fat\/day)', common.quota.toFixed(2)],\r\n        ['Fat produced (kg\/day)', S3.fatProduced.toFixed(2)],\r\n        ['Fat short of quota (kg\/day)', Math.max(0, common.quota - S3.fatProduced).toFixed(2)],\r\n        ['Cows needed to fill quota', S3.cowsNeededToFillQuota],\r\n        ['Current cows', S3.cowsUsed],\r\n        ['Cows short', S3.cowsShort],\r\n        ['Potential extra milk if quota filled (L\/day)', Math.round(S3.milkShort)],\r\n        ['Quota utilization', (S3.paidFat \/ common.quota * 100).toFixed(1) + '%']\r\n      ];\r\n\r\n      let s3GapHtml = '';\r\n      for (const [k,v] of s3GapRows) s3GapHtml += '<tr><td><strong>'+k+'<\/strong><\/td><td>'+v+'<\/td><\/tr>';\r\n      document.getElementById('s3GapBody').innerHTML = s3GapHtml;\r\n\r\n      \/\/ Show results\r\n      document.getElementById('results').style.display = 'block';\r\n      document.getElementById('results').scrollIntoView({ behavior: 'smooth' });\r\n    }\r\n\r\n    \/\/ generate client report (new window with charts) - simplified without purchase costs\r\n    function generateClientReport() {\r\n      if (!LAST.S1) { alert(\"Please click 'Compare Scenarios' first to generate data.\"); return; }\r\n      const w = window.open('', '_blank');\r\n      w.document.write(`\r\n        <html><head><title>Milk GMR \u00b7 Client Summary<\/title>\r\n        <style>\r\n          body{font-family:system-ui, -apple-system, sans-serif; background:#fff; padding:30px; max-width:1100px; margin:0 auto;}\r\n          .report-header{display:flex; justify-content:space-between; align-items:center; border-bottom:3px solid #4299e1; padding-bottom:15px;margin-bottom:25px}\r\n          .report-header h1{color:#1a2639; font-size:28px}\r\n          .date{color:#4a5568}\r\n          .cards{display:grid; grid-template-columns:repeat(3,1fr); gap:20px; margin:30px 0}\r\n          .card{background:#f7fafc; border-radius:16px; padding:20px; border:1px solid #e2e8f0}\r\n          .card.value{font-size:24px; font-weight:700; color:#2d3748}\r\n          .chart-row{display:flex; gap:30px; margin:40px 0; align-items:flex-end}\r\n          .chart-container{flex:1; background:#f8fafc; border-radius:12px; padding:20px}\r\n          .bar-chart{margin-top:15px}\r\n          .bar-item{margin:10px 0}\r\n          .bar-label{display:flex; justify-content:space-between; font-size:14px; font-weight:500}\r\n          .bar-fill{height:24px; background:#4299e1; border-radius:20px; color:white; line-height:24px; padding-left:10px; font-size:13px}\r\n          .table-mini{width:100%; border-collapse:collapse; margin-top:20px}\r\n          .table-mini td{padding:8px; border-bottom:1px solid #edf2f7}\r\n          .footer-note{margin-top:50px; font-size:14px; color:#718096; text-align:center; border-top:1px dashed #cbd5e0; padding-top:20px}\r\n          .highlight{background:#f0f5fa; border-radius:16px; padding:20px; margin:30px 0}\r\n          .quota-meter{height:30px; background:#e2e8f0; border-radius:30px; margin:15px 0; overflow:hidden}\r\n          .quota-fill{height:30px; background:#805ad5; color:white; line-height:30px; padding-left:15px; font-weight:bold}\r\n          @media print{ body{padding:15px} }\r\n        <\/style>\r\n        <\/head><body>\r\n        <div class=\"report-header\">\r\n          <h1>\ud83e\udd5b Milk Price GMR \u00b7 Client Report<\/h1>\r\n          <div class=\"date\">`+new Date().toLocaleDateString('en-US',{year:'numeric', month:'long', day:'numeric'})+`<\/div>\r\n        <\/div>\r\n        <p><strong>Policy (Effective June 1, 2026):<\/strong> Tier1 \u22642.20, Tier2 2.20-2.50 (market fraction), above 2.50 unpaid.<\/p>\r\n        \r\n        <!-- summary cards small -->\r\n        <div class=\"cards\">\r\n          <div class=\"card\"><div style=\"font-size:14px; color:#4a5568\">Quota (kg fat\/day)<\/div><div class=\"value\">${LAST.common.quota.toFixed(2)}<\/div><\/div>\r\n          <div class=\"card\"><div style=\"font-size:14px; color:#4a5568\">Fat Price \/ kg<\/div><div class=\"value\">$${LAST.common.fatPrice.toFixed(2)}<\/div><\/div>\r\n          <div class=\"card\"><div style=\"font-size:14px; color:#4a5568\">Protein Tier1 \/ Tier2<\/div><div class=\"value\">$${LAST.common.proteinPrice} \/ $${LAST.common.ratioProteinPrice}<\/div><\/div>\r\n        <\/div>\r\n\r\n        <!-- key net comparison bars -->\r\n        <div class=\"chart-row\">\r\n          <div class=\"chart-container\">\r\n            <h3>\ud83d\udcca Annual Net Income Comparison<\/h3>\r\n            <div class=\"bar-chart\">\r\n              <div class=\"bar-item\"><div class=\"bar-label\"><span>Scenario 1 (baseline)<\/span> <span>${formatMoney(LAST.S1.netA)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${Math.min(100, (LAST.S1.netA\/LAST.S2.netA)*100)}%; max-width:100%; background:#4299e1;\">${formatMoney(LAST.S1.netA)}<\/div><\/div>\r\n              <div class=\"bar-item\"><div class=\"bar-label\"><span>Scenario 2 (improved)<\/span> <span>${formatMoney(LAST.S2.netA)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${Math.min(100, (LAST.S2.netA\/LAST.S2.netA)*100)}%; background:#48bb78;\">${formatMoney(LAST.S2.netA)}<\/div><\/div>\r\n              <div class=\"bar-item\"><div class=\"bar-label\"><span>Scenario 3 (actual herd)<\/span> <span>${formatMoney(LAST.S3.netA)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${Math.min(100, (LAST.S3.netA\/LAST.S2.netA)*100)}%; background:#805ad5;\">${formatMoney(LAST.S3.netA)}<\/div><\/div>\r\n            <\/div>\r\n          <\/div>\r\n          <div class=\"chart-container\">\r\n            <h3>\ud83d\udcc8 S2 vs S1 improvement<\/h3>\r\n            <div style=\"font-size: 42px; font-weight:700; margin:20px 0; ${LAST.netDiff12>=0?'color:#2f855a':'color:#c53030'}\">${(LAST.netDiff12>0?'+':'')+formatMoney(LAST.netDiff12)}<\/div>\r\n            <div>Annual difference (S2 - S1)<\/div>\r\n            <table class=\"table-mini\">\r\n              <tr><td>Revenue per cow\/day S1<\/td><td><strong>${formatMoney(LAST.S1.revenuePerCowDaily)}<\/strong><\/td><\/tr>\r\n              <tr><td>Revenue per cow\/day S2<\/td><td><strong>${formatMoney(LAST.S2.revenuePerCowDaily)}<\/strong><\/td><\/tr>\r\n              <tr><td>Cows needed S1<\/td><td>${LAST.S1.cowsUsed}<\/td><\/tr>\r\n              <tr><td>Cows needed S2<\/td><td>${LAST.S2.cowsUsed}<\/td><\/tr>\r\n            <\/table>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- per cow daily revenue breakdown -->\r\n        <div class=\"chart-row\">\r\n          <div class=\"chart-container\">\r\n            <h3>\ud83d\udc04 Revenue per cow\/day (S2 improved)<\/h3>\r\n            <div class=\"bar-item\"><div class=\"bar-label\"><span>Fat<\/span><span>${formatMoney(LAST.S2.fatRevD\/LAST.S2.cowsUsed)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${(LAST.S2.fatRevD\/LAST.S2.totalRevD*100)}%;background:#3182ce\">${(LAST.S2.fatRevD\/LAST.S2.totalRevD*100).toFixed(1)}%<\/div><\/div>\r\n            <div class=\"bar-item\"><div class=\"bar-label\"><span>Protein Tier1<\/span><span>${formatMoney(LAST.S2.protBaseD\/LAST.S2.cowsUsed)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${(LAST.S2.protBaseD\/LAST.S2.totalRevD*100)}%;background:#48bb78\">${(LAST.S2.protBaseD\/LAST.S2.totalRevD*100).toFixed(1)}%<\/div><\/div>\r\n            <div class=\"bar-item\"><div class=\"bar-label\"><span>OS Tier1<\/span><span>${formatMoney(LAST.S2.osBaseD\/LAST.S2.cowsUsed)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${(LAST.S2.osBaseD\/LAST.S2.totalRevD*100)}%;background:#ecc94b\">${(LAST.S2.osBaseD\/LAST.S2.totalRevD*100).toFixed(1)}%<\/div><\/div>\r\n            <div class=\"bar-item\"><div class=\"bar-label\"><span>Protein Tier2<\/span><span>${formatMoney(LAST.S2.protMktD\/LAST.S2.cowsUsed)}<\/span><\/div><div class=\"bar-fill\" style=\"width:${(LAST.S2.protMktD\/LAST.S2.totalRevD*100)}%;background:#b794f4\">${(LAST.S2.protMktD\/LAST.S2.totalRevD*100).toFixed(1)}%<\/div><\/div>\r\n          <\/div>\r\n          <div class=\"chart-container\">\r\n            <h3>\ud83d\udccc SNF ratio & quota analysis<\/h3>\r\n            <table class=\"table-mini\">\r\n              <tr><td>Scenario 1 SNF ratio<\/td><td><strong>${LAST.S1.snfRatio.toFixed(3)}<\/strong><\/td><\/tr>\r\n              <tr><td>Scenario 2 SNF ratio<\/td><td><strong>${LAST.S2.snfRatio.toFixed(3)}<\/strong><\/td><\/tr>\r\n              <tr><td>Scenario 3 SNF ratio<\/td><td><strong>${LAST.S3.snfRatio.toFixed(3)}<\/strong><\/td><\/tr>\r\n              <tr><td>Quota scale S1<\/td><td>${(LAST.S1.quotaScale*100).toFixed(1)}% of milk paid<\/td><\/tr>\r\n              <tr><td>Quota scale S3<\/td><td>${(LAST.S3.quotaScale*100).toFixed(1)}% of milk paid<\/td><\/tr>\r\n            <\/table>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <!-- Scenario 3 focus -->\r\n        <div class=\"highlight\">\r\n          <h3 style=\"margin-bottom:15px;\">\ud83d\udfe3 Current Herd Analysis (Scenario 3)<\/h3>\r\n          <div style=\"display:grid; grid-template-columns:1fr 2fr; gap:30px;\">\r\n            <div>\r\n              <p><strong>Actual cows:<\/strong> ${LAST.S3.cowsUsed}<\/p>\r\n              <p><strong>Fat produced:<\/strong> ${LAST.S3.fatProduced.toFixed(2)} kg\/day<\/p>\r\n              <p><strong>Paid fat:<\/strong> ${LAST.S3.paidFat.toFixed(2)} kg\/day<\/p>\r\n              <p><strong>Cows to full quota:<\/strong> ${LAST.S3.cowsNeededToFillQuota}<\/p>\r\n              <p><strong>Shortage:<\/strong> ${LAST.S3.cowsShort} cows<\/p>\r\n            <\/div>\r\n            <div>\r\n              <p><strong>Quota utilization:<\/strong> ${(LAST.S3.paidFat\/LAST.common.quota*100).toFixed(1)}%<\/p>\r\n              <div class=\"quota-meter\">\r\n                <div class=\"quota-fill\" style=\"width:${Math.min(100, LAST.S3.paidFat\/LAST.common.quota*100)}%;\">${(LAST.S3.paidFat\/LAST.common.quota*100).toFixed(1)}%<\/div>\r\n              <\/div>\r\n              <p style=\"margin-top:15px;\"><strong>Annual net (S3):<\/strong> ${formatMoney(LAST.S3.netA)}<\/p>\r\n              <p><strong>vs. S2 potential:<\/strong> ${formatMoney(LAST.S2.netA - LAST.S3.netA)} more if optimized<\/p>\r\n            <\/div>\r\n          <\/div>\r\n        <\/div>\r\n\r\n        <div class=\"footer-note\">\r\n          Generated by Milk Price GMR Calculator (June 1, 2026 policy: no-pay above 2.50) \u2013 for discussion purposes only.<br>\r\n          Parameters: fat $${LAST.common.fatPrice}\/kg, protein $${LAST.common.proteinPrice}\/$${LAST.common.ratioProteinPrice}, OS $${LAST.common.osPrice}\/$${LAST.common.ratioOSPrice}, quota ${LAST.common.quota} kg fat\/day.\r\n        <\/div>\r\n        <script>window.print();<\\\/script>\r\n        <\/body><\/html>\r\n      `);\r\n      w.document.close();\r\n    }\r\n\r\n    \/\/ Wire up buttons (avoids inline onclick, which WordPress may strip)\r\n    (function(){\r\n      const btns = document.querySelectorAll('.milk-gmr-btn');\r\n      btns.forEach(function(b){\r\n        if (b.classList.contains('report')) {\r\n          b.addEventListener('click', generateClientReport);\r\n        } else {\r\n          b.addEventListener('click', calculate);\r\n        }\r\n      });\r\n    })();\r\n  <\/script><\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\r\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; &nbsp; &nbsp; \ud83e\udd5b Milk Price GMR Calculator (June 1, 2026 Policy) Tier 1 \u22642.20 \u2022 Tier 2 = 2.20\u20132.50 (market ratio fraction only) \u2022 Above 2.50 unpaid (Protein + OS) \ud83d\udcca Common Parameters Fat Price ($\/kg) Protein Price<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2487","page","type-page","status-publish","hentry"],"brizy_media":[],"_links":{"self":[{"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/pages\/2487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2487"}],"version-history":[{"count":5,"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/pages\/2487\/revisions"}],"predecessor-version":[{"id":2503,"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=\/wp\/v2\/pages\/2487\/revisions\/2503"}],"wp:attachment":[{"href":"https:\/\/dr-nutrition.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}