/**
 * TFSA Room Calculator — Page Template Styles
 * File: /wp-content/themes/plansmartfi-theme/assets/css/tfsa-calculator.css
 *
 * Enqueue in functions.php:
 *   if ( is_page_template( 'page-template-tfsa-calculator.php' ) ) {
 *     wp_enqueue_style( 'tfsa-calculator', get_template_directory_uri() . '/assets/css/tfsa-calculator.css', [], '1.0.0' );
 *     wp_enqueue_script( 'tfsa-calculator', get_template_directory_uri() . '/assets/js/tfsa-calculator.js', [], '1.0.0', true );
 *   }
 */

/* ============================================================
   DESIGN TOKENS — scoped to avoid theme conflicts
   ============================================================ */
.tfsa-page-wrap {
  --tfsa-navy: #0a0a0f;
  --tfsa-violet: #5b4fcf;
  --tfsa-violet-soft: #7b70df;
  --tfsa-violet-pale: #f0eeff;
  --tfsa-amber: #f0a500;
  --tfsa-amber-pale: #fff8e6;
  --tfsa-muted: #7a7a9a;
  --tfsa-cream: #faf9f6;
  --tfsa-white: #ffffff;
  --tfsa-border: #e8e6f0;
  --tfsa-green: #1a9e6e;
  --tfsa-green-pale: #e6f7f1;
  --tfsa-red: #c94040;
  --tfsa-red-pale: #fdf0f0;
  /* Semantic tokens — used for hardcoded amber/warning shades */
  --tfsa-warn-bg: #fff8e6;
  --tfsa-warn-border: #f5d78a;
  --tfsa-warn-text: #7a5000;
  --tfsa-warn-input-border: #f5c842;
  --tfsa-warn-input-bg: #fffde8;
  --tfsa-warn-label: #9a6800;
  --tfsa-newcomer-border: #c0b4f0;
  --tfsa-newcomer-text: #3a2fa0;
  --tfsa-highlight-text: #9a6800;
  font-family: 'DM Sans', sans-serif;
  color: var(--tfsa-navy);
  background: var(--tfsa-cream);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.tfsa-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}
.tfsa-container--narrow {
  max-width: 680px;
}

/* ============================================================
   SECTION 1: HERO / CALCULATOR
   ============================================================ */
.tfsa-hero-section {
  padding: 48px 0 60px;
}

.tfsa-intro {
  margin-bottom: 36px;
}
.tfsa-intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tfsa-violet-pale);
  color: var(--tfsa-violet);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.tfsa-updated-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--tfsa-green);
  background: var(--tfsa-green-pale);
  border: 1px solid #a8dfc8;
  border-radius: 20px;
  padding: 3px 10px;
  margin-bottom: 14px;
  margin-left: 6px;
}
.tfsa-headline {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 6vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.6px;
  margin-bottom: 12px;
  color: var(--tfsa-navy);
}
.tfsa-headline span { color: var(--tfsa-violet); }
.tfsa-intro-text {
  color: var(--tfsa-muted);
  font-size: 15px;
  line-height: 1.7;
}

/* CARDS */
.tfsa-card {
  background: var(--tfsa-white);
  border: 1.5px solid var(--tfsa-border);
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 14px;
  box-shadow: 0 2px 16px rgba(10,10,15,0.05);
  animation: tfsa-rise 0.5s ease both;
}
.tfsa-card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--tfsa-navy);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tfsa-step-num {
  width: 24px; height: 24px;
  background: var(--tfsa-violet);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* FIELDS */
.tfsa-field { margin-bottom: 20px; }
.tfsa-field:last-child { margin-bottom: 0; }
.tfsa-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tfsa-navy);
  margin-bottom: 7px;
}
.tfsa-field-hint {
  font-size: 12px;
  color: var(--tfsa-muted);
  margin-top: 6px;
  line-height: 1.55;
}
.tfsa-field-formatted {
  font-size: 12px;
  color: var(--tfsa-muted);
  margin-top: 5px;
  display: none;
}
.tfsa-field-formatted.show { display: block; }
.tfsa-field-error {
  font-size: 12px;
  color: var(--tfsa-red);
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.5;
  display: none;
}
.tfsa-field-error.show { display: block; }
.tfsa-field-warning {
  font-size: 12px;
  color: var(--tfsa-warn-label);
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.5;
  display: none;
}
.tfsa-field-warning.show { display: block; }

