/* ── Design tokens ── */
:root {
    --bg: #f7f8fc;
    --bg-alt: #eef0f6;
    --panel: #ffffff;
    --ink: #1a1a2e;
    --muted: #6b7280;
    --border: #e2e5ee;
    --brand: #6d5bd0;
    --brand-deep: #4e3fa8;
    --brand-light: #a394e8;
    --accent: #2563eb;
    --accent-light: #60a5fa;
    --danger: #dc2626;
    --shadow: 0 1px 4px rgba(30,20,60,0.06), 0 2px 10px rgba(30,20,60,0.05);
    --shadow-sm: 0 1px 3px rgba(30,20,60,0.05);
    --shadow-lg: 0 4px 20px rgba(30,20,60,0.10), 0 1px 6px rgba(30,20,60,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --radius-pill: 9999px;
    --transition: 0.18s ease;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4,
.navbar-brand,
.brand-lockup strong,
.panel-title {
    font-family: 'Space Grotesk', sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: var(--brand-deep);
}

/* ── Navbar ── */
.navbar-threadline {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px rgba(30,20,60,0.07);
}
/* Allow dropdowns inside the navbar to escape the collapse overflow */
.navbar-threadline .navbar-collapse {
    overflow: visible;
}

.brand-lockup {
    align-items: center;
    color: var(--ink);
    display: flex;
    gap: 0.7rem;
}

.brand-lockup:hover {
    color: var(--brand);
    text-decoration: none;
}

.brand-lockup small {
    color: var(--muted);
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(109,91,208,0.35);
    color: #fff;
    display: inline-flex;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.nav-cluster {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.nav-community-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.nav-community-pill,
.nav-user-chip {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--ink);
    font-size: 0.82rem;
    padding: 0.28rem 0.75rem;
    transition: background var(--transition), border-color var(--transition);
}

.nav-community-pill:hover {
    background: var(--bg-alt);
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}

.nav-user-chip {
    align-items: center;
    display: flex;
    gap: 0.55rem;
}

.nav-user-chip a {
    color: var(--ink);
}

.nav-user-chip a:hover {
    color: var(--brand);
    text-decoration: none;
}

/* ── Cards / Panels ── */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow var(--transition);
}

.panel-label {
    color: var(--brand);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.panel-title {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}

/* ── Feed toolbar ── */
.panel-toolbar {
    align-items: start;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-control {
    background: var(--bg-alt);
    border-radius: var(--radius-pill);
    display: inline-flex;
    justify-content: end;
    margin-left: auto;
    padding: 0.2rem;
}

.segmented-control a {
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.32rem 0.85rem;
    transition: all var(--transition);
}

.segmented-control a.active {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    color: var(--ink);
    text-decoration: none;
}

/* ── Buttons ── */
.btn-threadline,
.btn-outline-threadline:hover {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    border: 0;
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 10px rgba(109,91,208,0.30);
    color: #fff;
    transition: all var(--transition);
}

.btn-threadline:hover {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
    box-shadow: 0 4px 16px rgba(109,91,208,0.40);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-threadline {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--ink);
    transition: all var(--transition);
}

.btn-outline-threadline:hover {
    border-color: var(--brand);
}

.form-control,
.form-select {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    min-height: 38px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(109,91,208,0.14);
}

/* ── Post card ── */
.post-card {
    align-items: start;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 44px minmax(0, 1fr);
}

.post-card.panel:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.05);
}

.vote-rail {
    align-items: center;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.45rem 0;
}

.vote-button {
    background: transparent;
    border: 0;
    border-radius: var(--radius-xs);
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    height: 28px;
    width: 28px;
    transition: background var(--transition), color var(--transition);
}

.vote-button:hover,
.vote-button.active {
    background: rgba(109,91,208,0.14);
    color: var(--brand);
}

.vote-button.negative:hover,
.vote-button.negative.active {
    background: rgba(107,143,192,0.14);
    color: var(--accent);
}

.post-meta,
.post-actions {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.78rem;
    gap: 0.5rem;
    align-items: center;
}

.post-meta a,
.post-actions a {
    color: var(--muted);
    font-weight: 600;
}

.post-meta a:hover,
.post-actions a:hover {
    color: var(--ink);
    text-decoration: none;
}

.post-title {
    font-size: clamp(1.05rem, 2vw, 1.4rem);
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

.post-link a {
    color: var(--accent);
    font-size: 0.82rem;
}

.post-excerpt {
    font-size: 0.9rem;
    line-height: 1.55;
}

.text-muted {
    color: var(--muted) !important;
}

/* ── Composer ── */
.composer-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    color: var(--ink);
}
.composer-trigger:hover .panel-title { color: var(--brand); }
.composer-chevron {
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    transition: transform 0.2s;
}
.composer-trigger[aria-expanded="true"] .composer-chevron {
    transform: rotate(180deg);
}

/* ── Bell / Nav notifications ── */
.nav-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    text-decoration: none;
    padding: 4px;
    border-radius: var(--radius);
    transition: color 0.15s;
}
.nav-bell-btn {
    background: none;
    border: none;
    cursor: pointer;
}
.nav-bell:hover,
.nav-bell-btn:hover { color: var(--ink); }
.nav-bell-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    box-shadow: 0 1px 4px rgba(109,91,208,0.40);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ── Notification dropdown ── */
.notif-dropdown {
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(30,20,60,0.12);
    /* Override Bootstrap's static positioning inside navbar */
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
}
.notif-dropdown-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
#notifDropdown { position: relative; }
.bg-brand-soft { background: rgba(109,91,208,0.12); }
.text-brand    { color: var(--brand); }
.notif-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    font-size: .83rem;
    transition: background 0.1s;
}
.notif-dropdown-item:hover            { background: var(--bg-alt); color: var(--ink); }
.notif-dropdown-item--unread          { background: rgba(109,91,208,0.06); }
.notif-dropdown-item--unread:hover    { background: rgba(109,91,208,0.12); }
.notif-dropdown-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    margin-top: 1px;
}
.notif-dropdown-text { flex: 1; min-width: 0; line-height: 1.4; }
.notif-dropdown-footer {
    font-size: .8rem;
    color: var(--brand);
    text-decoration: none;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-weight: 600;
    transition: background 0.1s;
}
.notif-dropdown-footer:hover { background: var(--bg); color: var(--brand-deep); }

