/**
 * tfh-common.css
 * =============================================================
 * TFH Design System — Shared UI Stylesheet
 * Site    : thefinancialhygiene.com
 * Version : 1.0.0
 * Updated : 2026-02-18
 *
 * PURPOSE
 * -------
 * Single source of truth for all visual design tokens and
 * reusable UI components across every calculator page.
 * Loaded once by the WordPress adapter; never duplicated
 * in individual calculator CSS files.
 *
 * FONTS (must be enqueued separately by adapter)
 * -----------------------------------------------
 * Body : DM Sans     — https://fonts.google.com/specimen/DM+Sans
 * Mono : IBM Plex Mono — https://fonts.google.com/specimen/IBM+Plex+Mono
 * Google Fonts URL:
 *   https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap
 *
 * SECTIONS
 * --------
 *  1.  Design Tokens (:root)
 *  2.  Reset & Base
 *  3.  Calculator Wrapper
 *  4.  Card
 *  5.  Page Header
 *  6.  Badge
 *  7.  Form Row & Label
 *  8.  Input & Select
 *  9.  Slider
 * 10.  Buttons
 * 11.  Button Row & Standard Margin
 * 12.  Loader & Success Flash
 * 13.  Divider
 * 14.  Results Section
 * 15.  KPI Grid & KPI Card
 * 16.  Data Table
 * 17.  Chart Container & Bar Chart Layout
 * 18.  Callout
 * 19.  Calculator Mode Disclosure (Expanders)
 * 20.  TFHDetailedInput Component
 *        20a. Tabs
 *        20b. Table Entry Panel
 *        20c. File Upload Panel
 *        20d. Import Summary
 * 21.  Tooltip
 * 22.  Page Sections (How To / Assumptions / FAQ / Disclaimer)
 * 23.  Helper / Utility Classes
 * 24.  Mobile Breakpoints
 * 25.  Consent Banner
 * =============================================================
 */


/* =============================================================
   1. DESIGN TOKENS
   All values consumed via var(--tfh-*). Never hardcode colours,
   fonts, or spacing directly in component rules below.
   ============================================================= */
:root {

  /* -- Surfaces ------------------------------------------------ */
  --tfh-bg:            #FAFAF8;   /* page background              */
  --tfh-surface:       #FFFFFF;   /* cards, inputs                */
  --tfh-surface-2:     #F4F4F0;   /* subtle section backgrounds   */
  --tfh-surface-3:     #EAEAE4;   /* slider track, hover states   */

  /* -- Text ---------------------------------------------------- */
  --tfh-text:          #141412;   /* primary text                 */
  --tfh-text-muted:    #6B6B63;   /* secondary / helper text      */
  --tfh-text-faint:    #A8A89E;   /* placeholder, axis labels     */

  /* -- Borders ------------------------------------------------- */
  --tfh-border:        rgba(20,20,18,0.10);  /* default border    */
  --tfh-border-strong: rgba(20,20,18,0.22);  /* input borders     */
  --tfh-border-focus:  rgba(20,20,18,0.55);  /* focused input     */

  /* -- Accent (functional green — growth / success / CTA) ------ */
  --tfh-accent:        #1A6B4A;
  --tfh-accent-light:  #E8F5EE;
  --tfh-accent-hover:  #155C3E;
  --tfh-teal:          var(--tfh-accent);

  /* -- Button -------------------------------------------------- */
  --tfh-btn-bg:        #141412;
  --tfh-btn-text:      #FFFFFF;

  /* -- Semantic Status ----------------------------------------- */
  --tfh-ok-bg:         #E8F5EE;
  --tfh-ok-border:     #2da44e;
  --tfh-ok-text:       #116329;

  --tfh-err-bg:        #FFEBE9;
  --tfh-err-border:    #cf222e;
  --tfh-err-text:      #a40e26;

  --tfh-busy-bg:       #FFF8C5;
  --tfh-busy-border:   #9a6700;
  --tfh-busy-text:     #7d4e00;

  --tfh-info-bg:       #EEF3FF;
  --tfh-info-border:   #4969D4;
  --tfh-info-text:     #2D3E9E;

  /* -- Typography ---------------------------------------------- */
  /* WHY DM Sans: clean, modern, deliberate — suits a finance tool
     targeting professional audiences. Not a default/system font. */
  --tfh-font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* WHY IBM Plex Mono: renders standard zeros (no slash), excellent
     digit alignment in financial tables, designed for data. */
  --tfh-font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* -- Type Scale ---------------------------------------------- */
  --tfh-text-xs:   11px;   /* labels, badges, axis text          */
  --tfh-text-sm:   13px;   /* helper text, table cells, buttons  */
  --tfh-text-base: 14px;   /* default body                       */
  --tfh-text-md:   15px;   /* intro paragraph                    */
  --tfh-text-lg:   18px;   /* section headings                   */
  --tfh-text-kpi:  22px;   /* KPI values                         */
  --tfh-text-hero: 24px;   /* page title                         */

  /* -- Spacing Scale ------------------------------------------- */
  --tfh-space-1:  4px;
  --tfh-space-2:  8px;
  --tfh-space-3:  12px;
  --tfh-space-4:  16px;
  --tfh-space-5:  20px;
  --tfh-space-6:  24px;
  --tfh-space-8:  32px;

  /* -- Layout -------------------------------------------------- */
  --tfh-card-pad:    24px;
  --tfh-row-gap:     12px;  /* gap between label and input col   */
  --tfh-row-margin:  14px;  /* vertical margin between form rows */
  --tfh-label-col:   250px; /* fixed label column width          */
  --tfh-input-col:   340px; /* fixed input column width          */
  --tfh-max-width:   1100px;

  /* -- Radii --------------------------------------------------- */
  --tfh-radius-sm:   6px;
  --tfh-radius-md:   10px;
  --tfh-radius-lg:   14px;
  --tfh-radius-full: 999px;

  /* -- Shadows ------------------------------------------------- */
  --tfh-shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --tfh-shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --tfh-shadow-focus: 0 0 0 3px rgba(26,107,74,0.18);
  --tfh-chart-fs-overlay-bg: rgba(15,23,42,0.92);
  --tfh-chart-dark-control-bg: rgba(30,41,59,0.9);
  --tfh-chart-dark-control-border: rgba(255,255,255,0.15);
  --tfh-chart-dark-control-text: #E2E8F0;

  /* -- Transitions --------------------------------------------- */
  --tfh-transition: 150ms ease;

  /* -- Component-specific ------------------------------------- */
  /* WHY a token: ensures every button row has identical top
     spacing site-wide. Change once here, applies everywhere. */
  --tfh-btn-margin-top: 20px;
}


