/* VbForum – Layout nach Mockup. Farben als Tokens, Dark Mode über prefers-color-scheme. */
:root {
  --bg: #F4F5F7; --card: #FFFFFF; --head: #FAFBFC; --border: #E3E6EB; --border-soft: #EEF0F3; --input-border: #DDE1E7;
  --ink: #16191F; --ink-2: #2B3240; --muted: #5A6170; --muted-2: #4A5160;
  --accent: #1F56C3; --accent-hover: #163F91; --accent-soft: #E8EEFB; --accent-border: #C9D7F3; --own-bg: #F3F6FC;
  --chip: #EEF1F5; --sticky-bg: #FFFCF8; --unread-bg: #F7F9FD;
  --warn-bg: #FDF0E6; --warn-fg: #8A3A0C; --ok-bg: #E4F2EA; --ok-fg: #1E5B3A; --danger: #B42318; --danger-bg: #FDECEA;
  --badge: #C2410C; --quote-bg: #F4F6FA; --code-bg: #16191F; --code-fg: #E8EAEE; --mark: #FFE9A8;
  --radius: 14px; --radius-s: 10px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --card: #191C22; --head: #1D2027; --border: #2A2F38; --border-soft: #23272F; --input-border: #343A45;
    --ink: #E8EAEE; --ink-2: #D2D6DD; --muted: #9AA2B1; --muted-2: #A9B0BD;
    --accent: #7AA2F7; --accent-hover: #A5C0FA; --accent-soft: #1E2A44; --accent-border: #2E4472; --own-bg: #18202F;
    --chip: #262B34; --sticky-bg: #1E1C18; --unread-bg: #182033;
    --warn-bg: #3A2716; --warn-fg: #F5B98A; --ok-bg: #16301F; --ok-fg: #8FD3A7; --danger: #F08A80; --danger-bg: #3A1C1A;
    --badge: #E06A2C; --quote-bg: #1F232B; --code-bg: #0B0D10; --code-fg: #E8EAEE; --mark: #6B5A1E;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1:focus, h1:focus-visible { outline: none; }

/* ---------- Kopf ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.container { max-width: none; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.site-header .container { padding-top: 10px; padding-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.brand-logo { max-height: 40px; width: auto; display: block; }
.brand-name { font-weight: 700; font-size: 17px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 12px; border-radius: 8px; text-decoration: none; color: var(--muted-2); font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--chip); color: var(--ink); }
.nav a.active { background: var(--chip); color: var(--ink); font-weight: 600; }
.search-box { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--input-border); border-radius: var(--radius-s); padding: 0 12px; min-height: 44px; }
.search-box input { border: 0; background: transparent; flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--ink); outline: none; }
.user-area { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 44px; height: 44px; border: 0; background: transparent; border-radius: var(--radius-s); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted-2); text-decoration: none; }
.icon-btn:hover { background: var(--chip); color: var(--ink); }
.badge-count { position: absolute; top: 7px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--badge); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-chip { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); padding: 4px 10px 4px 4px; border-radius: 999px; min-height: 44px; }
.user-chip:hover { background: var(--chip); color: var(--ink); }
.user-chip .name { font-weight: 600; font-size: 14px; }

.avatar { --size: 34px; width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(var(--size) * 0.36); overflow: hidden; background: #DCE6FA; color: #1F3F86; object-fit: cover; }
.avatar.c1 { background: #E4F2EA; color: #1E5B3A; } .avatar.c2 { background: #FBEBDD; color: #7A3B10; } .avatar.c3 { background: #ECE6F7; color: #4B2E83; }
@media (prefers-color-scheme: dark) {
  .avatar { background: #24365C; color: #C9D8FA; } .avatar.c1 { background: #1D3A28; color: #A9DDB9; } .avatar.c2 { background: #42291A; color: #F2C49E; } .avatar.c3 { background: #33284A; color: #D5C7F0; }
}

/* ---------- Seite ---------- */
main.page { padding-top: 24px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 20px; }
.breadcrumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted-2); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .current { color: var(--ink); font-weight: 500; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.btn { min-height: 44px; padding: 0 16px; border-radius: var(--radius-s); border: 1px solid var(--input-border); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--chip); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0B1220; } }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; font-weight: 500; color: var(--muted-2); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--head); }
.card-head h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.card-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }

.alert { border-radius: var(--radius-s); padding: 12px 16px; font-size: 14px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-err { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--ink); border-color: var(--accent-border); }
.alert-warn { background: var(--warn-bg); color: var(--warn-fg); }

/* ---------- Forenübersicht ---------- */
.forum-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.forum-row:last-child { border-bottom: 0; }
.forum-main { flex: 999 1 380px; min-width: 0; display: flex; gap: 14px; align-items: flex-start; }
.forum-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-s); background: var(--chip); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.forum-icon.unread { background: var(--accent); color: #fff; }
.forum-title { font-weight: 650; font-size: 16px; color: var(--ink); text-decoration: none; }
.forum-title:hover { color: var(--accent); }
.forum-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ink-2); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--accent); }
.forum-stats { flex: 0 0 150px; display: flex; gap: 20px; font-size: 13px; color: var(--muted); }
.forum-stats div { display: flex; flex-direction: column; }
.forum-stats strong { color: var(--ink); font-size: 15px; font-weight: 600; }
.forum-last { flex: 1 1 240px; min-width: 0; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.forum-last .info { display: flex; flex-direction: column; min-width: 0; }
.forum-last a { color: var(--ink); font-weight: 500; text-decoration: none; }
.forum-last a:hover { color: var(--accent); }
.stats-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.stat { flex: 1 1 200px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; }

/* ---------- Themenliste ---------- */
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.sub-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.sub-card:hover { border-color: var(--accent-border); color: var(--ink); }
.sub-card .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; display: inline-block; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--head); }
.toolbar label { font-size: 13px; color: var(--muted-2); font-weight: 500; }
select, .select { min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--input-border); background: var(--card); font: inherit; font-size: 14px; color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.seg a, .seg button { min-height: 40px; padding: 0 12px; border: 0; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.seg .on { background: var(--ink); color: var(--card); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); min-height: 40px; padding: 0 6px; }
.check input { width: 16px; height: 16px; }
.list-head { display: flex; gap: 24px; padding: 8px 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
.thread-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft); background: var(--card); }
.thread-row.sticky { background: var(--sticky-bg); }
.thread-row.moderated, .thread-row.deleted { opacity: .8; }
.thread-main { flex: 999 1 380px; min-width: 0; display: flex; gap: 12px; align-items: flex-start; }
.thread-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.thread-title { font-size: 15px; color: var(--ink); text-decoration: none; font-weight: 500; }
.thread-title.unread { font-weight: 650; }
.thread-title:hover { color: var(--accent); }
.thread-sub { font-size: 13px; color: var(--muted); }
.thread-sub a { color: var(--muted); }
.mini-pager a { font-size: 12px; padding: 0 4px; color: var(--muted); }
.thread-counts { flex: 0 0 150px; font-size: 13px; color: var(--muted); }
.thread-counts strong { color: var(--ink); font-weight: 600; }
.thread-last { flex: 1 1 220px; min-width: 0; font-size: 13px; display: flex; flex-direction: column; }
.thread-last a { color: var(--muted); text-decoration: none; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted-2); white-space: nowrap; }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.list-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.pager { display: flex; gap: 4px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; min-height: 36px; padding: 0 8px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink); text-decoration: none; }
.pager a:hover { background: var(--chip); }
.pager .on { background: var(--accent); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .pager .on { color: #0B1220; } }
.pager .gap { color: var(--muted); min-width: 20px; }

/* ---------- Beiträge ---------- */
.post { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-wrap: wrap; overflow: hidden; scroll-margin-top: 80px; }
.post.own { border-color: var(--accent-border); }
.post.own .post-aside { background: var(--own-bg); }
.post.moderated { border-color: #E9C46A; }
.post.deleted { opacity: .7; }
.post-aside { flex: 1 0 180px; max-width: 100%; padding: 18px 20px; background: var(--head); border-right: 1px solid var(--border-soft); display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 12px; }
.post-author { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); min-width: 0; }
.post-author .name { font-weight: 650; font-size: 15px; color: var(--ink); text-decoration: none; }
.post-author .rank { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--ink-2); }
.post-main { flex: 999 1 480px; min-width: 0; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.post-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.post-meta a { color: var(--muted); text-decoration: none; }
.post-body { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.post-edited { font-size: 12px; color: var(--muted); font-style: italic; }
.signature { border-top: 1px solid var(--border-soft); padding-top: 10px; font-size: 13px; color: var(--muted); max-height: 160px; overflow: hidden; }
.signature img { max-height: 120px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.post-notice { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-fg); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.att-thumb { display: block; width: 150px; height: 110px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; background: var(--chip); }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-file { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input-border); color: var(--ink); text-decoration: none; font-size: 13px; }
.mod-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--warn-bg); border-radius: var(--radius-s); padding: 8px 12px; font-size: 13px; }
.mod-bar strong { color: var(--warn-fg); margin-right: 4px; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 10px; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }

/* BBCode */
.post-body p { margin: 0 0 .8em; }
.bb-quote { margin: 8px 0; padding: 10px 14px; background: var(--quote-bg); border: 1px solid var(--border); border-radius: var(--radius-s); font-size: 14px; color: var(--ink-2); }
.bb-quote .bb-quote-head { font-size: 12px; font-weight: 600; color: var(--muted-2); margin-bottom: 4px; }
.bb-quote .bb-quote-head a { color: var(--muted-2); }
.bb-quote .bb-quote { background: var(--card); }
.bb-code { margin: 8px 0; padding: 12px 14px; background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-s); font-family: var(--mono); font-size: 13px; line-height: 1.5; overflow-x: auto; white-space: pre; }
.bb-img { max-width: 100%; height: auto; border-radius: 6px; vertical-align: middle; }
.bb-attach-img img { max-width: min(100%, 560px); height: auto; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; display: inline-block; }
.bb-attach-file { display: inline-flex; padding: 4px 10px; border: 1px solid var(--input-border); border-radius: 8px; text-decoration: none; }
.bb-attach-missing { color: var(--muted); font-size: 13px; }
.bb-list { margin: 6px 0; padding-left: 24px; }
.bb-smilie { height: 1.2em; vertical-align: -0.2em; }
.bb-video { position: relative; max-width: 560px; aspect-ratio: 16/9; margin: 8px 0; }
.bb-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }
.bb-table-wrap { overflow-x: auto; } .bb-table { border-collapse: collapse; } .bb-table td { border: 1px solid var(--border); padding: 4px 8px; }
.bb-hr { border: 0; border-top: 1px solid var(--border); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Formulare / Editor ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, textarea.input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--radius-s); font: inherit; font-size: 15px; background: var(--card); color: var(--ink); width: 100%; }
.field textarea, textarea.input { padding: 10px 12px; resize: vertical; min-height: 120px; line-height: 1.5; }
.field input[disabled] { background: var(--bg); color: var(--muted-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.validation-message, .field-error { color: var(--danger); font-size: 13px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; border-bottom: 1px solid var(--border-soft); font-size: 15px; }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row input { width: 20px; height: 20px; flex: 0 0 auto; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; border: 1px solid var(--input-border); border-bottom: 0; border-radius: var(--radius-s) var(--radius-s) 0 0; padding: 6px; background: var(--head); }
.editor-toolbar button { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 6px; font: inherit; cursor: pointer; color: var(--muted-2); display: inline-flex; align-items: center; justify-content: center; }
.editor-toolbar button:hover { background: var(--chip); color: var(--ink); }
.editor-text { width: 100%; min-height: 200px; border: 1px solid var(--input-border); border-radius: 0 0 var(--radius-s) var(--radius-s); padding: 12px 14px; font: inherit; font-size: 15px; line-height: 1.55; resize: vertical; background: var(--card); color: var(--ink); }
.upload-list { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-item { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--input-border); border-radius: 8px; font-size: 13px; }
.preview-box { border: 1px dashed var(--input-border); border-radius: var(--radius-s); padding: 14px 16px; }
.file-drop { min-height: 44px; padding: 0 14px; border: 1px dashed var(--muted); background: var(--card); color: var(--ink-2); font-size: 14px; border-radius: var(--radius-s); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; position: relative; }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Konto / Admin ---------- */
.side-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.side-nav { flex: 1 1 220px; max-width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--radius-s); font-size: 14px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--chip); }
.side-nav a.active { background: var(--chip); font-weight: 650; }
.side-nav .sep { border-top: 1px solid var(--border-soft); margin: 6px 0; }
.side-nav .count { margin-left: auto; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--badge); color: #fff; }
.side-content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 600px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--head); white-space: nowrap; }
.table th a { color: var(--muted); text-decoration: none; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.sel td { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tree-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.perm-grid th, .perm-grid td { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; min-width: 150px; box-shadow: 1px 0 0 var(--border-soft); }
.perm-grid th:first-child { background: var(--head); }
.perm-grid th { white-space: normal; font-size: 10.5px; letter-spacing: .02em; padding: 8px 4px; }
/* Rechte-Spalten: senkrechte Überschriften, damit die Matrix ohne Querscrollen passt */
.perm-grid thead th.rot { vertical-align: bottom; min-width: 40px; width: 40px; padding: 10px 2px; }
.perm-grid thead th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; max-height: 150px; text-align: left; }
.perm-grid .perm-src { min-width: 110px; max-width: 170px; text-align: left; }
.perm-grid td:last-child { white-space: nowrap; }
.perm-grid td { padding: 8px 6px; }
.perm-cell { display: inline-flex; width: 34px; height: 30px; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid var(--input-border); background: var(--card); cursor: pointer; font-weight: 700; }
.perm-cell.yes { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.perm-cell.no { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.perm-cell.inh { opacity: .55; }
.modal-back { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: var(--radius); width: min(640px, 100%); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

/* ---------- Fuß ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--card); }
.site-footer .container { padding-top: 20px; padding-bottom: 20px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted-2); }

.badge-count[hidden] { display: none; }

/* PN-Popup */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 90; width: min(340px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--border);
  border-left: 0; border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
  animation: toast-in .25s ease-out; }
.toast-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.toast-body { font-size: 15px; overflow-wrap: anywhere; }
.toast-meta { font-size: 12px; color: var(--muted); }
.toast-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 640px) { .toast { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* Bild-Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .site-header .container { gap: 6px 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { padding: 10px; white-space: nowrap; }
  .site-header .search-box { order: 4; flex-basis: 100%; }
  .brand { flex: 1; }
  .user-chip .name { display: none; }
  main.page { padding-top: 16px; gap: 14px; }
  .page-head h1 { font-size: 22px; }
  .forum-row, .thread-row { padding: 14px; }
  .forum-stats { flex-basis: auto; }
  .list-head { display: none; }
  .post-aside { border-right: 0; border-bottom: 1px solid var(--border-soft); padding: 12px 14px; }
  .post-aside .avatar { --size: 38px !important; }
  .post-main { padding: 14px; }
  .card-pad { padding: 16px; }
  .hide-mobile { display: none !important; }
}

/* Benutzer-Aufklappmenü (nur für Administratoren) */
.user-menu { position: relative; display: inline-block; }
.user-menu > summary { cursor: pointer; list-style: none; color: var(--accent); font-weight: 600; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::after { content: " ▾"; font-size: .8em; color: var(--muted); }
.user-menu-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 210px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
  padding: 6px; display: flex; flex-direction: column;
}
.user-menu-pop a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; white-space: nowrap; }
.user-menu-pop a:hover { background: var(--head); }
.user-menu-pop a.danger { color: var(--danger); }
.user-menu-form { margin: 0; border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 4px; }
.user-menu-pop button { all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 7px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.user-menu-pop button.danger { color: var(--danger); }
.user-menu-pop button:hover, .user-menu-pop button:focus-visible { background: var(--head); }

/* Admin-Bereich: volle Bildschirmbreite (viele breite Tabellen) */
main.container:has(> .side-layout.admin-shell),
main.container:has(.admin-shell),
body:has(.admin-shell) .site-header .container,
body:has(.admin-shell) .site-footer .container { max-width: none; }
@media (min-width: 900px) {
  .admin-shell { flex-wrap: nowrap; }
  .admin-shell > .side-nav { flex: 0 0 220px; position: sticky; top: 16px; }
}

/* Ankündigungen */
.announcement-row { background: var(--accent-soft); }
.announce-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.announcement-body { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
/* Aufgeklapptes Benutzermenü nicht vom Kasten abschneiden lassen */
.card:has(.user-menu[open]), .post:has(.user-menu[open]), .table-wrap:has(.user-menu[open]) { overflow: visible; }
