:root {
  --elasticalc-color-bg: #ffffff;
  --elasticalc-color-surface: #fcf8f8;
  --elasticalc-color-border-subtle: #ccc;
  --elasticalc-color-text-main: #111;
  --elasticalc-color-text-muted: #555;
  --elasticalc-color-pill-bg: #333;
  --elasticalc-color-pill-text: #fff;
  --elasticalc-color-error: #c62828;
  --elasticalc-color-error-bg: #fdecea;
  --elasticalc-color-accent-primary: #0466c8;
  --elasticalc-color-accent-secondary: #555;
  --elasticalc-color-series-start: #7f4f24;
  --elasticalc-color-series-saving: #a4ac86;
  --elasticalc-color-series-return: #333d29;
  --elasticalc-font-family: system-ui, -apple-system, sans-serif;
  --elasticalc-font-size-base: 16px;
  --elasticalc-font-size-sm: 0.9rem;
  --elasticalc-font-size-lg: 1.6rem;
  --elasticalc-font-size-md: 1.2rem;
  --elasticalc-radius-sm: 4px;
  --elasticalc-radius-md: 6px;
  --elasticalc-space-2: 0.25rem;
  --elasticalc-space-3: 0.5rem;
  --elasticalc-space-4: 0.75rem;
  --elasticalc-space-5: 1rem;
  --elasticalc-space-6: 1.25rem;
  --elasticalc-space-8: 2rem;
  --elasticalc-shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.elasticalc-wrapper {
  font-family: var(--elasticalc-font-family);
  font-size: var(--elasticalc-font-size-base);
  color: var(--elasticalc-color-text-main);
  max-width: 100%;
  box-sizing: border-box;
}

.elasticalc-wrapper * {
  box-sizing: border-box;
}

/* Typography */
.elasticalc-title {
  font-size: 1.25rem;
  margin-bottom: var(--elasticalc-space-3);
  font-weight: 500;
}

.elasticalc-description {
  margin-bottom: var(--elasticalc-space-5);
  color: var(--elasticalc-color-text-muted);
  font-size: var(--elasticalc-font-size-sm);
}

.elasticalc-label {
  display: block;
  margin-bottom: var(--elasticalc-space-3);
  font-size: 16px;
  font-weight: 500;
}

/* Inputs */
.elasticalc-input-group {
  position: relative;
  width: 100%;
  margin-top: var(--elasticalc-space-2);
}

.elasticalc-input-wrapper {
  margin-top: 1.5rem;
}

.elasticalc-input {
  display: block;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: var(--elasticalc-radius-sm) !important;
  border: 1px solid var(--elasticalc-color-border-subtle);
  background: #fff;
  color: #000;
  font-size: 16px;
  height: 40px !important;
}

.elasticalc-input:focus {
  outline: 2px solid var(--elasticalc-color-accent-primary);
  outline-offset: 1px;
}

.elasticalc-input--number {
  text-align: right;
}

/* Hide number input spinners */
.elasticalc-input[type="number"]::-webkit-inner-spin-button,
.elasticalc-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.elasticalc-input[type="number"] {
  -moz-appearance: textfield;
}

.elasticalc-input-group--with-suffix .elasticalc-input {
  padding-right: 2.35rem;
}

.elasticalc-input-suffix {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--elasticalc-space-3);
  border-top-right-radius: var(--elasticalc-radius-sm);
  border-bottom-right-radius: var(--elasticalc-radius-sm);
  background: #005495;
  color: var(--elasticalc-color-pill-text);
  font-size: 0.9rem;
  pointer-events: none;
  width: 30px;
}

.elasticalc-input--error {
  border-color: var(--elasticalc-color-error);
  background: var(--elasticalc-color-error-bg);
}

.elasticalc-input-error-text {
  margin-top: var(--elasticalc-space-2);
  font-size: var(--elasticalc-font-size-sm);
  color: var(--elasticalc-color-error);
}

/* Sliders */
.elasticalc-slider {
  margin-top: var(--elasticalc-space-3);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #d3d3d3;
  cursor: pointer;
  outline: none;
}

