/* ============================================================
   MeshCore Münsterland Forum Stylesheet
   Same dark theme + LED-green accent as mcml.info
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0a0f;
    --bg-secondary: #10101a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --text: #e0e0e0;
    --text-dim: #9a9a9a;
    --text-muted: #666;
    --accent: #3bff5f;
    --accent-glow: rgba(59, 255, 95, 0.15);
    --accent-dim: rgba(59, 255, 95, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --danger: #ff4444;
    --warn: #ffb84a;
    --radius: 12px;
    --radius-sm: 6px;
    --transition: 0.3s ease;
    --container-max: 1100px;
}

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Headings should never show focus/selection box (skip-link target etc.) */
h1, h2, h3, h4, h5, h6, main, [tabindex="-1"]:focus {
    outline: none !important;
    box-shadow: none !important;
}
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus,
h1:focus-visible, h2:focus-visible, h3:focus-visible, h4:focus-visible, h5:focus-visible, h6:focus-visible,
main:focus, main:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
::selection { background: var(--accent-glow); color: var(--text); }

img { max-width: 100%; height: auto; display: block; }

/* ---- Layout ---- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.25rem;
    width: 100%;
}

main {
    flex: 1;
    padding: 2rem 0 4rem;
}

/* ---- Skip link ---- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 0.5rem 1rem;
    z-index: 9999;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ---- Header / Nav ---- */
.site-header {
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1000;
}
.nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    height: 56px;
}
.nav-logo {
    font-size: 1rem; font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.4px;
    display: inline-flex; align-items: center; gap: 0.4rem;
    flex-shrink: 0;
    margin-right: auto;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo .bi { font-size: 1.1rem; }
.nav-logo .logo-sub { color: var(--text); }

.nav-collapse { display: contents; }

.nav-links {
    display: flex; gap: 0.25rem; list-style: none; align-items: center; padding: 0; margin: 0;
}
.nav-links li { margin: 0; }
.nav-links a {
    color: var(--text-dim);
    font-size: 0.88rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
    display: inline-flex; align-items: center; gap: 0.35rem;
    min-height: 44px;
}
.nav-links a.active, .nav-links a:hover {
    color: var(--accent); text-decoration: none; background: rgba(59, 255, 95, 0.08);
}

.nav-search {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 999px; padding: 0.3rem 0.8rem;
    transition: var(--transition);
    max-width: 180px;
}
.nav-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.nav-search .bi { color: var(--text-dim); font-size: 0.9rem; }
.nav-search input {
    background: none !important; border: none !important;
    padding: 0.2rem 0 !important;
    font-size: 0.85rem !important;
    color: var(--text); width: 100%; min-width: 0;
    min-height: 28px;
}
.nav-search input:focus { outline: none !important; box-shadow: none !important; }

.nav-user { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.nav-user a:not(.btn) { color: var(--text-dim); }
.nav-user a.btn-primary { color: var(--bg); }
.nav-user .btn-small { padding: 0.45rem 0.9rem; min-height: 36px; }

.nav-toggle {
    display: none; background: transparent; border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; padding: 0;
    width: 44px; height: 44px;
    flex-direction: column; gap: 5px; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--text); border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Footer ---- */
.site-footer {
    background: #060609; border-top: 1px solid var(--border);
    padding: 2rem 0; margin-top: 4rem;
    color: var(--text-dim); font-size: 0.85rem;
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.site-footer a { color: var(--text-dim); margin-right: 1rem; }
.site-footer a:hover { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.4rem; border-radius: 8px;
    font-weight: 600; font-size: 0.95rem;
    border: 1px solid var(--accent); background: transparent; color: var(--accent);
    cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; box-shadow: 0 0 24px var(--accent-glow); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { box-shadow: 0 0 24px var(--accent-glow); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text); border-color: var(--accent); box-shadow: none; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--bg); box-shadow: none; }
.btn-small { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block; margin-bottom: 0.4rem; font-size: 0.9rem; color: var(--text-dim); font-weight: 500;
}
.form-control, input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]), textarea, select {
    width: 100%;
    padding: 0.7rem 0.9rem; font-size: 0.95rem;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 8px;
    font-family: inherit;
    transition: border-color var(--transition);
}
input[type=file] {
    width: 100%;
    padding: 0.5rem; font-size: 0.85rem;
    background: var(--bg-card); color: var(--text-dim);
    border: 1px dashed var(--border-strong); border-radius: 8px;
    font-family: inherit;
}
input[type=file]::file-selector-button {
    background: var(--bg-card-hover); color: var(--accent);
    border: 1px solid var(--accent); border-radius: 6px;
    padding: 0.4rem 0.8rem; margin-right: 0.75rem; cursor: pointer;
    font-family: inherit; font-size: 0.85rem; font-weight: 600;
}
input[type=file]::file-selector-button:hover { background: var(--accent); color: var(--bg); }
input[type=checkbox], input[type=radio] {
    accent-color: var(--accent);
    width: 1.05rem; height: 1.05rem; margin-right: 0.4rem;
    vertical-align: middle;
}

