:root {
  --sans: Arial, Helvetica, sans-serif;
  font-family: var(--sans);
  color: #172b3a;
  background: #f3f6f8;
  --muted: #4c6273;
  --line: #d9e3e9;
  --accent: #086963;
  --selected: #e1f4ef;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --panel-shadow: 0 2px 5px #13293509;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #167c78; outline-offset: 2px; }
.masthead { background: linear-gradient(110deg, #102938, #17414c); color: white; border-bottom: 1px solid #284f59; }
.header-inner, main { width: min(100%, 90rem); margin: auto; padding: 2rem clamp(1rem, 4vw, 3rem); }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.source { margin: 0 0 .5rem; color: #a9e8db; font-size: .875rem; font-weight: 650; letter-spacing: .035em; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.summary { margin: .75rem 0 0; color: #dae8ed; font-size: .95rem; font-variant-numeric: tabular-nums; }
.summary:empty { display: none; }
.tabs { display: flex; gap: .3rem; width: min(100%, 90rem); margin: auto; padding: 0 clamp(1rem, 4vw, 3rem); flex-wrap: wrap; }
.tabs a { color: #dbebee; border-bottom: 3px solid transparent; border-radius: .35rem .35rem 0 0; padding: .65rem .85rem; text-decoration: none; font-weight: 650; font-size: .9rem; }
.tabs a:hover { background: #ffffff12; }
.tabs a[aria-current="page"] { color: white; background: #ffffff15; border-bottom-color: #72dac9; }
.tabs a:focus-visible { outline-color: #a9e8db; outline-offset: -2px; }
.sources { max-width: 58rem; padding: clamp(1rem, 2vw, 1.6rem); background: white; border: 1px solid var(--line); border-radius: .7rem; box-shadow: var(--panel-shadow); }
.source-list { list-style: none; margin: 0; padding: 0; }
.source-list li { padding: 1rem 0; border-top: 1px solid var(--line); }
.source-list h3 { margin: 0; font-size: 1.05rem; }
.source-list p { margin: .4rem 0 .65rem; color: var(--muted); }
.source-list a { color: var(--accent); font-weight: 650; overflow-wrap: anywhere; }
.source-list li p a { font-weight: 500; }
.sources + .sources { margin-top: 1rem; }
.dataset-content { display: grid; gap: 1rem; }
.dataset > p { max-width: 75ch; }
.dataset-content > h3 { margin: .9rem 0 0; padding-top: .7rem; border-top: 1px solid var(--line); font-size: 1.15rem; }
.dataset-panel { background: white; border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; min-width: 0; box-shadow: var(--panel-shadow); }
.dataset-panel summary { color: #18394a; cursor: pointer; font-weight: 700; }
.dataset-panel[open] > summary { margin-bottom: .65rem; }
.dataset-panel h3 { margin: .7rem 0; }
.dataset-panel a, .dataset a { color: var(--accent); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: .45rem; }
.table-scroll + h3 { margin-top: 1.25rem; }
.dataset-panel input { margin: .35rem 0; max-width: 30rem; }
.dataset-panel td { overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.sidebar, #details { background: white; border: 1px solid var(--line); border-radius: .7rem; padding: 1.25rem; min-width: 0; box-shadow: var(--panel-shadow); }
.sidebar { position: sticky; top: 1rem; }
h2 { margin: 0 0 .85rem; font-size: 1.3rem; line-height: 1.3; }
label { display: block; font-size: .875rem; font-weight: 650; }
#table-search { display: flex; align-items: center; gap: .4rem; margin: .4rem 0 .7rem; }
input[type="search"] { width: 100%; min-width: 0; padding: .65rem; font: inherit; border: 1px solid #839ba6; border-radius: .35rem; }
input[type="search"]::-webkit-search-cancel-button { appearance: none; }
#clear-query { cursor: pointer; padding: .6rem; border: 1px solid #839ba6; border-radius: .35rem; background: white; color: var(--accent); font: inherit; }
#clear-query:hover { background: var(--selected); }
.checkbox { display: flex; align-items: center; gap: .4rem; }
.checkbox input { accent-color: var(--accent); }
.muted { color: var(--muted); font-size: .875rem; }
#results { list-style: none; margin: 0; padding: 0 .25rem; max-height: min(55vh, 36rem); overflow: auto; border-top: 1px solid var(--line); }
#results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem; border-bottom: 1px solid var(--line); }
#results a { display: block; padding: .65rem .55rem; border-bottom: 1px solid var(--line); color: #132935; text-decoration: none; overflow-wrap: anywhere; font-family: var(--mono); font-size: .875rem; }
#results a:hover, #results a[aria-current] { background: var(--selected); }
#results a[aria-current] { box-shadow: inset 3px 0 var(--accent); }
.result-meta { display: block; margin-top: .25rem; color: var(--muted); font-size: .875rem; font-family: var(--sans); }
#results mark { background: #ffe9a9; color: inherit; }
#results a { border-bottom: 0; }
.pin-table, .filter-controls button, .filter-controls select { background: white; color: var(--accent); border: 1px solid var(--line); border-radius: .3rem; padding: .35rem .55rem; font: inherit; font-size: .875rem; }
.pin-table:not(:disabled), .filter-controls button { cursor: pointer; }
.pin-table:disabled { opacity: .5; }
th .pin-table { display: block; margin-top: .35rem; }
.filter-controls { display: flex; gap: .7rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filter-controls select { display: block; margin-top: .25rem; }
.unique-field { background: #fff0bf; }
tbody tr.evidence-field, tbody tr.evidence-field:hover { background: #fff0bf; }
.view-switch { flex-wrap: wrap; }
#details:focus { scroll-margin-top: 1rem; }
.review { min-width: 0; }
.view-switch { display: inline-flex; gap: .2rem; margin-bottom: .75rem; padding: .2rem; background: #e8eef2; border: 1px solid var(--line); border-radius: .55rem; }
.view-switch button { background: transparent; color: #344f61; border: 1px solid transparent; border-radius: .35rem; padding: .4rem .75rem; font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer; }
.view-switch button:hover { color: var(--accent); }
.view-switch button[aria-pressed="true"] { background: white; border-color: var(--line); color: var(--accent); box-shadow: var(--panel-shadow); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: .75rem; align-items: start; }
.overview-card { min-width: 0; border: 1px solid var(--line); border-radius: .45rem; padding: .8rem; scroll-margin-top: 1rem; }
.overview-card.is-current { border-color: var(--accent); box-shadow: inset 0 3px var(--accent); }
.overview-card h3 { margin: 0; font: 650 .95rem / 1.45 var(--mono); overflow-wrap: anywhere; }
.overview-card a { color: var(--accent); }
.overview-card p { margin: .35rem 0 .65rem; }
.overview-fields { list-style: none; padding: 0; margin: 0; }
.overview-fields li { overflow-wrap: anywhere; border-top: 1px solid var(--line); padding: .3rem .35rem; font: .875rem var(--mono); }
.overview-fields li.match { background: #ffe9a9; }
#details h2 { overflow-wrap: anywhere; color: var(--accent); margin-bottom: .45rem; }
#details[aria-label="Table details"] h2 { font-family: var(--mono); }
.notice { border-left: 3px solid #aa671b; background: #fff4df; padding: .75rem; }
.block { margin-top: 1rem; border: 1px solid var(--line); border-radius: .4rem; }
.block summary { padding: .75rem; background: #edf4f6; cursor: pointer; overflow-wrap: anywhere; }
.block summary code { font-size: .9rem; }
.block-content { padding: 0 .75rem .75rem; }
.provenance { overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .65rem .7rem; vertical-align: top; }
th { font-size: .875rem; color: #304c5e; background: #eaf1f5; }
tbody tr:nth-child(even) { background: #f6f9fb; }
tbody tr:hover { background: #eef5f8; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
td { overflow-wrap: anywhere; }
code { font-family: var(--mono); }
tbody tr.match, tbody tr.match:hover { background: var(--selected); }

@media (max-width: 46rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  #results { max-height: 13rem; }
  .header-inner, main { padding-block: 1.4rem; }
  .tabs a { padding: .55rem .65rem; }
  .sidebar, #details { padding: 1rem; }
}
