/* SCHOOLVIBE — mobile-first. Eine Schrift (System), ein Lila-Verlauf, ruhige Flächen. */
:root {
  --grad-a: #7c3aed;
  --grad-b: #4f46e5;
  --grad: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  --bg: #f6f5fb;
  --card: #ffffff;
  --text: #1f1b2e;
  --muted: #6b6880;
  --line: #e7e5f0;
  --accent: #6d28d9;
  --accent-soft: #ede9fe;
  --danger: #dc2626;
  --radius: 16px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
/* hidden muss immer gewinnen — sonst überstimmt z. B. `.field { display: block }` das Attribut (Bug 21./22.10.). */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input { font: inherit; }

/* ---------- Logo / Wortmarke ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 40px; height: 40px; flex: 0 0 auto; }
.brand .word { font-weight: 800; letter-spacing: 0.04em; font-size: 20px; }
.brand .word span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Beitritt ---------- */
.join {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--grad);
  color: #fff;
}
.join .brand { justify-content: center; margin-bottom: 8px; }
.join .brand .word span { color: #fff; background: none; -webkit-text-fill-color: #fff; }
.join .tagline { text-align: center; opacity: 0.9; margin: 0 0 24px; font-size: 15px; }
.card {
  background: var(--card); color: var(--text);
  border-radius: var(--radius); padding: 20px 16px;
  box-shadow: 0 10px 30px rgba(31, 27, 46, 0.18);
}
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px 16px; border: 0; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: #fee2e2; color: var(--danger); }
.note { font-size: 12px; color: var(--muted); text-align: center; margin: 14px 0 0; }
.msg { margin: 12px 0 0; font-size: 14px; min-height: 20px; }
.msg.ok { color: #047857; }
.msg.err { color: var(--danger); }

/* ---------- App-Rahmen ---------- */
.app-header {
  position: sticky; top: 0; z-index: 5;
  background: var(--grad); color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.app-header .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header .brand .logo { width: 32px; height: 32px; }
.app-header .brand .word { font-size: 17px; }
.app-header .brand .word span { color: #fff; background: none; -webkit-text-fill-color: #fff; }
.app-header .who { margin-top: 8px; font-size: 13px; opacity: 0.95; }
.app-header .who strong { font-weight: 700; }
.app-header .logout {
  background: rgba(255,255,255,0.18); color: #fff; border: 0; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
}

main { padding: 16px 16px calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
.panel { display: none; }
.panel.active { display: block; }
.panel h2 { font-size: 18px; margin: 0 0 12px; }

/* ---------- Stundenplan-Raster ---------- */
.tt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.tt { border-collapse: separate; border-spacing: 4px; min-width: 100%; }
.tt th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 2px; }
.tt th.day { min-width: 62px; }
.tt td.period { font-size: 12px; color: var(--muted); text-align: center; width: 28px; }
.tt td.slot {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  height: 52px; padding: 6px; cursor: pointer; vertical-align: top;
  transition: transform 0.06s ease;
}
.tt td.slot:active { transform: scale(0.97); }
.tt td.slot.filled { background: var(--accent-soft); border-color: #ddd6fe; }
.tt td.slot .subj { font-size: 13px; font-weight: 700; line-height: 1.15; word-break: break-word; }
.tt td.slot .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* ---------- Editor (Bottom-Sheet) ---------- */
.sheet-bg {
  position: fixed; inset: 0; background: rgba(31,27,46,0.4); z-index: 20;
  display: none; align-items: flex-end;
}
.sheet-bg.open { display: flex; }
.sheet {
  width: 100%; background: var(--card); border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h3 { margin: 0 0 12px; font-size: 16px; }
.sheet .row { display: flex; gap: 10px; margin-top: 12px; }
.sheet .row .btn { width: auto; flex: 1; }

/* ---------- Platzhalter-Karten ---------- */
.soon {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; color: var(--muted);
}
.soon .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Tab-Leiste unten ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar button {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 600;
}
.tabbar button .ic { font-size: 22px; line-height: 1; }
.tabbar button.active { color: var(--accent); }

/* ---------- Beitritt: feste Schule + Klassen-Chips ---------- */
.field .fixed {
  padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--accent-soft); border-color: #ddd6fe; color: var(--accent); font-weight: 700; }

/* ---------- Stundenplan: Tagesansicht ---------- */
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tt-head h2 { margin: 0; }
.seg.small { margin: 0; width: 150px; }
.seg.small button { padding: 7px 6px; font-size: 13px; }
.daychips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.daychips button {
  position: relative; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 12px; padding: 10px 0; font-weight: 700; cursor: pointer;
}
.daychips button.active { background: var(--grad); color: #fff; border-color: transparent; }
.daychips button.today::after {
  content: ''; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; transform: translateX(-50%);
}
.daylist { display: flex; flex-direction: column; gap: 8px; }
.lesson {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer;
}
.lesson:active { transform: scale(0.99); }
.lesson .when { flex: 0 0 92px; display: flex; flex-direction: column; gap: 2px; }
.lesson .num { font-weight: 800; font-size: 15px; }
.lesson .time { font-size: 12px; color: var(--muted); }
.lesson .what { flex: 1; min-width: 0; }
.lesson .subj { font-weight: 700; font-size: 16px; }
.lesson .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.lesson.empty { border-style: dashed; background: transparent; padding-top: 8px; padding-bottom: 8px; }
.lesson.empty .num { color: var(--muted); font-weight: 600; }
.lesson.empty .what { color: var(--muted); font-size: 13px; }

/* ---------- Logo (Bild) ---------- */
.brand img.logo { border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
.app-header .brand img.logo { border-radius: 8px; }

/* ---------- Kalender ---------- */
#panel-timetable > .seg { margin-bottom: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-head h2 { margin: 0; font-size: 17px; }
.cal-nav {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--accent); font-size: 22px; line-height: 1; cursor: pointer;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.cal-day {
  aspect-ratio: 1 / 1; min-height: 40px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); cursor: pointer; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
}
.cal-day .n { font-size: 14px; font-weight: 600; }
.cal-day .dots { display: flex; gap: 2px; min-height: 6px; }
.cal-day.other { opacity: 0.4; }
.cal-day.we { background: var(--bg); }
.cal-day.today { border-color: var(--accent); }
.cal-day.today .n { color: var(--accent); font-weight: 800; }
.cal-day.sel { background: var(--grad); border-color: transparent; color: #fff; }
.cal-day.sel .n { color: #fff; }
.cal-day.sel .dot { box-shadow: 0 0 0 1.5px #fff; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.k-test .dot, .dot.k-test { background: #dc2626; }
.k-homework .dot, .dot.k-homework { background: #d97706; }
.k-event .dot, .dot.k-event { background: #7c3aed; }
.k-other .dot, .dot.k-other { background: #64748b; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); margin: 8px 0 4px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 8px; }
.cal-day-head h3, .cal-sub { margin: 0; font-size: 15px; }
.cal-sub { margin: 18px 0 8px; color: var(--muted); font-weight: 700; }
.cal-list { display: flex; flex-direction: column; gap: 8px; }
.cal-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.cal-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid #7c3aed;
  border-radius: 12px; padding: 10px 12px;
}
.cal-item.k-test { border-left-color: #dc2626; }
.cal-item.k-homework { border-left-color: #d97706; }
.cal-item.k-other { border-left-color: #64748b; }
.ci-main { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.ci-kind { font-weight: 700; }
.ci-title { font-weight: 700; font-size: 15px; margin-top: 2px; word-break: break-word; }
.ci-note { font-size: 13px; color: var(--text); margin-top: 2px; word-break: break-word; }
.ci-who { font-size: 11px; color: var(--muted); margin-top: 4px; }
.ci-del {
  border: 0; background: #fee2e2; color: var(--danger); width: 30px; height: 30px; border-radius: 8px;
  font-size: 18px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.chip.k-test.active { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.chip.k-homework.active { background: #fef3c7; border-color: #fde68a; color: #b45309; }
.chip.k-other.active { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet { max-height: 92dvh; overflow-y: auto; }
.sheet .seg { margin-bottom: 0; }
.join .switch { display: block; text-align: center; margin-top: 12px; font-size: 13px; color: var(--accent); background: none; border: 0; width: 100%; cursor: pointer; text-decoration: underline; }

/* ---------- PWA: Installieren-Hinweis, Anleitung, Offline-Seite ---------- */
.install {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid #ddd6fe; border-radius: var(--radius);
  padding: 10px 10px 10px 12px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.10);
}
.install img { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
.install .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.install .txt strong { font-size: 14px; }
.install .txt span { font-size: 12px; color: var(--muted); }
.install .x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 6px; cursor: pointer; }
.steps { margin: 0 0 14px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.35; }
.offline-card { text-align: center; }
.offline-card .big { font-size: 44px; margin-bottom: 4px; }
.offline-card h2 { margin: 0 0 8px; font-size: 20px; }
.offline-card p { color: var(--muted); margin: 0 0 16px; }
a.btn { text-decoration: none; }

/* ---------- Startseite ---------- */
.hello { margin: 2px 2px 12px; }
.hello h2 { margin: 0; font-size: 22px; }
.hello-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.hcard {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 14px 14px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(31,27,46,0.05);
}
.hc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hc-head h3 { margin: 0; font-size: 16px; }
.hc-titles { flex: 1; min-width: 0; }
.hc-head > h3 { flex: 1; }
.hc-ic { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 10px; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
.hc-ic.big { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
.hc-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; font-weight: 400; }
.hc-link { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; padding: 4px 0; white-space: nowrap; }
.ls-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ls-row + .ls-row { border-top: 1px solid var(--line); }
.ls-badge { flex: 0 0 auto; min-width: 64px; text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 5px 6px; }
.ls-badge.now { background: var(--grad); color: #fff; }
.ls-main { flex: 1; min-width: 0; }
.ls-subj { font-weight: 800; font-size: 16px; }
.ls-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ls-time { flex: 0 0 auto; font-weight: 700; font-size: 13px; color: var(--text); }
.ls-free { font-weight: 700; font-size: 15px; padding: 2px 0 6px; }
.home-map-wrap { position: relative; z-index: 0; isolation: isolate; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; margin-bottom: 8px; }
#homeMap { height: 160px; background: #e8e6f0; }
#homeMap .leaflet-control-attribution { font-size: 9px; }
.mp-pin.small { width: 30px; height: 30px; font-size: 15px; border-width: 2px; }
.home-list { display: flex; flex-direction: column; }
.hm-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; cursor: pointer; }
.hm-row + .hm-row { border-top: 1px solid var(--line); }
.hm-emoji, .hm-avatar { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; }
.hm-avatar { background: var(--grad); color: #fff; font-size: 13px; }
.hm-main { flex: 1; min-width: 0; }
.hm-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.hm-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.hm-time { flex: 0 0 auto; font-size: 12px; color: var(--muted); align-self: flex-start; margin-top: 3px; }
.hm-row .dot { width: 10px; height: 10px; margin: 0 6px 0 4px; }
.muted { color: var(--muted); }
.helper-cta { display: flex; align-items: center; gap: 12px; cursor: pointer; background: linear-gradient(135deg, #f5f3ff, #eef2ff); border-color: #ddd6fe; }
.hcta-txt { flex: 1; display: flex; flex-direction: column; }
.helper-cta .chev { font-size: 24px; color: var(--accent); }
.tabbar button { font-size: 10px; }

.push-card .hc-head { margin-bottom: 0; }
.push-actions { display: flex; gap: 16px; margin: 8px 0 0 42px; }
.muted-link { color: var(--muted); font-weight: 600; }

/* ---------- Campus-Karte ---------- */
.map-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  /* Eigene Ebene: Leaflet nutzt z-index bis 1000 — ohne das läge die Karte über Sheets, Kopf und Tab-Leiste. */
  z-index: 0; isolation: isolate;
}
#map { height: 44vh; min-height: 260px; background: #e8e6f0; }
#map.placing { cursor: crosshair; outline: 3px solid var(--accent); outline-offset: -3px; }
.map-fab {
  position: absolute; right: 10px; bottom: 26px; z-index: 500;
  border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 700; font-size: 14px;
  background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(31,27,46,0.25); cursor: pointer;
}
.mp { background: none; border: 0; }
.mp-pin {
  position: relative; width: 40px; height: 40px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 3px 8px rgba(31,27,46,0.3);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.mp-pin > * { transform: rotate(45deg); }
.mp-pin { line-height: 1; }
.mp-count {
  position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.leaflet-popup-content { margin: 10px 12px; }
.pop { min-width: 180px; font-family: inherit; }
.pop-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.pop-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pop-open { border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 8px; width: 100%; text-align: left; cursor: pointer; font-size: 13px; }
.pop-empty { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.pop-plan { width: 100%; }
.pop-del { display: block; margin: 8px auto 0; border: 0; background: none; color: var(--danger); font-size: 12px; text-decoration: underline; cursor: pointer; }
#panel-map .tt-head { margin-top: 14px; }
.act-card {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; cursor: pointer;
}
.ac-emoji { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.ac-main { flex: 1; min-width: 0; }
.ac-title { font-weight: 700; font-size: 15px; word-break: break-word; }
.ac-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ac-count { font-size: 12px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.ac-join { flex: 0 0 auto; border: 1px solid #ddd6fe; background: var(--card); color: var(--accent); border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.ac-join.on { background: var(--grad); color: #fff; border-color: transparent; }
.emoji-chips .chip.emoji { font-size: 20px; padding: 6px 10px; }
.act-detail { padding-top: 14px; }
.ad-head { display: flex; align-items: flex-start; gap: 10px; }
.ad-emoji { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.ad-titles { flex: 1; min-width: 0; }
.ad-titles h3 { margin: 0 0 2px; word-break: break-word; }
.ad-where { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; text-align: left; cursor: pointer; text-decoration: underline; }
.act-detail .x { border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.ad-note { margin: 10px 0 0; font-size: 14px; }
.ad-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; font-size: 13px; align-items: center; }
.ap-label { color: var(--muted); font-weight: 700; }
.ap { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 9px; }
.ad-sub { margin: 16px 0 6px; font-size: 14px; color: var(--muted); }
.ad-chat { min-height: 120px; max-height: 30vh; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--bg); }
.ad-input { display: flex; gap: 8px; margin-top: 8px; }
.ad-input input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px; outline: none; }
.ad-input button { width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--grad); color: #fff; font-size: 18px; cursor: pointer; }
.field select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); font: inherit; }

/* ---------- Anleitungsseite /installieren ---------- */
.install-page { background: var(--bg); }
.ip-head { background: var(--grad); color: #fff; text-align: center; padding: calc(28px + env(safe-area-inset-top)) 16px 26px; border-radius: 0 0 28px 28px; }
.ip-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.ip-head h1 { font-size: 23px; margin: 14px 0 4px; }
.ip-head p { margin: 0; opacity: 0.9; }
.ip-main { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.ip-note { background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.4; margin-bottom: 14px; }
.ip-seg { margin-bottom: 14px; }
.ip-steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ip-steps li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.ip-num { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.ip-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ip-txt strong { font-size: 16px; }
.ip-txt span { font-size: 14px; color: var(--muted); line-height: 1.4; }
.ip-txt b { color: var(--text); }
.ip-ico { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 12px; }
.ip-install { margin-bottom: 10px; font-size: 17px; padding: 15px; }
.ip-done { text-align: center; font-weight: 700; color: #047857; margin: 0 0 10px; }
.ip-back { display: flex; }

/* ---------- Chats ---------- */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--accent-soft); border-radius: 12px; padding: 4px; margin-bottom: 10px;
}
.seg button {
  border: 0; background: none; padding: 9px 8px; border-radius: 9px;
  font-weight: 600; color: var(--accent); cursor: pointer;
}
.seg button.active { background: var(--card); box-shadow: 0 1px 3px rgba(31,27,46,0.12); }
.chat-list {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 40vh; max-height: calc(100dvh - var(--nav-h) - 280px);
  overflow-y: auto; padding: 4px 0 8px;
}
.chat-list .empty { color: var(--muted); text-align: center; padding: 28px 12px; font-size: 14px; }
.bubble {
  max-width: 82%; align-self: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px; padding: 8px 12px;
}
.bubble.me {
  align-self: flex-end; background: var(--grad); color: #fff; border: 0;
  border-radius: 14px 14px 4px 14px;
}
.bubble .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.bubble.me .meta { color: rgba(255,255,255,0.85); }
.bubble .body { font-size: 15px; line-height: 1.3; white-space: pre-wrap; word-break: break-word; }
#panel-chats, #panel-helper { padding-bottom: 70px; }
.btn.tiny { width: auto; padding: 7px 12px; font-size: 13px; }
.bubble.bot { border-color: #ddd6fe; background: #faf5ff; }
.bubble.typing .body { color: var(--muted); letter-spacing: 2px; }
.bubble.err { border-color: #fecaca; background: #fef2f2; }
.chat-input input:disabled { background: var(--bg); color: var(--muted); }
.chat-input {
  position: fixed; left: 0; right: 0; z-index: 9;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 8px 16px;
  background: var(--card); border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 999px; outline: none;
}
.chat-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input button {
  width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%;
  background: var(--grad); color: #fff; font-size: 18px; cursor: pointer;
}

@media (min-width: 720px) {
  .chat-input { max-width: 680px; left: 50%; right: auto; transform: translateX(-50%); }
  .join .card, main { max-width: 680px; margin-left: auto; margin-right: auto; }
  .tabbar { max-width: 680px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: 0; }
}

/* =====================================================================================
   Design 2.0 (26.10.) — „mehr wie eine richtige App": echte Icons (Lucide), App-Leiste mit Titel,
   Avatare, ruhigere Karten mit Schatten statt Rahmen, Tab-Leiste mit Pill-Markierung.
   ===================================================================================== */
:root {
  --bg: #f4f3f9;
  --line: #ebe9f3;
  --text: #17142b;
  --muted: #6e6a85;
  --accent-soft: #f1ecfe;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(23, 20, 43, 0.04), 0 6px 20px rgba(23, 20, 43, 0.06);
  --nav-h: 68px;
}
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; letter-spacing: -0.005em; }

/* Icons */
.i { width: 22px; height: 22px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.i.sm { width: 18px; height: 18px; }
.i.xs { width: 14px; height: 14px; }

/* App-Leiste */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(244, 243, 249, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
}
.ab-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ab-logo { width: 32px; height: 32px; border-radius: 9px; }
.appbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.ab-me { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
main { padding-top: 4px; }

/* Avatare */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%; color: #fff; font-size: 20px; line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}
.avatar.letter { font-weight: 800; font-size: 15px; }
.avatar.xs { width: 22px; height: 22px; font-size: 13px; }
.avatar.xs.letter { font-size: 11px; }
.avatar.sm { width: 34px; height: 34px; font-size: 18px; }
.avatar.lg { width: 56px; height: 56px; font-size: 30px; }
.avatar.lg.letter { font-size: 22px; }
.avatar.xl { width: 72px; height: 72px; font-size: 40px; }
.avatar.xl.letter { font-size: 28px; }

/* Begrüßung */
.hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px; padding: 16px;
  background: var(--grad); color: #fff; border-radius: 22px; box-shadow: 0 10px 24px rgba(109, 40, 217, 0.25);
}
.hero h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.hero-sub { font-size: 13px; opacity: 0.9; margin-top: 2px; }
.hero-av .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }

/* Karten */
.hcard { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.hc-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.hc-ic .i { width: 19px; height: 19px; }
.hc-ic.big { width: 46px; height: 46px; }
.hc-ic.big .i { width: 24px; height: 24px; }
.hc-link { display: inline-flex; align-items: center; gap: 2px; }
.helper-cta .chev { color: var(--accent); display: flex; }
.hm-avatar .i { width: 20px; height: 20px; }
.ls-free { display: flex; align-items: center; gap: 6px; }

/* Tab-Leiste */
.tabbar {
  background: rgba(255, 255, 255, 0.92); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
}
.tabbar button { gap: 3px; font-size: 10.5px; font-weight: 600; color: #8a86a0; }
.tabbar button .ic { width: 52px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background 0.15s ease; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active .ic { background: var(--accent-soft); }

/* Knöpfe mit Icons */
.btn { gap: 6px; }
.btn.tiny, .map-fab, .ac-join { display: inline-flex; align-items: center; gap: 5px; }
.chat-input button, .ad-input button, .x, .ci-del { display: flex; align-items: center; justify-content: center; }
.chat-input button .i, .ad-input button .i { width: 20px; height: 20px; }
.sheet-bg { z-index: 50; }

/* Chats mit Avatar */
.msg-row { display: flex; align-items: flex-end; gap: 6px; }
.msg-row.me { justify-content: flex-end; }
.msg-row .bubble { max-width: 78%; }
.msg-av { border: 0; background: none; padding: 0; cursor: pointer; }
.msg-name { font-weight: 700; cursor: pointer; }
.bubble .meta .i { vertical-align: -2px; }
.ap { display: inline-flex; align-items: center; gap: 5px; border: 0; cursor: pointer; padding: 3px 10px 3px 3px; font: inherit; font-size: 13px; }

/* Profil */
.profile-sheet .pf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pf-titles { flex: 1; min-width: 0; }
.pf-titles h3 { margin: 0; font-size: 20px; }
.pf-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pf-status { background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
.av-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.av-pick { aspect-ratio: 1; border: 1px solid var(--line); background: #fff; border-radius: 12px; font-size: 21px; cursor: pointer; padding: 0; }
.av-pick.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.col-row { display: flex; gap: 10px; flex-wrap: wrap; }
.col-pick { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.col-pick.active { box-shadow: 0 0 0 3px var(--text); }
.pf-logout { margin-top: 8px; color: var(--danger); background: #fef2f2; }
.x { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 10px; cursor: pointer; }
.x:active { background: var(--accent-soft); }

/* ---------- Chats 2.0: Liste, Unterhaltung, Anfragen, Melden ---------- */
.new-chat { margin-bottom: 12px; }
.conv-sec { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 4px 2px 6px; }
.conv-list, .people-list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.people-list { max-height: 50vh; overflow-y: auto; box-shadow: none; border: 1px solid var(--line); }
.conv-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit;
  background: none; border: 0; padding: 12px 14px; cursor: pointer;
}
.conv-row + .conv-row { border-top: 1px solid var(--line); }
.conv-row:active { background: var(--accent-soft); }
.conv-row .hm-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conv-top, .conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.conv-row.unread .hm-title { font-weight: 800; }
.conv-row.unread .hm-preview { color: var(--text); }
.conv-ic {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 14px;
}
.conv-ic.emoji { background: var(--accent-soft); font-size: 22px; }
.avatar.md { width: 44px; height: 44px; font-size: 24px; }
.avatar.md.letter { font-size: 17px; }
.unread-dot { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.req-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.req-row .btn.tiny { padding: 8px 10px; }
.conv-head {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 5; display: flex; align-items: center; gap: 10px;
  background: var(--bg); padding: 2px 0 10px; margin: -4px 0 4px;
}
.conv-head-av { cursor: pointer; }
.conv-titles { min-width: 0; }
.conv-title { font-weight: 800; font-size: 17px; }
.conv-sub { font-size: 12px; color: var(--muted); }
#convView .chat-list { min-height: 50vh; max-height: none; }
#panel-chats .bubble[data-msg] { cursor: pointer; }
.tabbar button { position: relative; }
.tab-badge {
  position: absolute; top: 4px; left: 50%; margin-left: 8px; z-index: 1;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e11d48; color: #fff;
  font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff;
}
.pf-actions { display: flex; gap: 8px; margin-top: 10px; }
.pf-actions .btn { flex: 1; font-size: 14px; }
.danger-text { color: var(--danger); }
.search-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; }
.search-field input { border: 0; box-shadow: none; padding-left: 0; }
.search-field input:focus { box-shadow: none; }
.chip.active { background: var(--accent-soft); border-color: #ddd6fe; color: var(--accent); font-weight: 700; }
/* Fenster-Stapel: Profil liegt über „Neuer Chat", Melden über allem (26.10.) */
#peopleBg { z-index: 50; }
#profileBg { z-index: 60; }
#reportBg { z-index: 70; }
#adminBg { z-index: 65; }

/* Admin: Meldungen */
.pf-admin { margin: 0 0 12px; }
.pf-admin .unread-dot { margin-left: 6px; background: #e11d48; }
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.admin-card.done { opacity: 0.6; }
.admin-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.admin-reason { background: #fee2e2; color: #b91c1c; border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 12px; }
.admin-done-tag { background: #dcfce7; color: #15803d; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 12px; }
.admin-who { margin: 8px 0 4px; font-size: 14px; }
.admin-note { font-size: 14px; background: #f8fafc; border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.admin-ctx { border-left: 3px solid var(--line); padding-left: 10px; margin: 8px 0; }
.admin-ctx .cm { font-size: 13px; padding: 3px 0; word-break: break-word; }
.admin-ctx .cm b { font-weight: 700; }
.admin-ctx .cm.hit { background: #fef2f2; border-radius: 8px; padding: 6px 8px; margin: 2px 0; }
.admin-ctx .cm.gone .txt { text-decoration: line-through; color: var(--muted); }
.admin-ctx .cm .gone-tag { font-size: 11px; color: var(--danger); margin-left: 4px; }
.admin-acts { display: flex; gap: 8px; margin-top: 10px; }
.admin-acts .btn { flex: 1; font-size: 14px; }
.admin-seg { margin-bottom: 12px; }
.invite-form { margin-bottom: 14px; }
.invite-new { background: var(--accent-soft); border: 1px solid #ddd6fe; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; text-align: center; }
.invite-new .code { font-size: 28px; font-weight: 800; letter-spacing: 3px; color: var(--accent); margin: 6px 0; font-variant-numeric: tabular-nums; }
.invite-new .link { font-size: 13px; color: var(--muted); word-break: break-all; margin-bottom: 10px; }
.invite-row { display: flex; align-items: flex-start; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.invite-row.revoked { opacity: 0.55; }
.invite-row .inv-main { flex: 1; min-width: 0; }
.invite-row .inv-label { font-weight: 700; }
.invite-row .inv-code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--accent); }
.invite-row .inv-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.invite-row .btn.tiny { padding: 6px 10px; font-size: 13px; }
.join .code-input { text-transform: uppercase; letter-spacing: 3px; font-size: 22px; text-align: center; font-weight: 700; }
.pf-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pf-head > h3 { min-width: 0; }
