/* Raumlink: Design-Vertrag siehe DESIGN.md. Orientierung an base44.com (Vorgabe):
   Off-White mit Punktraster, große Grotesk, Anthrazit-Buttons, Orange nur für die Aufnahme. */
/* avoid-ai-design-ignore-file: SD1, K3 (Off-White mit Orange ist Vorgabe des Auftraggebers; Unschärfe nur über dem Kamerabild) */
:root {
  --paper: #f6f5f2;
  --card: #ffffff;
  --ink: #252322;
  --ink-2: #64605c;
  --ink-3: #8f8a84;
  --line: #e3dfd9;
  --signal: #f2541b;
  --signal-ink: #ffffff;
  --dots: radial-gradient(circle, rgba(37,35,34,.11) 1px, transparent 1.3px) 0 0 / 16px 16px;
  --accent: var(--ink);
  --accent-ink: #ffffff;
  --accent-soft: #ecebe7;
  --ok: #1f7a46;  --ok-soft: #e1f1e6;
  --warn: #9a6512; --warn-soft: #f8edd6;
  --bad: #b7321f;  --bad-soft: #f9e3df;
  --none: #9a958f; --none-soft: #ecebe7;
  --scan-bg: #0d0c0b;
  --scan-fg: #f5f3f0;
  --scan-glass: rgba(16, 15, 14, .74);
  --f-display: "Wix Madefor Display", "Helvetica Neue", Arial, system-ui, sans-serif;
  --f-body: "Wix Madefor Text", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono: var(--f-body);
  --r: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.dotted { background: var(--dots), var(--paper); }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.025em; font-weight: 600; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--signal) 60%, transparent); outline-offset: 2px; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* ---------- Grundgerüst ---------- */