/* ── Notification items ── */
.notification-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 1rem;
}
.notif-unread {
    border-left: 3px solid var(--brand);
}
.notif-read {
    border-left: 3px solid transparent;
    opacity: 0.75;
}
.notif-icon {
    font-size: 1rem;
    width: 24px;
    min-width: 24px;
    text-align: center;
    color: var(--muted);
    padding-top: 2px;
}
.notif-body { flex: 1; min-width: 0; }
.notif-body p { font-size: 0.9rem; margin: 0; }
.notif-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 3px;
}
.notif-meta a { color: var(--accent); text-decoration: none; }
.notif-meta a:hover { text-decoration: underline; }

/* ── Notification preference rows ── */
.notif-pref-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.notif-pref-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.notif-pref-info strong { font-size: 0.9rem; }
.notif-pref-info span { font-size: 0.8rem; color: var(--muted); }

/* Toggle switch */
.notif-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    min-width: 40px;
    height: 22px;
    cursor: pointer;
}
.notif-toggle input { opacity: 0; width: 0; height: 0; }
.notif-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d0d5db;
    border-radius: 22px;
    transition: background 0.25s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.notif-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.notif-toggle input:checked + .notif-toggle-slider { background: linear-gradient(135deg, var(--brand), var(--brand-light)); box-shadow: 0 1px 4px rgba(109,91,208,0.30); }
.notif-toggle input:checked + .notif-toggle-slider::before { transform: translateX(18px); }

/* ── NSFW ─────────────────────────────────────────────────────── */
.nsfw-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.6;
}

/* Card wrap: position context for overlay */
.nsfw-card-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}

/* Blurred content layer */
.nsfw-blur-content {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

/* Overlay on top of blurred card */
.nsfw-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    z-index: 2;
    gap: 0.4rem;
    text-align: center;
    padding: 1rem;
}

/* Inline age gate panel on post page */
.age-gate-panel {
    text-align: center;
    padding: 3rem 2rem;
}