.tfsa-page-wrap input[type=number],
.tfsa-page-wrap input[type=text],
.tfsa-page-wrap select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--tfsa-border);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--tfsa-navy);
  background: var(--tfsa-cream);
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  appearance: none;
  box-sizing: border-box;
}
.tfsa-page-wrap input[type=number]:focus,
.tfsa-page-wrap input[type=text]:focus,
.tfsa-page-wrap select:focus {
  outline: none;
  border-color: var(--tfsa-violet);
  background: var(--tfsa-white);
}
.tfsa-page-wrap input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.tfsa-page-wrap input.input-error { border-color: var(--tfsa-red) !important; background: var(--tfsa-red-pale) !important; }
.tfsa-page-wrap input.input-warning { border-color: var(--tfsa-warn-input-border) !important; background: var(--tfsa-warn-input-bg) !important; }

/* TOOLTIP */
.tfsa-tooltip-wrap { position: relative; display: inline-flex; align-items: center; }
.tfsa-tooltip-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--tfsa-border);
  color: var(--tfsa-muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
}
.tfsa-tooltip-box {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tfsa-navy);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 10px;
  width: 240px;
  z-index: 100;
  pointer-events: none;
}
.tfsa-tooltip-wrap:hover .tfsa-tooltip-box { display: block; }

/* TOGGLE */
.tfsa-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--tfsa-cream);
  border: 1.5px solid var(--tfsa-border);
  border-radius: 12px;
  margin-bottom: 16px;
  gap: 12px;
}
.tfsa-toggle-label { font-size: 13px; font-weight: 600; color: var(--tfsa-navy); line-height: 1.4; }
.tfsa-toggle-label small { display: block; font-weight: 400; color: var(--tfsa-muted); font-size: 11px; margin-top: 2px; }
.tfsa-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.tfsa-toggle input { opacity: 0; width: 0; height: 0; }
.tfsa-toggle-slider {
  position: absolute; inset: 0;
  background: var(--tfsa-border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.tfsa-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.tfsa-toggle input:checked + .tfsa-toggle-slider { background: var(--tfsa-violet); }
.tfsa-toggle input:checked + .tfsa-toggle-slider::before { transform: translateX(20px); }

/* ELIGIBILITY COLLAPSIBLE */
.tfsa-elig-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--tfsa-violet);
  cursor: pointer;
  margin-bottom: 14px;
  text-align: left;
  width: 100%;
}
.tfsa-elig-toggle svg { flex-shrink: 0; transition: transform 0.2s; }
.tfsa-elig-toggle.open svg:last-child { transform: rotate(180deg); }
.tfsa-elig-body {
  display: none;
  background: var(--tfsa-cream);
  border: 1.5px solid var(--tfsa-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--tfsa-navy);
}
.tfsa-elig-body.open { display: block; }
.tfsa-eli-group { margin-bottom: 12px; }
.tfsa-eli-group:last-child { margin-bottom: 0; }
.tfsa-eli-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tfsa-muted); margin-bottom: 7px; }
.tfsa-eli-row { display: flex; gap: 8px; margin-bottom: 5px; align-items: flex-start; }
.tfsa-eli-icon { flex-shrink: 0; font-size: 14px; margin-top: 1px; }

/* RESIDENCY */
.tfsa-residency-intro { font-size: 13px; color: var(--tfsa-muted); margin-bottom: 6px; line-height: 1.6; }
.tfsa-info-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tfsa-violet);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  margin-bottom: 14px;
}
.tfsa-inline-tooltip {
  display: none;
  background: var(--tfsa-navy);
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  position: relative;
}
.tfsa-inline-tooltip.show { display: block; }
.tfsa-inline-tooltip::before {
  content: '';
  position: absolute;
  top: -6px; left: 20px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--tfsa-navy);
}

/* PRESET BUTTONS */
.tfsa-preset-btns { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.tfsa-preset-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--tfsa-border);
  border-radius: 12px;
  background: var(--tfsa-cream);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--tfsa-navy);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.tfsa-preset-btn:hover { border-color: var(--tfsa-violet-soft); }
.tfsa-preset-btn.active { border-color: var(--tfsa-violet); background: var(--tfsa-violet-pale); color: var(--tfsa-violet); }
.tfsa-preset-icon { font-size: 18px; flex-shrink: 0; }

