.reference-table-wrap { display: block; max-height: 68vh; overflow: auto; overscroll-behavior: contain; margin-top: 1rem; border: 1px solid #d7dbe0; border-radius: 10px; background: #fff; }
.reference-scope-switcher { margin: .55rem 0 0; font-size: .82rem; }
.reference-table-wrap:focus-visible { outline: 3px solid rgba(47, 111, 103, .36); outline-offset: 2px; }
.reference-display-controls { display: grid; grid-template-columns: auto minmax(12rem, 18rem); align-items: end; gap: 10px 14px; margin-top: 12px; padding: 12px; border: 1px solid #d7dbe0; border-radius: 10px; background: #fff; }
.reference-view-field, .reference-display-controls label { display: grid; gap: 5px; min-width: 0; }
.reference-view-field > span, .reference-display-controls label > span { color: #5d6470; font-size: .75rem; font-weight: 700; }
.reference-view-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid #aeb6b4; border-radius: 8px; background: #f4f5f3; }
.reference-view-switch button { min-width: 7rem; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 0; background: transparent; color: #3e464b; font: inherit; font-weight: 800; }
.reference-view-switch button + button { border-left: 1px solid #aeb6b4; }
.reference-view-switch button[aria-pressed="true"] { background: var(--accent-2); color: #fff; }
.reference-display-controls select { min-height: 44px; }
.reference-table-hint { grid-column: 1 / -1; margin: 0; color: #5d6470; font-size: .78rem; line-height: 1.55; }
.reference-comparison-table { display: table; width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.reference-table-wrap thead th { position: sticky; top: 0; z-index: 3; background: #ecebe8; }
.reference-table-wrap th, .reference-table-wrap td { padding: 10px 12px; vertical-align: top; }
.reference-table-wrap [data-column-type="number"] { min-width: 4.5rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.reference-table-wrap [data-column-type="date"] { min-width: 7.4rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reference-identity-cell { position: sticky; left: 0; z-index: 2; min-width: 9rem; max-width: 12rem; background: #fff; box-shadow: 1px 0 0 #c8cdcb, 10px 0 12px -12px rgba(32,35,38,.7); overflow-wrap: anywhere; font-weight: 800; }
.reference-identity-primary { display: block; }
.reference-identity-secondary { display: block; margin-top: .25rem; color: #5d6470; font-size: .72rem; font-weight: 500; line-height: 1.35; }
.reference-identity-official-source-link { display: block; margin-top: .25rem; font-size: .72rem; font-weight: 700; line-height: 1.35; }
.reference-ocr-link { display: block; margin-top: .3rem; color: #8b4c28; font-size: .72rem; font-weight: 800; line-height: 1.35; }
.reference-card .reference-ocr-link { margin-top: .65rem; }
.reference-card-meta .reference-identity-secondary { display: inline; margin-top: 0; }
.reference-field-provenance { display: block; margin-top: .2rem; color: #5d6470; font-size: .68rem; font-weight: 600; line-height: 1.35; }
.reference-field-provenance[data-display-status="official_confirmed"] { color: var(--accent-2); }
.reference-field-provenance[data-display-status="conflict"] { color: #8b4c28; }
.reference-stat-provenance { display: block; margin-top: .15rem; color: #8b4c28; font-size: .64rem; font-weight: 700; line-height: 1.25; }
.reference-stats .reference-stat-provisional { background: #fff7e8; }
.reference-table-wrap thead .reference-identity-cell { z-index: 5; background: #e3e5e1; }
.reference-table-wrap tbody tr:nth-child(even), .reference-table-wrap tbody tr:nth-child(even) .reference-identity-cell { background: #f8f7f5; }
.reference-cards[hidden], .reference-table-wrap[hidden], .reference-display-controls [hidden], .reference-table-hint[hidden] { display: none !important; }
@media (max-width: 640px) {
  .reference-display-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 12px; }
  .reference-view-switch button { min-width: 0; padding-inline: 8px; }
  .reference-table-wrap { max-height: 62dvh; margin-top: 10px; }
  .reference-comparison-table { font-size: 12px; }
  .reference-table-wrap th, .reference-table-wrap td { padding: 8px 10px; }
  .reference-table-wrap [data-column-type="number"] { width: 3.5rem; min-width: 3.5rem; max-width: 3.5rem; }
  .reference-identity-cell { width: clamp(6.5rem, 29vw, 7.25rem); min-width: clamp(6.5rem, 29vw, 7.25rem); max-width: clamp(6.5rem, 29vw, 7.25rem); white-space: normal; word-break: break-word; }
}
.reference-stat-pending { color: #6b6257; font-size: .78rem; }
.reference-stat-pending-note { margin: .5rem 0 0; color: #6b6257; font-size: .85rem; }
