/* Visualizations styles - SS timing, Roth, survivor, spending components */

/* ============================================
   Social Security Timing Styles
   ============================================ */

.ss-timing-tabs {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-1);
  background: var(--page-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.ss-timing-tab {
  padding: var(--sp-1) var(--sp-3);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}

.ss-timing-tab:hover {
  background: var(--border-subtle);
  color: var(--text-secondary);
}

.ss-timing-tab.active {
  background: var(--surface-card);
  color: var(--primary);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}

/* SS Summary Metrics Grid — 1x4 horizontal strip */
.ss-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.ss-metric-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.ss-metric-card.recommended {
  background: linear-gradient(135deg, rgba(0, 181, 119, 0.08), rgba(59, 130, 246, 0.08));
  border-color: rgba(0, 181, 119, 0.3);
}

.ss-metric-card .metric-icon {
  font-size: 1.1rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.ss-metric-card .metric-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.ss-metric-card .metric-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.ss-metric-card .metric-value {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  line-height: 1.3;
}

.ss-metric-card .metric-subtext {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  line-height: 1.2;
}

/* SS Benefit Table */
.ss-benefit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-top: var(--sp-2);
}

.ss-benefit-table thead {
  background: var(--page-bg);
}

.ss-benefit-table th {
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-subtle);
  font-size: var(--text-2xs);
}

.ss-benefit-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.ss-benefit-table tr:hover {
  background: var(--page-bg);
}

.ss-benefit-table .row-recommended {
  background: rgba(0, 181, 119, 0.08);
  font-weight: var(--fw-semibold);
}

.ss-benefit-table .recommended-badge {
  display: inline-block;
  padding: 0.1rem var(--sp-1);
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: var(--radius);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  color: #fff;
  margin-left: var(--sp-1);
}

/* Break-Even Summary Card */
.break-even-summary-card {
  margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.break-even-summary-card h4 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
  color: var(--text-main);
}

.break-even-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}

.break-even-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-card);
  border-radius: var(--radius);
}

.break-even-comparison {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.break-even-age {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--primary);
}

.break-even-note {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* ============================================
   Couple SS Strategy Styles
   ============================================ */

.ss-couple-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
  margin: var(--sp-6) 0;
}

.ss-matrix-section h4,
.ss-detail-section h4 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
  color: var(--text-main);
}

.matrix-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}

.chart-container-square {
  aspect-ratio: 1;
  max-height: 500px;
}

/* Strategy Detail Card */
.strategy-detail-card {
  padding: var(--sp-6);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.strategy-header {
  margin-bottom: var(--sp-6);
}

.strategy-badge {
  display: inline-block;
  padding: var(--sp-2) var(--sp-4);
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: var(--radius);
  font-weight: var(--fw-semibold);
  font-size: var(--text-base);
  color: #fff;
}

.strategy-persons {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.person-card {
  flex: 1;
  padding: var(--sp-4);
  background: var(--surface-card);
  border-radius: var(--radius);
}

.person-card h5 {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.person-card.primary {
  border-left: 3px solid var(--primary);
}

.person-card.spouse {
  border-left: 3px solid var(--success);
}

.person-detail {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.person-detail:last-child {
  border-bottom: none;
}

.person-detail .label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.person-detail .value {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
}

.person-divider {
  font-size: 1.5rem;
  font-weight: var(--fw-light);
  color: var(--text-muted);
}

.strategy-combined {
  padding: var(--sp-4);
  background: rgba(0, 181, 119, 0.05);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
}

.combined-row {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-2) 0;
}

.combined-row .label {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.combined-row .value {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
}

.combined-row .value.highlight {
  font-size: var(--text-lg);
  color: var(--success);
}

.combined-row.survivor {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-3);
  margin-top: var(--sp-2);
}

.strategy-recommendation {
  padding: var(--sp-4);
  background: rgba(16, 185, 129, 0.05);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* Top Strategies Table */
.ss-strategies-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  margin-top: var(--sp-4);
}

.ss-strategies-table thead {
  background: var(--page-bg);
}

.ss-strategies-table th {
  padding: var(--sp-3);
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-subtle);
  font-size: var(--text-xs);
}

.ss-strategies-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.ss-strategies-table tr:hover {
  background: var(--page-bg);
}

.rank-badge {
  display: inline-block;
  padding: var(--sp-1) var(--sp-2);
  background: var(--page-bg);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
}

.rank-badge.rank-best {
  background: linear-gradient(135deg, var(--primary), var(--success));
  color: #fff;
}

/* Couple Summary Metrics */
.ss-couple-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.couple-metric-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.couple-metric-card .metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.couple-metric-card .metric-value {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
}

/* Info Icon */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: var(--sp-2);
  border: none;
  background: rgba(0, 181, 119, 0.2);
  color: var(--primary);
  border-radius: 50%;
  font-size: 14px;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--transition-base);
  vertical-align: middle;
}