/* YEAR GRID */
.tfsa-year-grid-wrap { margin-top: 14px; }
.tfsa-year-grid-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tfsa-year-grid-label { font-size: 12px; font-weight: 600; color: var(--tfsa-muted); }
.tfsa-year-grid-actions { display: flex; gap: 8px; }
.tfsa-year-action-btn { font-size: 11px; font-weight: 600; color: var(--tfsa-violet); background: none; border: none; cursor: pointer; padding: 2px 0; font-family: 'DM Sans', sans-serif; }
.tfsa-year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 7px; }
.tfsa-year-chip { position: relative; }
.tfsa-year-chip input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.tfsa-year-chip label {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 4px;
  border: 1.5px solid var(--tfsa-border);
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  color: var(--tfsa-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin: 0;
  user-select: none;
}
.tfsa-year-chip input:checked + label { border-color: var(--tfsa-violet); background: var(--tfsa-violet-pale); color: var(--tfsa-violet); font-weight: 600; }
.tfsa-year-chip label:hover { border-color: var(--tfsa-violet-soft); }

/* CONTEXTUAL WARNINGS */
.tfsa-ctx-warning {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: var(--tfsa-warn-bg);
  border: 1.5px solid var(--tfsa-warn-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--tfsa-warn-text);
  line-height: 1.6;
}
.tfsa-ctx-warning.show { display: flex; }
.tfsa-ctx-warning svg { flex-shrink: 0; margin-top: 1px; }
.tfsa-ctx-warning--newcomer { background: var(--tfsa-violet-pale); border-color: var(--tfsa-newcomer-border); color: var(--tfsa-newcomer-text); }

/* CALCULATE BUTTON */
.tfsa-calc-btn {
  width: 100%;
  padding: 16px;
  background: var(--tfsa-violet);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  letter-spacing: 0.2px;
  margin-top: 4px;
}
.tfsa-calc-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.tfsa-calc-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.tfsa-trust-badge { text-align: center; font-size: 11px; color: var(--tfsa-muted); margin-top: 10px; letter-spacing: 0.2px; }

/* LOADER */
.tfsa-loader {
  width: 36px; height: 36px;
  border: 3px solid var(--tfsa-border);
  border-top-color: var(--tfsa-violet);
  border-radius: 50%;
  animation: tfsa-spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes tfsa-spin { to { transform: rotate(360deg); } }

/* RESULTS */
.tfsa-result-hero {
  background: var(--tfsa-navy);
  border-radius: 20px;
  padding: 32px 24px;
  margin-bottom: 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: tfsa-rise 0.4s ease both;
}
.tfsa-result-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(91,79,207,0.4) 0%, transparent 70%);
  pointer-events: none;
}
.tfsa-result-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(240,165,0,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.tfsa-result-label { font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--tfsa-muted); margin-bottom: 10px; }
.tfsa-result-amount {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(42px, 12vw, 64px);
  color: var(--tfsa-amber);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
}
.tfsa-result-amount.negative { color: var(--tfsa-red); }
.tfsa-result-sub { font-size: 13px; color: var(--tfsa-muted); position: relative; z-index: 1; line-height: 1.5; }

