:root {
  --bg: #f3f2ef;
  --panel: #ffffff;
  --line: #e2e0da;
  --text: #22252a;
  --muted: #6b6f76;
  --accent: #2f7d5b;
  --accent-2: #e8f3ee;
  --male: #4aa8c8;
  --male-bg: #e6f4f9;
  --female: #e07a86;
  --female-bg: #fcecee;
  --unk: #9aa0a6;
  --unk-bg: #f1f2f3;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --panel: #212428; --line: #33373d; --text: #e7e8ea; --muted: #9aa0a8;
    --accent: #5cc193; --accent-2: #1f332b;
    --male-bg: #1b2d35; --female-bg: #36222a; --unk-bg: #2a2d31;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* Kopfzeile */
.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 18px; color: var(--accent); }
.brand span { color: var(--text); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.tabs button.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.status.err { color: var(--danger); font-weight: 600; }
.status.ok::before { content: "● "; color: var(--accent); }

main { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; }
.view.active { display: flex; }
.view.col.active { flex-direction: column; }
body.ro .rw { display: none !important; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--panel); padding: 7px 13px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 3px 4px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btnrow.end { justify-content: flex-end; }

/* Liste */
.list-pane { width: 340px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.list-tools { display: flex; gap: 8px; padding: 12px; }
.list-tools input { flex: 1; min-width: 0; }
input[type=search], input[type=text], input[type=password], select, textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; outline: none; width: 100%;
}
select { width: auto; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.list-count { padding: 0 14px 6px; font-size: 12px; color: var(--muted); }
.person-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.person-list li {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer;
}
.person-list li:hover { background: var(--bg); }
.person-list li.sel { background: var(--accent-2); }
.person-list li .nm { font-weight: 550; }
.person-list li .yr { font-size: 12.5px; color: var(--muted); }
.person-list li.new { color: var(--accent); font-weight: 600; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center; font-weight: 650; font-size: 14px; color: #fff; background: var(--unk);
}
.avatar.M { background: var(--male); }
.avatar.F { background: var(--female); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 96px; height: 96px; font-size: 32px; }

/* Detail */
.detail-pane { flex: 1; overflow-y: auto; padding: 20px; min-width: 0; }
.detail-pane .empty { color: var(--muted); text-align: center; margin-top: 15vh; }
.person-head { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.person-head h1 { margin: 0; font-size: 24px; }
.person-head .sub { color: var(--muted); }
.person-head .photo-tools { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.back-btn { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card.danger h2 { color: var(--danger); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select { color: var(--text); font-size: 15px; width: 100%; }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-top: 8px; }
textarea { min-height: 80px; resize: vertical; }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rel-block h3 { margin-top: 0; }
.rel { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 6px; cursor: pointer; background: var(--bg); }
.rel:hover { border-color: var(--accent); }
.rel .avatar { width: 32px; height: 32px; font-size: 12px; }
.rel .info { flex: 1; min-width: 0; }
.rel .info .nm { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel .info .yr { font-size: 12px; color: var(--muted); }
.rel .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 17px; padding: 2px 6px; border-radius: 6px; }
.rel .x:hover { color: var(--danger); background: var(--panel); }
.fam-box { border-left: 3px solid var(--line); padding-left: 10px; margin-bottom: 10px; }
.fam-box .fam-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.fam-box .fam-meta input { width: 130px; padding: 3px 6px; font-size: 12.5px; }
.add-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Toolbar + Canvas */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 12px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }
.canvas { flex: 1; overflow: auto; position: relative; -webkit-overflow-scrolling: touch; cursor: grab; }
.canvas.dragging { cursor: grabbing; }
.tree-inner { position: relative; transform-origin: 0 0; }
.tree-inner svg.lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.tree-inner svg.lines path { fill: none; stroke: var(--muted); stroke-opacity: .55; stroke-width: 1.4; }

.node {
  position: absolute; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  border-radius: 999px; border: 1.5px solid var(--unk); background: var(--panel); cursor: pointer;
  box-shadow: var(--shadow); user-select: none;
}
.node.M { border-color: var(--male); }
.node.F { border-color: var(--female); }
.node.focus { background: var(--accent-2); border-width: 2.5px; }
.node .avatar { width: 34px; height: 34px; font-size: 12px; }
.node .info { min-width: 0; }
.node .nm { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .yr { font-size: 12px; color: var(--muted); }
.node.placeholder { border-style: dashed; box-shadow: none; background: transparent; color: var(--muted); justify-content: center; font-size: 13px; padding: 6px 12px; }
.node.placeholder:hover { color: var(--accent); border-color: var(--accent); }
.node .more { position: absolute; right: -14px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-size: 12px; display: grid; place-items: center; color: var(--muted); }

.fan svg { display: block; margin: 0 auto; }
.fan .seg-path { stroke: var(--panel); stroke-width: 1.5; cursor: pointer; }
.fan .seg-path:hover { filter: brightness(.93); }
.fan text { fill: var(--text); font-size: 11px; pointer-events: none; }
.fan .center-name { font-weight: 650; font-size: 14px; }

/* Daten-Seite */
.data-page { padding: 20px; max-width: 860px; margin: 0 auto; overflow-y: auto; width: 100%; }
.hint { color: var(--muted); font-size: 14px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px 14px; }
.stats b { display: block; font-size: 20px; }
.backup-list { max-height: 220px; overflow: auto; font-size: 13px; margin-top: 10px; }
.backup-list div { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; }

/* Dialoge */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.overlay[hidden] { display: none; }
.dialog { background: var(--panel); border-radius: 16px; padding: 20px; width: min(520px, 100%); max-height: 85vh; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.dialog.small { width: min(360px, 100%); }
.dialog h2 { margin: 0; font-size: 18px; }
.picker-list { max-height: 50vh; min-height: 120px; padding: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); }

/* Mobil */

/* Diagramme */
.sizer { position: relative; }
.canvas .empty { color: var(--muted); text-align: center; margin-top: 15vh; }
.tree-inner svg.lines path.partner { stroke-width: 2.6; stroke-opacity: .9; }
.tree-inner svg.lines path.child { stroke-width: 1.8; stroke-opacity: .75; }
.tree-inner svg.lines path.sep, .tree-inner svg.lines path.adopt { stroke-dasharray: 6 5; }
.tree-inner svg.lines path.ph { stroke-dasharray: 3 4; stroke-opacity: .35; }
.tree-inner svg.lines path.dim { stroke-opacity: .08; }
.tree-inner svg.lines path.hl { stroke-opacity: 1; stroke-width: 3.4; }
.tree-inner svg.lines .fam-dot { stroke: var(--panel); stroke-width: 1.5; }
.node { transition: opacity .15s; }
.node.dim { opacity: .18; }
.node.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.node.root .nm::after { content: " ★"; color: #d4a017; }
.node .badge { position: absolute; top: -9px; right: 14px; background: #d4a017; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.node .more { cursor: pointer; right: -12px; font-weight: 600; }
.node .more:hover { color: var(--accent); border-color: var(--accent); }

.info-bar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); width: min(640px, calc(100% - 24px));
}
.info-bar[hidden] { display: none; }
.info-bar .info { flex: 1; min-width: 0; }
.info-bar .nm { font-weight: 650; }
.info-bar .yr { font-size: 13px; color: var(--muted); }
.info-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 20px; padding: 2px 8px; border-radius: 8px; line-height: 1; }
.x:hover { color: var(--danger); background: var(--bg); }
.path-bar {
  position: absolute; left: 12px; right: 12px; top: 64px; z-index: 15; max-width: 720px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.15);
  display: flex; gap: 8px; align-items: flex-start; max-height: 45vh; overflow: auto;
}
.path-bar[hidden] { display: none; }
#view-net { position: relative; }

/* Personenkopf */
.person-head .head-main { flex: 1; min-width: 0; }
.rel-line { color: var(--accent); font-weight: 600; font-size: 14px; margin-top: 4px; }
.head-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.person-head .avatar.big { cursor: pointer; }
.hint.small, .small { font-size: 12.5px; }
select.mini { padding: 3px 6px; font-size: 12.5px; border-radius: 7px; }
.mini-row { font-size: 12.5px; color: var(--muted); margin: -2px 0 8px 4px; display: flex; gap: 6px; align-items: center; }
.rel-block.wide { grid-column: 1 / -1; }
.kids { margin-left: 18px; margin-top: 6px; }
.kids .btn { margin-bottom: 6px; }

/* Lebenslauf */
.timeline { margin: 12px 0 6px; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 12px; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-top: 26px; flex-shrink: 0; border: 3px solid var(--accent-2); }
.tl-body { flex: 1; min-width: 0; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.tl-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.tl-body input, .tl-body textarea { background: var(--panel); }
.tl-body textarea { min-height: 44px; }

/* Medien */
.upload-row { align-items: center; margin-bottom: 6px; }
.upload-row select { width: auto; }
.upload-row .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-tile { display: flex; flex-direction: column; gap: 5px; }
.media-tile input, .media-tile select { font-size: 12.5px; padding: 4px 7px; width: 100%; }
.media-thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); cursor: zoom-in; display: grid; place-items: center; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-icon { font-size: 26px; font-weight: 800; color: var(--danger); letter-spacing: .05em; }
.media-cat { font-size: 12px; color: var(--muted); }
.media-title { font-size: 13px; }

/* Verbindungen */
.rel-list { margin: 6px 0 10px; padding-left: 20px; }
.rel-list li { margin-bottom: 4px; }
.chain { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 4px; font-size: 14px; }
.chain-person { background: var(--accent-2); color: var(--accent); padding: 2px 9px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.chain-step { color: var(--muted); font-size: 13px; }

/* Zuschneiden & Bildansicht */
.crop-view { position: relative; width: min(300px, 75vw); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #000; touch-action: none; cursor: move; }
.crop-view img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.8); pointer-events: none; }
#cropZoom { width: 100%; accent-color: var(--accent); }
.overlay.dark { background: rgba(0,0,0,.88); }
.viewer { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.viewer img { max-width: 100%; max-height: calc(100% - 70px); object-fit: contain; border-radius: 6px; }
.viewer-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; background: var(--panel); padding: 8px 12px; border-radius: 12px; }
.viewer-title { font-size: 14px; margin-right: 6px; }

@media (max-width: 760px) {
  .tl-row { grid-template-columns: 1fr 1fr; }
  .info-bar { flex-wrap: wrap; bottom: 8px; }
  .info-btns { width: 100%; justify-content: flex-start; }
  .path-bar { top: 110px; }
  .top { gap: 8px; padding: 8px 10px; }
  .brand { font-size: 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  .list-pane { width: 100%; border-right: 0; }
  #view-persons.detail-open .list-pane { display: none; }
  #view-persons:not(.detail-open) .detail-pane { display: none; }
  .detail-pane { padding: 12px; }
  .back-btn { display: inline-flex; margin-bottom: 10px; }
  .person-head { flex-direction: column; text-align: center; }
  .avatar.big { width: 84px; height: 84px; }
  .data-page { padding: 12px; }
}
@media print {
  .top, .toolbar { display: none; }
  .canvas { overflow: visible; }
}

/* ================= Drucken ================= */
.print-side { width: 320px; flex-shrink: 0; overflow-y: auto; padding: 16px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.print-side h2 { margin: 0; font-size: 18px; }
.print-side .field .btn { justify-content: space-between; color: var(--text); }
.btn.big { padding: 11px 16px; font-weight: 600; justify-content: center; }
.print-preview { flex: 1; overflow: auto; padding: 16px; background: #8a8f96; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.page-wrap { position: relative; flex-shrink: 0; box-shadow: 0 4px 24px rgba(0,0,0,.35); }
.page { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; display: flex; flex-direction: column;
  padding: 16mm 16mm 10mm; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.page .frame { position: absolute; inset: 7mm; border: 3px double; pointer-events: none; }
.page .frame.thin { border: 1px solid #000; }
.page .corner { position: absolute; width: 16mm; height: 16mm; }
.page .corner.tl { left: 5mm; top: 5mm; }
.page .corner.tr { right: 5mm; top: 5mm; transform: scaleX(-1); }
.page .corner.bl { left: 5mm; bottom: 5mm; transform: scaleY(-1); }
.page .corner.br { right: 5mm; bottom: 5mm; transform: scale(-1, -1); }
.p-head { text-align: center; margin-bottom: 4mm; position: relative; }
.p-head h1 { margin: 0; font-size: 13mm; font-weight: 400; letter-spacing: .02em; line-height: 1.15; }
.page.poster .p-head h1 { font-size: 11mm; }
.p-sub { font-style: italic; font-size: 6mm; margin-top: 1mm; }
.ornament { display: block; width: 70mm; height: 5mm; margin: 2mm auto 0; }
.p-chart { flex: 1; min-height: 0; position: relative; }
.p-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.p-foot { display: flex; justify-content: space-between; font-size: 3.2mm; font-style: italic; margin-top: 3mm; position: relative; }

/* Familienbuch */
.page.book { padding: 20mm 20mm 12mm; }
.b-body { flex: 1; min-height: 0; overflow: hidden; position: relative; font-size: 4mm; line-height: 1.45; }
.b-top { display: flex; gap: 8mm; align-items: center; margin-bottom: 6mm; }
.b-photo { width: 42mm; height: 52mm; flex-shrink: 0; border: 1.2mm solid; border-radius: 3mm; overflow: hidden; background: #fff; box-shadow: 0 1mm 3mm rgba(0,0,0,.15); }
.b-photo img { width: 100%; height: 100%; object-fit: cover; }
.b-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 3.2mm; }
.b-title h2 { margin: 1mm 0; font-size: 10mm; font-weight: 400; line-height: 1.1; }
.b-sub { font-style: italic; }
.b-years { font-size: 5mm; margin-top: 1mm; }
.b-facts { border-collapse: collapse; width: 100%; margin-bottom: 4mm; }
.b-facts th { text-align: left; font-weight: 600; width: 32mm; vertical-align: top; padding: 1.2mm 4mm 1.2mm 0; }
.b-facts td { padding: 1.2mm 0; border-bottom: 0.2mm solid rgba(0,0,0,.12); }
.b-body h3 { font-size: 5mm; font-weight: 400; font-style: italic; margin: 5mm 0 2mm; border-bottom: 0.3mm solid currentColor; padding-bottom: 1mm; }
.b-life { list-style: none; padding: 0; margin: 0; }
.b-life li { display: grid; grid-template-columns: 30mm 1fr; gap: 3mm; padding: 0.8mm 0; }
.b-notes { white-space: pre-wrap; }
.b-pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.b-pics figure { margin: 0; }
.b-pics img { width: 100%; height: 38mm; object-fit: cover; border-radius: 1.5mm; }
.b-pics figcaption { font-size: 3mm; margin-top: 1mm; }
.cover-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4mm; position: relative; }
.cover-kicker { text-transform: uppercase; letter-spacing: .3em; font-size: 4.5mm; }
.cover-in h1 { font-size: 16mm; font-weight: 400; margin: 0; line-height: 1.1; }
.cover-sub { font-style: italic; font-size: 6mm; }
.cover-photo { width: 70mm; height: 70mm; border-radius: 50%; overflow: hidden; border: 1.5mm solid; margin: 8mm 0 4mm; }
.cover-photo img { width: 100%; height: 100%; object-fit: cover; }
.cover-name { font-size: 7mm; }
.cover-date { font-size: 4.5mm; margin-top: 10mm; }
.toc-h { font-size: 10mm; font-weight: 400; text-align: center; margin: 0 0 6mm; }
.toc { list-style: none; padding: 0; margin: 0; }
.toc.cols { columns: 2; column-gap: 10mm; font-size: 3.4mm; }
.toc li { display: flex; gap: 3mm; padding: 0.7mm 0; break-inside: avoid; border-bottom: 0.2mm dotted rgba(0,0,0,.2); }
.toc-nr { width: 9mm; text-align: right; flex-shrink: 0; }
.toc-name { flex: 1; }

@media (max-width: 760px) {
  #view-print.active { flex-direction: column; }
  .print-side { width: 100%; border-right: 0; max-height: 45vh; }
}
#printRoot { display: none; }
.tile-head, .tile-foot { display: flex; justify-content: space-between; gap: 6mm; font-size: 3.4mm; position: relative; }
.tile-head { margin-bottom: 2mm; font-size: 4mm; }
.tile-foot { margin-top: 2mm; font-style: italic; }
.page.tile { padding: 12mm 14mm 9mm; }
@media print {
  html, body { height: auto !important; display: block !important; background: #fff !important; margin: 0 !important; }
  body.printing > *:not(#printRoot) { display: none !important; }
  body.printing #printRoot { display: block !important; }
  #printRoot .page { position: relative !important; transform: none !important; margin: 0; break-after: page; page-break-after: always; box-shadow: none; }
  #printRoot .page:last-child { break-after: auto; page-break-after: auto; }
  /* Fallback, falls direkt über das Browser-Menü gedruckt wird */
  body:not(.printing) .top, body:not(.printing) .print-side, body:not(.printing) #infoBar, body:not(.printing) .toast, body:not(.printing) .overlay, body:not(.printing) .view:not(#view-print) { display: none !important; }
  body:not(.printing) main, body:not(.printing) #view-print, body:not(.printing) .print-preview { display: block !important; overflow: visible !important; padding: 0 !important; background: none !important; height: auto !important; }
  body:not(.printing) .page-wrap { width: auto !important; height: auto !important; box-shadow: none !important; break-after: page; page-break-after: always; }
  body:not(.printing) .page { position: relative !important; transform: none !important; }
}

/* ================= Anmeldung ================= */
.auth-overlay { background: linear-gradient(160deg, #e8f3ee, #f3f2ef 60%); }
@media (prefers-color-scheme: dark) { .auth-overlay { background: linear-gradient(160deg, #1f332b, #17191c 60%); } }
.dialog.auth { gap: 0; }
.auth form { display: flex; flex-direction: column; gap: 10px; }
.auth h2 { margin: 6px 0 2px; }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--accent); font-size: 17px; }
.auth-logo { font-size: 24px; }
.auth-msg { margin: 0; font-size: 14px; min-height: 0; }
.auth-msg:empty { display: none; }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: var(--accent); }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.auth textarea { min-height: 50px; }

/* ================= Verwaltung ================= */
.user-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.user-row.disabled { opacity: .55; }
.u-main { flex: 1; min-width: 220px; }
.u-note { font-style: italic; margin: 3px 0; }
.u-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.u-actions select { padding: 4px 8px; font-size: 13px; }
.pending { background: color-mix(in srgb, #d4a017 12%, var(--panel)); border-radius: 10px; padding: 4px 12px; margin-bottom: 10px; }
.pending-row:last-child { border-bottom: 0; }
.link-box { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.link-box input { flex: 1; min-width: 200px; font-size: 12.5px; padding: 5px 8px; }
.link-box .hint { width: 100%; }
.btnrow .sep { width: 1px; background: var(--line); margin: 0 4px; }
.btnrow input[type=email] { width: auto; flex: 0 1 240px; }

/* ================= Doppelte ================= */
.badge-count { background: #d4a017; color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
.dup-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-height: 70vh; overflow: auto; }
.dup-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.dup-row.sure { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dup-score { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dup-row.sure .dup-score { color: var(--accent); }
.dup-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dup-person { display: flex; gap: 10px; background: var(--bg); border-radius: 10px; padding: 8px; cursor: pointer; min-width: 0; }
.dup-person .nm { font-weight: 600; }
.dup-person .yr { font-size: 12.5px; color: var(--muted); }
.dup-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 760px) { .dup-pair { grid-template-columns: 1fr; } }
