/* Design „Czauderna.de“: schlesisches Blau und Gold, Glasflächen, große Rundungen.
   Hell/Dunkel: Systemeinstellung, außer das Gerät hat eine Wahl gespeichert (data-theme, siehe theme.js). */
:root {
  --blue: #0055a5;
  --darkblue: #003366;
  --gold: #ffc72c;
  --darkgold: #d49b00;
  --sky: #38bdf8;
  --green: #10b981;
  --gradient: linear-gradient(135deg, #0055a5 0%, #002244 100%);

  --bg: #f8fafc;
  --canvas: #f1f5f9;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, .78);
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0055a5;
  --accent-text: #ffffff;
  --accent-soft: rgba(0, 85, 165, .1);
  --danger: #dc2626;
  --mine: #e3eefa;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --g-m: #2f6fb7;
  --g-f: #c2417a;
  --g-d: #8a63b8;
  --g-u: #94a3b8;
  --radius: 16px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #020617; --canvas: #070d1f; --surface: #0f172a; --glass: rgba(15, 23, 42, .78);
    --text: #f1f5f9; --muted: #94a3b8; --line: #1e293b;
    --accent: #ffc72c; --accent-text: #003366; --accent-soft: rgba(255, 199, 44, .12);
    --danger: #f87171; --mine: #13325a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --g-m: #60a5fa; --g-f: #f472b6; --g-d: #c4b5fd; --g-u: #64748b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #020617; --canvas: #070d1f; --surface: #0f172a; --glass: rgba(15, 23, 42, .78);
  --text: #f1f5f9; --muted: #94a3b8; --line: #1e293b;
  --accent: #ffc72c; --accent-text: #003366; --accent-soft: rgba(255, 199, 44, .12);
  --danger: #f87171; --mine: #13325a; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --g-m: #60a5fa; --g-f: #f472b6; --g-d: #c4b5fd; --g-u: #64748b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2 { margin: 0 0 .5rem; font-weight: 750; letter-spacing: -.02em; }
/* Gold auf hellem Grund dunkler (Lesbarkeit), auf Blau bzw. im Dunkelmodus das helle Gold */
.gold { color: var(--darkgold); }
.hero .gold, :root[data-theme="dark"] .gold { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gold { color: var(--gold); } }
@media (max-width: 900px) { .topbar .gold { color: var(--gold); } }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.15em; height: 1.15em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9;
     stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
/* Hell/Dunkel-Symbole: zeigt jeweils das zum Umschalten passende */
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .only-dark { display: inline; }
  :root:not([data-theme]) .only-light { display: none; }
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.15rem; margin-top: 1.5rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 0; }
[hidden] { display: none !important; }

input, textarea, select, button {
  font: inherit; color: inherit;
}
input, textarea, select {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--canvas);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; }
label { display: block; font-size: .9rem; color: var(--muted); }
label input, label select, label textarea { margin-top: .25rem; color: var(--text); }
label.check { display: flex; align-items: center; gap: .45rem; color: var(--text); cursor: pointer; }
label.check input { width: auto; margin: 0; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.1rem; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-weight: 650;
  transition: background-color .15s, opacity .15s, box-shadow .15s;
}
button:hover { opacity: .92; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.ghost:hover { background: var(--accent-soft); opacity: 1; }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); font-weight: 500; }
button.wide { width: 100%; margin-top: 1rem; }
button.tiny { padding: .25rem .6rem; font-size: .8rem; }

.stack { display: grid; gap: .9rem; }
.row { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }

/* Anmeldung */
#view-auth { min-height: 100%; display: grid; place-items: center; padding: 1rem; background: var(--gradient); }
.auth-card {
  width: min(430px, 100%); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 199, 44, .3); border-radius: 24px; padding: 2rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .45);
}
.auth-brand { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.auth-brand img { width: 64px; height: 64px; border-radius: 16px; background: #fff; padding: 4px; }
.auth-card h1 { margin: 0; font-size: 1.7rem; }
.auth-card > .muted { margin: 0 0 1.4rem; }
.tagline { display: flex; align-items: center; gap: .35rem; font-size: .66rem; font-weight: 650; letter-spacing: .12em;
           text-transform: uppercase; color: var(--muted); margin: 0; }
.tagline .dot { width: .38rem; height: .38rem; border-radius: 50%; background: var(--gold); display: inline-block; }

/* Hauptansicht: Kopfzeile aus Glas */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .7rem max(1.2rem, env(safe-area-inset-left)); padding-top: max(.7rem, env(safe-area-inset-top));
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .3rem; border-radius: 14px; background: transparent; color: var(--text); text-align: left; }
.brand:hover { opacity: 1; background: var(--accent-soft); }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--gradient); display: grid; place-items: center;
              border: 1px solid rgba(255, 199, 44, .35); box-shadow: 0 6px 16px rgba(0, 85, 165, .25); flex-shrink: 0; }
.brand-mark img { width: 30px; height: 38px; object-fit: contain; }
.brand-text { display: grid; gap: .1rem; }
.brand-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }

