/* ═══ App-Layout: Rail · Sidebar · Hauptbereich · Mitglieder ═══════════════ */
.shell { display: grid; grid-template-columns: 72px 264px minmax(0, 1fr) auto; height: 100dvh; position: relative; }
.shell > * { min-height: 0; min-width: 0; }

/* Server-Rail */
.rail { display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: calc(.75rem + var(--safe-top)) 0 calc(.75rem + var(--safe-bottom)); background: color-mix(in srgb, var(--bg) 70%, transparent); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-btn { position: relative; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 650; overflow: visible; flex: none; transition: border-radius var(--t) var(--ease), background var(--t), color var(--t), transform var(--t-fast); }
.rail-btn:hover { border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.rail-btn:active { transform: scale(.94); }
.rail-btn.active { border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.rail-btn img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.rail-btn::before { content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text); transform: translateY(-50%); transition: height var(--t) var(--ease); }
.rail-btn.active::before { height: 28px; }
.rail-btn.unread::before { height: 8px; }
.rail-btn:hover:not(.active)::before { height: 16px; }
.rail-btn .count-badge { position: absolute; right: -4px; bottom: -4px; border: 3px solid var(--bg); box-sizing: content-box; }
.rail-btn.home { background: linear-gradient(135deg, #a99bff, #5b8cff); color: #fff; }
.rail-btn.add { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--success); }
.rail-btn.add:hover { background: var(--success); color: #04120b; border-style: solid; border-color: transparent; }
.rail-sep { width: 28px; height: 2px; border-radius: 2px; background: var(--border-strong); flex: none; }
.rail-grow { flex: 1; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface-1) 78%, transparent); border-right: 1px solid var(--border); }
.sidebar-head { display: flex; align-items: center; gap: .5rem; height: 52px; padding: calc(0px + var(--safe-top)) .5rem 0 1rem; border-bottom: 1px solid var(--border); font-weight: 650; flex: none; cursor: pointer; transition: background var(--t-fast); box-sizing: content-box; }
.sidebar-head:hover { background: var(--hover); }
.sidebar-head .name { flex: 1; min-width: 0; font-size: .95rem; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: .6rem .5rem; }
.side-section { display: flex; align-items: center; gap: .35rem; padding: .9rem .5rem .3rem; font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
.side-section:hover { color: var(--text-2); }
.side-section .icon { width: 12px; height: 12px; transition: transform var(--t); }
.side-section.collapsed .icon.chev { transform: rotate(-90deg); }
.side-section .add { margin-left: auto; opacity: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.side-section:hover .add { opacity: 1; }
.side-section .add:hover { background: var(--hover); color: var(--text); }
.chan { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .38rem .6rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; text-align: left; position: relative; transition: background var(--t-fast), color var(--t-fast); }
.chan .icon { width: 18px; height: 18px; flex: none; }
.chan .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan:hover { background: var(--hover); color: var(--text-2); }
.chan.active { background: var(--active); color: var(--text); }
.chan.unread { color: var(--text); font-weight: 650; }
.chan .gear { opacity: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.chan:hover .gear { opacity: 1; }
.chan .gear:hover { background: var(--active); }
.chan .count-badge { margin-left: auto; }
.voice-users { padding: 0 0 .25rem 2rem; display: grid; gap: .1rem; }
.voice-user { display: flex; align-items: center; gap: .5rem; padding: .18rem .4rem; border-radius: 8px; font-size: .82rem; color: var(--text-2); }
.voice-user:hover { background: var(--hover); }
.voice-user .avatar { --s: 22px; }
.voice-user.speaking .avatar { box-shadow: 0 0 0 2px var(--success); }
.voice-user .icons { margin-left: auto; display: flex; gap: .25rem; color: var(--muted); }
.voice-user .icons .icon { width: 14px; height: 14px; }
.dm-item { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .4rem .55rem; border-radius: var(--radius-sm); color: var(--text-2); text-align: left; transition: background var(--t-fast); }
.dm-item:hover { background: var(--hover); }
.dm-item.active { background: var(--active); color: var(--text); }
.dm-item .meta { flex: 1; min-width: 0; }
.dm-item .n { font-weight: 550; }
.dm-item .s { font-size: .75rem; color: var(--muted); }
.dm-item.unread .n { color: var(--text); font-weight: 700; }

/* Voice-Statusleiste + Benutzerleiste */
.dock { flex: none; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 80%, transparent); padding-bottom: var(--safe-bottom); }
.voice-bar { padding: .65rem .75rem; border-bottom: 1px solid var(--border); display: grid; gap: .4rem; animation: slide-up var(--t) var(--ease); }
.voice-bar .st { display: flex; align-items: center; gap: .45rem; color: var(--success); font-weight: 650; font-size: .82rem; }
.voice-bar .st.warn { color: var(--warning); }
.voice-bar .st.bad { color: var(--danger); }
.voice-bar .st .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.voice-bar .st .bars i { width: 3px; background: currentColor; border-radius: 1px; opacity: .3; }
.voice-bar .st .bars i:nth-child(1) { height: 4px; } .voice-bar .st .bars i:nth-child(2) { height: 7px; } .voice-bar .st .bars i:nth-child(3) { height: 10px; } .voice-bar .st .bars i:nth-child(4) { height: 12px; }
.voice-bar .st[data-q="1"] .bars i:nth-child(-n+1), .voice-bar .st[data-q="2"] .bars i:nth-child(-n+2), .voice-bar .st[data-q="3"] .bars i:nth-child(-n+3), .voice-bar .st[data-q="4"] .bars i:nth-child(-n+4) { opacity: 1; }
.voice-bar .where { font-size: .78rem; color: var(--muted); }
.voice-bar .ctl { display: flex; gap: .25rem; }
.voice-bar .ctl .icon-btn { background: var(--surface-3); flex: 1; width: auto; }
.userbar { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; }
.userbar .who { flex: 1; min-width: 0; display: grid; text-align: left; padding: .2rem .35rem; border-radius: 10px; }
.userbar .who:hover { background: var(--hover); }
.userbar .who .n { font-weight: 650; font-size: .85rem; line-height: 1.2; }
.userbar .who .s { font-size: .72rem; color: var(--muted); line-height: 1.2; }

/* Hauptbereich */
.main { display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface-2) 72%, transparent); position: relative; overflow: hidden; /* schneidet die eingeklappte Mitgliederliste ab – sonst verbreitert sie auf Handys die Seite */ }
.topbar { display: flex; align-items: center; gap: .6rem; height: calc(52px + var(--safe-top)); padding: var(--safe-top) .9rem 0; border-bottom: 1px solid var(--border); flex: none; background: color-mix(in srgb, var(--surface-2) 60%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 5; }
.topbar .title { font-weight: 650; display: flex; align-items: center; gap: .5rem; min-width: 0; }
.topbar .title .icon { color: var(--muted); width: 20px; height: 20px; }
.topbar .topic { color: var(--muted); font-size: .85rem; padding-left: .75rem; border-left: 1px solid var(--border-strong); min-width: 0; }
.topbar .actions { margin-left: auto; display: flex; gap: .15rem; align-items: center; }
.menu-btn { display: none; }
.content { flex: 1; min-height: 0; display: flex; }
.content > .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Mitgliederliste */
.members { width: 248px; border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-1) 70%, transparent); overflow-y: auto; padding: .5rem .5rem 1rem; flex: none; }
.members .grp { padding: 1rem .5rem .3rem; font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.member { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .35rem .5rem; border-radius: var(--radius-sm); text-align: left; transition: background var(--t-fast); }
.member:hover { background: var(--hover); }
.member .avatar { --s: 34px; --dot-bg: var(--surface-1); }
.member .meta { flex: 1; min-width: 0; }
.member .n { font-weight: 550; line-height: 1.2; color: var(--c, var(--text)); }
.member .s { font-size: .73rem; color: var(--muted); }
.member.off { opacity: .5; }
.member.off:hover { opacity: .85; }

/* Willkommen / Leerzustand */
.welcome { flex: 1; display: grid; place-items: center; padding: 2rem; text-align: center; overflow-y: auto; }
.welcome .inner { max-width: 440px; display: grid; gap: .9rem; justify-items: center; animation: slide-up 380ms var(--ease); }
.welcome h1 { font-size: 1.6rem; }
.welcome p { color: var(--muted); }

/* ── Tablet ── */
@media (max-width: 1180px) {
  .members { position: absolute; right: 0; top: calc(52px + var(--safe-top)); bottom: 0; z-index: 20; width: min(280px, 86vw); box-shadow: var(--shadow); transform: translateX(105%); transition: transform var(--t) var(--ease); background: var(--surface-1); }
  .members.open { transform: none; }
}

/* ── Telefon: Rail + Sidebar als Drawer ── */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 60; transform: translateX(calc(-100% - 90px)); visibility: hidden; transition: transform 260ms var(--ease), visibility 0s linear 260ms; background: var(--surface-1); box-shadow: var(--shadow); }
  .rail { left: 0; width: 72px; }
  .sidebar { left: 72px; width: min(280px, calc(100vw - 72px)); }
  .shell.nav-open .rail, .shell.nav-open .sidebar { transform: none; visibility: visible; transition-delay: 0s; }
  .nav-scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); animation: fade-in var(--t) ease; }
  .menu-btn { display: inline-grid; }
  .topbar .topic { display: none; }
  .fullpage { flex-direction: column; }
  .fullpage-nav { width: 100%; flex-direction: row; overflow-x: auto; padding: calc(.6rem + var(--safe-top)) 3.5rem .6rem .6rem; border-right: 0; border-bottom: 1px solid var(--border); gap: .25rem; }
  .fullpage-nav .heading { display: none; }
  .fullpage-nav .nav-item { width: auto; white-space: nowrap; }
  .fullpage-body { padding: 1.25rem 1rem 3rem; }
  .fullpage-close { top: calc(.55rem + var(--safe-top)); right: .6rem; width: 36px; height: 36px; }
  .modal { max-height: 92dvh; }
  .scrim { align-items: end; padding: 0; }
  .scrim .modal { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: slide-up var(--t) var(--ease); }
  #toast-root { left: 1rem; right: 1rem; width: auto; bottom: calc(5rem + var(--safe-bottom)); }
}
@media (max-width: 480px) { .auth-card { padding: 1.6rem 1.25rem 1.3rem; } }
.loose-drop { height: 6px; }