/* =============================================================
   2. RESET & BASE
   Minimal reset scoped to calculator context only.
   Does not override global WordPress theme styles.
   ============================================================= */
.tfh-calculator *,
.tfh-calculator *::before,
.tfh-calculator *::after {
  box-sizing: border-box;
}

.tfh-calculator {
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-base);
  color: var(--tfh-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Page-level background — applied to body by adapter if needed */
.tfh-page-bg {
  background: var(--tfh-bg);
}


/* =============================================================
   3. CALCULATOR WRAPPER
   Centres content and constrains max width.
   Every calculator page is wrapped in .tfh-calculator.
   ============================================================= */
.tfh-calculator {
  max-width: var(--tfh-max-width);
  margin: 0 auto;
  padding: 20px 16px;
}

[data-fc-calculator],
[data-tfh-calculator] {
  max-width: var(--tfh-max-width);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* =============================================================
   4. CARD
   Container for form sections and result sections.
   Use .tfh-card for any visually grouped block.
   ============================================================= */
.tfh-card {
  background: var(--tfh-surface);
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-lg);
  padding: var(--tfh-card-pad);
  box-shadow: var(--tfh-shadow-sm);
}

/* Stack consecutive cards with consistent spacing */
.tfh-card + .tfh-card {
  margin-top: var(--tfh-space-4);
}


/* =============================================================
   5. PAGE HEADER
   Humble, bordered header shown at top of every calculator page.
   Contains: badge, title, intro paragraph.
   ============================================================= */
.tfh-tool__header {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-lg);
  background: var(--tfh-surface);
  padding: 16px 20px;
  margin-bottom: var(--tfh-space-5);
}

.tfh-tool__title {
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-hero);
  font-weight: 700;
  color: var(--tfh-teal);
  line-height: 1.25;
  margin-bottom: var(--tfh-space-2);
  /* Reset any theme heading margins */
  margin-top: 0;
}

.tfh-tool__intro {
  color: var(--tfh-text-muted);
  font-size: var(--tfh-text-base);
  line-height: 1.6;
  max-width: 680px;
  margin: 0;
}

.tfh-tool__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tfh-space-3);
  margin-top: var(--tfh-space-3);
}

.tfh-tool__link {
  font-size: var(--tfh-text-sm);
  color: #3B6FD8;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--tfh-transition);
}

.tfh-tool__link:hover,
.tfh-tool__link:focus {
  color: #2F5FC2;
}

.tfh-tool__link:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,111,216,0.22);
  border-radius: 2px;
}

/* Default link styling inside calculators */
.tfh-calculator a:not(.tfh-button) {
  color: #3B6FD8;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--tfh-transition);
}

.tfh-calculator a:not(.tfh-button):hover,
.tfh-calculator a:not(.tfh-button):focus {
  color: #2F5FC2;
}

.tfh-calculator a:not(.tfh-button):focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,111,216,0.22);
  border-radius: 2px;
}


/* =============================================================
   6. BADGE
   Small pill label. Used for "Educational Tool" etc.
   Appears above the page title.
   ============================================================= */
.tfh-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--tfh-radius-full);
  border: 1px solid var(--tfh-border-strong);
  font-size: var(--tfh-text-xs);
  font-weight: 500;
  color: var(--tfh-text-muted);
  background: var(--tfh-surface);
  letter-spacing: 0.01em;
  margin-bottom: var(--tfh-space-2);
  /* Prevent theme link styles from applying if inside <a> */
  text-decoration: none;
}


/* =============================================================
   7. FORM ROW & LABEL
   Two-column grid: label | input.
   Collapses to single column on mobile (see section 24).
   ============================================================= */
.tfh-row {
  display: grid;
  grid-template-columns: var(--tfh-label-col) var(--tfh-input-col);
  gap: var(--tfh-row-gap);
  align-items: center;
  margin: var(--tfh-row-margin) 0;
}

.tfh-label {
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-text);
  line-height: 1.4;
  /* Reset theme label styles */
  margin: 0;
  padding: 0;
}

/* Optional sub-hint below label text */
.tfh-label__hint {
  display: block;
  font-size: var(--tfh-text-xs);
  font-weight: 400;
  color: var(--tfh-text-muted);
  margin-top: 2px;
}


/* =============================================================
   8. INPUT & SELECT
   Shared styles for all text inputs and dropdowns.
   Uses !important only where WordPress theme overrides require.
   ============================================================= */
.tfh-input,
.tfh-select {
  width: 100% !important;
  min-width: 0 !important;
  padding: 10px 13px !important;
  border: 1px solid var(--tfh-border-strong) !important;
  border-radius: var(--tfh-radius-md) !important;
  background: var(--tfh-surface) !important;
  font-family: var(--tfh-font-body) !important;
  font-size: var(--tfh-text-base) !important;
  color: var(--tfh-text) !important;
  line-height: 1.4 !important;
  transition: border-color var(--tfh-transition), box-shadow var(--tfh-transition);
  appearance: none;
  -webkit-appearance: none;
  /* Reset theme box-shadow if any */
  box-shadow: none !important;
}

/* Custom dropdown arrow — avoids browser default arrow inconsistency */
.tfh-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236B6B63' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 34px !important;
}

.tfh-input:focus,
.tfh-select:focus {
  outline: none !important;
  border-color: var(--tfh-border-focus) !important;
  box-shadow: var(--tfh-shadow-focus) !important;
}

.tfh-input::placeholder {
  color: var(--tfh-text-faint);
}

/* Error state — applied by JS on validation failure */
.tfh-input--error {
  border-color: var(--tfh-err-border) !important;
  box-shadow: 0 0 0 3px rgba(207,34,46,0.12) !important;
}

/* Date input — used in PPF opening/as-of date fields */
.tfh-input[type="date"] {
  font-family: var(--tfh-font-body) !important;
}

/* Number input — remove browser spin buttons for cleaner look */
.tfh-input[type="number"]::-webkit-outer-spin-button,
.tfh-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tfh-input[type="number"] {
  -moz-appearance: textfield;
}

/* Generic disabled-state flag styling.
   Flag source: TFHRenderer.syncDisabledState/watchDisabledState in tfh-common.js */
.tfh-row[data-tfh-disabled="1"] .tfh-label {
  color: var(--tfh-text-faint);
}

