@font-face { font-family: 'Noto'; src: url('/fonts/noto-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* D28 Connect – Gestaltung
   Idee: Leuchtkasten. Kühles, helles Papier wie ein Befundmonitor, tiefes Petrol als Hauptfarbe,
   Bernstein nur für Dinge, die Aufmerksamkeit brauchen (Zähler, offene Aufgaben).
   Das Haus: Jede Etage (RG20, VRNZ, RadIni …) bringt ihre eigene Farbe mit (--floor, --floor-accent).
   Daraus werden Hauptfarbe, Flächen und ein leicht getöntes Papier abgeleitet – man merkt, auf welcher Etage man ist. */

:root {
  --paper: color-mix(in srgb, var(--floor) 5%, #f6f7f9);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #1a2233;
  --ink-2: #4a5568;
  --muted: #6e7889;
  --line: #dde2ea;
  --floor: #1f3346;
  --floor-accent: #16a37a;
  --petrol: var(--floor);
  --petrol-2: color-mix(in srgb, var(--floor) 80%, #ffffff);
  --petrol-soft: color-mix(in srgb, var(--floor) 11%, #ffffff);
  --floor-ink: #ffffff;
  --amber: #ee7203;
  --amber-ink: #8a3d00;
  --amber-soft: #fdeedf;
  --ok: #2f7d5b;
  --danger: #b4372f;
  --danger-soft: #f8e2e0;
  --film: #102b63;
  --radius-s: 3px;
  --radius-m: 6px;
  --radius-l: 10px;
  --shadow: 0 1px 2px rgba(22, 65, 148, .06), 0 4px 16px rgba(22, 65, 148, .05);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: color-mix(in srgb, var(--floor) 10%, #0b1120); --surface: #141d31; --surface-2: #1a2540; --ink: #e8ecf4; --ink-2: #b6c0d2; --muted: #8792a6;
    --line: #26324c; --petrol: color-mix(in srgb, var(--floor) 45%, #ffffff); --petrol-2: color-mix(in srgb, var(--floor) 30%, #ffffff); --petrol-soft: color-mix(in srgb, var(--floor) 35%, #141d31); --amber: #f28a2e; --amber-ink: #ffb877;
    --amber-soft: #3a2512; --danger: #ef7d73; --danger-soft: #3b1d1a; --film: #0a1a3d; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: color-mix(in srgb, var(--floor) 10%, #0b1120); --surface: #141d31; --surface-2: #1a2540; --ink: #e8ecf4; --ink-2: #b6c0d2; --muted: #8792a6;
    --line: #26324c; --petrol: color-mix(in srgb, var(--floor) 45%, #ffffff); --petrol-2: color-mix(in srgb, var(--floor) 30%, #ffffff); --petrol-soft: color-mix(in srgb, var(--floor) 35%, #141d31); --amber: #f28a2e; --amber-ink: #ffb877;
    --amber-soft: #3a2512; --danger: #ef7d73; --danger-soft: #3b1d1a; --film: #0a1a3d; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 'Noto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--petrol); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Grundgerüst ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
main.content { padding: 20px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 980px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 600; font-size: 1.05rem; flex: 1; display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 500; position: relative; }
.tabbar a[aria-current="page"] { color: var(--petrol); }
.tabbar svg, .side svg { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 248px 1fr; }
  .topbar, .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .side .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; padding: 4px 10px 22px; }
  .side .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .side a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 500; }
  .side a:hover { background: var(--surface-2); }
  .side a[aria-current="page"] { background: var(--petrol-soft); color: var(--petrol); }
  .side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
  .side .who { margin-top: auto; padding: 12px 10px 0; font-size: .85rem; color: var(--muted); }
  main.content { padding: 32px 40px 48px; }
}

.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--amber-ink); font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tabbar .count { position: absolute; top: 6px; left: 50%; margin-left: 6px; }
.side .count { margin-left: auto; }

/* ---------- Bausteine ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel, .stack > * + * { margin-top: 14px; }
.panel h2 { font-size: 1.05rem; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; color: inherit; text-decoration: none; width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
a.item:hover, button.item:hover { background: var(--surface-2); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 500; }
.item .sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-m);
  border: 1px solid transparent; background: var(--petrol); color: #fff; font: 500 .95rem/1 'Noto', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost):not(.soft):not(.danger) { color: #0b1630; } }
:root[data-theme="dark"] .btn:not(.ghost):not(.soft):not(.danger) { color: #0b1630; }
.btn:hover { background: var(--petrol-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--petrol); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--petrol-soft); color: var(--petrol); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .count { position: absolute; top: 2px; right: 0; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 7px; font: 500 .88rem 'Noto', sans-serif; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--petrol); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; font: 500 .95rem 'Noto', sans-serif; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--petrol); border-bottom-color: var(--petrol); }

/* Formulare */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .88rem; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
label.field > small { display: block; color: var(--muted); margin-top: 4px; }
input, select, textarea { width: 100%; font: 400 1rem 'Noto', system-ui, sans-serif; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 10px 12px; min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--petrol); flex: none; }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .wide { grid-column: 1 / -1; } }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-weight: 600; }

