@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/eb-garamond-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/eb-garamond-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/eb-garamond-italic-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "EB Garamond";
    font-style: italic;
    font-weight: 400 800;
    font-display: swap;
    src: url("fonts/eb-garamond-italic-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #f4f6f7;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --ink: #172027;
    --muted: #62717d;
    --line: #d8e0e6;
    --line-strong: #b8c5ce;
    --accent: #1d695d;
    --accent-blue: #245b93;
    --mark: #fff1a8;
    --shadow: 0 1px 2px rgba(23, 32, 39, 0.06), 0 12px 30px rgba(23, 32, 39, 0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    line-height: 1.4;
}

.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;
}

.app-shell {
    width: min(1560px, calc(100% - 28px));
    margin: 0 auto;
    padding: 22px 0 38px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 8px;
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.1rem, 4vw, 3.7rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.subtitle {
    max-width: 780px;
    margin-bottom: 0;
    color: var(--muted);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: 8px;
}

.metrics div {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metrics strong {
    display: block;
    font-size: 1.35rem;
}

.metrics span {
    color: var(--muted);
    font-size: 0.82rem;
}

.workbench {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto minmax(260px, auto) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.searchbox { position: relative; }

.searchbox::before {
    content: "⌕";
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-52%);
    color: var(--muted);
    font-size: 1.2rem;
}

input[type="search"], select, .clear-button, .import-link {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}

input[type="search"] { padding: 0 12px 0 38px; }
select { padding: 0 34px 0 10px; }

input[type="search"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(36, 91, 147, 0.13);
}

.view-toggle, .language-toggle {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.view-toggle button, .language-toggle button {
    min-width: 108px;
    border: 0;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.view-toggle button[aria-pressed="true"], .language-toggle button[aria-pressed="true"] {
    background: #e8f1ef;
    color: var(--accent);
}

.view-toggle.global-language-toggle {
    position: fixed;
    top: 22px;
    right: max(14px, calc((100vw - 1320px) / 2));
    z-index: 1200;
    grid-template-columns: 1fr 1fr;
    min-height: 36px;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.view-toggle.global-language-toggle button {
    min-width: 48px;
    padding: 0 10px;
    font-size: 0.78rem;
}

.viewer-page .view-toggle.global-language-toggle {
    right: max(14px, calc(50% - 520px));
}

@media (max-width: 620px) {
    .view-toggle.global-language-toggle {
        top: 14px;
        right: 9px;
        width: auto;
        min-height: 34px;
    }


    .viewer-page .view-toggle.global-language-toggle {
        right: 9px;
    }
}

.clear-button, .import-link {
    padding: 0 12px;
    cursor: pointer;
    font-weight: 750;
}

.layout-grid {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 12px;
}

.locality-nav {
    position: sticky;
    top: 12px;
    align-self: start;
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-title {
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 850;
    text-transform: uppercase;
    color: var(--muted);
}

.locality-link {
    display: grid;
    gap: 2px;
    padding: 9px 8px;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
}

.locality-link:hover { background: #eef4f2; }
.locality-link span { font-weight: 800; }
.locality-link small { color: var(--muted); }

.status-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.88rem;
}

.locality-section {
    margin-bottom: 22px;
    scroll-margin-top: 14px;
}

.locality-section[hidden], .group-block[hidden] { display: none; }

.locality-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 380px);
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.source-line {
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 800;
}

h2 {
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 1.55rem;
    letter-spacing: 0;
}

.title-original {
    margin-bottom: 0;
    color: var(--muted);
}

.locality-stats[hidden] { display: none; }

.locality-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: #f7faf9;
}

.stats-card {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.stats-disclosure { padding: 0; overflow: clip; }
.stats-disclosure summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 48px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}
.stats-disclosure summary::-webkit-details-marker { display: none; }
.stats-disclosure summary::after {
    content: "+";
    grid-column: 2;
    grid-row: 1 / span 2;
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 500;
}
.stats-disclosure[open] summary::after { content: "−"; }
.stats-disclosure summary strong { font-size: 0.94rem; line-height: 1.1; }
.stats-disclosure summary span { grid-column: 1; color: var(--muted); font-size: 0.72rem; }
.stats-disclosure[open] summary { border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.stats-disclosure .stats-card-body { padding: 10px; }
.stats-disclosure summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset: -3px; }
.stats-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.1;
}

.stats-overview p {
    margin: 0;
    color: var(--muted);
    font-weight: 650;
}

.given-extremes[hidden] {
    display: none !important;
}

.given-extremes {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}

.given-extremes div {
    min-width: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.given-extremes span,
.given-extremes strong,
.given-extremes em {
    display: block;
    line-height: 1.05;
}

.given-extremes span {
    color: var(--muted);
    font-size: 0.72rem;
}

.given-extremes strong {
    margin-top: 3px;
    color: #123d36;
    font-size: 0.9rem;
}

.given-extremes em {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.75rem;
    font-style: normal;
}

.stat-bars {
    display: grid;
    gap: 7px;
}

.stat-bar-row {
    min-width: 0;
}

.stat-bar-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 3px;
    font-size: 0.84rem;
    line-height: 1.1;
}

.stat-bar-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-bar-head strong {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
    white-space: nowrap;
}

.stat-track {
    height: 6px;
    overflow: hidden;
    border-radius: 4px;
    background: #e5edf0;
}

.stat-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.stat-bar-row.is-total {
    margin-top: 4px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
}

.stat-bar-row.is-total .stat-bar-head {
    margin-bottom: 0;
}

.stat-bar-row.is-total .stat-bar-head span,
.stat-bar-row.is-total .stat-bar-head strong {
    color: var(--ink);
    font-weight: 800;
}

.stat-extremes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 5px;
}

.stat-extremes div {
    min-width: 0;
    padding: 5px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.stat-extremes span,
.stat-extremes strong,
.stat-extremes em {
    display: block;
    line-height: 1.05;
}

.stat-extremes span {
    color: var(--muted);
    font-size: 0.7rem;
}

.stat-extremes strong {
    margin-top: 2px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.stat-extremes em {
    margin-top: 4px;
    overflow: visible;
    padding-bottom: 2px;
    color: #123d36;
    font-size: 0.78rem;
    font-style: italic;
    line-height: 1.3;
    text-overflow: clip;
    white-space: normal;
}

.stat-spread {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.stat-spread div {
    min-width: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.stat-spread span,
.stat-spread strong,
.stat-spread em {
    display: block;
    line-height: 1.05;
}

.stat-spread span {
    color: var(--muted);
    font-size: 0.72rem;
}

.stat-spread strong {
    margin-top: 3px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.stat-spread em {
    margin-top: 4px;
    overflow: hidden;
    color: #123d36;
    font-size: 0.78rem;
    font-style: italic;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reference-box {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.reference-box span {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    text-transform: uppercase;
}

.reference-box strong {
    font-size: 0.92rem;
}

.group-context {
    display: grid;
    border-right: 1px solid var(--line-strong);
    border-left: 1px solid var(--line-strong);
    background: var(--surface);
}

.context-bar {
    min-height: 36px;
    display: grid;
    place-items: center;
    padding: 7px 14px;
    color: #1f2d36;
    text-align: center;
    font-weight: 850;
}

.context-bar.landholder {
    background: #dfe8ed;
    border-top: 1px solid var(--line-strong);
    border-bottom: 1px solid var(--line-strong);
}

.context-bar.category {
    background: #f0f4f6;
    border-bottom: 1px solid var(--line-strong);
    font-weight: 760;
}

.table-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table-scroll {
    max-height: min(68vh, 760px);
    overflow: auto;
}

table {
    width: 100%;
    font-variant-numeric: tabular-nums;
    min-width: 1900px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.88rem;
}

th, td {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 7px 8px;
    vertical-align: middle;
    background: var(--surface);
    overflow: hidden;
    text-overflow: ellipsis;
}

th:last-child, td:last-child { border-right: 0; }

thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    min-height: 54px;
    background: #eef3f5;
    color: #26343f;
    font-size: 0.78rem;
    line-height: 1.2;
    text-align: center;
    font-weight: 800;
    cursor: pointer;
}

/* Rezervăm din start spațiul necesar celor mai lungi antete românești. */
.viewer-table-panel thead th {
    height: 124px;
    box-sizing: border-box;
}

tbody tr:nth-child(even) td { background: #fbfcfd; }
tbody tr:hover td { background: #f1f7f6; }

tfoot td,
.summa-row td,
.recap-summa-row td,
.universa-summa-row td {
    background: #edf4f2;
    color: #102f2b;
    font-weight: 850;
}

.summa-row .sticky-col,
.recap-summa-row .sticky-col,
.universa-summa-row .sticky-col {
    z-index: 3;
}

.recap-block {
    margin: 0;
}

.universa-block {
    margin-top: 18px;
}

.universa-context {
    border-top: 1px solid var(--line-strong);
}

.universa-table-panel {
    border-top: 0;
    border-radius: 0 0 8px 8px;
}

.recap-context {
    border-top: 0;
}

.recap-table-panel {
    border-top: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: none;
}

.recap-table {
    min-width: 1500px;
}

.recap-table-scroll {
    max-height: none;
}

.recap-table tbody td {
    background: #fbfdfd;
}

.col-number { width: 54px; }
.col-name { width: 330px; }
.col-status { width: 120px; }
.col-sessionis_qualitas { width: 150px; }
.col-fundus_intravillanus { width: 210px; }
.col-sessionales_arabiles { width: 190px; }
.col-sessionalia_prata_semper,
.col-sessionalia_prata_raro,
.col-sessionalia_prata_nunquam,
.col-titulo_prata_semper,
.col-titulo_prata_raro,
.col-titulo_prata_nunquam { width: 170px; }
.col-in_praedio { width: 220px; }
.col-titulo_arabiles { width: 230px; }

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 1px 0 0 var(--line);
}

.sticky-name {
    left: 54px;
}

.col-number,
.number-cell {
    text-align: center;
    font-family: "Excelsior LT Std", "Excelsior", "Century Schoolbook", Georgia, serif;
    font-variant-numeric: tabular-nums;
}

.numero-value {
    display: inline-block;
    min-width: var(--numero-digits, 1ch);
    text-align: right;
    font-family: "Excelsior LT Std", "Excelsior", "Century Schoolbook", Georgia, serif;
    font-variant-numeric: tabular-nums;
}

thead .sticky-col { z-index: 5; }
.name-cell { color: #123d36; }
.name-primary {
    display: block;
    white-space: normal;
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 500;
}
.in-praedio-heading-note {
    display: block;
    margin-top: 1.1em;
    font-style: italic;
    font-weight: 500;
}
.deserted-name-prefix { font-style: normal; font-weight: 400; }
.family-head-name { font-style: italic; }
.tax-payment-note { font-style: normal; }
tfoot .name-cell,
.recap-table .name-cell,
.universe-table .name-cell {
    font-style: normal;
    font-weight: 800;
}
.numeric, .compact { text-align: right; font-variant-numeric: tabular-nums; }
.wide { white-space: nowrap; }
.empty { color: #a4adb6; text-align: center; }

.sessionis-note-cell {
    position: relative;
    text-align: center;
    vertical-align: middle;
    color: var(--muted);
    background: #fbfdfd;
    padding: 0;
}

.sessionis-note-cell span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: block;
    width: 8.5ch;
    white-space: normal;
    line-height: 1;
    font-size: 0.82rem;
}


.fraction {
    display: inline;
    white-space: nowrap;
    font-size: 0.96em;
    letter-spacing: 0;
}

mark {
    padding: 0 2px;
    border-radius: 2px;
    background: var(--mark);
    color: inherit;
}

.empty-state {
    display: none;
    padding: 26px;
    text-align: center;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

@media (max-width: 980px) {
    .topbar, .workbench, .layout-grid, .locality-head, .map-grid {
        grid-template-columns: 1fr;
    }

    .metrics { grid-template-columns: repeat(3, 1fr); }
    .locality-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .locality-nav { position: static; max-height: none; }
    .map-side { border-left: 0; border-top: 1px solid var(--line); }
    .map-results { max-height: 220px; }
}

@media (max-width: 620px) {
    .locality-stats { grid-template-columns: 1fr; }
    .app-shell { width: min(100% - 18px, 1560px); padding-top: 14px; }
    .metrics { grid-template-columns: 1fr; }
    .view-toggle, .language-toggle { width: 100%; }
}
.import-link {
    display: inline-grid;
    place-items: center;
    text-decoration: none;
    font-weight: 750;
}

.import-link:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}
.import-shell {
    width: min(1320px, calc(100% - 28px));
}

.import-topbar {
    align-items: center;
}

.back-link {
    width: auto;
    min-width: 150px;
}

.notice {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.notice.success {
    border-color: #9bc5b9;
    background: #eef8f4;
}

.notice.error {
    border-color: #d4a0a0;
    background: #fff3f3;
}

.notice ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 12px;
}

.import-form, .help-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.form-head h2, .help-panel h2 {
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 1rem;
}

.form-head p, .help-panel p, .import-help p {
    margin-bottom: 0;
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 8px;
}

.primary-action {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.import-form textarea {
    display: block;
    width: 100%;
    min-height: 58vh;
    padding: 12px;
    border: 0;
    border-radius: 0 0 8px 8px;
    resize: vertical;
    color: var(--ink);
    background: #fbfcfd;
    font: 0.86rem/1.45 "Cascadia Mono", Consolas, monospace;
    white-space: pre;
    overflow: auto;
}

.import-form textarea:focus {
    outline: 3px solid rgba(36, 91, 147, 0.13);
}

.import-help {
    display: grid;
    align-content: start;
    gap: 12px;
}

.help-panel {
    padding: 14px;
}

.help-panel code, .notice code {
    color: #123d36;
    font-weight: 750;
}

@media (max-width: 980px) {
    .import-grid, .form-head {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-wrap: wrap;
    }
}
.geo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.geo-meta span {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.78rem;
}

.geo-meta strong {
    color: var(--ink);
}
.map-workbench {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.map-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.map-head h2 {
    font-family: "EB Garamond", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-weight: 700;
    margin-bottom: 0;
    font-size: 1.1rem;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.map-legend span {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.count-0 { background: #f6d6d4; }
.legend-dot.count-1 { background: #ee9b98; }
.legend-dot.count-2 { background: #e77874; }
.legend-dot.count-3 { background: #dc5b58; }
.legend-dot.count-4 { background: #c94043; }
.legend-dot.count-5 { background: #a92b36; }
.legend-dot.count-plus { background: #781827; }

.map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    min-height: 360px;
}

.map-canvas-wrap {
    position: relative;
    min-height: 360px;
    background: #eef3f5;
}

.stat-map {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 360px;
}

.map-bg {
    fill: #edf3f5;
}

.map-gridlines line {
    stroke: rgba(98, 113, 125, 0.26);
    stroke-width: 1;
    stroke-dasharray: 5 8;
}

.map-marker {
    cursor: pointer;
    outline: none;
}

.map-marker circle {
    stroke: #ffffff;
    stroke-width: 3;
    filter: drop-shadow(0 6px 10px rgba(23, 32, 39, 0.22));
}

.map-marker text {
    fill: #172027;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 4px;
    font-size: 20px;
    font-weight: 850;
    pointer-events: none;
}

.map-marker.none circle {
    fill: #aeb9c1;
    opacity: 0.38;
}

.map-marker.none text {
    fill: #6c7881;
    opacity: 0.55;
    font-size: 15px;
    font-weight: 760;
}

.map-marker.low circle { fill: #a8d5b5; }
.map-marker.mid circle { fill: #4f9d69; }
.map-marker.high circle { fill: #176b45; }
.map-marker:focus circle { stroke: var(--accent-blue); stroke-width: 5; }

.map-empty {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
    font-weight: 750;
}

.map-side {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 12px;
    border-left: 1px solid var(--line);
    background: var(--surface-soft);
}

.map-summary {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.map-summary strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1;
}

.map-summary span {
    color: var(--muted);
    font-size: 0.82rem;
}

.map-results {
    display: grid;
    gap: 6px;
    max-height: 300px;
    overflow: auto;
}

.map-result {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.map-result:hover {
    border-color: var(--accent-blue);
}

.map-result span,
.map-no-results {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}
@media (max-width: 980px) {
    .map-grid {
        grid-template-columns: 1fr;
    }

    .map-side {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .map-results {
        max-height: 220px;
    }
}
.leaflet-container {
    font: inherit;
    background: #dfe8ed;
}

.leaflet-control-layers,
.leaflet-control-zoom a {
    border-color: var(--line-strong) !important;
}

.map-empty {
    z-index: 600;
    pointer-events: none;
    background: rgba(248, 250, 251, 0.82);
}

.legend-line {
    width: 22px;
    height: 0;
    display: inline-block;
    border-top: 2px solid #7f8d96;
}
.language-toggle {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.language-toggle button {
    min-width: 54px;
}

.locality-identity {
    display: grid;
    gap: 2px;
    margin-top: 8px;
}

.locality-identity p {
    margin: 0;
}

.locality-historical-line {
    color: var(--ink);
    font-weight: 800;
}

.locality-current-line {
    color: var(--muted);
}

.map-result strong {
    font-size: 1rem;
}

.map-result span:empty {
    display: none;
}

.search-shell {
    width: min(980px, calc(100% - 28px));
    min-height: 100vh;
    display: grid;
    align-items: center;
}

.site-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
}

.site-brand h1 {
    margin-bottom: 0;
}

.site-brand-map {
    width: clamp(52px, 7vw, 84px);
    height: auto;
    flex: 0 0 auto;
}
.search-front {
    display: grid;
    gap: 18px;
    padding: clamp(24px, 5vw, 48px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-module { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.search-module-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    padding: 0 5px;
    border-bottom: 1px solid var(--line);
}
.search-mode-tabs { display: flex; gap: 2px; padding: 5px 0 0; border-bottom: 0; }
.search-module-header > .view-toggle.global-language-toggle {
    position: static;
    inset: auto;
    z-index: auto;
    width: auto;
    min-height: 42px;
    margin: 5px 0 0;
    border-radius: 7px 7px 0 0;
    box-shadow: none;
}
.search-module-header > .view-toggle.global-language-toggle button {
    min-width: 48px;
    padding-inline: 10px;
    font-size: .78rem;
}
.search-mode-tabs button { min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-weight: 800; }
.search-mode-tabs button:hover { color: var(--ink); }
.search-mode-tabs button[aria-selected="true"] { margin-bottom: -1px; border-color: var(--line); background: var(--surface); color: var(--ink); }
.search-mode-tabs button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent-blue) 28%, transparent); outline-offset: -3px; }
.search-mode-panel { padding: 20px; background: var(--surface); border-radius: 0 0 8px 8px; }
.search-mode-panel[hidden] { display: none; }
.search-form-simple { grid-template-columns: minmax(0, 1fr) auto; }
.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) auto;
    gap: 10px;
    align-items: center;
}

.searchbox-large input[type="search"] {
    min-height: 54px;
    font-size: 1.25rem;
}

.search-submit {
    min-height: 54px;
    padding: 0 22px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.search-metrics {
    margin-top: 4px;
}

.front-links,
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.front-links a,
.page-actions a {
    color: var(--accent-blue);
    font-weight: 750;
    text-decoration: none;
}

.front-links {
    justify-content: center;
}

.front-links > span {
    color: var(--muted);
}

.page-actions .clear-button {
    width: auto;
    min-width: 0;
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 11px;
    line-height: 1;
}

.results-shell,
.viewer-shell,
.map-page-shell {
    width: min(1320px, calc(100% - 28px));
}

.results-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 14px;
}

.viewer-page-header {
    position: relative;
    display: block;
    min-height: 112px;
    padding: 8px 170px 12px;
    text-align: center;
}

.viewer-page-identity h1 {
    margin-bottom: 8px;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.12;
}

.locality-directory-header > div h1 {
    margin-bottom: 8px;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.12;
}

.locality-directory-header .subtitle {
    max-width: 820px;
    margin-inline: auto;
}

.viewer-location-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.viewer-shell .viewer-page-header > .page-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    transform: none;
}

.locality-directory-header > .page-actions {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.urbarii-page-header > .page-actions {
    position: fixed;
    top: 22px;
    left: 14px;
    right: auto;
    z-index: 1200;
    transform: none;
}

@media (max-width: 760px) {
    .viewer-shell .viewer-page-header {
        min-height: 0;
        padding: 54px 0 8px;
    }

    .locality-directory-header {
        min-height: 0;
        padding: 4px 0 8px;
    }

    .viewer-shell .viewer-page-header > .page-actions {
        position: absolute;
        top: 0;
        left: 0;
        justify-content: flex-start;
        margin-top: 0;
        transform: none;
    }


    .locality-directory-header > .page-actions {
        position: static;
        justify-content: center;
        margin-top: 12px;
        transform: none;
    }


    .urbarii-page-header {
        padding-top: 54px;
    }

    .urbarii-page-header > .page-actions {
        position: fixed;
        top: 14px;
        left: 9px;
        justify-content: flex-start;
        margin-top: 0;
    }
}

.results-search {
    grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) auto;
}

.locality-directory-search {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 0;
}

.locality-directory-search > .searchbox input[type="search"],
.owner-directory-search > .searchbox input[type="search"] {
    border-radius: 8px 0 0 8px;
}

.locality-directory-search > .search-icon-button,
.owner-directory-search > .search-icon-button {
    border-radius: 0 8px 8px 0;
}

.locality-directory-search > .clear-button:not(.search-icon-button),
.owner-directory-search > .clear-button:not(.search-icon-button) {
    margin-left: 10px;
}

.locality-directory-search .searchbox::before {
    content: none;
}

.locality-directory-search input[type="search"] {
    padding-left: 12px;
}

.locality-directory {
    display: grid;
    gap: 10px;
}

.locality-directory[hidden] {
    display: none;
}

.locality-directory[data-locality-panel$="-alphabetical"] {
    gap: 0;
}

.locality-directory[data-locality-panel$="-alphabetical"] .locality-alphabet {
    margin-bottom: 12px;
}

.locality-directory[data-locality-panel$="-alphabetical"] .locality-directory-item:last-child {
    border-bottom: 1px solid var(--line);
}

.locality-directory[data-locality-panel$="-alphabetical"] .locality-letter-section:last-child .locality-directory-item:last-child {
    border-bottom: 0;
}

.locality-directory-controls {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.locality-view-toggle {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(100%, 760px);
}

.locality-view-toggle button {
    min-width: 0;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .locality-view-toggle {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .locality-view-toggle button {
        white-space: normal;
    }
}

.locality-alphabet {
    margin-bottom: 2px;
}

.locality-alphabet .locality-letter-filter {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: #eef4f3;
    color: var(--accent);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 750;
    cursor: pointer;
}

.locality-alphabet .locality-letter-filter[data-locality-letter="all"] {
    width: auto;
    padding: 0 9px;
}

.locality-alphabet .locality-letter-filter:hover,
.locality-alphabet .locality-letter-filter.is-active {
    background: var(--accent);
    color: #fff;
}

.locality-letter-section[hidden] {
    display: none;
}

.locality-letter-section {
    display: block;
    background: var(--surface);
}

.locality-letter-section .locality-county-list {
    padding: 0;
}


.locality-county-directory {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.urbarium-directory-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.urbarium-directory-entry:hover {
    border-color: var(--accent-blue);
    background: #f7fbfa;
}

.urbarium-directory-entry strong {
    color: #164b43;
}

.urbarium-directory-entry span {
    color: var(--muted);
    font-size: 0.86rem;
}

.conscription-navigation {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.conscription-navigation a {
    flex: 1 1 0;
    min-width: 0;
    padding: 11px 10px;
    color: var(--muted);
    font-weight: 750;
    text-align: center;
    text-decoration: none;
}

.conscription-navigation a + a {
    border-left: 1px solid var(--line);
}

.conscription-navigation a:hover,
.conscription-navigation a[aria-current="page"] {
    background: #e8f1ef;
    color: var(--accent);
}

.simple-directory-list {
    display: grid;
    border: 1px solid var(--line);
    background: var(--surface);
}

.simple-directory-list > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    color: inherit;
    text-decoration: none;
}

.simple-directory-list > a + a {
    border-top: 1px solid var(--line);
}

.simple-directory-list > a:hover {
    background: #f0f7f5;
}

.simple-directory-list strong {
    color: #174b43;
}

.simple-directory-list span {
    color: var(--muted);
    font-size: 0.82rem;
}

@media (max-width: 620px) {
    .conscription-navigation {
        overflow-x: auto;
        justify-content: flex-start;
    }

    .conscription-navigation a {
        flex: 0 0 auto;
        min-width: 124px;
    }

    .urbarium-directory-entry {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        padding: 13px 14px;
    }
}

.locality-county-directory > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
    color: #164b43;
    font-weight: 800;
    cursor: pointer;
}

.locality-county-directory > summary span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
}

.locality-county-directory[open] > summary {
    border-bottom: 1px solid var(--line);
    background: #eef7f4;
}

.locality-county-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px;
}

.locality-county-list a {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 5px;
    color: inherit;
    text-decoration: none;
}

.locality-county-list a:hover { background: #f0f7f5; }
.locality-county-list strong { color: #174b43; }
.locality-county-list small { color: var(--muted); }

.locality-county-list .locality-directory-item {
    display: block;
    min-height: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    color: #3e5551;
    line-height: 1.35;
}

.locality-county-list .locality-directory-item:last-child {
    border-bottom: 0;
}

.locality-county-list .locality-directory-item strong {
    color: #174b43;
}

@media (max-width: 640px) {
    .locality-directory-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .locality-county-list .locality-directory-item {
        padding: 9px 10px;
        font-size: 0.9rem;
    }
}

.result-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.result-card {
    position: relative;
    display: grid;
    gap: 5px;
    min-height: 158px;
    padding: 14px 48px 14px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.result-card:hover {
    border-color: var(--accent-blue);
    background: #fbfdfd;
}

.result-card h2 {
    margin: 0;
    font-size: 1.32rem;
    line-height: 1.08;
}

.result-count {
    position: absolute;
    top: 12px;
    right: 12px;
    min-width: 28px;
    min-height: 28px;
    display: inline-grid;
    place-items: center;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--accent);
    font-weight: 800;
}

.result-subtitle,
.result-source,
.result-date,
.name-samples {
    margin: 0;
}

.result-subtitle,
.result-source,
.result-date {
    color: var(--muted);
}

.name-samples {
    align-self: end;
    color: #123d36;
    font-weight: 650;
}

.visible {
    display: block;
}


.viewer-tools {
    display: grid;
    gap: 8px;
    justify-items: stretch;
    width: 100%;
}

.viewer-name-toggle,
.viewer-unit-toggle {
    width: 100%;
    min-height: 40px;
}

.viewer-name-toggle {
    grid-template-columns: repeat(3, minmax(max-content, 1fr));
}

.viewer-unit-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.viewer-name-toggle button,
.viewer-unit-toggle button {
    min-width: 0;
    width: 100%;
    display: grid;
    place-items: center;
    padding: 0 8px;
    line-height: 1;
    white-space: nowrap;
}

.viewer-unit-toggle button {
    min-height: 34px;
    font-size: 0.84rem;
}

.viewer-stats-toggle {
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    color: var(--accent-blue);
}

.viewer-stats-toggle.is-active {
    border-color: var(--accent);
    background: #e8f1ef;
    color: var(--accent);
}

.viewer-landholder-block {
    margin-bottom: 18px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.viewer-landholder-context,
.viewer-category-context {
    border-left: 1px solid var(--line-strong);
    border-right: 1px solid var(--line-strong);
}

.viewer-group-block {
    margin: 0;
}

.viewer-group-block + .viewer-group-block .viewer-category-context {
    border-top: 0;
}

.viewer-table-panel {
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
}

.viewer-table-panel .table-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
}

.viewer-landholder-block .viewer-group-block:last-child .viewer-table-panel {
    border-radius: 0 0 8px 8px;
}

.map-hidden-controls {
    display: none;
}

@media (max-width: 760px) {
    .search-form,
    .results-topbar,
    .results-search {
        grid-template-columns: 1fr;
    }

    .search-shell {
        align-items: start;
        padding-top: 18px;
    }
}


.stats-inline-toggle {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    margin: 6px 0 10px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: left;
    cursor: pointer;
}

.stats-inline-toggle[aria-pressed="true"],
.stats-inline-toggle.is-active {
    background: #e8f1ef;
    color: var(--accent);
}

.owner-directory-shell {
    width: min(1320px, calc(100% - 28px));
}

.owner-directory-search {
    grid-template-columns: minmax(260px, 1fr) auto auto;
    column-gap: 0;
    margin-bottom: 14px;
}

.owner-directory-search .clear-button {
    width: auto;
    min-height: 42px;
    padding: 0 14px;
    text-decoration: none;
}

.owner-directory {
    display: grid;
    gap: 12px;
}

.owner-alphabet {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 14px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.owner-alphabet a,
.owner-alphabet span {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: none;
}

.owner-alphabet a {
    background: #eef4f3;
    color: var(--accent);
}

.owner-alphabet a:hover {
    background: var(--accent);
    color: #fff;
}

.owner-alphabet span {
    color: #aab3b8;
}

.owner-letter-section {
    scroll-margin-top: 60px;
}

.owner-letter-section h2 {
    margin: 0 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
    color: var(--accent);
    font-size: 1.25rem;
}

.owner-letter-list {
    display: grid;
    gap: 2px;
}

.owner-directory-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.owner-directory-item:hover {
    border-color: var(--accent-blue);
    background: #fbfdfd;
}

.owner-directory-name {
    color: #123d36;
    font-size: 0.94rem;
    font-weight: 750;
    line-height: 1.1;
}

.owner-directory-original {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-directory-count {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 650;
    white-space: nowrap;
}

@media (max-width: 620px) {
    .owner-directory-search {
        grid-template-columns: 1fr;
    }
}
.owner-family-back {
    margin-bottom: 14px;
}

.owner-family-back .clear-button {
    width: auto;
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0 14px;
    text-decoration: none;
}

.owner-member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.owner-member-card {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.owner-member-card:hover {
    border-color: var(--accent-blue);
    background: #fbfdfd;
}

.owner-member-card strong {
    color: #123d36;
    font-size: 1.08rem;
}

.owner-member-card span {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-member-card em {
    color: var(--muted);
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 650;
}
.owner-family-details {
    min-width: 0;
}

.owner-family-details > summary {
    cursor: pointer;
    list-style-position: inside;
}

.owner-family-details[open] > summary {
    border-color: var(--accent-blue);
    border-radius: 7px 7px 0 0;
    background: #f6faf9;
}

.owner-family-members {
    display: grid;
    margin-left: 22px;
    border: 0;
    background: var(--surface-soft);
}

.owner-family-member {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}

.owner-family-member:last-child {
    border-bottom: 0;
}

.owner-family-member:hover {
    background: var(--surface);
}

.owner-family-member span {
    color: #123d36;
    font-size: 0.9rem;
    font-weight: 650;
}

.owner-family-member em {
    color: var(--muted);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .owner-family-member {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
.owner-member-details {
    min-width: 0;
    border-bottom: 1px solid var(--line);
}

.owner-member-details:last-child {
    border-bottom: 0;
}

.owner-member-details > summary {
    cursor: pointer;
    list-style-position: inside;
    border-bottom: 0;
}

.owner-member-details[open] > summary {
    background: var(--surface);
}

.owner-estate-list {
    display: grid;
    margin: 0 8px 6px 28px;
}

.owner-estate-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}

.owner-estate-item:last-child {
    border-bottom: 0;
}

.owner-estate-item:hover {
    background: var(--surface);
}

.owner-estate-item strong {
    color: #244f48;
    font-size: 0.84rem;
}

.owner-estate-item strong::before {
    content: "— ";
    color: var(--muted);
    font-weight: 400;
}

.owner-estate-item span {
    color: var(--muted);
    font-size: 0.7rem;
    text-align: right;
}

@media (max-width: 560px) {
    .owner-estate-item {
        grid-template-columns: 1fr;
        gap: 1px;
    }

    .owner-estate-item span {
        text-align: left;
    }
}
.owner-family-details > summary,
.owner-member-details > summary,
.owner-county-details > summary {
    position: relative;
    list-style: none;
}

.owner-family-details > summary::-webkit-details-marker,
.owner-member-details > summary::-webkit-details-marker,
.owner-county-details > summary::-webkit-details-marker {
    display: none;
}

.owner-family-details > summary::before,
.owner-member-details > summary::before,
.owner-county-details > summary::before {
    content: "→";
    position: absolute;
    top: 50%;
    left: 9px;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    transform: translateY(-50%);
    transition: transform 140ms ease;
}

.owner-family-details[open] > summary::before,
.owner-member-details[open] > summary::before,
.owner-county-details[open] > summary::before {
    transform: translateY(-50%) rotate(90deg);
}

.owner-family-details > .owner-directory-item,
.owner-member-details > .owner-family-member {
    padding-left: 27px;
}

.owner-county-details {
    border-bottom: 1px solid var(--line);
}

.owner-county-details:last-child {
    border-bottom: 0;
}

.owner-county-details > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 6px 8px 6px 27px;
    cursor: pointer;
}

.owner-county-details > summary span {
    color: #315d55;
    font-size: 0.82rem;
    font-weight: 750;
}

.owner-county-details > summary em {
    color: var(--muted);
    font-size: 0.7rem;
    font-style: normal;
    white-space: nowrap;
}

.owner-county-details[open] > summary {
    background: rgba(255, 255, 255, 0.55);
}

.owner-county-localities {
    display: grid;
    margin-left: 20px;
}
.owner-family-details > summary::before,
.owner-member-details > summary::before {
    display: none;
}

.owner-family-details > .owner-directory-item,
.owner-member-details > .owner-family-member {
    padding-left: 10px;
}

.owner-language-toggle {
    width: fit-content;
    min-height: 32px;
    margin: 0 0 12px auto;
}

.owner-language-toggle button {
    min-width: 46px;
    padding: 0 9px;
    font-size: 0.76rem;
}
/* Ierarhia repertoriului: familie > proprietar > comitat > localitate */
.owner-letter-list {
    gap: 7px;
}

.owner-family-details > .owner-directory-item {
    min-height: 42px;
    padding: 8px 11px;
    border-color: #b8cbc7;
    background: #eef5f3;
}

.owner-family-details[open] > .owner-directory-item {
    border-color: #7fa39b;
    border-radius: 7px;
    background: #e5f0ed;
}

.owner-family-details > .owner-directory-item .owner-directory-name {
    font-size: 1.04rem;
    font-weight: 800;
}

.owner-family-members {
    gap: 4px;
    margin: 5px 0 7px 18px;
    padding: 2px 0 2px 8px;
    background: transparent;
}

.owner-member-details {
    border: 0;
}

.owner-member-details > .owner-family-member {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #d5dfdd;
    border-radius: 6px;
    background: #fbfdfc;
}

.owner-member-details[open] > .owner-family-member {
    border-color: #b8cbc7;
    background: #f6faf9;
}

.owner-member-details > .owner-family-member span {
    font-size: 0.92rem;
    font-weight: 720;
}

.owner-estate-list {
    gap: 4px;
    margin: 4px 4px 7px 20px;
}

.owner-county-details {
    border: 0;
}

.owner-county-details > summary {
    min-height: 32px;
    padding: 5px 8px 5px 29px;
    border: 1px solid #dde5e3;
    border-radius: 5px;
    background: #f4f7f6;
}

.owner-county-details[open] > summary {
    border-color: #c4d4d0;
    background: #edf3f1;
}

.owner-county-details > summary span {
    font-size: 0.82rem;
    font-weight: 720;
}

.owner-county-localities {
    gap: 1px;
    margin: 3px 0 5px 20px;
}

.owner-estate-item {
    padding: 5px 8px;
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.72);
}

.owner-estate-item:hover {
    background: #fff;
}
.owner-family-suffixes {
    display: grid;
    gap: 5px;
    margin: 5px 0 8px 18px;
}

.owner-suffix-details > summary {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid #ccd9d6;
    border-radius: 6px;
    background: #f3f8f6;
    cursor: pointer;
    list-style: none;
}

.owner-suffix-details > summary::-webkit-details-marker {
    display: none;
}

.owner-suffix-details[open] > summary {
    border-color: #aebfbb;
    background: #edf4f2;
}

.owner-suffix-summary span {
    color: #315d55;
    font-size: 0.94rem;
    font-weight: 760;
}

.owner-suffix-summary em {
    color: var(--muted);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 620;
    white-space: nowrap;
}

.owner-suffix-details > .owner-family-members {
    margin: 4px 0 6px 18px;
    padding: 0;
}

.owner-suffix-details .owner-member-details > .owner-family-member {
    background: #fff;
}
/* Ierarhie exclusiv prin nuanțe de verde, fără săgeți sau linii */
.owner-family-details > summary::before,
.owner-suffix-details > summary::before,
.owner-member-details > summary::before,
.owner-county-details > summary::before,
.owner-estate-item strong::before {
    display: none;
    content: none;
}

.owner-letter-section h2,
.owner-family-details > .owner-directory-item,
.owner-suffix-details > .owner-suffix-summary,
.owner-member-details > .owner-family-member,
.owner-county-details > summary,
.owner-estate-item {
    border: 0;
    box-shadow: none;
}

.owner-family-details > .owner-directory-item,
.owner-family-details[open] > .owner-directory-item {
    background: #dcece7;
}

.owner-suffix-details > .owner-suffix-summary,
.owner-suffix-details[open] > .owner-suffix-summary {
    background: #e6f2ee;
}

.owner-member-details > .owner-family-member,
.owner-member-details[open] > .owner-family-member,
.owner-suffix-details .owner-member-details > .owner-family-member {
    background: #eef7f4;
}

.owner-county-details > summary,
.owner-county-details[open] > summary {
    background: #f4faf8;
}

.owner-estate-item,
.owner-estate-item:hover {
    background: #f9fcfb;
}
.owner-county-details > summary,
.owner-county-details[open] > summary {
    padding-left: 10px;
}
/* Ritm egal între nivelurile ierarhiei */
.owner-directory-shell,
.conscription-owner-shell {
    --owner-level-indent: 32px;
    --owner-level-gap: 8px;
}

.owner-family-suffixes,
.owner-suffix-details > .owner-family-members,
.owner-estate-list,
.owner-county-localities {
    margin: var(--owner-level-gap) 0 var(--owner-level-gap) var(--owner-level-indent);
}

.owner-family-suffixes,
.owner-family-members,
.owner-estate-list,
.owner-county-localities {
    gap: var(--owner-level-gap);
}
.owner-type-toggle {
    width: fit-content;
    margin-bottom: 14px;
}

.owner-type-toggle button {
    min-width: 190px;
    padding: 0 14px;
    font-size: 0.84rem;
}

.owner-type-panel[hidden] {
    display: none;
}

.institution-estate-list {
    margin-left: var(--owner-level-indent);
}
.owner-suffix-details.is-empty-suffix > summary {
    display: none;
}

.owner-suffix-details.is-empty-suffix > .owner-family-members {
    margin-top: 0;
}
/* Aceeași mărime pentru denumiri la toate nivelurile ierarhiei proprietarilor. */
.owner-family-details > .owner-directory-item .owner-directory-name,
.owner-suffix-summary span,
.owner-member-details > .owner-family-member span,
.owner-county-details > summary span,
.owner-estate-item strong {
    font-size: 1.04rem;
}

/* Mobile-first production overrides */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

img,
svg {
    max-width: 100%;
}

button,
input,
select,
summary,
a {
    touch-action: manipulation;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 980px) {
    .topbar {
        align-items: stretch;
    }

    .topbar > *,
    .locality-head > *,
    .workbench > * {
        min-width: 0;
    }

    .locality-nav {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 8px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .locality-nav .panel-title {
        display: none;
    }

    .locality-link {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 8px 12px;
        border: 1px solid var(--line);
        white-space: nowrap;
    }

    .viewer-tools {
        max-width: 100%;
    }

    .viewer-name-toggle,
    .viewer-unit-toggle {
        width: 100%;
    }
}

@media (max-width: 620px) {
    body {
        font-size: 1rem;
        line-height: 1.45;
    }

    .app-shell,
    .import-shell,
    .owner-directory-shell {
        width: 100%;
        padding: 10px 8px 24px;
    }

    h1 {
        font-size: clamp(2.15rem, 13vw, 3rem);
        line-height: 1;
    }

    .subtitle {
        font-size: 0.98rem;
    }

    .topbar,
    .locality-head {
        gap: 10px;
        margin-bottom: 10px;
    }

    .locality-head {
        padding: 10px;
    }

    .metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metrics div {
        min-width: 0;
        padding: 8px;
        text-align: center;
    }

    .metrics strong {
        font-size: 1.15rem;
    }

    .metrics span {
        font-size: 0.72rem;
        overflow-wrap: anywhere;
    }

    input[type="search"],
    select,
    .clear-button,
    .import-link,
    .view-toggle,
    .language-toggle {
        min-height: 46px;
        font-size: 1rem;
    }

    .viewer-name-toggle {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .viewer-name-toggle button {
        min-width: 0;
        padding: 0 4px;
        font-size: clamp(0.8rem, 3.8vw, 0.95rem);
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: center;
    }

    .viewer-unit-toggle {
        grid-template-columns: 1fr 1fr;
    }

    .viewer-unit-toggle button {
        min-height: 44px;
        padding: 5px 6px;
        white-space: normal;
        text-align: center;
    }

    .reference-box {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .locality-table-title {
        font-size: clamp(1.35rem, 7vw, 1.8rem);
        overflow-wrap: anywhere;
    }

    .viewer-table,
    .data-table,
    .recap-table,
    .universe-table {
        font-size: 0.86rem;
    }

    .viewer-table th,
    .viewer-table td,
    .data-table th,
    .data-table td {
        padding: 7px 8px;
    }

    .sticky-col {
        max-width: min(48vw, 190px);
    }

    .name-cell {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .map-canvas,
    #map {
        min-height: 55vh;
        height: 55vh;
    }

    .leaflet-control-attribution {
        max-width: 78vw;
        font-size: 9px;
    }

    .owner-member-grid {
        grid-template-columns: 1fr;
    }

    .owner-family-members {
        margin-left: 0;
    }

    .result-card,
    .owner-member-card,
    .stats-card {
        padding: 10px;
    }
}

@media (max-width: 380px) {
    .app-shell {
        padding-inline: 6px;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .viewer-name-toggle button {
        font-size: 0.78rem;
    }

    .viewer-unit-toggle {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
@media (max-width: 620px) {
    .owner-type-toggle {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .owner-type-toggle button {
        min-width: 0;
        padding: 5px 6px;
        font-size: clamp(0.72rem, 3.7vw, 0.84rem);
        line-height: 1.05;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: center;
    }
}

/* C?utarea patronimelor pe harta satelor */
.map-family-search {
    display: grid;
    gap: 7px;
    margin: 0 0 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.map-family-search label { font-weight: 750; }
.map-family-search-row { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr) auto; gap: 8px; }
.map-family-search select,
.map-family-search input {
    min-width: 0;
    padding-left: 12px;
}
.map-search-input-wrap {
    position: relative;
    min-width: 0;
}
.map-search-input-wrap input {
    width: 100%;
    height: 100%;
}
.map-search-input-wrap .family-suggestions {
    top: calc(100% + 8px);
    left: 0;
    right: 0;
}
.map-family-search button { display: grid; place-items: center; align-self: stretch; width: 44px; min-height: 42px; padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-soft); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 700; line-height: 1; }
.map-side h3 { margin: 6px 0; font-size: 1rem; }
.map-source-results, #map-source-results { display: grid; gap: 6px; }
.map-source-result { display: grid; text-decoration: none; color: inherit; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.map-source-result span { color: var(--muted); font-size: .82rem; }
@media (max-width: 620px) { .map-family-search-row { grid-template-columns: minmax(0, 1fr) auto; } .map-family-search select { grid-column: 1 / -1; } }

.map-result em { color: #9a3f39; font-size: .78rem; font-style: normal; font-weight: 700; }


/* Panoul lateral al h?r?ii: list? compact? */
.map-side { gap: 0; padding: 0; background: var(--surface); }
.map-summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.map-summary-line strong { color: var(--ink); font-size: 1rem; }
.map-source-results, .map-side > section { display: block; }
.map-side > section h3 { margin: 0; padding: 10px 14px 6px; color: var(--muted); font-family: inherit; font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
#map-source-results, .map-results { display: block; max-height: none; overflow: visible; }
.map-source-result, .map-result { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: transparent; box-shadow: none; }
.map-source-result { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 9px 14px; }
.map-source-result span { white-space: nowrap; }
.map-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 14px; }
.map-result-name { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.map-result strong { font-size: .94rem; }
.map-result b { min-width: 1.65rem; padding: 2px 6px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .78rem; text-align: center; }
.map-result em { white-space: nowrap; font-size: .68rem; }
.map-source-result:hover, .map-result:hover { background: var(--surface-soft); }
@media (max-width: 980px) { #map-source-results, .map-results { max-height: 240px; overflow: auto; } }

.map-boundary-note { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }


/* Selectorul de limb? apar?ine antetului viewerului; nu plute?te peste tabel. */
.viewer-page-header > .view-toggle.global-language-toggle {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    z-index: 2;
    margin: 0;
}
@media (max-width: 760px) {
    .viewer-page-header > .view-toggle.global-language-toggle {
        top: 0;
        right: 0;
    }
}

.front-links a,
.conscription-navigation a {
    text-transform: lowercase;
}

/* Antet comun Urbarica */
.global-site-header {
    width: min(1320px, calc(100% - 28px));
    min-height: 58px;
    margin: 14px auto 0;
    padding: 7px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}


.global-site-header > .header-page-actions {
    position: static;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    transform: none;
    margin: 0;
    z-index: auto;
}

.global-site-header > .view-toggle.global-language-toggle {
    position: static;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    width: auto;
    min-height: 36px;
    margin: 0;
    transform: none;
    z-index: auto;
}

.global-site-header > .header-page-actions .clear-button {
    min-height: 38px;
}
.global-site-home {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.global-site-home img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.global-site-home span {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.65rem;
    font-weight: 750;
    line-height: 1;
}

.global-site-home:hover span {
    color: var(--accent);
}


@media (max-width: 620px) {
    .global-site-header {
        width: calc(100% - 16px);
        min-height: 50px;
        margin-top: 8px;
        padding: 6px 8px;
    }

    .global-site-header > .header-page-actions .clear-button {
        width: auto;
        min-height: 34px;
        padding-inline: 9px;
        font-size: 0.78rem;
    }

    .global-site-header > .view-toggle.global-language-toggle {
        min-height: 34px;
    }

    .global-site-home img {
        width: 32px;
        height: 32px;
    }

    .global-site-home span {
        font-size: 1.35rem;
    }
}
.search-icon-button {
    display: grid;
    place-items: center;
    align-self: center;
    width: 44px !important;
    min-width: 44px;
    min-height: 42px !important;
    height: 42px;
    padding: 0 !important;
    line-height: 1;
}

.search-icon-button svg {
    display: block;
    pointer-events: none;
}
.viewer-urbarium-search {
    margin: 0 0 14px;
}

.viewer-urbarium-search[hidden] {
    display: none;
}

.viewer-urbarium-search > .clear-button:last-child {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    padding: 0;
    text-decoration: none;
}

.viewer-search-button {
    cursor: pointer;
}
:is(.page-actions, .owner-family-back) .viewer-results-back {
    display: inline-flex;
    width: auto;
    min-width: 0;
    gap: 3px;
    align-items: center;
    justify-content: center;
    padding-inline: 9px 11px;
}
:is(.page-actions, .owner-family-back) .viewer-results-back svg {
    width: 16px;
    height: 16px;
}
.page-actions .viewer-icon-action {
    width: 38px;
    min-width: 38px;
    padding: 0;
}
.page-actions .viewer-map-action {
    width: auto;
    min-width: 0;
    padding-inline: 11px;
}
.page-actions .viewer-icon-action svg,
:is(.page-actions, .owner-family-back) .viewer-results-back svg {
    display: block;
    flex: 0 0 auto;
}
/* Vizualizatorul urbarial folosește cadre cu unghiuri drepte. */
.viewer-page .locality-head,
.viewer-page .viewer-landholder-block,
.viewer-page .table-panel,
.viewer-page .universa-table-panel,
.viewer-page .recap-table-panel,
.viewer-page .viewer-landholder-block .viewer-group-block:last-child .viewer-table-panel {
    border-radius: 0;
}
#locality-stats + .viewer-landholder-block {
    margin-top: 18px;
}
/* Bara compactă de căutare din index */
.search-front .search-form {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) 44px;
    gap: 8px;
}

.search-front .searchbox::before {
    content: none;
}

.search-front .search-form-simple {
    grid-template-columns: minmax(0, 1fr) 44px;
}

.search-front .searchbox-large input[type="search"],
.search-front .search-form select {
    min-height: 44px;
    height: 44px;
    font-size: 1rem;
}

.search-front .searchbox-large input[type="search"] {
    padding: 0 12px;
}

.search-front .search-form > .search-icon-button {
    width: 44px !important;
    min-width: 44px;
    min-height: 44px !important;
    height: 44px;
    border-radius: 7px;
}

@media (max-width: 760px) {
    .search-mode-tabs button { flex: 1 1 0; padding-inline: 5px; font-size: .82rem; }
    .search-module-header > .view-toggle.global-language-toggle button { min-width: 40px; padding-inline: 6px; }
    .search-mode-panel { padding: 14px; }
    .search-front .search-form {
        grid-template-columns: minmax(0, 1fr) 44px;
    }

    .search-front .search-form select {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .search-front .search-form > .search-icon-button {
        grid-column: 2;
        grid-row: 1;
    }
}
.page-actions .primary-action,
.global-site-header .page-actions .primary-action {
    color: #fff;
}
.global-site-header .clear-button,
.owner-family-back .clear-button {
    text-transform: lowercase;
}
/* Rezultatele sunt rânduri dreptunghiulare pe toată lățimea. */
.result-card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.result-card {
    width: 100%;
    min-height: 126px;
    align-content: start;
    padding: 12px 58px 12px 14px;
    border-radius: 0;
}

.result-count {
    top: 50%;
    right: 14px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 0;
    transform: translateY(-50%);
}
mark.search-hit {
    padding: 0 0.08em;
    background: #fff0a6;
    color: inherit;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
/* Datarea rezultatului în colțul din dreapta-sus. */
.result-card h2 {
    padding-right: 190px;
}

.result-card .result-date {
    position: absolute;
    top: 12px;
    right: 14px;
    white-space: nowrap;
}

.result-card .result-count {
    top: 74px;
    right: 14px;
    bottom: auto;
    transform: none;
}

@media (max-width: 620px) {
    .result-card h2 {
        padding-right: 0;
    }

    .result-card .result-date {
        position: static;
        white-space: normal;
    }

    .result-card .result-count {
        top: auto;
        bottom: 12px;
    }
}
#map-query-label {
    font-style: italic;
    font-weight: 400;
}
.result-card .result-source {
    position: absolute;
    top: 38px;
    right: 14px;
    max-width: 260px;
    font-style: italic;
    font-weight: 400;
    text-align: right;
}

@media (max-width: 620px) {
    .result-card .result-source {
        position: static;
        max-width: none;
        text-align: left;
    }
}
.result-card .name-samples {
    position: absolute;
    left: 14px;
    right: 64px;
    bottom: 12px;
    margin: 0;
}

@media (max-width: 620px) {
    .result-card .name-samples {
        position: static;
        margin-top: auto;
    }
}
.close-icon {
    display: block;
    pointer-events: none;
}
.map-family-search {
    position: relative;
}

.family-suggestions {
    position: absolute;
    z-index: 1100;
    top: calc(100% - 8px);
    left: 14px;
    right: 66px;
    display: grid;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.family-suggestions[hidden] {
    display: none;
}

.family-suggestions button {
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.family-suggestions button:last-child {
    border-bottom: 0;
}

.family-suggestions button:hover,
.family-suggestions button[aria-selected="true"] {
    background: #e8f1ef;
}

.family-suggestions button em {
    color: var(--muted);
    font-size: 0.78rem;
    font-style: normal;
}

@media (max-width: 620px) {
    .family-suggestions {
        left: 8px;
        right: 58px;
    }
}
input[type="search"]::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}
.family-suggestions button {
    place-items: initial;
    align-items: center;
    justify-items: start;
}

.family-suggestions button em {
    justify-self: end;
}
/* Pagina dedicată statisticilor */
.statistics-page-shell { width: min(1440px, calc(100% - 28px)); }
.statistics-page-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 28px;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.statistics-page-stats .stats-overview,
.statistics-page-stats .stats-land-card { grid-column: 1 / -1; }
.statistics-page-stats .stat-bar-head { align-items: start; }
.statistics-page-stats .stat-bar-head span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}
.viewer-stats-link {
    min-height: 38px;
    display: inline-grid;
    place-items: center;
    color: var(--accent-blue);
    text-decoration: none;
}
@media (max-width: 850px) {
    .statistics-page-stats { grid-template-columns: 1fr; }
    .statistics-page-stats .stats-overview,
    .statistics-page-stats .stats-land-card { grid-column: auto; }
}
/* Indexul și paginile individuale ale statisticilor */
.statistics-index-shell { width: min(1040px, calc(100% - 28px)); }
.statistics-index { display: grid; gap: 8px; margin: 0 auto 32px; }
.statistics-index a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; min-height: 72px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 2px 8px rgba(23,32,39,.04); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.statistics-index a:hover { transform: translateX(3px); border-color: var(--accent); box-shadow: 0 5px 16px rgba(23,32,39,.08); }
.statistics-index a span,.statistics-index a strong,.statistics-index a small { display: block; }
.statistics-index a strong { font-size: 1.08rem; }
.statistics-index a small { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.statistics-index a b { color: var(--accent); font-size: 1.35rem; font-weight: 500; }
.statistics-detail-shell { width: min(1160px, calc(100% - 28px)); }
.statistics-detail-header h1 { font-size: clamp(2.2rem, 5vw, 4.3rem); }
.statistics-detail-card { margin-bottom: 32px; padding: clamp(16px,3vw,28px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.statistics-detail-bars { gap: 15px; }
.statistics-detail-card .stat-bar-head { align-items: start; font-size: 1rem; line-height: 1.25; }
.statistics-detail-card .stat-bar-head span { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.statistics-detail-card .stat-track { height: 8px; }
.statistics-detail-intro { display: flex; gap: 9px; align-items: baseline; margin-bottom: 12px; }
.statistics-detail-intro strong { font-size: 2rem; }
.statistics-detail-intro span { color: var(--muted); }
@media (max-width:620px){.statistics-index a{min-height:64px;padding:11px 13px}.statistics-detail-header .page-actions{width:100%}.statistics-detail-header .page-actions a{flex:1 1 auto}}
/* Aspect sobru și compact pentru paginile statistice */
.statistics-page .statistics-page-header,
.statistics-page .statistics-detail-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    margin: 18px 0 14px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    text-align: left;
    box-shadow: 0 2px 8px rgba(23, 32, 39, .04);
}
.statistics-page .statistics-page-header h1,
.statistics-page .statistics-detail-header h1 {
    max-width: none;
    margin: 2px 0 0;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    line-height: 1.05;
    letter-spacing: -.015em;
}
.statistics-page .statistics-page-header .eyebrow,
.statistics-page .statistics-detail-header .eyebrow {
    margin: 0;
    font-size: .7rem;
    letter-spacing: .09em;
}
.statistics-page .statistics-page-header .subtitle,
.statistics-page .statistics-detail-header .subtitle {
    margin: 6px 0 0;
    font-size: .88rem;
    line-height: 1.25;
}
.statistics-page .statistics-page-header .page-actions,
.statistics-page .statistics-detail-header .page-actions {
    justify-content: flex-end;
}
.statistics-page .statistics-page-header .clear-button,
.statistics-page .statistics-detail-header .clear-button {
    min-width: 0;
    min-height: 36px;
    padding: 0 12px;
    font-size: .82rem;
}
.statistics-index-shell,
.statistics-detail-shell { width: min(1000px, calc(100% - 28px)); }
.statistics-index { gap: 6px; margin-bottom: 24px; }
.statistics-index a {
    min-height: 58px;
    padding: 9px 14px;
    border-radius: 6px;
    box-shadow: none;
}
.statistics-index a:hover {
    transform: none;
    background: var(--surface-soft);
    box-shadow: none;
}
.statistics-index a strong { font-size: .98rem; }
.statistics-index a small { margin-top: 2px; font-size: .76rem; }
.statistics-index a b { font-size: 1.05rem; }
.statistics-detail-card {
    margin-bottom: 24px;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(23, 32, 39, .04);
}
.statistics-detail-bars { gap: 11px; }
.statistics-detail-card .stat-bar-head { font-size: .92rem; }
.statistics-detail-card .stat-track { height: 7px; }
.statistics-detail-intro strong { font-size: 1.55rem; }
@media (max-width: 720px) {
    .statistics-page .statistics-page-header,
    .statistics-page .statistics-detail-header { grid-template-columns: 1fr; gap: 12px; padding: 14px; }
    .statistics-page .statistics-page-header .page-actions,
    .statistics-page .statistics-detail-header .page-actions { justify-content: flex-start; }
    .statistics-page .statistics-detail-header .page-actions a { flex: 0 1 auto; }
}
/* Clasamente complete pentru patronimice și prenume */
.statistics-ranking-card { padding: 0; overflow: hidden; }
.statistics-ranking-card .stats-inline-toggle { margin: 14px 16px 4px; }
.statistics-ranking { margin: 0; padding: 0; list-style: none; }
.statistics-ranking[hidden] { display: none; }
.statistics-ranking li { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.statistics-ranking li:last-child { border-bottom: 0; }
.statistics-ranking li:nth-child(even) { background: var(--surface-soft); }
.statistics-ranking .ranking-position { color: var(--accent); font-weight: 800; text-align: right; }
.statistics-ranking li strong { font-size: .98rem; font-weight: 700; }
.statistics-ranking .ranking-count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
@media (max-width:620px){.statistics-ranking li{grid-template-columns:32px minmax(0,1fr);gap:8px;padding:9px 11px}.statistics-ranking .ranking-count{grid-column:2;white-space:normal}}
/* Clasamente integrale: aceeași reprezentare cu bare ca în celelalte statistici. */
.statistics-ranking-bars[hidden] { display: none; }
.statistics-ranking-bars .ranking-position {
  display: inline-block;
  min-width: 2.1rem;
  color: var(--accent);
  font-weight: 800;
}
.statistics-name-map-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.statistics-name-map-link:hover,
.statistics-name-map-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}
/* Patronimice/Prenume folosesc exact încadrarea celorlalte casete statistice. */
.statistics-detail-card.statistics-ranking-card {
  padding: 18px;
  overflow: visible;
}
.statistics-ranking-card .stats-inline-toggle {
  margin: 0 0 14px;
}
@media (max-width: 620px) {
  .statistics-detail-card.statistics-ranking-card { padding: 14px; }
}
/* Etichetele cantitative din indexul proprietarilor sunt uniforme la toate nivelurile. */
.owner-directory-count,
.owner-suffix-summary em,
.owner-family-member em,
.owner-county-details > summary em,
.owner-estate-item > span,
.owner-member-card em {
  display: inline-flex;
  align-items: center;
  align-self: center;
  justify-content: flex-end;
  justify-self: end;
  min-width: 9.5rem;
  min-height: 1.2em;
  color: var(--muted);
  font-size: .78rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}
.owner-estate-item {
  align-items: center;
}
@media (max-width: 560px) {
  .owner-directory-count,
  .owner-suffix-summary em,
  .owner-family-member em,
  .owner-county-details > summary em,
  .owner-estate-item > span,
  .owner-member-card em {
    min-width: 0;
  }
}
/* Antetul indexului statistic: titlu și identități administrativă/istorică centrate. */
.statistics-page .statistics-page-header {
  display: block;
  text-align: center;
}
.statistics-page .statistics-page-header .statistics-header-copy {
  width: 100%;
  text-align: center;
}
.statistics-page .statistics-page-header .statistics-header-copy h1 {
  margin: 0 0 7px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}
.statistics-locality-current,
.statistics-locality-historical {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}
.statistics-locality-historical { margin-top: 2px; }
.family-head-name.is-nihil,
.nihil-label {
  font-style: italic;
  font-weight: 400;
}
.is-undetermined {
  font-style: italic !important;
  font-weight: 400 !important;
}

/* Statistica generală a structurii sociale din Conscripția czirákyană. */
.conscription-general-statistics {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(420px, 1.2fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  margin-bottom: 30px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.conscription-statistics-copy .eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.conscription-statistics-copy h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.55rem); line-height: 1.08; }
.conscription-statistics-copy > p:last-child { margin: 12px 0 0; color: var(--muted); }
.social-pie-layout { display: grid; grid-template-columns: minmax(210px, 290px) minmax(220px, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center; }
.social-pie { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#176f62 0 var(--pie-a), #4f8fa3 var(--pie-a) var(--pie-b), #c48a3a var(--pie-b) var(--pie-c), #c9d1d3 var(--pie-c) 360deg); box-shadow: inset 0 0 0 1px rgba(23,32,39,.06); }
.social-pie::before { content: ''; grid-area: 1 / 1; width: 55%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.social-pie > span { z-index: 1; grid-area: 1 / 1; display: grid; gap: 2px; color: var(--muted); font-size: .76rem; text-align: center; }
.social-pie > span strong { color: var(--ink); font-size: clamp(1.35rem, 3vw, 2rem); }
.social-pie-legend { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.social-pie-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.social-pie-legend li:last-child { border-bottom: 0; }
.social-pie-dot { width: 10px; height: 10px; border-radius: 50%; background: #c9d1d3; }
.social-pie-iobagi .social-pie-dot { background: #176f62; }
.social-pie-jeleri .social-pie-dot { background: #4f8fa3; }
.social-pie-colocatari .social-pie-dot { background: #c48a3a; }
.social-pie-legend strong { font-size: .98rem; }
.social-pie-legend b { color: var(--accent); font-size: 1rem; }
.social-pie-legend small { grid-column: 2 / -1; color: var(--muted); font-size: .76rem; }
@media (max-width: 820px) {
  .conscription-general-statistics { grid-template-columns: 1fr; }
  .social-pie-layout { grid-template-columns: minmax(170px, 240px) minmax(190px, 1fr); }
}
@media (max-width: 540px) {
  .social-pie-layout { grid-template-columns: 1fr; }
  .social-pie { width: min(240px, 82vw); justify-self: center; }
}
/* Repertoriul general al patronimicelor. */
.patronym-directory-shell { width: min(1320px, calc(100% - 28px)); max-width: none; }
.patronym-family-content { display: grid; gap: 8px; padding: 8px 10px 10px 32px; }
.patronym-family-details .owner-estate-list { margin: 0; }
.patronym-family-details .owner-estate-item { padding-block: 8px; }
.patronym-family-details .owner-estate-item > span { color: var(--muted); font-size: .78rem; white-space: nowrap; }
@media (max-width: 620px) { .patronym-family-content { padding-left: 12px; } }
.owner-alphabet a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.owner-letter-section[hidden] { display: none !important; }


/* Export PDF: control compact și selecție de rânduri în viewer. */
.page-actions .viewer-pdf-action {
    width: auto;
    min-width: 0;
    padding-inline: 10px;
    cursor: pointer;
}
.page-actions .viewer-pdf-action.is-active {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
}
.viewer-pdf-panel[hidden] { display: none !important; }
.viewer-pdf-panel {
    display: grid;
    gap: 14px;
    margin: 0 0 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.viewer-pdf-panel-head,
.viewer-pdf-panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.viewer-pdf-panel-head > div { display: flex; align-items: baseline; gap: 10px; }
.viewer-pdf-panel-head strong { color: var(--ink); font-size: 1.05rem; }
.viewer-pdf-panel-head span { color: var(--muted); font-size: .82rem; }
.viewer-pdf-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: 1.35rem;
    cursor: pointer;
}
.viewer-pdf-options {
    display: grid;
    grid-template-columns: minmax(240px, 1.35fr) repeat(2, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}
.viewer-pdf-options fieldset,
.viewer-pdf-options > label,
.viewer-pdf-columns {
    min-width: 0;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: #fbfcfc;
    font-size: .78rem;
}
.viewer-pdf-options fieldset { display: flex; flex-wrap: wrap; gap: 7px 16px; }
.viewer-pdf-options legend { padding: 0 4px; color: var(--ink); font-weight: 700; }
.viewer-pdf-options fieldset label,
.viewer-pdf-summary { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.viewer-pdf-options > label { display: grid; gap: 6px; }
.viewer-pdf-options select {
    width: 100%;
    min-height: 36px;
    padding: 5px 30px 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: .88rem;
}
.viewer-pdf-columns { grid-column: 1 / -1; align-self: stretch; }
.viewer-pdf-columns summary { color: var(--ink); font-weight: 700; cursor: pointer; }
.viewer-pdf-columns > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 7px 14px;
    padding-top: 11px;
}
.viewer-pdf-columns label { display: flex; align-items: flex-start; gap: 7px; color: var(--ink); line-height: 1.25; }
.viewer-pdf-summary { grid-column: 1 / -1; justify-self: start; }
.viewer-pdf-panel-actions { justify-content: flex-end; }
.viewer-pdf-panel-actions .clear-button { width: auto; min-width: 0; padding-inline: 13px; }
.pdf-row-selector { display: none; margin-right: 5px; vertical-align: middle; cursor: pointer; }
.pdf-selection-active .pdf-row-selector { display: inline-flex; }
.pdf-row-selector input { position: absolute; opacity: 0; pointer-events: none; }
.pdf-row-selector span {
    display: block;
    width: 15px;
    height: 15px;
    border: 1px solid #9fb6b2;
    border-radius: 3px;
    background: #fff;
}
.pdf-row-selector input:checked + span { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
tr:has(.pdf-row-selector input:checked) > td { background-color: #eef7f4; }
.pdf-single-export {
    display: none;
    float: right;
    margin: -2px 0 -2px 8px;
    padding: 3px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--accent);
    background: #fff;
    font: inherit;
    font-size: .62rem;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .035em;
    cursor: pointer;
    opacity: .7;
}
.pdf-export-active .pdf-single-export { display: inline-block; }
.pdf-single-export:hover,
.pdf-single-export:focus-visible { opacity: 1; border-color: var(--accent); }
@media (max-width: 820px) {
    .viewer-pdf-options { grid-template-columns: 1fr 1fr; }
    .viewer-pdf-options fieldset { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
    .viewer-pdf-options { grid-template-columns: 1fr; }
    .viewer-pdf-options > * { grid-column: 1 !important; }
    .viewer-pdf-panel-actions { align-items: stretch; flex-direction: column; }
    .viewer-pdf-panel-actions .clear-button { width: 100%; }
}

/* Selector RO/HU integrat curat în antetul căutării. */
.search-module-header {
    padding-right: 0;
}
.search-module-header > .view-toggle.global-language-toggle {
    align-self: stretch;
    min-height: 0;
    margin: 8px 8px 8px 0;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: none;
}
.search-module-header > .view-toggle.global-language-toggle button {
    min-width: 44px;
    min-height: 0;
    height: 100%;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    line-height: 1;
}
.search-module-header > .view-toggle.global-language-toggle button + button {
    border-left: 1px solid var(--line);
}