.tfh-calculator .tfh-input[data-tfh-disabled="1"],
.tfh-calculator .tfh-select[data-tfh-disabled="1"],
.tfh-calculator textarea.tfh-input[data-tfh-disabled="1"] {
  background: var(--tfh-surface-2) !important;
  border-color: var(--tfh-border) !important;
  color: var(--tfh-text-muted) !important;
  cursor: not-allowed !important;
}

.tfh-calculator .tfh-button[data-tfh-disabled="1"],
.tfh-calculator .tfh-button.tfh-is-disabled {
  background: var(--tfh-surface-3) !important;
  border-color: var(--tfh-border) !important;
  color: var(--tfh-text-muted) !important;
  opacity: 1 !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: not-allowed !important;
}


/* =============================================================
   9. SLIDER
   Used for percentage allocation inputs (e.g. Monte Carlo
   portfolio split). Plain number input used for precise fields.
   ============================================================= */
.tfh-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.tfh-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--tfh-surface-3);
  border-radius: var(--tfh-radius-full);
  outline: none;
  cursor: pointer;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.tfh-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tfh-accent);
  border: 2px solid var(--tfh-surface);
  box-shadow: var(--tfh-shadow-sm);
  cursor: pointer;
  transition: transform var(--tfh-transition);
}

.tfh-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.tfh-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tfh-accent);
  border: 2px solid var(--tfh-surface);
  box-shadow: var(--tfh-shadow-sm);
  cursor: pointer;
}

/* Live value display next to slider */
.tfh-slider-val {
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-accent);
  font-family: var(--tfh-font-mono);
}


/* =============================================================
   9b. TOGGLE SWITCH
   Binary on/off toggle. Used for feature flags inside results
   (e.g. Historical Market Simulation on/off).
   ============================================================= */
.tfh-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* Visually hide the native checkbox; keep it accessible */
.tfh-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* The pill track */
.tfh-toggle__track {
  display: inline-block;
  width: 40px;
  height: 22px;
  background: var(--tfh-surface-3);
  border-radius: var(--tfh-radius-full);
  border: 1px solid var(--tfh-border);
  transition: background var(--tfh-transition), border-color var(--tfh-transition);
  position: relative;
  flex-shrink: 0;
}

/* The sliding knob */
.tfh-toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--tfh-surface);
  border-radius: 50%;
  box-shadow: var(--tfh-shadow-sm);
  transition: transform var(--tfh-transition);
}

/* Checked state: green track + knob slides right */
.tfh-toggle input:checked ~ .tfh-toggle__track {
  background: var(--tfh-accent);
  border-color: var(--tfh-accent);
}

.tfh-toggle input:checked ~ .tfh-toggle__track::after {
  transform: translateX(18px);
}

/* Keyboard focus ring */
.tfh-toggle input:focus-visible ~ .tfh-toggle__track {
  outline: 2px solid var(--tfh-border-focus);
  outline-offset: 2px;
}


/* =============================================================
   10. BUTTONS
   Primary (dark), Light (outlined), Accent (green).
   Small modifier available for table row actions.
   ============================================================= */
.tfh-button {
  display: inline-flex !important;
  align-items: center !important;
  gap: var(--tfh-space-2) !important;
  padding: 10px 20px !important;
  border-radius: var(--tfh-radius-md) !important;
  border: 1px solid rgba(0,0,0,0.15) !important;
  background: var(--tfh-btn-bg) !important;
  color: var(--tfh-btn-text) !important;
  font-family: var(--tfh-font-body) !important;
  font-size: var(--tfh-text-sm) !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  letter-spacing: 0.01em !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
  transition:
    background var(--tfh-transition),
    transform var(--tfh-transition),
    box-shadow var(--tfh-transition) !important;
}

.tfh-button:hover {
  background: #2a2a26 !important;
  box-shadow: var(--tfh-shadow-sm) !important;
  transform: translateY(-1px) !important;
}

.tfh-button:active {
  transform: translateY(0) !important;
}

.tfh-button:disabled,
.tfh-button[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Light variant — for secondary actions (Add Row, Prev/Next page) */
.tfh-button--light {
  background: var(--tfh-surface) !important;
  color: var(--tfh-text) !important;
  border: 1px solid var(--tfh-border-strong) !important;
}

.tfh-button--light:hover {
  background: var(--tfh-surface-2) !important;
  box-shadow: var(--tfh-shadow-sm) !important;
}

/* Accent variant — for high-priority CTAs */
.tfh-button--accent {
  background: var(--tfh-accent) !important;
  border-color: var(--tfh-accent-hover) !important;
}

.tfh-button--accent:hover {
  background: var(--tfh-accent-hover) !important;
}

/* Small variant — table row actions, pagination */
.tfh-button--sm {
  padding: 6px 12px !important;
  font-size: var(--tfh-text-xs) !important;
  border-radius: var(--tfh-radius-sm) !important;
}

/* Danger variant — remove/delete row actions */
.tfh-button--danger {
  background: var(--tfh-surface) !important;
  color: var(--tfh-err-text) !important;
  border-color: var(--tfh-err-border) !important;
}

.tfh-button--danger:hover {
  background: var(--tfh-err-bg) !important;
}


/* =============================================================
   11. BUTTON ROW & STANDARD MARGIN
   WHY a dedicated class: ensures every calculate button has
   identical top spacing (--tfh-btn-margin-top) site-wide.
   Never rely on tfh-row margin for button placement.
   ============================================================= */
.tfh-btn-row {
  margin-top: var(--tfh-btn-margin-top);
  display: flex;
  align-items: center;
  gap: var(--tfh-space-3);
  flex-wrap: wrap;
}

/* Button group for multiple buttons side by side */
.tfh-btn-group {
  display: flex;
  gap: var(--tfh-space-2);
  align-items: center;
  flex-wrap: wrap;
}


/* =============================================================
   12. LOADER & SUCCESS FLASH
   Appears below the calculate button during async computation.
   WHY below (not beside): avoids layout shift; clearer feedback.
   Controlled by JS: add/remove .is-visible class.
   ============================================================= */
.tfh-loader {
  display: none;
  margin-top: var(--tfh-space-3);
}

.tfh-loader.is-visible {
  display: block;
}

.tfh-loader__bar-wrap {
  height: 3px;
  background: var(--tfh-surface-3);
  border-radius: var(--tfh-radius-full);
  overflow: hidden;
}

.tfh-loader__bar {
  height: 100%;
  width: 0%;
  border-radius: var(--tfh-radius-full);
  transition: width 0.4s ease;
}

/* Indeterminate animation — used when compute time is unknown */
.tfh-loader__bar.is-computing {
  background: var(--tfh-accent);
  animation: tfh-indeterminate 1.4s ease infinite;
}

@keyframes tfh-indeterminate {
  0%   { width: 0%;  margin-left: 0;    }
  50%  { width: 60%; margin-left: 20%;  }
  100% { width: 0%;  margin-left: 100%; }
}

/* Determinate — set width via JS when progress is known */
.tfh-loader__bar.is-determinate {
  background: var(--tfh-accent);
  animation: none;
}

.tfh-loader__label {
  margin-top: 5px;
  font-size: var(--tfh-text-xs);
  color: var(--tfh-text-muted);
  font-weight: 500;
}

/* Brief success confirmation after compute completes */
.tfh-success-flash {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-ok-text);
  margin-top: var(--tfh-space-2);
  animation: tfh-fadein 0.3s ease;
}

