/* ── reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #000000;
    --surface:  #111111;
    --border:   rgba(255,255,255,.15); /* Чуть контрастнее для плоского стиля */
    --text:     #ffffff;
    --muted:    rgba(255,255,255,.45);
    --accent:   #ffffff;
    --radius:   0px;    /* Полностью квадратные углы */
    --radius-lg: 0px;   /* Полностью квадратные углы */
    --gap:      16px;   /* Увеличен зазор между элементами (было 8px) */
}

html { font-size: 18px; } /* Увеличен базовый размер шрифта (было 16px) */

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: .75; }
img { display: block; max-width: 100%; }

input, select, textarea, button {
    font: inherit;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border); /* Сделано 1px вместо 0.5px для четкости */
    border-radius: var(--radius);
    padding: 12px 16px; /* Увеличены внутренние отступы (было 8px 12px) */
    outline: none;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    border-color: rgba(255,255,255,.6);
}
input[type="color"] {
    padding: 2px 4px;
    height: 42px; /* Чуть выше */
    cursor: pointer;
    width: 60px;
}
input[type="radio"] { width: auto; }
input[type="file"] {
    padding: 10px;
    cursor: pointer;
}

button {
    cursor: pointer;
    width: auto;
    padding: 12px 24px; /* Увеличены кнопки */
    transition: opacity .15s;
}
button:hover { opacity: .75; }
button:active { transform: scale(.98); }

textarea { resize: vertical; min-height: 100px; }

/* ── topbar ───────────────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px; /* Увеличены отступы шапки */
    background: #000000; /* Убрано размытие для более строгого плоского вида */
    border-bottom: 1px solid var(--border);
}
.logo {
    font-size: 18px; /* Крупнее (было 15px) */
    font-weight: 600;
    letter-spacing: .02em;
}
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-nav a {
    font-size: 15px; /* Крупнее */
    color: var(--muted);
    padding: 8px 14px;
    border-radius: var(--radius);
    transition: all .15s;
}
.topbar-nav a:hover,
.topbar-nav a.active {
    color: var(--text);
    background: rgba(255,255,255,.1);
    opacity: 1;
}
.btn-ghost {
    border: 1px solid var(--border);
}

