:root {
  color-scheme: light;
  --paper: #f5f6f2;
  --white: #fff;
  --ink: #172421;
  --muted: #6a7772;
  --line: #dfe5df;
  --green: #146c53;
  --green-soft: #e3f1e9;
  --orange: #d65b36;
  --orange-soft: #fff0e9;
  --yellow: #e8bd42;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "DM Sans", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; }
button, input { font: inherit; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 4.4%; background: var(--ink); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 13px; letter-spacing: .08em; font-weight: 700; }
.brand b { color: #b9d269; font-weight: 500; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; }
.brand-mark img { display: block; width: 32px; height: 32px; object-fit: contain; }
.topbar-right { display: flex; align-items: center; gap: 22px; color: #bbc6c0; font-size: 11px; }
.environment { display: flex; gap: 8px; align-items: center; font-family: var(--mono); letter-spacing: .04em; }
.environment i { width: 7px; height: 7px; background: #a9ce5d; border-radius: 50%; }
.built-at { font-family: var(--mono); }
main { max-width: 1500px; margin: 0 auto; padding: 36px 4.4% 24px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.eyebrow, .stamp-label { margin: 0 0 9px; color: var(--green); font: 600 10px var(--mono); letter-spacing: .08em; }
h1 { margin: 0; font-size: 31px; line-height: 1.15; letter-spacing: 0; font-weight: 600; }
.intro { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.batch-stamp { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font: 12px var(--mono); }
.stamp-label { margin: 0; color: var(--muted); font-size: 9px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--white); border: 1px solid var(--line); margin-bottom: 18px; }
.metric { min-height: 103px; padding: 17px 20px 14px; border-right: 1px solid var(--line); position: relative; }
.metric:last-child { border: 0; }
.metric-label, .metric-note { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: inline-block; margin: 3px 9px 0 0; font: 500 28px var(--mono); }
.metric-note { display: inline; font-size: 10px; }
.metric-review::before { content: ""; position: absolute; width: 3px; top: 0; bottom: 0; left: 0; background: var(--orange); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, .8fr); min-height: 540px; border: 1px solid var(--line); background: var(--white); }
.list-pane { min-width: 0; border-right: 1px solid var(--line); }
.list-header { min-height: 69px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 19px; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.subtle { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; width: min(260px, 52%); height: 34px; padding: 0 10px; border: 1px solid var(--line); color: var(--muted); }
.search-box span { font-size: 19px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search-box:focus-within { border-color: var(--green); }
.toolbar { min-height: 43px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 19px; background: #f8f9f6; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 3px; }
.filter { height: 28px; padding: 0 9px; border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.filter span { margin-left: 3px; color: #87928d; font: 10px var(--mono); }
.filter.active { background: var(--ink); color: #fff; }
.filter.active span { color: #c6d3cb; }
.table-hint { color: #8b9691; font-size: 9px; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.export-mode { height: 29px; max-width: 120px; padding: 0 24px 0 8px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-size: 10px; }
.export-mode:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.export-button { display: inline-flex; align-items: center; gap: 6px; min-height: 29px; padding: 0 10px; border: 1px solid var(--green); background: var(--white); color: var(--green); font-size: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.export-button:hover { background: var(--green-soft); }
.export-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.export-button span { font-size: 15px; line-height: 1; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #fff; }
th { height: 36px; padding: 0 13px; color: #8a9590; font: 9px var(--mono); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 19px; }
td { height: 57px; padding: 8px 13px; border-top: 1px solid #edf0ec; vertical-align: middle; }
tr.data-row { cursor: pointer; transition: background .14s ease; }
tr.data-row:hover { background: #f5f8f4; }
tr.data-row.selected { background: #eff6ef; box-shadow: inset 3px 0 var(--green); }
.nif { display: block; color: var(--green); font: 500 11px var(--mono); }
.company-name { display: block; max-width: 250px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 10px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #aaa; }
.status.found { color: var(--green); }
.status.found::before { background: #43a179; }
.status.empty { color: #77817d; }
.status.review { color: #a64b2e; }
.status.review::before { background: var(--orange); }
.count, .date-cell { font: 10px var(--mono); color: var(--muted); white-space: nowrap; }
.row-arrow { color: #a1aaa5; font-size: 17px; }
.no-matches { padding: 38px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.detail-pane { min-width: 0; padding: 21px; background: #fbfcfa; }
.empty-detail { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-height: 450px; max-width: 250px; margin: auto; }
.detail-symbol { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; background: var(--green-soft); color: var(--green); font-size: 21px; }
.empty-detail p { color: var(--muted); line-height: 1.6; font-size: 12px; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.detail-head h2 { margin-top: 4px; font-size: 17px; }
.detail-nif { color: var(--green); font: 12px var(--mono); }
.detail-label { color: var(--muted); font: 9px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.detail-status { align-self: flex-start; padding: 5px 7px; background: var(--green-soft); color: var(--green); font-size: 9px; white-space: nowrap; }
.detail-status.empty { background: #edf0ed; color: #66736d; }
.detail-status.review { background: var(--orange-soft); color: #a64b2e; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.meta-value { display: block; margin-top: 5px; color: var(--ink); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.detail-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; }
.evidence-link { display: inline-flex; align-items: center; min-height: 30px; padding: 0 9px; border: 1px solid var(--line); color: var(--green); text-decoration: none; font-size: 10px; }
.evidence-link:hover { border-color: var(--green); background: var(--green-soft); }
.publication-list { display: grid; gap: 12px; margin-top: 6px; }
.publication { padding: 13px; border: 1px solid var(--line); background: #fff; }
.publication h3 { margin: 5px 0 8px; font-size: 12px; line-height: 1.45; font-weight: 600; }
.pub-date { color: var(--muted); font: 9px var(--mono); }
.clause { margin: 0; padding-left: 10px; border-left: 2px solid var(--yellow); color: #34423d; font-size: 11px; line-height: 1.55; }
.review-note { margin: 9px 0 0; color: #a64b2e; font-size: 10px; }
.evidence-caption { margin: 10px 0 5px; color: var(--muted); font: 9px var(--mono); }
.evidence-text { max-height: 135px; overflow: auto; padding: 9px; background: #f4f6f2; color: #48554f; font: 10px/1.5 var(--mono); white-space: pre-wrap; }
.search-page-text { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.search-page-text summary { cursor: pointer; color: var(--green); }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 2px; color: var(--muted); font-size: 10px; }
footer span:last-child { font-family: var(--mono); }

@media (max-width: 980px) {
  main { padding-right: 3%; padding-left: 3%; }
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }
  .table-hint { display: none; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}
@media (max-width: 720px) {
  .topbar { height: 54px; padding: 0 16px; }
  .topbar-right { gap: 0; }
  .built-at { display: none; }
  main { padding: 25px 14px 16px; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 27px; }
  .intro { max-width: 300px; line-height: 1.5; }
  .batch-stamp { padding-top: 4px; font-size: 10px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 86px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3), .metric:nth-child(4) { border-bottom: 0; }
  .metric strong { font-size: 24px; }
  .workspace { display: flex; flex-direction: column; }
  .list-pane { border-right: 0; }
  .list-header { align-items: flex-start; flex-direction: column; }
  .search-box { width: 100%; }
  .toolbar { padding: 6px 10px; }
  .toolbar-actions { flex-shrink: 0; }
  .filters { flex-wrap: wrap; }
  .filter { padding: 0 7px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  td { height: 55px; padding: 8px; }
  th { padding: 0 8px; }
  th:first-child, td:first-child { padding-left: 12px; }
  .detail-pane { border-top: 1px solid var(--line); padding: 17px; }
  .empty-detail { min-height: 210px; }
  footer { flex-direction: column; line-height: 1.5; }
}