/* Native select dropdown: force dark options + arrow */
select {
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a9a9a' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 10px 6px;
    padding-right: 2.2rem;
}
select option, select optgroup {
    background: #10101a;
    color: #e0e0e0;
}
select option:checked, select option:hover {
    background: rgba(59, 255, 95, 0.2);
    color: #3bff5f;
}
.form-control:focus, input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { min-height: 200px; resize: vertical; font-family: 'Consolas', 'Monaco', 'Courier New', monospace; line-height: 1.5; }
.form-help { margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
.honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: background var(--transition), border-color var(--transition);
}
.card:hover { background: var(--bg-card-hover); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { margin: 0; }

/* ---- Hero ---- */
.hero {
    padding: 3.5rem 0 2.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800; line-height: 1.1; margin-bottom: 0.75rem;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--text-dim); max-width: 640px; margin: 0 auto 1.5rem; font-size: 1.05rem; }

/* ---- Page title ---- */
.page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.4rem; }
.page-title span { color: var(--accent); }
.page-subtitle { color: var(--text-dim); margin-bottom: 2rem; }

/* ---- Categories list ---- */
.category-list { display: grid; gap: 1rem; }
.category-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    transition: background var(--transition);
}
.category-item:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.category-item a.cat-name { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.category-item a.cat-name:hover { color: var(--accent); text-decoration: none; }
.category-item .cat-desc { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.25rem; }
.category-item .cat-stats { color: var(--text-muted); font-size: 0.85rem; text-align: right; white-space: nowrap; }
.subcat-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.subcat-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.7rem; font-size: 0.8rem;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 999px; color: var(--text-dim);
    text-decoration: none; transition: var(--transition);
}
.subcat-pill:hover { background: rgba(59, 255, 95, 0.08); border-color: var(--accent-dim); color: var(--accent); text-decoration: none; }
.subcat-pill .bi { font-size: 0.85rem; }
.subcat-pill .text-muted { background: rgba(0,0,0,0.3); padding: 0.05rem 0.4rem; border-radius: 999px; font-size: 0.7rem; }

/* ---- Threads list ---- */
.thread-list { display: grid; gap: 0.6rem; margin-top: 1rem; }
.thread-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem; align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.thread-row:hover { background: var(--bg-card-hover); }
.thread-title a { font-weight: 600; color: var(--text); font-size: 1rem; }
.thread-title a:hover { color: var(--accent); text-decoration: none; }
.thread-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.2rem; }
.thread-stats { color: var(--text-dim); font-size: 0.85rem; text-align: right; white-space: nowrap; }
.pinned-badge, .locked-badge {
    display: inline-block; padding: 0.1rem 0.5rem; font-size: 0.7rem;
    border-radius: 4px; margin-right: 0.4rem; font-weight: 600;
}
.pinned-badge { background: rgba(59, 255, 95, 0.12); color: var(--accent); }
.locked-badge { background: rgba(255, 184, 74, 0.12); color: var(--warn); }

