/* LANJUS – Designsystem: Archivpapier, Tinte, Neufile Grotesk (Hausschrift der Sammlung Renner-Lanjus).
   Ruhig, klar, eine Hauptaktion je Bildschirm; die Kunstwerke tragen die Farbe. */
@font-face { font-family: "Neufile Grotesk"; src: url("/fonts/Neufile-Grotesk-Regular-Extended.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Neufile Grotesk"; src: url("/fonts/Neufile-Grotesk-Bold-Extended.otf") format("opentype"); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Neufile Grotesk"; src: url("/fonts/Neufile-Grotesk-Light-Extended-Italic.otf") format("opentype"); font-weight: 300 400; font-style: italic; font-display: swap; }
:root {
  --bg: #f4f2ed; --surface: #ffffff; --ink: #1d1d1b; --muted: #6f6b64; --faint: #7d786f; --line: #e4e0d7; --hover: #efece5;
  --accent: #1d1d1b; --accent-ink: #ffffff; --accent-soft: #ebe7de;
  --ai: #6b4fa0; --ai-soft: #f3effa; --warn: #9a6200; --warn-soft: #faf2e1; --ok: #2f6f4a; --ok-soft: #e7f1ea; --bad: #b3261e; --bad-soft: #fbe9e7;
  --on-dark: #f2f2f2; --cam-bg: #0f0f0e; --cam-glass: rgba(30, 30, 28, .55); --cam-mark: #f4d35e;
  --r: 6px; --r-sm: 4px; --shadow: 0 10px 30px rgba(29, 29, 27, .12);
  --font: "Neufile Grotesk", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink);
  font-feature-settings: "kern" 1; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .faint { color: var(--faint); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; margin-top: 16px; } .row.center { justify-content: center; }
.grow { flex: 1; } .warn-text { color: var(--warn); }

/* ---------- App-Leiste ---------- */
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; letter-spacing: .2px; }
#nav { display: flex; gap: 2px; }
#nav a { color: var(--muted); padding: 7px 12px; border-radius: var(--r-sm); text-decoration: none; font-weight: 500; }
#nav a:hover { background: var(--hover); color: var(--ink); }
#nav a.active { color: var(--ink); background: var(--hover); }
#nav a .count { font-size: 12px; color: var(--accent); margin-left: 4px; }
.activity { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.activity .spin { width: 10px; height: 10px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
main { padding: 20px; }

/* ---------- Bausteine ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 20px 24px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 16px; } h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 20px 0 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px;
  border-radius: var(--r-sm); cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 550; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 11px 22px; font-size: 15.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px 9px; }
.btn.danger { color: var(--bad); }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link:hover { text-decoration: underline; }
.link.muted { color: var(--muted); }
kbd { font-family: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .07); }
.btn.primary kbd { background: rgba(255, 255, 255, .2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field { margin-top: 14px; }
.field > label, .flabel { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.ai { background: var(--ai-soft); color: var(--ai); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button:hover { color: var(--ink); } .tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--hover); padding: 3px; border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: 80vw; font-size: 14px; }
.toast.error { background: var(--bad); }
dialog { border: none; border-radius: 14px; padding: 0; box-shadow: var(--shadow); max-width: 560px; width: 92vw; }
dialog form { padding: 24px; } dialog::backdrop { background: rgba(20, 20, 30, .35); }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 50; min-width: 260px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--hover); } .menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--hover); } tr.current { background: var(--accent-soft); }
.bar { height: 6px; background: var(--hover); border-radius: 3px; overflow: hidden; min-width: 100px; }
.bar > div { height: 100%; background: var(--accent); } .bar.full > div { background: var(--warn); }
.mini { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--hover); }
pre.log { max-height: 320px; overflow: auto; background: var(--hover); padding: 10px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; } .kpi .v { font-size: 24px; font-weight: 600; } .kpi .l { color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.page { max-width: 1100px; margin: 0 auto; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; }

/* ---------- Inventarisieren ---------- */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 20px; height: calc(100vh - 56px - 40px); }
.viewer { position: relative; background: #2b2d31; border-radius: var(--r); overflow: hidden; min-height: 0; }
.viewer .stage { position: absolute; inset: 0; overflow: hidden; cursor: grab; }
.viewer img.main { position: absolute; left: 0; top: 0; max-width: 100%; max-height: 100%; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.viewer .msg { position: absolute; inset: 0; display: grid; place-items: center; color: #c9c9cc; }
.floatbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px;
  background: rgba(30, 31, 34, .82); border-radius: 12px; backdrop-filter: blur(6px); z-index: 5; }
.floatbar button, .floatbar a { border: 0; background: none; color: #f2f2f2; padding: 7px 11px; border-radius: 8px; cursor: pointer; font-size: 13.5px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.floatbar button:hover, .floatbar a:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.floatbar .sep { width: 1px; background: rgba(255, 255, 255, .15); margin: 6px 4px; }
.banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 10px; align-items: center;
  background: var(--warn-soft); color: var(--warn); padding: 8px 10px 8px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; }
.banner .btn { padding: 4px 12px; font-size: 13px; }
.thumbstrip { display: none; position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.thumbstrip button { width: 54px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: #444; position: relative; }
.thumbstrip button.on { border-color: #fff; } .thumbstrip img { width: 100%; height: 100%; object-fit: cover; }
.thumbstrip span { position: absolute; bottom: 0; left: 0; right: 0; font-size: 9.5px; background: rgba(0, 0, 0, .6); color: #fff; }
.side { display: flex; flex-direction: column; min-height: 0; }
.side .head { padding: 18px 24px 0; }
.progressline { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.progressline .bar { flex: 1; height: 4px; }
.worktitle { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.worktitle .no { font-size: 20px; font-weight: 600; }
.worktitle .no.draft { color: var(--muted); font-weight: 500; font-size: 16px; }
.ailine { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; min-height: 20px; }
.ailine .dotpulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ai); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.side .body { flex: 1; overflow-y: auto; padding: 4px 24px 20px; }
.side .foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; position: relative; }
.f { margin-top: 16px; }
.f .flabel { justify-content: space-between; }
.f .flabel .acts { display: flex; gap: 10px; align-items: center; opacity: 0; transition: opacity .12s; }
.f:hover .flabel .acts, .f:focus-within .flabel .acts { opacity: 1; }
.f .flabel .acts button { background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.f .flabel .acts button:hover { color: var(--accent); }
.f .flabel .acts button.on { color: var(--accent); opacity: 1; }
.tag-ai { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--ai); display: inline-flex; gap: 4px; align-items: center; opacity: 1 !important; }
.tag-ai button { border: 0; background: none; color: var(--ai); cursor: pointer; padding: 0 2px; font-size: 12px; }
.f.from-ai input, .f.from-ai textarea, .f.from-ai select { border-color: #ddd3ee; background: #fcfbfe; }
.unknown { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--r-sm); color: var(--muted); font-style: italic; }
.suggest { font-size: 13px; color: var(--ai); margin-top: 5px; }
.suggest button { margin-left: 6px; }
.inline2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.yearrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.saved { font-size: 12px; color: var(--faint); }

.side .foot .btn.primary { flex: 1 1 auto; justify-content: center; min-width: 0; }
@media (max-width: 1600px) { .side .foot .btn.primary kbd { display: none; } }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; padding: 4px 0; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.banner-inline { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: var(--r-sm); }
.activity a.pill { text-decoration: none; }
.dategrid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.side { overflow: hidden; }
.side .tabs { margin-top: 10px; }
.f.is-unknown .flabel .acts, .f .flabel .acts:has(.on) { opacity: 1; }
.sugslot:empty { display: none; }
.viewer .stage img.main { max-width: none; max-height: none; }
.stickybar .btn.big { min-width: 260px; justify-content: center; }
.btn.primary:disabled { background: var(--accent); filter: none; }
.list p { padding: 0 12px; }

/* Werkgalerie (alle Aufnahmen eines Werks) */
.gstrip { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; align-items: flex-end; overflow-x: auto; z-index: 5; padding-bottom: 2px; }
.gstrip .gi { position: relative; flex: none; width: 76px; height: 76px; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; cursor: pointer; background: #3a3c40; }
.gstrip .gi.on { border-color: #fff; }
.gstrip .gi img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gstrip .gi .gl { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; padding: 2px 4px; background: rgba(0, 0, 0, .62); color: #fff; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gstrip .gi .gmenu { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 6px; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; font-size: 14px; }
.gstrip .gi.hid { opacity: .55; }
.gstrip .gmore { flex: none; height: 32px; border: 0; border-radius: 8px; background: rgba(30, 31, 34, .82); color: #eee; padding: 0 10px; cursor: pointer; font-size: 12.5px; }
.viewer .floatbar { bottom: 100px; }
.viewer:has(.gstrip.hidden) .floatbar, .viewer:has(.gstrip:empty) .floatbar { bottom: 16px; }
/* Aufnahme-Kontext */
.ctx { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.ctxbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--ink); }
.ctxbtn:hover { background: var(--hover); }
.ctxwatch { color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.ctxwatch::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.ctxwatch.on::before { background: var(--ok); } .ctxwatch.bad { color: var(--bad); } .ctxwatch.bad::before { background: var(--bad); }
.side .worktitle .no { font-size: 26px; letter-spacing: .3px; }
.recent { display: flex; gap: 6px; align-items: center; padding: 8px 24px; border-top: 1px solid var(--line); }
.recent .rc { position: relative; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; cursor: pointer; background: var(--hover); }
.recent .rc img { width: 100%; height: 100%; object-fit: cover; }
.recent .rc span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; background: rgba(255, 255, 255, .85); color: var(--ink); }
.recent .rc .dotpulse { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--ai); animation: pulse 1.2s ease-in-out infinite; }
.appbar .brand { border: 0; background: none; font: inherit; font-weight: 650; cursor: pointer; padding: 6px 10px; border-radius: var(--r-sm); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .brand:hover { background: var(--hover); }
.menu button .muted { font-size: 12px; }

/* Zuschnitt-Editor */
.editor { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.editor-inner { position: relative; }
.editor-inner img { display: block; max-width: 100%; max-height: 100%; user-select: none; -webkit-user-drag: none; }
.editor-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.editor-inner polygon { fill: rgba(80, 150, 230, .10); stroke: #5fa8ff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.handle { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; border: 3px solid #2f7de1; cursor: move; touch-action: none; transform: scale(var(--hs, 1)); }
.modal-editor { position: fixed; inset: 0; background: #1f2023; z-index: 60; }

/* Forschung */
.stmt { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; }
.stmt .t { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stmt .t.observation { color: var(--ok); } .stmt .t.interpretation { color: var(--accent); } .stmt .t.hypothesis { color: var(--warn); } .stmt .t.question { color: var(--muted); }
.stmt.accepted { border-color: #cfe5d7; background: #f7fbf8; } .stmt.rejected { opacity: .5; }
.stmt .acts { margin-top: 6px; display: flex; gap: 12px; }
.simlist { display: flex; gap: 10px; flex-wrap: wrap; }
.sim { width: 86px; font-size: 12px; color: var(--ink); text-decoration: none; }
.sim img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; background: var(--hover); display: block; }
.sigcrop { width: 100%; max-width: 360px; border: 1px solid var(--line); border-radius: 8px; background-repeat: no-repeat; background-color: #fff; }

/* ---------- Bildprüfung / Werke ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar > input, .toolbar > select { width: auto; }
.toolbar input[type=search] { min-width: 280px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--surface); border: 2px solid transparent; border-radius: var(--r); overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.tile:hover { border-color: var(--line); }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile .img { aspect-ratio: 3/4; background: #ece9e3; display: grid; place-items: center; }
.tile .img img { max-width: 100%; max-height: 100%; }
.tile .cap { padding: 7px 9px; font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; color: var(--muted); }
.tile .check { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .9); border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; }
.tile.sel .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile .flag { position: absolute; top: 8px; right: 8px; }
.tile .hover { position: absolute; left: 8px; right: 8px; bottom: 40px; display: flex; gap: 4px; justify-content: center; opacity: 0; transition: opacity .12s; }
.tile:hover .hover { opacity: 1; }
.tile .hover button { border: 0; border-radius: 7px; background: rgba(30, 31, 34, .82); color: #fff; padding: 5px 9px; cursor: pointer; font-size: 12.5px; }
.tile .busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .6); font-size: 13px; color: var(--muted); }
.stickybar { position: sticky; bottom: 0; margin-top: 16px; padding: 12px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; position: relative; }
.card:hover { border-color: #cfccc5; } .card.selected { outline: 3px solid var(--accent); }
.card .img { aspect-ratio: 1; background: #ece9e3; display: grid; place-items: center; }
.card .img img { max-width: 100%; max-height: 100%; }
.card .meta { padding: 10px 12px; font-size: 13px; }
.card .meta b { display: block; font-size: 14px; font-weight: 600; }
.card .sel { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
table.worklist td { padding: 6px 10px; } table.worklist td:nth-child(3), table.worklist td:nth-child(9), table.worklist td:nth-child(10) { white-space: nowrap; }
table.worklist .badge, table.worklist .pill { white-space: nowrap; } table.worklist .mini { width: 40px; height: 40px; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--ink); } th.sortable.on { color: var(--accent); }
th.sortable.on::after { content: " ▾"; }
.batchbar input, .batchbar select { width: 180px; }

/* Einlagern */
.boxbig { border: 1px solid var(--line); border-radius: var(--r); padding: 20px; text-align: center; margin-bottom: 14px; background: var(--accent-soft); }
.boxbig.full { background: var(--warn-soft); }
.boxbig .code { font-size: 26px; font-weight: 650; } .boxbig .pos { font-size: 22px; }
.boxbig .bar { margin: 10px auto; max-width: 240px; }
table.storelist tr.current { background: var(--accent-soft); }

/* Einstellungen */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
.settings nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.settings nav a.on { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.artists { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.artists .list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; }
.artists .list button.on { background: var(--accent-soft); } .artists .list button:hover { background: var(--hover); }
table.keys td { padding: 6px 8px; }

@media (max-width: 1200px) { .work { grid-template-columns: minmax(0, 1fr) 400px; } #nav a { padding: 7px 9px; } }
@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; height: auto; } .viewer { height: 60vh; }
  .cols, .settings, .artists { grid-template-columns: 1fr; }
  .appbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; } .activity { margin-left: 0; }
}

/* Wissen und Gespräch */
.page.wide { max-width: 1400px; }
.kprofile { background: var(--hover); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 8px; }
.kprofile h3 { margin-top: 0; }
.srcs { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.doc { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 10px 0; }
.doc.rejected { opacity: .5; }
.upload { border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.mcard { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; }
.mcard img { width: 72px; height: 72px; object-fit: contain; background: var(--hover); border-radius: 4px; }
.hit { padding: 8px 0; border-bottom: 1px solid var(--line); } .hit mark { background: #fff1b8; }
.chat { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.convs .clist { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow: auto; }
.convs .clist a { padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 14px; }
.convs .clist a.on { background: var(--accent-soft); } .convs .clist a:hover { background: var(--hover); }
.convo { display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 420px; }
.convo .msgs { flex: 1; overflow: auto; padding: 18px 20px; }
.convo .composer { border-top: 1px solid var(--line); padding: 12px 16px; }
.convo .composer textarea { resize: vertical; }
.msg { max-width: 820px; margin: 0 0 14px; line-height: 1.5; }
.msg.user { margin-left: auto; background: var(--accent-soft); padding: 8px 12px; border-radius: 12px; width: fit-content; max-width: 70%; }
.msg.user p { margin: 0; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant ul { margin: 0 0 8px; padding-left: 20px; }
.msg.assistant h4 { margin: 10px 0 4px; }
.msg .refs { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); }
.msg.pending { color: var(--muted); }
@media (max-width: 900px) { .chat { grid-template-columns: 1fr; } .convo { height: auto; } }

/* Frühere Nummern */
.fnums { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fnum { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--surface); }
.fnum button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.fnum button:hover { color: var(--ink); }

/* ---------- LANJUS-Marke ---------- */
.appbar { height: 64px; gap: 22px; padding: 0 24px; border-bottom-color: var(--line); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo img { height: 34px; width: auto; display: block; }
.logo span { font-weight: 700; font-size: 15px; letter-spacing: .14em; }
.brand { border: 0; background: none; cursor: pointer; padding: 6px 10px; border-radius: var(--r-sm); font-weight: 400; font-size: 13px;
  color: var(--muted); border-left: 1px solid var(--line); border-radius: 0; padding-left: 18px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand:hover { color: var(--ink); }
#nav { gap: 4px; }
#nav a { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 8px 10px; border-radius: 0;
  border-bottom: 2px solid transparent; }
#nav a:hover { background: none; color: var(--ink); }
#nav a.active { background: none; color: var(--ink); border-bottom-color: var(--ink); }
#nav a .count { color: var(--ink); font-weight: 700; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: .01em; } h2 { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
h3 { font-size: 10.5px; letter-spacing: .14em; font-weight: 700; }
.panel { border-color: var(--line); box-shadow: 0 1px 0 rgba(29, 29, 27, .03); }
.btn { border-color: #d9d4c9; font-size: 13px; }
.btn.primary { font-weight: 700; letter-spacing: .02em; }
.btn.primary:hover { filter: none; background: #3a3a37; }
.btn.big { font-size: 14px; letter-spacing: .03em; }
.link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.link.muted { text-decoration: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(29, 29, 27, .08); }
.pill.info, .badge.info { background: var(--accent-soft); color: var(--ink); }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.kpi .v { font-weight: 700; font-size: 26px; letter-spacing: .01em; }
.tabs button { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.tabs button.on { border-bottom-color: var(--ink); }
.empty p, .kprofile p, .muted.lead { font-style: italic; font-weight: 300; }
.empty h2 { font-size: 20px; }
.msg.assistant { font-size: 14.5px; }
.convo .composer { background: #fbfaf7; }
.worktitle .no { letter-spacing: .04em; }
::selection { background: #e9e2d0; }
.brand { flex-shrink: 0; max-width: 240px; }
.activity { flex-shrink: 1; min-width: 190px; max-width: 300px; font-size: 12px; line-height: 1.3; }
.activity > a { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tabs button { white-space: nowrap; letter-spacing: .05em; font-size: 11.5px; padding: 10px 9px; }
.tabs button .muted { text-transform: none; letter-spacing: 0; }
@media (max-width: 1280px) { #nav a { letter-spacing: .04em; padding: 8px 7px; } .logo span { display: none; } }
#userbtn { flex-shrink: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
@media (max-width: 1520px) { .appbar { gap: 14px; } #nav { gap: 0; } #nav a { letter-spacing: .05em; padding: 8px 8px; } }
.f .flabel .acts { gap: 8px; } .f .flabel .acts button { font-size: 10.5px; letter-spacing: 0; white-space: nowrap; }

/* ---------- Anmeldung ---------- */
body.loggedout .appbar { display: none; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; margin: -20px; background: var(--bg); }
.loginbox { width: min(420px, 100%); padding: 32px 32px 28px; box-shadow: var(--shadow); }
.loginbrand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.loginbrand img { height: 54px; }
.loginbrand b { display: block; font-size: 20px; letter-spacing: .16em; }
.loginbrand span { font-size: 11.5px; color: var(--muted); font-style: italic; font-weight: 300; }
.loginform h2 { margin-top: 0; }
.qr { display: grid; place-items: center; margin: 12px 0; } .qr svg { width: 200px; height: 200px; }
pre.codes { font-size: 15px; letter-spacing: .08em; columns: 2; }

/* ---------- Tablet und Handy ---------- */
.artists > *, .chat > *, .work > *, .settings > *, .cols > * { min-width: 0; }   /* breite Inhalte scrollen statt zu sprengen */
@media (max-width: 1100px) {
  .appbar { flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 14px 0; row-gap: 2px; }
  #nav { order: 10; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -6px; }
  #nav::-webkit-scrollbar { display: none; }
  #nav a { flex: 0 0 auto; }
  .activity { margin-left: auto; }
  .settings nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .settings nav a { flex: 0 0 auto; }
}
@media (max-width: 760px) {
  main { padding: 10px; }
  .pad { padding: 14px 16px; }
  h1 { font-size: 20px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .logo img { height: 28px; }
  .brand { max-width: 46vw; padding-left: 10px; }
  .activity { min-width: 0; max-width: 40vw; }
  .activity > a { -webkit-line-clamp: 1; }
  #userbtn { max-width: 28vw; padding: 6px 8px; }
  #grid.panel { overflow-x: auto; }
  table.worklist { min-width: 760px; }
  .work { gap: 10px; } .viewer { height: 48vh; }
  .side .foot { position: sticky; bottom: 0; background: var(--surface); z-index: 2; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .msg.user { max-width: 90%; }
  .convo .composer .row { flex-wrap: wrap; }
  dialog form { padding: 18px; }
  .matches { grid-template-columns: 1fr; }
  .login { margin: -10px; padding: 12px; } .loginbox { padding: 24px 20px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .worktitle .no { font-size: 21px; white-space: nowrap; }
  .progressline { font-size: 12px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { white-space: nowrap; flex: 0 0 auto; }
}

/* ---------- Werkverzeichnis (wie LANJUS Objects): Filterleiste, Kacheln / Liste / Detail, Gruppen ---------- */
.catalog { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1600px; margin: 0 auto; }
.facets { position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 16px; font-size: 13.5px; }
.facets .fhead { margin-bottom: 6px; }
.facet { border-top: 1px solid var(--line); padding: 6px 0; }
.facet summary { cursor: pointer; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 5px 0; list-style: none; }
.facet summary::before { content: "▸ "; } .facet[open] summary::before { content: "▾ "; }
.fv { display: flex; align-items: center; gap: 8px; padding: 3px 2px; cursor: pointer; border-radius: var(--r-sm); }
.fv:hover { background: var(--hover); } .fv.zero { color: var(--faint); }
.fv .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.results { min-width: 0; }
.results .pagehead { margin-bottom: 10px; }
.results .toolbar { margin-bottom: 8px; }
.toolbar .search { flex: 1 1 260px; min-width: 0; }
.tsels { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 13px; }
.ghead { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.drows { display: flex; flex-direction: column; gap: 10px; }
.drow { position: relative; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; cursor: pointer; }
.drow:hover { border-color: #cfccc5; } .drow.selected { outline: 3px solid var(--accent); }
.drow > img, .drow > .noimg { width: 200px; height: 200px; object-fit: contain; background: #ece9e3; border-radius: var(--r-sm); }
.drow > .noimg { display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.drow .sel { position: absolute; top: 18px; left: 18px; width: 18px; height: 18px; }
.drow .num { font-size: 16px; }
.drow dl.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 2px 12px; margin: 8px 0; font-size: 13.5px; }
.drow dl.kv dt { color: var(--muted); } .drow dl.kv dd { margin: 0; }
.batchbar { bottom: 12px; }
.showfilters { display: none; }
@media (max-width: 1000px) {
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .showfilters { display: inline-flex; }
  .facets { display: none; position: fixed; inset: calc(52px + env(safe-area-inset-top)) 0 0 0; z-index: 45; max-height: none; border-radius: 0;
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .facets.open { display: block; }
  .drow { grid-template-columns: 110px minmax(0, 1fr); } .drow > img, .drow > .noimg { width: 110px; height: 110px; }
}

/* ---------- Handy: untere Navigationsleiste wie LANJUS Objects, sichere Ränder, kein Zoom in Eingabefelder ---------- */
#nav .only-mobile { display: none; }
.mehr .panel { margin-bottom: 12px; overflow: hidden; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; min-height: 54px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); cursor: pointer; }
.mrow:last-child { border-bottom: 0; }
.mrow span { color: var(--muted); font-size: 13px; text-align: right; }
@media (max-width: 760px) {
  .appbar { padding: env(safe-area-inset-top) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left)); min-height: calc(52px + env(safe-area-inset-top));
    flex-wrap: nowrap; gap: 8px; }
  #nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; width: auto; margin: 0; order: 0; background: var(--surface);
    border-top: 1px solid var(--line); justify-content: space-around; overflow: visible; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #nav a { flex: 1 1 0; text-align: center; font-size: 11.5px; letter-spacing: .02em; padding: 10px 2px; min-height: 46px; border-radius: 10px; }
  #nav a.secondary { display: none; }
  #nav .only-mobile { display: block; }
  #nav a .count { display: none; }
  main { padding: 10px calc(10px + env(safe-area-inset-right)) calc(78px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); }
  .activity { display: none; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 92dvh; }
  dialog form { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .btn { min-height: 40px; font-size: 14px; } .btn.small { min-height: 32px; } .btn.big { min-height: 50px; }
  .seg button { padding: 7px 10px; font-size: 13px; }
  .toolbar { gap: 8px; }
  .toolbar .search { order: -1; flex: 1 1 100%; }
  .results .toolbar .seg { flex: 1; } .results .toolbar .seg button { flex: 1; }
  .tsels { flex: 1 1 100%; min-width: 0; } .tsels select { flex: 1 1 0; width: 0; min-width: 0; }
  .results .pagehead h1 { flex: 1 1 100%; }
  .results .pagehead #levels { flex: 1 1 100%; }
  .drow { grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 10px; } .drow > img, .drow > .noimg { width: 90px; height: 90px; }
  .drow dl.kv { grid-template-columns: 78px minmax(0, 1fr); font-size: 13px; }
  .batchbar { position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 41; margin: 0; }
  .facets { inset: calc(52px + env(safe-area-inset-top)) 0 calc(60px + env(safe-area-inset-bottom)) 0; padding-bottom: 16px; }
  table.worklist { min-width: 0; }
  .f .flabel { flex-wrap: wrap; row-gap: 2px; } .f .flabel .acts { flex-wrap: wrap; }
  .work > .side { overflow: visible; }   /* sonst bleibt die Fußleiste nicht stehen (sticky braucht sichtbaren Überlauf) */
  .side .foot { bottom: calc(62px + env(safe-area-inset-bottom)) !important; border-radius: 0 0 var(--r) var(--r); }   /* über der unteren Navigationsleiste */
  #view table:not(.worklist) { display: block; max-width: 100%; overflow-x: auto; }   /* breite Tabellen seitlich wischen, Seite bleibt schmal */
  table.worklist th:nth-child(n+5), table.worklist td:nth-child(n+5) { display: none; }   /* Handy: Nr., Titel, Bild */
  .login { margin: 0; padding: 16px; min-height: 100dvh; }
  .loginbox { width: 100%; }
}

/* ---------- Touch-Geräte: Feldaktionen sichtbar und groß genug zum Tippen ---------- */
@media (pointer: coarse) {
  .f .flabel .acts { opacity: 1; }
  .f .flabel .acts button, .tag-ai button, .fnum button { min-height: 32px; min-width: 32px; padding: 4px 8px; font-size: 13px; }
}

/* ---------- Forschung (ArtKnowledge): Aussagen mit Prüfstand und Belegen ---------- */
.fs-sum { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); margin-bottom: 10px; line-height: 1.7; }
details.fs { border-top: 1px solid var(--line); padding: 8px 0; }
details.fs > summary { cursor: pointer; list-style: none; padding: 4px 0; }
details.fs > summary::before { content: "▸ "; color: var(--muted); }
details.fs[open] > summary::before { content: "▾ "; }
.stmt2 { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; background: var(--surface); }
.stmt2.neg { opacity: .55; }
.stmt2 .txt { margin: 4px 0 2px; }
.stmt2 .kind { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stmt2 .kind.observation { color: var(--ok); } .stmt2 .kind.interpretation { color: var(--accent); }
.stmt2 .kind.hypothesis, .stmt2 .kind.relation { color: var(--warn); } .stmt2 .kind.fact { color: var(--ai); } .stmt2 .kind.question { color: var(--muted); }
.stmt2 .acts { margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.stmt2 .answer { margin-top: 4px; padding: 6px 8px; background: var(--ok-soft); border-radius: var(--r-sm); }
.evs { margin-top: 6px; border-left: 2px solid var(--line); padding-left: 8px; }
.ev { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; align-items: flex-start; }
.ev .rel { width: 14px; text-align: center; font-weight: 700; color: var(--muted); }
.ev.supports .rel { color: var(--ok); } .ev.contradicts .rel { color: var(--bad); }
.quote { font-style: italic; color: var(--muted); margin: 2px 0; }
.quote mark { background: var(--warn-soft); color: var(--ink); font-style: normal; }
.opts .opt { padding: 3px 0; }
.taskres:not(:empty) { margin-top: 8px; padding: 8px; background: var(--hover); border-radius: var(--r-sm); }
.cmplist { display: grid; gap: 10px; }
.cmp { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; align-items: start; }
.cmp img { width: 86px; height: 86px; object-fit: cover; border-radius: var(--r-sm); background: var(--hover); display: block; }
.lit { padding: 6px 0; border-bottom: 1px solid var(--line); }
table.kv td { padding: 3px 8px 3px 0; vertical-align: top; }

/* ---------- Zuschnitt-Editor: Modus Rechteck | Perspektive ---------- */
.floatbar .seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--on-dark) 8%, transparent); }
.floatbar .seg button { padding: 5px 10px; }
.floatbar .seg button.on { background: color-mix(in srgb, var(--on-dark) 22%, transparent); }
.floatbar button[hidden] { display: none; }
.floatbar { max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }   /* einzeilig, notfalls seitlich wischen */
.floatbar > * { flex-shrink: 0; }
@media (max-width: 1100px) {   /* schmale Fenster: kompakte Leiste, nichts abgeschnitten */
  .floatbar button, .floatbar a { padding: 6px 8px; font-size: 12.5px; }
  .floatbar .seg button { padding: 4px 7px; }
}
.handle.edge { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 3px; }
.handle.e-t, .handle.e-b { cursor: ns-resize; } .handle.e-l, .handle.e-r { cursor: ew-resize; }
.handle.c-tl, .handle.c-br { cursor: nwse-resize; } .handle.c-tr, .handle.c-bl { cursor: nesw-resize; }
.editor-inner.rectmode:not(.wb) polygon { cursor: move; }

/* ---------- Forschungsfragen: Thema, Werkbezüge, Vorschläge ---------- */
.qx { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.qx > div, .qx > details { flex-basis: 100%; }
.qx .chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.qworks { display: flex; gap: 6px; flex-wrap: wrap; }
.qworks a { position: relative; display: inline-block; font-size: 12px; text-decoration: none; }
.qworks img { width: 42px; height: 42px; object-fit: cover; border-radius: var(--r-sm); display: block; background: var(--hover); }
.qworks i { position: absolute; top: -4px; right: -4px; font-style: normal; font-size: 10px; background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 0 4px; }
.prop { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- Dokumente: Seitentext, Funde ---------- */
.pagetext { white-space: pre-wrap; max-height: 60vh; overflow: auto; background: var(--hover); padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; }
.finding { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 6px 0; }
.finding.accepted { border-color: var(--ok); } .finding.rejected { opacity: .5; }
.finding .acts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.findings { max-height: 65vh; overflow: auto; }

/* ---------- Stufenanzeige je Werk (fields.progress) ---------- */
.stagesteps { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.stagesteps .ss { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.stagesteps .ss + .ss::before { content: ""; width: 14px; height: 1px; background: var(--line); margin-right: 4px; }
.stagesteps .dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--faint); flex: none; }
.stagesteps .ss.done { color: var(--ok); } .stagesteps .ss.done .dot { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.stagesteps .ss.next { color: var(--ink); } .stagesteps .ss.next .dot { border-color: var(--ink); color: var(--ink); }
.stagesteps.compact { gap: 2px; flex-wrap: nowrap; }
.stagesteps.compact .ss + .ss::before { width: 6px; margin-right: 2px; }
.stagesteps.compact .dot { width: 15px; height: 15px; font-size: 9.5px; }
.stagesteps .sslabel { margin-left: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.card .stagesteps.compact { flex-wrap: wrap; } .card .stagesteps .sslabel { white-space: normal; }   /* Kacheln: Text bricht um */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stagebar { margin: 0 0 10px; display: grid; gap: 6px; }
.stagebar .nextline { font-size: 13px; color: var(--muted); }
.stagebar .nextline b { color: var(--ink); font-weight: 600; }
.stagebar details > summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: revert; }
.stagelist { margin: 8px 0 4px; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.stagelist > li { padding-left: 26px; position: relative; }
.stagelist > li::before { content: counter(list-item); position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.stagelist > li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.stagelist > li.next::before { border-color: var(--ink); color: var(--ink); }
.stagelist ul { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 760px) {
  .stagebar .stagesteps .ss:not(.next) .lbl { display: none; }   /* Handy: nur die nächste Stufe beschriftet */
}

/* ---------- Einführung (schwebende Karte) und Hilfeseite ---------- */
.tourcard { position: fixed; left: 24px; bottom: 24px;   /* links: Hauptschaltflächen rechts unten bleiben frei */
  z-index: 60; width: min(400px, calc(100vw - 32px)); padding: 16px 18px;
  box-shadow: var(--shadow); display: grid; gap: 8px; }
.tourcard p { margin: 0; }
.tourdots { display: flex; gap: 6px; }
.tourdots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tourdots span.on { background: var(--ink); }
.hilfe .panel { margin-bottom: 16px; }
.terms { margin: 0; display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; }
.terms dt { font-weight: 600; } .terms dd { margin: 0; color: var(--muted); }
@media (max-width: 760px) {
  .tourcard { left: 16px; right: 16px; width: auto; bottom: auto; top: calc(60px + env(safe-area-inset-top)); }   /* oben: Aktionsleiste unten frei */
  .terms { grid-template-columns: 1fr; gap: 2px; } .terms dd { margin-bottom: 10px; }
}