.age-gate-overlay-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Admin toggle label */
.admin-toggle-label {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ── Sidebar ── */
.sidebar-panel {
    background: #f8f9fa;
    border-color: #e4e7ea !important;
}

.sidebar-panel-accent {
    background: #f8f9fa;
    border-color: #e4e7ea !important;
}

.community-list {
    display: grid;
    gap: 0.35rem;
}

.community-pill {
    align-items: center;
    background: var(--panel);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    display: flex;
    font-size: 0.85rem;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    transition: all var(--transition);
}

.community-pill:hover {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(109,91,208,0.14);
    color: var(--ink);
    text-decoration: none;
    transform: translateX(2px);
}

.community-pill small {
    color: var(--muted);
    display: block;
    font-size: 0.75rem;
}

/* ── Inline action links (reply / edit / delete) ── */
.btn-link-action,
.btn-link-danger {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0;
    text-transform: uppercase;
}

.btn-link-action {
    color: var(--muted);
}

.btn-link-action:hover {
    color: var(--ink);
}

.btn-link-danger {
    color: var(--muted);
}

.btn-link-danger:hover {
    color: #cc0000;
}

/* ─────────────────────────────────
   Reddit-style nested comments
───────────────────────────────── */

.comment-form-area {
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.25rem;
}

#comments-list {
    padding: 0 0 16px;
}

.comment-item {
    border-top: 1px solid var(--border);
    margin-bottom: 0;
    position: relative;
}

.comment-item:first-child {
    border-top: 0;
}

/* Depth-colored thread line — positioned inside comment-nest, click to collapse */
.thread-line {
    border: 0;
    background: transparent;
    bottom: 0;
    cursor: pointer;
    padding: 0;
    position: absolute;
    top: 0;
    transition: opacity 0.1s;
    width: 20px;
}

.thread-line::after {
    background: currentColor;
    border-radius: 2px;
    bottom: 0;
    content: '';
    left: 9px;           /* centered in the 20px strip */
    position: absolute;
    top: 0;
    width: 2px;
}

.thread-line:hover::after {
    width: 3px;
    left: 8.5px;
}

.comment-nest {
    padding: 12px 16px 14px 14px;
    position: static;
}

/* Subtle hover tint on comment body */
.comment-nest:hover > .comment-collapse-body,
.comment-nest:hover > .comment-head {
    /* no background change needed — line hover is the affordance */
}

/* Header row: [–] u/name  ▲ 0 ▼  • time */
.comment-head {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8rem;
    gap: 0.35rem;
    margin-bottom: 6px;
}

/* [–] / [+] collapse toggle */
.btn-collapse {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--muted);
    cursor: pointer;
    font-family: monospace;
    font-size: 0.65rem;
    line-height: 1;
    padding: 1px 5px;
    transition: all var(--transition);
}

.btn-collapse:hover {
    background: var(--bg-alt);
    border-color: var(--muted);
    color: var(--ink);
}

.comment-author {
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 700;
}

.comment-author:hover {
    color: var(--brand);
    text-decoration: none;
}

/* Inline ▲ N ▼ vote cluster */
.comment-vote-inline {
    align-items: center;
    display: inline-flex;
    gap: 0.08rem;
}

.vote-arrow {
    background: transparent;
    border: 0;
    border-radius: 2px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 3px;
}

.vote-arrow:hover,
.vote-arrow.active {
    color: var(--brand);
}

.vote-arrow.down:hover,
.vote-arrow.down.active {
    color: var(--accent);
}

.comment-score {
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1ch;
    text-align: center;
}

.comment-time {
    color: var(--muted);
    font-size: 0.74rem;
}

.comment-text {
    color: var(--ink);
    font-size: 0.94rem;
    line-height: 1.6;
    margin-bottom: 8px;
    padding: 0;
}

