/* LANJUS Objects – Designsystem (gleiche Grundwerte wie LANJUS Art: Archivpapier, Tinte, Neufile Grotesk).
   Mobil zuerst: große Bedienelemente, eine Hauptaktion je Bildschirm. Farben nur über die Variablen. */
@font-face { font-family: "Neufile Grotesk"; src: url("/fonts/Neufile-Grotesk-Regular-Extended.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Neufile Grotesk"; src: url("/fonts/Neufile-Grotesk-Bold-Extended.otf") format("opentype"); font-weight: 600 800; 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;
  --cam-bg: #0f0f0e; --on-dark: #f2f2f2;
  --r: 8px; --r-sm: 5px; --shadow: 0 10px 30px rgba(29, 29, 27, .14);
  --font: "Neufile Grotesk", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-underline-offset: 3px; }
.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; } .grow { flex: 1; } .end { justify-content: flex-end; }
.stack > * + * { margin-top: 10px; }

/* App-Leiste */
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 54px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; letter-spacing: .2px; white-space: nowrap; } .brand small { font-weight: 400; color: var(--muted); }
#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.active, #nav a:hover { color: var(--ink); background: var(--hover); }
.who { margin-left: auto; font-size: 13px; color: var(--muted); }
main { padding: 18px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 760px) {
  #nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
    justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #nav a { font-size: 12.5px; padding: 8px 6px; text-align: center; flex: 1; }
  main { padding: 12px 12px 90px; }
  .who { display: none; }
}

