/* navbar.css */

html {
    font-size: 90%;
}


/* ── Нейтральный фон светлой темы ── */
[data-bs-theme="light"] {
    --bs-body-bg: #e8eaed;
    --bs-body-bg-rgb: 232, 234, 237;
    --bs-card-bg: #f8f9fa;
    --bs-secondary-bg: #d8dde3;
    --bs-tertiary-bg: #dde1e6;
}

/* ── Header / Navbar ── */
.site-header {
    z-index: 1030;
}

.site-header .navbar {
    height: 54px;
    padding: 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

[data-bs-theme="dark"] .site-header .navbar  { background: #131418; }
[data-bs-theme="light"] .site-header .navbar { background: #ffffff; }

/* ── Logo ── */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    margin-right: 2rem;
    text-decoration: none;
}
.nav-logo-img {
    height: 26px;
    width: 26px;
    object-fit: contain;
    opacity: 0.9;
}
.nav-logo-text {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
[data-bs-theme="dark"]  .nav-logo-text { color: #f0f0f0; }
[data-bs-theme="light"] .nav-logo-text { color: #111; }

/* ── Nav links ── */
.navbar-nav .nav-link {
    font-size: 0.865rem;
    font-weight: 450;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
[data-bs-theme="dark"]  .navbar-nav .nav-link         { color: rgba(255,255,255,0.65); }
[data-bs-theme="dark"]  .navbar-nav .nav-link:hover,
[data-bs-theme="dark"]  .navbar-nav .nav-link:focus    { color: #fff; background: rgba(255,255,255,0.07); }
[data-bs-theme="dark"]  .navbar-nav .nav-link.active   { color: #fff; }

[data-bs-theme="light"] .navbar-nav .nav-link         { color: rgba(0,0,0,0.6); }
[data-bs-theme="light"] .navbar-nav .nav-link:hover,
[data-bs-theme="light"] .navbar-nav .nav-link:focus    { color: #000; background: rgba(0,0,0,0.05); }
[data-bs-theme="light"] .navbar-nav .nav-link.active   { color: #000; }

/* ── Dropdown ── */
.navbar-nav .dropdown-toggle::after { opacity: 0.5; }

[data-bs-theme="dark"]  .dropdown-menu { background: #1e2025; border: 1px solid rgba(255,255,255,0.1); }
[data-bs-theme="light"] .dropdown-menu { background: #fff; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.dropdown-menu { border-radius: 8px; padding: 6px; min-width: 180px; }

[data-bs-theme="dark"]  .dropdown-item { color: rgba(255,255,255,0.75); border-radius: 5px; font-size: 0.85rem; padding: 6px 10px; }
[data-bs-theme="light"] .dropdown-item { color: rgba(0,0,0,0.75); border-radius: 5px; font-size: 0.85rem; padding: 6px 10px; }

[data-bs-theme="dark"]  .dropdown-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
[data-bs-theme="light"] .dropdown-item:hover { background: rgba(0,0,0,0.05); color: #000; }

.dropdown-divider { opacity: 0.12; margin: 4px 0; }

.nav-cat-count {
    float: right;
    font-size: 0.7rem;
    opacity: 0.45;
    margin-top: 1px;
}

/* ── Right actions ── */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Search (toggle-expand) */
.nav-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-search-form {
    position: absolute;
    right: 38px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    overflow: hidden;
    transition: width 0.22s ease;
}
.nav-search-form.open { width: 200px; }

.nav-search-input {
    width: 100%;
    height: 32px;
    font-size: 0.8rem;
    border-radius: 7px;
    padding: 0 10px;
    border: 1px solid rgba(128,128,128,0.3);
    outline: none;
    background: transparent;
}
[data-bs-theme="dark"]  .nav-search-input { color: #eee; background: #1e2128; }
[data-bs-theme="light"] .nav-search-input { color: #111; background: #fff; }
[data-bs-theme="dark"]  .nav-search-input::placeholder { color: rgba(255,255,255,0.3); }
[data-bs-theme="light"] .nav-search-input::placeholder { color: rgba(0,0,0,0.35); }

/* Theme toggle */
.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s;
}
[data-bs-theme="dark"]  .nav-icon-btn:hover { background: rgba(255,255,255,0.08); }
[data-bs-theme="light"] .nav-icon-btn:hover { background: rgba(0,0,0,0.06); }

/* User button */
.nav-user-btn {
    height: 32px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid rgba(128,128,128,0.25);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
[data-bs-theme="dark"]  .nav-user-btn { color: rgba(255,255,255,0.8); }
[data-bs-theme="light"] .nav-user-btn { color: rgba(0,0,0,0.75); }
[data-bs-theme="dark"]  .nav-user-btn:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.3); }
[data-bs-theme="light"] .nav-user-btn:hover { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.3); }
.nav-user-btn::after { margin-left: 6px; opacity: 0.5; }

/* Avatar */
.nav-avatar-link { display: flex; align-items: center; flex-shrink: 0; }
.nav-avatar-img  { width: 30px; height: 30px; object-fit: cover; }
.nav-avatar-fallback {
    width: 30px; height: 30px;
    font-size: 0.7rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
[data-bs-theme="dark"]  .nav-avatar-fallback { background: #3a3f4a; color: #e0e0e0; }
[data-bs-theme="light"] .nav-avatar-fallback { background: #dee2e6; color: #333; }

/* Login / Register buttons */
.nav-btn-secondary {
    height: 32px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0 12px;
    border-radius: 7px;
    border: 1px solid rgba(128,128,128,0.3);
    background: transparent;
    text-decoration: none;
    display: inline-flex; align-items: center;
    transition: background 0.15s;
}
[data-bs-theme="dark"]  .nav-btn-secondary { color: rgba(255,255,255,0.75); }
[data-bs-theme="light"] .nav-btn-secondary { color: rgba(0,0,0,0.7); }
[data-bs-theme="dark"]  .nav-btn-secondary:hover { background: rgba(255,255,255,0.07); color: #fff; }
[data-bs-theme="light"] .nav-btn-secondary:hover { background: rgba(0,0,0,0.04); color: #000; }

.nav-btn-primary {
    height: 32px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0 12px;
    border-radius: 7px;
    border: none;
    background: #3b82f6;
    color: #fff;
    text-decoration: none;
    display: inline-flex; align-items: center;
    transition: background 0.15s;
}
.nav-btn-primary:hover { background: #2563eb; color: #fff; }

/* Hamburger */
.navbar-toggler {
    border: 1px solid rgba(128,128,128,0.25);
    border-radius: 7px;
    padding: 5px 8px;
}
.navbar-toggler:focus { box-shadow: none; }

/* Username label in dropdown */
.nav-username-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
}

/* Avatar dropdown toggle — hide default caret */
.nav-avatar-link.dropdown-toggle::after { display: none; }

/* ── Mobile collapse (phones < 768px) ── */
@media (max-width: 767.98px) {
    .site-header .navbar { height: auto; padding: 10px 0; }
    .navbar-collapse { padding: 8px 0 4px; }
    .navbar-nav .nav-link { padding: 8px 12px; border-radius: 6px; }
    .nav-actions { flex-wrap: wrap; padding: 8px 0 4px; gap: 8px; }
    .nav-search-wrap { flex: 1; min-width: 180px; }
    .nav-search-form { position: static; transform: none; width: 100% !important; overflow: visible; }
    .nav-search-input { width: 100%; }
    [data-bs-theme="dark"]  .dropdown-menu { background: #1a1d22 !important; }
    [data-bs-theme="light"] .dropdown-menu { background: #f8f9fa !important; box-shadow: none; }
}

/* Компактный сайдбар каталогов */
.catalog-sidebar {
    align-self: flex-start;
    position: sticky;
    top: 62px;  /* navbar 54px + 8px зазор */
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}
.catalog-sidebar .card {
    border-radius: 4px;
}
.catalog-sidebar .card-header {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    opacity: 0.55;
    border-bottom: none;
}
.catalog-sidebar .list-group-item {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 0 !important;
}
.catalog-sidebar .list-group-item .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.45em;
    opacity: 0.6;
}
.catalog-sidebar .card + .card {
    margin-top: 0.5rem;
}

/* Нейтральные бейджи для карточек каталога */
.tool-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2em 0.55em;
    border-radius: 3px;
    border: 1px solid currentColor;
    background: transparent;
    opacity: 0.7;
    letter-spacing: 0.02em;
}


/* ── Tag scroller ── */
.tag-scroller-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tag-scroller {
    flex: 1;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    padding: 3px 0;
    mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
}
.tag-scroller::-webkit-scrollbar { display: none; }

.tag-chip {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(128,128,128,0.28);
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
[data-bs-theme="dark"]  .tag-chip { color: rgba(255,255,255,0.6); }
[data-bs-theme="light"] .tag-chip { color: rgba(0,0,0,0.6); }
[data-bs-theme="dark"]  .tag-chip:hover { color: #fff; border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.07); }
[data-bs-theme="light"] .tag-chip:hover { color: #000; border-color: rgba(0,0,0,0.35); background: rgba(0,0,0,0.05); }
.tag-chip.active { background: #3b82f6; border-color: #3b82f6; color: #fff !important; }
.tag-chip-count { font-size: 0.67rem; opacity: 0.5; }

.tag-scroll-btn {
    flex-shrink: 0;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(128,128,128,0.22);
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; line-height: 1; padding: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    pointer-events: none;
    user-select: none;
}
.tag-scroller-wrap.has-left  .tag-scroll-left  { opacity: 1; pointer-events: auto; }
.tag-scroller-wrap.has-right .tag-scroll-right { opacity: 1; pointer-events: auto; }
[data-bs-theme="dark"]  .tag-scroll-btn { color: rgba(255,255,255,0.65); }
[data-bs-theme="light"] .tag-scroll-btn { color: rgba(0,0,0,0.55); }
[data-bs-theme="dark"]  .tag-scroll-btn:hover { background: rgba(255,255,255,0.08); }
[data-bs-theme="light"] .tag-scroll-btn:hover { background: rgba(0,0,0,0.06); }

/* ── Comment action buttons ── */
.comment-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.comment:hover .comment-actions,
.comment:focus-within .comment-actions,
.forum-post:hover .comment-actions,
.forum-post:focus-within .comment-actions {
    opacity: 1;
}
@media (hover: none) {
    .comment-actions { opacity: 0.55; }
}

.comment-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    line-height: 1;
}
[data-bs-theme="dark"]  .comment-action-btn { color: rgba(255,255,255,0.4); }
[data-bs-theme="light"] .comment-action-btn { color: rgba(0,0,0,0.35); }
[data-bs-theme="dark"]  .comment-action-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
[data-bs-theme="light"] .comment-action-btn:hover { background: rgba(0,0,0,0.07); color: rgba(0,0,0,0.85); }
.comment-action-delete:hover { color: #ef4444 !important; }


/* ══════════════════════════════════════════
   FORUM
   ══════════════════════════════════════════ */

/* ── Forum index: Discourse-style table ── */

.fdisc-table {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(128,128,128,0.15);
}
[data-bs-theme="dark"]  .fdisc-table { border-color: rgba(255,255,255,0.08); }
[data-bs-theme="light"] .fdisc-table { background: #fff; border-color: rgba(0,0,0,0.1); }

/* Header row */
.fdisc-thead {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    gap: 0;
}
[data-bs-theme="dark"]  .fdisc-thead { background: rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.07); color: rgba(255,255,255,0.3); }
[data-bs-theme="light"] .fdisc-thead { background: rgba(0,0,0,0.02); border-bottom: 1px solid rgba(0,0,0,0.07); color: rgba(0,0,0,0.35); }

/* Data row */
.fdisc-row {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    gap: 0;
    transition: background 0.12s;
    border-top: 1px solid rgba(128,128,128,0.08);
}
.fdisc-row:first-of-type { border-top: none; }
[data-bs-theme="dark"]  .fdisc-row { border-top-color: rgba(255,255,255,0.06); }
[data-bs-theme="light"] .fdisc-row { border-top-color: rgba(0,0,0,0.06); }
[data-bs-theme="dark"]  .fdisc-row:hover { background: rgba(255,255,255,0.025); }
[data-bs-theme="light"] .fdisc-row:hover { background: rgba(0,0,0,0.018); }

/* Column widths */
.fdisc-col-cat    { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding-right: 16px; }
.fdisc-col-num    { width: 72px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fdisc-col-latest { width: 220px; flex-shrink: 0; display: flex; align-items: center; padding-left: 16px; }

/* Category dot (Discourse-style colored square) */
.fdisc-dot {
    width: 10px; height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
}
.fdisc-dot-1 { background: #208152; }
.fdisc-dot-2 { background: #e07b2b; }
.fdisc-dot-3 { background: #c94040; }
.fdisc-dot-4 { background: #7c6dd8; }
.fdisc-dot-5 { background: #2893c0; }

.fdisc-cat-body { flex: 1; min-width: 0; }

.fdisc-cat-name {
    font-size: 0.875rem;
    font-weight: 600;
    display: inline;
}
[data-bs-theme="dark"]  .fdisc-cat-name { color: #e2e2e2; }
[data-bs-theme="light"] .fdisc-cat-name { color: #1a1a1a; }
.fdisc-cat-name:hover { color: #208152 !important; }

.fdisc-cat-icon { margin-right: 4px; font-size: 0.85rem; }

.fdisc-cat-desc {
    font-size: 0.78rem;
    margin-top: 2px;
    line-height: 1.35;
}
[data-bs-theme="dark"]  .fdisc-cat-desc { color: rgba(255,255,255,0.38); }
[data-bs-theme="light"] .fdisc-cat-desc { color: rgba(0,0,0,0.4); }

/* Numbers */
.fdisc-num {
    font-size: 0.82rem;
    font-weight: 500;
}
[data-bs-theme="dark"]  .fdisc-num { color: rgba(255,255,255,0.5); }
[data-bs-theme="light"] .fdisc-num { color: rgba(0,0,0,0.45); }

/* Latest post column */
.fdisc-latest { min-width: 0; }

.fdisc-latest-title {
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
[data-bs-theme="dark"]  .fdisc-latest-title { color: #c8c8d0; }
[data-bs-theme="light"] .fdisc-latest-title { color: #333; }
.fdisc-latest-title:hover { color: #208152 !important; }

.fdisc-latest-title-link { font-size: 0.78rem; }
[data-bs-theme="dark"]  .fdisc-latest-title-link { color: #b0b0ba; }
[data-bs-theme="light"] .fdisc-latest-title-link { color: #444; }
.fdisc-latest-title-link:hover { color: #208152 !important; }

.fdisc-latest-meta {
    font-size: 0.7rem;
    margin-top: 2px;
}
[data-bs-theme="dark"]  .fdisc-latest-meta { color: rgba(255,255,255,0.28); }
[data-bs-theme="light"] .fdisc-latest-meta { color: rgba(0,0,0,0.35); }

.fdisc-latest-who { font-weight: 500; }
[data-bs-theme="dark"]  .fdisc-latest-who { color: rgba(255,255,255,0.45); }
[data-bs-theme="light"] .fdisc-latest-who { color: rgba(0,0,0,0.5); }

.fdisc-latest-dot { margin: 0 3px; opacity: 0.4; }

/* Mobile stats */
.fdisc-mobile-meta { }
.fdisc-mobile-stat { font-size: 0.72rem; }
[data-bs-theme="dark"]  .fdisc-mobile-stat { color: rgba(255,255,255,0.35); }
[data-bs-theme="light"] .fdisc-mobile-stat { color: rgba(0,0,0,0.4); }

/* ── Thread list (category page) ── */
.forum-thread-list-full {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(128,128,128,0.15);
}
[data-bs-theme="dark"]  .forum-thread-list-full { border-color: rgba(255,255,255,0.08); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

.forum-thead {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
[data-bs-theme="dark"]  .forum-thead { background: rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.07); }
[data-bs-theme="light"] .forum-thead { background: rgba(0,0,0,0.025); border-bottom: 1px solid rgba(0,0,0,0.06); }

.forum-col-title   { flex: 1; min-width: 0; }
.forum-col-replies { width: 72px; flex-shrink: 0; }
.forum-col-views   { width: 80px; flex-shrink: 0; }
.forum-col-last    { width: 150px; flex-shrink: 0; }
.forum-col-admin   { width: 28px; flex-shrink: 0; }

.forum-thread-row {
    font-size: 0.85rem;
    border-top: 1px solid rgba(128,128,128,0.08);
    transition: background 0.1s;
}
[data-bs-theme="dark"]  .forum-thread-row { background: #1c1e24; }
[data-bs-theme="light"] .forum-thread-row { background: #fff; }
[data-bs-theme="dark"]  .forum-thread-row:hover { background: #22252c; }
[data-bs-theme="light"] .forum-thread-row:hover { background: rgba(0,0,0,0.018); }

.forum-thread-row.forum-pinned { border-left: 2px solid #208152; }

.forum-thread-title { font-weight: 500; font-size: 0.85rem; }
[data-bs-theme="dark"]  .forum-thread-title { color: #d0d0d8; }
[data-bs-theme="light"] .forum-thread-title { color: #1a1a2e; }
.forum-thread-title:hover { color: #208152 !important; }

.forum-status-icon { width: 20px; flex-shrink: 0; }

.forum-admin-del {
    background: none;
    border: none;
    padding: 3px;
    cursor: pointer;
    color: rgba(128,128,128,0.35);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.forum-admin-del:hover {
    color: #e05c5c;
    background: rgba(220,53,69,0.1);
}

.forum-tag-pin,
.forum-tag-closed {
    font-size: 0.63rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.forum-tag-pin    { background: rgba(32,129,82,0.15); color: #208152; }
.forum-tag-closed { background: rgba(128,128,128,0.12); color: rgba(128,128,128,0.8); }

/* ── Thread page (posts) ── */
.forum-posts {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(128,128,128,0.15);
}
[data-bs-theme="dark"]  .forum-posts { border-color: rgba(255,255,255,0.08); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
[data-bs-theme="light"] .forum-posts { border-color: rgba(0,0,0,0.12); }

.forum-post {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(128,128,128,0.1);
    transition: background 0.15s;
}
.forum-post:first-child { border-top: none; }

[data-bs-theme="dark"]  .forum-post { background: #1c1e24; border-top-color: rgba(255,255,255,0.06); }
[data-bs-theme="light"] .forum-post { background: #f4f5f7; border-top-color: rgba(0,0,0,0.07); }
[data-bs-theme="dark"]  .forum-post.forum-post-op { background: rgba(32,129,82,0.06); }
[data-bs-theme="light"] .forum-post.forum-post-op { background: #eceef1; }

/* Author sidebar */
.forum-post-author {
    width: 110px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 10px 16px 16px;
    text-align: center;
    border-right: 1px solid rgba(128,128,128,0.08);
}
[data-bs-theme="dark"]  .forum-post-author { border-right-color: rgba(255,255,255,0.06); }
[data-bs-theme="light"] .forum-post-author { background: #e8eaed; border-right-color: rgba(0,0,0,0.08); }

.forum-avatar { object-fit: cover; }
.forum-avatar-fallback {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    flex-shrink: 0;
}
[data-bs-theme="dark"]  .forum-avatar-fallback { background: #2a2d35; color: #c8c8d0; }
[data-bs-theme="light"] .forum-avatar-fallback { background: #dee2e6; color: #333; }

.forum-author-name { font-size: 0.78rem; }
[data-bs-theme="dark"]  .forum-author-name { color: #9898a8; }
[data-bs-theme="light"] .forum-author-name { color: #444; }

.forum-role-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 2px;
    background: rgba(32,129,82,0.18);
    color: #208152;
}
[data-bs-theme="light"] .forum-role-badge { color: #1a6b43; }

/* Rank badges */
.forum-rank-badge {
    font-size: 0.58rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 1px;
    opacity: 0.85;
}
.forum-rank-badge.rank-observer  { background: rgba(120,120,140,.13); color: #888; }
.forum-rank-badge.rank-recon     { background: rgba(59,130,246,.13);  color: #3b82f6; }
.forum-rank-badge.rank-analyst   { background: rgba(16,185,129,.13);  color: #10b981; }
.forum-rank-badge.rank-operator  { background: rgba(245,158,11,.13);  color: #d97706; }
.forum-rank-badge.rank-pentester { background: rgba(239,68,68,.13);   color: #ef4444; }
.forum-rank-badge.rank-red-team  { background: rgba(168,85,247,.13);  color: #a855f7; }
.forum-rank-badge.rank-core      { background: rgba(250,204,21,.13);  color: #ca8a04; }

[data-bs-theme="light"] .forum-rank-badge.rank-observer  { color: #666; }
[data-bs-theme="light"] .forum-rank-badge.rank-recon     { color: #2563eb; }
[data-bs-theme="light"] .forum-rank-badge.rank-analyst   { color: #059669; }
[data-bs-theme="light"] .forum-rank-badge.rank-operator  { color: #b45309; }
[data-bs-theme="light"] .forum-rank-badge.rank-pentester { color: #dc2626; }
[data-bs-theme="light"] .forum-rank-badge.rank-red-team  { color: #7c3aed; }
[data-bs-theme="light"] .forum-rank-badge.rank-core      { color: #92400e; }

/* Inline rank — в комментариях рядом с именем */
.forum-rank-inline {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-left: 4px;
}

/* Post content */
.forum-post-content {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
}

.forum-post-meta { font-size: 0.77rem; }

.forum-post-body {
    font-size: 0.875rem;
    line-height: 1.65;
    word-break: break-word;
}

/* Action buttons */
.forum-post-actions { gap: 4px; }

.forum-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 0.77rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
[data-bs-theme="dark"]  .forum-action-btn { color: rgba(255,255,255,0.3); }
[data-bs-theme="light"] .forum-action-btn { color: rgba(0,0,0,0.28); }
[data-bs-theme="dark"]  .forum-action-btn:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
[data-bs-theme="light"] .forum-action-btn:hover { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.8); }

.forum-like-btn.liked { color: #208152 !important; }
.forum-like-btn.liked:hover { color: #1a6b43 !important; }

/* Reply box */
.forum-reply-box {
    margin-top: 24px;
    border-radius: 8px;
    border: 1px solid rgba(128,128,128,0.15);
    padding: 16px;
}
[data-bs-theme="dark"]  .forum-reply-box { background: #1c1e24; border-color: rgba(255,255,255,0.08); }
[data-bs-theme="light"] .forum-reply-box { background: #fff; }

.forum-reply-header { font-size: 0.8rem; opacity: 0.55; }

.forum-textarea {
    resize: vertical;
    min-height: 100px;
    font-size: 0.875rem;
}

/* Mobile: collapse author sidebar */
@media (max-width: 575.98px) {
    .forum-post { flex-direction: column; }
    .forum-post-author {
        width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border-right: none;
        border-bottom: 1px solid rgba(128,128,128,0.08);
    }
    .forum-author-name { margin-top: 0; }
    .forum-role-badge { margin-top: 0; }
}

/* .fw-500 и .fw-600 утилиты */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.opacity-35 { opacity: 0.35 !important; }
.opacity-40 { opacity: 0.40 !important; }
.opacity-50 { opacity: 0.50 !important; }
.opacity-65 { opacity: 0.65 !important; }
.opacity-70 { opacity: 0.70 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-80 { opacity: 0.80 !important; }
.min-w-0 { min-width: 0; }
.cursor-default { cursor: default; }

/* Tool card author attribution */
.tool-card-author {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(128,128,128,0.12);
    font-size: 0.72rem;
    color: var(--bs-secondary-color, #6c757d);
}
.tool-card-author::before {
    content: 'добавил ';
    opacity: 0.6;
}
.tool-card-author-link {
    color: inherit;
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.15s, color 0.15s;
}
.tool-card-author-link:hover {
    opacity: 1;
    color: #208152;
    text-decoration: underline;
}

/* ── Article content: code blocks ───────────────────────────────────────── */
.content code {
    display: block;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0 1.25rem;
    background: #f0f2f4;
    border: 1px solid #dee2e6;
    border-left: 3px solid #198754;
    border-radius: 0 0.375rem 0.375rem 0;
    color: #1a1e21;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
}

[data-bs-theme="dark"] .content code {
    background: #1a1d23;
    border-color: #2d3238;
    border-left-color: #20c997;
    color: #c9d1d9;
}

/* Inline code inside <p> stays inline */
.content p code,
.content li code,
.content td code {
    display: inline;
    padding: 0.15em 0.4em;
    margin: 0;
    font-size: 0.82em;
    background: #e9ecef;
    border: none;
    border-left: none;
    border-radius: 0.25rem;
    color: #c0392b;
    white-space: nowrap;
    word-break: normal;
}

[data-bs-theme="dark"] .content p code,
[data-bs-theme="dark"] .content li code,
[data-bs-theme="dark"] .content td code {
    background: #2d3238;
    color: #ff7b72;
}

/* Section headings in articles */
.content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #e9ecef;
}

[data-bs-theme="dark"] .content h2 {
    border-bottom-color: #2d3238;
}

.content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.content p {
    line-height: 1.75;
    margin-bottom: 0.9rem;
}

.content ul, .content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.content li {
    line-height: 1.7;
    margin-bottom: 0.25rem;
}

/* ── Footer ── */
.site-footer {
    border-top: 1px solid rgba(128,128,128,0.13);
    margin-top: 3rem;
}
[data-bs-theme="dark"]  .site-footer { background: #0e1014; border-top-color: rgba(255,255,255,0.07); }
[data-bs-theme="light"] .site-footer { background: #f0f2f5; }

.footer-main {
    padding: 3rem 0 2.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
}
.footer-brand-name {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
[data-bs-theme="dark"]  .footer-brand-name { color: #e8e8e8; }
[data-bs-theme="light"] .footer-brand-name { color: #111; }

.footer-about {
    font-size: 0.82rem;
    line-height: 1.65;
    max-width: 340px;
    margin: 0;
}
[data-bs-theme="dark"]  .footer-about { color: rgba(255,255,255,0.42); }
[data-bs-theme="light"] .footer-about { color: rgba(0,0,0,0.52); }

.footer-social { display: flex; gap: 10px; }
.footer-social-link {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
[data-bs-theme="dark"]  .footer-social-link { color: rgba(255,255,255,0.38); }
[data-bs-theme="light"] .footer-social-link { color: rgba(0,0,0,0.38); }
[data-bs-theme="dark"]  .footer-social-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
[data-bs-theme="light"] .footer-social-link:hover { background: rgba(0,0,0,0.07); color: #000; }

.footer-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
[data-bs-theme="dark"]  .footer-heading { color: rgba(255,255,255,0.9); }
[data-bs-theme="light"] .footer-heading { color: rgba(0,0,0,0.85); }

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.footer-links a,
.footer-links button {
    font-size: 0.82rem;
    text-decoration: none;
    transition: color 0.15s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
[data-bs-theme="dark"]  .footer-links a,
[data-bs-theme="dark"]  .footer-links button { color: rgba(255,255,255,0.45); }
[data-bs-theme="light"] .footer-links a,
[data-bs-theme="light"] .footer-links button { color: rgba(0,0,0,0.52); }
[data-bs-theme="dark"]  .footer-links a:hover,
[data-bs-theme="dark"]  .footer-links button:hover { color: rgba(255,255,255,0.9); }
[data-bs-theme="light"] .footer-links a:hover,
[data-bs-theme="light"] .footer-links button:hover { color: rgba(0,0,0,0.9); }

.footer-link-all { color: #198754 !important; font-weight: 500; }

.footer-donate-desc {
    font-size: 0.8rem;
    line-height: 1.55;
    margin-bottom: 10px;
}
[data-bs-theme="dark"]  .footer-donate-desc { color: rgba(255,255,255,0.35); }
[data-bs-theme="light"] .footer-donate-desc { color: rgba(0,0,0,0.45); }

.footer-donate-links { gap: 5px; }
.footer-donate-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px !important;
    border-radius: 7px;
    transition: background 0.15s, color 0.15s;
    width: 100%;
}
[data-bs-theme="dark"]  .footer-donate-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9) !important; }
[data-bs-theme="light"] .footer-donate-item:hover { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.85) !important; }

.footer-donate-icon {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.footer-donate-item > span:not(.footer-donate-icon):not(.footer-copy-hint) {
    flex: 1;
    min-width: 0;
}
.footer-copy-hint {
    font-size: 0.7rem;
    opacity: 0.45;
    white-space: nowrap;
    flex-shrink: 0;
}
.footer-donate-qr {
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0.9;
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}
.footer-donate-item:hover .footer-donate-qr,
.footer-donate-item:focus-visible .footer-donate-qr {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    width: 180px;
    height: 180px;
    opacity: 1;
    background: #fff;
    padding: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    z-index: 60;
    pointer-events: none;
}

/* ── Footer bottom bar ── */
.footer-bottom {
    border-top: 1px solid rgba(128,128,128,0.1);
    padding: 14px 0;
}
[data-bs-theme="dark"]  .footer-bottom { border-top-color: rgba(255,255,255,0.07); }

.footer-copy {
    font-size: 0.78rem;
}
[data-bs-theme="dark"]  .footer-copy { color: rgba(255,255,255,0.28); }
[data-bs-theme="light"] .footer-copy { color: rgba(0,0,0,0.38); }

.footer-bottom-link {
    font-size: 0.78rem;
    text-decoration: none;
    transition: color 0.15s;
}
[data-bs-theme="dark"]  .footer-bottom-link { color: rgba(255,255,255,0.32); }
[data-bs-theme="light"] .footer-bottom-link { color: rgba(0,0,0,0.4); }
[data-bs-theme="dark"]  .footer-bottom-link:hover { color: rgba(255,255,255,0.8); }
[data-bs-theme="light"] .footer-bottom-link:hover { color: rgba(0,0,0,0.8); }

/* ── Footer toast (copy notification) ── */
.footer-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #198754;
    color: #fff;
    font-size: 0.82rem;
    padding: 8px 18px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 9999;
    white-space: nowrap;
}
.footer-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Scroll navigation (up/down arrows) ── */
.scroll-nav {
    position: fixed;
    top: 76px;
    right: 16px;
    z-index: 1020;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.scroll-nav-btn {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: 1px solid var(--tc-card-br, rgba(128,128,128,.25));
    background: var(--tc-card-bg, var(--bs-body-bg));
    color: var(--bs-secondary-color);
    cursor: pointer;
    opacity: 0.45;
    transition: opacity .15s, color .15s, border-color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.scroll-nav-btn:hover {
    opacity: 1;
    color: #198754;
    border-color: #198754;
}
.scroll-nav-btn.sn-hidden {
    opacity: 0 !important;
    pointer-events: none;
}
@media (max-width: 767px) {
    .scroll-nav {
        top: auto;
        bottom: 18px;
        right: 12px;
    }
    .scroll-nav-btn {
        width: 24px;
        height: 24px;
    }
}

/* ── DARKROOM nav link ───────────────────────────────── */
.nav-darkroom-link {
    color: #c0392b !important;
    font-family: 'Courier New', monospace;
    font-size: .82rem !important;
    font-weight: 700;
    letter-spacing: .06em;
    opacity: .85;
    transition: opacity .15s;
}
.nav-darkroom-link:hover,
.nav-darkroom-link.active {
    opacity: 1;
    text-shadow: 0 0 8px rgba(192,57,43,.4);
}

.featured-partners-disclosure {
    font-size: 0.7rem;
    opacity: 0.45;
}

/* ── Featured/sponsored карточки — компактные, не растягиваются ── */
.featured-tool-card .card-body {
    flex: none;
}
.featured-tool-card .tc-featured-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Правовое уведомление (главная страница) ── */
.legal-notice {
    max-width: 820px;
    border-radius: 10px;
    border: 1px solid var(--tc-card-br, rgba(128,128,128,.25)) !important;
}
[data-bs-theme="dark"]  .legal-notice { background: rgba(255,255,255,0.02); }
[data-bs-theme="light"] .legal-notice { background: rgba(0,0,0,0.015); }

.legal-notice .card-body {
    padding: 1.75rem 2rem;
}

.legal-notice-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 1.1rem;
}
[data-bs-theme="dark"]  .legal-notice-heading { color: rgba(255,255,255,0.5); }
[data-bs-theme="light"] .legal-notice-heading { color: rgba(0,0,0,0.5); }

.legal-notice p:not(.legal-notice-heading) {
    font-size: 0.85rem;
    line-height: 1.7;
    margin-bottom: 0.9rem;
}
[data-bs-theme="dark"]  .legal-notice p:not(.legal-notice-heading) { color: rgba(255,255,255,0.6); }
[data-bs-theme="light"] .legal-notice p:not(.legal-notice-heading) { color: rgba(0,0,0,0.65); }