.info-icon:hover {
  background: rgba(0, 181, 119, 0.3);
}

/* ============================================
   Modal Overlay
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn 0.2s ease-out;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  background: var(--surface-card);
  border-radius: var(--radius-2xl);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--page-bg);
  color: var(--text-main);
}

.modal-body {
  padding: var(--sp-6);
}

.analysis-method {
  margin-bottom: var(--sp-8);
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--primary);
}

.analysis-method:last-child {
  margin-bottom: 0;
}

.analysis-method h4 {
  margin: 0 0 var(--sp-3) 0;
  font-size: 1.2rem;
  color: var(--text-main);
}

.analysis-method p {
  margin: var(--sp-2) 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.analysis-method .example {
  color: var(--info-dark);
  font-style: italic;
  background: var(--info-light);
  padding: var(--sp-3);
  border-radius: var(--radius);
  margin-top: var(--sp-3);
}

.analysis-method .note {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: var(--sp-3);
  padding-left: var(--sp-4);
  border-left: 2px solid var(--border-subtle);
}

/* ============================================
   Roth Optimization Styles
   ============================================ */

.roth-recommendation-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-6);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-6);
  border-left: 4px solid;
}

.roth-banner-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(0, 181, 119, 0.08));
  border-color: var(--success);
}

.roth-banner-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--warning);
}

.roth-banner-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--info);
}

.banner-icon {
  font-size: 2rem;
  line-height: 1;
}

.banner-content {
  flex: 1;
}

.banner-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
  color: var(--text-main);
}

.banner-message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
  line-height: 1.5;
}

.banner-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
}

.banner-stat {
  font-size: var(--text-base);
  color: var(--text-muted);
}

.banner-stat strong {
  color: var(--text-main);
  margin-right: var(--sp-1);
}

/* Roth Metrics Grid */
.roth-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.roth-metric-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Conversion Schedule Table */
.roth-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  margin-top: var(--sp-4);
}

.roth-schedule-table thead {
  background: var(--page-bg);
}

.roth-schedule-table th {
  padding: var(--sp-3);
  text-align: left;
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-subtle);
  font-size: var(--text-xs);
}

.roth-schedule-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.roth-schedule-table tr:hover {
  background: var(--page-bg);
}

.roth-schedule-table .conversion-year {
  background: rgba(16, 185, 129, 0.05);
  font-weight: var(--fw-medium);
}

/* Strategy Comparison Grid */
.strategy-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-6);
  margin: var(--sp-6) 0;
}

.strategy-card {
  position: relative;
  padding: var(--sp-6);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.strategy-card.recommended {
  background: linear-gradient(135deg, rgba(0, 181, 119, 0.06), rgba(59, 130, 246, 0.06));
  border-color: rgba(0, 181, 119, 0.3);
  border-width: 2px;
}

.strategy-card .recommended-badge {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: #fff;
}

.strategy-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-4);
  color: var(--text-main);
}

.strategy-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.strategy-metric {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.strategy-metric .metric-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.strategy-metric .metric-value {
  font-size: 1rem;
  font-weight: var(--fw-semibold);
  color: var(--text-main);
}

/* IRMAA Timeline */
.irmaa-timeline-section {
  margin: var(--sp-8) 0;
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-lg);
}

.irmaa-timeline-section h4 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
  color: var(--text-main);
}

.timeline-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
}

.irmaa-timeline {
  position: relative;
  padding-left: var(--sp-8);
}

.irmaa-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-subtle);
}

.irmaa-timeline-item {
  position: relative;
  padding: var(--sp-4) 0 var(--sp-4) var(--sp-6);
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 1.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 2px solid var(--text-muted);
}

.irmaa-timeline-item.triggered .timeline-marker {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.irmaa-timeline-item.safe .timeline-marker {
  background: var(--success);
  border-color: var(--success);
}

.timeline-content {
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.timeline-year {
  font-size: var(--text-base);
  margin-bottom: var(--sp-2);
  color: var(--text-main);
}

.timeline-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: var(--text-xs);
}

.detail-item {
  color: var(--text-muted);
}

/* Table wrapper for responsive scrolling */
.table-wrapper {
  overflow-x: auto;
  margin: var(--sp-4) 0;
}

/* ============================================
   Survivor Scenario Visualization
   ============================================ */

.survivor-toggle-section {
  margin-bottom: var(--sp-6);
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.toggle-header h4 {
  font-size: 1.25rem;
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  margin: 0 0 var(--sp-2) 0;
}

.toggle-description {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0 0 var(--sp-4) 0;
}

.scenario-badge.primary-scenario {
  background: rgba(0, 181, 119, 0.1);
  border: 1px solid rgba(0, 181, 119, 0.3);
  color: var(--primary);
}

.scenario-badge.spouse-scenario {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.badge-icon {
  font-size: 1.25rem;
}

/* Survivor impact metrics */
.survivor-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.survivor-metric-card {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
}

.survivor-metric-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* Survivor timeline */
.survivor-timeline-section {
  margin-top: var(--sp-6);
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.survivor-timeline-section h4 {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  margin: 0 0 var(--sp-2) 0;
}

.survivor-timeline {
  position: relative;
  padding-left: var(--sp-8);
}

.survivor-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--border-subtle), transparent);
}

.survivor-timeline-item {
  position: relative;
  padding: var(--sp-4) 0 var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-4);
}