/* ---- Posts ---- */
.post {
    display: grid; grid-template-columns: 180px 1fr; gap: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden;
}
.post-author {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.25rem; border-right: 1px solid var(--border);
    text-align: center;
}
.post-author .avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--bg); display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--accent); border: 2px solid var(--accent);
    margin: 0 auto 0.6rem;
    overflow: hidden;
}
.post-author .avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-author .name { font-weight: 600; color: var(--text); display: block; margin-bottom: 0.2rem; word-break: break-word; }
.post-author .name a { color: var(--text); }
.post-author .name a:hover { color: var(--accent); text-decoration: none; }
.post-author .joined { font-size: 0.75rem; color: var(--text-muted); }

.post-body {
    padding: 1.25rem 1.5rem;
    display: flex; flex-direction: column; min-width: 0;
}
.post-meta {
    color: var(--text-muted); font-size: 0.8rem;
    margin-bottom: 0.75rem;
    display: flex; gap: 1rem; justify-content: space-between; align-items: center;
}
.post-content { flex: 1; }

/* ---- Markdown body ---- */
.markdown-body { color: var(--text); line-height: 1.7; word-wrap: break-word; }
.markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin: 1.5rem 0 0.75rem; line-height: 1.3; font-weight: 700;
}
.markdown-body h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.markdown-body h3 { font-size: 1.2rem; }
.markdown-body h4 { font-size: 1.05rem; }
.markdown-body p { margin: 0.75rem 0; }
.markdown-body ul, .markdown-body ol { margin: 0.75rem 0 0.75rem 1.5rem; }
.markdown-body li { margin: 0.25rem 0; }
.markdown-body strong { color: var(--text); }
.markdown-body em { font-style: italic; }
.markdown-body code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.88em;
    background: rgba(59, 255, 95, 0.08); color: var(--accent);
    padding: 0.1rem 0.35rem; border-radius: 3px;
}
.markdown-body pre {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1rem; border-radius: var(--radius-sm);
    overflow-x: auto; margin: 1rem 0;
}
.markdown-body pre code { background: none; color: var(--text); padding: 0; }
.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem; margin: 1rem 0;
    color: var(--text-dim);
}
.markdown-body table {
    width: 100%; border-collapse: collapse; margin: 1rem 0;
    background: var(--bg);
}
.markdown-body .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin: 1rem 0;
    border-radius: var(--radius-sm);
}
.markdown-body .table-wrap > table { margin: 0; min-width: 100%; }
.markdown-body th, .markdown-body td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem; text-align: left;
}
.markdown-body th { background: rgba(255,255,255,0.04); font-weight: 600; }
.markdown-body img { border-radius: var(--radius-sm); margin: 0.75rem 0; max-width: 100%; }
.markdown-body .embed-video {
    position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
    margin: 1rem 0; border-radius: var(--radius-sm); overflow: hidden;
    background: #000; border: 1px solid var(--border);
}
.markdown-body .embed-video iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
.markdown-body a { color: var(--accent); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---- Editor (markdown live preview) ---- */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.editor-grid > * { min-height: 320px; }
.editor-preview {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 8px; padding: 1rem; overflow: auto;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; border: 1px solid var(--border);
    background: var(--bg-card); font-size: 0.9rem;
}
.alert-success { border-color: var(--accent); color: var(--accent); background: rgba(59, 255, 95, 0.06); }
.alert-error { border-color: var(--danger); color: var(--danger); background: rgba(255, 68, 68, 0.06); }
.alert-warn { border-color: var(--warn); color: var(--warn); background: rgba(255, 184, 74, 0.06); }
.alert-info { border-color: var(--accent-dim); color: var(--text); background: rgba(59, 255, 95, 0.04); }

/* ---- Breadcrumbs ---- */
.breadcrumbs {
    color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem;
}
.breadcrumbs a { color: var(--text-dim); }
.breadcrumbs a:hover { color: var(--accent); text-decoration: none; }
.breadcrumbs .sep { margin: 0 0.4rem; color: var(--text-muted); }

/* ---- Utility ---- */
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.flex { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- Pagination ---- */
.pagination {
    display: flex; justify-content: center; gap: 0.4rem;
    margin: 2rem 0 1rem;
    list-style: none; padding: 0;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 0.6rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-dim); font-size: 0.9rem;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

/* ---- Forum auth pages (login/register) ---- */
.auth-card {
    max-width: 460px; margin: 3rem auto;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-card .form-actions { margin-top: 1.5rem; }
.auth-card .links { margin-top: 1.25rem; font-size: 0.85rem; text-align: center; color: var(--text-dim); }

/* ---- Cookie notice (technical-only) ---- */
.cookie-notice {
    position: fixed;
    left: 1rem; right: 1rem; bottom: 1rem;
    z-index: 1500;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(59,255,95,0.06);
    max-width: 720px;
    margin: 0 auto;
    animation: cookie-slide-up 0.4s ease-out;
}
@keyframes cookie-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.cookie-notice-inner {
    display: flex; gap: 1rem; align-items: center;
    flex-wrap: wrap;
}
.cookie-notice-text { flex: 1; min-width: 240px; font-size: 0.88rem; line-height: 1.5; }
.cookie-notice-text strong { display: block; margin-bottom: 0.25rem; color: var(--accent); }
.cookie-notice-text strong .bi { margin-right: 0.25rem; }
.cookie-notice-text span { color: var(--text-dim); }
.cookie-notice-text a { color: var(--accent); }
.cookie-notice-inner .btn { flex-shrink: 0; }

@media (max-width: 600px) {
    .cookie-notice { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; padding: 0.85rem 1rem; }
    .cookie-notice-inner .btn { width: 100%; justify-content: center; }
}

/* ---- Footer legal-links: smaller, separated ---- */
.footer-legal { font-size: 0.8rem; opacity: 0.85; }

/* ---- Empty state ---- */
.empty {
    padding: 3rem 1rem; text-align: center; color: var(--text-dim);
    border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .nav-toggle { display: flex; }
    .nav-collapse {
        display: none;
    }
    body.nav-open .nav-collapse {
        display: flex !important;
        position: fixed;
        top: 56px; left: 0; right: 0;
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        background: var(--bg);
        flex-direction: column;
        padding: 1.25rem;
        gap: 1rem;
        overflow-y: auto;
        z-index: 1000;
        border-top: 1px solid var(--border);
    }
    body.nav-open { overflow: hidden; }

    .nav-collapse nav { width: 100%; }
    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }
    .nav-links a {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        border-radius: 8px;
        min-height: 48px;
    }
    .nav-search {
        width: 100%; max-width: none;
        padding: 0.5rem 1rem;
    }
    .nav-search input { font-size: 1rem !important; padding: 0.4rem 0 !important; }
    .nav-user {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        width: 100%;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border);
    }
    .nav-user > * { width: 100%; }
    .nav-user .icon-btn {
        width: 100%; height: auto; padding: 0.85rem 1rem;
        border-radius: 8px; justify-content: flex-start; gap: 0.75rem;
        background: var(--bg-card);
    }
    .nav-user .icon-btn .badge { position: static; margin-left: auto; border: none; }
    .nav-user .icon-btn::after { content: "Benachrichtigungen"; color: var(--text-dim); font-size: 0.95rem; }
    .nav-user .dropdown { width: 100%; }
    .nav-user .dropdown > summary {
        display: flex;
        width: 100%;
        padding: 0.85rem 1rem;
        background: var(--bg-card);
        border-radius: 8px;
        justify-content: flex-start;
        font-size: 0.95rem;
        min-height: 48px;
        align-items: center;
    }
    .nav-user .dropdown > summary > i:last-child { margin-left: auto; }
    .nav-user .dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 0.4rem;
        box-shadow: none;
        background: rgba(255,255,255,0.03);
    }
    .nav-user form { width: 100%; }
    .nav-user form button { width: 100%; }
}