.tfsa-confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  animation: tfsa-rise 0.4s 0.05s ease both;
}
.tfsa-confidence-bar.high { background: var(--tfsa-green-pale); color: var(--tfsa-green); border: 1.5px solid #a8dfc8; }
.tfsa-confidence-bar.medium { background: var(--tfsa-amber-pale); color: var(--tfsa-warn-label); border: 1.5px solid var(--tfsa-warn-border); }
.tfsa-confidence-bar.low { background: var(--tfsa-red-pale); color: var(--tfsa-red); border: 1.5px solid #f0b8b8; }

.tfsa-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; animation: tfsa-rise 0.4s 0.08s ease both; }
.tfsa-stat-box { background: var(--tfsa-white); border: 1.5px solid var(--tfsa-border); border-radius: 16px; padding: 16px 14px; }
.tfsa-stat-box--green { border-color: #a8dfc8; background: var(--tfsa-green-pale); }
.tfsa-stat-box--red { border-color: #f0b8b8; background: var(--tfsa-red-pale); }
.tfsa-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tfsa-muted); margin-bottom: 5px; }
.tfsa-stat-value { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 20px; color: var(--tfsa-navy); letter-spacing: -0.3px; }
.tfsa-stat-box--green .tfsa-stat-value { color: var(--tfsa-green); }
.tfsa-stat-box--red .tfsa-stat-value { color: var(--tfsa-red); }

/* SIMULATOR */
.tfsa-simulator-card { animation: tfsa-rise 0.4s 0.1s ease both; }
.tfsa-sim-safe { display: none; padding: 10px 14px; background: var(--tfsa-green-pale); border: 1.5px solid #a8dfc8; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--tfsa-green); margin-bottom: 14px; }
.tfsa-sim-safe.show { display: block; }
.tfsa-sim-row { display: flex; gap: 10px; align-items: flex-end; }
.tfsa-sim-row .tfsa-field { flex: 1; margin-bottom: 0; }
.tfsa-sim-btn { padding: 12px 18px; background: var(--tfsa-violet-pale); color: var(--tfsa-violet); border: 1.5px solid var(--tfsa-violet); border-radius: 12px; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background 0.15s; flex-shrink: 0; }
.tfsa-sim-btn:hover { background: var(--tfsa-violet); color: #fff; }
.tfsa-sim-result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.tfsa-sim-result.ok { background: var(--tfsa-green-pale); color: var(--tfsa-green); border: 1.5px solid #a8dfc8; }
.tfsa-sim-result.warn { background: var(--tfsa-red-pale); color: var(--tfsa-red); border: 1.5px solid #f0b8b8; }
.tfsa-sim-zero-hint { font-size: 12px; color: var(--tfsa-muted); font-style: italic; font-weight: 400; }

/* GROWTH */
.tfsa-growth-card { animation: tfsa-rise 0.4s 0.12s ease both; }
.tfsa-growth-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--tfsa-cream); padding: 4px; border-radius: 12px; }
.tfsa-growth-tab { flex: 1; padding: 8px 6px; border: none; border-radius: 9px; background: transparent; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600; color: var(--tfsa-muted); cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.tfsa-growth-tab.active { background: var(--tfsa-white); color: var(--tfsa-violet); box-shadow: 0 1px 6px rgba(10,10,15,0.08); }
.tfsa-growth-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.tfsa-growth-row { display: flex; align-items: center; gap: 10px; }
.tfsa-growth-label { font-size: 12px; color: var(--tfsa-muted); width: 60px; flex-shrink: 0; }
.tfsa-growth-bar-wrap { flex: 1; height: 8px; background: var(--tfsa-border); border-radius: 8px; overflow: hidden; }
.tfsa-growth-bar { height: 100%; border-radius: 8px; background: var(--tfsa-violet); transition: width 0.8s ease; }
.tfsa-growth-val { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 13px; color: var(--tfsa-navy); width: 70px; text-align: right; flex-shrink: 0; }
.tfsa-growth-rate-note { font-size: 12px; color: var(--tfsa-muted); margin-top: 10px; line-height: 1.5; }

/* EMOTIONAL BOX */
.tfsa-emotional-box { display: none; padding: 16px 20px; border-radius: 14px; font-size: 14px; line-height: 1.65; margin-bottom: 14px; font-style: italic; color: var(--tfsa-navy); border-left: 3px solid var(--tfsa-violet); background: var(--tfsa-violet-pale); animation: tfsa-rise 0.4s ease both; }
.tfsa-emotional-box.show { display: block; }
.tfsa-emotional-box.red-tone { border-color: var(--tfsa-red); background: var(--tfsa-red-pale); }
.tfsa-emotional-box.green-tone { border-color: var(--tfsa-green); background: var(--tfsa-green-pale); }

/* RECON NOTE */
.tfsa-recon-note { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--tfsa-muted); line-height: 1.6; padding: 10px 14px; background: var(--tfsa-cream); border: 1px solid var(--tfsa-border); border-radius: 10px; margin-bottom: 14px; }
.tfsa-recon-note svg { flex-shrink: 0; margin-top: 2px; }

/* NEXT STEPS */
.tfsa-next-card { animation: tfsa-rise 0.4s 0.14s ease both; }
.tfsa-next-steps { display: flex; flex-direction: column; }
.tfsa-next-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--tfsa-border); align-items: flex-start; }
.tfsa-next-item:last-child { border-bottom: none; padding-bottom: 0; }
.tfsa-next-icon { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.tfsa-next-icon.violet { background: var(--tfsa-violet-pale); }
.tfsa-next-icon.amber { background: var(--tfsa-amber-pale); }
.tfsa-next-icon.green { background: var(--tfsa-green-pale); }
.tfsa-next-icon.red { background: var(--tfsa-red-pale); }
.tfsa-next-text strong { font-size: 14px; color: var(--tfsa-navy); display: block; margin-bottom: 2px; }
.tfsa-next-text p { font-size: 13px; color: var(--tfsa-muted); line-height: 1.55; }
.tfsa-next-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--tfsa-violet); text-decoration: none; }
.tfsa-next-link:hover { text-decoration: underline; }
.tfsa-next-steps-list { margin-top: 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.tfsa-next-steps-list li { font-size: 13px; color: var(--tfsa-muted); line-height: 1.55; }
.tfsa-next-steps-list li strong { color: var(--tfsa-navy); }

/* BREAKDOWN TABLE */
.tfsa-breakdown-card { animation: tfsa-rise 0.4s 0.16s ease both; }
.tfsa-breakdown-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; color: var(--tfsa-navy); margin-bottom: 14px; }
.tfsa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tfsa-table thead th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--tfsa-muted); padding: 0 0 10px; border-bottom: 1.5px solid var(--tfsa-border); }
.tfsa-table thead th:last-child { text-align: right; }
.tfsa-table tbody tr { border-bottom: 1px solid var(--tfsa-border); }
.tfsa-table tbody tr:last-child { border-bottom: none; }
.tfsa-table tbody td { padding: 9px 0; color: var(--tfsa-navy); vertical-align: middle; }
.tfsa-table tbody td:last-child { text-align: right; font-weight: 600; font-family: 'Syne', sans-serif; }
.tfsa-yr-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 6px; margin-left: 5px; vertical-align: middle; }
.tfsa-yr-badge.eligible { background: var(--tfsa-violet-pale); color: var(--tfsa-violet); }
.tfsa-yr-badge.skip { background: #f0f0f0; color: var(--tfsa-muted); }
.tfsa-yr-badge.first { background: var(--tfsa-amber-pale); color: #9a6800; }
.tfsa-yr-badge.current { background: var(--tfsa-green-pale); color: var(--tfsa-green); }

/* CRA NOTE */
.tfsa-cra-note { display: flex; align-items: flex-start; gap: 10px; background: var(--tfsa-violet-pale); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-size: 13px; color: var(--tfsa-violet); line-height: 1.55; animation: tfsa-rise 0.4s 0.2s ease both; }
.tfsa-cra-note svg { flex-shrink: 0; margin-top: 1px; }

/* PRINT / RESET / SHARE */
.tfsa-print-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px; margin-top: 14px; border: 1.5px solid var(--tfsa-border); border-radius: 12px; background: transparent; color: var(--tfsa-navy); font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color 0.15s, background 0.15s; animation: tfsa-rise 0.4s 0.22s ease both; }
.tfsa-print-btn:hover { border-color: var(--tfsa-violet); background: var(--tfsa-violet-pale); color: var(--tfsa-violet); }
.tfsa-disclaimer { font-size: 11px; color: var(--tfsa-muted); line-height: 1.7; text-align: center; padding: 0 8px; margin-top: 20px; animation: tfsa-rise 0.4s 0.24s ease both; }
.tfsa-reset-btn { display: block; width: 100%; padding: 13px; margin-top: 10px; border: 1.5px solid var(--tfsa-border); border-radius: 12px; background: transparent; color: var(--tfsa-muted); font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color 0.15s, color 0.15s; text-align: center; }
.tfsa-reset-btn:hover { border-color: var(--tfsa-violet); color: var(--tfsa-violet); }
.tfsa-share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--tfsa-violet-pale); border: 1.5px solid #c0b4f0; border-radius: 14px; margin-top: 14px; font-size: 13px; color: var(--tfsa-violet); font-weight: 500; flex-wrap: wrap; }
.tfsa-share-btn { background: var(--tfsa-violet); color: #fff; border: none; border-radius: 10px; padding: 9px 16px; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: opacity 0.15s; flex-shrink: 0; }
.tfsa-share-btn:hover { opacity: 0.85; }

/* CONFIRMATION MODAL */
.tfsa-confirm-overlay { display: none; position: fixed; inset: 0; background: rgba(10,10,15,0.55); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.tfsa-confirm-overlay.show { display: flex; }
.tfsa-confirm-modal { background: var(--tfsa-white); border-radius: 20px; padding: 28px 24px; max-width: 380px; width: 100%; box-shadow: 0 8px 40px rgba(10,10,15,0.2); }
.tfsa-confirm-modal h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--tfsa-navy); margin-bottom: 10px; }
.tfsa-confirm-modal p { font-size: 13px; color: var(--tfsa-muted); line-height: 1.6; margin-bottom: 20px; }
.tfsa-confirm-amount { font-family: 'Syne', sans-serif; font-weight: 800; color: var(--tfsa-amber); font-size: 22px; display: block; margin-bottom: 4px; }
.tfsa-confirm-btns { display: flex; gap: 10px; }
.tfsa-confirm-recheck { flex: 1; padding: 12px; border: 1.5px solid var(--tfsa-border); border-radius: 12px; background: transparent; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 14px; color: var(--tfsa-navy); cursor: pointer; transition: border-color 0.15s; }
.tfsa-confirm-recheck:hover { border-color: var(--tfsa-violet); }
.tfsa-confirm-continue { flex: 1; padding: 12px; border: none; border-radius: 12px; background: var(--tfsa-violet); color: #fff; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer; transition: opacity 0.15s; }
.tfsa-confirm-continue:hover { opacity: 0.85; }

/* ============================================================
   SECTION 2: EXPLAINER
   ============================================================ */
.tfsa-explainer-section {
  background: var(--tfsa-white);
  border-top: 1.5px solid var(--tfsa-border);
  padding: 72px 20px;
}
.tfsa-section-header { text-align: center; margin-bottom: 48px; }
.tfsa-section-badge { display: inline-block; background: var(--tfsa-violet-pale); color: var(--tfsa-violet); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 5px 12px; border-radius: 20px; margin-bottom: 14px; }
.tfsa-section-header h2 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(22px, 5vw, 30px); color: var(--tfsa-navy); letter-spacing: -0.4px; margin-bottom: 10px; line-height: 1.2; }
.tfsa-section-header p { color: var(--tfsa-muted); font-size: 15px; line-height: 1.6; }

