:root {
     --brand-dark: #00674C;
     --brand-mid: #00AD4F;
     --brand-light: #A9DC92;
     --brand-yellow: #FFE370;
     --brand-very-light: #dcefde;
     --bg: #ffffff;
     --text: #1f2d24;
     --muted: #516354;
     --accent-1: var(--brand-mid);
     --accent-2: var(--brand-light);
     --accent-3: var(--brand-yellow);
     --main: var(--brand-dark);
     --border: var(--brand-very-light);
     --shadow: none;
     --font-family: "greycliff-cf", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
 * {
     box-sizing: border-box;
}
.hidden { display: none !important; }
 body, button, input, select, textarea {
     font-family: var(--font-family);
}
 body {
     margin: 0;
     font: 16px/1.5 var(--font-family);
     background: var(--bg);
     color: var(--text);
}
 .container {
     max-width: 1000px;
     margin: 0 auto;
     padding: 24px;
}
 .header h1,h2{
     margin: 8px 0;
     color: #00674C;
}
 .subtitle {
     color: var(--muted);
     margin-top: 0;
}
 .header-row {
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 12px;
}
 .lang-toggle button {
     appearance: none;
     border: 1px solid var(--border);
     background: #ffffff;
     color: var(--brand-dark);
     padding: 8px 16px;
     border-radius: 999px;
     cursor: pointer;
     font-weight: 600;
}
 .lang-toggle button.active {
     border-color: var(--accent-1);
     background: var(--accent-1);
     color: #fff;
}
 .card {
     background: var(--card);
     border: 1px solid var(--border);
     border-radius: 4px;
     padding: 24px;
     margin: 16px 10px;
}
 .grid {
     display: grid;
     grid-template-columns: repeat(3, minmax(240px, 1fr));
     gap: 16px;
}
label {
     display: flex;
     flex-direction: column;
     gap: 6px;
}
 input, select {
     background: #dcefde;
     color: var(--text);
     border: 2px solid transparent;
     border-radius: 2px;
     padding: 0 20px;
     height: 42px;
     outline: none;
}
 input:focus, select:focus {
     border-color: var(--accent-1);
     box-shadow: 0 0 0 2px rgba(0,173,79,.25);
}
 .input-prefix {
     position: relative;
     width: 100%;
}
 .input-prefix {
  position: relative;
}

.input-prefix::before,
.input-prefix::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

/* English: $ before */
html[lang^="en"] .input-prefix::before {
  content: attr(data-prefix);
  left: 10px;
}

html[lang^="en"] .input-prefix input {
  padding-left: 20px;
}

/* French: $ after */
html[lang^="fr"] .input-prefix::after {
  content: attr(data-prefix);
  right: 10px;
}

html[lang^="fr"] .input-prefix input {
  padding-right: 20px;
}


 .input-prefix input {
     width: 100%;
     padding-left: 38px;
}
 .actions {
     display: flex;
     gap: 10px;
     margin-top: 30px;
}
 button {
     appearance: none;
     cursor: pointer;
     border: none;
     border-radius: 999px;
     padding: 16px 30px;
     font-size: 14px;
     font-weight: 600;
     color: #fff;
     background: var(--accent-1);
     transition: transform 0.2s ease;
}
 button:hover {
     transform: translateY(-2px);
}
 button.secondary {
     background: transparent;
     border: 2px;
     border-style: solid;
     border-color: #00674C;
     color: var(--brand-dark);
}
 button.tertiary {
     background: var(--accent-3);
     color: var(--brand-dark);
}
 .results.hidden {
     display: none;
}
.results-grid {
     display: grid;
     grid-template-columns: repeat(2, 1fr);
     gap: 16px;
     margin-top: 10px;
}
.result .label {
     color: var(--muted);
     font-size: 16px;
}
.result .value {
     font-size: 22px;
     font-weight: 700;
     color: var(--brand-dark);
}
.result.chart {
     grid-column: span 2;
}
.results table thead {
  display: table-header-group;
}
.results table th {
  background: #f5f7f6;
  font-weight: 600;
  text-align: none;
  padding: 10px;
}
.chart-wrapper {
     display: flex;
     align-items: center;
     gap: 16px;
     flex-wrap: wrap;
}
.pie {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.pie circle {
  fill: none;
  stroke-width: 18;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.pie circle.interest {
  stroke: #dcefde;
}
.pie circle.principal {
  stroke: var(--brand-dark);
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.4s ease;
}
.pie.empty circle.interest,
.pie.empty circle.principal {
  stroke: var(--border);
}
.chart-legend {
     display: flex;
     flex-direction: column;
     gap: 8px;
     font-weight: 600;
     color: var(--text);
}
.chart-legend .swatch {
     display: inline-block;
     width: 12px;
     height: 12px;
     border-radius: 50%;
     margin-right: 6px;
}
.chart-legend .swatch.principal {
     background: var(--brand-dark);
}
.chart-legend .swatch.interest {
     background: #dcefde;
}

 table {
     width: 100%;
     border-collapse: collapse;
     margin-top: 16px;
}
 th, td {
     border-bottom: 1px solid var(--border);
     padding: 10px;
     text-align: right;
}
 th:first-child, td:first-child {
     text-align: left;
}
/* Tabs */

.tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:12px 0 18px;
}

.tab-btn{
  padding:10px 16px;
  border-radius:20px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  cursor:pointer;
  font-weight:600;
  transition:all .15s ease;
}

/* Hover state */
.tab-btn:hover{
  border-color:var(--accent-1);
  color:var(--brand-dark);
}

/* Active tab */
.tab-btn.active{
  background:var(--accent-1);
  color:#fff;
  border-color:var(--accent-1);
}
 .tab-panel {
     display: none;
}
 .tab-panel.active {
     display: block;
}
 body.single-calculator .tabs {
     display: none;
}
 body.single-calculator .lang-toggle {
     display: none;
}
 .section-title {
     margin: 0 0 8px 0;
}
 .summary-grid {
     display: grid;
     grid-template-columns: repeat(2, 1fr);
     gap: 16px;
}
 .summary .label {
     color: var(--muted);
     font-size: 16px;
}
 .summary .value {
     font-size: 22px;
     font-weight: 700;
}
@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .results-grid, .summary-grid {
    grid-template-columns: 1fr;
  }
  .result.chart {
    grid-column: span 1;
  }
  .chart-wrapper {
    justify-content: flex-start;
  }
}

@media print {
  .pie circle {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Phones: 1 column + stacked buttons */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button {
    width: 100%;
    padding: 14px 20px;
  }

  .chart-container {
    height: 260px;
  }
}

.print-header {
  display: none;
}

@media print {
  .actions,
  .lang-toggle {
    display: none !important;
  }

  .print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
  }

  .print-header img {
    height: 40px;
  }

  .print-date {
    font-size: 12px;
    color: var(--muted);
  }
}

/* ===============
   Desktop results layout
   3 numeric results LEFT & chart RIGHT
   =============== */
@media (min-width: 901px) {
  /* Two columns: left=results, right=chart */
  .results-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* Force the chart into the right column */
  .results-grid .result.chart {
    grid-column: 2;
    grid-row: 1 / span 3;
    justify-self: start;
    align-self: center;
  }

  /* Force ALL other results into the left column */
  .results-grid .result:not(.chart) {
    grid-column: 1;
  }
}
/* ==========================
   Debt table responsive
========================== */

@media (max-width: 700px) {

  #debtsBody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
  }

  #debtsBody td {
    display: block;
    text-align: left;
    padding: 8px 0;
    border: none;
  }

  #debtsBody td::before {
    content: attr(data-label);
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 600;
  }

  #debtsBody td:last-child {
    text-align: right;
  }


  /* Make the debt table behave like stacked cards */
  #debtsBody tr {
    display: block;
  }

  #debtsBody td {
    width: 100%;
  }

  /* Force input containers to full width */
  #debtsBody .input-prefix,
  #debtsBody input {
    width: 100%;
  }

  /* Ensure consistent sizing */
  #debtsBody input {
    box-sizing: border-box;
  }

  /* Remove button full width (optional but recommended) */
  #debtsBody td:last-child button {
    width: 100%;
    margin-top: 8px;
  }

}

