/* Time to Financial Independence Calculator - Scoped styles */
.tfi-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  margin: 0 auto !important;
  padding: 0 !important;
  clear: both !important;
  float: none !important;
}

.tfi-app {
  --tfi-bg: #fef7ff;
  --tfi-card: #ffffff;
  --tfi-border: #e9d5ff;
  --tfi-text: #0f172a;
  --tfi-muted: #64748b;
  --tfi-primary: #9333ea;
  --tfi-primary-hover: #7e22ce;
  --tfi-success: #16a34a;
  --tfi-danger: #dc2626;
  --tfi-warn: #d97706;
  --tfi-soft: #f3e8ff;
  --tfi-pastel-purple: #f3e8ff;
  --tfi-shadow: rgba(147, 51, 234, 0.08);
  --tfi-shadow-hover: rgba(147, 51, 234, 0.15);
  
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--tfi-text);
  background: var(--tfi-bg);
  border: 2px solid var(--tfi-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 8px 32px var(--tfi-shadow);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
  display: block;
}

.tfi-app * { box-sizing: border-box; }

.tfi-loading {
  padding: 2rem;
  text-align: center;
  color: var(--tfi-muted);
}

.tfi-hero {
  background: linear-gradient(135deg, var(--tfi-pastel-purple), #ffffff);
  border: 2px solid var(--tfi-border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 6px 24px var(--tfi-shadow);
  margin-bottom: 28px;
}

.tfi-title {
  margin: 0 0 16px 0;
  line-height: 1.2;
  font-size: 36px;
  font-weight: 800;
  color: var(--tfi-text);
  letter-spacing: -0.6px;
}

.tfi-subtitle {
  margin: 0;
  color: var(--tfi-muted);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: -0.1px;
}

.tfi-inst {
  background: var(--tfi-soft);
  border: 2px dashed var(--tfi-border);
  border-radius: 14px;
  padding: 18px 24px;
  font-size: 15px;
  color: var(--tfi-muted);
  margin-bottom: 32px;
  text-align: center;
  font-weight: 600;
  letter-spacing: -0.1px;
}

.tfi-card {
  background: var(--tfi-card);
  border: 2px solid var(--tfi-border);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: 0 4px 16px var(--tfi-shadow);
  transition: all 0.3s ease;
}

.tfi-card:hover {
  box-shadow: 0 8px 28px var(--tfi-shadow-hover);
  transform: translateY(-2px);
}

.tfi-card h3 {
  margin: 0 0 20px 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--tfi-text);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.4px;
  line-height: 1.3;
}

.tfi-section-desc {
  font-size: 15px;
  color: var(--tfi-muted);
  line-height: 1.7;
  margin-bottom: 24px;
  padding: 18px 22px;
  background: var(--tfi-soft);
  border-left: 4px solid var(--tfi-primary);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(147, 51, 234, 0.05);
}

.tfi-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.tfi-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.tfi-field {
  margin-bottom: 22px;
}

.tfi-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--tfi-text);
  font-size: 15px;
  letter-spacing: -0.2px;
}

.tfi-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--tfi-border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--tfi-text);
  background: #ffffff;
  transition: all 0.2s ease;
}

.tfi-input:hover {
  border-color: var(--tfi-primary);
}

.tfi-input:focus {
  outline: none;
  border-color: var(--tfi-primary);
  border-width: 2px;
  box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.1);
}

.tfi-input-money {
  font-weight: 600;
  font-size: 16px;
}

.tfi-hint {
  font-size: 13px;
  color: var(--tfi-muted);
  margin-top: 8px;
  line-height: 1.6;
  font-weight: 400;
}

.tfi-kpi {
  background: linear-gradient(135deg, var(--tfi-pastel-purple), #ffffff);
  border: 2px solid var(--tfi-border);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  transition: all 0.3s ease;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.tfi-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--tfi-shadow-hover);
  border-color: var(--tfi-primary);
}