.tfh-success-flash.is-visible {
  display: flex;
}

/* Error message below button */
.tfh-error-text {
  display: none;
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-err-text);
  margin-top: var(--tfh-space-2);
}

.tfh-error-text.is-visible {
  display: block;
}

@keyframes tfh-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}


/* =============================================================
   13. DIVIDER
   ============================================================= */
.tfh-divider {
  border: none;
  border-top: 1px solid var(--tfh-border);
  margin: var(--tfh-space-6) 0;
}


/* =============================================================
   14. RESULTS SECTION
   Container that appears after successful calculation.
   Hidden initially; shown by JS once engine returns ok:true.
   ============================================================= */
.tfh-results {
  margin-top: var(--tfh-space-5);
  padding-top: var(--tfh-space-5);
  border-top: 1px solid var(--tfh-border);
}

.tfh-results__section {
  margin-bottom: var(--tfh-space-5);
}

.tfh-results__section-title {
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-lg);
  font-weight: 700;
  color: var(--tfh-text);
  line-height: 1.3;
  letter-spacing: 0.01em;
  margin: 0 0 var(--tfh-space-3) 0;
}

.tfh-results__section-hint {
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  margin: 0 0 var(--tfh-space-3) 0;
}


/* =============================================================
   15. KPI GRID & KPI CARD
   Grid: auto-fit with minmax — adapts to any card count.
   Standard: minmax(180px, 1fr) — SIP / Monte Carlo.
   Compact:  minmax(140px, 1fr) — PPF (many small KPIs).
   Hero card mapping is done in calculator-specific JS,
   NOT in the engine response (UI concern only).
   ============================================================= */
.tfh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--tfh-space-3);
  margin-bottom: var(--tfh-space-5);
}

/* Compact variant — more cards, smaller minimum width */
.tfh-kpi-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--tfh-space-2);
}

.tfh-kpi-card {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  padding: 14px 16px;
  background: var(--tfh-surface-2);
  transition: box-shadow var(--tfh-transition);
}

.tfh-kpi-card:hover {
  box-shadow: var(--tfh-shadow-sm);
}

/* Hero card — dark. Applied by TFHRenderer based on calculator JS style map */
.tfh-kpi-card--dark {
  background: var(--tfh-text);
  border-color: var(--tfh-text);
}

/* Secondary accent card — green */
.tfh-kpi-card--green {
  background: var(--tfh-accent-light);
  border-color: rgba(26,107,74,0.20);
}

/* Alias names used by calculator bindings (master doc naming). */
.tfh-kpi-card--primary {
  background: var(--tfh-text);
  border-color: var(--tfh-text);
}

.tfh-kpi-card--accent {
  background: var(--tfh-accent-light);
  border-color: rgba(26,107,74,0.20);
}

/* KPI label row */
.tfh-kpi-key {
  font-size: var(--tfh-text-xs);
  font-weight: 600;
  color: var(--tfh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  line-height: 1.3;
}

.tfh-kpi-card--dark  .tfh-kpi-key { color: rgba(255,255,255,0.55); }
.tfh-kpi-card--green .tfh-kpi-key { color: var(--tfh-accent);      }
.tfh-kpi-card--primary .tfh-kpi-key { color: rgba(255,255,255,0.55); }
.tfh-kpi-card--accent .tfh-kpi-key { color: var(--tfh-accent); }

/* KPI value — IBM Plex Mono for financial number alignment */
.tfh-kpi-val {
  font-family: var(--tfh-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 2.2vw, var(--tfh-text-kpi));
  font-weight: 500;
  color: var(--tfh-text);
  line-height: 1.2;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.tfh-kpi-card--dark  .tfh-kpi-val { color: #ffffff;           }
.tfh-kpi-card--green .tfh-kpi-val { color: var(--tfh-accent); }
.tfh-kpi-card--primary .tfh-kpi-val { color: #ffffff; }
.tfh-kpi-card--accent .tfh-kpi-val { color: var(--tfh-accent); }

/* Smaller value size in compact variant */
.tfh-kpi-grid--compact .tfh-kpi-val {
  font-size: var(--tfh-text-lg);
}


/* =============================================================
   16. DATA TABLE
   Used for: Year-by-Year schedule, Loan eligibility,
   Withdrawal eligibility, Monte Carlo percentile table.
   First column uses body font (labels); data columns use mono.
   ============================================================= */
.tfh-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  background: var(--tfh-surface);
  box-shadow: var(--tfh-shadow-sm);
  /* Enables horizontal scroll on mobile without breaking layout */
  -webkit-overflow-scrolling: touch;
}

.tfh-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px; /* prevents columns from collapsing too narrow */
}

.tfh-table th {
  background: var(--tfh-surface-2);
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-xs);
  font-weight: 700;
  color: var(--tfh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--tfh-border);
  white-space: nowrap;
}

.tfh-table td {
  /* WHY IBM Plex Mono: standard zeros, aligned decimal points,
     professional appearance for financial data cells. */
  font-family: var(--tfh-font-mono);
  font-size: var(--tfh-text-sm);
  padding: 10px 12px;
  border-bottom: 1px solid var(--tfh-border);
  color: var(--tfh-text);
  white-space: nowrap;
}

.tfh-table tr:last-child td {
  border-bottom: none;
}

.tfh-table tbody tr:hover td {
  background: var(--tfh-surface-2);
}

/* First column: year label / category — body font, not mono */
.tfh-table td:first-child,
.tfh-table th:first-child {
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-text);
}