@media (max-width: 768px) {
    main { padding: 1.25rem 0 2.5rem; }
    .container { padding: 0 1rem; }

    /* Hero / Headings */
    .hero { padding: 2rem 0 1.5rem; }
    .page-title { font-size: 1.3rem; }
    .page-subtitle { font-size: 0.9rem; margin-bottom: 1.25rem; }

    /* Posts: stacked author + body */
    .post { grid-template-columns: 1fr; }
    .post-author {
        border-right: none; border-bottom: 1px solid var(--border);
        display: flex; align-items: center; gap: 0.75rem;
        text-align: left; padding: 0.75rem 1rem;
        background: rgba(255,255,255,0.03);
    }
    .post-author .avatar { width: 40px; height: 40px; font-size: 1rem; margin: 0; flex-shrink: 0; }
    .post-author .name { word-break: normal; flex-shrink: 1; min-width: 0; margin-bottom: 0; }
    .post-author .joined { font-size: 0.75rem; flex-shrink: 0; }
    .post-author .pill-list { width: 100%; margin-top: 0.4rem; flex-basis: 100%; justify-content: flex-start !important; }
    .post-author { flex-wrap: wrap; }
    .post-body { padding: 1rem; }
    .post-meta { flex-wrap: wrap; gap: 0.4rem; }

    /* Thread/category lists: single column */
    .thread-row {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.85rem 1rem;
    }
    .thread-stats {
        text-align: left;
        font-size: 0.8rem;
        display: inline-block;
        margin-right: 1rem;
    }
    .category-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 1rem;
    }
    .category-item .cat-stats { text-align: left; white-space: normal; }

    /* Forms: collapse multi-column grids */
    .form-group { margin-bottom: 1rem; }
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 2fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns:1fr 1fr 100px"],
    div[style*="grid-template-columns: 1fr 1fr 100px"],
    div[style*="grid-template-columns:1fr 2fr auto"],
    div[style*="grid-template-columns: 1fr 2fr auto"] {
        grid-template-columns: 1fr !important;
    }

    /* Buttons: bigger touch */
    .btn { padding: 0.75rem 1.1rem; min-height: 44px; }
    .btn-small { padding: 0.5rem 0.85rem; min-height: 38px; font-size: 0.85rem; }

    /* Editor toolbar: smaller, no separator */
    .editor-toolbar { gap: 0.2rem; padding: 0.3rem; }
    .editor-tools button { padding: 0.5rem 0.55rem; }
    .toolbar-sep { display: none !important; }
    .editor-tabs-inline { width: 100%; margin: 0; padding: 2px; order: 99; flex-basis: 100%; justify-content: stretch; }
    .editor-tabs-inline button { flex: 1; justify-content: center; }
    .editor-tabs-inline button span { display: inline; }

    /* Tables - horizontal scroll inside card */
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 480px; font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; white-space: nowrap; }
    .data-table td a { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

    /* Stats grid */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
    .stat-tile { padding: 0.85rem; }
    .stat-tile .stat-value { font-size: 1.4rem; }

    /* Cards */
    .card { padding: 1rem; }

    /* Auth card */
    .auth-card { padding: 1.5rem 1.25rem; margin: 1.5rem auto; }

    /* Footer */
    .site-footer .container { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
    .footer-nav a { margin: 0; min-height: 36px; display: inline-flex; align-items: center; }

    /* Pagination */
    .pagination { flex-wrap: wrap; }
    .pagination a, .pagination span { min-width: 44px; height: 44px; }

    /* Breadcrumbs wrap */
    .breadcrumbs { font-size: 0.8rem; line-height: 1.5; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 0.95rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .editor-tools button .bi { font-size: 1.05rem; }
    .nav-search { padding: 0.4rem 0.8rem; }
}

/* ---- Editor toolbar (single row: tools left, tabs right) ---- */
.editor-toolbar {
    display: flex; align-items: stretch; gap: 0.5rem;
    padding: 0.3rem 0.4rem; margin-bottom: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-strong); border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}
.editor-tools { display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center; }
.editor-tools button {
    background: transparent; border: 1px solid transparent; cursor: pointer;
    padding: 0.4rem 0.55rem; border-radius: 6px;
    color: var(--text-dim); font-size: 0.95rem; line-height: 1;
    transition: var(--transition);
}
.editor-tools button:hover { background: var(--bg-card-hover); color: var(--accent); border-color: var(--border); }
.editor-tools button:active { background: var(--accent); color: var(--bg); }
.toolbar-sep { display: inline-block; width: 1px; height: 20px; background: var(--border); margin: 0 0.3rem; align-self: center; }

.editor-tabs-inline {
    display: flex; gap: 0; margin-left: auto; align-items: stretch;
    background: rgba(0,0,0,0.2); border-radius: 6px; padding: 2px;
}
.editor-tabs-inline button {
    background: transparent; border: none; cursor: pointer;
    padding: 0.35rem 0.7rem; font-size: 0.85rem; font-weight: 600;
    color: var(--text-dim); border-radius: 5px;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.editor-tabs-inline button:hover { color: var(--text); }
.editor-tabs-inline button.active { color: var(--accent); background: var(--bg-secondary); }

.editor-pane { min-height: 320px; }
.editor-pane[hidden] { display: none; }
.editor-pane.preview-pane {
    background: var(--bg-secondary); border: 1px solid var(--border-strong); border-top: none;
    border-radius: 0 0 8px 8px; padding: 1rem; overflow: auto;
}

.editor-status {
    margin-top: 0.4rem; padding: 0.4rem 0.7rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.85rem; color: var(--text-dim);
}
.editor-status.is-error { border-color: var(--danger); color: var(--danger); }
.editor-status.is-success { border-color: var(--accent-dim); color: var(--accent); }

[data-md-editor] textarea { border-radius: 0 0 8px 8px; border-top: none; }
[data-md-editor].is-dragover { outline: 2px dashed var(--accent); outline-offset: 2px; }


/* ---- Pills (badges for groups, roles, etc.) ---- */
.pill {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.18rem 0.55rem; font-size: 0.72rem; font-weight: 600;
    border-radius: 999px; line-height: 1.4;
    background: rgba(255,255,255,0.05); color: var(--text-dim);
    border: 1px solid var(--border);
    text-decoration: none;
}
.pill-accent { background: rgba(59, 255, 95, 0.1); color: var(--accent); border-color: var(--accent-dim); }
.pill-warn { background: rgba(255, 184, 74, 0.12); color: var(--warn); border-color: rgba(255, 184, 74, 0.4); }
.pill-danger { background: rgba(255, 68, 68, 0.12); color: var(--danger); border-color: rgba(255, 68, 68, 0.4); }
.pill-list { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }

/* ---- Notification bell ---- */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: transparent; color: var(--text-dim);
    position: relative; transition: var(--transition);
    text-decoration: none;
}
.icon-btn:hover { background: var(--bg-card-hover); color: var(--accent); text-decoration: none; }
.icon-btn .bi { font-size: 1.15rem; line-height: 1; }
.icon-btn .badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--danger); color: #fff;
    font-size: 0.65rem; font-weight: 700; line-height: 1;
    padding: 0.15rem 0.32rem; border-radius: 999px; min-width: 16px;
    text-align: center; border: 2px solid var(--bg);
}