/* ── flash messages ──────────────────────────────────────────────────────── */
.flash {
    padding: 14px 24px;
    font-size: 14px;
    text-align: center;
}
.flash-ok    { background: rgba(0,200,100,.15); color: #4dffaa; }
.flash-error { background: rgba(255,60,60,.15);  color: #ff7070; }

/* ── auth page ────────────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-box {
    width: 100%;
    max-width: 400px; /* Крупнее (было 360px) */
    padding: 40px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.auth-box .logo {
    display: block;
    text-align: center;
    margin-bottom: 32px;
    font-size: 24px;
}
.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 4px;
}
.auth-tabs a {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    color: var(--muted);
    transition: all .15s;
}
.auth-tabs a.active {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.auth-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.auth-box label input { margin: 0; }
.auth-box button[type="submit"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    margin-top: 8px;
}
.form-error {
    font-size: 13px;
    color: #ff7070;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(255,60,60,.1);
    border-radius: var(--radius);
}

/* ── grid page (home) ─────────────────────────────────────────────────────── */
.grid-page { 
    padding: 40px 20px; 
    max-width: 1200px; 
    margin: 0 auto; 
}

.user-grid {
    display: grid;
    /* Карточки крупнее (минимум 200px, максимум 260px) */
    grid-template-columns: repeat(auto-fit, minmax(200px, 260px)); 
    /* Сортировка/выравнивание колонок строго по центру страницы */
    justify-content: center; 
    gap: var(--gap);
}
.user-card {
    position: relative;
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    transition: border-color .15s, transform .15s;
}
.user-card:hover {
    border-color: rgba(255,255,255,.4);
    transform: scale(1.02);
    opacity: 1;
}
.user-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-text-inner,
.card-avatar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    word-break: break-word;
}
.card-avatar-inner span {
    font-size: 26px;
    font-weight: 500;
    opacity: .7;
}
.card-username {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    font-size: 12px;
    background: rgba(0,0,0,.8);
    color: rgba(255,255,255,.9);
    text-align: center;
}
.empty-state {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 16px;
    padding: 4rem 0;
    text-align: center;
}
.empty-state a { text-decoration: underline; }

/* ── profile page ────────────────────────────────────────────────────────── */
.profile-page { padding: 40px 20px; max-width: 1000px; margin: 0 auto; }

.profile-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.profile-avatar {
    flex-shrink: 0;
    width: 80px;  /* Увеличено (было 64px) */
    height: 80px; /* Увеличено (было 64px) */
    border-radius: 0%; /* Квадратный аватар профиля */
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 500;
    overflow: hidden;
    border: 1px solid var(--border);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; }
.profile-info h1 { font-size: 22px; font-weight: 600; }
.profile-username { font-size: 14px; color: var(--muted); margin-top: 4px; }
.profile-bio { font-size: 14px; color: var(--muted); margin-top: 12px; }
.profile-meta { font-size: 13px; color: var(--muted); margin-top: 8px; }

.owner-actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.tag-btn {
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 0px; /* Квадратные теги/кнопки */
    border: 1px solid var(--border);
    background: none;
    color: var(--muted);
    white-space: nowrap;
    width: auto;
}
.tag-btn:hover { color: var(--text); border-color: rgba(255,255,255,.4); }
.tag-btn.danger { color: #ff7070; border-color: rgba(255,100,100,.4); }

/* settings panel */
.settings-panel {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.settings-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.settings-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    flex: 1;
    min-width: 140px;
}
.settings-panel textarea {
    width: 100%;
    margin-bottom: 14px;
}

/* add card panel */
.add-card-panel {
    margin-bottom: 24px;
}
.add-card-toggle {
    width: 100%;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: none;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}
.add-card-toggle:hover { color: var(--text); border-color: rgba(255,255,255,.4); }
.add-card-form {
    margin-top: 12px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.card-type-tabs { display: flex; gap: 20px; font-size: 14px; }
.card-style-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.card-style-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.card-style-row select { width: auto; }

/* cards grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Крупнее карточки в профиле */
    gap: var(--gap);
}
.card-wrap { position: relative; }
.card-wrap.card-hidden .card-1x1 { opacity: .35; }

.card-1x1 {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-1x1 img { width: 100%; height: 100%; object-fit: cover; }
.card-text-content {
    padding: 18px;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    word-break: break-word;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-controls {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
    background: rgba(0,0,0,.85);
    border-radius: var(--radius);
    padding: 4px;
}
.card-wrap:hover .card-controls { display: flex; }
.ctrl-btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 0px;
    border: none;
    background: rgba(255,255,255,.1);
    color: var(--text);
    width: auto;
}
.ctrl-btn:hover { background: rgba(255,255,255,.2); }
.ctrl-btn.active { background: rgba(255,255,255,.3); }
.ctrl-btn.danger { color: #ff7070; }

/* ── feed page ────────────────────────────────────────────────────────────── */
.feed-page { padding: 40px 20px; }

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 520px; /* Лента чуть шире */
    margin: 0 auto;
}
.feed-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}
.feed-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
}
.feed-avatar-link { display: block; flex-shrink: 0; }
.feed-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 0%; /* Квадратные аватарки в ленте */
    object-fit: cover;
    border: 1px solid var(--border);
}
.feed-avatar-initials {
    display: flex;
    width: 36px;
    height: 36px;
    border-radius: 0%; /* Квадратные аватарки без картинок */
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.1);
}
.feed-meta { flex: 1; }
.feed-username { font-size: 14px; font-weight: 500; }
.feed-time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 32px 0;
}

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .topbar { padding: 12px 16px; }
    .grid-page, .profile-page, .feed-page { padding: 16px; }
    .profile-header { flex-wrap: wrap; }
    .user-grid {
        /* На мобилках карточки тоже будут центроваться в колонны */
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ── link card ────────────────────────────────────────────────────────────── */
.card-link {
    flex-direction: column;
    text-decoration: none;
    overflow: hidden;
    position: relative;
    transition: border-color .15s, transform .15s;
    background: #000000;
    color: var(--text);
}
.card-link:hover {
    border-color: rgba(255,255,255,.4);
    transform: scale(1.02);
    opacity: 1;
}

/* верхняя часть — OG-изображение: занимает всё свободное место */
.cl-image-wrap {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
.cl-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* нижняя часть — текст: фиксированная высота, не растягивается */
.cl-body {
    flex: 0 0 auto;
    width: 100%;
    padding: 8px 10px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(0,0,0,.65);  /* полупрозрачная полоса поверх фона */
    backdrop-filter: blur(2px);
}
/* с картинкой — узкая полоска снизу (~28%) */
.cl-has-image { padding: 7px 10px 8px; }
/* без картинки — занимает всю карточку по центру */
.cl-no-image  { flex: 1; justify-content: center; padding: 18px; background: transparent; }

.cl-type {
    font-size: 10px;
    color: rgba(255,255,255,.5);
    letter-spacing: .06em;
    text-transform: uppercase;
    font-weight: 600;
    line-height: 1;
}
.cl-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.95);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cl-desc {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 1px;
}

/* ── link add form ────────────────────────────────────────────────────────── */
.link-input-row {
    display: flex;
    gap: 10px;
}
.link-input-row input {
    flex: 1;
}
.link-input-row button {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,.07);
    color: var(--text);
    font-size: 14px;
}
.link-input-row button:hover { background: rgba(255,255,255,.13); }
.link-input-row button:disabled { opacity: .4; cursor: default; }

.link-fetch-error {
    font-size: 13px;
    color: #ff7070;
    margin-top: 8px;
}