/* Market events table uses body font for all cells to match surrounding copy. */
.tfh-market-events-table td,
.tfh-market-events-table th {
  font-family: var(--tfh-font-body);
}


/* =============================================================
   17. CHART CONTAINER & BAR CHART LAYOUT
   .tfh-chart-wrap: outer bordered container for any chart.
   .tfh-bar-*: CSS layout for bar chart (Chart.js canvas sits
   inside .tfh-chart-wrap; these classes handle axis labelling).
   In production, Chart.js renders inside a <canvas> element.
   ============================================================= */
.tfh-chart-wrap {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  padding: 16px;
  background: var(--tfh-surface);
  box-shadow: var(--tfh-shadow-sm);
  position: relative;
  /* Prevent canvas from exceeding container */
  overflow: hidden;
}

.tfh-chart-wrap canvas {
  /* Do NOT set height: auto !important here — that overrides Chart.js inline
     height calculations and collapses the canvas on mobile viewports. */
  max-width: 100%;
  display: block;
}

/* Explicit-height wrapper that Chart.js measures when maintainAspectRatio:false.
   Isolates canvas sizing from the chart title above it, giving Chart.js a clean
   bounding box to fill. Mobile heights are overridden in section 24. */
.tfh-chart-canvas-wrap {
  position: relative;
  height: 280px;
}

.tfh-chart-title {
  font-size: var(--tfh-text-xs);
  font-weight: 700;
  color: var(--tfh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--tfh-space-3);
}

/* Axis label wrappers — used to label X and Y axes */
.tfh-chart-x-label,
.tfh-chart-y-label-text {
  font-size: var(--tfh-text-xs);
  font-weight: 600;
  color: var(--tfh-text-muted);
  text-align: center;
  margin-top: var(--tfh-space-2);
}

/* Chart legend row */
.tfh-chart-legend {
  display: flex;
  gap: var(--tfh-space-5);
  margin-top: var(--tfh-space-3);
  flex-wrap: wrap;
}

.tfh-chart-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--tfh-text-xs);
  color: var(--tfh-text-muted);
}

.tfh-chart-legend__swatch {
  width: 20px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Reset Zoom button — CR-13. Injected by adapter inside .tfh-chart-wrap.
   Hidden by default; adapter shows/hides via inline style. */
.tfh-chart-reset-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

/* Mobile chart expand button + fullscreen modal (Phase 2). */
.tfh-chart-expand-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 11;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--tfh-border-strong);
  border-radius: var(--tfh-radius-sm);
  background: var(--tfh-surface);
  color: var(--tfh-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--tfh-shadow-sm);
}

.tfh-chart-expand-btn:hover {
  background: var(--tfh-surface-2);
}

.tfh-chart-expand-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.tfh-chart-wrap[data-chart-theme="dark"] .tfh-chart-expand-btn {
  background: var(--tfh-chart-dark-control-bg);
  border-color: var(--tfh-chart-dark-control-border);
  color: var(--tfh-chart-dark-control-text);
}

.tfh-chart-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--tfh-chart-fs-overlay-bg);
  display: flex;
}

.tfh-chart-fullscreen-body {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) auto;
  background: var(--tfh-bg);
}

.tfh-chart-fullscreen-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--tfh-space-2);
  height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--tfh-border);
  background: var(--tfh-surface);
}

.tfh-chart-fs-back,
.tfh-chart-fs-reset,
.tfh-chart-fs-close {
  border: 1px solid var(--tfh-border-strong);
  border-radius: var(--tfh-radius-sm);
  background: var(--tfh-surface);
  color: var(--tfh-text);
  font-size: var(--tfh-text-xs);
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
}

.tfh-chart-fs-title {
  font-size: var(--tfh-text-xs);
  font-weight: 700;
  color: var(--tfh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tfh-chart-fs-chart-area {
  min-height: 0;
  padding: 8px 8px 0;
}

.tfh-chart-fs-mount,
.tfh-chart-fs-mount .tfh-chart-wrap,
.tfh-chart-fs-mount .tfh-chart-canvas-wrap {
  height: 100%;
}

.tfh-chart-fs-mount .tfh-chart-wrap {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 8px;
}

.tfh-chart-fs-mount .tfh-chart-title {
  display: none;
}

.tfh-chart-fs-data-bar {
  border-top: 1px solid var(--tfh-border);
  background: var(--tfh-surface);
  padding: 6px 10px;
}

.tfh-chart-fs-data-bar .tfh-chart-mobile-year-slider {
  padding: 4px 0 4px;
}

.tfh-chart-fs-data-bar .tfh-chart-mobile-bar {
  padding: 6px 0 2px;
  border-top: 0;
}

.tfh-chart-mobile-bar {
  transition: background 180ms ease, box-shadow 180ms ease;
}

.tfh-chart-mobile-bar.is-updating {
  background: linear-gradient(90deg, rgba(37,99,235,0.08), rgba(37,99,235,0));
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.12);
}

.tfh-chart-fs-data-bar .tfh-chart-mobile-year-slider,
.tfh-chart-fs-data-bar .tfh-chart-mobile-year-slider span,
.tfh-chart-fs-data-bar .tfh-chart-mobile-bar,
.tfh-chart-fs-data-bar .tfh-chart-mobile-bar span {
  color: var(--tfh-text) !important;
}

/* Year slider < > navigation buttons.
   Sit inside .tfh-chart-mobile-year-slider on both inline and fullscreen views. */
.tfh-chart-mobile-year-nav-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--tfh-border-strong);
  border-radius: var(--tfh-radius-sm);
  background: var(--tfh-surface);
  color: var(--tfh-text);
  font-size: var(--tfh-text-sm);
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tfh-chart-mobile-year-nav-btn:hover:not(:disabled) {
  background: var(--tfh-surface-2);
}

.tfh-chart-mobile-year-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Dark chart: match the other control-button tokens. */
.tfh-chart-wrap[data-chart-theme="dark"] .tfh-chart-mobile-year-nav-btn {
  background: var(--tfh-chart-dark-control-bg);
  border-color: var(--tfh-chart-dark-control-border);
  color: var(--tfh-chart-dark-control-text);
}

/* Fullscreen data bar: inherit surface text colour. */
.tfh-chart-fs-data-bar .tfh-chart-mobile-year-nav-btn {
  color: var(--tfh-text) !important;
}

/* Annotation HTML table — CR-14. Rendered by adapter on mobile (< 600px). */
.tfh-chart-annotations {
  margin-top: var(--tfh-space-2);
}

