:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #59655f;
  --line: #d5ddd9;
  --surface: #f5f7f5;
  --paper: #ffffff;
  --brand: #0f5c4d;
  --brand-dark: #0a4238;
  --accent: #e6a819;
  --notice: #fff7dc;
  --max: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; line-height: 1.55; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
button, input { font: inherit; letter-spacing: 0; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 10; background: var(--ink); color: #fff; padding: .7rem 1rem; }
.skip-link:focus { top: 1rem; }
.site-header { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 0 max(1.25rem, calc((100vw - var(--max)) / 2)); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-size: 1.2rem; font-weight: 780; text-decoration: none; }
.brand img { display: block; }
.site-header nav { display: flex; align-items: center; gap: 1.5rem; }
.site-header nav a { color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
.site-header nav a:hover { color: var(--brand); }
.data-notice { padding: .65rem max(1.25rem, calc((100vw - var(--max)) / 2)); background: var(--notice); border-bottom: 1px solid #eadb9b; color: #4b421f; font-size: .88rem; }
main { min-height: calc(100vh - 220px); }
.workspace, .results-page, .record-page, .prose-page, .error-page { width: min(var(--max), calc(100% - 2.5rem)); margin: 0 auto; }
.workspace { padding: clamp(2.5rem, 7vh, 5.2rem) 0 3rem; }
.workspace-heading { max-width: 750px; }
.eyebrow { margin: 0 0 .55rem; color: var(--brand); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
h1, h2 { line-height: 1.12; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 790; }
h2 { margin: 0 0 1rem; font-size: 1.45rem; }
.workspace-heading > p:last-child { max-width: 660px; margin: 1rem 0 0; color: var(--muted); font-size: 1.04rem; }
.search-tool { margin: 2.3rem 0 1.4rem; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 12px 35px rgba(20, 55, 45, .08); }
.mode-switch { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.mode-switch label { min-width: 0; }
.mode-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; clip-path: inset(50%); pointer-events: none; }
.mode-switch span { display: flex; min-height: 48px; align-items: center; justify-content: center; padding: .65rem; border-right: 1px solid var(--line); color: var(--muted); font-size: .86rem; font-weight: 700; text-align: center; cursor: pointer; }
.mode-switch label:last-child span { border-right: 0; }
.mode-switch input:checked + span { background: var(--paper); color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.mode-switch input:focus-visible + span { outline: 3px solid #75b9aa; outline-offset: -3px; }
.search-fields { display: flex; align-items: end; gap: .85rem; padding: 1.25rem; }
.vehicle-fields { flex: 1; display: grid; grid-template-columns: 140px 1fr 1fr; gap: .85rem; }
.term-field { flex: 1; }
.vehicle-fields label, .term-field { color: var(--muted); font-size: .76rem; font-weight: 720; }
input { width: 100%; height: 46px; margin-top: .3rem; padding: 0 .8rem; border: 1px solid #aebbb5; border-radius: 4px; background: #fff; color: var(--ink); }
input:focus { outline: 3px solid rgba(15, 92, 77, .2); border-color: var(--brand); }
.primary-button, .secondary-button, .external-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: .55rem; padding: .7rem 1rem; border: 1px solid var(--brand); border-radius: 4px; font-size: .86rem; font-weight: 760; text-decoration: none; }
.primary-button { flex: 0 0 auto; background: var(--brand); color: #fff; cursor: pointer; }
.primary-button:hover { background: var(--brand-dark); color: #fff; }
.primary-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.secondary-button { background: #fff; color: var(--brand); }
.stats { display: flex; gap: 2.3rem; margin: 0; padding: 0; }
.stats div { display: flex; align-items: baseline; gap: .4rem; }
.stats dt { font-weight: 780; }
.stats dd { margin: 0; color: var(--muted); font-size: .82rem; }
.sync-status { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; }
.source-label { font-weight: 700; }
.source-label.current { color: var(--brand); }
.source-label.inactive { color: #a13727; }
.next-band { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 2rem max(1.25rem, calc((100vw - var(--max)) / 2)); border-block: 1px solid var(--line); background: var(--surface); }
.next-band h2 { margin-bottom: .4rem; }
.next-band p { max-width: 700px; margin: 0; color: var(--muted); }
.external-button { flex: 0 0 auto; color: var(--brand); background: #fff; }
.results-page { padding: 2.5rem 0 4rem; }
.results-page header h1, .record-header h1, .prose-page h1, .error-page h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.results-intro { max-width: 760px; margin: .75rem 0 0; color: var(--muted); }
.results-page .search-tool { margin-top: 1.5rem; }
.result-summary { margin: 1.4rem 0 .7rem; color: var(--muted); font-size: .86rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: .85rem; }
.eo-table { min-width: 920px; }
.eo-table th:first-child { width: 160px; }
.eo-table th:nth-child(3), .eo-table th:nth-child(4) { width: 110px; }
.eo-table th:nth-child(5) { width: 175px; }
.eo-table th:last-child { width: 130px; }
.date-unavailable { color: var(--muted); }
th { padding: .75rem; background: var(--surface); color: var(--muted); font-size: .7rem; text-align: left; text-transform: uppercase; }
td { padding: .8rem .75rem; border-top: 1px solid var(--line); vertical-align: top; }
td small { display: block; margin-top: .15rem; color: var(--muted); }
tbody tr:hover { background: #f9fbfa; }
.pagination { display: flex; justify-content: space-between; margin-top: 1rem; }
.pagination a { font-weight: 700; }
.empty-state { padding: 2.5rem; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.empty-state h2 { margin-bottom: .4rem; }
.empty-state p { margin: 0; color: var(--muted); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; color: var(--muted); font-size: .8rem; }
.record-page { padding: 2rem 0 4rem; }
.record-header { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: 1.6rem; border-bottom: 1px solid var(--line); }
.record-header p:last-child { margin: .6rem 0 0; color: var(--muted); }
.record-actions { display: flex; gap: .6rem; }
.record-metadata { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 2.5rem; border-bottom: 1px solid var(--line); }
.record-metadata div { padding: 1.1rem 1rem 1.1rem 0; }
.record-metadata dt { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.record-metadata dd { margin: .25rem 0 0; font-weight: 680; }
.record-page section + section { margin-top: 2.7rem; }
.document-viewer { scroll-margin-top: 1rem; }
.document-viewer-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.document-viewer-heading h2 { margin-bottom: 0; }
.document-viewer-actions { display: flex; gap: .55rem; }
.pdf-frame { display: block; width: 100%; height: clamp(560px, 76vh, 900px); border: 1px solid var(--line); background: var(--surface); }
.document-fallback { margin: .7rem 0 0; color: var(--muted); font-size: .8rem; }
.empty-inline { padding: 1rem; background: var(--surface); color: var(--muted); }
.prose-page { max-width: 760px; padding: 3.5rem 0 5rem; }
.prose-page h2 { margin: 2.2rem 0 .5rem; }
.prose-page p { color: #38443f; }
.error-page { padding: 5rem 0; }
footer { display: flex; justify-content: space-between; gap: 1.5rem; padding: 1.6rem max(1.25rem, calc((100vw - var(--max)) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header { height: auto; min-height: 64px; padding-block: .7rem; }
  .site-header nav a:nth-child(-n+2) { display: none; }
  .workspace, .results-page, .record-page, .prose-page, .error-page { width: min(100% - 1.5rem, var(--max)); }
  .workspace { padding-top: 2.5rem; }
  h1 { font-size: 2.15rem; }
  .mode-switch { grid-template-columns: repeat(2, 1fr); }
  .mode-switch label:nth-child(2) span { border-right: 0; }
  .mode-switch label:nth-child(-n+2) span { border-bottom: 1px solid var(--line); }
  .search-fields, .record-header, .record-actions, .document-viewer-heading, .document-viewer-actions, .next-band, footer { align-items: stretch; flex-direction: column; }
  .vehicle-fields { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; }
  .stats div { display: block; }
  .record-header { align-items: stretch; }
  .record-metadata { grid-template-columns: 1fr 1fr; }
  .pdf-frame { height: 560px; }
  footer { gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
