/* =====================================================================
   Sternenforum – Basis-Layout (theme-unabhängig)
   Hier steht nur STRUKTUR. Farben, Schriften, Rahmen, Effekte kommen aus
   /themes/<id>/theme.css über die unten definierten CSS-Variablen.
   ===================================================================== */
:root {
  --font: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: var(--font);
  --font-size: 15px;
  --bg: #f4f5f7;
  --bg-image: none;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --border: #d5d9e0;
  --border-strong: #9aa3b2;
  --text: #1d2330;
  --text-muted: #687083;
  --heading: var(--text);
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --accent-2: #c58a12;
  --danger: #c93a3a;
  --ok: #2e9b5a;
  --highlight: #e8a90c;
  --highlight-bg: rgba(232, 169, 12, .10);
  --mine-bg: transparent;
  --radius: 8px;
  --radius-sm: 5px;
  --gap: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --topbar-bg: var(--surface);
  --topbar-h: 60px;
  --sidebar-w: 260px;
  --focus: 0 0 0 2px var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--font-size); line-height: 1.45;
  color: var(--text); background: var(--bg); background-image: var(--bg-image); background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.ico { display: inline-flex; width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.boot { display: grid; place-items: center; height: 100vh; color: var(--text-muted); }
.boot-error { color: var(--danger); }
.meta { color: var(--text-muted); font-size: .85em; }
.empty, .loading, .hint { color: var(--text-muted); }
.empty { padding: 8px 0; }
.hint { font-size: .9em; }
.notice { padding: 12px 16px; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; }

/* ---------- Bedienelemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-ghost { background: transparent; }
.btn-ghost.is-active { border-color: var(--highlight); color: var(--highlight); }
.btn-sm { padding: 4px 10px; font-size: .88em; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border); }
.icon-btn.is-active { color: var(--highlight); }

input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-label { font-size: .88em; color: var(--text-muted); }
.field-hint { font-size: .8em; color: var(--text-muted); }
.form-error { color: var(--danger); min-height: 1.2em; margin-bottom: 8px; }
.form-narrow { max-width: 420px; }

.badge-count {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
.role-badge { font-size: 10.5px; padding: 1px 6px; border-radius: 3px; border: 1px solid currentColor; text-transform: uppercase; letter-spacing: .04em; }
.role-badge.role-admin { color: var(--accent-2); }
.role-badge.role-moderator { color: var(--accent); }
.avatar {
  --hue: 200; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: hsl(var(--hue) 45% 45%); color: #fff; font-weight: 700; font-size: 13px;
}
.who { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; display: inline-block; }
.is-online > .status-dot, .status-dot.is-on { background: var(--ok); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); min-height: 46px; }
.panel-title { font-size: 1.05em; display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 14px 16px; }
.panel-foot { padding: 10px 16px 12px; border-top: 1px solid var(--border); }

/* ---------- Grundgerüst ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 18px; min-height: var(--topbar-h); padding: 6px 18px;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; min-width: 0; }
.brand-emblem { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--accent); }
.brand-title { font-size: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .8em; color: var(--text-muted); }
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.nav-link { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none !important; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--accent); background: var(--surface-2); }
.nav-link .badge-count { margin-left: 2px; }
.userbox { display: flex; align-items: center; gap: 6px; }
.userbox-me { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none !important; padding: 4px 8px; border-radius: var(--radius-sm); }
.userbox-me:hover { background: var(--surface-2); }

.motd {
  flex: none; display: flex; align-items: flex-start; gap: 12px; margin: 12px 18px 0; padding: 10px 14px;
  border: 1px solid var(--highlight); background: var(--highlight-bg); border-radius: var(--radius);
}
.motd-icon { color: var(--highlight); font-size: 1.4em; line-height: 1; padding-top: 2px; }
.motd-content { flex: 1; min-width: 0; }
.motd-label { font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--highlight); font-weight: 700; }
.motd-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-w); gap: var(--gap); padding: var(--gap) 18px; }
.main { min-height: 0; overflow: auto; padding-right: 2px; }
.main[data-view="chat"], .main[data-view="dm"] { overflow: hidden; }
.sidebar { min-height: 0; overflow: auto; }

.offline-banner { display: none; position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 8px 16px; background: var(--danger); color: #fff; border-radius: var(--radius); z-index: 50; }
.shell.is-offline .offline-banner { display: block; }

/* ---------- Sprachräume ---------- */
:root { --room-blau: #4aa3ff; --room-rot: #ff5a5a; --room-gold: #e9b949; }
.sidebar { display: flex; flex-direction: column; gap: var(--gap); }
.voice-rooms { display: flex; flex-direction: column; gap: 8px; }
.voice-room { --room: var(--room-blau); border: 1px solid var(--border); border-left: 3px solid var(--room); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface-2); }
.voice-room.room-rot { --room: var(--room-rot); }
.voice-room.room-gold { --room: var(--room-gold); }
.voice-room.is-joined { border-color: var(--room); box-shadow: 0 0 0 1px var(--room) inset; }
.voice-room-head { display: flex; align-items: center; gap: 8px; }
.voice-room-head .btn { margin-left: auto; }
.voice-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--room); box-shadow: 0 0 6px var(--room); flex: none; }
.voice-room-name { font-weight: 600; }
.vp-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.vp { display: flex; align-items: center; gap: 7px; padding: 2px 4px; font-size: .9em; border-radius: var(--radius-sm); }
.vp .avatar { width: 24px; height: 24px; font-size: 11px; transition: box-shadow .12s; }
.vp.is-speaking .avatar { box-shadow: 0 0 0 2px var(--room), 0 0 10px var(--room); }
.vp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp.is-me .vp-name::after { content: " (du)"; color: var(--text-muted); font-size: .85em; }
.vp-flag { color: var(--danger); display: inline-flex; }
.vp-kick { width: 22px; height: 22px; opacity: 0; }
.vp:hover .vp-kick { opacity: 1; }
.voice-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.voice-controls .btn { flex: 1; }
.voice-hint { margin: 4px 0 0; font-size: .82em; color: var(--text-muted); }