/* Dark chart variant — applied when adapter sets data-chart-theme="dark"
   or when JS theme option is 'dark' (which is the sitewide default).
   Section 12.2 of REQ_ChartAdapterPattern_ECharts_TradingView. */
.tfh-chart-wrap[data-chart-theme="dark"] {
  background: #0F172A;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.tfh-chart-wrap[data-chart-theme="dark"] .tfh-chart-title {
  color: #94A3B8;
}

.tfh-chart-wrap[data-chart-theme="dark"] .tfh-chart-legend__item {
  color: #94A3B8;
}

.tfh-chart-wrap[data-chart-theme="dark"] .tfh-chart-reset-zoom {
  /* Ensure button is visible against dark background */
  background: var(--tfh-chart-dark-control-bg);
  border-color: var(--tfh-chart-dark-control-border);
  color: var(--tfh-chart-dark-control-text);
}

.tfh-chart-fullscreen-overlay .tfh-chart-wrap[data-chart-theme="dark"] {
  border-color: transparent;
}


/* =============================================================
   18. CALLOUT
   Informational boxes used inside results sections.
   Variants: default, disclaimer (dashed), warning, info.
   ============================================================= */
.tfh-callout {
  border: 1px solid transparent;
  border-radius: var(--tfh-radius-md);
  background: var(--tfh-surface-2);
  padding: 12px 14px;
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  line-height: 1.6;
  margin: var(--tfh-space-3) 0 var(--tfh-space-4);
  box-shadow: none;
}

.tfh-callout:first-child {
  margin-top: 0;
}

.tfh-callout:last-child {
  margin-bottom: 0;
}

.tfh-callout::before {
  content: 'Note: ';
  font-style: italic;
  font-weight: 600;
}

.tfh-callout--disclaimer {
  background: var(--tfh-surface);
  border-style: dashed;
  border-color: var(--tfh-border);
}

.tfh-callout--warning {
  background: rgba(255, 248, 197, 0.7);
  border-color: transparent;
  color: var(--tfh-busy-text);
}

.tfh-callout--info {
  background: rgba(238, 243, 255, 0.8);
  border-color: transparent;
  color: var(--tfh-info-text);
}

.tfh-callout--error {
  background: rgba(255, 235, 233, 0.8);
  border-color: transparent;
  color: var(--tfh-err-text);
}

.tfh-callout--warning::before {
  content: 'Warning: ';
}

.tfh-callout--info::before {
  content: 'Info: ';
}

.tfh-callout--error::before {
  content: 'Error: ';
}

.tfh-callout--disclaimer::before {
  content: 'Disclaimer: ';
}

/* Stacked callouts */
.tfh-callout + .tfh-callout {
  margin-top: var(--tfh-space-3);
}

/* Ensure breathing room between a callout and the next KPI grid. */
.tfh-callout + .tfh-kpi-grid,
.tfh-callout + .tfh-kpi-grid--compact {
  margin-top: var(--tfh-space-3);
}


/* =============================================================
   19. CALCULATOR MODE DISCLOSURE (EXPANDERS)
   One expander per calculator mode (e.g. SIP: by_amount,
   for_target, tenure). All collapsed by default.
   JS toggles .is-open on .tfh-disclosure__body.
   ============================================================= */
.tfh-disclosure {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  overflow: hidden;
  margin: var(--tfh-space-3) 0;
}

.tfh-disclosure__trigger {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100%;
  padding: 14px 18px;
  background: var(--tfh-surface);
  border: none !important;
  cursor: pointer;
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-base);
  font-weight: 600;
  color: var(--tfh-text);
  text-align: left !important;
  transition: background var(--tfh-transition);
  /* Reset WP button styles */
  box-shadow: none !important;
  border-radius: 0 !important;
  line-height: 1.35;
}

.tfh-disclosure__trigger:hover {
  background: var(--tfh-surface-2);
}

.tfh-disclosure__trigger > span:first-child {
  flex: 1 1 auto;
  padding-right: var(--tfh-space-3);
}

/* Icon: + collapsed, − expanded */
.tfh-disclosure__icon {
  font-size: 18px;
  font-weight: 400;
  color: var(--tfh-text-muted);
  flex-shrink: 0;
  line-height: 1;
  transition: transform var(--tfh-transition);
  /* Prevent icon from being selected on click */
  user-select: none;
}

.tfh-disclosure__body {
  display: none;
  padding: 16px 18px;
  border-top: 1px solid var(--tfh-border);
  background: var(--tfh-surface);
}

.tfh-disclosure__body.is-open {
  display: block;
}

.tfh-disclosure__body .tfh-error-text {
  margin-top: var(--tfh-space-3);
}

/* Shared separators */
.outer-divider {
  border-top: 1px solid var(--tfh-border);
  padding-top: var(--tfh-space-4);
}

.outer-divider > .tfh-disclosure:first-child {
  margin-top: 0;
}

.outer-divider > .tfh-card > .tfh-disclosure:first-child {
  margin-top: 0;
}

.outer-divider > .tfh-card > :first-child {
  margin-top: 0 !important;
}

.inner-divider {
  margin: 14px 0;
  border: none;
  border-top: 1px solid var(--tfh-border);
}


/* =============================================================
   20. TFHDetailedInput COMPONENT
   Handles complex transaction data entry for calculators like PPF.
   Strategy pattern: type="table" | type="fileupload" | future types.
   Tabs auto-generated by TFHDetailedInput JS based on config.
   ============================================================= */

/* 20a. Outer container & tabs --------------------------------- */
.tfh-detailed-input {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  overflow: hidden;
  background: var(--tfh-surface);
}

.tfh-detailed-input__tabs {
  display: flex;
  border-bottom: 1px solid var(--tfh-border);
  background: var(--tfh-surface-2);
}

.tfh-detailed-input__tab {
  padding: 10px 18px;
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-text-muted);
  cursor: pointer;
  border: none !important;
  background: none;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -1px;
  font-family: var(--tfh-font-body);
  transition: color var(--tfh-transition), border-color var(--tfh-transition);
  box-shadow: none !important;
  border-radius: 0 !important;
}

.tfh-detailed-input__tab:hover {
  color: var(--tfh-text);
}

.tfh-detailed-input__tab--active {
  color: var(--tfh-text) !important;
  border-bottom-color: var(--tfh-text) !important;
  background: var(--tfh-surface) !important;
}

/* Panel wrapper */
.tfh-detailed-input__panel {
  padding: 16px;
}