.survivor-timeline-item .timeline-marker {
  position: absolute;
  left: -1.5rem;
  top: 1.25rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
}

.survivor-timeline-item.major-impact .timeline-marker {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.survivor-timeline-item.moderate-impact .timeline-marker {
  background: var(--warning);
  border-color: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.survivor-timeline-item.minor-impact .timeline-marker {
  background: var(--success);
  border-color: var(--success);
}

.timeline-age {
  font-size: var(--text-base);
  color: var(--text-main);
  margin-bottom: var(--sp-2);
}

.timeline-description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.timeline-amount {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  margin-top: var(--sp-1);
}

/* ============================================
   Spending Guardrails Visualization
   ============================================ */

.spending-toggle-section {
  margin-bottom: var(--sp-6);
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.spending-toggle-section .toggle-header h4 {
  font-size: 1.25rem;
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  margin: 0 0 var(--sp-2) 0;
}

.spending-toggle-section .toggle-description {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0 0 var(--sp-4) 0;
}

.strategy-badge.guardrails-strategy {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--info);
}

.strategy-badge.fixed-strategy {
  background: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(156, 163, 175, 0.3);
  color: var(--text-secondary);
}

/* Spending metrics */
.spending-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.spending-metric-card {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--page-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
}

.spending-metric-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* Spending adjustments timeline */
.spending-adjustments-section {
  margin-top: var(--sp-6);
  padding: var(--sp-6);
  background: var(--page-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.spending-adjustments-section h4 {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-main);
  margin: 0 0 var(--sp-2) 0;
}

.no-adjustments {
  font-size: var(--text-base);
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--sp-8) 0;
}

.adjustment-timeline {
  position: relative;
  padding-left: var(--sp-8);
  margin-top: var(--sp-6);
}

.adjustment-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--border-subtle), transparent);
}

.adjustment-timeline-item {
  position: relative;
  padding: var(--sp-4) 0 var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-4);
}

.adjustment-timeline-item .timeline-marker {
  position: absolute;
  left: -1.5rem;
  top: 1.25rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
}

.adjustment-timeline-item.major-adjustment .timeline-marker {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.adjustment-timeline-item.moderate-adjustment .timeline-marker {
  background: var(--warning);
  border-color: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.adjustment-timeline-item.minor-adjustment .timeline-marker {
  background: var(--success);
  border-color: var(--success);
}

.adjustment-details {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--text-base);
}

.adjustment-amount {
  font-weight: var(--fw-semibold);
}

.adjustment-result {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ============================================
   Loading States & Skeletons
   ============================================ */

.chart-skeleton {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-4);
  animation: fadeIn 0.3s ease;
}

.skeleton-header {
  width: 40%;
  height: 20px;
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--page-bg) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  height: 70%;
}

.skeleton-bar {
  flex: 1;
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--page-bg) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius) var(--radius) 0 0;
}

.skeleton-footer {
  width: 60%;
  height: 16px;
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--page-bg) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  margin-top: auto;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Loading spinner overlay */
.loading-spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.loading-spinner-overlay.visible {
  opacity: 1;
}

[data-theme="dark"] .loading-spinner-overlay {
  background: rgba(17, 24, 39, 0.95);
}

.loading-spinner-content {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--sp-4);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: var(--fw-medium);
}

/* Inline loader */
.inline-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-8);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inline-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Progress bar overlay */
.progress-bar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.progress-bar-overlay.visible {
  opacity: 1;
}

[data-theme="dark"] .progress-bar-overlay {
  background: rgba(17, 24, 39, 0.95);
}

.progress-bar-content {
  width: 400px;
  max-width: 90%;
  text-align: center;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius);
  transition: width var(--transition-slow);
  width: 0%;
}

.progress-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--sp-2);
}

.progress-percent {
  color: var(--text-main);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  font-family: var(--font-display);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  transform: translateX(calc(100% + 2rem));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
  border-left: 4px solid var(--primary);
  color: var(--text-main);
}

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

.toast-exit {
  transform: translateX(calc(100% + 2rem));
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast-message {
  flex: 1;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text-main);
}

.toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.toast-close:hover {
  color: var(--text-main);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

/* Toast variants */
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }

.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }
