/* Schriften liegen lokal im Ordner assets/fonts, es werden keine Daten an Dritte gesendet. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/newsreader-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/newsreader-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #e8edea;
  --canvas: #f7f9f8;
  --surface: #ffffff;
  --ink: #18241f;
  --muted: #55655e;
  --line: #a9b9b1;
  --card-bd: #bccac3;
  --grid: #d9e2dd;
  --accent: #0e6b5b;
  --accent-ink: #ffffff;
  --hit: #c8791a;
  --danger: #b3261e;
  --shadow: rgba(24, 36, 31, .16);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b110f; --canvas: #121a17; --surface: #1b2622; --ink: #e7efeb; --muted: #9aaba3;
    --line: #3f5049; --card-bd: #35453f; --grid: #1b2723; --accent: #5ccfb6; --accent-ink: #06201a;
    --hit: #f0b24a; --danger: #ff8d84; --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}
[hidden] { display: none !important; }
.app { height: 100%; display: flex; flex-direction: column; gap: 12px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
h1 { margin: 0; font: 600 26px/1.1 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.search { position: relative; display: flex; gap: 8px; flex: 1 1 300px; min-width: 0; max-width: 560px; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: 400 15px var(--sans);
}
.search input::placeholder, .field input::placeholder { color: var(--muted); opacity: .8; }
button { font: 500 14px var(--sans); cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
.btn {
  height: 40px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary, .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover:not(:disabled), .btn[aria-pressed="true"]:hover { filter: brightness(1.08); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tools .btn { min-width: 40px; padding: 0 12px; }
:is(button, input, select, textarea, .card):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sug {
  position: absolute; z-index: 30; left: 0; right: 0; top: 46px; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px var(--shadow); max-height: 320px; overflow: auto;
}
.sug li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.sug li[aria-selected="true"], .sug li:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sug .sn { font: 600 15px var(--serif); }
.sug .sd { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sug .st { margin-left: auto; font-size: 11px; color: var(--hit); letter-spacing: .04em; text-transform: uppercase; }

.canvas {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  border: 1px solid var(--card-bd); border-radius: 12px;
  background-color: var(--canvas);
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
}
.canvas.editing { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#svg.grabbing { cursor: grabbing; }

.link { fill: none; stroke: var(--line); stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.pair { fill: none; stroke: var(--muted); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.pair.ex { stroke-dasharray: 6 5; }
.card { cursor: pointer; outline: none; }
.card .box { fill: var(--surface); stroke: var(--card-bd); stroke-width: 1.2px; }
.card:hover .box { stroke: var(--accent); }
.card.sel .box, .card:focus-visible .box { stroke: var(--accent); stroke-width: 2.6px; }
.card .ring { fill: none; stroke: var(--hit); stroke-width: 3px; opacity: 0; }
.card.pulse .ring { animation: ring 2.4s ease-out 1; }
@keyframes ring { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.nm { fill: var(--ink); font: 600 14px var(--serif); }
.dt { fill: var(--muted); font: 400 11px var(--sans); font-variant-numeric: tabular-nums; }
.jb { fill: var(--muted); font: 400 11px var(--sans); }
.live { fill: var(--accent); }

.hint {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 14px; flex-wrap: wrap;
  max-width: calc(100% - 24px); padding: 6px 10px; border-radius: 8px; pointer-events: none;
  background: color-mix(in srgb, var(--canvas) 88%, transparent); color: var(--muted); font-size: 12px;
}
.hint i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; text-align: center; pointer-events: none;
}
.empty > * { pointer-events: auto; }
.empty h2 { margin: 0; font: 600 24px/1.2 var(--serif); }
.empty p { margin: 0 0 8px; color: var(--muted); max-width: 42ch; }
.msg {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; max-width: calc(100% - 24px);
}

.panel {
  position: absolute; z-index: 10; top: 12px; right: 12px; bottom: 12px; width: min(330px, calc(100% - 24px));
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 16px 8px; }
.panel-head h2 { margin: 0; flex: 1; min-width: 0; font: 600 24px/1.15 var(--serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.x { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 6px; font-size: 20px; line-height: 1; flex: none; }
.x:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.panel-body { padding: 0 16px 16px; overflow: auto; min-height: 0; }
.life { color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 0 2px; }
.job { font-weight: 600; margin: 0 0 12px; }
.story { margin: 0 0 16px; max-width: 65ch; overflow-wrap: anywhere; white-space: pre-line; }
.rel { margin: 0 0 12px; }
.rel h3 { margin: 0 0 4px; font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rel ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.rel button { border: 0; padding: 2px 0; background: none; color: var(--accent); font: 500 14px var(--sans); text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.rel button:hover { filter: brightness(1.2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--card-bd); }
.actions .ask { flex-basis: 100%; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.actions .btn { max-width: 100%; height: auto; min-height: 34px; padding-top: 6px; padding-bottom: 6px; white-space: normal; text-align: left; line-height: 1.25; }
.rel .note { margin-left: 4px; color: var(--muted); font-size: 12px; }
fieldset.ufields { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 12px; border: 1px solid var(--card-bd); border-radius: 8px; min-width: 0; }
fieldset.ufields legend { padding: 0 6px; font: 600 12px var(--sans); letter-spacing: .04em; color: var(--muted); }
.sexpick { margin: 0; padding: 0; border: 0; min-width: 0; }
.sexpick legend { padding: 0; margin-bottom: 4px; font: 600 12px var(--sans); letter-spacing: .04em; color: var(--muted); }
.sexpick .auto { font-weight: 400; letter-spacing: 0; }
.sexpick .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.sexpick input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sexpick label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--card-bd); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 13px var(--sans); cursor: pointer; }
.sexpick label:hover { border-color: var(--accent); }
.sexpick input:checked + label { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sexpick input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.modal {
  position: fixed; inset: 0; z-index: 100; display: flex; overflow: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}
#login { background: var(--bg); }
.sheet {
  margin: auto; width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 48px var(--shadow);
}
.sheet.wide { width: min(620px, 100%); }
.sheet h2 { margin: 0; font: 600 24px/1.15 var(--serif); letter-spacing: -.01em; }
.sheet-head { display: flex; align-items: flex-start; gap: 8px; }
.sheet-head h2 { flex: 1; min-width: 0; }
.sheet .ctx { margin: -6px 0 0; color: var(--muted); }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 4px; font: 600 12px var(--sans); letter-spacing: .04em; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--canvas); color: var(--ink); font: 400 15px/1.4 var(--sans);
}
.field textarea { resize: vertical; min-height: 92px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { margin: 0; color: var(--danger); font-size: 13px; }
.sheet .actions { margin-top: 0; padding-top: 14px; }

.dbody { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dsec { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--card-bd); min-width: 0; }
.dsec:first-child { padding-top: 0; border-top: 0; }
.dsec h3 { margin: 0; font: 600 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dsec p { margin: 0; }
.who { color: var(--muted); }
.ulist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ulist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--card-bd); border-radius: 8px; min-width: 0; }
.ulist .un { font-weight: 600; overflow-wrap: anywhere; }
.ulist .ur { color: var(--muted); font-size: 12px; }
.ulist .ua { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.ulist .inline { flex-basis: 100%; display: flex; gap: 8px; }
.ulist .inline input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--ink); font: 400 14px var(--sans); }
.okmsg { margin: 0; color: var(--accent); font-size: 13px; }
.logwrap { max-height: 280px; overflow: auto; border: 1px solid var(--card-bd); border-radius: 8px; }
.logt { width: 100%; border-collapse: collapse; font-size: 13px; }
.logt th, .logt td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--card-bd); vertical-align: top; }
.logt th { position: sticky; top: 0; background: var(--surface); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.logt td.t { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }

@media (max-width: 759px) {
  h1 { font-size: 22px; }
  .tools { margin-left: 0; }
  .search { max-width: none; flex-basis: 100%; order: 3; }
  .panel { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 48%; }
  .canvas.has-panel .hint { display: none; }
  .row2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .card.pulse .ring { animation: none; opacity: 1; }
}

/* Erweiterte Angaben, Foto, Fakten */
.artbox { display: flex; flex-direction: column; gap: 10px; }
.artbox:empty { display: none; }
details.more { border: 1px solid var(--card-bd); border-radius: 8px; padding: 0; min-width: 0; }
details.more summary { cursor: pointer; padding: 9px 12px; font: 600 12px var(--sans); letter-spacing: .04em; color: var(--muted); }
details.more[open] summary { border-bottom: 1px solid var(--card-bd); }
.morebody { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.pphoto { display: block; width: 100%; max-width: 200px; max-height: 240px; object-fit: cover; margin: 0 0 12px; border-radius: 10px; border: 1px solid var(--card-bd); background: var(--canvas); }
.facts { margin: 0 0 12px; display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.views { display: inline-flex; gap: 0; }
.views .btn { border-radius: 0; margin-left: -1px; }
.views .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.views .btn:last-child { border-radius: 0 8px 8px 0; }
.link.nb { stroke-dasharray: 3 4; }

/* Listenansicht */
.listview { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--canvas); }
.listbar { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--card-bd); }
.listbar input { flex: 1; min-width: 0; max-width: 420px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 400 14px var(--sans); }
.listbar .count { color: var(--muted); font-size: 13px; }
.listwrap { flex: 1; min-height: 0; overflow: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable th { position: sticky; top: 0; z-index: 1; padding: 0; text-align: left; background: var(--surface); border-bottom: 1px solid var(--line); }
.ptable th button { width: 100%; padding: 10px 12px; border: 0; background: none; color: var(--muted); font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.ptable th button:hover { color: var(--ink); }
.ptable th[aria-sort] button { color: var(--accent); }
.ptable td { padding: 8px 12px; border-bottom: 1px solid var(--card-bd); vertical-align: top; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:hover, .ptable tbody tr:focus-visible { background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
.ptable td.nm2 { font: 600 14px var(--serif); }
.ptable td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 700px) { .ptable .hide-s { display: none; } }
.vrow { margin: 4px 0 12px; }
.avbg { fill: var(--canvas); }
.avring { fill: none; stroke: var(--card-bd); stroke-width: 1px; }
.rfields { display: flex; flex-direction: column; gap: 12px; }
.rfields .ctx { margin: 0; }
.ctx.small { font-size: 12px; }
.okmsg { margin: 0; color: var(--accent); font-weight: 600; }
.reqitem { padding: 10px 12px; border: 1px solid var(--card-bd); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reqitem .rh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.reqitem .rn { font-weight: 600; overflow-wrap: anywhere; }
.reqitem .rm, .reqitem .rt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.reqitem .rb { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

.reqitem .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.reqitem .sendbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reqitem .sendbox input, .reqitem .sendbox select { flex: 1 1 140px; min-width: 0; }
.reqitem .actions { border-top: 0; padding-top: 0; }

.ulist .upw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--card-bd); padding: 2px 6px; border-radius: 4px; user-select: all; overflow-wrap: anywhere; }

.reqitem .mlink { font-size: 13px; color: var(--accent, #0b6b5a); text-decoration: underline; cursor: pointer; }