/* Pagination row below table */
.tfh-detailed-input__pagination {
  display: flex;
  align-items: center;
  gap: var(--tfh-space-3);
  margin-top: var(--tfh-space-3);
  flex-wrap: wrap;
}

/* Add Row button — always below table rows */
.tfh-detailed-input__add-row {
  margin-top: var(--tfh-space-3);
}

/* 20b. Table entry panel -------------------------------------- */
.tfh-input-table {
  width: 100%;
  border-collapse: collapse;
}

.tfh-input-table th {
  background: var(--tfh-surface-2);
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-xs);
  font-weight: 700;
  color: var(--tfh-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--tfh-border);
  white-space: nowrap;
}

.tfh-input-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--tfh-border);
  vertical-align: middle;
}

.tfh-input-table tr:last-child td {
  border-bottom: none;
}

/* Compact input sizing inside table rows */
.tfh-input-table .tfh-input,
.tfh-input-table .tfh-select {
  padding: 6px 10px !important;
  font-size: var(--tfh-text-sm) !important;
  min-width: 100px;
}

/* 20c. File upload panel -------------------------------------- */
.tfh-file-drop {
  border: 2px dashed var(--tfh-border-strong);
  border-radius: var(--tfh-radius-md);
  padding: var(--tfh-space-8) var(--tfh-space-6);
  text-align: center;
  cursor: pointer;
  background: var(--tfh-surface-2);
  transition:
    border-color var(--tfh-transition),
    background var(--tfh-transition);
}

.tfh-file-drop:hover,
.tfh-file-drop.is-dragover {
  border-color: var(--tfh-accent);
  background: var(--tfh-accent-light);
}

.tfh-file-drop__icon {
  font-size: 26px;
  margin-bottom: var(--tfh-space-2);
  opacity: 0.4;
  display: block;
}

.tfh-file-drop__label {
  font-size: var(--tfh-text-sm);
  font-weight: 600;
  color: var(--tfh-text);
  margin-bottom: var(--tfh-space-1);
}

.tfh-file-drop__hint {
  font-size: var(--tfh-text-xs);
  color: var(--tfh-text-muted);
}

/* Hidden native file input (triggered by .tfh-file-drop click) */
.tfh-file-input {
  display: none;
}

/* 20d. Import summary ---------------------------------------- */
.tfh-import-summary {
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  padding: var(--tfh-space-3) var(--tfh-space-4);
  background: var(--tfh-surface-2);
  border-radius: var(--tfh-radius-sm);
  border: 1px solid var(--tfh-border);
  margin-top: var(--tfh-space-3);
  line-height: 1.5;
}

.tfh-import-summary--ok {
  background: var(--tfh-ok-bg);
  border-color: var(--tfh-ok-border);
  color: var(--tfh-ok-text);
}

.tfh-import-summary--warn {
  background: var(--tfh-busy-bg);
  border-color: var(--tfh-busy-border);
  color: var(--tfh-busy-text);
}

.tfh-import-summary--err {
  background: var(--tfh-err-bg);
  border-color: var(--tfh-err-border);
  color: var(--tfh-err-text);
}


/* =============================================================
   21. TOOLTIP
   Small circular ? button. Used next to table headers and
   complex input labels to show contextual help.
   ============================================================= */
.tfh-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50% !important;
  border: 1px solid var(--tfh-border-strong) !important;
  font-size: 9px;
  font-weight: 700;
  color: var(--tfh-text-muted);
  cursor: help;
  font-family: var(--tfh-font-mono);
  vertical-align: middle;
  margin-left: 4px;
  background: var(--tfh-surface-2) !important;
  box-shadow: none !important;
  transition: background var(--tfh-transition), color var(--tfh-transition);
  line-height: 1;
}

.tfh-tip::before {
  content: 'i';
}

.tfh-tip:hover {
  background: var(--tfh-text) !important;
  color: white;
  border-color: var(--tfh-text) !important;
}


/* =============================================================
   22. PAGE SECTIONS
   Informational content below every calculator.
   Plain heading style (Option A) — no accordion chrome.
   Content is passed as config from each calculator's shortcode.
   Common JS (TFHPageSections) renders identical structure always.

   Standard section order (every calculator):
     1. How to use
     2. Assumptions
     3. Quick Notes  (optional — if calculator has noteworthy tips)
     4. FAQ
     5. Disclaimer
   ============================================================= */
.tfh-page-sections-wrap {
  border-top: 1px solid var(--tfh-border);
  margin-top: var(--tfh-space-6);
  padding-top: var(--tfh-space-5);
  scroll-margin-top: var(--tfh-space-6);
}

.tfh-page-sections {
  margin-top: var(--tfh-space-8);
}

.tfh-page-sections-wrap .tfh-page-sections {
  margin-top: 0;
}

/* Individual section block */
.tfh-ps-section {
  margin-bottom: var(--tfh-space-6);
}

/* Section heading — matches current site style */
.tfh-ps-title {
  font-family: var(--tfh-font-body);
  font-size: var(--tfh-text-lg);
  font-weight: 700;
  color: var(--tfh-text);
  margin: 0 0 var(--tfh-space-3) 0;
  line-height: 1.3;
}

/* Section body text */
.tfh-ps-body {
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  line-height: 1.7;
}

.tfh-ps-body p {
  margin: 0 0 var(--tfh-space-2) 0;
}

.tfh-ps-body ul,
.tfh-ps-body ol {
  margin-left: 18px;
  margin-top: var(--tfh-space-2);
}

.tfh-ps-body li {
  margin-bottom: 6px;
}

.tfh-ps-body strong {
  color: var(--tfh-text);
  font-weight: 600;
}

.tfh-ps-body em {
  font-style: italic;
}

/* Boxed content (assumptions, disclaimer) */
.tfh-ps-box {
  border: 1px solid var(--tfh-border);
  border-radius: var(--tfh-radius-md);
  padding: 14px 16px;
  margin-top: var(--tfh-space-2);
  background: var(--tfh-surface);
}

.tfh-ps-box--disclaimer {
  border-style: dashed;
}

/* FAQ Q&A pairs */
.tfh-ps-faq-q {
  font-size: var(--tfh-text-sm);
  font-weight: 700;
  color: var(--tfh-text);
  margin-top: var(--tfh-space-4);
  line-height: 1.4;
}

.tfh-ps-faq-q:first-child {
  margin-top: 0;
}

.tfh-ps-faq-a {
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  margin-top: 3px;
  line-height: 1.6;
}


