:root {
  --bg: #ffffff;
  --bg2: #1b365d;
  --bg3: #f1f5f9;
  --prof: #132644;
  --input: #f8fafc;
  --txt: #1e293b;
  --head: #0f172a;
  --mut: #64748b;
  --acc: #1b365d;
  --acc2: #15294a;
  --acc3: #0f172a;
  --ok: #16a34a;
  --ok2: #15803d;
  --bad: #dc2626;
  --bad2: #b91c1c;
  --hov: rgba(255, 255, 255, 0.09);
  --sel: rgba(255, 255, 255, 0.18);
  --msg-hov: #f8fafc;
  --line: #e2e8f0;
  --border: #e2e8f0;
  --gold: #f59e0b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
::-webkit-scrollbar-track {
  background: transparent;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 3px;
  background: var(--acc);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  transition: background 0.12s, color 0.12s;
}
button:hover {
  background: var(--acc2);
}
button:active {
  background: var(--acc3);
}

button.ghost {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
}
button.ghost:hover {
  background: #e2e8f0;
  color: #0f172a;
}

button.danger {
  background: var(--bad);
}
button.danger:hover {
  background: var(--bad2);
}

button.on {
  background: var(--ok);
}
button.on:hover {
  background: var(--ok2);
}

.btn-primary {
  background: var(--acc);
  color: #fff;
  border: 0;
  border-radius: 3px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover {
  background: var(--acc2);
}
.btn-primary:active {
  background: var(--acc3);
}

.btn-icon {
  background: transparent;
  border: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b5bac1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover {
  background: var(--hov);
  color: var(--head);
}
.btn-icon.logout:hover {
  color: var(--bad);
}

input, textarea {
  background: var(--bg3);
  border: 1px solid var(--bg3);
  border-radius: 3px;
  padding: 10px;
  outline: 0;
  width: 100%;
  color: var(--txt);
  transition: border-color 0.15s;
}
input:focus, textarea:focus {
  border-color: var(--acc);
}
::placeholder {
  color: #6d6f78;
}

.ico {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ---------- Login / Auth ---------- */
.auth {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--acc);
}

.auth-card, .card {
  background: var(--bg);
  border-radius: 5px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  color: var(--head);
  text-align: center;
}

.card p {
  color: var(--mut);
  margin: 0 0 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

.card .row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.card .row > * {
  flex: 1;
}

.field {
  margin-bottom: 16px;
  text-align: left;
}
.field label {
  display: block;
  margin-bottom: 8px;
  color: #b5bac1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.tabs button {
  flex: 1;
  height: 38px;
  background: transparent;
  color: var(--mut);
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #3f4147;
}
.tabs button:hover {
  background: var(--hov);
  color: var(--txt);
}
.tabs button.sel {
  background: var(--sel);
  color: #fff;
  border-color: var(--acc);
}

.token {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
  background: var(--bg3);
  border: 1px solid var(--prof);
  padding: 14px;
  border-radius: 4px;
  user-select: all;
  color: var(--head);
  text-align: center;
  letter-spacing: 0.04em;
}

.warn {
  background: rgba(240, 178, 50, 0.1);
  border-left: 4px solid var(--gold);
  padding: 10px 14px;
  margin: 16px 0;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gold);
  line-height: 1.4;
  text-align: left;
}

.err {
  color: #fa777c;
  margin-top: 10px;
  min-height: 1.2em;
  font-size: 14px;
  text-align: center;
}

/* ---------- Shell Layout ---------- */
.shell {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ---------- Links: Sidebar ---------- */
.side {
  width: 260px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  flex: none;
  z-index: 2;
  color: #f1f5f9;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.side-head {
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #15294a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex: none;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.side-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}
.side-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-sub {
  font-size: 11px;
  color: #93c5fd;
  font-weight: 500;
}
.side-head .btn-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.side-head .btn-icon:hover {
  background: rgba(255, 255, 255, 0.22);
}

.list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.empty-list {
  padding: 24px 8px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: #cbd5e1;
  height: 42px;
  margin-bottom: 2px;
  transition: background 0.1s, color 0.1s;
}
.item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.item.sel {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-left: 3px solid #f59e0b;
}

.item .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
}

.chan-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex: none;
}
.item:hover .chan-icon {
  color: #ffffff;
}
.item.sel .chan-icon {
  color: #f59e0b;
}

.live {
  color: var(--ok);
  display: flex;
  align-items: center;
}

.badge {
  background: var(--bad);
  color: #fff;
  border-radius: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
  flex: none;
}

/* ---------- Avatare ---------- */
.av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex: none;
  position: relative;
  user-select: none;
}
.av.av-0 { background: #1b365d; }
.av.av-1 { background: #16a34a; }
.av.av-2 { background: #0284c7; }
.av.av-3 { background: #d97706; }
.av.av-4 { background: #4f46e5; }
.av.g { background: #64748b; }

.av i {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  border: 3px solid var(--bg2);
  box-sizing: content-box;
}
.av i.on {
  background: var(--ok);
}

/* Profilleiste (unten links) */
.me {
  background: var(--prof);
  padding: 0 12px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.me .av i {
  border-color: var(--prof);
}
.me .nm {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
  min-width: 0;
}
.me small {
  color: #86efac;
  display: block;
  font-weight: 500;
  font-size: 11px;
}
.me .btn-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.me .btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
.me .btn-icon.logout:hover {
  background: #dc2626;
  color: #ffffff;
}

/* ---------- Mitte: Hauptbereich ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

.top {
  height: 54px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  flex: none;
  z-index: 3;
}

.top-title {
  font-size: 16px;
  font-weight: 700;
  color: #1b365d;
}

.top-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.top-icon {
  color: #1b365d;
  display: flex;
  align-items: center;
}
.top .t {
  font-weight: 700;
  font-size: 16px;
  color: #1b365d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-sep {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 8px;
  flex-shrink: 0;
}
.top-sub {
  color: #64748b;
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.top-actions button {
  height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.top-actions button:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.top-actions button.on {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}
.top-actions button.on:hover {
  background: #bbf7d0;
}
.ttl-label {
  font-size: 12px;
}

.top .menu {
  display: none;
  margin-right: 8px;
}

.body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

/* ---------- Nachrichtenliste ---------- */
.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 0;
  background: #ffffff;
}

.welcome-channel {
  padding: 24px 20px 16px;
  margin-bottom: 8px;
}
.chan-big-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1b365d;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.chan-big-icon svg {
  width: 32px;
  height: 32px;
}
.welcome-channel h2 {
  font-size: 24px;
  font-weight: 800;
  color: #1b365d;
  margin: 0 0 6px;
  line-height: 1.2;
}
.welcome-channel p {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.welcome-hero {
  margin: auto;
  max-width: 440px;
  text-align: center;
  padding: 32px 16px;
}
.hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #1b365d;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.hero-icon svg {
  width: 34px;
  height: 34px;
}
.welcome-hero h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1b365d;
  margin: 0 0 8px;
}
.welcome-hero p {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 8px;
  line-height: 1.5;
}
.hero-sub {
  font-size: 13px !important;
  color: #94a3b8 !important;
}

.msg {
  position: relative;
  display: flex;
  padding: 4px 20px;
  margin-top: 14px;
  min-height: 44px;
}
.msg:hover {
  background: #f8fafc;
}
.msg.cont {
  margin-top: 0;
  min-height: 22px;
  padding-top: 1px;
  padding-bottom: 1px;
}

.msg-gutter {
  width: 38px;
  margin-right: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.msg .av.sm {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.msg.cont .msg-gutter {
  justify-content: flex-end;
  align-items: center;
}
.cont-time {
  display: none;
  font-size: 11px;
  color: var(--mut);
  line-height: 22px;
  user-select: none;
}
.msg.cont:hover .cont-time {
  display: block;
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg .h {
  line-height: 1.375;
  margin-bottom: 2px;
}
.msg .author {
  font-size: 15px;
  font-weight: 700;
  color: #1b365d;
  cursor: pointer;
}
.msg .author:hover {
  text-decoration: underline;
}
.msg .h small {
  color: var(--mut);
  font-weight: 400;
  margin-left: 8px;
  font-size: 12px;
}

.msg .tx {
  font-size: 15px;
  line-height: 1.5;
  color: var(--txt);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg .tx.bad {
  color: var(--mut);
  font-style: italic;
}

.msg .x {
  position: absolute;
  right: 20px;
  top: -14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  height: 30px;
  display: none;
  align-items: center;
  z-index: 5;
}
.msg:hover .x {
  display: flex;
}
.msg .x button {
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  color: #64748b;
  border: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg .x button:hover {
  background: #fee2e2;
  color: #dc2626;
}

.sys {
  text-align: center;
  color: var(--mut);
  font-size: 13px;
  margin: 12px 16px;
}

/* Composer / Eingabefeld */
.comp {
  padding: 0 20px 20px;
  background: #ffffff;
}
.comp textarea {
  resize: none;
  height: 46px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 12px 16px;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.comp textarea:focus {
  border-color: #1b365d;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(27, 54, 93, 0.1);
}
.typing {
  height: 22px;
  padding: 0 20px;
  font-size: 12px;
  color: var(--mut);
  font-weight: 500;
}

/* ---------- Rechts: Mitgliederliste ---------- */
.members {
  width: 240px;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 16px 8px 8px;
  flex: none;
}
.members h3 {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 8px 6px;
  margin: 0;
}
.member-card {
  margin-bottom: 2px;
}
.member-card .item {
  color: #334155;
  height: 40px;
}
.member-card .item:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.crown {
  color: var(--gold);
  display: flex;
  align-items: center;
  margin-left: 4px;
}
.fp {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: #475569;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 8px;
  margin: 2px 8px 8px;
  word-break: break-all;
}
.fp-info {
  font-size: 11px;
  color: #64748b;
  padding: 4px 8px 12px;
  line-height: 1.3;
}
.rename-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1b365d;
  padding: 6px 12px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  margin: 0 8px;
  font-weight: 600;
  cursor: pointer;
}
.rename-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ---------- Call-Ansicht & Videokonferenz ---------- */
.call {
  background: #090d16;
  border-bottom: 2px solid #1e293b;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: none;
  max-height: 60%;
  position: relative;
  transition: all 0.25s ease-in-out;
}

.call.full {
  position: fixed;
  inset: 0;
  z-index: 9999;
  max-height: 100vh;
  height: 100vh;
  width: 100vw;
  border-bottom: none;
  padding: 16px 24px 20px;
}

/* Call Header */
.call-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.call-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.call-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
}

.call-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: callDotPulse 1.6s infinite ease-out;
}

@keyframes callDotPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.call-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.call-badge.timer {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  font-family: ui-monospace, Consolas, monospace;
}

.call-badge.enc {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.call-head-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.call-head-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Call PiP Bar */
.call-pip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border-radius: 6px;
  padding: 10px 16px;
  border: 1px solid #334155;
  color: #f8fafc;
}

.call-pip-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  margin-right: 10px;
  animation: callDotPulse 1.6s infinite ease-out;
}

.call-pip-text {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.call-pip-btn {
  background: #16a34a;
  color: #fff;
  border: 0;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.call-pip-btn:hover {
  background: #15803d;
}

/* Call Grid */
.grid {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  align-content: center;
  justify-content: center;
}

.grid[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.grid[data-count="3"],
.grid[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}

.grid[data-count="5"],
.grid[data-count="6"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

/* Participant Tile */
.tile {
  position: relative;
  background: #0f172a;
  border-radius: 12px;
  aspect-ratio: 16/9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1e293b;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tile.tile-screen {
  aspect-ratio: 16/10;
}

.tile.speaking {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35), 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.tile.tile-screen video {
  object-fit: contain;
}

.tile.voice video {
  display: none;
}

.tile .av {
  width: 84px;
  height: 84px;
  font-size: 34px;
  font-weight: 700;
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tile.speaking .av {
  transform: scale(1.08);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.5), 0 0 24px rgba(34, 197, 94, 0.4);
  animation: tileAvatarPulse 1.2s infinite alternate ease-in-out;
}

@keyframes tileAvatarPulse {
  0% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4), 0 0 16px rgba(34, 197, 94, 0.3); }
  100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.7), 0 0 28px rgba(34, 197, 94, 0.6); }
}

.tile:not(.voice) .av {
  display: none;
}

/* Tile Bottom Label */
.tile .lb {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lb-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Audio wave animation on tile label */
.audio-wave {
  display: none;
  align-items: center;
  gap: 2px;
  height: 12px;
}

.tile.speaking .audio-wave {
  display: inline-flex;
}

.audio-wave .bar {
  width: 2px;
  height: 4px;
  background: #22c55e;
  border-radius: 1px;
}

.tile.speaking .audio-wave .bar:nth-child(1) {
  animation: wavePulse 0.5s infinite alternate ease-in-out;
}
.tile.speaking .audio-wave .bar:nth-child(2) {
  animation: wavePulse 0.7s infinite alternate ease-in-out 0.15s;
}
.tile.speaking .audio-wave .bar:nth-child(3) {
  animation: wavePulse 0.6s infinite alternate ease-in-out 0.3s;
}

@keyframes wavePulse {
  0% { height: 3px; }
  100% { height: 12px; }
}

.tile-mic-status {
  display: none;
  color: #ef4444;
}

.tile.mic-muted .tile-mic-status {
  display: inline-flex;
  align-items: center;
}

/* Call Controls */
.ctl {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 6px 0 2px;
  flex-wrap: wrap;
}

.ctl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 64px;
  height: 52px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.ctl-btn:hover {
  background: #334155;
  color: #ffffff;
  transform: translateY(-1px);
}

.ctl-btn.ctl-active {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.ctl-btn.ctl-active:hover {
  background: rgba(34, 197, 94, 0.3);
}

.ctl-btn.ctl-active.screen-on {
  background: rgba(2, 132, 199, 0.2);
  border-color: #0284c7;
  color: #38bdf8;
}

.ctl-btn.danger {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #fca5a5;
}

.ctl-btn.danger:hover {
  background: #ef4444;
  color: #ffffff;
}

.ctl-btn.ctl-leave {
  min-width: 72px;
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.ctl-btn.ctl-leave:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.ctl-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Call Banner in Chat */
.call-banner {
  margin: 12px 20px 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #1b365d 0%, #0f172a 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(27, 54, 93, 0.15);
}

.cb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cb-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: callDotPulse 1.6s infinite ease-out;
  flex: none;
}

.cb-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.cb-info small {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 1px;
}

.cb-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.cb-btn.cb-voice {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.cb-btn.cb-voice:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cb-btn.cb-video {
  background: #16a34a;
  border: 1px solid #16a34a;
  color: #ffffff;
}

.cb-btn.cb-video:hover {
  background: #15803d;
}

/* Sidebar Live Call Badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: callDotPulse 1.6s infinite ease-out;
}

.live-count {
  font-size: 11px;
}

/* ---------- Modale Dialoge ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 24px 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  color: #0f172a;
}
.modal-card h1 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  color: #1b365d;
}
.modal-card input {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  border-radius: 4px;
}
.modal-card input:focus {
  border-color: #1b365d;
  background: #ffffff;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.modal-footer .btn-primary {
  width: auto;
  padding: 8px 24px;
}
.chk {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--txt);
  cursor: pointer;
  user-select: none;
}
.chk input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Toast & Lock */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111214;
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  z-index: 1000;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.lock {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  text-align: center;
}

.members.hide {
  display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .members {
    display: none !important;
  }
}
@media (max-width: 600px) {
  .grid[data-count="2"],
  .grid[data-count="3"],
  .grid[data-count="4"],
  .grid[data-count="5"],
  .grid[data-count="6"] {
    grid-template-columns: 1fr;
  }
  .call {
    max-height: 70%;
    padding: 10px 10px 14px;
  }
  .call-head-left {
    gap: 8px;
  }
  .ctl-btn {
    min-width: 52px;
    height: 48px;
    padding: 4px 8px;
  }
  .ctl-label {
    font-size: 10px;
  }
  .call-banner {
    flex-direction: column;
    align-items: stretch;
    margin: 10px 12px;
  }
  .cb-actions {
    justify-content: flex-end;
  }
}
@media (max-width: 560px) {
  .top .menu {
    display: inline-flex !important;
  }
  .side {
    position: absolute;
    z-index: 100;
    height: 100%;
    width: 260px;
    max-width: 85%;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
  }
  .side.hide {
    display: none !important;
  }
}

/* ==========================================================================
   Schul-Webseite (Tarnseite: OWT-Schule / Schulportal)
   ========================================================================== */
.sch-root {
  min-height: 100%;
  background: #f8fafc;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.sch-wrap {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Navigation */
.sch-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex: none;
}
.sch-topbar {
  background: #0f172a;
  color: #94a3b8;
  font-size: 13px;
  padding: 6px 0;
}
.sch-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.sch-navbar {
  padding: 12px 0;
}
.sch-navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.sch-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.sch-brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
}
.sch-brand svg {
  width: 38px;
  height: 38px;
  color: #1b365d;
}
.sch-brand-title {
  font-size: 22px;
  font-weight: 700;
  color: #1b365d;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.sch-brand-sub {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.sch-navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sch-navbtn {
  background: transparent;
  border: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sch-navbtn:hover {
  background: #f1f5f9;
  color: #1b365d;
}
.sch-navbtn.active {
  color: #1b365d;
  background: #e2e8f0;
}
.sch-portal-btn {
  background: #1b365d;
  color: #ffffff;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.sch-portal-btn:hover {
  background: #15294a;
}

/* Hero */
.sch-hero {
  background: #1b365d;
  color: #ffffff;
  padding: 40px 0;
  border-bottom: 4px solid #0284c7;
}
.sch-hero-media {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 32px;
  align-items: center;
}
.sch-hero-photo-wrap {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.sch-hero-photo {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}
.sch-hero-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.9));
  color: #f1f5f9;
  font-size: 12px;
  padding: 14px 12px 6px;
}
.sch-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.sch-hero h1 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 12px;
  color: #ffffff;
}
.sch-hero p {
  font-size: 15px;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0 0 20px;
}
.sch-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Content Grid */
.sch-main {
  flex: 1;
  padding-bottom: 48px;
}
.sch-content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-top: 36px;
}
.sch-sec-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
}

/* Grußwort Schulleitung Card */
.sch-lead-card {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 5px solid #1b365d;
  border-radius: 6px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.sch-lead-avatar {
  width: 140px;
  height: auto;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.sch-lead-body {
  flex: 1;
}
.sch-lead-body h3 {
  font-size: 19px;
  font-weight: 700;
  color: #1b365d;
  margin: 0 0 4px;
}
.sch-lead-subtitle {
  font-size: 13px;
  color: #0284c7;
  font-weight: 600;
  margin-bottom: 10px;
}
.sch-lead-body p {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 10px;
}
.sch-lead-sig {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
  margin-top: 12px;
}

/* Cards & Images */
.sch-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sch-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1b365d;
  margin: 0 0 8px;
}
.sch-card p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 8px;
}
.sch-card p:last-child {
  margin-bottom: 0;
}
.sch-article-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
  display: block;
  background: #f1f5f9;
}
.sch-article-caption {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  margin: -8px 0 12px;
}
.sch-poster-img {
  width: 100%;
  border-radius: 4px;
  margin: 10px 0 8px;
  border: 1px solid #e2e8f0;
  display: block;
}
.sch-meta {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 6px;
}
.sch-portal-card {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.sch-portal-card h3 {
  color: #166534;
}
.sch-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.sch-list li {
  font-size: 13px;
  color: #334155;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.sch-list li:last-child {
  border-bottom: 0;
}

/* Buttons */
.sch-btn-pri {
  background: #1b365d;
  color: #ffffff;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.sch-btn-pri:hover {
  background: #15294a;
}
.sch-btn-pri.full {
  width: 100%;
}
.sch-btn-sec {
  background: #ffffff;
  color: #1b365d;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}
.sch-btn-sec:hover {
  background: #f1f5f9;
}
.sch-link-btn {
  background: transparent;
  border: 0;
  color: #0284c7;
  font-size: 14px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* Footer */
.sch-footer {
  background: #0f172a;
  color: #94a3b8;
  margin-top: auto;
  border-top: 1px solid #1e293b;
  font-size: 13px;
}
.sch-footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  padding: 36px 16px;
}
.sch-footer-col h4 {
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}
.sch-footer-col p {
  margin: 0 0 6px;
  line-height: 1.5;
}
.sch-footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 14px 0;
  font-size: 12px;
  text-align: center;
}
.sch-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sch-footer-btn {
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
  transition: color 0.15s;
}
.sch-footer-btn:hover {
  color: #ffffff;
}
.sch-sep {
  color: #475569;
  font-size: 12px;
}

/* Schulportal Login Page */
.sch-login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.sch-login-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 480px;
  padding: 32px;
}
.sch-login-head {
  text-align: center;
  margin-bottom: 24px;
}
.sch-login-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin-bottom: 8px;
}
.sch-login-head svg {
  width: 48px;
  height: 48px;
  color: #1b365d;
  margin-bottom: 8px;
}
.sch-login-head h2 {
  font-size: 24px;
  font-weight: 800;
  color: #1b365d;
  margin: 0;
}
.sch-login-portal-title {
  font-size: 15px;
  font-weight: 600;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.sch-login-head p {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 0;
}
.sch-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}
.sch-tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.sch-tabs button:hover {
  color: #1b365d;
  background: #f1f5f9;
}
.sch-tabs button.sel {
  color: #1b365d;
  background: #e2e8f0;
}
.sch-subtext {
  font-size: 14px;
  color: #475569;
  margin: 0 0 16px;
  line-height: 1.5;
}
.sch-field {
  margin-bottom: 16px;
}
.sch-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.sch-input {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 15px;
  color: #0f172a;
  width: 100%;
}
.sch-input:focus {
  border-color: #1b365d;
  background: #ffffff;
}
.sch-actions {
  margin-top: 20px;
}
.sch-actions.row {
  display: flex;
  gap: 12px;
}
.sch-actions.row > * {
  flex: 1;
}
.sch-token-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 12px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  color: #0f172a;
  text-align: center;
  word-break: break-all;
  user-select: all;
  margin-bottom: 12px;
}
.sch-notice {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #92400e;
  padding: 10px 12px;
  font-size: 12px;
  border-radius: 3px;
  line-height: 1.4;
  margin-bottom: 16px;
}
.sch-err {
  color: #dc2626;
  font-size: 13px;
  margin-top: 10px;
  min-height: 1.2em;
  text-align: center;
}
.sch-back-link {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}

@media (max-width: 860px) {
  .sch-hero-media {
    grid-template-columns: 1fr;
  }
  .sch-content-grid {
    grid-template-columns: 1fr;
  }
  .sch-hero h1 {
    font-size: 26px;
  }
  .sch-lead-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .sch-lead-avatar {
    width: 130px;
  }
}
