/* bauenTek Meet — approved palette only: red #cc0000, black #1a1a1a, dark green #004d00 (plus neutrals). No blue. */
:root {
  --red: #cc0000;
  --black: #1a1a1a;
  --green: #004d00;
  --bg: #f4f4f2;
  --line: #d6d6d2;
  --muted: #6b6b66;
  --stage: #111;
  --tile: #2a2a2a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 "Segoe UI", Arial, sans-serif; color: var(--black); background: var(--bg); }
*:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin-top: 8px; }

.brand { font-size: 26px; font-weight: 600; margin-bottom: 6px; }
.brand.small { font-size: 18px; margin: 0; }
.b-bauen { color: var(--black); }
.b-tek { color: var(--red); }

.view { min-height: 100%; }
#view-login, #view-prejoin { display: flex; align-items: center; justify-content: center; padding: 20px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px 22px; }
.card.narrow { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 15px; margin: 0 0 10px; }
.card h2 + .row { margin-bottom: 18px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--black); min-width: 0; }
input:focus { border-color: var(--green); outline: none; }

.btn { font: inherit; padding: 8px 14px; border-radius: 5px; border: 1px solid var(--line); background: #fff; color: var(--black); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--black); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #003a00; }
.btn.link { border: none; background: none; color: var(--red); padding: 0 4px; }
.btn.dark { background: #333; color: #fff; border-color: #444; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.toggle.on { background: var(--green); color: #fff; border-color: var(--green); }
.btn:disabled { opacity: .5; cursor: default; }

.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.row.center { justify-content: center; margin-top: 12px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.lobby { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr); gap: 18px; padding: 22px; max-width: 1100px; margin: 0 auto; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } }
.meeting-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.meeting-item:first-child { border-top: none; }
.meeting-item .t { font-weight: 600; }
.meeting-item .p { font-size: 12px; color: var(--muted); }

.prejoin { width: 480px; max-width: 100%; }
.preview-wrap { position: relative; background: var(--stage); border-radius: 6px; aspect-ratio: 16/9; overflow: hidden; }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aaa; }

/* ---------- meeting ---------- */
#view-meeting { display: flex; flex-direction: column; height: 100vh; background: var(--stage); color: #eee; }
.mbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--black); border-bottom: 1px solid #333; }
.mtitle { font-weight: 600; }
.mbody { flex: 1; display: flex; min-height: 0; }
.mmain { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px; gap: 10px; }

.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.stage-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-tabs:empty { display: none; }
.stage-tabs button { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 4px; border: 1px solid #444; background: #222; color: #ddd; cursor: pointer; }
.stage-tabs button.active { background: var(--green); border-color: var(--green); color: #fff; }
.stage-box { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 6px; overflow: hidden; cursor: default; }
.stage-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pointer-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stage-hint { font-size: 12px; color: #999; min-height: 1.2em; }

.rptr { position: absolute; left: 0; top: 0; transition: transform 60ms linear, opacity 400ms; will-change: transform; }
.rptr svg { display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.rptr .lbl { position: absolute; left: 16px; top: 18px; padding: 1px 6px; border-radius: 3px; font-size: 12px; color: #fff; white-space: nowrap; border: 1px solid rgba(255,255,255,.7); }
.rptr.idle { opacity: .35; }
.ripple { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 3px solid; animation: rip 600ms ease-out forwards; }
@keyframes rip { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); grid-auto-rows: minmax(140px, 1fr); flex: 1; min-height: 0; overflow: auto; }
.stage:not(.hidden) ~ .tiles { flex: 0 0 140px; grid-auto-flow: column; grid-auto-columns: 200px; grid-template-columns: none; grid-auto-rows: 1fr; overflow-x: auto; overflow-y: hidden; }
.tile { position: relative; background: var(--tile); border-radius: 6px; overflow: hidden; border: 2px solid transparent; min-height: 0; }
.tile.speaking { border-color: var(--green); box-shadow: 0 0 0 2px #2e7d2e inset; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tile .avatar span { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; color: #fff; }
.tile .nm { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.6); padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tile .nm .mut { color: #ff6b6b; margin-left: 6px; }

.people { width: 240px; background: #1d1d1d; border-left: 1px solid #333; padding: 10px 12px; overflow: auto; }
.people h3 { font-size: 14px; margin: 0 0 8px; }
.people ul { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #2a2a2a; font-size: 13px; }
.people li .st { color: #999; font-size: 12px; }

.controls { display: flex; justify-content: center; gap: 8px; padding: 10px; background: var(--black); border-top: 1px solid #333; flex-wrap: wrap; }
.ctl { font: inherit; padding: 9px 16px; border-radius: 6px; border: 1px solid #444; background: #2b2b2b; color: #eee; cursor: pointer; }
.ctl:hover { border-color: #777; }
.ctl.on { background: var(--green); border-color: var(--green); color: #fff; }
.ctl.off { background: #3a1a1a; border-color: var(--red); color: #fff; }
.ctl.leave { background: var(--red); border-color: var(--red); color: #fff; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: var(--black); color: #fff; padding: 8px 16px; border-radius: 6px; z-index: 50; border: 1px solid #444; }
