.calculator-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    font-family: "Sora", sans-serif;
    color: #303030;
  }
  
  /* Field Warning Styles */
  .field-warning {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 4px;
    padding: 4px 8px;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    display: none;
  }
  
  /* CTA Button Styles */
  .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .cta-button:active {
    transform: translateY(0);
  }
  
  @media (max-width: 600px) {
    .cta-buttons {
      flex-direction: column;
      align-items: center;
    }
    
    .cta-button {
      width: 200px;
    }
  }
  
  /* Titles & Lines */
  h2 {
    text-align: center;
    margin: 0 0 5px 0;
    font-size: 1.6em;
    color: #303030;
  }
  h3 {
    margin: 0;
    font-size: 1.2em;
    color: #303030;
    text-align: center;
  }
  
  .soft-line {
    display: block;
    margin: 20px auto;
    border: none;
    border-bottom: 1px solid #ccc;
  }
  .sub-line {
    margin: 10px auto;
    border: none;
    border-bottom: 1px dashed #ccc;
  }
  
  /* Intro text */
  .intro {
    font-size: 0.85em;
    color: #555;
    line-height: 1.5;
    text-align: center;
    max-width: 90%;
    margin: 0 auto 20px auto;
  }
  
  /* Pill Switch */
  .pill-switch {
    display: block;
    width: 300px;
    height: 40px;
    margin: 0 auto 15px auto;
    position: relative;
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px #ccc;
    background: #f9f9f9;
  }
  .pill-switch input[type="radio"] {
    display: none;
  }
  .pill-switch .option {
    position: relative;
    float: left;
    width: 50%;
    text-align: center;
    line-height: 40px;
    font-size: 0.85em;
    font-weight: normal;
    color: #666;
    cursor: pointer;
    z-index: 2;
  }
  .pill-switch .slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: #007bff;
    border-radius: 20px;
    transition: all 0.3s ease;
    z-index: 1;
  }
  .pill-switch input[value="apr"]:checked ~ .slider {
    left: 50%;
  }
  .pill-switch input[value="payment"]:checked ~ label[for="mode-payment"],
  .pill-switch input[value="apr"]:checked ~ label[for="mode-apr"] {
    color: #fff;
    font-weight: bold;
  }
  
  /* Form section */
  .form-section {
    margin-bottom: 20px;
  }
  .input-row {
    margin-bottom: 15px;
  }
  .input-row label {
    display: block;
    font-weight: bold;
    margin-bottom: 14px;
    color: #333;
    font-size: 0.9em;
  }
  .radio-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
  }
  .radio-row label {
    font-weight: normal !important;
  }
  
  /* Sliders */
  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin: 5px 0;
  }
  input[type="range"]:focus {
    outline: none;
  }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #D9E021, #F1AEF9);
  }
  input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #D9E021, #F1AEF9);
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.4);
  }
  input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #333;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.4);
    border: none;
  }
  .slider-label {
    font-size: 0.8em;
    margin: 0 0 3px 0; /* top=0, bottom=3px */
    display: block;
    color: #333;
    font-weight: normal;
  }
  
  /* Typed Inputs */
  #interestRate_New,
  #interestRate_Stocks,
  #promoRate_New {
    width: 100%;
    padding: 8px;
    margin: 5px 0 0 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    box-sizing: border-box;
  }
  .small-disclaimer {
    font-size: 0.7em;
    color: #555;
    margin-top: 5px;
  }
  
  /* Boxed section */
  .boxed-section {
    margin-top: 10px;
    margin-bottom: 15px;
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 5px;
  }
  
  /* Full-width select (to match typed-input style) */
  .full-width-select {
    width: 100%;
    padding: 8px;
    margin: 5px 0 0 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    box-sizing: border-box;
  }
  
  /* Buttons */
  .calculate-button {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background-color: #ffd300;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 10px;
    text-align: center;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.3);
  }
  .calculate-button:hover,
  .calculate-button:active {
    background-color: #ff4d4d;
    color: #fff;
  }
  
  /* Modals */
  .results-modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
  }
  .results-modal .modal-content {
    background: #fff;
    margin: 80px auto;
    padding: 20px;
    border-radius: 10px;
    max-width: 650px;
    position: relative;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.3);
  }
  .results-modal .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
  }
  .results-modal .close-btn:hover {
    color: #333;
  }
  .results-modal h3 {
    margin: 0;
    font-size: 1.2em;
    color: #303030;
    text-align: center;
  }
  
  /* Result Summary */
  .result-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
  }
  .result-box {
    background: #f1f1f1;
    padding: 10px;
    border-radius: 5px;
    width: 45%;
    text-align: center;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  }
  .result-label {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 5px;
  }
  .result-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #007bff;
  }
  .result-value.growth {
    color: green;
  }
  
  /* Disclaimer */
  .calc-disclaimer {
    font-size: 0.7em;
    color: #666;
    margin-top: 15px;
    line-height: 1.3;
    text-align: center;
  }
  
  /* Chart Container */
  .chart-container {
    position: relative;
    margin: 20px 0;
    text-align: center;
  }
  #savingsChart,
  #savingsChart_Stocks {
    max-width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
  }
  .chart-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    pointer-events: none;
  }
  
  /* Overview Container */
  .overview-container {
    margin: 20px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    font-size: 0.9em;
    line-height: 1.4;
    color: #333;
  }
  .overview-container h3.overview-heading {
    margin-top: 0;
    font-size: 1.3em;
    font-weight: bold;
    color: #303030;
    text-align: center;
    margin-bottom: 10px;
  }
  
  /* Buy Me a Coffee Section */
  .bmc-section {
    text-align: center;
    margin-top: 20px;
  }
  .bmc-section h3.overview-heading {
    margin-bottom: 10px;
    font-size: 0.7em;
    font-weight: bold;
    color: #303030;
    text-align: center;
  }
  .bmc-button-wrapper {
    display: inline-block;
    width: 100%;
  }
  .bmc-button-wrapper iframe,
  .bmc-button-wrapper a,
  .bmc-button-wrapper a span {
    width: 100% !important;
    box-sizing: border-box;
    color: #ffffff !important;
  }
  
  /* CTA Buttons */
  .explore-button {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background-color: #ffd300;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 15px;
    text-align: center;
    box-shadow: 2px 2px 3px rgba(0,0,0,0.3);
  }
  .explore-button:hover,
  .explore-button:active {
    background-color: #ff4d4d;
    color: #fff;
  }
  
  /* Compact Form Styling */
  .calculator-container {
    max-width: 650px;
    margin: 15px auto;
    padding: 20px;
  }
  
  .compact-row {
    margin-bottom: 16px;
  }
  
  .field-explanation {
    font-size: 12px;
    color: #666;
    margin: 4px 0 8px 0;
    font-style: italic;
  }
  
  .balance-row {
    margin-bottom: 15px;
  }
  
  .balance-row label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    font-size: 0.925em;
  }
  
  .balance-row .slider-label {
    margin: 0 0 5px 0;
    font-weight: normal;
    color: #666;
    font-size: 0.875em;
  }
  
  .balance-row input[type="range"] {
    width: 100%;
    margin: 0;
  }
  
  .compact-row label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    font-size: 0.925em;
  }
  .compact-row input,
  .compact-row select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.8em;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    height: 32px;
  }
  .compact-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.8em;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    height: 32px;
  }
  
  /* Calculation Options Styling */
  .calculation-options {
    margin-bottom: 20px;
  }
  .section-label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.925em;
  }
  .calc-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .calc-option {
    position: relative;
    cursor: pointer;
    display: block;
  }
  .calc-option input[type="checkbox"],
  .calc-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }
  .calc-option-content {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .calc-option:hover .calc-option-content {
    background-color: #e3f2fd;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .calc-option input[type="checkbox"]:checked + .calc-option-content,
  .calc-option input[type="radio"]:checked + .calc-option-content {
    border-color: #007bff;
    background: #e3f2fd;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
  }
  .calc-icon {
    font-size: 1.2em;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
  }
  .calc-text {
    flex: 1;
  }
  .calc-title {
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
  }
  .calc-desc {
    font-size: 0.65em;
    color: #666;
    line-height: 1.3;
  }
  .calc-option input[type="checkbox"]:checked + .calc-option-content .calc-title,
  .calc-option input[type="radio"]:checked + .calc-option-content .calc-title {
    color: #007bff;
  }
  .calc-option input[type="checkbox"]:checked + .calc-option-content .calc-desc,
  .calc-option input[type="radio"]:checked + .calc-option-content .calc-desc {
    color: #0056b3;
  }
  
  /* Compact Label and Slider Styling */
  .compact-label {
    font-size: 0.85em;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
  }
  .compact-slider-label {
    font-size: 0.8em;
    color: #666;
    margin: 2px 0 4px 0;
  }
  .compact-slider {
    width: 100%;
    height: 6px;
    margin: 4px 0;
  }
  .compact-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    box-sizing: border-box;
  }
  .compact-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    box-sizing: border-box;
    background-color: white;
  }
  .goal-btn {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .goal-btn:hover {
    background-color: #e3f2fd;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .goal-btn.selected {
    border-color: #007bff;
    background: #e3f2fd;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
  }
  .goal-icon {
    font-size: 1.2em;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
  }
  .goal-text {
    flex: 1;
  }
  .goal-title {
    font-size: 0.85em;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
  }
  .goal-desc {
    font-size: 0.7em;
    color: #666;
    line-height: 1.3;
  }
  .goal-btn.selected .goal-title {
    color: #007bff;
  }
  .goal-btn.selected .goal-desc {
    color: #0056b3;
  }
  
  /* Optional Sections (Collapsible) */
  .optional-section {
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
  }
  .optional-section summary {
    padding: 10px 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8em;
    color: #666;
    background: #f5f5f5;
    border-radius: 6px 6px 0 0;
    user-select: none;
  }
  .optional-section summary:hover {
    background: #eeeeee;
    color: #333;
  }
  .optional-section[open] summary {
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid #e0e0e0;
  }
  .optional-section > div {
    padding: 12px;
  }
  
  /* Radio buttons in compact rows */
  .compact-row .radio-row {
    display: flex;
    gap: 15px;
    margin-top: 5px;
  }
  .compact-row .radio-row label {
    display: flex;
    align-items: center;
    font-weight: normal;
    font-size: 0.8em;
    margin-bottom: 0;
  }
  .compact-row .radio-row input[type="radio"] {
    width: auto;
    height: auto;
    margin-right: 5px;
  }
  
  /* Slider labels in compact rows */
  .compact-row .slider-label {
    font-size: 0.75em;
    color: #666;
    margin: 2px 0;
    text-align: right;
  }

  /* Responsive */
  @media (max-width: 600px) {
    .calculator-container {
      max-width: 100%;
      margin: 10px;
      padding: 12px;
    }
    .result-box {
      width: 100%;
    }
    .goal-btn {
      padding: 8px 10px;
    }
    .goal-icon {
      font-size: 1em;
    }
    .goal-title {
      font-size: 0.8em;
    }
    .goal-desc {
      font-size: 0.65em;
    }
  }

/* Additional styles for Credit Card Calculator Modal */
.results-modal .result-summary {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 10px 0 !important;
}

.results-modal .result-box {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
    text-align: center !important;
    width: 48% !important;
    min-width: 200px !important;
    border-radius: 5px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    box-shadow: 0 0 2px rgba(0,0,0,0.1) !important;
    flex: 0 0 48% !important;
}

.results-modal .result-icon {
    font-size: 1.3em;
    margin-bottom: 5px;
    display: block;
}

.results-modal .result-box .result-label {
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
}

.results-modal .result-box .result-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
}

.results-modal .result-box .result-value.growth {
    color: #28a745;
}

.chart-container {
    margin-top: 20px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
}

.chart-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    pointer-events: none; /* So it doesn't interfere with mouse events on the canvas */
    white-space: nowrap;
}

  