@font-face { font-family: Asap; src: url('fonts/asap-latin-normal-variable.woff2') format('woff2'); font-style: normal; font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Ropa Sans'; src: url('fonts/ropa-sans-latin-400-normal.woff2') format('woff2'); font-style: normal; font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --red-700: #a51629;
  --red-600: #c21b30;
  --red-50: #fcf0f2;
  --gray-900: #242424;
  --gray-800: #333333;
  --gray-600: #626262;
  --gray-400: #a3a3a3;
  --gray-300: #cecece;
  --gray-200: #e5e5e5;
  --gray-100: #f3f3f3;
  --white: #ffffff;
  --brand: var(--red-600);
  --brand-hover: var(--red-700);
  --brand-subtle: var(--red-50);
  --text: var(--gray-800);
  --text-strong: var(--gray-900);
  --text-secondary: var(--gray-600);
  --surface: var(--white);
  --surface-subtle: var(--gray-100);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --map-ground: #e9e3d3;
  --event-birth: #22657a;
  --event-birth-subtle: #edf4f7;
  --event-marriage: #a51629;
  --event-marriage-subtle: #fcf0f2;
  --event-death: #575757;
  --warning-text: #735218;
  --warning-surface: #f9f3e7;
  --header-height: 64px;
  --timeline-height: 104px;
  --font-ui: Asap, Arial, sans-serif;
  --font-heading: 'Ropa Sans', Asap, Arial, sans-serif;
  --radius: 2px;
  --shadow-menu: 0 8px 28px #00000024;
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: var(--font-ui);
  font-size: 14px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
/* The offscreen mobile record sheet must not turn map gestures or marker
   focus into document scrolling. Each reading panel scrolls internally. */
html { overflow: clip; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: clip; background: var(--surface); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
button, input, select, textarea, a { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); }
input, textarea { accent-color: var(--brand); caret-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 1; }
::selection { color: var(--white); background: var(--brand); }
* { scrollbar-width: thin; scrollbar-color: var(--gray-400) transparent; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-400); border: 1px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }
[hidden] { display: none !important; }
svg { display: block; flex-shrink: 0; }
button svg, a svg { pointer-events: none; }
button, select, a { touch-action: manipulation; }
p { line-height: 1.6; }
h1, h2, h3 { color: var(--text-strong); text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: 8px; z-index: 200; background: var(--surface); padding: 12px 16px; border: 2px solid var(--brand); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.icon, [data-icon] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon { width: 18px; height: 18px; }
.icon svg, [data-icon] svg { width: 18px; height: 18px; stroke-width: 1.7; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; font-weight: 500; line-height: 1.35; text-decoration: none; }
.button:hover { background: var(--surface-subtle); }
.button.is-active { color: var(--white); background: var(--brand); border-color: var(--brand); }
.button-quiet { border-color: transparent; background: transparent; }
.icon-button { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border: 0; border-radius: var(--radius); background: transparent; }
.icon-button:hover { background: var(--surface-subtle); }
select { min-height: 40px; max-width: 100%; padding: 7px 25px 7px 9px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background-color: var(--surface); font-size: 12px; cursor: pointer; }

/* Archive identity: white masthead, direct navigation, one red rule. */
.app-header { position: relative; z-index: 100; display: flex; flex: 0 0 var(--header-height); align-items: center; gap: 36px; height: var(--header-height); padding: 0 24px; border-bottom: 3px solid var(--brand); background: var(--surface); }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; color: var(--text-strong); text-decoration: none; }
.brand:hover { color: var(--text-strong); }
.brand-name { font-family: var(--font-heading); font-size: 32px; font-weight: 400; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.brand-year { color: var(--brand); margin-left: 4px; }
.main-nav { display: flex; align-self: stretch; align-items: stretch; gap: 28px; }
.nav-link { position: relative; border: 0; padding: 0 2px; background: transparent; color: var(--text); font-size: 18px; font-weight: 400; white-space: nowrap; }
.nav-link::after { position: absolute; left: 0; right: 0; bottom: 10px; height: 2px; content: ''; background: transparent; }
.nav-link:hover, .nav-link.is-active { color: var(--brand); }
.nav-link.is-active::after { background: var(--brand); }
.header-actions { position: relative; display: flex; align-items: center; gap: 20px; margin-left: auto; }
.project-state { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.status-dot { display: none; }
.export-menu { position: absolute; top: calc(100% + 12px); right: 0; z-index: 120; width: 270px; padding: 6px; background: var(--surface); box-shadow: var(--shadow-menu); }
.export-menu a { display: block; min-height: 40px; padding: 11px 12px; color: var(--text); font-size: 13px; text-decoration: none; }
.export-menu a:hover { color: var(--brand); background: var(--brand-subtle); }

/* Records and selected evidence share a flat reading surface. */
.app-main { position: relative; display: grid; grid-template-columns: 360px minmax(0,1fr); flex: 1 1 auto; min-height: 0; }
.research-dock { position: relative; z-index: 4; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
.records-panel { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
body.has-detail .records-panel { display: none; }
.search-wrap { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; height: 44px; margin: 16px 18px 12px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); }
.search-wrap:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }
.search-wrap > [data-icon] { color: var(--text-secondary); }
.search-wrap input { width: 100%; min-width: 0; height: 40px; border: 0; padding: 0; color: var(--text); background: transparent; outline: none; font-size: 13px; }
.search-wrap input::-webkit-search-cancel-button { cursor: pointer; }
.search-wrap kbd { color: var(--text-secondary); font: 12px var(--font-ui); }
#clear-search { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 40px; flex: 0 0 36px; margin-right: -8px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); }
#clear-search:hover { color: var(--brand); }
#clear-search svg { width: 16px; height: 16px; }
.records-tabs { display: grid; grid-template-columns: 1.25fr .9fr 1.15fr .8fr; flex-shrink: 0; padding: 0 12px; border-bottom: 1px solid var(--border); }
.record-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; height: 56px; padding: 7px 2px; border: 0; color: var(--text-secondary); background: transparent; font-size: 12px; line-height: 1.3; }
.record-tab span { font-size: 12px; font-variant-numeric: tabular-nums; }
.record-tab.is-active { color: var(--brand); font-weight: 700; }
.record-tab.is-active::after { position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--brand); content: ''; }
.record-tab:hover { color: var(--brand); }
.records-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-shrink: 0; margin: 22px 18px 14px; }
.records-heading h1 { margin: 0; font-family: var(--font-heading); font-size: 24px; line-height: 1.2; font-weight: 400; }
.records-heading p { margin: 6px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.records-heading select { flex-shrink: 0; min-height: 36px; max-width: 105px; padding-left: 6px; padding-right: 17px; font-size: 12px; }
#profile-filter { max-width: 135px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; padding: 0 18px 16px; }
.filters button, .filter-chip { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); font-size: 12px; }
.filters button [data-icon] svg { width: 14px; height: 14px; }
.filters button.is-active, .filter-chip.is-active { border-color: var(--border-strong); background: var(--surface-subtle); color: var(--text); }
.filters button:not(.is-active), .filter-chip:not(.is-active) { border-color: transparent; color: var(--text-secondary); background: transparent; }
.filters button:not(.is-active) .filter-dot, .filter-chip:not(.is-active) i { background: transparent; outline: 1px solid currentColor; }
.filters button:hover { border-color: var(--text-secondary); }
.filter-dot, .filter-chip i { display: inline-block; flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.filter-chip > span { font-size: 12px; font-variant-numeric: tabular-nums; }
.house-filters { display: flex; gap: 7px; flex-shrink: 0; padding: 0 18px 16px; }
.house-filters select { width: 50%; min-width: 0; font-size: 12px; }
.active-filter { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-shrink: 0; margin: 0 18px 12px; padding: 8px 10px; background: var(--brand-subtle); color: var(--brand); font-size: 12px; }
.active-filter button { min-height: 28px; min-width: 28px; border: 0; background: transparent; padding: 3px; }
.active-filter svg { width: 14px; height: 14px; }
.records-list { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: 8px; scrollbar-gutter: stable; }
.record-day-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 10px 18px; background: var(--surface-subtle); color: var(--text); font-size: 12px; font-weight: 700; line-height: 1.4; }
.record-day-heading span { color: var(--text-secondary); font-weight: 400; }
.record-day-heading button { padding: 0; border: 0; color: inherit; background: transparent; font-size: inherit; font-weight: inherit; }
.record-day-heading button:hover { text-decoration: underline; }
.record-day-heading.is-active { color: var(--brand); background: var(--brand-subtle); }
.record-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 76px; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; }
.record-row:hover { background: var(--surface-subtle); }
.record-row.is-selected { background: var(--brand-subtle); }
.record-row:focus-visible { outline-offset: -3px; }
.record-icon { display: inline-flex; flex: 0 0 24px; width: 24px; height: 27px; align-items: center; justify-content: center; color: var(--text-secondary); }
.record-icon svg { width: 17px; height: 17px; }
.record-icon.baptism, .record-icon.birth { color: var(--event-birth); }
.record-icon.marriage { color: var(--event-marriage); }
.record-icon.burial, .record-icon.death { color: var(--event-death); }
.record-main { flex: 1 1 auto; min-width: 0; }
.record-title { display: block; margin: 0 0 5px; color: var(--text-strong); font-size: 14px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.record-subtitle { display: block; margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.record-date { flex: 0 0 auto; padding-top: 2px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 5px; color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.record-meta .icon { width: 12px; height: 12px; }
.record-meta.reviewed { color: var(--text); }
.record-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; background: var(--surface-subtle); color: var(--text); font-size: 12px; font-weight: 500; line-height: 1.4; }
.record-badge .icon { width: 11px; height: 11px; }
.person-initial { flex: 0 0 26px; display: flex; align-items: center; justify-content: center; width: 26px; height: 28px; background: var(--surface-subtle); color: var(--text-secondary); font-size: 13px; }
.records-footer { flex-shrink: 0; min-height: 38px; padding: 10px 18px; border-top: 1px solid var(--border); color: var(--text-secondary); background: var(--surface); font-size: 12px; line-height: 1.45; }
.show-more { display: block; width: calc(100% - 36px); min-height: 40px; margin: 14px 18px 4px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--brand); font-size: 13px; }
.show-more:hover { background: var(--brand-subtle); }
.empty-state { padding: 30px 22px; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.empty-state > [data-icon] { margin-bottom: 16px; }
.empty-state h2, .empty-state h3, .empty-state strong { display: block; margin: 0 0 8px; color: var(--text-strong); font-size: 16px; line-height: 1.4; }
.empty-state p { margin: 0 0 12px; }
.loading-skeleton { padding: 9px 18px; }
.loading-skeleton i { display: block; height: 58px; margin: 12px 0; background: var(--surface-subtle); animation: loading 1.5s ease-in-out infinite alternate; }
@keyframes loading { from { opacity: .45; } to { opacity: 1; } }

/* The original cartography supplies the only parchment surface. */
.map-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--map-ground); }
.map-topbar { position: absolute; left: 16px; top: 16px; right: 16px; z-index: 12; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-source-control { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); background: var(--surface); pointer-events: auto; }
.map-source-control > [data-icon] { color: var(--text-secondary); }
.map-current-year { font-size: 13px; font-weight: 500; white-space: nowrap; }
.map-source-control > [data-icon] svg { width: 16px; height: 16px; }
.map-source-control select { min-width: 0; min-height: 38px; padding: 0 18px 0 0; border: 0; background-color: transparent; font-size: 13px; font-weight: 500; }
.map-date-separator { width: 1px; height: 14px; background: var(--border-strong); }
#map-source-description { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.map-layer-toggle { flex-shrink: 0; font-size: 13px; pointer-events: auto; }
.map-layer-toggle svg { width: 16px; height: 16px; }
.layer-menu { position: absolute; right: 0; top: 48px; z-index: 30; width: 300px; padding: 18px; background: var(--surface); box-shadow: var(--shadow-menu); pointer-events: auto; }
.layer-menu strong { display: block; margin-bottom: 10px; font-size: 15px; }
.layer-menu label { display: flex; align-items: center; gap: 9px; min-height: 40px; color: var(--text); font-size: 13px; cursor: pointer; }
.layer-menu input { width: 16px; height: 16px; margin: 0; }
.layer-menu p { margin: 12px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.map-viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; overscroll-behavior: contain; user-select: none; outline-offset: -3px; }
.map-viewport.is-dragging, .map-viewport:active { cursor: grabbing; }
.map-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; user-select: none; }
.map-world > img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.map-tiles { position: absolute; z-index: 0; inset: 0; pointer-events: none; overflow: hidden; }
.map-tiles > img { position: absolute; display: block; max-width: none; pointer-events: none; user-select: none; }
.street-overlay, .map-markers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-markers { inset: auto; top: 0; left: 0; transform-origin: 0 0; }
.map-world { z-index: 0; }
.map-markers { z-index: 2; }
.property-use-overlay { position: absolute; z-index: 1; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.property-use-control { position: absolute; z-index: 11; left: 16px; bottom: 42px; max-width: calc(100% - 80px); }
.property-use-toggle { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 12px; }
.property-use-toggle > [data-icon] svg { width: 15px; height: 15px; }
.property-use-swatch { width: 12px; height: 12px; background: #75946d; }
.property-use-key { position: absolute; bottom: 48px; left: 0; width: 270px; max-height: calc(100dvh - var(--header-height) - var(--timeline-height) - 150px); overflow: auto; padding: 16px; background: var(--surface); box-shadow: var(--shadow-menu); }
.property-use-key p { margin: 0 0 12px; color: var(--text-secondary); font-size: 12px; }
.property-use-key ul { list-style: none; margin: 0 0 12px; padding: 0; }
.property-use-key li { display: flex; align-items: center; gap: 9px; min-height: 27px; font-size: 12px; }
.property-use-key li > i { width: 12px; height: 12px; flex: 0 0 auto; background: var(--property-color); }
.property-use-key .button { width: 100%; }
.outer-map-context { position: absolute; z-index: 11; left: 16px; top: 64px; max-width: min(350px,calc(100% - 32px)); padding: 8px 10px; background: var(--surface); color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.outer-map-context button { display: block; min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.property-record-uses { margin: 0; padding-left: 20px; }
.property-reference { padding: 8px 0 16px; border-bottom: 1px solid var(--border); }
.property-reference:last-child { border-bottom: 0; }
.property-reference > .record-row { padding-left: 0; padding-right: 0; }
.property-reference .person-entry { padding-top: 7px; padding-bottom: 7px; }
.property-coverage-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.property-coverage-table th, .property-coverage-table td { padding: 9px 6px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.property-coverage-table th:first-child, .property-coverage-table td:first-child { padding-left: 0; text-align: left; }
#place-kind { flex: 0 0 142px; width: 142px; }
#property-category { width: 100%; }
.street-overlay { z-index: 1; overflow: visible; }
.alignment-overlay { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.alignment-offset { fill: none; stroke: #705827; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.alignment-reference-outline { fill: none; stroke: #146247; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.alignment-reference { fill: none; stroke: #146247; stroke-width: 2px; }
.alignment-feature { fill: var(--surface); stroke: #205b9a; stroke-width: 2px; }
.alignment-number { fill: var(--text-strong); stroke: var(--surface); stroke-width: 3px; paint-order: stroke; font: 700 12px var(--font-ui); }
.alignment-point.check-only .alignment-offset { stroke-dasharray: 3 3; }
.show-alignment .map-activity { display: none; }
.show-alignment .map-marker:not(.selected-location-marker) { opacity: .2; }
.alignment-field { align-items: flex-start !important; flex-direction: column; padding: 8px 0; }
.alignment-field select { width: 100%; }
.layer-menu { max-height: calc(100dvh - var(--header-height) - var(--timeline-height) - 80px); overflow: auto; overscroll-behavior: contain; }
.street-overlay polyline, .street-overlay path { fill: none; stroke: #666; stroke-width: 1px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; opacity: .25; }
.street-overlay .is-selected { stroke: var(--brand); opacity: 1; stroke-width: 2px; }
.street-overlay .parcel-shape { fill: none; stroke: #625b52; stroke-width: .7px; opacity: .3; }
.street-overlay .parcel-shape.is-selected { fill: #c21b3026; stroke: var(--brand); stroke-width: 2px; opacity: 1; }
.map-marker { position: absolute; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 1px solid var(--white); border-radius: 50%; background: var(--text); color: var(--white); font-size: 12px; font-weight: 700; line-height: 1; transform: translate(-50%,-50%) rotate(var(--marker-bearing,0deg)); transform-origin: center; pointer-events: auto; cursor: pointer; }
.map-marker::before { position: absolute; inset: -7px; content: ''; }
.map-marker:hover, .map-marker:focus-visible { z-index: 8; background: var(--text-strong); }
.map-marker.is-selected { z-index: 10; background: var(--brand); }
.map-marker.is-selected { width: 16px; height: 16px; outline: 2px solid var(--brand); outline-offset: 2px; }
.map-marker [data-icon] svg { width: 12px; height: 12px; }
.map-marker > .icon, .marker-count > .icon { width: 12px; height: 12px; }
.marker-count { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.marker-label { position: absolute; display: none; top: calc(100% + 8px); left: 50%; width: max-content; max-width: 200px; padding: 6px 9px; transform: translateX(-50%); background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500; line-height: 1.4; white-space: normal; box-shadow: 0 3px 12px #00000024; text-align: center; pointer-events: none; }
.map-marker:hover .marker-label, .map-marker:focus-visible .marker-label { display: block; }
.street-marker, .cluster-marker { width: 8px; height: 8px; background: var(--text); border-width: 1px; }
.street-marker .marker-count, .cluster-marker .marker-count { display: none; }
.street-marker:hover .marker-count, .street-marker:focus-visible .marker-count, .cluster-marker:hover .marker-count, .cluster-marker:focus-visible .marker-count { display: inline; }
.street-marker:hover, .street-marker:focus-visible, .cluster-marker:hover, .cluster-marker:focus-visible { width: 18px; height: 18px; }
.house-marker { width: 6px; height: 6px; border-width: 1px; background: var(--text); }
.house-marker:not(.is-selected) { width: 28px; height: 28px; border: 0; background: transparent; }
.house-marker:not(.is-selected)::after { content: ''; width: 10px; height: 10px; border: 1px solid var(--white); border-radius: 50%; background: var(--text); }
.house-marker:not(.is-selected):hover::after, .house-marker:not(.is-selected):focus-visible::after { background: var(--brand); }
.is-close .house-marker:not(.is-selected) { width: 32px; height: 32px; }
.is-close .house-marker:not(.is-selected)::after { width: 12px; height: 12px; }
.house-marker .marker-count, .house-marker > .icon { display: none; }
.landmark-marker { z-index: 3; width: 19px; height: 19px; border-width: 1px; border-radius: var(--radius); background: var(--text-secondary); }
.map-name-marker { z-index: 1; width: 26px; height: 26px; border: 0; border-radius: 2px; background: var(--surface); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.map-name-marker:hover, .map-name-marker:focus-visible, .map-name-marker.is-selected { color: var(--white); background: var(--brand); }
.map-marker .map-key { font-size: 12px; }
.map-key.italic-key { font-style: italic; }
.record-key { min-width: 30px; color: var(--text-secondary); font-size: 14px; text-align: center; font-weight: 600; }
.event-marker { z-index: 4; width: 21px; height: 21px; background: var(--event-marriage); }
.event-marker.baptism, .event-marker.birth { background: var(--event-birth); }
.event-marker.burial, .event-marker.death { background: var(--event-death); }
.selected-location-marker.is-selected { z-index: 10; width: 16px; height: 16px; background: var(--brand); border: 2px solid var(--white); outline: 2px solid var(--brand); outline-offset: 2px; }
.property-marker { z-index: 1; width: 24px; height: 24px; border: 1px solid var(--property-color); border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); }
.property-marker > .icon { width: 14px; height: 14px; }
.property-marker.is-selected { color: var(--white); }
.proposed-home-marker { z-index: 2; width: 14px; height: 14px; border: 1px dashed var(--warning-text); background: var(--warning-surface); color: var(--warning-text); }
.proposed-home-marker:hover, .proposed-home-marker:focus-visible { background: var(--warning-surface); color: var(--warning-text); }
.proposed-home-marker.is-selected { background: var(--warning-surface); outline: 2px dashed var(--warning-text); }
.cluster-marker.area-reference-marker { background: var(--surface); border-color: var(--text-secondary); }
.area-reference-marker.house-marker:not(.is-selected)::after { border-radius: 2px; background: var(--surface); border: 2px solid var(--text-secondary); }
.street-overlay .is-proposed .parcel-shape.is-selected { stroke: var(--warning-text); stroke-dasharray: 5 4; fill: var(--warning-surface); fill-opacity: .2; }
.map-marker.proposed-event-marker { background: var(--surface); border: 2px solid var(--warning-text); color: var(--warning-text); }
.proposed-event-marker.is-selected { outline: 2px solid var(--warning-text); outline-offset: 2px; }
.map-marker.proposed-event-marker.name-only { border-color: var(--text-secondary); border-style: dashed; color: var(--text-secondary); }
.proposed-event-marker.name-only.is-selected { outline-color: var(--text-secondary); outline-style: dashed; }
.map-loading { position: absolute; z-index: 9; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--map-ground); color: var(--text); font-size: 14px; }
.map-context { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.45; pointer-events: none; }
.context-line { display: none; }
.map-tools { position: absolute; bottom: 28px; right: 16px; z-index: 10; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-strong); background: var(--surface); }
.map-tools button { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-bottom: 1px solid var(--border); background: transparent; }
.map-tools button:last-child { border-bottom: 0; }
.map-tools button:hover { color: var(--brand); background: var(--brand-subtle); }
.map-tools svg { width: 18px; height: 18px; }
.map-north { position: absolute; z-index: 8; bottom: 164px; right: 29px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--text); pointer-events: none; }
.map-north svg { transform: rotate(var(--north-bearing,0deg)); }
.map-north span { font-size: 12px; font-weight: 700; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.map-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 6px; height: 6px; background: var(--text); border-radius: 50%; }
.legend-dot.landmark-dot { width: 7px; height: 7px; border-radius: 0; background: var(--text-secondary); }
#map-located-summary { flex-basis: 100%; color: var(--text-secondary); font-size: 12px; }
.map-attribution { position: absolute; z-index: 8; left: 16px; right: 16px; bottom: 9px; width: fit-content; max-width: calc(100% - 32px); padding: 2px 4px; color: var(--text); background: #ffffffd9; font-size: 12px; line-height: 1.4; pointer-events: none; }
.map-attribution a { color: inherit; pointer-events: auto; }
.mobile-record-toggle { display: none; }

/* The daily register stays visible even when an event has no established location. */
.map-activity { position: absolute; top: 64px; right: 16px; z-index: 11; display: flex; flex-direction: column; width: 280px; max-width: calc(100% - 32px); max-height: calc(100% - 104px); padding: 12px 14px 0; border: 1px solid var(--border-strong); background: var(--surface); }
.map-activity:empty { display: none; }
.activity-header { flex: 0 0 auto; padding-bottom: 8px; }
.activity-header h3 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.4; text-wrap: initial; }
.activity-header p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.activity-list { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.activity-item { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 2px 8px; width: 100%; min-height: 48px; padding: 9px 0; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; }
.activity-item:hover { background: var(--surface-subtle); }
.activity-item:focus-visible { outline-offset: -2px; }
.activity-type { grid-column: 1; grid-row: 1 / 3; display: inline-flex; align-items: flex-start; justify-content: center; padding-top: 2px; color: var(--text-secondary); }
.activity-type .icon, .activity-type svg { width: 15px; height: 15px; }
.activity-name { grid-column: 2; min-width: 0; color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.activity-badge { grid-column: 2; color: var(--text-secondary); font-size: 12px; font-weight: 400; line-height: 1.45; }
.activity-badge.is-linked { color: var(--text-secondary); }
.activity-badge.is-proposed { color: var(--warning-text); }
.activity-badge.is-unresolved { color: var(--text-secondary); }
.activity-footer { flex: 0 0 auto; display: flex; align-items: center; min-height: 40px; border-top: 1px solid var(--border); }
.activity-open-day { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 7px 0; border: 0; color: var(--brand); background: transparent; font-size: 13px; text-align: left; }
.activity-open-day:hover { color: var(--brand-hover); text-decoration: underline; }
.activity-open-day svg { width: 13px; height: 13px; }

.detail-panel { display: none; position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; background: var(--surface); scrollbar-gutter: stable; }
body.has-detail .detail-panel { display: block; }
#detail-content { min-height: 100%; }
.detail-welcome { padding: 60px 24px 30px; color: var(--text-secondary); }
.detail-welcome > [data-icon] { margin-bottom: 20px; color: var(--brand); }
.detail-welcome h2 { margin: 0 0 12px; font-family: var(--font-heading); font-size: 30px; font-weight: 400; }
.detail-welcome p { max-width: 28ch; margin: 0; font-size: 14px; }
.detail-header { position: relative; padding: 8px 24px 22px; }
.detail-back { justify-content: flex-start; min-height: 40px; margin: 0 0 12px -8px; padding: 8px; color: var(--text-secondary); font-size: 13px; }
.detail-back:hover { color: var(--brand); background: transparent; }
.detail-back svg { width: 16px; height: 16px; }
.detail-type { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.detail-type svg { width: 14px; height: 14px; }
.detail-title { margin: 0; padding-right: 12px; font-family: var(--font-heading); color: var(--text-strong); font-size: 28px; line-height: 1.15; font-weight: 400; overflow-wrap: anywhere; }
.detail-subtitle { margin: 12px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.detail-close { position: absolute; top: 14px; right: 12px; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; color: var(--text-secondary); background: transparent; }
.detail-close:hover { color: var(--brand); background: var(--surface-subtle); }
.detail-close svg { width: 18px; height: 18px; }
.detail-tabs { position: sticky; top: 0; z-index: 4; display: flex; gap: 22px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.detail-tab { position: relative; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font-size: 13px; }
.detail-tab.is-active { font-weight: 700; color: var(--brand); }
.detail-tab.is-active::after { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; content: ''; background: var(--brand); }
.detail-section { padding: 22px 24px; border-bottom: 1px solid var(--border); }
.detail-section:last-child { border-bottom: 0; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px; font-size: 16px; line-height: 1.4; font-weight: 700; }
.detail-section p { margin: 0 0 14px; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.detail-section p:last-child { margin-bottom: 0; }
.detail-facts { margin: 0; }
.fact-row { display: grid; grid-template-columns: 110px minmax(0,1fr); align-items: baseline; gap: 12px; margin-bottom: 14px; font-size: 13px; line-height: 1.55; }
.fact-row:last-child { margin-bottom: 0; }
.fact-row dt, .fact-row > :first-child { color: var(--text-secondary); font-weight: 400; }
.fact-row dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.fact-row > :last-child { min-width: 0; overflow-wrap: anywhere; }
.people-in-house { display: flex; flex-direction: column; }
.person-entry { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 13px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; }
.person-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.person-entry > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.person-entry > .icon:last-child { flex: 0 0 14px; width: 14px; height: 14px; margin-left: auto; color: var(--text-secondary); }
button.person-entry:hover .person-name { color: var(--brand); text-decoration: underline; }
.person-name { display: block; color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.5; }
.person-role { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.source-quote { margin: 14px 0 18px; padding: 16px; background: var(--surface-subtle); color: var(--text); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.source-document-caption { margin: 0 0 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.source-document-select-label { display: block; margin: 0 0 6px; color: var(--text-secondary); font-size: 12px; }
.source-document-select { width: 100%; min-width: 0; margin-bottom: 12px; font-size: 13px; }
.source-document-fragment { margin: 0 0 10px; }
.source-document-image { display: block; overflow: hidden; border: 1px solid var(--border); background: var(--surface-subtle); cursor: zoom-in; }
.source-document-image:hover { border-color: var(--brand); }
.source-document-image:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.source-document-image img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.source-document-image.is-full-page img { height: 180px; object-fit: contain; }
.source-document-fragment figcaption, .source-document-status { margin: 6px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.source-document-fragment figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.source-document-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.source-document-context { margin-bottom: 0; }
.evidence-label, .evidence-status, .location-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 6px; background: var(--surface-subtle); color: var(--text); font-size: 12px; line-height: 1.5; }
.evidence-label svg, .evidence-status svg, .location-badge svg { width: 12px; height: 12px; }
.evidence-status.unreviewed, .location-badge.unlocated { background: var(--warning-surface); color: var(--warning-text); }
.source-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.source-link svg { flex-shrink: 0; width: 13px; height: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-actions .button { min-height: 40px; font-size: 12px; }
.household-summary { margin-top: 16px; padding-top: 14px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; border-top: 1px solid var(--border); }
.detail-section .record-row { padding: 14px 0; border-bottom: 0; }
.detail-section > ul { margin: 12px 0 0; padding-left: 18px; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.context-note { margin-top: 14px; padding: 12px 14px; background: var(--surface-subtle); color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.detail-section .context-note { color: var(--text-secondary); }
.uncertainty-note { margin-top: 14px; padding: 12px 14px; background: var(--warning-surface); color: var(--warning-text); font-size: 13px; line-height: 1.6; }
.detail-section .uncertainty-note { color: var(--warning-text); }
.review-form { display: flex; flex-direction: column; gap: 14px; }
.review-form label { display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: 13px; }
.review-form select, .review-form input, .review-form textarea { width: 100%; min-height: 42px; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.5; }
.review-form textarea { min-height: 110px; resize: vertical; }
.review-form .button[type='submit'] { align-self: flex-start; background: var(--brand); color: var(--white); border-color: var(--brand); }
.review-form .button[type='submit']:hover { background: var(--brand-hover); }
.review-form .form-error { margin: 0; color: var(--brand-hover); font-size: 13px; }
.review-history { margin-top: 22px; }
.review-entry { padding: 14px 0; border-top: 1px solid var(--border); }
.review-entry p { margin: 8px 0 0; color: var(--text); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-date { display: block; margin-top: 6px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.review-status { font-size: 13px; font-weight: 700; color: var(--text); }
.review-status.correction-needed { color: var(--brand); }
.source-preview { display: block; width: 100%; max-height: 340px; margin: 16px 0; padding: 0; border: 0; background: var(--surface-subtle); object-fit: contain; }
.source-preview img { display: block; width: 100%; max-height: 330px; object-fit: contain; }

/* One calendar rail keeps date navigation visible throughout research. */
.timeline { position: relative; z-index: 40; display: flex; flex: 0 0 var(--timeline-height); align-items: center; gap: 28px; height: var(--timeline-height); padding: 10px 22px; border-top: 1px solid var(--border-strong); background: var(--surface); }
.timeline-controls { display: flex; align-items: center; gap: 2px; flex: 0 0 360px; min-width: 0; }
.play-button { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: var(--radius); color: var(--white); background: var(--brand); }
.play-button:hover { background: var(--brand-hover); }
.play-button svg { width: 17px; height: 17px; }
.selected-date { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; margin: 0 4px 0 10px; }
.selected-date label { display: block; margin-bottom: 4px; color: var(--text-strong); font-family: var(--font-heading); font-size: 23px; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.selected-date input { width: 130px; height: 22px; margin: 0; padding: 0; border: 0; color: var(--text-secondary); background: transparent; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.selected-date input::-webkit-calendar-picker-indicator { width: 14px; height: 14px; cursor: pointer; }
#selected-date-events { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
#play-speed { width: 81px; min-height: 40px; margin-left: auto; padding: 5px 14px 5px 5px; border-color: transparent; background-color: transparent; color: var(--text-secondary); font-size: 12px; }
.year-timeline { flex: 1 1 auto; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.month-labels { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); margin-bottom: 2px; }
.month-labels button { min-width: 0; min-height: 26px; padding: 0 0 4px; border: 0; background: transparent; color: var(--text-secondary); font-size: 12px; text-align: left; }
.month-labels button:hover, .month-labels button.is-active { color: var(--brand); font-weight: 700; }
.month-labels span { color: var(--text-secondary); font-size: 12px; }
.timeline-track { position: relative; flex: 0 0 29px; height: 29px; border-bottom: 1px solid var(--border-strong); }
#timeline-chart { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
#timeline-chart rect { fill: #a5a5a5; }
#timeline-chart rect.is-selected { fill: var(--brand); }
#day-slider { position: absolute; z-index: 3; left: 0; right: 0; top: 0; width: 100%; height: 100%; margin: 0; padding: 0; appearance: none; -webkit-appearance: none; cursor: ew-resize; background: transparent; }
#day-slider::-webkit-slider-runnable-track { height: 29px; background: transparent; }
#day-slider::-moz-range-track { height: 29px; background: transparent; }
#day-slider::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: 21px; border: 2px solid var(--surface); border-radius: 50%; appearance: none; -webkit-appearance: none; background: var(--brand); }
#day-slider::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: var(--brand); transform: translateY(15px); }
.timeline-cursor { position: absolute; top: -3px; bottom: -1px; z-index: 2; width: 1px; background: var(--brand); pointer-events: none; }
.timeline-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
.timeline-caption > span:first-child { color: var(--text); font-weight: 700; }
.timeline-caption > span:nth-child(2) { margin-right: auto; }
.timeline-caption button { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; background: transparent; color: var(--brand); font-size: 12px; white-space: nowrap; }
.timeline-caption button:hover { text-decoration: underline; }
.timeline-caption button svg { width: 12px; height: 12px; }

.coverage-view { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; background: var(--surface); }
.coverage-shell { width: min(1180px,100%); margin: 0 auto; padding: 38px 36px 56px; }
.coverage-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.coverage-header h1 { margin: 0 0 14px; font-family: var(--font-heading); font-size: 42px; line-height: 1.1; font-weight: 400; }
.coverage-header p { max-width: 70ch; margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.coverage-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 36px; align-items: start; }
.coverage-layout > div, .coverage-layout > aside { min-width: 0; }
.coverage-section { min-width: 0; padding: 24px 0 30px; border-top: 1px solid var(--border); }
.coverage-section h2 { margin: 0 0 16px; font-family: var(--font-heading); font-size: 26px; line-height: 1.25; font-weight: 400; }
.coverage-section h3 { margin: 24px 0 12px; font-size: 15px; line-height: 1.4; }
.coverage-section p, .coverage-section li { max-width: 70ch; margin: 0 0 14px; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.coverage-section ul, .coverage-section ol { padding-left: 20px; }
.coverage-table { width: 100%; margin: 16px 0 20px; border-collapse: collapse; font-size: 13px; line-height: 1.6; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll .coverage-table { min-width: 570px; }
.coverage-table button.source-link { padding: 0; border: 0; background: transparent; font-size: 13px; cursor: pointer; text-align: left; }
.coverage-table th { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border-strong); color: var(--text-secondary); font-size: 12px; font-weight: 700; text-align: left; vertical-align: top; }
.coverage-table td { padding: 13px 10px 13px 0; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; overflow-wrap: anywhere; }
.coverage-table td:last-child, .coverage-table th:last-child { padding-right: 0; }
.coverage-pending { color: var(--text-secondary); font-size: 12px; }
.coverage-table details { margin-top: 8px; }
.coverage-table details summary, .source-row details summary { color: var(--brand); cursor: pointer; }
.coverage-table details p { font-size: 13px; }
.transcription-progress { display: block; width: 100%; height: 6px; margin: 20px 0; border: 0; background: var(--border); accent-color: var(--brand); }
.transcription-progress::-webkit-progress-bar { background: var(--border); }
.transcription-progress::-webkit-progress-value { background: var(--brand); }
.transcription-search { width: 100%; min-height: 44px; margin: 8px 0 16px; padding: 10px 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.census-page.is-transcribed { border-color: var(--brand); background: var(--brand-subtle); color: var(--brand); }
.coverage-table .number, .coverage-table [data-numeric] { text-align: right; font-variant-numeric: tabular-nums; }
.coverage-stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 20px 35px; padding: 6px 0 28px; color: var(--text-secondary); font-size: 13px; }
.coverage-stats > div, .coverage-stats > span { display: flex; flex-direction: column; gap: 6px; }
.coverage-stats strong { color: var(--text); font-size: 26px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; width: 100%; margin: 12px 0 10px; overflow: hidden; background: var(--border); }
.progress-fill { height: 100%; background: var(--brand); }
.source-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 26px; }
.source-row { min-width: 0; padding: 18px 0; border-bottom: 1px solid var(--border); }
.source-row h3 { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.source-row p { margin: 0 0 10px; font-size: 13px; }
.source-row a { overflow-wrap: anywhere; font-size: 13px; }
.census-pages { display: grid; grid-template-columns: repeat(auto-fill,minmax(36px,1fr)); gap: 5px; margin: 20px 0; }
.census-page { display: flex; align-items: center; justify-content: center; height: 36px; min-width: 0; padding: 0; border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-subtle); font-size: 12px; text-decoration: none; font-variant-numeric: tabular-nums; }
.census-page:hover { border-color: var(--brand); color: var(--brand); }
.census-page.reviewed, .census-page.transcribed, .census-page.processed, .census-page[data-status='reviewed'], .census-page.is-reviewed { border-color: #e3b5bc; background: var(--brand-subtle); color: var(--brand); }
.pagination-button, .calendar-day { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 7px 9px; border: 1px solid var(--border); background: var(--surface); color: var(--brand); font-size: 12px; }
.pagination-button:hover, .calendar-day:hover { background: var(--brand-subtle); }
.pagination-button.is-active, .calendar-day.is-selected { color: var(--white); background: var(--brand); border-color: var(--brand); }
.toast { position: fixed; bottom: calc(var(--timeline-height) + 18px); left: 50%; z-index: 150; max-width: calc(100% - 32px); padding: 13px 18px; transform: translateX(-50%); color: var(--white); background: var(--text-strong); box-shadow: var(--shadow-menu); font-size: 13px; line-height: 1.5; }
.error-screen { position: fixed; inset: var(--header-height) 0 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; background: var(--surface); text-align: center; }
.error-screen h1 { margin: 0 0 16px; font-family: var(--font-heading); font-size: 38px; font-weight: 400; }
.error-screen p { max-width: 65ch; margin: 0 0 24px; color: var(--text-secondary); font-size: 14px; }

@media (min-width: 1600px) {
  .record-row { padding-left: 22px; padding-right: 22px; }
  .detail-header, .detail-section { padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 1180px) {
  .app-header { gap: 32px; padding: 0 20px; }
  .project-state { display: none; }
  .app-main { grid-template-columns: 340px minmax(0,1fr); }
  .detail-header, .detail-section { padding-left: 22px; padding-right: 22px; }
  #map-source-description, .map-date-separator { display: none; }
  .map-source-control { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .timeline { gap: 22px; padding-left: 16px; padding-right: 16px; }
  .timeline-controls { flex-basis: 348px; }
  .timeline-caption > span:nth-child(2) { display: none; }
  .coverage-layout { grid-template-columns: minmax(0,1fr) 270px; gap: 28px; }
}

@media (max-width: 900px) {
  .app-main { grid-template-columns: 320px minmax(0,1fr); }
  .brand-name { font-size: 30px; }
  .nav-link { font-size: 16px; }
  .app-header { gap: 28px; }
  .map-topbar { left: 12px; right: 12px; top: 12px; }
  .map-context { display: none; }
  .map-source-control select { font-size: 12px; }
  .map-layer-toggle { padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .timeline-controls { flex-basis: 340px; }
  .coverage-layout { grid-template-columns: minmax(0,1fr); gap: 0; }
  .coverage-shell { padding: 30px 25px 44px; }
}

@media (max-width: 680px) {
  :root { --header-height: 64px; --timeline-height: 176px; }
  .app-header { gap: 18px; padding: 0 14px; }
  .brand-name { font-size: 27px; }
  .brand-year { margin-left: 1px; }
  .main-nav { gap: 16px; margin-left: auto; }
  .nav-link { min-height: 40px; font-size: 14px; }
  .nav-link::after { bottom: 10px; }
  .header-actions { margin-left: 0; }
  .export-toggle { width: 36px; height: 40px; padding: 0; }
  .export-label { display: none; }
  .export-menu { top: calc(100% + 8px); width: min(280px,calc(100vw - 28px)); }
  .app-main { display: block; }
  .map-panel { position: absolute; inset: 0; }
  .research-dock { position: absolute; inset: 0; z-index: 30; display: block; border: 0; background: transparent; pointer-events: none; }
  .search-wrap { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 65; height: 44px; margin: 0; pointer-events: auto; }
  .search-wrap input { font-size: 16px; }
  .search-wrap kbd { display: none; }
  .records-panel { position: absolute; z-index: 33; left: 0; right: 0; bottom: 0; width: 100%; height: min(70dvh,calc(100% - 68px)); overflow: hidden; visibility: hidden; transform: translateY(calc(100% + 10px)); transition: transform .24s var(--ease), visibility .24s; border: 0; box-shadow: 0 -8px 28px #00000024; pointer-events: none; }
  body.show-records .records-panel { visibility: visible; transform: translateY(0); pointer-events: auto; }
  .records-panel::before { display: block; flex: 0 0 auto; width: 32px; height: 3px; content: ''; margin: 8px auto 0; background: var(--border-strong); }
  .records-tabs { padding: 0 18px; }
  .records-heading { margin: 18px 18px 12px; }
  .records-heading h1 { font-size: 24px; }
  .records-heading select { font-size: 12px; }
  .filters, .house-filters { padding: 0 18px 12px; }
  .record-row { padding: 14px 18px; min-height: 76px; }
  .records-footer { padding-right: 150px; min-height: 48px; font-size: 12px; }
  .detail-panel { position: absolute; top: 68px; bottom: 0; left: 0; right: 0; z-index: 60; width: 100%; max-width: none; border-top: 1px solid var(--border); pointer-events: auto; }
  .detail-header { padding: 8px 22px 22px; }
  .detail-section { padding: 22px; }
  .detail-title { font-size: 28px; }
  .fact-row { grid-template-columns: 110px minmax(0,1fr); }
  .review-form input, .review-form select, .review-form textarea { font-size: 16px; }
  .map-topbar { left: 12px; top: 68px; right: 12px; }
  .property-use-control { left: 12px; top: 116px; bottom: auto; max-width: calc(100% - 100px); }
  .property-use-toggle { gap: 5px; padding: 7px 8px; font-size: 12px; white-space: nowrap; }
  .property-use-toggle > [data-icon] { display: none; }
  .property-use-key { top: 48px; bottom: auto; width: min(270px,calc(100vw - 24px)); max-height: calc(100dvh - var(--header-height) - var(--timeline-height) - 200px); }
  .outer-map-context { top: 164px; left: 12px; max-width: calc(100% - 88px); }
  .map-source-control { max-width: calc(100% - 87px); }
  .map-source-control select { font-size: 12px; padding-right: 17px; }
  .map-layer-toggle { padding: 8px; font-size: 12px; }
  .layer-menu { width: min(300px,calc(100vw - 24px)); max-height: calc(100dvh - var(--header-height) - var(--timeline-height) - 132px); }
  .map-context, #map-source-description { display: none; }
  .map-activity { top: auto; right: 64px; bottom: 58px; left: 12px; width: auto; max-width: none; max-height: 180px; padding: 10px 12px 0; }
  .activity-header { padding-bottom: 6px; }
  .activity-header h3 { font-size: 14px; }
  .activity-item { min-height: 43px; padding-top: 7px; padding-bottom: 7px; }
  .activity-footer { min-height: 36px; }
  body.has-detail .map-activity, body.show-records .map-activity { display: none; }
  .map-tools { right: 12px; bottom: 72px; }
  .map-north { right: 25px; bottom: 208px; }
  .map-attribution { left: 12px; right: 12px; bottom: 10px; max-width: calc(100% - 166px); font-size: 12px; }
  .mobile-record-toggle { position: fixed; z-index: 45; bottom: calc(var(--timeline-height) + 12px); right: 12px; display: inline-flex; min-height: 40px; padding: 9px 11px; color: var(--white); background: var(--brand); border-color: var(--brand); font-size: 12px; }
  .mobile-record-toggle:hover { color: var(--white); background: var(--brand-hover); }
  .mobile-record-toggle svg { width: 16px; height: 16px; }
  body.has-detail .mobile-record-toggle { display: none; }
  .timeline { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px 12px; height: var(--timeline-height); }
  .timeline-controls { flex: 0 0 72px; width: 100%; gap: 0; }
  .timeline-controls .icon-button { width: 32px; height: 40px; }
  .play-button { width: 36px; height: 40px; }
  .selected-date { margin: 0 3px 0 8px; flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr); align-items: start; }
  .selected-date label { grid-column: 1; margin: 0 0 4px; font-size: 20px; }
  .selected-date input { grid-column: 1; width: 112px; height: 20px; font-size: 12px; }
  #selected-date-events { grid-column: 1; margin-top: 2px; font-size: 12px; white-space: nowrap; }
  #play-speed { flex: 0 0 66px; width: 66px; margin-left: auto; padding-right: 11px; padding-left: 3px; font-size: 12px; }
  .year-timeline { flex: 1 1 auto; align-self: stretch; justify-content: flex-start; min-height: 0; }
  .month-labels { margin-bottom: 0; }
  .month-labels button, .month-labels span { min-height: 22px; padding-bottom: 2px; font-size: 12px; }
  .timeline-track { flex-basis: 25px; height: 25px; }
  #day-slider::-webkit-slider-runnable-track { height: 25px; }
  #day-slider::-moz-range-track { height: 25px; }
  #day-slider::-webkit-slider-thumb { margin-top: 17px; }
  #day-slider::-moz-range-thumb { transform: translateY(12px); }
  .timeline-caption { gap: 10px; padding-top: 9px; font-size: 12px; }
  .timeline-caption button { margin-left: auto; font-size: 12px; }
  .timeline-caption button svg { width: 11px; height: 11px; }
  .coverage-shell { padding: 26px 20px 40px; }
  .coverage-header { gap: 16px; margin-bottom: 26px; }
  .coverage-header h1 { font-size: 36px; }
  .coverage-section { padding: 24px 0 28px; }
  .coverage-section h2 { font-size: 26px; }
  .coverage-stats { gap: 20px 28px; padding-bottom: 24px; font-size: 12px; }
  .coverage-stats strong { font-size: 25px; }
  .source-grid { grid-template-columns: 1fr; }
  .coverage-table { font-size: 12px; }
  .coverage-table th { font-size: 12px; padding-right: 8px; }
  .coverage-table td { padding-right: 8px; }
  .toast { bottom: calc(var(--timeline-height) + 60px); width: max-content; max-width: calc(100% - 28px); padding: 11px 14px; font-size: 12px; }
  .error-screen { padding: 24px; }
  .error-screen h1 { font-size: 32px; }
}

@media (max-width: 370px) {
  .app-header { gap: 12px; padding: 0 12px; }
  .brand-name { font-size: 25px; }
  .main-nav { gap: 12px; }
  .selected-date { margin-left: 4px; }
  .selected-date label { font-size: 16px; }
  #selected-date-events { display: none; }
  .timeline-controls .icon-button { width: 30px; }
  #play-speed { width: 62px; flex-basis: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  html, body { height: auto; overflow: visible; }
  .main-nav, .header-actions, .timeline, .mobile-record-toggle, .map-tools, .map-layer-toggle { display: none; }
  .app-main { height: 760px; grid-template-columns: 280px minmax(0,1fr); }
  .detail-panel, body.has-detail .detail-panel { display: none; }
  .coverage-view { overflow: visible; }
}