/* превью карточки в форме */
.link-preview-box {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 280px;
}
.lp-image-wrap {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    flex-shrink: 0;
}
.lp-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#lp-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    background: rgba(0,0,0,.75);
    color: rgba(255,255,255,.85);
    padding: 3px 7px;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 600;
}
.lp-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.lp-site  { font-size: 10px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.lp-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.3; }
.lp-desc  { font-size: 12px; color: rgba(255,255,255,.4); line-height: 1.4; margin-top: 2px; }


/* ── image modal (lightbox) ──────────────────────────────────────────────── */
.image-modal {
    display: none; /* скрыто по умолчанию, меняется на flex через JS */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-modal .modal-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
    animation: zoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.image-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--muted);
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    z-index: 1001;
}

.image-modal .modal-close:hover {
    color: var(--text);
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── verified badge ──────────────────────────────────────────────────────── */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    background: #fff;
    color: #000;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── soundcloud embed ─────────────────────────────────────────────────────── */
.sc-embed {
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.sc-embed iframe {
    width: 100%;
    min-height: 166px;
    display: block;
}

/* ── lightbox ─────────────────────────────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    display: block;
}
.lb-close {
    position: absolute;
    top: 16px; right: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 24px;
    cursor: pointer;
    width: auto; padding: 4px 10px;
    line-height: 1;
}
.lb-close:hover { color: #fff; }
.card-zoomable { cursor: zoom-in; }


/* ── Groups ─────────────────────────────────────────────────────────────────── */
.admins-list {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
}
.admins-label {
    margin-right: 8px;
}
.admin-link {
    color: var(--text);
    margin-right: 12px;
    text-decoration: underline;
}
.members-list {
    margin-top: 16px;
}
.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.member-item:last-child {
    border-bottom: none;
}
.member-role {
    color: var(--muted);
    font-size: 12px;
    margin-left: auto;
}

/* ── wall of comments (fixed) ─────────────────────────────────────────────── */
.wall-block {
    margin-top: 32px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.wall-form {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.wall-form textarea {
    flex: 1;
    resize: none;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.wall-form button {
    padding: 8px 16px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text);
    flex-shrink: 0;
    height: 36px;
}

.wall-form button:hover { background: rgba(255,255,255,.07); }
.wall-form button:disabled { opacity: .4; cursor: default; }
.wall-error { font-size: 11px; color: #ff7070; margin-top: 4px; }
.wall-login-hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.wall-login-hint a { text-decoration: underline; }
.wall-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }

.wall-comments { display: flex; flex-direction: column; gap: 1px; }
.wall-comment {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.wall-comment:last-child { border-bottom: none; }

.wc-avatar {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 0;
    background: rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    font-size: 11px; font-weight: 500;
    border: 1px solid var(--border);
}
.wc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wc-avatar span { color: var(--muted); }

.wc-body { flex: 1; min-width: 0; }
.wc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}
.wc-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.wc-name:hover { opacity: .7; }
.wc-time {
    font-size: 10px;
    color: var(--muted);
}
.wc-delete {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
    padding: 0 4px;
    width: auto;
    margin-left: auto;
}
.wc-delete:hover { color: #ff7070; }
.wc-text {
    font-size: 12px;
    color: rgba(255,255,255,.85);
    line-height: 1.4;
    word-break: break-word;
}
.wall-block .wall-title {
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
}

/* ── Section management ─────────────────────────────────────────────────────── */
.section-management {
    margin-bottom: 24px;
}
.add-section-panel {
    margin-top: 12px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* ── groups section on home ──────────────────────────────────────────────── */
.groups-section, .users-section {
    margin-bottom: 40px;
}
.section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
    padding-left: 4px;
}
.groups-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
}
.group-members-count {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    background: rgba(0,0,0,.7);
    color: rgba(255,255,255,.85);
    padding: 3px 8px;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Sort bar ─────────────────────────────────────────────────────────────── */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}
.sort-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 8px;
}
.sort-btn {
    font-size: 12px;
    padding: 6px 12px;
    color: var(--muted);
    border: 1px solid transparent;
    letter-spacing: 0.03em;
    transition: all .15s;
}
.sort-btn:hover {
    color: var(--text);
    opacity: 1;
}
.sort-btn.active {
    color: var(--text);
    background: rgba(255,255,255,.08);
    border-color: var(--border);
}

/* ── Section header (title + count) ────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
    padding-left: 4px;
}
.section-count {
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

/* ── Card stats overlay ────────────────────────────────────────────────────── */
.card-stats {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
    letter-spacing: 0.04em;
    font-weight: 600;
    pointer-events: none;
}
.card-stats span {
    background: rgba(0,0,0,.75);
    color: rgba(255,255,255,.9);
    padding: 3px 7px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}
/* Remove old group-members-count if still in CSS */
.group-members-count { display: none; }

/* ── Groups section (keep existing styles) ─────────────────────────────────── */
.groups-section, .users-section {
    margin-bottom: 48px;
}
.groups-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
}