/* ── Freunde (Startseite) ── */
.fr-top { gap: .5rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.fr-top::-webkit-scrollbar { display: none; }
.fr-top .title { flex: 0 0 auto; padding-right: .6rem; margin-right: .2rem; border-right: 1px solid var(--border); }
.fr-tabs { display: flex; gap: .25rem; align-items: center; flex: 0 0 auto; }
.fr-tab { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .7rem; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.fr-tab:hover { background: var(--surface-3); color: var(--text); }
.fr-tab.active { background: var(--surface-4); color: var(--text); }
.fr-tab.add { background: var(--success, #3ba55d); color: #fff; }
.fr-tab.add.active { background: transparent; color: var(--success, #3ba55d); }
.count-badge.inline { position: static; transform: none; margin-left: .1rem; }
.fr-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.5rem 2rem; }
.fr-search { max-width: 100%; margin-bottom: .9rem; }
.fr-count { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: .2rem 0 .5rem; }
.fr-list { display: grid; }
.fr-row { display: flex; align-items: center; gap: .8rem; padding: .6rem .6rem; border-top: 1px solid var(--border); border-radius: 8px; cursor: default; }
.fr-row[role=button] { cursor: pointer; }
.fr-row:hover { background: var(--surface-2); border-top-color: transparent; }
.fr-row:hover + .fr-row { border-top-color: transparent; }
.fr-meta { flex: 1; min-width: 0; }
.fr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-actions { display: flex; gap: .4rem; }
.fr-act { background: var(--surface-3); border-radius: 50%; width: 36px; height: 36px; }
.fr-act.ok:hover { color: var(--success, #3ba55d); }
.fr-act.no:hover { color: var(--danger); }
.fr-empty { display: grid; justify-items: center; gap: .6rem; padding: 3rem 1rem; color: var(--muted); text-align: center; }
.fr-empty.welcome-like { color: var(--text-2); padding-top: 4rem; }
.fr-empty.welcome-like h2 { color: var(--text); margin: .2rem 0 0; }
.fr-addwrap { max-width: 640px; }
.fr-addwrap h2 { margin: .2rem 0 .3rem; }
.fr-add { display: flex; gap: .5rem; margin-top: .8rem; padding: .4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.fr-add:focus-within { border-color: var(--accent); }
.fr-add .input { border: 0; background: transparent; flex: 1; min-width: 0; }
.pill-ok { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--success, #3ba55d); font-weight: 600; }
.blocked-stub { display: flex !important; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; padding: .3rem 1.25rem .3rem 4.5rem; }
.linklike { background: none; border: 0; color: var(--accent-strong, var(--accent)); cursor: pointer; padding: 0; font: inherit; }
.linklike:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .fr-top { flex-wrap: wrap; height: auto; min-height: 52px; padding-top: .45rem; padding-bottom: .45rem; overflow: visible; row-gap: .4rem; }
  .fr-top .title { border-right: 0; }
  .fr-tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: .1rem; }
  .fr-tabs::-webkit-scrollbar { display: none; }
  .fr-tab.add .lbl { display: none; }
  .fr-body { padding: .8rem .8rem 2rem; }
  .blocked-stub { padding-left: 1rem; }
}