.error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 14px; font-size: .93rem; }
.note { background: var(--petrol-soft); color: var(--ink); border-radius: var(--radius-m); padding: 12px 14px; font-size: .93rem; }
.note.warn { background: var(--amber-soft); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.empty .btn { margin-top: 12px; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.petrol { background: var(--petrol-soft); color: var(--petrol); border-color: transparent; }
.tag.amber { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.amber { color: var(--amber); } }
:root[data-theme="dark"] .tag.amber { color: var(--amber); }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--petrol-soft); color: var(--petrol); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .9rem; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.3rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .75rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: .82rem; padding: 8px 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }

/* Dialog */
.overlay { position: fixed; inset: 0; background: rgba(8, 16, 20, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: var(--surface); width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; border-radius: var(--radius-l) var(--radius-l) 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: rise .2s ease-out; }
@media (min-width: 700px) { .overlay { align-items: center; } .dialog { border-radius: var(--radius-l); padding: 26px; } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Popup auf dem Startbildschirm */
.announce { border-left: 5px solid var(--amber); }
.announce h2 { font-size: 1.35rem; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--radius-m); z-index: 200; font-size: .93rem; max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; }
.auth .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth .logo img { width: 52px; height: 52px; border-radius: 14px; }
.auth .logo b { font-size: 1.3rem; display: block; }
.auth .legal { margin-top: 22px; font-size: .85rem; color: var(--muted); display: flex; gap: 16px; }
.qr { display: block; margin: 8px auto 12px; width: 200px; height: 200px; border-radius: var(--radius-m); background: #fff; padding: 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 600 1rem 'Noto', monospace; background: var(--surface-2); padding: 14px; border-radius: var(--radius-m); letter-spacing: .04em; }

/* ---------- Start ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { font-size: 1.6rem; }
.todo { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
@media (min-width: 700px) { .todo { grid-template-columns: repeat(4, 1fr); } }
.todo a { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.todo a b { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.todo a.hot { border-color: var(--amber); background: var(--amber-soft); }
.todo a span { font-size: .88rem; color: var(--ink-2); }

.date-chip { width: 54px; flex: none; text-align: center; border-radius: var(--radius-m); background: var(--petrol-soft); color: var(--petrol); padding: 6px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 1.25rem; }
.date-chip span { font-size: .72rem; font-weight: 500; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 150px - var(--nav-h)); min-height: 360px; }
@media (min-width: 900px) { .chat { height: calc(100dvh - 120px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 14px 2px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 82%; align-self: flex-start; }
.msg.me { align-self: flex-end; }
.bubble { background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--petrol); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.me .bubble { color: #0b1630; } }
:root[data-theme="dark"] .msg.me .bubble { color: #0b1630; }
.msg .meta { font-size: .74rem; color: var(--muted); margin: 2px 6px; }
.msg.me .meta { text-align: right; }
.msg .deleted { font-style: italic; color: var(--muted); }
.msg a.file { color: inherit; display: inline-flex; gap: 6px; align-items: center; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 44px; max-height: 160px; height: 44px; }
.day-sep { text-align: center; font-size: .78rem; color: var(--muted); margin: 10px 0 4px; }

/* ---------- Themen-Bubbles (das Herzstück) ---------- */
.bubbles { position: relative; background: var(--film); border-radius: var(--radius-l); min-height: 440px; overflow: hidden;
  background-image: radial-gradient(circle at 30% 20%, rgba(238, 114, 3, .14), transparent 55%); }
.bubbles canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.bubbles .legend { position: absolute; left: 14px; bottom: 12px; color: #a9bcc5; font-size: .8rem; pointer-events: none; }
.bubble-list { margin-top: 14px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.kpi b { display: block; font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.kpi span { color: var(--ink-2); font-size: .86rem; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 340px; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--petrol); border-radius: 5px; }
.bar-row .fill.amber { background: var(--amber); }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-note { font-size: .82rem; color: var(--muted); margin-top: 10px; }

/* Abstimmung */
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 8px; cursor: pointer; position: relative; overflow: hidden; }
.opt input { width: 20px; height: 20px; min-height: 0; accent-color: var(--petrol); flex: none; z-index: 1; }
.opt .res { position: absolute; inset: 0 auto 0 0; background: var(--petrol-soft); z-index: 0; }
.opt .lab { z-index: 1; flex: 1; }
.opt .num { z-index: 1; font-weight: 600; font-size: .9rem; }

.vote { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 56px; padding: 6px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 600 1rem 'Noto', sans-serif; color: var(--ink-2); }
.vote[aria-pressed="true"] { border-color: var(--petrol); color: var(--petrol); background: var(--petrol-soft); }
.vote svg { width: 18px; height: 18px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.small svg { width: 16px; height: 16px; }
.shell > div { min-width: 0; }
.item .check { min-width: 0; }
.btn { white-space: nowrap; }
.grid > *, .stack > * { min-width: 0; }

/* D28-Akzente */
.count { color: #fff; font-weight: 700; }
h1, h2 { font-weight: 700; }
.btn { font-weight: 600; letter-spacing: .01em; }
.topbar { border-bottom: 3px solid var(--amber); }
@media (min-width: 900px) { .side { border-right: 0; box-shadow: inset -1px 0 0 var(--line); } .side .brand img { width: 44px; height: 44px; border-radius: 0; } }
.brand img, .auth .logo img { border-radius: 0 !important; background: transparent; }
.side a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--amber); }
.tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--amber); }
.hello h1 { color: var(--petrol); }
.brand img, .side .brand img, .auth .logo img { width: auto !important; object-fit: contain; }
.topbar .brand img { height: 26px; }
.side .brand img { height: 36px !important; }
.auth .logo img { height: 52px; }

/* ---------- Chat: Bilder, Dateien, Reaktionen, Smileys, Gruppen ---------- */
.emo { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Noto', sans-serif; line-height: 1; }
.avatar.group { border-radius: 12px; background: var(--amber-soft); color: var(--amber); }
.avatar.group svg { width: 22px; height: 22px; }
.avatar.group.sm svg { width: 16px; height: 16px; }
.group-tag { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; font-size: .72rem; vertical-align: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .group-tag { color: var(--amber); } }
:root[data-theme="dark"] .group-tag { color: var(--amber); }
.chat-item.is-group { box-shadow: inset 3px 0 0 var(--amber); }
.seg .count { margin-left: 4px; vertical-align: 1px; }

.composer { position: relative; }
.msg-row { display: flex; align-items: center; gap: 4px; }
.msg.me .msg-row { flex-direction: row-reverse; }
.msg .meta.author { color: var(--petrol); font-weight: 600; }
.bubble.has-img { padding: 4px; }
.bubble.has-img .caption { padding: 6px 8px 4px; }
.msg-img { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.msg-img img { display: block; width: min(280px, 62vw); max-height: 340px; object-fit: cover; background: var(--surface-2); }
.file-card { display: flex; align-items: center; gap: 10px; min-width: min(240px, 60vw); padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: inherit; text-decoration: none; white-space: normal; }
.msg.me .file-card { background: rgba(255, 255, 255, .16); }
.file-card .grow { display: flex; flex-direction: column; min-width: 0; }
.file-card .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fsize { font-size: .78rem; opacity: .8; }
.file-card .file-ico, .file-card .file-dl { width: 26px; height: 26px; display: inline-flex; flex: none; }
.file-card .file-ico svg, .file-card .file-dl svg { width: 100%; height: 100%; }
.bubble + .react-btn, .react-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.react-btn svg { width: 20px; height: 20px; }
.msg:hover .react-btn, .react-btn:focus-visible { opacity: 1; }
.react-btn:hover { background: var(--surface-2); color: var(--petrol); }
@media (hover: none) { .react-btn { display: none; } }
@media (pointer: coarse) { .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: -7px 10px 0; position: relative; z-index: 1; }
.msg.me .reactions { justify-content: flex-end; }
.react-pill { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 8px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 .78rem 'Noto', sans-serif; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.react-pill .emo { font-size: 1rem; }
.react-pill.mine { border-color: var(--petrol); background: var(--petrol-soft); color: var(--petrol); }

.quick-reacts { display: flex; justify-content: space-between; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 4px 6px; }
.quick-reacts button { width: 46px; height: 46px; border: 0; border-radius: 50%; background: none; font-size: 1.75rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .12s; }
.quick-reacts button:hover { transform: scale(1.15); }
.quick-reacts button[aria-pressed="true"] { background: var(--petrol-soft); box-shadow: inset 0 0 0 2px var(--petrol); }
.quick-reacts .more-emo { font-size: 1rem; color: var(--ink-2); background: var(--surface); }
.quick-reacts .more-emo svg { width: 22px; height: 22px; }
@media (max-width: 380px) { .quick-reacts button { width: 40px; height: 40px; font-size: 1.5rem; } }
.react-who { margin-top: 10px; }
.react-who .item { padding: 6px 4px; }

.emoji-panel { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 8px; z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: 0 10px 30px rgba(10, 25, 60, .16); padding: 8px; }
.emoji-tabs { display: flex; gap: 2px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { flex: none; border: 0; background: none; border-radius: 8px; padding: 6px 9px; font-size: 1.25rem; cursor: pointer; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.emoji-tabs button[aria-selected="true"] { background: var(--petrol-soft); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); max-height: 230px; overflow-y: auto; }
.emoji-grid.inline { margin-top: 10px; max-height: 200px; }
.emoji-grid button { height: 42px; border: 0; background: none; border-radius: 8px; font-size: 1.55rem; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--surface-2); }

.lightbox { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; background: #05080f; color: #fff; animation: lbIn .15s ease-out; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox .lb-bar { display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; }
.lightbox .lb-bar .grow { flex: 1; min-width: 0; }
.lightbox .lb-bar .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox .iconbtn { color: #fff; width: 44px; height: 44px; }
.lightbox .iconbtn:hover { background: rgba(255, 255, 255, .12); }
.lightbox .lb-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; cursor: zoom-out; }
.lightbox .lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: default; touch-action: pinch-zoom; }
.lightbox .lb-caption { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); text-align: center; white-space: pre-wrap; }
.lightbox .lb-caption a { color: #9ec0ff; }


/* ---------- Das Haus: Etagen-Umschalter, Etiketten, Marktplatz ---------- */
.floor-logo { border-radius: 9px; object-fit: contain; background: #fff; flex: none; }
.floor-logo.mono { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; letter-spacing: .02em; }
.floor-tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 4px; font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); vertical-align: 2px; white-space: nowrap; }
.floor-tag.market { --c: #5b6b7d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .floor-tag { color: color-mix(in srgb, var(--c) 45%, #fff); } }
:root[data-theme="dark"] .floor-tag { color: color-mix(in srgb, var(--c) 45%, #fff); }

/* Aufzug: Liste der Etagen, oben der Marktplatz */
.elevator { display: flex; flex-direction: column; gap: 4px; }
.elevator button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-m);
  background: none; color: var(--ink-2); font: inherit; font-weight: 500; text-align: left; cursor: pointer; position: relative; }
.elevator button:hover { background: var(--surface-2); }
.elevator button[aria-current="true"] { background: var(--petrol-soft); color: var(--ink); border-color: color-mix(in srgb, var(--floor) 25%, transparent); }
.elevator button[aria-current="true"]::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--floor-accent); }
.elevator .lvl { font-size: .68rem; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.elevator .nm { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.elevator .nm b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elevator hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }
.side .elevator { margin-bottom: 8px; }
.side .brand { padding-bottom: 14px !important; }

.topbar { border-top: 3px solid var(--floor-accent); }
.floor-btn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: inherit; padding: 0; cursor: pointer; text-align: left; }
.floor-btn .nm { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.floor-btn .nm b { font-weight: 600; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.floor-btn .nm span { font-size: .75rem; color: var(--muted); }
.floor-btn .chev { width: 18px; height: 18px; color: var(--muted); transform: rotate(90deg); flex: none; }

/* Kopfbereich einer Etage bzw. des Marktplatzes */
.hall { position: relative; overflow: hidden; border-radius: var(--radius-l); padding: 22px 20px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, var(--floor) 0%, color-mix(in srgb, var(--floor) 70%, #000) 100%); }
.hall::after { content: ''; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--floor-accent) 60%, transparent) 0%, transparent 70%); opacity: .55; pointer-events: none; }
.hall .row { position: relative; z-index: 1; }
.hall h1 { margin: 0; font-size: 1.5rem; color: #fff; }
.hall p { margin: 4px 0 0; color: rgba(255, 255, 255, .82); }
.hall .kicker { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--floor-accent) 55%, #fff); }
.hall .btn.on-dark { color: #fff !important; background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .28); }
.hall .btn.on-dark:hover { background: rgba(255, 255, 255, .22); }

/* Etagen-Kacheln auf dem Marktplatz */
.floors { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 16px; }
.floor-card { --c: var(--petrol); display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius-l); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; cursor: pointer; position: relative; overflow: hidden; }
.floor-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.floor-card:hover { border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.floor-card .t { font-weight: 600; }
.floor-card .s { font-size: .85rem; color: var(--ink-2); }
.floor-card .meta { font-size: .8rem; color: var(--muted); margin-top: auto; display: flex; gap: 12px; }
.floor-card.locked { cursor: default; opacity: .7; }

/* Zimmer */
.room-ico { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: color-mix(in srgb, var(--c, var(--petrol)) 14%, var(--surface)); color: var(--c, var(--petrol)); }
.room-ico svg { width: 22px; height: 22px; }
.access { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--muted); }
.access svg { width: 13px; height: 13px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: var(--floor-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip[aria-pressed="true"] { color: #0b1120; } }
:root[data-theme="dark"] .chip[aria-pressed="true"] { color: #0b1120; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.join-bar { padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.readonly-bar { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .9rem; text-align: center; }

/* Push-Hinweis (Pflicht-Einrichtung, danach abwählbar) */
.push-banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius-m); margin-bottom: 14px;
  background: var(--amber-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.push-banner svg { width: 22px; height: 22px; color: var(--amber); flex: none; }
.push-steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 14px; }
.push-steps li { counter-increment: s; position: relative; padding: 6px 0 6px 34px; }
.push-steps li::before { content: counter(s); position: absolute; left: 0; top: 5px; width: 24px; height: 24px; border-radius: 50%; background: var(--petrol-soft); color: var(--petrol); font-weight: 700; font-size: .8rem; display: flex; align-items: center; justify-content: center; }

/* ---------- Veranstaltungen: Anmeldeformular und Übersicht ---------- */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.choice button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: var(--radius-m); border: 2px solid var(--line);
  background: var(--surface); color: var(--ink-2); font: 600 .98rem 'Noto', sans-serif; cursor: pointer; }
.choice button svg { width: 20px; height: 20px; }
.choice .yes[aria-checked="true"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.choice .no[aria-checked="true"] { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.fs { border: 0; padding: 0; margin: 0 0 14px; }
.fs legend { font-size: .9rem; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.reg-done { padding: 14px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface-2); }
.reg-done.zusage { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 9%, var(--surface)); }
.reg-done.zusage > b { color: var(--ok); }
.reg-done .small { margin-top: 4px; }
.kpi-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.kpi-btn.on { border-color: var(--petrol); box-shadow: inset 0 0 0 1px var(--petrol); }
.kpi-btn.warn b { color: var(--amber-ink); }
.kpi span { font-size: .85rem; color: var(--ink-2); }
.sub.remark { white-space: normal; font-style: italic; color: var(--ink-2); }
.form-editor { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.fe-block { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fe-custom { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.chip svg { width: 14px; height: 14px; flex: none; }
.partners { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 8px; }
.partner { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; color: inherit; background: var(--surface-2); }
.partner:hover { border-color: var(--petrol); }
.partner .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partner .sub { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