/* ---------- Mitgliederliste ---------- */
.userlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.user-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-sm); }
.user-item:hover { background: var(--surface-2); }
.user-item:not(.is-online) { opacity: .62; }
.user-item .avatar { width: 26px; height: 26px; font-size: 12px; }
.user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item.is-me .user-name::after { content: " (du)"; color: var(--text-muted); font-size: .85em; }
.dm-btn { width: 28px; height: 28px; }
.dm-btn.has-unread { color: var(--danger); }
.sidebar-hint { margin: 12px 0 0; font-size: .8em; color: var(--text-muted); }

/* ---------- Brotkrumen ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9em; }
.crumb.is-current { color: var(--text-muted); }
.crumb-sep { color: var(--text-muted); }

/* ---------- Forum ---------- */
.cat-list, .thread-list, .hl-list, .conv-list { list-style: none; margin: 0; padding: 0; }
.cat-item { display: grid; grid-template-columns: minmax(0, 1fr) 150px 230px; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.cat-item:last-child, .thread-item:last-child, .hl-item:last-child, .conv-item:last-child { border-bottom: 0; }
.cat-main { display: flex; flex-direction: column; color: inherit; text-decoration: none !important; }
.cat-name { font-family: var(--font-head); font-size: 1.08em; color: var(--accent); }
.cat-desc { color: var(--text-muted); font-size: .9em; margin: 0 0 6px; }
.cat-stats { display: flex; flex-direction: column; font-size: .88em; color: var(--text-muted); }
.cat-stats b { color: var(--text); }
.cat-last { display: flex; flex-direction: column; min-width: 0; font-size: .9em; }
.cat-last a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thread-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) 110px 150px; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.thread-flags { display: flex; gap: 2px; color: var(--accent-2); }
.thread-main { display: flex; flex-direction: column; color: inherit; text-decoration: none !important; min-width: 0; }
.thread-title { color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.thread-item.is-pinned .thread-title::before { content: ""; }
.thread-stats { font-size: .88em; color: var(--text-muted); }
.thread-stats b { color: var(--text); }
.thread-title-input { font-size: 1.05em; }

.hl-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.hl-link { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none !important; }
.hl-title { color: var(--highlight); font-weight: 600; }
.hl-snippet { color: var(--text-muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-mark { color: var(--highlight); display: inline-flex; align-items: center; gap: 3px; font-size: .82em; }

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post { display: grid; grid-template-columns: 130px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); scroll-margin: 80px; transition: box-shadow .3s; }
.post.is-highlighted { border-color: var(--highlight); background: var(--highlight-bg); }
.post.is-flash { box-shadow: 0 0 0 3px var(--accent); }
.post-author { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-right: 1px solid var(--border); text-align: center; overflow-wrap: anywhere; }
.post-author .avatar { width: 44px; height: 44px; font-size: 18px; }
.post-author-name { font-weight: 600; }
.post-main { padding: 10px 14px 14px; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.post-num { color: var(--text-muted); font-size: .85em; }
.post-actions, .msg-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.post-text, .msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Chat ---------- */
.chat-panel { height: 100%; display: flex; flex-direction: column; position: relative; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.chat-log { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.chat-more { align-self: center; margin-bottom: 10px; }
.chat-status.is-online { color: var(--ok); }
.msg { display: flex; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.msg:hover { background: var(--surface-2); }
.msg.is-mine { background: var(--mine-bg); }
.msg.is-highlighted { border-color: var(--highlight); background: var(--highlight-bg); }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.msg-author { font-weight: 600; }
.msg-time { color: var(--text-muted); font-size: .8em; }
.msg-actions { opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions .icon-btn { width: 26px; height: 26px; }

/* ---------- Anhänge ---------- */
.att-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none !important; }
.att-file { padding: 7px 10px; max-width: 320px; }
.att-file:hover { border-color: var(--accent); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--text-muted); font-size: .8em; white-space: nowrap; }
.att-img { padding: 3px; }
.att-img img { display: block; max-width: 280px; max-height: 220px; border-radius: 3px; }

/* ---------- Abstimmung ---------- */
.poll { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); max-width: 520px; }
.poll-q { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 8px; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; text-align: left;
}
.poll-option:hover:not(:disabled) { border-color: var(--accent); }
.poll-option:disabled { cursor: default; }
.poll-option.is-voted { border-color: var(--accent); }
.poll-bar { position: absolute; inset: 0; pointer-events: none; }
.poll-fill { display: block; height: 100%; width: 0; background: var(--accent); opacity: .18; transition: width .4s; }
.poll-check, .poll-text, .poll-count { position: relative; }
.poll-check { width: 14px; color: var(--accent); font-weight: 700; }
.poll-text { flex: 1; }
.poll-count { color: var(--text-muted); font-size: .85em; white-space: nowrap; }
.poll-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: .82em; color: var(--text-muted); }
.poll.is-closed .poll-q::after { content: "beendet"; margin-left: auto; font-size: .75em; color: var(--text-muted); border: 1px solid var(--border); padding: 0 6px; border-radius: 3px; font-weight: 400; }

/* ---------- Eingabefeld ---------- */
.composer { position: relative; display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-input { flex: 1; min-height: 44px; max-height: 40vh; }
.composer-tools { display: flex; gap: 4px; align-items: center; }
.composer-help { font-size: .75em; color: var(--text-muted); }
.drop-hint {
  display: none; position: absolute; inset: -6px; z-index: 5; place-items: center; align-content: center; gap: 6px;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--accent); font-weight: 600; pointer-events: none;
}
.composer.is-dragover .drop-hint { display: grid; }
.is-drop-target { outline: 2px dashed var(--accent); outline-offset: 3px; }
.att-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.att-chips:empty { display: none; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .85em; max-width: 280px; }
.att-chip.is-uploading { opacity: .7; }
.chip-thumb { width: 26px; height: 26px; object-fit: cover; border-radius: 3px; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-progress { color: var(--text-muted); white-space: nowrap; }
.chip-remove { border: 0; background: none; cursor: pointer; color: var(--text-muted); display: inline-grid; padding: 2px; }
.chip-remove:hover { color: var(--danger); }
.poll-editor { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.poll-editor-head { display: flex; align-items: center; gap: 8px; }
.poll-editor-head .icon-btn { margin-left: auto; }
.poll-opt-list { display: flex; flex-direction: column; gap: 4px; }
.poll-opt-row { display: flex; gap: 4px; }
.poll-editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Privatnachrichten ---------- */
.conv-item { border-bottom: 1px solid var(--border); }
.conv-link { display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: inherit; text-decoration: none !important; }
.conv-link:hover { background: var(--surface-2); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.conv-last { color: var(--text-muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-item.has-unread .conv-name { color: var(--accent); }
.conv-new { width: auto; min-width: 200px; }

/* ---------- Verwaltung ---------- */
.cat-edit { display: grid; grid-template-columns: 64px minmax(120px, 1fr) minmax(160px, 2fr) auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.cat-edit-head { margin-bottom: 2px; }
.cat-new { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); grid-template-columns: 64px minmax(120px, 1fr) minmax(160px, 2fr) auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; font-size: .85em; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-strong); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.is-locked td { opacity: .6; }
.table select { width: auto; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Anmeldung ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .panel-head { justify-content: flex-start; gap: 12px; padding: 16px 20px; }
.auth-card .panel-body { padding: 18px 20px 22px; }
.auth-title { font-size: 1.3em; }
.auth-sub { color: var(--text-muted); font-size: .88em; }
.intro { margin-top: 0; color: var(--text-muted); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); cursor: pointer; margin-bottom: -1px; }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.pw-wrap { margin: -6px 0 12px; }
.pw-meter { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pw-meter-fill { height: 100%; width: 0; transition: width .2s, background .2s; background: var(--danger); }
.pw-meter[data-level="medium"] .pw-meter-fill { background: var(--highlight); }
.pw-meter[data-level="good"] .pw-meter-fill, .pw-meter[data-level="strong"] .pw-meter-fill { background: var(--ok); }
.pw-meter-text { font-size: .8em; color: var(--text-muted); margin-top: 3px; }

/* ---------- Hinweise ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; transition: opacity .4s, transform .4s; }
.toast-error { border-color: var(--danger); color: var(--danger); }
.toast-ok { border-color: var(--ok); }
.toast-dm { border-color: var(--accent); }
.toast.is-out { opacity: 0; transform: translateY(8px); }


/* ---------- Chat-Archiv ---------- */
.chat-archive-link { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 5px 12px; font-size: .85em; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.ico.flip { transform: scaleX(-1); }
.archive-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.archive-search { flex: 1; width: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.archive-info { white-space: nowrap; }
.archive-bar:empty { display: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 10px; }
.archive-list { display: flex; flex-direction: column; gap: 2px; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; color: var(--text-muted); font-size: .8em; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }


/* ---------- Whiteboard ---------- */
.wb-new input { flex: 1; min-width: 220px; width: auto; }
.wb-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.wb-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.wb-card:hover { border-color: var(--accent); }
.wb-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none !important; }
.wb-card-title { font-weight: 600; color: var(--accent); }
.wb-card-snippet { color: var(--text-muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-card-side { display: flex; align-items: center; gap: 8px; }
.wb-card-live { display: inline-flex; align-items: center; gap: 2px; }
.wb-card-live .avatar { width: 22px; height: 22px; font-size: 10px; }
.main[data-view="wb"] { overflow: hidden; }
.wb-panel { height: 100%; display: flex; flex-direction: column; }
.wb-head-left { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.wb-title { flex: 1; font-size: 1.1em; font-weight: 600; border-color: transparent !important; background: transparent !important; padding: 4px 8px; }
.wb-title:hover, .wb-title:focus { border-color: var(--border) !important; }
.wb-people { display: flex; align-items: center; gap: 3px; }
.wb-people .avatar { width: 24px; height: 24px; font-size: 11px; }
.wb-people .meta { margin-left: 6px; }
.wb-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.wb-btn { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text); cursor: pointer; font-size: .9em; display: inline-flex; align-items: center; justify-content: center; }
.wb-btn:hover { border-color: var(--border-strong); background: var(--surface); color: var(--accent); }
.wb-sep { width: 1px; align-self: stretch; margin: 3px 6px; background: var(--border); }
.wb-body { flex: 1; min-height: 0; overflow: auto; }
.wb-editor { max-width: 900px; margin: 0 auto; min-height: 100%; padding: 8px 16px 80px; outline: none; line-height: 1.6; font-size: 1.02em; }
.wb-editor > * { position: relative; margin: 0 0 .7em; padding: 1px 6px; border-left: 3px solid transparent; transition: border-color .2s, background .2s; }
.wb-editor h1 { font-size: 1.7em; } .wb-editor h2 { font-size: 1.35em; } .wb-editor h3 { font-size: 1.12em; }
.wb-editor ul, .wb-editor ol { padding-left: 2em; }
.wb-editor blockquote { border-left-color: var(--border-strong); color: var(--text-muted); font-style: italic; }
.wb-editor pre { font-family: Consolas, "Cascadia Mono", monospace; background: var(--surface-2); padding: 8px 10px; white-space: pre-wrap; }
.wb-editor code { font-family: Consolas, "Cascadia Mono", monospace; background: var(--surface-2); padding: 0 3px; }
.wb-editor mark { background: rgba(255, 227, 110, .55); color: inherit; }
.wb-editor a { cursor: text; }
.wb-editor > .is-locked { --lock-hue: 200; border-left-color: hsl(var(--lock-hue) 70% 55%); background: hsl(var(--lock-hue) 70% 55% / .08); cursor: not-allowed; }
.wb-editor > .is-locked::after {
  content: attr(data-lock); position: absolute; right: 0; top: -1.1em; font-size: 11px; line-height: 1; padding: 2px 6px;
  background: hsl(var(--lock-hue) 70% 45%); color: #fff; font-style: normal; font-weight: 600; pointer-events: none; white-space: nowrap;
}
.wb-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.auth-forgot { text-align: center; margin: 14px 0 0; font-size: .9em; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- Kopfleiste: Wetter & Musik ---------- */
.ico svg .fill { fill: currentColor; }
.ico svg .thick { stroke-width: 3; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.weather {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: default;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); white-space: nowrap;
}
.weather-icon { width: 1.5em; height: 1.5em; color: var(--accent-2); }
.weather-temp { font-weight: 700; font-size: 1.05em; }
.weather-place { color: var(--text-muted); font-size: .82em; }
.weather.is-unavailable { opacity: .6; }
.weather-pop {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 240px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.3);
  white-space: normal; color: var(--text); font-size: .9em;
}
.weather:hover .weather-pop, .weather:focus .weather-pop, .weather:focus-within .weather-pop { display: block; }
.weather-pop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.weather-pop-head .ico { width: 2.2em; height: 2.2em; color: var(--accent-2); }
.weather-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }
.weather-row span { color: var(--text-muted); }
.weather-foot { margin-top: 8px; }
.player {
  display: flex; align-items: center; gap: 2px; padding: 3px 6px 3px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.player-note { color: var(--text-muted); margin-right: 2px; }
.player.is-playing .player-note { color: var(--accent); animation: sf-pulse 1.6s ease-in-out infinite; }
@keyframes sf-pulse { 50% { opacity: .35; } }
.player .icon-btn { width: 28px; height: 28px; }
.player-toggle { color: var(--accent); }
.player .icon-btn:disabled { opacity: .4; cursor: default; }
.player-shuffle.is-active, .player-repeat.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.player-track { --p: 0%; position: relative; margin: 0 4px; border-radius: var(--radius-sm); overflow: hidden; }
.player-progress {
  position: absolute; inset: 0 auto 0 0; width: var(--p); pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent) 45%, transparent));
  border-right: 2px solid var(--accent); transition: width .25s linear;
}
.player-track .player-select { position: relative; background: transparent !important; }
.player-seek { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: pointer; z-index: 2; }
.player-seek:hover { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.player-select { width: 190px; padding: 4px 6px; font-size: .85em; }
.player-vol { width: 70px; accent-color: var(--accent); margin-left: 4px; }
.player.is-empty .player-vol, .player.is-empty .player-track .player-progress { display: none; }

/* ---------- Sternenhimmel-Menü ---------- */
.stars-wrap { position: relative; }
.stars-btn { color: var(--accent-2); }
.stars-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 70; width: 250px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.stars-menu-title { font-size: .75em; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding: 2px 6px 6px; }
.stars-opt { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text); cursor: pointer; text-align: left; }
.stars-opt:hover { background: var(--surface-2); border-color: var(--border); }
.stars-opt-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; }
.stars-opt.is-active .stars-opt-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px var(--accent); }
.stars-opt-text { display: flex; flex-direction: column; }
.hyperspace { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }

/* ---------- Editor für Beiträge ---------- */
.composer-format { display: flex; align-items: center; gap: 2px; }
.fmt-btn { min-width: 30px; height: 28px; padding: 0 7px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: .95em; }
.fmt-btn:hover { color: var(--accent); border-color: var(--border); background: var(--surface); }
.fmt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rich-input {
  min-height: 44px; max-height: 40vh; overflow-y: auto; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none;
}
.rich-input:focus { border-color: var(--accent); }
.rich-input.is-empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.rich-input img, .inline-img { max-width: min(100%, 420px); max-height: 260px; vertical-align: middle; border-radius: 3px; margin: 2px 0; }
.rich-input a { color: var(--accent); }
.inline-img-link { display: inline-block; line-height: 0; }
.edit-box { margin: 6px 0 4px; padding: 10px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--surface); }
.edit-title { margin-bottom: 4px; font-weight: 600; }
.edited-mark { color: var(--text-muted); font-size: .78em; font-style: italic; cursor: help; }
.composer.is-edit .composer-help { margin-top: -2px; }


/* ---------- Avatare ---------- */
.avatar { overflow: hidden; }
.avatar.has-img { background: var(--surface-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-editor { display: flex; gap: 18px; align-items: stretch; flex-wrap: wrap; }
.avatar-preview .avatar { width: 96px; height: 96px; font-size: 40px; }
.avatar-drop {
  flex: 1; min-width: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 14px; border: 2px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; text-align: center; color: var(--text-muted);
}
.avatar-drop .ico { width: 1.8em; height: 1.8em; color: var(--accent); }
.avatar-drop:hover, .avatar-drop.is-dragover { border-color: var(--accent); color: var(--text); }
.avatar-gallery-title { font-size: .9em; margin: 18px 0 8px; color: var(--text-muted); font-weight: 600; }
.avatar-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-choice { width: 64px; height: 64px; padding: 2px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.avatar-choice img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-choice:hover { border-color: var(--accent); }
.avatar-choice.is-active { border-color: var(--highlight); box-shadow: 0 0 0 2px var(--highlight); }

.brand, .brand-text { min-width: 0; }
.brand { flex: 0 1 auto; }
@media (max-width: 1550px) {
  .weather-place, .player-vol, .player-note { display: none; }
  .player-select { width: 140px; }
  .topbar { gap: 12px; }
}
@media (max-width: 1520px) {
  .nav-label, .userbox-name { display: none; }
  .nav-link { padding: 8px 11px; }
}

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 900px) {
  .shell { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .mainnav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .userbox { margin-left: auto; }
  .nav-label { display: none; }
  .layout { display: flex; flex-direction: column; padding: 10px; }
  .main { overflow: visible; }
  .main[data-view="chat"], .main[data-view="dm"], .main[data-view="wb"] { height: 80vh; }
  .cat-item { grid-template-columns: 1fr; gap: 4px; }
  .thread-item { grid-template-columns: 26px 1fr; }
  .thread-stats, .thread-last { display: none; }
  .post { grid-template-columns: 1fr; }
  .post-author { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 12px; }
  .post-author .avatar { width: 30px; height: 30px; font-size: 13px; }
  .cat-edit, .cat-new { grid-template-columns: 1fr; }
  .userbox-name { display: none; }
  .topbar-tools { order: 4; width: 100%; justify-content: space-between; }
  .player-select { flex: 1; width: auto; }
  .weather-pop { right: auto; left: 0; }
}
.inline > input[type=email] { width: auto; flex: 1; max-width: 340px; }
.le-val { padding: 6px 0; } .le-err { color: var(--danger); }
