:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel2: #21252e;
  --line: #2c3140;
  --text: #f2f3f5;
  --muted: #9aa3b2;
  --accent: #f5b342;
  --accent-ink: #1a1200;
  --ok: #3ccf7a;
  --warn: #f0a33c;
  --bad: #ef5a5a;
  --info: #5aa9ff;
  --radius: 14px;
  --tap: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.35 system-ui, -apple-system, Roboto, "Segoe UI", sans-serif; overscroll-behavior-y: contain; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--info); }
h1, h2, h3 { margin: 14px 0 8px; font-weight: 650; }
h2 { font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: rgba(15,17,21,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .title { flex: 1; font-weight: 700; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 22px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--bad); }
.chip { font-size: .8rem; padding: 4px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); }

main { padding: 12px 12px 24px; max-width: 640px; margin: 0 auto; }
.screen { display: none; }
.screen.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); width: 100%; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 1.05rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:active { transform: scale(.985); filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.warn { background: #2d2214; border-color: var(--warn); color: var(--warn); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.xl { min-height: 72px; font-size: 1.25rem; }
.btn.small { min-height: 44px; font-size: .95rem; padding: 8px 12px; width: auto; }
.btn:disabled { opacity: .45; }
.btn .count { background: var(--panel2); border-radius: 999px; padding: 2px 8px; font-size: .85rem; color: var(--muted); }
.row { display: flex; align-items: stretch; margin: 10px 0; }
.row.gap { gap: 10px; }
.row > * { flex: 1; }
.sticky-bottom { position: sticky; bottom: 8px; z-index: 5; }
.file-btn { position: relative; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(245,179,66,.25); }
.list { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.status { color: var(--muted); padding: 8px 2px; min-height: 1.4em; }
.hint { background: #2b2410; border: 1px solid var(--warn); color: #ffd98a; border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; font-weight: 600; }
.hint.info { background: #14233a; border-color: var(--info); color: #bcdcff; }
.hint.ok { background: #12301f; border-color: var(--ok); color: #b6f2cd; }
.hint.bad { background: #341818; border-color: var(--bad); color: #ffc4c4; }

.field { display: block; margin: 8px 0; }
.field .lbl { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.in { width: 100%; min-height: 50px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 1.05rem; font-family: inherit; }
textarea.in { min-height: 90px; resize: vertical; }
.in.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.badge { font-size: .75rem; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.badge.ok { background: #14361f; color: var(--ok); }
.badge.warn { background: #3a2a10; color: var(--warn); }
.badge.bad { background: #3a1616; color: var(--bad); }
.badge.muted { background: var(--panel2); color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); margin: 2px 4px 2px 0; }
.tag.hit { background: #14361f; color: var(--ok); }
.tag.miss { background: #3a1616; color: var(--bad); }

/* Kamera */
.cam-wrap { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #000; border-radius: var(--radius); overflow: hidden; }
#cam-video { width: 100%; height: 100%; object-fit: cover; }
.cam-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.guide { border: 2px dashed rgba(245,179,66,.9); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.guide.cover { width: 82%; aspect-ratio: 1; border-radius: 6px; }
.guide.label { width: 60%; aspect-ratio: 1; border-radius: 50%; }
.guide.matrix { width: 88%; aspect-ratio: 1; border-radius: 50%; border-style: dotted; }
.cam-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; text-shadow: 0 1px 3px #000; }
.cam-step { font-size: .8rem; color: var(--accent); font-weight: 700; }
.cam-label { font-size: 1.3rem; font-weight: 700; }
.cam-hint { font-size: .9rem; color: #ddd; }
.cam-thumbs { position: absolute; bottom: 10px; left: 10px; display: flex; gap: 6px; }
.cam-thumbs img, .thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); background: #222; }
.cam-thumbs .ph { width: 56px; height: 56px; border-radius: 8px; border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem; }
.cam-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.cam-controls .btn { flex: 1; }
.shutter { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 50%; border: 5px solid #fff; background: var(--accent); box-shadow: 0 0 0 4px #000 inset; }
.shutter:active { transform: scale(.94); }
.thumbs { display: flex; gap: 8px; margin: 4px 0 8px; }
.thumbs img { width: 84px; height: 84px; }

/* Trefferkarten */
.rel { display: grid; grid-template-columns: 84px 1fr; gap: 12px; cursor: pointer; }
.rel img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; background: #222; }
.rel .t { font-weight: 700; font-size: 1.02rem; }
.rel .m { color: var(--muted); font-size: .9rem; }
.rel .mx { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; color: #cfd6e2; word-break: break-all; margin-top: 4px; }
.rel .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

/* Preis */
.ptable { width: 100%; border-collapse: collapse; margin: 8px 0; }
.ptable th, .ptable td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.ptable th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.ptable td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ptable tr.sel td { background: #2b2410; color: #ffd98a; }
.seg { display: grid; grid-auto-flow: column; gap: 6px; margin: 8px 0; }
.seg button { min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 700; font-size: 1rem; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bigprice { text-align: center; padding: 14px; }
.bigprice .v { font-size: 2.6rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.bigprice .r { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.stat { background: var(--panel2); border-radius: 12px; padding: 10px; text-align: center; }
.stat .k { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.stat .v { font-size: 1.15rem; font-weight: 700; }

/* Sprachdialog – aus 2 m lesbar */
.steps { display: flex; gap: 6px; margin: 4px 0 10px; }
.steps div { flex: 1; height: 8px; border-radius: 4px; background: var(--panel2); }
.steps div.done { background: var(--ok); }
.steps div.cur { background: var(--accent); }
.voice-prompt { font-size: 2.4rem; font-weight: 800; line-height: 1.1; margin: 8px 0 4px; }
.voice-sub { font-size: 1.15rem; color: var(--muted); margin-bottom: 8px; }
.voice-transcript { min-height: 2.4em; font-size: 1.35rem; color: #d8dde6; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.voice-transcript:empty::before { content: '…'; color: var(--muted); }
.voice-result { margin: 10px 0; font-size: 1.9rem; font-weight: 800; line-height: 1.15; min-height: 1.2em; }
.voice-result .sub { display: block; font-size: 1.05rem; color: var(--muted); font-weight: 500; margin-top: 4px; }
.voice-result .cnt { font-size: .95rem; color: var(--muted); font-weight: 500; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0; }
.mic { width: 112px; height: 112px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); font-size: 3rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 30px rgba(245,179,66,.35); }
.mic.listening { background: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
.mic.busy { background: var(--panel2); color: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,90,90,.6);} 70% { box-shadow: 0 0 0 26px rgba(239,90,90,0);} 100% { box-shadow: 0 0 0 0 rgba(239,90,90,0);} }
.mic-state { font-size: 1.05rem; color: var(--muted); }
.manual { margin: 8px 0; }
.manual .seg { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); }
.manual .seg.wide { grid-template-columns: repeat(3, 1fr); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.quick button { min-height: 48px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 1rem; }
.toggle { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 8px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin: 8px 0; font-weight: 600; }
.toggle input { width: 28px; height: 28px; accent-color: var(--accent); }

/* Summary */
.kv { display: grid; grid-template-columns: 1fr; gap: 8px; }
.kv .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 56px; cursor: pointer; }
.kv .item .k { color: var(--muted); font-size: .85rem; }
.kv .item .v { font-weight: 700; text-align: right; }
.kv .item .v.long { font-weight: 500; font-size: .95rem; }

/* Session-Liste */
.sess { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.sess img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #222; }
.pill { font-size: .75rem; padding: 3px 9px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.pill.draft { background: #14233a; color: #8dc2ff; }
.pill.live { background: #14361f; color: var(--ok); }
.pill.err { background: #3a1616; color: var(--bad); }
.pill.queued { background: #3a2a10; color: var(--warn); }
.pill.open { background: var(--panel2); color: var(--muted); }

.toast { position: fixed; left: 12px; right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50; background: #2a2f3a; color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600; transform: translateY(120%); opacity: 0; transition: .25s; text-align: center; }
.toast.show { transform: none; opacity: 1; }
.toast.ok { background: #14361f; color: #b6f2cd; }
.toast.bad { background: #3a1616; color: #ffc4c4; }
.busy { position: fixed; inset: 0; z-index: 60; background: rgba(15,17,21,.85); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; font-size: 1.2rem; font-weight: 600; }
.busy.show { display: flex; }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--panel2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg);} }
.pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--panel2); padding: 10px; border-radius: 10px; }