.page { max-width: 640px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(32px + var(--safe-b)); display: grid; gap: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.topbar .grow { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.iconbtn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #3a3735; }
.btn.signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Startseite ---------- */
.landing { min-height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.landing header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + var(--safe-t)) 16px 14px; max-width: 1080px; width: 100%; margin: 0 auto; }
.hero { max-width: 760px; margin: 0 auto; padding: clamp(48px, 12vh, 120px) 16px 40px; text-align: center; display: grid; gap: 24px; justify-items: center; }
.hero h1 { font-size: clamp(3rem, 13vw, 6.5rem); line-height: .95; letter-spacing: -.045em; }
.hero .lead { font-size: clamp(1.05rem, 3.6vw, 1.3rem); line-height: 1.45; color: var(--ink); max-width: 30ch; }
.startbox { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(37,35,34,.04), 0 10px 30px -12px rgba(37,35,34,.18); padding: 14px 14px 12px 18px; display: grid; gap: 10px; text-align: left; }
.startbox label { font-size: .8rem; color: var(--ink-3); }
.startbox .line { display: flex; align-items: center; gap: 10px; }
.startbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.05rem; padding: 6px 0; outline: none; }
.startbox input::placeholder { color: var(--ink-3); }
.startbox .go { width: 48px; height: 48px; border-radius: 10px; border: 0; background: var(--signal); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.startbox .go svg { width: 24px; height: 24px; }
.startbox .go:disabled { opacity: .6; }
.startbox .foot { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 10px; }
.sequence { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; font-size: 1rem; color: var(--ink-2); }
.sequence span.sep { width: 6px; height: 6px; background: var(--ink); opacity: .7; }
.sequence b { color: var(--ink); font-weight: 600; }
.explain { max-width: 1080px; margin: 0 auto; width: 100%; padding: 40px 16px 56px; display: grid; gap: 28px; grid-template-columns: 1fr; align-items: center; }
.explain h2 { font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1; letter-spacing: -.04em; }
.explain h2 .dim { color: var(--ink-3); display: block; }
.explain p { color: var(--ink-2); max-width: 46ch; font-size: 1.05rem; }
.explain figure { margin: 0; display: grid; gap: 10px; justify-items: center; }
.explain figure svg { width: min(320px, 80vw); height: auto; }
.explain figcaption { font-size: .85rem; color: var(--ink-3); text-align: center; }
.recent { max-width: 640px; margin: 0 auto; width: 100%; padding: 0 16px 48px; display: grid; gap: 12px; }
.recent .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.landing footer { border-top: 1px solid var(--line); padding: 18px 16px calc(18px + var(--safe-b)); font-size: .85rem; color: var(--ink-3); text-align: center; }
@media (min-width: 820px) { .explain { grid-template-columns: 1.2fr 1fr; } }

/* ---------- Status-Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--none-soft); color: var(--ink-2); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.run { background: var(--accent-soft); color: var(--accent); }
.chip.run::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Rundgang-Liste ---------- */
.tour-list { display: grid; gap: 12px; }
.tour { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer; text-align: left; width: 100%; }
.tour .thumb { width: 88px; height: 88px; border-radius: 10px; background: var(--none-soft) center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); }
.tour .meta { min-width: 0; display: grid; gap: 6px; }
.tour .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour .facts { font-size: .85rem; color: var(--ink-2); }
.empty { text-align: center; padding: 40px 16px; display: grid; gap: 14px; justify-items: center; color: var(--ink-2); }
.empty svg { width: 56px; height: 56px; color: var(--ink-3); }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
textarea.input { min-height: 96px; resize: vertical; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--none-soft); border-radius: 12px; }
.seg button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.codebox { font: .78rem/1.5 var(--f-mono); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; word-break: break-all; user-select: all; }
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox .input { font-family: var(--f-mono); font-size: .85rem; min-width: 0; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 10px; border: 1px solid var(--line); width: max-content; margin-inline: auto; }
.qr svg, .qr img { width: 180px; height: 180px; display: block; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.thumbs button { aspect-ratio: 3/4; border-radius: 8px; border: 2px solid transparent; background: var(--none-soft) center/cover; cursor: pointer; padding: 0; max-width: 100%; }
.thumbs button[aria-pressed="true"] { border-color: var(--accent); }

/* ---------- Verarbeitung ---------- */
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stages li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.stages .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--none-soft); color: var(--ink-3); }
.stages .dot svg { width: 16px; height: 16px; }
.stages li.done .dot { background: var(--ok-soft); color: var(--ok); }
.stages li.running .dot { background: var(--accent-soft); color: var(--accent); }
.stages li.running .dot svg { animation: spin 1s linear infinite; }
.stages li.failed .dot { background: var(--bad-soft); color: var(--bad); }
.stages .lbl { font-weight: 600; }
.stages .msg { font-size: .85rem; color: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issues li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: .9rem; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: #5d3f0c; }
.issues li.block { background: var(--bad-soft); color: #6d1d15; }
.issues svg { width: 18px; height: 18px; margin-top: 2px; }
.preview { width: 100%; aspect-ratio: 4/3; max-height: 60vh; border: 0; border-radius: 10px; background: var(--scan-bg); display: block; max-width: 100%; }
.roomrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding-block: 10px; border-top: 1px solid var(--line); }
.roomrow:first-child { border-top: 0; }
.roomrow .name { font-weight: 600; }
.note { font-size: .85rem; color: var(--ink-2); background: var(--paper); border-radius: 10px; padding: 10px 12px; }
.confirm { border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: .92rem; max-width: calc(100% - 32px); z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- Aufnahme (dunkel) ---------- */
.scan { position: fixed; inset: 0; background: var(--scan-bg); color: var(--scan-fg); z-index: 50; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.scan video, .scan .stage { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scan .flash.on { opacity: .7; transition: none; }
.scan-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(10px + var(--safe-t)) 12px 10px; display: grid; gap: 8px; background: linear-gradient(var(--scan-glass), transparent); }
.scan-top .bar { display: flex; align-items: center; gap: 8px; }
.glassbtn { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.16); background: var(--scan-glass); color: var(--scan-fg); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: .9rem; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.glassbtn svg { width: 20px; height: 20px; flex: none; }
.roomname { flex: 1; min-width: 0; text-align: left; justify-content: flex-start; }
.roomname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { white-space: nowrap; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: .82rem; }
.progress .track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; }
.progress .fill { height: 100%; background: #5fd08f; width: 0; transition: width .4s; }
.hint { position: absolute; left: 12px; right: 12px; top: calc(132px + var(--safe-t)); display: flex; justify-content: center; pointer-events: none; }
.hint div { background: var(--scan-glass); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 1rem; text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 420px; }
.hint div.good { background: rgba(31, 138, 76, .88); }
.hint div.bad { background: rgba(194, 56, 43, .9); }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(16px + var(--safe-b)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: linear-gradient(transparent, var(--scan-glass) 40%); }
.radar { width: 104px; height: 104px; justify-self: start; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; display: grid; place-items: center; transition: transform .1s, background .2s; }
.shutter::after { content: ""; width: 60px; height: 60px; border-radius: 50%; background: #fff; transition: background .2s; }
.shutter.aligned::after { background: #5fd08f; }
.shutter:active { transform: scale(.94); }
.shutter:disabled { opacity: .35; }
.scan-bottom .right { justify-self: end; display: grid; gap: 8px; justify-items: end; }
.autotoggle { font-size: .78rem; }
.autotoggle[aria-pressed="true"] { background: rgba(95, 208, 143, .25); border-color: #5fd08f; }

/* Bottom-Sheet & Startkarte im Scan */
.sheet-wrap { position: absolute; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; z-index: 5; }
.sheet { width: 100%; max-height: 85%; overflow: auto; background: #15191b; color: var(--scan-fg); border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + var(--safe-b)); display: grid; gap: 14px; }
.sheet .muted, .scan .muted { color: #aab3b8; }
.sheet .input { background: #0e1112; border-color: #2c3337; color: var(--scan-fg); }
.sheet .btn { background: #22282b; border-color: #2c3337; color: var(--scan-fg); }
.sheet .btn.primary { background: var(--scan-fg); border-color: var(--scan-fg); color: var(--scan-bg); }
.sheet .btn.danger { color: #ff8b7e; }
.sroom { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: #1d2225; }
.sroom.current { outline: 2px solid #5fd08f; }
.sroom .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sroom .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sroom .acts .btn { min-height: 40px; padding: 0 12px; font-size: .85rem; flex: 1 1 auto; }
.scan .chip { background: #2a3033; color: #c4cbcf; }
.scan .chip.ok { background: rgba(95,208,143,.18); color: #7fe0a8; }
.scan .chip.warn { background: rgba(240,184,76,.18); color: #f3c66f; }
.scan .chip.bad { background: rgba(255,120,104,.18); color: #ff8b7e; }
.center-card { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px 16px; z-index: 4; background: var(--scan-bg); overflow: auto; }
.center-card > div { max-width: 420px; width: 100%; display: grid; gap: 16px; }
.center-card h2 { font-size: 1.5rem; }
.center-card .btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.center-card .btn { background: #22282b; border-color: #2c3337; color: var(--scan-fg); }
.center-card ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: #c4cbcf; }
.door-guide { position: absolute; left: 50%; top: 50%; width: 120px; height: 180px; transform: translate(-50%, -55%); border: 3px dashed rgba(255,255,255,.8); border-radius: 6px 6px 0 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 720px) { h1 { font-size: 2.3rem; } }

/* Auswahl nach einer kompletten Rundumsicht */
.donebar { position: absolute; left: 12px; right: 12px; top: calc(196px + var(--safe-t)); background: #1c1a19; color: var(--scan-fg); border: 1px solid #34302d; border-radius: 14px; padding: 14px; display: grid; gap: 10px; z-index: 3; max-width: 460px; margin: 0 auto; }
.donebar p { font-size: .92rem; color: #cfc9c2; }
.donebar .btn { min-height: 46px; background: #2a2725; border-color: #3a3633; color: var(--scan-fg); }
.donebar .btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }

/* Fortschrittsbalken (Verarbeitung, Teilen) */
.bar { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--signal); transition: width .5s; }
.share-locked { opacity: .45; pointer-events: none; }

/* Vermessung nach der Rundumsicht */
.donebar { max-height: calc(100% - 340px); overflow: auto; }
.plan-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; }
.plan-row canvas { width: 110px; height: 110px; }
.plan-row #measinfo { color: #cfc9c2; }
.suggest { display: grid; gap: 10px; }
.sug { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: #26221f; }
.sug p { font-size: .9rem; color: #e6e1db; }
.walkbar { position: absolute; left: 12px; right: 12px; bottom: calc(150px + var(--safe-b)); background: #1c1a19; color: var(--scan-fg); border: 1px solid #34302d; border-radius: 14px; padding: 14px; display: grid; gap: 10px; z-index: 3; max-width: 460px; margin: 0 auto; }
.walkbar p { font-size: 1rem; font-weight: 600; }
.walkbar .btn { min-height: 46px; background: #2a2725; border-color: #3a3633; color: var(--scan-fg); }
.walkbar .btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