/* Bausteine */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.pad { padding: 16px 18px; }
h1 { font-size: 21px; font-weight: 600; margin: 0 0 14px; } h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 18px 0 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--hover); } .btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ai { background: var(--ai); border-color: var(--ai); color: #fff; }
.btn.big { padding: 13px 22px; font-size: 16.5px; min-height: 52px; }
.btn.small { padding: 4px 10px; font-size: 13px; min-height: 30px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 10px; background: var(--surface); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; 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.ai { background: var(--ai-soft); color: var(--ai); }
.notice { padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.notice.ai { background: var(--ai-soft); color: var(--ai); } .notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--on-dark);
  padding: 10px 18px; border-radius: 999px; z-index: 100; box-shadow: var(--shadow); max-width: 92vw; }
.toast.error { background: var(--bad); }
dialog { border: 0; border-radius: var(--r); padding: 0; box-shadow: var(--shadow); width: min(560px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog form { padding: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* Objektkarten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; position: relative; }
.card img, .card .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--hover); }
.card .noimg { display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.card .meta { padding: 8px 10px; font-size: 13px; }
.card .num { font-weight: 600; } .card .sel { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; }
.prio { position: absolute; top: 8px; right: 8px; }

/* Objektansicht */
.detail { display: grid; grid-template-columns: minmax(280px, 520px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.detail > * { min-width: 0; }
.gallery .main { max-height: 60vh; }
.thumbs .t .pick { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; }
.gallery .main { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs .t { position: relative; width: 74px; } .thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: var(--r-sm); border: 2px solid transparent; cursor: pointer; }
.thumbs img.on { border-color: var(--accent); } .thumbs .t.hid img { opacity: .3; }
.thumbs .t span { position: absolute; left: 2px; bottom: 2px; font-size: 10px; background: rgba(255,255,255,.9); padding: 0 4px; border-radius: 3px; }
.fs { font-size: 11px; padding: 1px 6px; border-radius: 999px; margin-left: 6px; }
.fs.human { background: var(--ok-soft); color: var(--ok); } .fs.ai_accepted { background: var(--ai-soft); color: var(--ai); }
.fs.verified { background: var(--ok); color: #fff; }
.sugg { border: 1px solid var(--ai-soft); background: var(--ai-soft); border-radius: var(--r-sm); padding: 8px 10px; margin: 6px 0; }
.sugg.conflict { border-color: var(--warn); background: var(--warn-soft); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.excerpt { font-size: 13px; background: var(--hover); border-left: 3px solid var(--line); padding: 4px 8px; margin: 4px 0; }
.range { font-size: 22px; font-weight: 600; }
.tree ul { list-style: none; margin: 0; padding-left: 18px; } .tree > ul { padding-left: 0; }
.tree li > div { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r-sm); }
.tree li > div:hover { background: var(--hover); } .tree .cnt { font-size: 12px; color: var(--muted); }

/* ---------- Scanner (iPhone) ---------- */
body.scanning { background: var(--cam-bg); }
body.scanning .appbar { display: none; }
.scan { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--cam-bg); color: var(--on-dark);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); z-index: 35; }
.scan-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.scan-top .num { font-size: 22px; font-weight: 650; letter-spacing: .3px; }
.scan-top .num small { display: block; font-size: 12px; font-weight: 400; color: #b9b5ad; }
.scan-top .num small.reopened { color: var(--warn-soft); font-weight: 600; }
.scan-top .btn { background: rgba(255,255,255,.1); border-color: transparent; color: var(--on-dark); min-height: 36px; }
.up { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); white-space: nowrap; }
.up.ok { background: #1f4d33; } .up.wait { background: #5c4300; } .up.err { background: var(--bad); }
.viewer { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.viewer video, .viewer img.last { width: 100%; height: 100%; object-fit: contain; }
.viewer .placeholder { text-align: center; color: #b9b5ad; padding: 24px; }
.viewer .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.viewer .flash.on { opacity: .7; transition: none; }
.hint { margin: 0 12px 8px; padding: 8px 12px; border-radius: var(--r-sm); background: rgba(107, 79, 160, .85); font-size: 14px; }
.roles { display: flex; gap: 6px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.roles button { flex: none; border: 1px solid rgba(255,255,255,.25); background: transparent; color: var(--on-dark); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; }
.roles button.on { background: var(--on-dark); color: var(--ink); border-color: var(--on-dark); font-weight: 600; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 8px; min-height: 64px; }
.strip .s { position: relative; flex: none; width: 58px; height: 58px; border-radius: 6px; overflow: hidden; background: #2a2a28; }
.strip .s img { width: 100%; height: 100%; object-fit: cover; } .strip .s.hid img { opacity: .3; }
.strip .s i { position: absolute; right: 2px; bottom: 2px; font-style: normal; font-size: 11px; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,.6); }
.strip .s.err { outline: 2px solid var(--bad); }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 6px 14px 12px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid var(--on-dark); background: rgba(255,255,255,.92); cursor: pointer; }
.shutter:active { transform: scale(.94); } .shutter:disabled { opacity: .4; }
.controls .side { display: flex; } .controls .side.r { justify-content: flex-end; }
.controls .btn { background: rgba(255,255,255,.12); border-color: transparent; color: var(--on-dark); }
.finish { margin: 0 14px 10px; }
.finish .btn { width: 100%; background: var(--on-dark); color: var(--ink); border: 0; font-weight: 650; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); color: var(--ink); border-radius: 14px 14px 0 0; z-index: 60;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); max-height: 80vh; overflow: auto; }
.sheet img { width: 100%; max-height: 40vh; object-fit: contain; border-radius: var(--r-sm); background: var(--hover); }
.pairbox { max-width: 460px; margin: 40px auto; }

/* ---------- Objektverzeichnis (Filterleiste, Kacheln / Liste / Detail) ---------- */
.catalog { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
.facets { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 16px; font-size: 14px; }
.facet { border-top: 1px solid var(--line); padding: 6px 0; }
.facet summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); padding: 4px 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; }
.toolbar { margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--hover); padding: 3px; border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.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; }
.ghead { display: flex; gap: 8px; align-items: baseline; font-size: 13px; 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); }
.olist td, .olist th { white-space: nowrap; } .olist tbody tr { cursor: pointer; } .olist tbody tr:hover, .olist tr.on { background: var(--hover); }
img.mini { width: 40px; height: 40px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.drows { display: flex; flex-direction: column; gap: 10px; }
.drow { position: relative; display: grid; grid-template-columns: 200px 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px; cursor: pointer; }
.drow:hover, .drow.on, .card.on { border-color: var(--accent); }
.drow > img, .drow > .noimg { width: 200px; height: 200px; object-fit: contain; background: var(--hover); 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: 20px; height: 20px; }
.drow .num { font-size: 16px; } .drow .kv { margin: 8px 0; grid-template-columns: 110px 1fr; font-size: 13.5px; }
.selbar { position: sticky; bottom: 12px; display: flex; gap: 10px; align-items: center; margin-top: 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.showfilters { display: none; }
@media (max-width: 900px) {
  .catalog { grid-template-columns: 1fr; }
  .showfilters { display: inline-flex; }
  .facets { display: none; position: fixed; inset: 54px 0 60px 0; z-index: 45; max-height: none; border-radius: 0; }
  .facets.open { display: block; }
  .drow { grid-template-columns: 110px 1fr; } .drow > img, .drow > .noimg { width: 110px; height: 110px; }
}

/* ---------- Benutzerverwaltung ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu .menubody { position: absolute; right: 0; z-index: 20; display: flex; flex-direction: column; gap: 4px; min-width: 210px;
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
details.menu .menubody .btn { justify-content: flex-start; }
.temppw code { font-size: 20px; letter-spacing: 1px; padding: 6px 10px; background: var(--hover); border-radius: var(--r-sm); user-select: all; }
.ulist { overflow: visible; } .ulist td, .ulist th { white-space: normal; }
@media (max-width: 760px) { .ulist thead { display: none; } .ulist tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .ulist td { display: block; border: 0; padding: 2px 8px; } }

/* Scanner: Lagerort und QR */
.locrow { display: flex; gap: 8px; padding: 0 12px 8px; }
.loc { flex: 1; text-align: left; border: 1px dashed rgba(255,255,255,.35); background: transparent; color: #b9b5ad;
  border-radius: var(--r-sm); padding: 7px 10px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc.set { border-style: solid; color: var(--on-dark); }
.locrow .btn { background: rgba(255,255,255,.12); border-color: transparent; color: var(--on-dark); }
.qrbar { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--ok); color: #fff; }
.locres { max-height: 45vh; overflow: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.lopt { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 9px 10px; }

/* Zweispaltige Seiten (Einstellungen, Standorte): auf dem Handy untereinander */
.detail.twocol { grid-template-columns: 1fr 1fr; } .detail.loccol { grid-template-columns: minmax(280px, 1fr) 1.2fr; }
@media (max-width: 900px) { .detail.twocol, .detail.loccol { grid-template-columns: 1fr; } }
.keyrow > .grow { min-width: 140px; }

/* ---------- Umlagern per Scan ---------- */
.qrcam { position: relative; margin: 10px 0; border-radius: var(--r); overflow: hidden; background: var(--cam-bg); aspect-ratio: 4 / 3; }
.qrcam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qrhint { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; color: var(--on-dark); background: rgba(0,0,0,.45); font-size: 13px; }
.qrcam::after { content: ""; position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.85); border-radius: 10px; }

/* ---------- Etiketten ---------- */
#sheet { background: #fff; }
.lsheet { display: grid; grid-template-columns: repeat(3, var(--lw)); grid-auto-rows: var(--lh); width: 210mm; padding: 0; }
.lroll { display: flex; flex-direction: column; gap: 4mm; }
.label { width: var(--lw); height: var(--lh); display: flex; align-items: center; gap: 2mm; padding: 2mm 3mm; overflow: hidden;
  color: #000; font-family: var(--font); box-sizing: border-box; }
.lroll .label { outline: 1px dashed var(--line); break-after: page; page-break-after: always; }
.label .lqr { height: calc(var(--lh) - 4mm); aspect-ratio: 1; flex: none; } .label .lqr svg { width: 100%; height: 100%; display: block; }
.label .ltxt { min-width: 0; line-height: 1.15; }
.label .lcode { font-weight: 700; font-size: 11pt; white-space: nowrap; }
.label .ltitle { font-size: 7.5pt; } .label .lsub { font-size: 6.5pt; color: #444; }
.label.location .lcode { font-size: 13pt; }
@media screen { .lsheet .label { outline: 1px dashed var(--line); } }
@media print { .lroll { gap: 0; } .lroll .label { outline: none; } }
.photobar { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