/* Familienwappen */
.content:has(> #tab-crest:not([hidden])) { max-width: 1000px; }
.crest { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 2rem; align-items: start; }
.crest-figure { margin: 0; position: sticky; top: 4.5rem; }
.crest-figure img { display: block; width: 100%; height: auto; }
.crest-text { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; line-height: 1.6; }
.crest-text h2 { font-size: 1.4rem; margin-top: 0; }
.crest-text h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.crest-text p { margin: 0; }
.crest-text ul { margin: 0; padding-left: 1.2rem; }
.crest-text li { margin: .35rem 0; }
.crest-text li ul { margin-top: .3rem; }
@media (max-width: 760px) {
  .crest { grid-template-columns: 1fr; gap: 1rem; }
  .crest-figure { position: static; max-width: 340px; margin: 0 auto; }
  .crest-text { padding: 1rem 1.1rem; }
}
.tabs { display: flex; gap: .2rem; flex: 1; justify-content: center; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); font-weight: 550; font-size: .92rem; padding: .5rem .85rem; border-radius: 11px; }
.tabs button:hover { background: var(--accent-soft); color: var(--text); opacity: 1; }
.tabs button.active { background: var(--accent-soft); color: var(--accent); }
.badge {
  display: inline-block; min-width: 1.2em; padding: 0 .35em; margin-left: .1em;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.5;
}
.user-menu { display: flex; gap: .5rem; align-items: center; }
.icon-btn { width: 42px; height: 42px; padding: 0; border-radius: 12px; background: var(--canvas); color: var(--text); border: 1px solid var(--line); }
.icon-btn .i { width: 1.25rem; height: 1.25rem; }
:root[data-theme="dark"] .icon-btn { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-btn { color: var(--gold); } }
.avatar { width: 42px; height: 42px; padding: 0; border-radius: 12px; background: var(--gold); color: var(--darkblue);
          font-weight: 800; font-size: .92rem; border: 2px solid var(--surface); box-shadow: var(--shadow); }
.avatar.big { display: grid; place-items: center; width: 48px; height: 48px; font-size: 1.05rem; flex-shrink: 0; }

/* App-Leiste unten – nur auf dem Handy sichtbar */
.bottom-nav { display: none; }

.content { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.2rem 2rem; }
#tab-log, #tab-members, #tab-admin, #tab-calls { max-width: 780px; margin: 0 auto; }
h2.section-title { font-size: 1.2rem; margin: 0 0 .8rem; }

/* Glas-Karten (gemeinsamer Stil der Flächen) */
.composer, .post, .messages, .tree-canvas, .tree-panel, .crest-text, .log-item, .list li, .side-card, .widget {
  box-shadow: var(--shadow);
}

/* Übersicht: Banner */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 2.6rem 2.6rem 2rem;
  background: var(--gradient); color: #fff; border: 1px solid rgba(255, 199, 44, .2);
  box-shadow: 0 25px 50px -12px rgba(0, 51, 102, .45); margin-bottom: 1.6rem;
}
.hero-crest { position: absolute; right: -40px; bottom: -70px; width: 360px; height: auto; opacity: .16; pointer-events: none; }
.hero-body { position: relative; max-width: 760px; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; margin-bottom: 1rem;
              background: rgba(255, 199, 44, .18); border: 1px solid rgba(255, 199, 44, .35); color: var(--gold); font-size: .78rem; font-weight: 650; }
.hero h1 { font-size: clamp(1.7rem, 3.4vw, 2.8rem); line-height: 1.12; margin: 0 0 .8rem; color: #fff; }
.hero p { color: #dbe4f0; font-size: 1.05rem; margin: 0 0 1.6rem; max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.gold-btn { background: var(--gold); color: var(--darkblue); padding: .8rem 1.4rem; box-shadow: 0 10px 24px rgba(255, 199, 44, .25); }
.gold-btn:hover { background: var(--darkgold); opacity: 1; }
.glass-btn { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .22); padding: .8rem 1.4rem; font-weight: 600; }
.glass-btn:hover { background: rgba(255, 255, 255, .2); opacity: 1; }
.hero-stats { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem;
              margin-top: 2.2rem; padding-top: 1.6rem; border-top: 1px solid rgba(255, 255, 255, .12); }
.hero-stats strong { display: block; font-size: 1.6rem; color: var(--gold); line-height: 1.2; }
.hero-stats span { font-size: .78rem; color: #cbd5e1; }

/* Übersicht: Kacheln */
.widgets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-bottom: 1.8rem; }
.widget {
  display: grid; gap: .55rem; align-content: start; text-align: left; padding: 1.4rem; border-radius: 20px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--blue); font-weight: 400;
}
.widget:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(15, 23, 42, .1); }
.widget strong { font-size: 1.08rem; }
.widget-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.widget-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: rgba(0, 85, 165, .1); color: var(--blue); }
.widget-icon .i { width: 1.4rem; height: 1.4rem; }
.pill { font-size: .72rem; font-weight: 650; padding: .2rem .65rem; border-radius: 999px; background: rgba(255, 199, 44, .2); color: var(--darkblue); }
.widget-link { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; color: var(--accent); margin-top: .2rem; }
.widget.w-gold { border-left-color: var(--gold); }
.widget.w-gold .widget-icon { background: rgba(255, 199, 44, .15); color: var(--darkgold); }
.widget.w-gold .pill { background: rgba(0, 85, 165, .1); color: var(--blue); }
.widget.w-green { border-left-color: var(--green); }
.widget.w-green .widget-icon { background: rgba(16, 185, 129, .12); color: var(--green); }
.widget.w-green .pill { background: rgba(16, 185, 129, .12); color: #047857; }
:root[data-theme="dark"] .pill { color: var(--gold); }
:root[data-theme="dark"] .widget-icon { color: var(--sky); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill { color: var(--gold); }
  :root:not([data-theme="light"]) .widget-icon { color: var(--sky); }
}

/* Übersicht: Beiträge + Seitenleiste */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.6rem; align-items: start; }
.side { display: grid; gap: 1.2rem; position: sticky; top: 6rem; }
.side-card { background: var(--glass); border: 1px solid var(--line); border-radius: 22px; padding: 1.2rem 1.3rem; }
.side-card h3 { display: flex; align-items: center; gap: .45rem; font-size: .95rem; margin: 0 0 .7rem; }
.side-card h3 .i { color: var(--accent); }
.crest-card { display: grid; justify-items: center; text-align: center; gap: .35rem; border-top: 4px solid var(--gold); }
.crest-card img { width: 120px; height: auto; margin-bottom: .3rem; }
.crest-card button { margin-top: .5rem; }
.side-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .55rem; font-size: .88rem; }
.side-list li { display: grid; gap: .1rem; }
.side-list .sub { color: var(--muted); font-size: .76rem; }

