.provenance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: #e5e9ec;
  color: #5a6975;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
  vertical-align: middle;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.provenance-badge:hover { background: #1a5632; color: #fff; }

.provenance-badge[data-source="ai-extracted"] { background: #e3f0e8; color: #1a5632; }
.provenance-badge[data-source="bill-derived"] { background: #e8eef5; color: #1f4d7a; }
.provenance-badge[data-source="calculator"]   { background: #f4ecdb; color: #7a4d1f; }
.provenance-badge[data-source="manual"]       { background: #eef0f2; color: #5a6975; }

.provenance-popover {
  display: none;
  position: absolute;
  top: 22px;
  left: 0;
  z-index: 100;
  min-width: 240px;
  padding: 10px 12px;
  background: #1a2332;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: normal;
  pointer-events: none;
}

.provenance-badge:hover .provenance-popover,
.provenance-badge:focus .provenance-popover { display: block; }

.provenance-popover dt { font-weight: 600; opacity: 0.7; margin-top: 6px; }
.provenance-popover dt:first-child { margin-top: 0; }
.provenance-popover dd { margin: 0; }
.provenance-popover .override-flag { color: #ffb84d; font-weight: 600; }

table.appendix-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
table.appendix-table th, table.appendix-table td {
  padding: 6px 10px;
  border: 1px solid #d4d8dc;
  text-align: left;
  vertical-align: top;
}
table.appendix-table th { background: #f5f7fa; font-weight: 600; }
table.appendix-table .override-flag { color: #b06b00; font-weight: 600; }
table.appendix-table code { font-size: 12px; background: #eef0f2; padding: 1px 4px; border-radius: 3px; }