/* ==========================
   Debt table: compact desktop / iframe widths
   (between mobile cards and full desktop table)
   ========================== */
@media (min-width: 701px) and (max-width: 980px) {

  /* Hide headers like mobile */
  table thead {
    display: none;
  }

  /* Turn each row into a 2-column card */
  #debtsBody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
  }

  #debtsBody td {
    border: none;
    padding: 0;
    text-align: left;
  }

  /* Field label (uses your existing data-label attributes) */
  #debtsBody td::before {
    content: attr(data-label);
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 600;
  }

  /* Name full width (row 1) */
  #debtsBody td:nth-child(1) {
    grid-column: 1 / -1;
  }

  /* Remove button full width at bottom */
  #debtsBody td:nth-child(5) {
    grid-column: 1 / -1;
  }
  #debtsBody td:nth-child(5) button {
    width: 100%;
    margin-top: 6px;
  }

  /* Make inputs full width inside the grid cells */
  #debtsBody .input-prefix,
  #debtsBody input {
    width: 100%;
    box-sizing: border-box;
  }
}

.debt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.section-subtitle{
  font-size:18px;
  font-weight:600;
  margin-top:10px;
  margin-bottom:6px;
}

.scenario-intro{
  color:var(--muted);
  font-size:14px;
  margin-bottom:14px;
  max-width:650px;
}

/* Calculator CTA styling to be inserted */

.calculator-cta.hidden { display: none; }

.calculator-cta {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid #e1ebe5;
  text-align: center;
}

.calculator-cta h2 {
  color: #0f6b4c;
  margin-bottom: 10px;
}

.calculator-cta p {
  margin-bottom: 20px;
}

.calculator-cta a.cta-button {
  display: inline-block;
  padding: 14px 30px;
  background: #0f6b4c;
  color: white;
  border-radius: 28px;
  text-decoration: none;
}

.calculator-cta .cta-button:hover {
  background: #0c5a40;
}

.chart-container {
  margin-top: 24px;
  height: 300px;
}

.chart-container canvas {
  display: block;
}

.field-error {
  color: #c0392b;
  font-size: 0.875rem;
  margin: 4px 0 8px;
  padding: 8px 12px;
  background: #fde9e9;
  border-left: 3px solid #c0392b;
  border-radius: 4px;
}