.tfsa-explainer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 1100px; margin: 0 auto; }
@media (max-width: 700px) { .tfsa-explainer-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) {
  .tfsa-stats-grid { grid-template-columns: 1fr; }
}



.tfsa-explainer-card { background: var(--tfsa-cream); border: 1.5px solid var(--tfsa-border); border-radius: 20px; padding: 28px 24px; }
.tfsa-explainer-icon { font-size: 28px; margin-bottom: 14px; }
.tfsa-explainer-card h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 17px; color: var(--tfsa-navy); margin-bottom: 12px; line-height: 1.3; }
.tfsa-explainer-card p { font-size: 14px; color: var(--tfsa-muted); line-height: 1.7; margin-bottom: 14px; }
.tfsa-explainer-card p:last-of-type { margin-bottom: 0; }

.tfsa-explainer-limits { margin-top: 20px; }
.tfsa-limits-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tfsa-muted); margin-bottom: 10px; }
.tfsa-limits-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tfsa-limit-chip { background: var(--tfsa-white); border: 1.5px solid var(--tfsa-border); border-radius: 10px; padding: 8px 10px; text-align: center; }
.tfsa-limit-chip span { display: block; font-size: 10px; color: var(--tfsa-muted); margin-bottom: 2px; }
.tfsa-limit-chip strong { font-family: 'Syne', sans-serif; font-size: 13px; color: var(--tfsa-navy); }
.tfsa-limit-chip--highlight { border-color: var(--tfsa-amber); background: var(--tfsa-amber-pale); }
.tfsa-limit-chip--highlight strong { color: var(--tfsa-highlight-text); }
.tfsa-limit-chip--current { border-color: var(--tfsa-violet); background: var(--tfsa-violet-pale); }
.tfsa-limit-chip--current strong { color: var(--tfsa-violet); }