.tfi-kpi-label {
  font-size: 16px;
  color: var(--tfi-muted);
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.tfi-kpi-value {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  color: var(--tfi-primary);
  margin: 10px 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .tfi-kpi-value {
    font-size: clamp(20px, 5vw, 32px);
  }
}

.tfi-kpi-sub {
  font-size: 13px;
  color: var(--tfi-muted);
  font-weight: 500;
  margin-top: 8px;
  line-height: 1.4;
}

.tfi-kpi-highlight {
  background: linear-gradient(135deg, var(--tfi-primary), var(--tfi-primary-hover));
  color: #ffffff;
  border-color: var(--tfi-primary);
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.3);
}

.tfi-kpi-highlight .tfi-kpi-label,
.tfi-kpi-highlight .tfi-kpi-sub {
  color: rgba(255, 255, 255, 0.9);
}

.tfi-kpi-highlight .tfi-kpi-value {
  color: #ffffff;
}

.tfi-table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 12px;
  border: 2px solid var(--tfi-border);
  box-shadow: 0 2px 8px var(--tfi-shadow);
}

.tfi-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  background: var(--tfi-card);
}

.tfi-table th {
  background: var(--tfi-soft);
  padding: 14px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  color: var(--tfi-text);
  border-bottom: 2px solid var(--tfi-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.tfi-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: var(--tfi-text);
  font-weight: 500;
}

.tfi-table tr:hover {
  background: var(--tfi-soft);
}

.tfi-table tr:last-child td {
  border-bottom: none;
}

.tfi-export-section {
  margin-top: 32px;
  padding: 28px;
  background: linear-gradient(135deg, var(--tfi-soft), #ffffff);
  border: 2px dashed var(--tfi-border);
  border-radius: 16px;
  text-align: center;
}

.tfi-btn,
.tfi-btn-export {
  padding: 16px 32px;
  font-size: 16px;
  margin-bottom: 12px;
  border: 2px solid var(--tfi-primary);
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--tfi-primary);
  color: #ffffff;
  display: inline-block;
  text-decoration: none;
}

.tfi-btn:hover,
.tfi-btn-export:hover {
  background: var(--tfi-primary-hover);
  border-color: var(--tfi-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.4);
}

.tfi-btn:active,
.tfi-btn-export:active {
  transform: translateY(0);
}

.tfi-export-help {
  font-size: 13px;
  color: var(--tfi-muted);
  margin: 0;
  font-weight: 500;
}

/* Investment Pot Cards */
.tfi-pot-card {
  background: #ffffff;
  border: 2px solid var(--tfi-border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 3px 12px var(--tfi-shadow);
  transition: all 0.3s ease;
}

.tfi-pot-card:hover {
  box-shadow: 0 6px 20px var(--tfi-shadow-hover);
  border-color: var(--tfi-primary);
  transform: translateY(-2px);
}

/* Income Stream Cards */
.tfi-income-stream-card {
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tfi-income-stream-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--tfi-success), #86efac);
  transition: width 0.3s ease;
}

.tfi-income-stream-card:hover {
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.25);
  border-color: var(--tfi-success);
  transform: translateY(-3px);
}

.tfi-income-stream-card:hover::before {
  width: 6px;
}

.tfi-income-stream-card h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--tfi-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tfi-pot-card h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--tfi-text);
}

.tfi-btn-danger {
  background: rgba(220, 38, 38, 0.08);
  border: 1.5px solid rgba(220, 38, 38, 0.3);
  color: var(--tfi-danger);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.tfi-btn-danger:hover {
  background: var(--tfi-danger);
  border-color: var(--tfi-danger);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.tfi-btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.2);
}

@media (max-width: 980px) {
  .tfi-app {
    padding: 24px;
  }
  .tfi-grid-2 {
    grid-template-columns: 1fr;
  }
  .tfi-card {
    padding: 24px;
  }
  .tfi-projection-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .tfi-app {
    padding: 16px;
    border-radius: 20px;
  }
  .tfi-card {
    padding: 20px;
    border-radius: 16px;
  }
  .tfi-title {
    font-size: 24px;
  }
  .tfi-kpi-value {
    font-size: clamp(20px, 5vw, 32px);
  }
  .tfi-kpi-label {
    font-size: 14px;
  }
  .tfi-hero {
    padding: 24px;
  }
  .tfi-section-desc {
    padding: 12px 16px;
    font-size: 14px;
  }
  .tfi-projection-grid {
    grid-template-columns: 1fr !important;
  }
}