/* ---- Dropdown menu (header) ---- */
.dropdown { position: relative; }
.dropdown > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: var(--text-dim); padding: 0.4rem 0;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { color: var(--accent); }
.dropdown > summary .bi { font-size: 1rem; }
.dropdown[open] > summary { color: var(--accent); }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 0.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    min-width: 220px; padding: 0.4rem 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 1100;
}
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.55rem 0.9rem; width: 100%;
    color: var(--text); font-size: 0.9rem;
    background: none; border: none; cursor: pointer; text-align: left;
    text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-card-hover); color: var(--accent); text-decoration: none; }
.dropdown-menu .divider { height: 1px; background: var(--border); margin: 0.4rem 0; }
.dropdown-menu .heading { padding: 0.4rem 0.9rem; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.dropdown-menu .bi { width: 16px; color: var(--text-dim); font-size: 1rem; }
.dropdown-menu a:hover .bi, .dropdown-menu button:hover .bi { color: var(--accent); }

/* ---- Stat tiles (admin dashboard) ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-tile {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    display: flex; flex-direction: column; gap: 0.4rem;
}
.stat-tile .stat-label { color: var(--text-dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-tile .stat-value { color: var(--accent); font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-tile .stat-trend { color: var(--text-muted); font-size: 0.8rem; }

/* ---- Tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; background: rgba(255,255,255,0.02); }
.data-table tr:hover { background: var(--bg-card-hover); }

/* ---- Truncation ---- */
.text-clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-clip-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Visually hidden (a11y) ---- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