/* ── Footer ── */
.site-footer {
    color: var(--muted);
    font-size: 0.78rem;
    margin: 2rem 0 1.5rem;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ── Bootstrap overrides ── */
.alert {
    border-radius: var(--radius-sm) !important;
    border: 0 !important;
    box-shadow: var(--shadow-sm);
}
.alert-success { background: #edf6ee; color: #2d5a35; }
.alert-danger   { background: #faeef0; color: #7a2d3a; }
.alert-warning  { background: #fdf6ea; color: #7a5020; }
.alert-info     { background: #edf3fb; color: #2d4a72; }

.modal-content {
    border-radius: var(--radius) !important;
    border: none !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--border) !important; }
.modal-footer { border-top: 1px solid var(--border) !important; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .panel-toolbar,
    .post-card {
        grid-template-columns: 1fr;
    }

    .vote-rail {
        flex-direction: row;
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .panel {
        border-radius: var(--radius-sm);
        padding: 1rem;
    }

    .nav-cluster {
        align-items: start;
        margin-top: 0.65rem;
    }
}

/* ── Mod / Admin UI ──────────────────────────────────────────────────────── */

/* Role badges */
.role-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    vertical-align: middle;
}
.role-admin { background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: #fff; box-shadow: 0 1px 4px rgba(109,91,208,0.28); }
.role-mod   { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #fff; box-shadow: 0 1px 4px rgba(107,143,192,0.28); }

/* Small buttons */
.btn-xs {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    line-height: 1.6;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: 1.5px solid transparent;
    transition: all var(--transition);
}
.btn-outline-mod {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}
.btn-outline-mod:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
    background: transparent;
}
.btn-outline-danger:hover { background: var(--danger); color: #fff; transform: translateY(-1px); }

/* Inline mod action link (next to edit/delete) */
.btn-link-mod {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.btn-link-mod:hover { text-decoration: underline; }

/* Admin / Mod page layout */
.admin-page, .mod-page {
    max-width: 1000px;
}
.admin-header, .mod-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.panel-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

/* Admin / Mod tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.admin-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 12px;
    border-bottom: 1.5px solid var(--border);
}
.admin-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfd; transition: background var(--transition); }

/* Mod user list (mods / bans) */
.mod-user-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.mod-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.mod-user-row:last-child { border-bottom: none; }

/* Age gate (inline panel variant for post page) */
.age-gate-panel { text-align: center; padding: 2.5rem 1.5rem; }
.age-gate-overlay-inline { max-width: 480px; margin: 0 auto; }

/* TipTap editor */
.tiptap-source {
    display: none;
}

.tiptap-shell {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tiptap-shell:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(109,91,208,0.14);
}

.tiptap-toolbar {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    flex-wrap: wrap;
}

.tiptap-btn {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    background: #fff;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    line-height: 1.4;
    transition: all var(--transition);
}

.tiptap-btn:hover {
    background: var(--bg-alt);
    border-color: #c5cad0;
}

.tiptap-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 1px 4px rgba(109,91,208,0.28);
}

.tiptap-editor {
    min-height: 120px;
    padding: 0.6rem 0.75rem;
}

.tiptap-editor .ProseMirror {
    min-height: 100px;
    outline: none;
    font-size: 0.9rem;
    line-height: 1.6;
}

.tiptap-editor .ProseMirror p {
    margin: 0.35rem 0;
}

.tiptap-editor .ProseMirror h2 {
    font-size: 1.05rem;
    margin: 0.55rem 0 0.35rem;
}

.tiptap-editor .ProseMirror ul,
.tiptap-editor .ProseMirror ol {
    margin: 0.4rem 0;
    padding-left: 1.2rem;
}

/* Images inside editor and rendered content */
.tiptap-editor .ProseMirror img,
.post-excerpt img,
.comment-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    display: block;
    margin: 0.5rem 0;
}

.tiptap-editor .ProseMirror img.ProseMirror-selectednode {
    outline: 2px solid var(--accent);
}

/* ── Image-insert dialog ─────────────────────────────────────────────────── */
.tiptap-img-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .52);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.tiptap-img-dialog {
    background: var(--bg, #fff);
    border: 1px solid var(--border, #e4e7ea);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem 1.25rem;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, .25));
}

.tiptap-img-dialog-title {
    font-weight: 700;
    font-size: .9rem;
    margin: 0 0 .75rem;

/* ============================================================
   Visibility options (community settings / create form)
   ============================================================ */
.visibility-option { display:flex; align-items:flex-start; gap:.75rem; padding:.85rem 1rem; border:1.5px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; margin-bottom:.6rem; transition: all var(--transition); }
.visibility-option:has(.visibility-radio:checked),
.visibility-option.selected { border-color:var(--accent); background:#f0f4fb; }
.visibility-icon { font-size:1.5rem; flex-shrink:0; }

/* Visibility badges inline */
.vis-badge { font-size:.7rem; font-weight:700; border-radius:var(--radius-pill); padding:2px 8px; vertical-align:middle; letter-spacing:.04em; }
.vis-badge.vis-public  { background:#e6f7e6; color:#1a7a1a; }
.vis-badge.vis-private { background:#fff3cd; color:#856404; }
.vis-badge.vis-secret  { background:#fce8e8; color:#b91c1c; }

/* ============================================================
   Role permission grid
   ============================================================ */
.role-perm-grid { display:flex; flex-direction:column; gap:.25rem; }
.role-perm-row { display:flex; align-items:center; gap:.5rem; padding:.4rem .6rem; border-radius:4px; cursor:pointer; transition:background .1s; }
.role-perm-row:hover { background:var(--bg-muted, #f8f9fa); }
.role-perm-row.active { background:#eaf4ff; }
.perm-key { font-size:.85rem; flex:1; }
.perm-badge-danger { font-size:.7rem; color:#dc3545; border:1px solid #dc3545; border-radius:3px; padding:0 4px; }

/* ============================================================
   Reports
   ============================================================ */
.report-list { list-style:none; margin:0; padding:0; }
.report-item { border-bottom:1px solid var(--border); }
.report-item a { display:block; padding:.6rem .75rem; text-decoration:none; color:inherit; }
.report-item.active a, .report-item a:hover { background:#f0f8ff; }
.report-type { display:block; font-weight:600; font-size:.85rem; }
.report-reason { display:block; font-size:.8rem; color:#555; }
.report-meta { display:block; font-size:.75rem; color:#888; margin-top:.2rem; }
.report-detail-box { background:#f8f9fa; border-radius:var(--radius); padding:.75rem 1rem; }
.report-detail-row { display:flex; gap:.75rem; margin-bottom:.4rem; font-size:.85rem; }
.report-detail-label { font-weight:600; min-width:90px; color:#555; }
.report-notes { display:flex; flex-direction:column; gap:.75rem; }
.report-note { border-left:3px solid var(--border); padding:.4rem .75rem; }
.report-note-author { font-weight:600; font-size:.8rem; }
.report-note-time { font-size:.75rem; color:#888; margin-left:.5rem; }
.report-note-body { margin:.25rem 0 0; font-size:.85rem; }
.report-count-badge { background:linear-gradient(135deg,var(--brand),var(--brand-light)); color:#fff; font-size:.7rem; font-weight:700; border-radius:var(--radius-pill); padding:1px 8px; box-shadow:0 1px 4px rgba(109,91,208,0.28); }
.report-inline-form { display:flex; align-items:center; gap:.4rem; margin-top:.25rem; }
.report-reason-input { font-size:.8rem; border:1px solid var(--border); border-radius:3px; padding:2px 6px; width:180px; }
.btn-link-muted { background:none; border:none; padding:0; font-size:.8rem; color:#888; cursor:pointer; box-shadow:none; outline:none; }
.btn-link-muted:hover { color:var(--accent); text-decoration:underline; }
.btn-link-muted:focus, .btn-link-muted:focus-visible { outline:none; box-shadow:none; }
.more-btn:focus, .more-btn:focus-visible { outline:none; box-shadow:none; }

/* ── Feed toolbar ── */
.feed-toolbar { min-height: 36px; }
.feed-sort-btn { font-weight: 600; font-size: .8rem; }

/* ── Post more-menu (···) ── */
.more-btn { background: none; border: none !important; padding: 2px 6px; font-size: 1rem; color: var(--muted); cursor: pointer; line-height: 1; border-radius: var(--radius-xs); box-shadow: none !important; outline: none !important; -webkit-appearance: none; appearance: none; }
.more-btn:hover { color: var(--ink); background: var(--bg-alt); }
.more-btn:focus, .more-btn:focus-visible, .more-btn:active { border: none !important; box-shadow: none !important; outline: none !important; }
.post-more-menu .dropdown-menu { min-width: 160px; font-size: .85rem; border-color: var(--border); }
.dropdown-menu { border-color: var(--border) !important; }
.post-more-menu .dropdown-item form { margin: 0; }
.post-more-menu .dropdown-item form button { width: 100%; text-align: left; background: none; border: none; padding: 0; color: inherit; cursor: pointer; }

/* ============================================================
   Community badges
   ============================================================ */
.badge-grid { display:flex; flex-direction:column; gap:.6rem; }
.community-badge-card {
    display:flex; align-items:center; gap:.85rem;
    padding:.7rem 1rem;
    border:1.5px solid var(--border); border-radius:var(--radius-sm); background:#fff;
    transition: all var(--transition);
}
.community-badge-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(109,91,208,0.10); }
.community-badge-icon { font-size:1.8rem; line-height:1; flex-shrink:0; }
.community-badge-info { flex:1; min-width:0; }
.badge-pill {
    display:inline-flex; align-items:center; gap:.35rem;
    background:#fff; border:1.5px solid var(--border); border-radius:var(--radius-pill);
    padding:.25rem .75rem; font-size:.8rem; font-weight:600;
    cursor:default; box-shadow: var(--shadow-sm);
}
.inline-badge {
    display:inline; font-size:.9rem; cursor:default; vertical-align:middle;
}

/* ============================================================
   Staff / community mod helpers
   ============================================================ */
.community-staff-list { display:flex; flex-direction:column; gap:.5rem; }
.community-staff-row { display:flex; justify-content:space-between; align-items:center; padding:.5rem .25rem; border-bottom:1px solid var(--border); font-size:.85rem; }
.mod-user-list { list-style:none; margin:0; padding:0; }
.mod-user-row { display:flex; justify-content:space-between; align-items:center; padding:.5rem .25rem; border-bottom:1px solid var(--border); font-size:.85rem; }

/* Community pill with mod link */
.community-pill-wrap { position:relative; }
.community-mod-link { position:absolute; right:.5rem; top:50%; transform:translateY(-50%); font-size:.7rem; color:var(--accent); text-decoration:none; padding:2px 8px; border:1.5px solid var(--accent); border-radius:var(--radius-pill); opacity:0; transition:all var(--transition); pointer-events:none; }
.community-pill-wrap:hover .community-mod-link { opacity:1; pointer-events:auto; }

/* Danger zone */
.danger-zone-panel { border:1.5px solid #fca5a5 !important; background: #fffbfb !important; }
.danger-zone-item { padding-bottom:.75rem; }
.danger-zone-item:last-child { padding-bottom:0; }
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tiptap-img-preview-wrap {
    background: #f3f4f6;
    border: 1.5px solid var(--border, #e4e7ea);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1rem;
    text-align: center;
    max-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiptap-img-preview {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    display: block;
}

.tiptap-img-fields {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-bottom: .9rem;
}

.tiptap-img-row {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    flex-wrap: wrap;
}

.tiptap-img-fields label,
.tiptap-img-row label {
    font-size: .78rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    flex: 1;
    min-width: 80px;
}

.tiptap-img-lock-label {
    flex-direction: row !important;
    align-items: center !important;
    gap: .35rem !important;
    white-space: nowrap;
    flex: 0 0 auto !important;
    min-width: unset !important;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
}

.tiptap-img-input {
    padding: .4rem .65rem;
    border: 1.5px solid var(--border, #e4e7ea);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    line-height: 1.4;
    width: 100%;
    background: #fff;
    color: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tiptap-img-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(107,143,192,0.16);
}

.tiptap-img-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.tiptap-img-btn-cancel {
    padding: .42rem 1rem;
    border: 1.5px solid var(--border, #e4e7ea);
    border-radius: var(--radius-pill);
    background: transparent;
    font-size: .85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tiptap-img-btn-cancel:hover { background: #f3f4f6; border-color: #b0b5bc; }

.tiptap-img-btn-insert {
    padding: .42rem 1.1rem;
    border: none;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    box-shadow: 0 2px 8px rgba(109,91,208,0.28);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.tiptap-img-btn-insert:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ── Klipy GIF picker ───────────────────────────────────────────────────── */
.tiptap-gif-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}
.tiptap-gif-picker {
    background: var(--bg, #fff);
    border: 1px solid var(--border, #e4e7ea);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    overflow: hidden;
}
.tiptap-gif-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--border, #e4e7ea);
    flex-shrink: 0;
}
.tiptap-gif-search {
    flex: 1;
    border: 1.5px solid var(--border, #e4e7ea);
    border-radius: var(--radius-sm);
    padding: .4rem .7rem;
    font-size: .9rem;
    outline: none;
    transition: border-color var(--transition);
    background: var(--bg, #fff);
    color: inherit;
}
.tiptap-gif-search:focus { border-color: var(--brand); }
.tiptap-gif-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--muted, #888);
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    line-height: 1;
}
.tiptap-gif-close:hover { background: var(--bg-alt); color: var(--ink); }
.tiptap-gif-categories {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border, #e4e7ea);
    flex-shrink: 0;
}
.tiptap-gif-cat-btn {
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .65rem;
    border: 1.5px solid var(--border, #e4e7ea);
    border-radius: var(--radius-pill);
    background: #fff;
    cursor: pointer;
    color: var(--ink);
    transition: all var(--transition);
    text-transform: capitalize;
}
.tiptap-gif-cat-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.tiptap-gif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .35rem;
    padding: .5rem .75rem;
    overflow-y: auto;
    flex: 1;
}
.tiptap-gif-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    background: var(--bg-alt, #f0f1f3);
    display: block;
}
.tiptap-gif-thumb:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 1;
    position: relative;
}
.tiptap-gif-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .75rem;
    border-top: 1px solid var(--border, #e4e7ea);
    flex-shrink: 0;
    font-size: .75rem;
}
.tiptap-gif-loading { color: var(--muted, #888); }
.tiptap-gif-more {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: .2rem .75rem;
    font-size: .75rem;
    cursor: pointer;
    color: var(--ink);
    transition: all var(--transition);
}
.tiptap-gif-more:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.tiptap-gif-attr { color: var(--muted, #888); text-decoration: none; }
.tiptap-gif-attr:hover { color: var(--brand); text-decoration: underline; }
.tiptap-gif-error { color: var(--muted); padding: 1rem; text-align: center; grid-column: 1/-1; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
#lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    opacity: 0;
    transition: opacity .2s ease;
}
#lightbox-overlay.lb-visible { opacity: 1; }

#lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 48px rgba(0, 0, 0, .7);
    cursor: zoom-out;
    display: block;
}

#lightbox-close {
    position: absolute;
    top: .75rem;
    right: 1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: .75;
    padding: 0;
}
#lightbox-close:hover { opacity: 1; }

img[data-full] { cursor: zoom-in; }


.post-card-thumb {
    flex: 0 0 auto;
    width: 96px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--border, #e4e7ea);
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   Bootstrap button harmonisation
   Override Bootstrap's default sharp corners globally
   ============================================================ */
.btn {
    border-radius: var(--radius-pill) !important;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all var(--transition) !important;
}
.btn:active { transform: translateY(0) !important; }
.btn-sm { font-size: 0.8rem !important; padding: 0.3rem 0.85rem !important; }
.btn-lg { padding: 0.6rem 1.5rem !important; }

/* Bootstrap form controls rounding */
.form-control,
.form-select,
.input-group > .form-control,
.input-group > .form-select {
    border-radius: var(--radius-sm) !important;
}
.input-group > .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }
.input-group > .form-control:first-child,
.input-group > .form-select:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}

/* Bootstrap card rounding */
.card { border-radius: var(--radius) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }

/* Bootstrap table in panels */
.table { font-size: 0.88rem; }
.table thead th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1.5px solid var(--border) !important; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #fafbfd; }
.table > :not(caption) > * > * { border-bottom-color: var(--border); }

/* Bootstrap select rounding override */
.form-select { border-radius: var(--radius-sm) !important; }

/* ── Mod table (community-badges, community-mod etc) ── */
.mod-table thead th { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); padding:8px 10px; border-bottom:1.5px solid var(--border); }
.mod-table tbody td { padding:9px 10px; border-bottom:1px solid var(--border); vertical-align:middle; font-size:.85rem; }
.mod-table tbody tr:last-child td { border-bottom:none; }
.mod-table tbody tr:hover td { background:#fafbfd; }