.tfsa-why-cra-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.tfsa-why-item { display: flex; gap: 12px; align-items: flex-start; }
.tfsa-why-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.tfsa-why-item strong { font-size: 13px; color: var(--tfsa-navy); display: block; margin-bottom: 3px; }
.tfsa-why-item p { font-size: 13px; color: var(--tfsa-muted); line-height: 1.55; margin: 0; }
.tfsa-cra-tip { background: var(--tfsa-violet-pale); border-left: 3px solid var(--tfsa-violet); border-radius: 0 10px 10px 0; padding: 12px 16px; font-size: 13px; color: var(--tfsa-navy); line-height: 1.6; }
.tfsa-cra-tip strong { color: var(--tfsa-violet); }

/* ============================================================
   SECTION 3: EMAIL CAPTURE
   ============================================================ */
.tfsa-email-section {
  background: var(--tfsa-navy);
  padding: 72px 20px;
}
.tfsa-email-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.tfsa-email-badge { display: inline-block; background: rgba(240,165,0,0.15); color: var(--tfsa-amber); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 5px 12px; border-radius: 20px; margin-bottom: 16px; }
.tfsa-email-card h2 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(22px, 5vw, 30px); color: #fff; margin-bottom: 12px; letter-spacing: -0.3px; }
.tfsa-email-card p { color: #9a9ab8; font-size: 15px; line-height: 1.65; margin-bottom: 20px; }
.tfsa-email-features { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; text-align: left; }
.tfsa-email-features span { font-size: 13px; color: #c0c0d8; }
.tfsa-beehiiv-wrap { border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.tfsa-email-disclaimer { font-size: 11px; color: #6a6a8a; }

/* ============================================================
   SECTION 4: FAQ
   ============================================================ */
.tfsa-faq-section { padding: 72px 20px; background: var(--tfsa-cream); }
.tfsa-faq-list { display: flex; flex-direction: column; }
.tfsa-faq-item { border-bottom: 1.5px solid var(--tfsa-border); }
.tfsa-faq-item:first-child { border-top: 1.5px solid var(--tfsa-border); }
.tfsa-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 18px 0;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--tfsa-navy);
  cursor: pointer;
  text-align: left;
}
.tfsa-faq-q:hover { color: var(--tfsa-violet); }
.tfsa-faq-chevron { flex-shrink: 0; transition: transform 0.2s; color: var(--tfsa-muted); }
.tfsa-faq-item.open .tfsa-faq-chevron { transform: rotate(180deg); }
.tfsa-faq-a { padding: 0 0 18px; }
.tfsa-faq-a p { font-size: 14px; color: var(--tfsa-muted); line-height: 1.75; }

/* ============================================================
   SECTION 5: INTERNAL LINKS
   ============================================================ */
.tfsa-links-section { padding: 72px 20px; background: var(--tfsa-white); border-top: 1.5px solid var(--tfsa-border); }
.tfsa-internal-links { display: flex; flex-direction: column; gap: 10px; }
.tfsa-internal-link { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px solid var(--tfsa-border); border-radius: 16px; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.tfsa-internal-link:hover { border-color: var(--tfsa-violet); background: var(--tfsa-violet-pale); }
.tfsa-internal-link-icon { font-size: 22px; flex-shrink: 0; }
.tfsa-internal-link strong { font-size: 14px; color: var(--tfsa-navy); display: block; margin-bottom: 2px; }
.tfsa-internal-link span { font-size: 12px; color: var(--tfsa-muted); line-height: 1.5; }
.tfsa-link-arrow { color: var(--tfsa-violet); flex-shrink: 0; margin-left: auto; font-size: 18px; }

/* ============================================================
   SECTION 6: LEGAL
   ============================================================ */
.tfsa-legal-section { padding: 40px 20px 60px; background: var(--tfsa-cream); border-top: 1.5px solid var(--tfsa-border); }
.tfsa-legal-text { font-size: 12px; color: var(--tfsa-muted); line-height: 1.8; text-align: center; }
.tfsa-legal-text a { color: var(--tfsa-violet); text-decoration: underline; }

/* ============================================================
   SEO SECTION
   ============================================================ */
.tfsa-seo-section {
  padding: 40px 20px 60px;
  border-top: 1.5px solid var(--tfsa-border);
  background: var(--tfsa-cream);
}
.tfsa-seo-section h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--tfsa-navy);
  margin-bottom: 12px;
}
.tfsa-seo-section p {
  font-size: 14px;
  color: var(--tfsa-muted);
  line-height: 1.75;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes tfsa-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .tfsa-explainer-section,
  .tfsa-email-section,
  .tfsa-faq-section,
  .tfsa-links-section,
  .tfsa-legal-section,
  .tfsa-calc-btn,
  .tfsa-print-btn,
  .tfsa-reset-btn,
  .tfsa-share-row,
  .tfsa-confirm-overlay,
  #quiz,
  #loadingState,
  .tfsa-simulator-card,
  .tfsa-cra-note,
  .tfsa-disclaimer { display: none !important; }
  .tfsa-page-wrap { background: white; }
  .tfsa-card, .tfsa-result-hero, .tfsa-stats-grid, .tfsa-breakdown-card, .tfsa-next-card, .tfsa-growth-card { box-shadow: none !important; border: 1px solid #ddd !important; }
  .tfsa-result-hero { background: #0a0a0f !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   DARK MODE
   Triggered by [data-theme="dark"] on <html> or <body>,
   matching your theme's existing dark mode implementation.
   ============================================================ */

[data-theme="dark"] .tfsa-page-wrap {
  /* Override all light-mode tokens */
  --tfsa-navy: #0a0a0f;
  --tfsa-violet: #7b70df;
  --tfsa-violet-soft: #9b90ef;
  --tfsa-violet-pale: #1e1a3a;
  --tfsa-amber: #f0a500;
  --tfsa-amber-pale: #2a2000;
  --tfsa-muted: #9a9ab8;
  --tfsa-cream: #111118;
  --tfsa-white: #1a1a24;
  --tfsa-border: #2a2a3a;
  --tfsa-green: #2ac88a;
  --tfsa-green-pale: #0d2a1e;
  --tfsa-red: #e05555;
  --tfsa-red-pale: #2a0f0f;
  /* Semantic warning tokens — dark equivalents */
  --tfsa-warn-bg: #2a1e00;
  --tfsa-warn-border: #6b4e00;
  --tfsa-warn-text: #f0c060;
  --tfsa-warn-input-border: #a07800;
  --tfsa-warn-input-bg: #1e1800;
  --tfsa-warn-label: #f0b830;
  --tfsa-newcomer-border: #4a3fa0;
  --tfsa-newcomer-text: #c0b4f0;
  --tfsa-highlight-text: #f0b830;

  color: #e8e8f0;
  background: #111118;
}

/* Page background */
[data-theme="dark"] .tfsa-page-wrap,
[data-theme="dark"] .tfsa-hero-section,
[data-theme="dark"] .tfsa-faq-section,
[data-theme="dark"] .tfsa-legal-section,
[data-theme="dark"] .tfsa-seo-section {
  background: #111118;
}

/* Alternating section backgrounds */
[data-theme="dark"] .tfsa-explainer-section,
[data-theme="dark"] .tfsa-links-section {
  background: #16161f;
}

/* Email section stays dark navy — it already looks good in dark mode */
[data-theme="dark"] .tfsa-email-section {
  background: #0a0a0f;
}

/* Cards */
[data-theme="dark"] .tfsa-card {
  background: #1a1a24;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

[data-theme="dark"] .tfsa-explainer-card {
  background: #111118;
}

[data-theme="dark"] .tfsa-confirm-modal {
  background: #1a1a24;
}

/* Inputs */
[data-theme="dark"] .tfsa-page-wrap input[type=number],
[data-theme="dark"] .tfsa-page-wrap input[type=text],
[data-theme="dark"] .tfsa-page-wrap select {
  background: #111118;
  color: #e8e8f0;
  border-color: #2a2a3a;
}

[data-theme="dark"] .tfsa-page-wrap input[type=number]:focus,
[data-theme="dark"] .tfsa-page-wrap input[type=text]:focus,
[data-theme="dark"] .tfsa-page-wrap select:focus {
  background: #1a1a24;
}

/* Toggle row */
[data-theme="dark"] .tfsa-toggle-row {
  background: #111118;
}

/* Preset buttons */
[data-theme="dark"] .tfsa-preset-btn {
  background: #111118;
  color: #e8e8f0;
}

/* Eligibility body */
[data-theme="dark"] .tfsa-elig-body {
  background: #111118;
  color: #c0c0d8;
}

/* Inline tooltip — already dark navy, fine in both modes */

/* CRA toggle row */
[data-theme="dark"] .tfsa-toggle-slider {
  background: #2a2a3a;
}

/* Growth tabs */
[data-theme="dark"] .tfsa-growth-tabs {
  background: #111118;
}

[data-theme="dark"] .tfsa-growth-tab.active {
  background: #1a1a24;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

/* Stat boxes */
[data-theme="dark"] .tfsa-stat-box {
  background: #1a1a24;
}

[data-theme="dark"] .tfsa-stat-box--green {
  background: #0d2a1e;
  border-color: #1a5a3a;
}

[data-theme="dark"] .tfsa-stat-box--red {
  background: #2a0f0f;
  border-color: #5a1a1a;
}

/* Recon note */
[data-theme="dark"] .tfsa-recon-note {
  background: #111118;
  border-color: #2a2a3a;
  color: #9a9ab8;
}

/* Emotional box */
[data-theme="dark"] .tfsa-emotional-box {
  background: #1e1a3a;
  border-color: #5b4fcf;
  color: #c0c0e0;
}

[data-theme="dark"] .tfsa-emotional-box.green-tone {
  background: #0d2a1e;
  border-color: #2ac88a;
  color: #80e8b8;
}

[data-theme="dark"] .tfsa-emotional-box.red-tone {
  background: #2a0f0f;
  border-color: #e05555;
  color: #f09090;
}

/* Confidence bars */
[data-theme="dark"] .tfsa-confidence-bar.high {
  background: #0d2a1e;
  border-color: #1a5a3a;
}

[data-theme="dark"] .tfsa-confidence-bar.medium {
  background: #2a1e00;
  border-color: #6b4e00;
}

[data-theme="dark"] .tfsa-confidence-bar.low {
  background: #2a0f0f;
  border-color: #5a1a1a;
}

/* Simulator result */
[data-theme="dark"] .tfsa-sim-result.ok {
  background: #0d2a1e;
  border-color: #1a5a3a;
}

[data-theme="dark"] .tfsa-sim-result.warn {
  background: #2a0f0f;
  border-color: #5a1a1a;
}

/* Sim safe */
[data-theme="dark"] .tfsa-sim-safe {
  background: #0d2a1e;
  border-color: #1a5a3a;
}

/* CRA note */
[data-theme="dark"] .tfsa-cra-note {
  background: #1e1a3a;
  color: #9b90ef;
}

/* Share row */
[data-theme="dark"] .tfsa-share-row {
  background: #1e1a3a;
  border-color: #4a3fa0;
  color: #c0b4f0;
}

/* FAQ */
[data-theme="dark"] .tfsa-faq-q {
  color: #e8e8f0;
  background: none;
}

[data-theme="dark"] .tfsa-faq-q:hover {
  color: var(--tfsa-violet);
}

/* Internal links */
[data-theme="dark"] .tfsa-internal-link {
  background: transparent;
}

[data-theme="dark"] .tfsa-internal-link:hover {
  background: #1e1a3a;
}

[data-theme="dark"] .tfsa-internal-link strong {
  color: #e8e8f0;
}

/* Limit chips */
[data-theme="dark"] .tfsa-limit-chip {
  background: #1a1a24;
}

[data-theme="dark"] .tfsa-limit-chip--highlight {
  background: #2a1e00;
  border-color: #8b6800;
}

[data-theme="dark"] .tfsa-limit-chip--current {
  background: #1e1a3a;
}

/* CRA tip box */
[data-theme="dark"] .tfsa-cra-tip {
  background: #1e1a3a;
  color: #c0c0e0;
}

/* Year chips */
[data-theme="dark"] .tfsa-year-chip label {
  background: #111118;
  color: #9a9ab8;
}

[data-theme="dark"] .tfsa-year-chip input:checked + label {
  background: #1e1a3a;
  color: #9b90ef;
}

/* Print — always use light for print regardless of dark mode */
@media print {
  [data-theme="dark"] .tfsa-page-wrap {
    background: white !important;
    color: black !important;
  }
}