/* Menü (Avatar / „Mehr“) */
dialog.menu { width: min(320px, 92vw); padding: .6rem; margin: 4.8rem 1rem auto auto; border-radius: 20px; }
dialog.menu::backdrop { background: rgba(2, 6, 23, .25); }
.menu-head { display: flex; align-items: center; gap: .7rem; padding: .6rem .6rem .9rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.menu-head strong, .menu-head .muted { display: block; }
.menu-list { display: grid; gap: .15rem; }
.menu-list button { justify-content: flex-start; gap: .7rem; background: transparent; color: var(--text); font-weight: 550; padding: .7rem .7rem; border-radius: 12px; }
.menu-list button:hover { background: var(--accent-soft); opacity: 1; }
.menu-list .i { color: var(--accent); width: 1.25rem; height: 1.25rem; }
.menu-list .danger-item, .menu-list .danger-item .i { color: var(--danger); }

/* Feed */
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; }
.composer textarea { border: 0; padding: .2rem; background: transparent; }
.composer textarea:focus { outline: 0; }
.composer .row { margin-top: .5rem; }
.post {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; margin-bottom: .7rem;
}
.post .meta { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; margin-bottom: .3rem; }
.post .author { font-weight: 650; }
.post .time { color: var(--muted); font-size: .8rem; }
.post .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.post .body a { overflow-wrap: anywhere; }
.post .actions { margin-top: .4rem; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

/* Chat */
.content:has(> #tab-chat:not([hidden])) { max-width: 1000px; }
/* --topbar-h setzt app.js (die Kopfzeile bricht auf dem Handy je nach Anzahl der Tabs um) */
.chat { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; height: calc(100dvh - var(--topbar-h, 4.5rem) - 3.6rem); }
.chat-list, .chat-view, .chat-open { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-open { flex: 1; }
.chat-list .row { gap: .4rem; }
.chat-list input { padding: .45rem .65rem; }
.chat-list button { white-space: nowrap; }
.conv-list { list-style: none; padding: 0; margin: .6rem 0; flex: 1; overflow-y: auto; }
.conv {
  display: block; width: 100%; text-align: left; background: transparent; color: var(--text);
  font-weight: 400; padding: .55rem .7rem; border-radius: 10px; margin-bottom: .15rem;
}
.conv:hover { background: var(--surface); }
.conv.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.conv-top, .conv-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.conv-name, .conv-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-name { font-weight: 600; }
.conv-preview { color: var(--muted); font-size: .85rem; }
.conv .time { color: var(--muted); font-size: .75rem; flex-shrink: 0; }
.conv .badge { flex-shrink: 0; }
.chat-head { display: flex; align-items: center; gap: .6rem; min-height: 2.6rem; }
.chat-title { font-weight: 650; line-height: 1.2; }
#btn-chat-back { display: none; }
.chat-view > .empty { margin: auto; }
.messages {
  flex: 1; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem; margin: .4rem 0 .7rem;
}
.messages .older { display: block; margin: 0 auto .7rem; }

/* Neuer Chat */
.pick-list { list-style: none; padding: 0; margin: 0; max-height: 45vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-list .sub { padding: .6rem .8rem; color: var(--muted); font-size: .85rem; }
.pick { display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem; color: var(--text); font-size: 1rem; cursor: pointer; }
.pick input { width: auto; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips:empty { display: none; }
.chip { padding: .2rem .65rem; font-size: .8rem; border-radius: 999px; background: var(--mine); color: var(--text); font-weight: 500; }
.msg { margin-bottom: .55rem; max-width: 85%; }
.msg.mine { margin-left: auto; }
.msg .bubble {
  display: inline-block; padding: .45rem .7rem; border-radius: 12px; background: var(--bg);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: var(--mine); }
.msg .who { font-size: .75rem; color: var(--muted); margin-bottom: .1rem; }
.msg.mine .who { text-align: right; }
.msg .time { font-size: .7rem; color: var(--muted); margin-left: .4rem; }

/* Anhänge */
.att-btn {
  display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: .85rem; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.att-btn:hover { background: var(--bg); }
.att-btn.icon { padding: .5rem .6rem; font-size: 1rem; }
.att-left { justify-content: flex-start; gap: .7rem; }
.att-tray { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
#chat-tray { margin: 0 0 .5rem; }
.att-chip {
  display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; padding: .25rem .3rem .25rem .5rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .8rem;
}
.att-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.att-chip .att-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip .att-status { color: var(--muted); }
.att-chip.uploading { opacity: .75; }
.att-chip.failed { border-color: var(--danger); }
.att-chip.failed .att-status { color: var(--danger); }
.att-x { background: transparent; color: var(--muted); padding: 0 .35rem; font-size: 1rem; line-height: 1; }
.attachments { display: grid; gap: .4rem; margin-top: .5rem; }
.att-media { display: grid; gap: .3rem; grid-template-columns: 1fr; }
.att-media.n2 { grid-template-columns: 1fr 1fr; }
.att-media.n3 { grid-template-columns: 1fr 1fr 1fr; }
.att-media a { display: block; }
.att-media img, .att-media video { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.att-media.n1 img { object-fit: contain; width: auto; max-width: 100%; }
.att-media.n2 img, .att-media.n3 img { aspect-ratio: 1; }
.att-file {
  display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: .9rem; background: var(--surface); min-width: 0;
}
.att-file:hover { border-color: var(--muted); }
.att-file .att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .sub { color: var(--muted); font-size: .8rem; flex-shrink: 0; }
.msg .attachments { margin-top: .35rem; width: min(320px, 70vw); }

/* Listen */
.list { list-style: none; padding: 0; margin: .5rem 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin-bottom: .4rem;
}
.list .sub { color: var(--muted); font-size: .8rem; }
.dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--line); margin-right: .4em; }
.dot.on { background: var(--accent); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 650; letter-spacing: .05em; }
.tag { font-size: .7rem; padding: .1em .5em; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); padding: 1.5rem; width: min(400px, 92vw); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .35); }
dialog.wide { width: min(680px, 94vw); max-height: 92dvh; overflow-y: auto; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.install-box { padding-bottom: 1.2rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.install-box h2, .install-box h3, .install-box p { margin: 0; }
.install-box h3, #form-password h3 { font-size: 1.02rem; margin: 0; }
.settings-head { margin-bottom: 1rem; }
.settings-head h2 { margin: 0; }
.notify-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.notify-table th { font-size: .75rem; font-weight: 650; color: var(--muted); text-align: center; padding: .2rem .4rem; }
.notify-table td { padding: .45rem .4rem; border-top: 1px solid var(--line); }
.notify-table td + td { text-align: center; width: 6.5rem; }
.notify-table input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
.push-device { display: grid; gap: .5rem; padding: .8rem .9rem; border-radius: 14px; background: var(--canvas); border: 1px solid var(--line); }
.push-device p { margin: 0; }
.row.push-buttons { justify-content: flex-start; }
.mail-form { margin: .6rem 0 1rem; }
.invite-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .6rem; align-items: end; margin: .6rem 0 .8rem; }
.invite-form .error { grid-column: 1 / -1; }
.invite-main { display: grid; gap: .15rem; min-width: 0; }
@media (max-width: 760px) { .invite-form { grid-template-columns: 1fr; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .9rem; }
.grid2 .span2 { grid-column: 1 / -1; }
fieldset.plain { border: 1px solid var(--line); border-radius: 10px; padding: .9rem; margin: 0; background: var(--bg); }
.seg { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.stack-tight { display: grid; gap: .35rem; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; }
.lbl { font-size: .9rem; color: var(--muted); }

/* Stammbaum */
.content:has(> #tab-tree:not([hidden])) { max-width: none; }
.tree-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.tree-toolbar input { flex: 1; min-width: 12rem; width: auto; padding: .45rem .7rem; }
.tree-tools { display: flex; gap: .35rem; flex-wrap: wrap; }
.tree-tools button { padding: .45rem .8rem; }
.tree-main { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; height: calc(100dvh - var(--topbar-h, 4.5rem) - 8.5rem); min-height: 420px; }
.tree-canvas { position: relative; min-width: 0; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#tree-svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#tree-svg:active { cursor: grabbing; }
.tree-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1rem; background: var(--surface); }
.tree-empty p { margin: 0 0 .6rem; }
.tree-panel { overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.tree-panel h2 { margin: 0 0 .6rem; font-size: 1.2rem; }
.tree-panel h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .3rem; font-weight: 600; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: .92rem; }
.tree-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0 .2rem; }
.tree-actions button { padding: .35rem .7rem; font-size: .85rem; }
.rel-list { list-style: none; padding: 0; margin: 0; }
.rel-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .25rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.rel-list li:last-child { border-bottom: 0; }
.rel-list .sub { color: var(--muted); font-size: .82rem; }
.tree-panel > .row:last-child { margin-top: 1.2rem; align-items: flex-end; }
.row.tight { gap: .3rem; justify-content: flex-end; }
button.link { background: none; padding: 0; color: var(--accent); font-weight: 600; text-align: left; }
button.link:hover { text-decoration: underline; }

.tp { cursor: pointer; }
.tp-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.3; }
.tp:hover .tp-box { stroke: var(--muted); }
.tp.selected .tp-box { stroke: var(--accent); stroke-width: 2.6; }
.tp.dead .tp-box { fill: var(--bg); }
.tp-g { fill: var(--g-u); }
.tp-g.g-m { fill: var(--g-m); }
.tp-g.g-f { fill: var(--g-f); }
.tp-g.g-d { fill: var(--g-d); }
.tp-name { font: 600 13px var(--font); fill: var(--text); }
.tp-sub, .tp-dates { font: 11.5px var(--font); fill: var(--muted); }
.tree-lines line, .tree-lines path { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.tree-lines .tl-partnership { stroke-dasharray: 7 4; }
.tree-lines .tl-ended { stroke-dasharray: 2 4; }
.tree-lines .tl-nonbio { stroke-dasharray: 5 4; }
.tree-lines .tl-coparent { stroke-dasharray: 1 5; }
.tl-symbol { font: 14px var(--font); fill: var(--muted); }

.hidden-note { margin: -.3rem 0 .6rem; color: var(--muted); font-style: italic; }
.row.view-actions { justify-content: flex-start; flex-wrap: wrap; margin: 0 0 .8rem; }

/* Verlauf */
.log-head h2 { margin-top: 0; }
.log-head p { margin: 0 0 .8rem; }
.log-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.log-filters select { width: auto; padding: .4rem .6rem; }
.log-list { list-style: none; padding: 0; margin: 0; }
.log-item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin-bottom: .45rem; }
.log-item.undone .log-summary { text-decoration: line-through; color: var(--muted); }
.log-item.is-undo { border-left: 3px solid var(--accent); }
.log-main { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.log-time { color: var(--muted); font-size: .8rem; }
.log-summary { overflow-wrap: anywhere; }
.log-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; flex-wrap: wrap; margin-top: .35rem; }
.log-foot details { font-size: .85rem; color: var(--muted); }
.log-foot summary { cursor: pointer; }
.log-changes { margin: .3rem 0 0; padding-left: 1rem; color: var(--text); }
.log-changes li { margin: .15rem 0; overflow-wrap: anywhere; }
.log-changes ul { margin: .1rem 0; padding-left: 1rem; color: var(--muted); }

/* Eigene Person und Mitglieder im Baum */
.tp.me .tp-box { stroke: var(--gold); stroke-width: 2.4; }
.tp-me rect { fill: var(--gold); }
.tp-me text { font: 700 10px var(--font); fill: var(--darkblue); }
.tp-member { fill: var(--accent); }
.kin { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.3rem 0 .7rem; }
.kin-label { font-weight: 650; color: var(--accent); }

/* Mitglieder & Adressen */
.members .member { align-items: flex-start; }
.member-main { display: grid; gap: .3rem; min-width: 0; }
.member-name { display: flex; align-items: center; gap: .4rem; font-weight: 650; }
.member-contact { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .88rem; }
.member-contact a { color: var(--accent); text-decoration: none; }
.member-contact .contact { overflow-wrap: anywhere; }

/* Galerie */
:root { --tile: 160px; }
.content:has(> #tab-gallery:not([hidden])) { max-width: none; }
.gallery-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.gallery-bar .section-title { margin-bottom: .1rem; }
.gallery-bar p { margin: 0; }
.gallery-tools { display: flex; align-items: center; gap: .9rem; }
.zoom { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.zoom input { width: 120px; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.att-btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 650; padding: .55rem .9rem; }
.gallery-progress { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.gallery-progress .bar { height: 6px; border-radius: 3px; background: var(--canvas); margin-top: .5rem; overflow: hidden; }
.gallery-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.gallery-progress ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--danger); }
.gallery-progress ul:empty { display: none; }
.gallery-drop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0, 85, 165, .25); backdrop-filter: blur(3px); pointer-events: none; }
.gallery-drop div { padding: 1.2rem 2rem; border-radius: 18px; background: var(--surface); border: 2px dashed var(--accent); font-weight: 650; font-size: 1.2rem; }
.gallery-month h3 { position: sticky; top: calc(var(--topbar-h, 4.5rem) + .2rem); z-index: 5; margin: 1rem 0 .5rem; padding: .3rem .2rem;
                    font-size: 1.05rem; background: var(--bg); }
.gallery-month h3 .sub { color: var(--muted); font-weight: 500; font-size: .85rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 4px; }
.tile { position: relative; padding: 0; border: 0; border-radius: 4px; background: var(--canvas); aspect-ratio: 1; overflow: hidden; cursor: zoom-in; }
.tile:hover { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.tile-badge { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: .7rem; display: grid; place-items: center; }
.tile-comments { position: absolute; left: 6px; bottom: 6px; padding: .1rem .4rem; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .7rem; }
.gallery-sentinel { height: 1px; }

/* Großansicht */
dialog.viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-radius: 0;
                background: #0b1220; color: #f1f5f9; display: grid; grid-template-columns: 1fr 340px; }
dialog.viewer:not([open]) { display: none; }
dialog.viewer::backdrop { background: #000; }
.viewer-stage { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 1rem; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100dvh - 2rem); object-fit: contain; border-radius: 6px; }
.viewer-side { background: #0f172a; border-left: 1px solid #1e293b; padding: 1.1rem 1.2rem; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; }
.viewer-side h3 { margin: .6rem 0 0; font-size: .95rem; }
.viewer-side .muted, .viewer-side .sub { color: #94a3b8; }
.viewer-side input, .viewer-side textarea { background: #1e293b; border-color: #334155; color: #f1f5f9; }
.viewer-side .ghost { color: #e2e8f0; border-color: #334155; }
.viewer-meta { display: grid; gap: .1rem; padding-right: 2.5rem; }
.viewer-caption { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-link { display: inline-flex; align-items: center; padding: .25rem .6rem; border-radius: 12px; border: 1px solid #334155; color: #e2e8f0; text-decoration: none; font-size: .8rem; font-weight: 500; }
.viewer-btn { position: absolute; z-index: 2; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; }
.viewer-btn:hover { background: rgba(255, 255, 255, .25); opacity: 1; }
.viewer-btn:disabled { opacity: .25; }
.viewer-close { top: .8rem; right: .8rem; }
.viewer-prev { left: .8rem; top: 50%; transform: translateY(-50%); }
.viewer-next { right: calc(340px + .8rem); top: 50%; transform: translateY(-50%); }
.viewer-social { display: flex; flex-direction: column; gap: .7rem; flex: 1; min-height: 0; }
.chips.persons { display: flex; align-items: center; }
.chips.persons:empty { display: none; }
.chips.persons .chip { color: #f1f5f9; background: #1e3a5f; display: inline-flex; align-items: center; gap: .2rem; }
.tiny-select { width: auto; padding: .3rem .5rem; font-size: .8rem; border-radius: 999px; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; flex: 1; }

/* Fotos & Dokumente einer Person */
.person-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .4rem; }
.person-head h2 { margin: 0; }
.portrait { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex-shrink: 0; }
.person-files .row { margin: .3rem 0 .5rem; }
.person-files .upload-note:empty { display: none; }
.person-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; margin: .4rem 0 .6rem; }
.person-image { display: grid; gap: .15rem; }
.person-image .tile { border-radius: 8px; }
.person-image.is-portrait .tile { outline: 2px solid var(--gold); }
.person-image .row { justify-content: center; gap: .4rem; }
.tile-badge.text { width: auto; height: auto; border-radius: 999px; padding: .1rem .45rem; font-size: .65rem; font-weight: 650; background: var(--gold); color: var(--darkblue); }
.link.tiny { font-size: .75rem; }
.danger-text { color: var(--danger); }
.tp-portrait { pointer-events: none; }
.comment-head { display: flex; gap: .5rem; align-items: baseline; font-size: .85rem; }
.comment-head .link { margin-left: auto; color: #94a3b8; font-weight: 500; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
#form-comment { gap: .4rem; }
#form-comment input { padding: .5rem .7rem; }
@media (max-width: 900px) {
  dialog.viewer { grid-template-columns: 1fr; grid-template-rows: minmax(40dvh, 1fr) auto; }
  .viewer-stage { padding: 2.8rem .4rem .4rem; }
  .viewer-stage img, .viewer-stage video { max-height: calc(60dvh - 3rem); }
  .viewer-side { border-left: 0; border-top: 1px solid #1e293b; max-height: 50dvh; }
  .viewer-prev, .viewer-next { top: 30dvh; }
  .viewer-next { right: .8rem; }
  .gallery-month h3 { top: calc(var(--topbar-h, 3.5rem) + .1rem); }
  .zoom input { width: 90px; }
}

.tree-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: .6rem 0 0; }
.lg { display: inline-block; width: 26px; height: 0; border-top: 2px solid var(--muted); vertical-align: middle; margin-right: .25rem; }
.lg-partnership { border-top-style: dashed; }
.lg-ended { border-top-style: dotted; }
.lg-nonbio { border-top-style: dashed; width: 18px; }

@media (max-width: 899px) {
  .tree-main { grid-template-columns: 1fr; height: auto; }
  .tree-canvas { height: 62dvh; min-height: 340px; }
  .tree-panel { overflow: visible; }
}

/* Mittlere Breiten: Seitenleiste unter die Beiträge, Navigation kompakter */
@media (max-width: 1100px) {
  .tabs button { padding: .5rem .6rem; font-size: .86rem; }
  .brand .tagline { display: none; }
}
@media (max-width: 980px) {
  .overview { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* App-Ansicht (Handy, Tablet hochkant): blaue Kopfzeile, Navigation als Leiste unten, Menü als Blatt von unten */
@media (max-width: 900px) {
  .topbar { background: var(--gradient); border-bottom-color: rgba(255, 199, 44, .25); padding: .6rem .9rem; padding-top: max(.6rem, env(safe-area-inset-top)); gap: .6rem; }
  .topbar .tabs { display: none; }
  .brand { color: #fff; }
  .brand:hover { background: rgba(255, 255, 255, .08); }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; box-shadow: none; }
  .brand-mark img { width: 24px; height: 31px; }
  .brand-name { font-size: 1.15rem; }
  .user-menu { margin-left: auto; }
  .icon-btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .15); color: var(--gold); width: 38px; height: 38px; }
  .topbar .avatar { display: none; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around;
    padding: .45rem .4rem calc(.45rem + env(safe-area-inset-bottom));
    background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .bottom-nav button {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem;
    background: transparent; color: var(--muted); padding: .3rem 0; font-size: .64rem; font-weight: 600; border-radius: 12px;
  }
  .bottom-nav button .i { width: 1.35rem; height: 1.35rem; }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav .badge { position: absolute; top: 0; left: 55%; }

  .content { padding: .9rem .8rem calc(5.2rem + env(safe-area-inset-bottom)); }
  .hero { padding: 1.4rem 1.3rem 1.2rem; border-radius: 22px; margin-bottom: 1rem; }
  .hero-crest { width: 190px; right: -30px; bottom: -40px; }
  .hero h1 { font-size: 1.45rem; }
  .hero p { font-size: .9rem; margin-bottom: 1.1rem; }
  .gold-btn, .glass-btn { padding: .65rem 1rem; font-size: .88rem; }
  .hero-stats { margin-top: 1.3rem; padding-top: 1rem; gap: .8rem; }
  .hero-stats strong { font-size: 1.25rem; }
  /* Kacheln als kompakte Reihe, damit die Beiträge schnell erreichbar sind */
  .widgets { grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1.2rem; }
  .widget { padding: .75rem .4rem; justify-items: center; text-align: center; gap: .3rem; border-left-width: 1px; border-top: 3px solid var(--blue); }
  .widget.w-gold { border-top-color: var(--gold); }
  .widget.w-green { border-top-color: var(--green); }
  .widget .pill, .widget .muted, .widget .widget-link { display: none; }
  .widget-head { margin: 0; }
  .widget strong { font-size: .82rem; }
  .widget-icon { width: 40px; height: 40px; }
  .hero-actions { gap: .5rem; }
  .side { grid-template-columns: 1fr; }

  dialog.menu { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(.8rem + env(safe-area-inset-bottom)); }
  /* Chat füllt den Platz zwischen Kopfzeile und App-Leiste (Höhen setzt app.js) */
  .content:has(> #tab-chat:not([hidden])) { padding-bottom: calc(var(--bottomnav-h, 4rem) + .6rem); }
  .chat { height: calc(100dvh - var(--topbar-h, 4rem) - var(--bottomnav-h, 4rem) - 1.5rem); }
}

@media (max-width: 560px) {
  .chat { grid-template-columns: 1fr; }
  .chat.open .chat-list, .chat:not(.open) .chat-view { display: none; }
  #btn-chat-back { display: inline-block; }
  .grid2 { grid-template-columns: 1fr; }
  dialog.wide { padding: 1.1rem; }
}

/* Kalender */
#tab-calendar { max-width: 1000px; margin: 0 auto; }
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .3rem; }
.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-nav .section-title { margin: 0 .3rem; min-width: 11rem; text-align: center; }
.cal-nav.list-mode .icon-btn, .cal-nav.list-mode #cal-today { visibility: hidden; }
.cal-nav .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.cal-tools { display: flex; align-items: center; gap: .6rem; }
.seg-btns { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: .15rem; background: var(--canvas); }
.seg-btns button { border: 0; border-radius: 999px; }
.seg-btns button.active { background: var(--accent); color: var(--accent-text); }
.cal-hint { margin: 0 0 .9rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { text-align: center; font-size: .72rem; font-weight: 650; color: var(--muted); padding: .2rem 0 .4rem; text-transform: uppercase; letter-spacing: .06em; }
.cal-cell {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: .2rem; min-height: 96px; padding: .35rem .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 500; text-align: left;
}
.cal-cell:hover { opacity: 1; border-color: var(--muted); }
.cal-cell.other { opacity: .55; background: var(--canvas); }
.cal-cell.weekend .cal-num { color: var(--muted); }
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-text); }
.cal-cell.selected { outline: 2px solid var(--accent); outline-offset: -1px; }
.cal-num { align-self: flex-start; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; font-weight: 650; }
.cal-chips { display: grid; gap: 2px; min-width: 0; }
.cal-chip {
  font-size: .72rem; line-height: 1.25; padding: .1rem .35rem; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--blue);
}
.cal-more { font-size: .7rem; color: var(--muted); padding-left: .35rem; }
.k-birthday { --k: var(--darkgold); }
.k-death { --k: var(--muted); }
.k-mine { --k: var(--blue); }
.k-invited { --k: var(--green); }
:root[data-theme="dark"] .k-birthday, :root[data-theme="dark"] .k-mine { --k: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .k-birthday, :root:not([data-theme="light"]) .k-mine { --k: var(--gold); } }
.cal-chip { border-left-color: var(--k); }
.cal-chip.k-birthday { background: rgba(255, 199, 44, .18); }
.cal-chip.k-death { background: var(--canvas); color: var(--muted); }
.cal-chip.k-invited { background: rgba(16, 185, 129, .14); }
.cal-day { margin-top: 1rem; }
.cal-day h3 { font-size: 1rem; margin: 0 0 .5rem; }
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.cal-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--k, var(--line)); border-radius: 10px; }
.cal-item-main { flex: 1; display: grid; gap: .1rem; min-width: 0; background: transparent; color: var(--text); padding: 0; text-align: left; font-weight: 500; border-radius: 0; justify-content: start; }
.cal-item-main:hover { opacity: 1; }
button.cal-item-main .cal-item-title { color: var(--accent); }
.cal-item-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 600; }
.cal-item .sub { color: var(--muted); font-size: .82rem; }
.cal-date { flex-shrink: 0; width: 5.6rem; font-size: .82rem; font-weight: 650; color: var(--muted); }
.cal-empty { padding: .4rem 0; }
.cal-agenda { display: grid; gap: 1.2rem; }
.cal-agenda-month h3 { font-size: 1rem; margin: 0 0 .5rem; position: sticky; top: calc(var(--topbar-h, 4.5rem) + .2rem); background: var(--bg); padding: .3rem 0; z-index: 1; }
.tag.ok { border-color: var(--green); color: var(--green); }
.tag.off { text-decoration: line-through; }
.ev-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .5rem; align-items: baseline; }
.ev-desc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding: .7rem .9rem; background: var(--canvas); border-radius: 10px; }
.ev-guests { display: grid; gap: .3rem; }
.ev-guest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .92rem; }
.ev-guest-list li { display: inline-flex; align-items: center; gap: .35rem; }
.ev-rsvp { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .7rem .9rem; background: var(--canvas); border-radius: 10px; }
.ev-rsvp .lbl { grid-column: 1 / -1; }
#event-view h2 { margin: 0; }
#event-pick .pick-list { max-height: 30vh; }
@media (max-width: 700px) {
  .cal-bar { gap: .5rem; }
  .cal-nav .section-title { min-width: 0; font-size: 1.05rem; }
  .cal-tools { width: 100%; justify-content: space-between; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 54px; padding: .2rem; align-items: center; border-radius: 8px; }
  .cal-num { align-self: center; width: 1.5rem; height: 1.5rem; font-size: .8rem; }
  .cal-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .cal-chip { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; background: var(--k); color: transparent; }
  .cal-more { display: none; }
  .cal-date { width: 4.2rem; font-size: .75rem; }
  .ev-row { grid-template-columns: 1fr; gap: .1rem; }
}

/* Videoanrufe */
.call-banners { display: grid; gap: .5rem; }
.call-banners:not(:empty) { margin-bottom: 1rem; }
.call-banner { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .7rem 1rem; border-radius: 14px;
  background: var(--gradient); color: #fff; box-shadow: var(--shadow); }
.call-banner .i { color: var(--gold); width: 1.5rem; height: 1.5rem; }
.call-banner .main { flex: 1; min-width: 12rem; display: grid; line-height: 1.25; }
.call-banner .sub { color: #cbd5e1; font-size: .82rem; }
.call-banner .gold-btn { padding: .5rem 1rem; }
.call-banner .dismiss { background: transparent; color: #cbd5e1; padding: .3rem .5rem; }
.chat-call { margin-left: auto; }
.ev-call { display: grid; gap: .5rem; padding: .8rem .9rem; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--line); }
.ev-call .row { flex-wrap: wrap; justify-content: flex-start; }
.ev-call code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; overflow-wrap: anywhere; }
.ev-guests { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; font-size: .88rem; }
.ev-guests li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ev-guests .sub { color: var(--muted); font-size: .8rem; }
.ev-guests .err { color: var(--danger); font-size: .8rem; }
#call-users { max-height: 30vh; }

/* Transkript & Zusammenfassungen */
.transcript-box { max-height: 40vh; overflow-y: auto; display: grid; gap: .35rem; padding: .7rem .9rem; background: var(--canvas); border-radius: 12px; font-size: .9rem; }
.transcript-box .who { color: var(--muted); font-size: .78rem; }
.transcript-box .who b { color: var(--accent); }
.transcript-box .line { white-space: pre-wrap; overflow-wrap: anywhere; }
.summary-card { display: grid; gap: .5rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary-card .row { flex-wrap: wrap; }
.summary-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; margin: 0; }
.summary-text h4 { margin: .6rem 0 .2rem; font-size: .95rem; }
.summary-text ul { margin: 0 0 .3rem 1.1rem; padding: 0; }
.summary-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.summary-table th, .summary-table td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary-table th { font-size: .75rem; color: var(--muted); font-weight: 650; }
.summary-new { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.summary-new select { width: auto; flex: 1; min-width: 12rem; }
.k-call { --k: var(--sky); }
.cal-chip.k-call { background: rgba(56, 189, 248, .16); }
.btn-link { display: inline-flex; align-items: center; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 12px; font-size: .8rem; color: var(--text); text-decoration: none; }
.btn-link:hover { background: var(--accent-soft); }

/* Videoanrufe-Seite */
.calls-section { margin-top: 1.2rem; }
.calls-section h3 { font-size: 1rem; margin: 0 0 .5rem; }
.calls-section .cal-item.live { --k: var(--green); }
.calls-section .cal-item.planned { --k: var(--blue); }
.calls-section .cal-item.past { --k: var(--muted); }
@media (max-width: 900px) { .bottom-nav button { font-size: .6rem; } }
