/* ============================================
   TAX BRACKET VISUALIZER
   ============================================ */

.tb-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 3rem;
  align-items: start;
}

.tb-results {
  position: relative;
}

.tb-raise-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Raise result box */
.tb-raise-result {
  margin-top: 1rem;
  background: var(--surface);
  border-radius: 10px;
  padding: 1rem;
}

.tb-raise-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  color: var(--text-muted);
}

.tb-raise-val {
  font-weight: 700;
  color: var(--navy);
}

.tb-raise-red { color: var(--red) !important; }
.tb-raise-green { color: var(--emerald) !important; }

.tb-raise-total {
  border-top: 1px solid var(--surface-alt);
  margin-top: 0.3rem;
  padding-top: 0.5rem;
  font-weight: 600;
}

.tb-raise-verdict {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
}

/* ---- Rate hero ---- */

.tb-rates-hero {
  background: var(--navy);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.tb-rate-box {
  flex: 1;
  text-align: center;
}

.tb-rate-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.tb-rate-num {
  font-size: 3rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tb-rate-effective {
  color: var(--emerald);
}

.tb-rate-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.tb-rate-divider {
  width: 1px;
  height: 60px;
  background: var(--navy-mid);
}

/* ---- Waterfall visualization ---- */

.tb-waterfall-card {
  background: var(--white);
  border: 1px solid var(--surface-alt);
  border-radius: 16px;
  padding: 1.5rem;
}

.tb-waterfall-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.tb-waterfall-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.tb-waterfall {
  display: flex;
  width: 100%;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.tb-wf-bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  transition: width 0.6s var(--ease-out);
  position: relative;
  min-width: 0;
  overflow: hidden;
  cursor: default;
}

.tb-wf-bar:hover {
  filter: brightness(1.15);
}

.tb-wf-bar span {
  white-space: nowrap;
  padding: 0 4px;
}

/* Bracket colors */
.tb-wf-10 { background: #22C55E; }
.tb-wf-12 { background: #3B82F6; }
.tb-wf-22 { background: #8B5CF6; }
.tb-wf-24 { background: #F59E0B; }
.tb-wf-32 { background: #EF4444; }
.tb-wf-35 { background: #DC2626; }
.tb-wf-37 { background: #991B1B; }

/* Legend */
.tb-waterfall-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tb-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tb-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.tb-legend-amount {
  font-weight: 600;
  color: var(--text);
}

/* ---- Summary card ---- */

.tb-summary-card {
  background: var(--white);
  border: 1px solid var(--surface-alt);
  border-radius: 16px;
  padding: 1.5rem;
}

.tb-summary-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
}

/* ---- Bracket detail table ---- */

.tb-bracket-table-card {
  background: var(--white);
  border: 1px solid var(--surface-alt);
  border-radius: 16px;
  padding: 1.5rem;
  overflow-x: auto;
}

.tb-bracket-table-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
}

.tb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tb-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--surface-alt);
}

.tb-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--surface-alt);
  color: var(--text);
}

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

.tb-table .tb-row-active {
  background: rgba(16, 185, 129, 0.05);
}

.tb-table .tb-row-active td:first-child {
  font-weight: 700;
  color: var(--emerald);
}

.tb-table .tb-bracket-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.tb-table .tb-row-empty td {
  color: var(--text-light);
  font-style: italic;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 1024px) {
  .tb-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .fc-results-sticky {
    position: static;
  }
}

@media (max-width: 768px) {
  .tb-rates-hero {
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
  }

  .tb-rate-divider {
    width: 60px;
    height: 1px;
  }

  .tb-rate-num {
    font-size: 2.25rem;
  }

  .tb-waterfall {
    height: 44px;
  }

  .tb-wf-bar span {
    font-size: 0.6rem;
  }

  .tb-table {
    font-size: 0.75rem;
  }

  .tb-table th, .tb-table td {
    padding: 0.4rem 0.5rem;
  }
}