.elasticalc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--elasticalc-color-accent-primary);
  cursor: pointer;
  box-shadow: var(--elasticalc-shadow-subtle);
}

.elasticalc-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--elasticalc-color-accent-primary);
  cursor: pointer;
  box-shadow: var(--elasticalc-shadow-subtle);
}

.elasticalc-input-slider-stack {
  margin-top: var(--elasticalc-space-2);
}

/* Controls */
.elasticalc-control-group-label {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: var(--elasticalc-space-3);
  display: block;
}

.elasticalc-radio-group,
.elasticalc-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--elasticalc-space-2);
}

/* Mobile: show only heart icon and count for saved list trigger */
@media (max-width: 640px) {
  .elasticalc-trigger-saved-list {
    font-size: 0 !important;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
  }

  .elasticalc-trigger-saved-list .dashicons {
    font-size: 20px !important;
line-height: 1 !important;    
  }

  .elasticalc-trigger-saved-list .elasticalc-saved-count {
    display: none !important;
  }

  .elasticalc-trigger-saved-list::after {
    content: " " attr(data-elasticalc-count);
    font-size: 18px;
  line-height: 1 !important;
    margin-left: -2px;
  }
}

.elasticalc-radio,
.elasticalc-checkbox {
  display: flex;
  align-items: center;
  gap: var(--elasticalc-space-2);
  font-size: var(--elasticalc-font-size-sm);
  cursor: pointer;
}

.elasticalc-radio input,
.elasticalc-checkbox input {
  accent-color: var(--elasticalc-color-accent-primary);
  width: 16px;
  height: 16px;
}

.elasticalc-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: var(--elasticalc-radius-sm);
  border: 1px solid var(--elasticalc-color-border-subtle);
  background: #fff;
  font-size: 16px;
  height: 40px !important;
}

.elasticalc-select:focus {
  outline: 2px solid var(--elasticalc-color-accent-primary);
  outline-offset: 1px;
}

/* Buttons */
.elasticalc-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--elasticalc-space-4);
  align-items: center;
  margin-top: var(--elasticalc-space-5);
}

.elasticalc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--elasticalc-space-2);
  padding: 0.3rem 1rem;
  border-radius: var(--elasticalc-radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.elasticalc-btn--primary {
  background: var(--elasticalc-color-accent-primary);
  color: #fff;
  border-color: var(--elasticalc-color-accent-primary);
}

.elasticalc-btn--primary:hover {
  background: #0350a0;
  border-color: #0350a0;
}

.elasticalc-btn--secondary {
  background: #fff;
  color: var(--elasticalc-color-accent-secondary);
  border-color: var(--elasticalc-color-border-subtle);
}

.elasticalc-btn--secondary:hover {
  background: #f4f4f4;
}

/* Result Cards */
.elasticalc-result-card {
  border-radius: var(--elasticalc-radius-md);
  background: var(--elasticalc-color-surface);
  padding: var(--elasticalc-space-5);
  border: 1px solid #eee;
}

.elasticalc-result-card--large {
  text-align: center;
  width: 100%;
}

.elasticalc-result-card--medium {
  text-align: left;
  padding: var(--elasticalc-space-4);
  flex: 1;
}

.elasticalc-result-card--small {
  text-align: left;
  padding: var(--elasticalc-space-4);
  font-size: var(--elasticalc-font-size-sm);
}

.elasticalc-result-card-title {
  font-size: var(--elasticalc-font-size-md);
  color: var(--elasticalc-color-text-main);
  margin-bottom: var(--elasticalc-space-3);
}

.elasticalc-result-card-value-lg {
  font-size: var(--elasticalc-font-size-lg);
  font-weight: 700;
}

.elasticalc-result-card-value-md {
  font-size: var(--elasticalc-font-size-md);
  font-weight: 700;
}

.elasticalc-result-card-value-sm {
  font-size: 1.1rem;
  font-weight: 600;
}

.elasticalc-result-card-subtitle {
  margin-top: var(--elasticalc-space-3);
  font-size: var(--elasticalc-font-size-sm);
  color: var(--elasticalc-color-text-muted);
}

/* Layout Grid */
.elasticalc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--elasticalc-space-8);
  align-items: flex-start;
}

.elasticalc-col-1 {
  flex: 1 1 100%;
}

.elasticalc-col-2 {
  flex: 1 1 calc(50% - var(--elasticalc-space-8) / 2);
  min-width: 250px;
}

.elasticalc-col-3 {
  flex: 1 1 calc(33.333% - var(--elasticalc-space-8) * 2 / 3);
  min-width: 200px;
}

.elasticalc-col-30 {
  flex: 1 1 calc(30% - var(--elasticalc-space-8) / 2);
  min-width: 250px;
}

.elasticalc-col-70 {
  flex: 1 1 calc(70% - var(--elasticalc-space-8) / 2);
  min-width: 300px;
}

@media (max-width: 768px) {

  .elasticalc-col-2,
  .elasticalc-col-3,
  .elasticalc-col-30,
  .elasticalc-col-70 {
    flex: 1 1 100%;
  }

  .elasticalc-result-card--medium {
    flex: 1 1 100%;
    width: 100%;
  }

  .elasticalc-button-row {
    justify-content: center;
    width: -webkit-fill-available;
  }
}

/* Charts */
.elasticalc-chart {
  margin-top: 2rem;
  width: 100%;
  height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  position: relative;
  overflow: visible;
}

.elasticalc-chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  position: relative;
  cursor: pointer;
}

.elasticalc-chart-segment {
  width: 100%;
  transition: height 0.2s ease;
}

.elasticalc-chart-segment--start {
  background: var(--elasticalc-color-series-start);
}

.elasticalc-chart-segment--saving {
  background: var(--elasticalc-color-series-saving);
}

.elasticalc-chart-segment--return {
  background: var(--elasticalc-color-series-return);
}

.elasticalc-chart-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.4rem 0.6rem;
  border-radius: var(--elasticalc-radius-sm);
  white-space: nowrap;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 10;
  display: none;
}

.elasticalc-chart-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.elasticalc-chart-axis-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--elasticalc-space-3);
  font-size: var(--elasticalc-font-size-sm);
  color: var(--elasticalc-color-text-muted);
}

.elasticalc-legend {
  margin-top: var(--elasticalc-space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--elasticalc-space-4);
  font-size: var(--elasticalc-font-size-sm);
}

.elasticalc-legend-item {
  display: flex;
  align-items: center;
}

.elasticalc-legend-swatch {
  width: 16px;
  height: 16px;
  margin-right: var(--elasticalc-space-3);
  border-radius: var(--elasticalc-radius-sm);
}

/* PDF Logo (Hidden by default) */
.elasticalc-pdf-logo {
  display: none;
  margin-bottom: 20px;
  text-align: center;
}

.elasticalc-pdf-logo img {
  max-height: 60px;
  width: auto;
}

/* PDF Subtitle (Hidden by default) */
.elasticalc-pdf-subtitle {
  display: none;
  margin-bottom: 20px;
  text-align: center;
  font-size: 14px;
  color: #555;
}

/* PDF Input List (Hidden by default, shown in print) */
.elasticalc-pdf-input-list {
  display: none;
}

/* Shared PDF/Print Styles (Used by both @media print and JS canvas capture) */
.elasticalc-pdf-mode .elasticalc-chart-axis-labels,
.elasticalc-chart-axis-labels.elasticalc-force-visible {
  display: flex !important;
  font-size: 11px !important;
  margin-top: 5px !important;
}

.elasticalc-pdf-mode .elasticalc-legend-swatch,
.elasticalc-legend-swatch.elasticalc-force-print {
  width: 12px !important;
  height: 12px !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.elasticalc-pdf-mode .elasticalc-legend-item:nth-child(1) .elasticalc-legend-swatch {
  background: #AF121D !important; /* Initial/Start color */
}

.elasticalc-pdf-mode .elasticalc-legend-item:nth-child(2) .elasticalc-legend-swatch {
  background: #409D9B !important; /* Contributions/Saving color */
}

.elasticalc-pdf-mode .elasticalc-legend-item:nth-child(3) .elasticalc-legend-swatch {
  background: #034561 !important; /* Return color */
}

/* Save & Load Modals */
.elasticalc-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

.elasticalc-modal--visible {
  display: flex;
}

.elasticalc-modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: relative;
}