/* =============================================================
   23. HELPER / UTILITY CLASSES
   Lightweight utility classes for common one-off needs.
   Do not create large utility frameworks — keep this minimal.
   ============================================================= */

/* Muted text */
.tfh-muted {
  font-size: var(--tfh-text-sm);
  color: var(--tfh-text-muted);
  line-height: 1.5;
}

/* Mono text — for inline financial values in body copy */
.tfh-mono {
  font-family: var(--tfh-font-mono);
}

/* Visually hidden (accessible) */
.tfh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Link style within page sections */
.tfh-link {
  color: var(--tfh-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tfh-link:hover {
  color: var(--tfh-accent-hover);
}


/* =============================================================
   24. MOBILE BREAKPOINTS
   WHY 780px: matches existing site breakpoint from ppf.css.
   WHY 480px: handles very small phones (320–480px range).
   All !important used deliberately to override grid definitions
   set by desktop rules above.
   ============================================================= */
@media (orientation: landscape) and (max-height: 500px) {
  .tfh-chart-fullscreen-header {
    height: 32px;
    padding: 4px 12px;
  }

  .tfh-chart-fs-data-bar {
    padding: 4px 10px;
    font-size: 11px;
  }
}

@media (max-width: 600px) {
  .tfh-chart-wrap {
    padding-top: 32px;
  }

  .tfh-chart-title {
    padding-left: 34px;
    padding-right: 102px;
  }

  .tfh-chart-expand-btn,
  .tfh-chart-reset-zoom {
    top: 30px;
  }

  .tfh-chart-fs-title {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
}

@media (max-width: 780px) {

  .tfh-calculator {
    padding: 12px 10px;
  }

  .tfh-card {
    padding: 16px !important;
  }

  /* Stack form rows: label above input */
  .tfh-row {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    align-items: stretch !important;
  }

  .tfh-input,
  .tfh-select {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Mobile KPI UX (all calculators): each KPI block becomes one readable
     list container instead of multiple small cards. */
  .tfh-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0;
    border: 1px solid var(--tfh-border);
    border-radius: var(--tfh-radius-md);
    overflow: hidden;
    background: var(--tfh-surface);
  }

  .tfh-kpi-grid--compact {
    grid-template-columns: 1fr !important;
    gap: 0;
    border: 1px solid var(--tfh-border);
    border-radius: var(--tfh-radius-md);
    overflow: hidden;
    background: var(--tfh-surface);
  }

  .tfh-kpi-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--tfh-border);
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
  }

  .tfh-kpi-grid .tfh-kpi-card:last-child,
  .tfh-kpi-grid--compact .tfh-kpi-card:last-child {
    border-bottom: 0;
  }

  .tfh-kpi-card--dark,
  .tfh-kpi-card--green,
  .tfh-kpi-card--primary,
  .tfh-kpi-card--accent {
    background: transparent !important;
    border-color: transparent !important;
  }

  .tfh-kpi-key {
    margin-bottom: 4px;
    color: var(--tfh-text-muted) !important;
    font-size: 12px;
    letter-spacing: 0.03em;
  }

  /* KPI value: slightly smaller on mobile */
  .tfh-kpi-val {
    font-size: 13px !important;
    line-height: 1.15;
    color: var(--tfh-text) !important;
    text-align: right;
    white-space: nowrap;
    letter-spacing: -0.01em;
  }

  .tfh-results__section-title {
    font-size: 17px;
  }

  /* Page title */
  .tfh-tool__title {
    font-size: 20px;
  }

  /* Tabs: smaller padding */
  .tfh-detailed-input__tab {
    padding: 8px 12px;
    font-size: var(--tfh-text-xs);
  }

  /* Button row: allow wrapping */
  .tfh-btn-row {
    flex-wrap: wrap;
  }

  /* Disclosure: full-width trigger */
  .tfh-disclosure__trigger {
    padding: 12px 14px;
  }

  /* Chart canvas area: shorter on tablet to preserve scroll ergonomics */
  .tfh-chart-canvas-wrap {
    height: 230px;
  }
}

@media (max-width: 480px) {

  /* KPI grid: keep one list container on small phones too */
  .tfh-kpi-grid,
  .tfh-kpi-grid--compact {
    grid-template-columns: 1fr !important;
  }

  /* Chart container: reduce padding */
  .tfh-chart-wrap {
    padding: 12px;
  }

  /* Chart canvas area: compact height on small phones */
  .tfh-chart-canvas-wrap {
    height: 200px;
  }

  /* Page sections: tighter spacing */
  .tfh-ps-section {
    margin-bottom: var(--tfh-space-5);
  }
}

@media (max-width: 380px) {

  /* Prevent KPI clipping on very narrow phones. */
  .tfh-kpi-grid,
  .tfh-kpi-grid--compact {
    grid-template-columns: 1fr !important;
  }

  .tfh-kpi-card {
    padding: 8px 10px;
  }

  .tfh-kpi-val {
    font-size: 12px !important;
    line-height: 1.12;
  }
}


/* =============================================================
   25. CONSENT BANNER
   Fixed bottom bar. Visibility toggled by tfh-consent.js via
   the --visible modifier. Uses existing design tokens and button
   classes so no new colour values are introduced.
   ============================================================= */

.tfh-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: var(--tfh-white);
  color: var(--tfh-text);   /* override theme footer color inheritance */
  border-top: 2px solid var(--tfh-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: var(--tfh-space-4) var(--tfh-space-6);
  display: none;           /* hidden by default; JS adds --visible */
  align-items: center;
  gap: var(--tfh-space-4);
  flex-wrap: wrap;
}

.tfh-consent-banner--visible {
  display: flex;
}

/* Push page content up so the fixed banner never overlaps it */
body.tfh-consent-open {
  padding-bottom: 90px !important;
}

@media (max-width: 480px) {
  body.tfh-consent-open {
    padding-bottom: 130px !important;
  }
}

.tfh-consent-banner__text {
  flex: 1 1 280px;
  font-size: 13px;
  color: var(--tfh-muted);
  line-height: 1.55;
  margin: 0;
}

.tfh-consent-banner__reload-note {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.7;
}

.tfh-consent-banner__text a {
  color: var(--tfh-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tfh-consent-banner__actions {
  display: flex;
  gap: var(--tfh-space-2);
  flex-shrink: 0;
  align-items: center;
}

@media (max-width: 480px) {
  .tfh-consent-banner {
    padding: var(--tfh-space-3) var(--tfh-space-4);
  }

  .tfh-consent-banner__actions {
    width: 100%;
    justify-content: flex-end;
  }
}
