/* Parten-Verwaltung – Schwarz-Weiß-Trauerdesign.
   Anlehnung an klassische Sterbebilder: weißes Papier, schwarzer
   Trauerrand, Serifenschrift, keine Farben. */
:root {
    --ink: #111111;
    --ink-soft: #3a3a3a;
    --muted: #6e6e6e;
    --line: #111111;
    --line-soft: #cfcfcf;
    --paper: #ffffff;
    --bg: #e9e9e9;
    --hover: #f0f0f0;
}

* { box-sizing: border-box; }

/* =====================================================================
   Öffentliche Vereins-Webseite (familienforscher.at) – Kopf, Navigation,
   Banner, Inhalt, Sponsoren, Fuß. Gleiche Trauer-/Papier-Anmutung wie der
   Mitgliederbereich, aber als klassische Webseite mit Kopf + Top-Navigation.
   ===================================================================== */
.site-head {
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem 1.5rem; background: var(--ink); color: #fff;
    border-bottom: 4px solid #000;
}
.site-head .spacer { flex: 1; }
.site-brand {
    font-size: 1.35rem; font-weight: 600; letter-spacing: .01em;
    color: #fff; text-decoration: none;
}
.site-brand span { color: #b9b9b9; font-weight: 400; }
.site-brand:hover { background: none; color: #fff; }
.site-tagline {
    font-size: .82rem; color: #cfcfcf; font-style: italic;
    border-left: 1px solid #555; padding-left: .85rem; margin-left: .35rem;
}
.site-user { font-size: .82rem; opacity: .8; }

.site-nav {
    background: var(--paper); border-bottom: 2px solid var(--ink);
    padding: 0 1rem; position: sticky; top: 0; z-index: 90;
    display: flex; align-items: center;
}
.site-nav .nav-toggle { display: none; margin: .35rem 0; }
.site-nav-links { display: flex; flex-wrap: wrap; align-items: center; }
.site-nav .nav-link {
    display: inline-block; padding: .7rem 1rem; color: var(--ink);
    text-decoration: none; font-size: .92rem; border-bottom: 3px solid transparent;
}
.site-nav .nav-link:hover { background: var(--hover); }
.site-nav .nav-link.active {
    background: none; color: var(--ink); font-weight: 600;
    border-bottom-color: var(--ink);
}
.nav-sep-v { width: 1px; align-self: stretch; background: var(--line-soft); margin: .3rem .4rem; }

.site-banner {
    height: 150px;
    background: #000 url('/img/schnitter.jpg') center 35% / cover no-repeat;
    filter: grayscale(100%); border-bottom: 4px solid #000;
}

.site-main {
    max-width: 1180px; margin: 0 auto; padding: 1.9rem 2rem 2.5rem;
    background: var(--bg); min-height: 40vh;
}

.site-foot {
    display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between;
    padding: 1rem 2rem; background: var(--ink); color: #cfcfcf; font-size: .82rem;
    border-top: 4px solid #000;
}
.site-foot a { color: #fff; }

/* Sponsoren-Leiste (Partial _Sponsors) */
.sponsors {
    display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center;
    justify-content: center; margin: 2rem 5px 0; padding-top: 1.4rem;
    border-top: 1px solid var(--line-soft);
}
.sponsors a { line-height: 0; }
.sponsors img { height: 46px; filter: grayscale(100%); opacity: .8; }
.sponsors img:hover { opacity: 1; }

/* Inhaltsblöcke der öffentlichen Seiten */
.article-body { font-size: .98rem; line-height: 1.7; }
.article-body p { margin: 0 0 1rem; }
.content-section { margin-bottom: 2rem; }
.content-section > h2 { border-bottom: 1px solid var(--line-soft); padding-bottom: .35rem; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: .6rem 0; border-bottom: 1px solid var(--line-soft); }
.link-list .lnk-title { font-weight: 600; }

@media (max-width: 820px) {
    .site-tagline { display: none; }
    .site-nav { display: block; padding: 0; }
    .site-nav .nav-toggle { display: inline-block; margin: .4rem .6rem; }
    .site-nav-links { display: none; flex-direction: column; align-items: stretch; }
    body.nav-open .site-nav-links { display: flex; }
    .site-nav .nav-link { border-bottom: 1px solid var(--line-soft); }
    .nav-sep-v { display: none; }
    .site-main { padding: 1.1rem 1rem 2rem; }
}

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: #000; background: #ededed; }

h1, h2, h3 {
    font-weight: 500;
    letter-spacing: 0;
    margin: 0 0 .8rem;
}
h1 {
    font-size: 1.45rem;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: .45rem;
    margin-bottom: 1.2rem;
}
h2 { font-size: 1.05rem; margin: 1.1rem 0 .55rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---- Topbar: schwarzer Trauerbalken ---- */
.topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    height: 58px;
    padding: 0 1.25rem;
    background: var(--ink);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 4px solid #000;
}
.topbar a { color: #fff; }
/* Website-Zugehörigkeit: gleiche Marke wie familienforscher.at, Link zurück. */
.topbar .brand-site {
    font-size: 1.1rem; font-weight: 600; text-decoration: none; letter-spacing: .01em;
}
.topbar .brand-site .dot { color: #caa45a; }
.topbar .brand-site:hover { background: none; text-decoration: underline; }
.topbar .brand-divider { color: #777; }
.topbar .brand {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: .02em;
}
.topbar .topbar-tagline {
    font-size: .82rem; color: #bdbdbd; font-style: italic;
    border-left: 1px solid #444; padding-left: .75rem; margin-left: .15rem;
}
.topbar .spacer { flex: 1; }
@media (max-width: 760px) {
    .topbar .topbar-tagline, .topbar .brand-divider { display: none; }
    .topbar .brand-site { font-size: 1rem; }
}
.topbar .user { font-size: .85rem; opacity: .85; }
.nav-toggle {
    background: none; border: 1px solid #555; color: #fff;
    font-size: 1.05rem; cursor: pointer; padding: .2rem .55rem; border-radius: 0;
}
.btn-link {
    background: none; border: 0; color: #fff; cursor: pointer;
    font-size: .85rem; padding: .35rem .6rem; font-family: inherit;
}
.btn-link:hover { background: #2a2a2a; text-decoration: none; }
.logout-form { display: inline; margin: 0; }

/* ---- Helle Webseiten-Navigation im Parten-Bereich (Zugehörigkeit) ---- */
.member-topnav {
    display: flex; flex-wrap: wrap; align-items: center; gap: .1rem;
    background: var(--paper); border-bottom: 2px solid var(--ink); padding: 0 1rem;
}
.member-topnav a {
    color: var(--ink); text-decoration: none; font-size: .92rem;
    padding: .6rem .85rem; border-bottom: 3px solid transparent;
}
.member-topnav a:hover { background: var(--hover); }
.member-topnav a.active { font-weight: 600; border-bottom-color: var(--ink); }
@media (max-width: 720px) {
    .member-topnav { flex-wrap: nowrap; overflow-x: auto; padding: 0 .25rem; }
    .member-topnav a { white-space: nowrap; padding: .6rem .6rem; }
}
.sidebar-label {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); padding: .2rem 1.4rem .5rem;
}

/* ---- Shell / Sidebar ---- */
.shell { display: flex; min-height: calc(100vh - 58px); }
.sidebar {
    width: 220px;
    background: var(--paper);
    border-right: 2px solid var(--ink);
    padding: 1rem 0;
    flex-shrink: 0;
    display: none;            /* per Default ausgeblendet, Menüknopf blendet ein */
}
body.nav-open .sidebar { display: block; }
.nav-link {
    display: block;
    padding: .6rem 1.4rem;
    color: var(--ink);
    text-decoration: none;
    font-size: .95rem;
}
.nav-link:hover { background: var(--hover); }
.nav-link.active {
    background: var(--ink);
    color: #fff;
    font-weight: 500;
}
.nav-sep { height: 2px; background: var(--ink); margin: .6rem 1.4rem; }
.content { flex: 1; padding: 1.75rem 2.25rem; min-width: 0; }

@media (max-width: 720px) {
    /* Auf Mobile als Overlay über dem Inhalt – Sidebar würde sonst die
       halbe Bildschirmbreite fressen. */
    body.nav-open .sidebar {
        position: fixed;
        top: 58px;
        left: 0;
        bottom: 0;
        z-index: 95;
        width: min(80vw, 280px);
        box-shadow: 4px 0 10px rgba(0,0,0,.25);
        overflow-y: auto;
    }
    .content { padding: 1rem; }
}

/* ---- Karten / Panels: Papier mit Trauerrand ---- */
.panel {
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--ink);
    padding: 1.4rem 1.5rem;
    margin: 0 5px 1.4rem;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.4rem;
    margin: 0 5px;
}
.card-grid .panel { margin: 0 0 .25rem; }

/* ---- Formulare ---- */
label { display: block; font-size: .82rem; color: var(--muted);
        margin: .6rem 0 .2rem; }
input[type=text], input[type=email], input[type=password],
input[type=number], select {
    width: 100%;
    padding: .5rem .6rem;
    font-size: .95rem;
    font-family: inherit;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 0; }

textarea {
    width: 100%;
    min-height: 18rem;          /* deutlich höher als der Browser-Standard */
    padding: .6rem .7rem;
    font-size: .95rem;
    font-family: inherit;
    line-height: 1.5;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: #fff;
    color: var(--ink);
    resize: vertical;
}
textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.form-row > div { flex: 1; min-width: 140px; }

/* Eigene Auto-Vervollständigung (Orts-Suchbox) – iOS-tauglicher Ersatz fürs
   native <datalist>-Popup. Das Dropdown hängt unter dem Eingabefeld. */
.ac-field { position: relative; }
.ac-list {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--ink);
    border-top: none;
    max-height: 16rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}
.ac-list.open { display: block; }
.ac-item {
    padding: .55rem .75rem;
    cursor: pointer;
    font-size: .92rem;
    line-height: 1.2;
    border-top: 1px solid var(--rule, #e5e5e5);
}
.ac-item:first-child { border-top: none; }
.ac-item.active,
.ac-item:hover { background: var(--hover, #f0f0f0); }
.checkbox { display: flex; align-items: center; gap: .4rem; }
.checkbox input { width: auto; }

/* An/Aus-Schalter: eine Checkbox wird visuell als hübscher Button dargestellt.
   Klar erkennbarer Zustand über ○ (aus) / ● (an) und gefüllten Hintergrund. */
.toggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-btn {
    display: inline-block; margin: 0; cursor: pointer; user-select: none;
    padding: .5rem 1.05rem;
    border: 1px solid var(--ink);
    background: #fff; color: var(--ink);
    font-family: inherit; font-size: .88rem; white-space: nowrap;
}
.toggle-btn::before { content: "\25CB\00a0"; }        /* ○ + geschütztes Leerzeichen */
.toggle-btn:hover { background: var(--hover); }
.toggle-input:checked + .toggle-btn { background: var(--ink); color: #fff; }
.toggle-input:checked + .toggle-btn::before { content: "\25CF\00a0"; } /* ● */
.toggle-input:checked + .toggle-btn:hover { background: #000; }
.toggle-input:focus-visible + .toggle-btn { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn {
    display: inline-block;
    padding: .5rem 1.15rem;
    background: var(--ink);
    color: #fff;
    border: 1px solid var(--ink);
    border-radius: 0;
    font-family: inherit;
    font-size: .88rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #fff; color: var(--ink); }
.btn.secondary { background: #fff; color: var(--ink); }
.btn.secondary:hover { background: var(--ink); color: #fff; }
.btn.danger { background: #fff; color: #000; border-color: #000; }
.btn.danger:hover { background: #000; color: #fff; }
.btn.small { padding: .25rem .6rem; font-size: .75rem; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.alert {
    padding: .75rem 1rem; margin: .85rem 5px; font-size: .9rem;
    background: #fff; border: 1px solid var(--ink); border-left: 6px solid var(--ink);
}
.alert.info    { border-left-color: #555; }
.alert.warn    { border-left-color: #000; font-style: italic; }
.alert.error   { border-left-color: #000; font-weight: 700; }
.alert.success { border-left-color: #888; }

.chip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--ink); color: #fff;
    padding: .25rem .8rem; font-size: .8rem;
}
.chip a { color: #fff; font-weight: 700; }

/* Review-Hinweis: nur Admin/Redakteur, dezent im Trauerthema */
.review-flag {
    display: inline-block; margin-left: .5rem;
    font-size: .7rem; letter-spacing: .03em;
    border: 1px solid var(--ink); padding: 0 .35rem;
    font-style: italic; vertical-align: middle;
}
.review-banner { margin: .2rem 0 1rem; }

/* ---- Tabellen ---- */
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    border: 2px solid var(--ink);
    margin: 0 5px;
}
table.data th, table.data td {
    padding: .5rem .8rem;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    font-size: .9rem;
}
table.data thead th {
    background: var(--ink);
    color: #fff;
    font-weight: 500;
    border-bottom: 1px solid #000;
}
table.data thead th a.sort {
    color: #fff; text-decoration: none; display: block;
    white-space: nowrap;
}
table.data thead th a.sort:hover { background: #2c2c2c; color: #fff; }
table.data thead th .ind { font-size: .8em; opacity: .85; }
table.data tbody tr:hover { background: var(--hover); }
table.data tr.clickable { cursor: pointer; }
table.data .num { text-align: right; }
table.data td.score { font-variant-numeric: tabular-nums; color: var(--ink); opacity: .75; }

/* Ergebnisbereich während einer laufenden Echtzeitsuche.
   - Inhalt wird dezent abgeblendet.
   - Eine schmale animierte Sliding-Bar zeigt, dass tatsächlich was läuft
     (relevant v. a. bei der Volltext/OCR-Suche, die mehrere Sekunden dauern kann).
   - Optionaler Text-Indikator (.search-pulse) erscheint erst nach ~250 ms,
     damit kurze Suchen nicht flackern. */
#results-region { position: relative; }
#results-region.loading > :not(.search-pulse) { opacity: .45; transition: opacity .12s ease; }

/* ---- Landing/Statistik-Karte auf /parten und /zeitungen ---- */
.parten-landing { margin-top: .8rem; }
.parten-landing-hero {
    display:flex; align-items:baseline; gap:.6rem;
    padding: 1rem 1.25rem; margin-bottom: 1rem;
    background: #f4f0e8; border-left: 6px solid var(--ink);
}
.parten-landing-num {
    font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.parten-landing-text { font-size: 1.05rem; }
.parten-landing-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem;
}
@media (max-width: 720px) { .parten-landing-grid { grid-template-columns: 1fr; } }
.cloud { list-style: none; padding: 0; margin: 0;
         display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.cloud li { display: inline-flex; align-items: baseline; gap: .25rem;
            padding: .2rem .55rem; border: 1px solid var(--line-soft);
            border-radius: 14px; background: #fff; }
.cloud li a { color: var(--ink); text-decoration: none; font-weight: 600; }
.cloud li a:hover { text-decoration: underline; }
.decade-bars {
    display: flex; align-items: flex-end; gap: 3px;
    min-height: 110px; padding-bottom: 22px;
    border-bottom: 1px solid var(--line-soft);
    position: relative;
}
/* Das <a> IST der Balken: height kommt inline aus dem Razor (Pixel).
   Labels hängen absolut drunter. */
.decade-bar {
    flex: 1 1 0; min-width: 14px;
    background: var(--ink);
    position: relative;
    text-decoration: none;
    min-height: 4px;
    transition: background .15s;
}
.decade-bar:hover { background: #c87800; }
.decade-bar-label {
    position: absolute;
    bottom: -20px; left: 50%; transform: translateX(-50%);
    font-size: .7rem; color: var(--muted);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Nur jedes zweite Label schreiben würde besser passen, aber das müsste
   Razor-seitig entschieden werden — fürs Erste rotieren wir die Labels
   bei Bedarf um 90°, wenn es zu eng wird. */
@media (max-width: 600px) {
    .decade-bar-label { transform: translateX(-50%) rotate(-60deg); transform-origin: top center; bottom: -28px; }
    .decade-bars { padding-bottom: 32px; }
}
#results-region.loading::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%, var(--ink) 30%, var(--ink) 70%, transparent 100%);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    background-position: -40% 0;
    animation: results-slide 1.1s cubic-bezier(.4, 0, .2, 1) infinite;
    z-index: 5;
    pointer-events: none;
}
@keyframes results-slide {
    0%   { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}
.search-pulse {
    display: none;
    position: absolute;
    top: 12px; right: 8px;
    background: var(--ink); color: #fff;
    padding: 3px 10px; border-radius: 12px;
    font-size: .78rem; letter-spacing: .02em;
    z-index: 6; pointer-events: none;
    animation: search-pulse-fade .2s ease-out;
}
#results-region.loading.loading-slow .search-pulse { display: inline-block; }
.search-pulse::before {
    content: "●";
    margin-right: .35rem; color: #fff;
    animation: search-pulse-dot 1.1s ease-in-out infinite;
}
@keyframes search-pulse-dot { 50% { opacity: .25; } }
@keyframes search-pulse-fade { from { opacity: 0; } to { opacity: 1; } }

.pagination { display: flex; gap: .3rem; justify-content: center;
              margin: 1.25rem 5px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: .35rem .7rem; border: 1px solid var(--ink);
    background: #fff; font-size: .85rem; text-decoration: none; color: var(--ink);
}
.pagination .current { background: var(--ink); color: #fff; }
.pagination .disabled { opacity: .3; pointer-events: none; }

.scroll-status {
    text-align: center;
    padding: 1rem;
    margin: 0 5px;
    border: 1px solid var(--line-soft);
    border-top: 0;
    background: var(--paper);
}

/* „Nach oben"-Knopf: schwebend unten rechts.
   Endlos-Liste erreicht ihr Ende nicht (Sentinel lädt 400 px vor Sichtbar-
   werden nach), darum als Floating-Button. site.js schaltet `.visible`,
   sobald window.scrollY > 400. */
a.back-to-top {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    background: var(--ink);
    color: #fff;
    border: 2px solid var(--ink);
    text-decoration: none;
    font-size: 1.25rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
a.back-to-top.visible { opacity: 1; pointer-events: auto; }
a.back-to-top:hover { background: #000; color: #fff; }

/* ---- Hover-Vorschau ---- */
.name-cell { position: relative; }
/* Kleines Vorschau-Icon links: nur dessen Hover lädt + zeigt das Thumbnail.
   Vermeidet das Massen-Nachladen beim schnellen Überfahren ganzer Zeilen. */
.pv-trigger {
    display: inline-block;
    vertical-align: middle;
    margin-right: .45rem;
    line-height: 0;
    color: var(--ink-soft);
    cursor: pointer;
}
/* Hover auf die Namens-Zelle öffnet die Vorschau direkt — kein eigenes Icon
   mehr. site.js verzögert das Laden um 250 ms, damit schnelles Scrollen
   durch die Liste keine Massen-Downloads auslöst. */
.name-cell.pv-host:hover .preview { display: block; }

/* Lade-Spinner in der Vorschau: sichtbar, solange das Bild noch nicht da ist.
   Sobald das <img> seinen load-Event feuert (site.js setzt class="pv-loaded"),
   wird der Spinner ausgeblendet. */
.pv-spinner {
    width: 36px; height: 36px; margin: 1rem auto;
    border: 3px solid #d6d2c8;
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: pv-spin .8s linear infinite;
}
@keyframes pv-spin { to { transform: rotate(360deg); } }
/* Browser mit :has()-Support (alle modernen ab Ende 2023) blenden den Spinner
   sobald img/iframe geladen ist. Fallback via .pv-hidden setzt site.js. */
.preview:has(img.pv-loaded) .pv-spinner,
.preview:has(iframe.pv-loaded) .pv-spinner,
.preview .pv-spinner.pv-hidden { display: none; }
/* Mobile: keine Hover-Vorschau (Touch hat kein Hover) – Icon weg. */
@media (max-width: 720px) {
    .pv-trigger { display: none; }
}
.preview {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 50;
    width: 320px;
    background: #fff;
    border: 1px solid var(--ink);
    box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--ink);
    padding: .7rem;
    margin-left: .7rem;
    line-height: 1.4;   /* .pv-trigger setzt line-height:0 – hier zurücksetzen, sonst überlappen die Textzeilen */
}
.preview img {
    width: 100%; max-height: 220px; object-fit: contain;
    display: block; margin-bottom: .5rem;
    filter: grayscale(100%);
    border: 1px solid var(--ink);
}
.preview .pv-pdf {
    width: 100%; height: 240px; display: block; margin-bottom: .5rem;
    border: 1px solid var(--ink); background: #fff;
}
.preview .pv-line { font-size: .8rem; color: var(--ink-soft); }
.preview .pv-name { font-weight: 700; font-size: .92rem; margin-bottom: .2rem; }

/* ---- Modal ---- */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    width: min(1100px, 92vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--ink);
    box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--ink);
}
.modal-head {
    display: flex; align-items: center;
    padding: .9rem 1.35rem;
    border-bottom: 3px double var(--ink);
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
    margin-left: auto; background: none; border: 0;
    font-size: 1.5rem; cursor: pointer; color: var(--ink); line-height: 1;
}
.modal-body { padding: 1.4rem; overflow-y: auto; }

/* ---- Lightbox für Bilder (z. B. das Sterbebild im Parten-Detail).
   Liegt über dem Detail-Modal (z-index 1100 > 1000), eigene Backdrop-Logik.
   Klick + ziehen = verschieben, Mausrad = zoom, Doppelklick = zurücksetzen. */
/* Backdrop ist halbtransparent statt fast schwarz — der Kontext bleibt sichtbar,
   wirkt weniger erschreckend für ältere Anwender. */
.lb-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(20,15,10,.65); z-index: 1100;
}
.lb-backdrop.open { display: block; }
.lb-stage {
    position: absolute; inset: 0;
    overflow: hidden;
    cursor: grab; user-select: none;
    display: flex; align-items: center; justify-content: center;
    /* Padding sorgt für visuellen Rand statt Bild-bis-zum-Bildschirmrand. */
    padding: 6vh 8vw;
    box-sizing: border-box;
}
.lb-stage.grabbing { cursor: grabbing; }
/* Schonendere Maße: ~75 % der Viewport-Fläche statt Vollbild. Der
   Mausrad-Zoom hebt das Bild trotzdem auf jede gewünschte Größe. */
.lb-img {
    transform-origin: center center;
    transform: translate(0,0) scale(1);
    transition: transform 60ms ease-out;
    max-width: 78vw; max-height: 76vh;
    -webkit-user-drag: none; user-drag: none;
    background: #fff;
    border: 6px solid #fff;
    box-shadow: 0 6px 28px rgba(0,0,0,.5);
}
.lb-close {
    position: absolute; top: .8rem; right: 1rem;
    background: #fff; color: #1a1a1a; border: 1px solid #1a1a1a;
    font-size: 1.6rem; line-height: 1; cursor: pointer;
    width: 2.4rem; height: 2.4rem; border-radius: 50%;
    z-index: 2; font-weight: 600;
}
.lb-close:hover { background: #1a1a1a; color: #fff; }
.lb-hint {
    position: absolute; bottom: 1.2rem; left: 50%;
    transform: translateX(-50%);
    color: #fff; font-size: .85rem;
    background: rgba(0,0,0,.55); padding: .35rem .9rem; border-radius: 14px;
    pointer-events: none;
}

/* ---- Druckansicht ----
   Beim Drucken eines Detail-Modals sollen Layout-Chrome (Modal-Backdrop,
   Header-Navigation, Buttons) entfallen, nur Inhalt bleibt. Wichtig:
   verstecken muss display:none sein, NICHT visibility:hidden — sonst
   nimmt das versteckte Markup weiterhin Platz und ergibt leere Seiten. */
@media print {
    body > *:not(.modal-backdrop) { display: none !important; }
    .modal-backdrop {
        position: static !important; display: block !important;
        background: none !important; padding: 0 !important; overflow: visible !important;
        width: 100% !important;
    }
    .modal {
        width: 100% !important; max-width: none !important; max-height: none !important;
        border: none !important; box-shadow: none !important;
    }
    .modal-head, .modal-close, .pd-btn, .pd-link, .review-banner,
    .lb-backdrop, .ocr-block, details, .pd-actions { display: none !important; }
    .modal-body { overflow: visible !important; padding: 0 !important; }
    .asset-card { border: none !important; padding: 0 !important; }
    .asset-card img { max-height: none !important; page-break-inside: avoid; }
    .detail-grid { display: block !important; gap: 0 !important; }
    .panel { border: none !important; padding: .3rem 0 !important; box-shadow: none !important; }
}

/* ---- Mobile-Anpassung Detail-Modal ----
   Auf schmalen Bildschirmen Modal randlos, Lightbox-Knöpfe in Reichweite. */
@media (max-width: 720px) {
    .modal { width: 96vw !important; max-height: 94vh !important; }
    .modal-body { padding: .9rem !important; }
    .detail-grid { grid-template-columns: 1fr !important; gap: .9rem !important; }
    .lb-stage { padding: 3vh 3vw; }
    .lb-img { max-width: 94vw; max-height: 80vh; border-width: 4px; }
}

/* ---- Detailansicht ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-grid .panel { margin: 0 0 1.1rem; box-shadow: none; border: 1px solid var(--ink); }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: .35rem .5rem; font-size: .9rem; border-bottom: 1px solid #e4e4e4; }
table.kv td.k { color: var(--muted); width: 38%; font-size: .85rem; }
.asset-card {
    border: 1px solid var(--ink); padding: .8rem; margin-bottom: .9rem;
}
.asset-card img {
    max-width: 100%; max-height: 60vh; object-fit: contain;
    display: block; margin: 0 auto;
}
/* PDF-Vorschau im Sterbebild-Detail: iframe-Höhe folgt dem A4-Hochformat
   (1 : √2). Damit gibt's keinen schwarzen Leerraum unter der Seite, wie ihn
   die meisten eingebauten PDF-Viewer als Default-Hintergrund zeigen.
   max-height bremst sehr hohe Modal-Breiten ein, color-scheme:light zwingt
   Browsern, die Toolbar in der hellen Variante anzuzeigen. */
.asset-card .asset-pdf {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    max-height: 80vh;
    display: block; margin: 0 0 .6rem;
    border: 1px solid var(--ink); background: #fff;
    color-scheme: light;
}
.asset-head { display: flex; align-items: center; gap: .5rem;
              margin-bottom: .5rem; font-size: .85rem; }
.asset-head .sz { margin-left: auto; color: var(--muted); }

/* ---- Galerie ---- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .85rem;
    margin: 0 5px;
}
.gallery .tile { border: 1px solid var(--ink); padding: .45rem; background: #fff; }
.gallery .tile img {
    width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block;
    filter: grayscale(100%);
}
.gallery .tile .cap {
    font-size: .75rem; margin-top: .35rem; color: var(--ink-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Login / Standalone ---- */
.login-card {
    max-width: 380px; margin: 9vh auto; background: #fff;
    border: 2px solid var(--ink);
    box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--ink);
    padding: 2.25rem;
}
.login-card h1 { text-align: center; }
.login-card .sub {
    text-align: center; color: var(--muted);
    margin: -.6rem 0 1.6rem; font-size: .85rem;
}

/* OCR-Anzeige im Detail */
.ocr-block { margin-top: 8px; }
.ocr-block summary { cursor: pointer; font-size: .85rem; color: #333; }
.ocr-text { white-space: pre-wrap; font-size: .82rem; line-height: 1.35; max-height: 260px; overflow: auto; margin-top: 6px; padding: 8px; background: #faf9f6; border: 1px solid #e3e0d8; }
.ocr-status { color: #999; margin-top: 6px; }

/* ---- Verarbeitungs-Seite (Import / Texterkennung) ---- */
.proc-step { position: relative; }
.proc-step > h2 { margin-top: 0; }
.proc-step-no {
    display: inline-block; min-width: 1.6rem; padding: 0 .35rem;
    margin-right: .5rem; text-align: center;
    background: var(--ink); color: #fff; font-size: .8rem; line-height: 1.6rem;
}
.proc-lead { color: #3a3a3a; font-size: .92rem; line-height: 1.5; margin: .3rem 0 1.1rem; }
.field-hint { font-size: .78rem; color: #666; margin-top: .25rem; line-height: 1.4; }
.proc-adv { margin: 1rem 0 .4rem; border-top: 1px solid #e3e0d8; padding-top: .6rem; }
.proc-adv > summary { cursor: pointer; font-size: .82rem; color: #555; }
.proc-actions { margin-top: 1.1rem; }
.ocr-diff { width: 100%; margin-top: 6px; font-size: .82rem; }
.ocr-diff th { text-align: left; color: #555; border-bottom: 1px solid #e3e0d8; padding: 2px 6px; }
.ocr-diff td { padding: 2px 6px; vertical-align: top; }
.ocr-diff tr.ocr-conflict { background: #f3f3f3; }
.ocr-diff tr.ocr-conflict td { font-weight: 600; border-left: 3px solid #000; }
.ocr-diff tr.ocr-fill td { color: #444; }

/* ---- CMS-Formatierungsleiste (Fett/Kursiv/Unterstr./Link) ---- */
.cms-fmt { display: flex; gap: .3rem; margin-bottom: .35rem; flex-wrap: wrap; }
.cms-fmt-btn {
    background: #f1ece3; border: 1px solid #cbbfa8; border-radius: 5px;
    padding: .25rem .55rem; min-width: 2rem; cursor: pointer; font-size: .9rem;
    line-height: 1; color: #2a2723;
}
.cms-fmt-btn:hover { background: #e6dccb; }
/* WYSIWYG-Bearbeitungsfläche (ersetzt das rohe HTML-Textarea). */
.cms-wysiwyg {
    border: 1px solid #cbbfa8; border-radius: 5px;
    min-height: 9rem; max-height: 50vh; overflow-y: auto;
    padding: .6rem .75rem; background: #fff; line-height: 1.5; color: #2a2723;
}
.cms-wysiwyg:focus { outline: 2px solid #1c64c4; outline-offset: -2px; }
.cms-wysiwyg > :first-child { margin-top: 0; }
.cms-wysiwyg h1, .cms-wysiwyg h2, .cms-wysiwyg h3 { margin: .6rem 0 .3rem; font-size: 1.1rem; font-weight: 600; }
.cms-wysiwyg p, .cms-wysiwyg div { margin: 0 0 .6rem; }
.cms-wysiwyg ul, .cms-wysiwyg ol { margin: 0 0 .6rem 1.25rem; }

/* ---- Such-Tab-Leiste (Zeitungen Vital vs. Volltext, ggf. weitere) ----
   Anschluss an Trauerstil: weißes Papier, schwarzer Trauerrand für aktiven Tab. */
.search-tabs {
    display: flex; gap: 0; margin: .5rem 0 1.25rem;
    border: 1px solid var(--line-soft); border-radius: 4px;
    background: var(--paper); overflow: hidden;
}
.search-tab {
    flex: 1; padding: .75rem 1.1rem; color: var(--ink-soft);
    text-decoration: none; display: flex; flex-direction: column; gap: .15rem;
    border-right: 1px solid var(--line-soft);
    transition: background 80ms;
}
.search-tab:last-child { border-right: 0; }
.search-tab:hover { background: var(--hover); color: var(--ink); }
.search-tab.active {
    background: var(--ink); color: #fff;
    border-right-color: var(--ink);
}
.search-tab.active + .search-tab { border-left: 0; }
.search-tab-title { font-weight: 600; font-size: 1rem; }
.search-tab-sub { font-size: .8rem; opacity: .82; }