.elasticalc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.elasticalc-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.elasticalc-modal-close {
  color: #aaa;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.elasticalc-modal-close:hover,
.elasticalc-modal-close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.elasticalc-saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

.elasticalc-saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.elasticalc-saved-item:last-child {
  border-bottom: none;
}

.elasticalc-saved-name {
  font-weight: 500;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.elasticalc-saved-date {
  font-size: 0.8rem;
  color: #888;
  margin-left: 10px;
}

.elasticalc-saved-actions {
  display: flex;
  gap: 5px;
}

.elasticalc-btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.elasticalc-btn-icon {
  padding: 0.3rem;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
}

.elasticalc-btn-icon:hover {
  color: #c62828;
}

/* Top Menu Trigger */
.elasticalc-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  color: var(--elasticalc-color-accent-primary);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none !important;
}

.elasticalc-menu-trigger:hover {
  text-decoration: none !important;
}

/* Toast Notifications */
.elasticalc-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  font-family: var(--elasticalc-font-family);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(400px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  pointer-events: none;
}

.elasticalc-notification--visible {
  opacity: 1;
  transform: translateX(0);
}

.elasticalc-notification--success {
  background: #4caf50;
  color: white;
}

.elasticalc-notification--error {
  background: #f44336;
  color: white;
}

/* Print Styles (PDF Generation) */
/* 
 * Page Restrictions: 
 * - No hard page limit set - PDF length is content-based
 * - Browser print dialog controls page size and number of pages
 * - Charts use 'break-inside: avoid' to prevent splitting across pages
 * - PDF can span multiple pages if content requires it
 */
@media print {
  /* Apply the PDF mode styles in print automatically */
  .elasticalc-chart-axis-labels {
    display: flex !important;
    font-size: 11px !important;
    margin-top: 5px !important;
  }
  
  .elasticalc-legend-swatch {
    width: 12px !important;
    height: 12px !important;
  }

  .elasticalc-legend-item:nth-child(1) .elasticalc-legend-swatch {
    background: #AF121D !important; 
  }
  
  .elasticalc-legend-item:nth-child(2) .elasticalc-legend-swatch {
    background: #409D9B !important; 
  }
  
  .elasticalc-legend-item:nth-child(3) .elasticalc-legend-swatch {
    background: #034561 !important; 
  }

  /* Hide all body direct children that aren't the wrapper and don't contain the wrapper */
  /* This prevents hiding wrapper children while still hiding page content */
  body > *:not(.elasticalc-wrapper):not(:has(.elasticalc-wrapper)) {
    display: none !important;
  }
  
  /* Also hide nested elements inside those hidden containers */
  body > *:not(.elasticalc-wrapper):not(:has(.elasticalc-wrapper)) * {
    display: none !important;
  }

  /* Hide common WordPress theme elements even if they contain the wrapper */
  /* These should never appear in PDF exports */
  header,
  header *,
  footer,
  footer *,
  nav,
  nav *,
  aside,
  aside *,
  .site-header,
  .site-header *,
  .site-footer,
  .site-footer *,
  .main-navigation,
  .main-navigation *,
  .sidebar,
  .sidebar *,
  #header,
  #header *,
  #footer,
  #footer *,
  #nav,
  #nav *,
  #sidebar,
  #sidebar * {
    display: none !important;
  }

  /* Hide WordPress content areas that don't contain the wrapper */
  main:not(:has(.elasticalc-wrapper)),
  main:not(:has(.elasticalc-wrapper)) *,
  article:not(:has(.elasticalc-wrapper)),
  article:not(:has(.elasticalc-wrapper)) *,
  .entry-content:not(:has(.elasticalc-wrapper)),
  .entry-content:not(:has(.elasticalc-wrapper)) *,
  .post-content:not(:has(.elasticalc-wrapper)),
  .post-content:not(:has(.elasticalc-wrapper)) *,
  .content-area:not(:has(.elasticalc-wrapper)),
  .content-area:not(:has(.elasticalc-wrapper)) *,
  .site-main:not(:has(.elasticalc-wrapper)),
  .site-main:not(:has(.elasticalc-wrapper)) *,
  .wp-block-group:not(:has(.elasticalc-wrapper)),
  .wp-block-group:not(:has(.elasticalc-wrapper)) *,
  .wp-block-columns:not(:has(.elasticalc-wrapper)),
  .wp-block-columns:not(:has(.elasticalc-wrapper)) *,
  .wp-block-column:not(:has(.elasticalc-wrapper)),
  .wp-block-column:not(:has(.elasticalc-wrapper)) * {
    display: none !important;
  }

  /* Hide Gutenberg blocks that don't contain the wrapper */
  [class*="wp-block-"]:not(:has(.elasticalc-wrapper)):not(.elasticalc-wrapper),
  [class*="wp-block-"]:not(:has(.elasticalc-wrapper)):not(.elasticalc-wrapper) * {
    display: none !important;
  }

  /* Hide Stackable blocks that don't contain the wrapper */
  [class*="stk-"]:not(:has(.elasticalc-wrapper)):not(.elasticalc-wrapper),
  [class*="stk-"]:not(:has(.elasticalc-wrapper)):not(.elasticalc-wrapper) * {
    display: none !important;
  }

  /* Ensure wrapper displays as block and is always visible */
  .elasticalc-wrapper {
    display: block !important;
    visibility: visible !important;
  }

  /* Ensure all wrapper children are visible */
  .elasticalc-wrapper * {
    visibility: visible !important;
  }

  /* Fallback for browsers that don't support :has() - hide all except wrapper */
  @supports not selector(:has(*)) {
    body > *:not(.elasticalc-wrapper) {
      display: none !important;
    }
    body > *:not(.elasticalc-wrapper) * {
      display: none !important;
    }
    /* Hide WordPress content areas */
    main:not(.elasticalc-wrapper),
    main:not(.elasticalc-wrapper) *,
    article:not(.elasticalc-wrapper),
    article:not(.elasticalc-wrapper) *,
    .entry-content:not(.elasticalc-wrapper),
    .entry-content:not(.elasticalc-wrapper) *,
    .post-content:not(.elasticalc-wrapper),
    .post-content:not(.elasticalc-wrapper) *,
    .content-area:not(.elasticalc-wrapper),
    .content-area:not(.elasticalc-wrapper) * {
      display: none !important;
    }
    /* Hide Gutenberg and Stackable blocks */
    [class*="wp-block-"]:not(.elasticalc-wrapper),
    [class*="wp-block-"]:not(.elasticalc-wrapper) *,
    [class*="stk-"]:not(.elasticalc-wrapper),
    [class*="stk-"]:not(.elasticalc-wrapper) * {
      display: none !important;
    }
  }

  /* Show Logo & Subtitle */
  .elasticalc-pdf-logo,
  .elasticalc-pdf-subtitle {
    display: block;
  }

  /* Position calculator at top-left */
  .elasticalc-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: #fff;
    border: none;
    box-shadow: none;
  }

  /* Hide Buttons */
  .elasticalc-button-row {
    display: none !important;
  }

  /* Adjust Layout for Print */
  .elasticalc-col-30,
  .elasticalc-col-70 {
    flex: 1 1 100%;
    display: block;
    width: 100%;
  }

  /* Hide input fields and sliders in print */
  .elasticalc-input,
  .elasticalc-slider,
  .elasticalc-input-group,
  .elasticalc-input-wrapper {
    display: none !important;
  }

  /* Show PDF input list */
  .elasticalc-pdf-input-list {
    display: block !important;
    list-style: disc;
    margin: 20px 0;
    padding-left: 30px;
    font-size: 14px;
    line-height: 1.6;
  }

  .elasticalc-pdf-input-list li {
    margin-bottom: 8px;
  }

  /* Hide input column in print, show only results and chart */
  .elasticalc-col-30 {
    display: none !important;
  }

  /* Ensure results and charts are visible and properly ordered */
  .elasticalc-col-70 {
    display: block !important;
    width: 100%;
  }

  /* Simplify Result Cards for PDF */
  .elasticalc-result-card {
    background: #f0ffe9 !important;
    padding: 8px 12px !important;
    margin-bottom: 3px !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 4px;
  }

  .elasticalc-result-card-title {
    display: inline !important;
    font-size: 18px !important;
    margin-bottom: 0 !important;
    margin-right: 8px;
  }

  .elasticalc-result-card-title::after {
    content: ": ";
  }

  .elasticalc-result-card-value-lg,
  .elasticalc-result-card-value-md,
  .elasticalc-result-card-value-sm {
    display: inline !important;
    font-size: 18px !important;
    font-weight: bold !important;
    margin-left: 0;
  }

  .elasticalc-result-card-subtitle {
    display: inline !important;
    font-size: 14px !important;
    margin-top: 0 !important;
    margin-left: 8px;
    color: #666 !important;
  }

  .elasticalc-result-card-subtitle::before {
    content: "(";
  }

  .elasticalc-result-card-subtitle::after {
    content: ")";
  }

  /* Reduce spacing in result grid */
  .elasticalc-grid {
    margin-top: 5px !important;
    gap: 3px !important;
  }

  .elasticalc-result-card--large {
    text-align: left !important;
  }

  /* Ensure charts are visible */
  .elasticalc-chart-wrapper {
    display: block !important;
    visibility: visible !important;
    margin-top: 20px !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .elasticalc-chart {
    display: flex !important;
    visibility: visible !important;
    height: 300px !important;
    width: 100% !important;
    min-height: 300px !important;
    break-inside: avoid;
    overflow: visible !important;
    position: relative !important;
  }

  .elasticalc-chart-bar {
    display: flex !important;
    visibility: visible !important;
    flex: 1 !important;
    min-width: 0 !important;
    height: 300px !important;
    min-height: 300px !important;
    align-items: flex-end !important;
    flex-direction: column-reverse !important;
    position: relative !important;
  }

  .elasticalc-chart-segment {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    min-height: 1px !important;
    position: relative !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  /* Add border to chart container for visibility */
  .elasticalc-chart {
    border: 1px solid #ddd !important;
    background: #fafafa !important;
  }

  /* Hide chart tooltips in print (they're interactive) */
  .elasticalc-chart-tooltip {
    display: none !important;
  }

  /* Show chart legend in PDF */
  .elasticalc-legend {
    display: flex !important;
    margin-top: 10px !important;
    font-size: 12px !important;
  }

  /* Fix legend swatch sizes and add actual colors for html2canvas */
  .elasticalc-legend-swatch {
    width: 12px !important;
    height: 12px !important;
  }
  
  /* Override CSS variables with actual colors for canvas capture */
  .elasticalc-legend-item:nth-child(1) .elasticalc-legend-swatch {
    background: #AF121D !important; /* Initial/Start color */
  }
  
  .elasticalc-legend-item:nth-child(2) .elasticalc-legend-swatch {
    background: #409D9B !important; /* Contributions/Saving color */
  }
  
  .elasticalc-legend-item:nth-child(3) .elasticalc-legend-swatch {
    background: #034561 !important; /* Return color */
  }

  /* Show chart axis labels in PDF */
  .elasticalc-chart-axis-labels {
    display: flex !important;
    font-size: 11px !important;
    margin-top: 5px !important;
  }

  /* Show canvas image for print */
  .elasticalc-chart-image-print {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 300px !important;
    margin-top: 20px !important;
    border: 1px solid #ddd !important;
    break-inside: avoid !important; /* Prevent splitting across pages */
  }

  /* Force hide elements that have been replaced by canvas */
  .elasticalc-hidden-print {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Hide original chart when converted to image */
  .elasticalc-chart[data-original-display] {
    display: none !important;
  }
}