/* ================================================================
   VK MONITOR · DESIGN SYSTEM v31
   Dark-first · minimal · T-Bank/VK inspired
   Полная замена. Все классы сохранены.
   ================================================================ */

/* ============ 1. ТОКЕНЫ ============ */
:root {
    /* Фон */
    --bg: #0A0B0D;
    --bg-elevated: #101114;
    --surface: #14151A;
    --surface-2: #1A1B21;
    --surface-hover: #1E1F26;

    /* Границы */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-focus: rgba(255, 255, 255, 0.28);

    /* Текст */
    --text-primary: #F5F6F8;
    --text-secondary: #8B8D96;
    --text-muted: #5B5D66;
    --text-inverse: #0A0B0D;

    /* Акцент */
    --accent: #FFFFFF;
    --accent-hover: #EDEDEF;
    --accent-soft: rgba(255, 255, 255, 0.06);

    /* Семантические цвета */
    --green: #34D399;
    --red: #F87171;
    --yellow: #FBBF24;
    --blue: #60A5FA;
    --violet: #A78BFA;
    --pink: #F472B6;
    --amber: #F59E0B;

    --green-soft: rgba(52, 211, 153, 0.12);
    --red-soft: rgba(248, 113, 113, 0.12);
    --yellow-soft: rgba(251, 191, 36, 0.12);
    --blue-soft: rgba(96, 165, 250, 0.12);
    --violet-soft: rgba(167, 139, 250, 0.12);
    --pink-soft: rgba(244, 114, 182, 0.12);
    --amber-soft: rgba(245, 158, 11, 0.12);

    /* Радиусы */
    --r-xs: 8px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-2xl: 32px;
    --r-pill: 999px;

    /* Отступы */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;
    --s-10: 40px;
    --s-12: 48px;

    /* Типографика */
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 17px;
    --fs-xl: 20px;
    --fs-2xl: 24px;
    --fs-3xl: 32px;
    --fs-4xl: 44px;

    /* Анимации */
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 320ms;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);

    /* Legacy alias (для старых мест) */
    --radius-sm: var(--r-sm);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
    --radius-xl: var(--r-xl);
    --shadow-sm: var(--shadow-sm);
    --shadow-md: var(--shadow-md);
    --speed: var(--dur);
    --speed-fast: var(--dur-fast);
    --speed-slow: var(--dur-slow);
}

body.light-theme {
    --bg: #F6F7F9;
    --bg-elevated: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F2F3F5;
    --surface-hover: #EAEBEE;

    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.12);
    --border-focus: rgba(0, 0, 0, 0.28);

    --text-primary: #0A0B0D;
    --text-secondary: #5B5D66;
    --text-muted: #8B8D96;
    --text-inverse: #FFFFFF;

    --accent: #0A0B0D;
    --accent-hover: #1E1F26;
    --accent-soft: rgba(0, 0, 0, 0.04);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.12);
}

/* ============ 2. БАЗА ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html, body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--fs-md);
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01", "kern" 1, "calt" 1;
    font-variant-ligatures: contextual;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    touch-action: pan-x pan-y;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: 16px; /* защита от zoom на iOS */
    color: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Скроллбар — тоньше и незаметнее */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Фокус */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* Плавный переход темы */
html.theme-transition,
html.theme-transition body,
html.theme-transition body * {
    transition: background-color var(--dur-slow) var(--ease-out),
                color var(--dur-slow) var(--ease-out),
                border-color var(--dur-slow) var(--ease-out) !important;
}

/* ============ 3. ТИПОГРАФИКА ============ */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ============ 4. LAYOUT ============ */
.container {
    max-width: 920px;
    margin: 0 auto;
    padding: calc(var(--s-4) + env(safe-area-inset-top, 0px)) var(--s-4) 96px;
}

@media (min-width: 641px) {
    .container { padding-top: var(--s-6); }
}

body.has-sidebar .container {
    padding-left: calc(var(--s-4) + 84px);
}

/* Хедер страницы */
.header { margin-bottom: var(--s-6); }
.header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}
.header p {
    color: var(--text-secondary);
    font-size: var(--fs-base);
    margin-bottom: var(--s-4);
}

/* Хлебные крошки */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 12px 0 16px;
}
.breadcrumbs a {
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--r-xs);
    transition: background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
}
.breadcrumbs a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.breadcrumbs .separator {
    opacity: 0.35;
    font-size: 11px;
}
.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============ 5. КНОПКИ ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 22px;
    height: 44px;
    font-size: var(--fs-base);
    font-weight: 600;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease-spring),
                background var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                color var(--dur) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 34px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}
.btn-small:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-expand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    margin: 10px auto 0;
    padding: 8px 16px;
    height: 36px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}
.btn-expand:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.icon-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: all var(--dur) var(--ease);
}
.icon-toggle:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.icon-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

.btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn--loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 6. SEARCH BAR ============ */
.search-sticky {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    padding: calc(12px + env(safe-area-inset-top, 0px)) 0 12px;
    margin: 0 -4px 6px;
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.page-search.is-scrolled .search-sticky {
    border-color: var(--border);
    box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}
body.light-theme .page-search.is-scrolled .search-sticky {
    box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.06);
}

.search-sticky__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.search-sticky__head h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.search-sticky__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 0 12px 0 44px;
    height: 48px;
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.search-bar:focus-within {
    background: var(--surface-2);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-bar__icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
.search-bar__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    padding: 0;
}
.search-bar__input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}
.search-bar__clear {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transform: scale(0.7);
    pointer-events: none;
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease-spring),
                background var(--dur) var(--ease);
}
.search-bar__clear.is-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.search-bar__clear:hover {
    background: var(--border-strong);
    color: var(--text-primary);
}
.search-bar.is-loading::after {
    content: '';
    position: absolute;
    right: 48px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    pointer-events: none;
}

/* ============ 7. FILTER CHIPS ============ */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0;
    margin-bottom: 10px;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 36px;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}
.filter-chip:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.filter-chip.active .filter-chip__dot { background: var(--text-inverse) !important; }

.filter-chip__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.filter-chip--save {
    background: transparent;
    border-style: dashed;
    color: var(--text-secondary);
    font-weight: 500;
}
.filter-chip--save:hover {
    border-style: solid;
    color: var(--text-primary);
}

/* Активные фильтры (чипсы-подсказки) */
.active-filters {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 4px;
}
.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    height: 30px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}
.active-filter-chip:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}
.active-filter-chip svg {
    opacity: 0.5;
    transition: opacity var(--dur-fast) var(--ease);
}
.active-filter-chip:hover svg { opacity: 1; }
.active-filter-chip--clear {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
    background: var(--red-soft);
}
.active-filter-chip--clear:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.5);
}

/* Сохранённые поиски */
.saved-searches {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 8px;
}
.saved-searches__label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.saved-search-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px 0 14px;
    height: 30px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}
.saved-search-chip:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}
.saved-search-chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    color: var(--text-muted);
    transition: all var(--dur-fast) var(--ease);
}
.saved-search-chip__x:hover {
    background: var(--red-soft);
    color: var(--red);
}

.saved-searches--vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
}
.saved-searches__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color var(--dur) var(--ease);
}
.saved-searches__row:hover { border-color: var(--border-strong); }
.saved-searches__info { flex: 1; min-width: 0; }
.saved-searches__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}
.saved-searches__params {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ 8. КАРТОЧКИ ПОСТОВ / КОММЕНТОВ ============ */
.post, .comment {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 12px;
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                transform var(--dur-fast) var(--ease);
}
.post:hover, .comment:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

/* Плотный режим */
body.dense-mode .post,
body.dense-mode .comment {
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: var(--r-md);
}
body.dense-mode .post-header,
body.dense-mode .comment-header { margin-bottom: 8px; }
body.dense-mode .text-block {
    margin: 8px 0;
    padding: 12px 44px 12px 14px;
    border-radius: var(--r-sm);
}
body.dense-mode .text-content { font-size: 14.5px; line-height: 1.55; }
body.dense-mode .photos {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 5px;
}
body.dense-mode .action-bar { padding-top: 10px; margin-top: 10px; gap: 5px; }
body.dense-mode .action-btn { padding: 0 12px; height: 32px; font-size: 12px; }
body.dense-mode .badges { margin-bottom: 8px; }

.post-header, .comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.author-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}
.author-block:empty { display: none; }
.author-name {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
a.author-name:hover { color: var(--text-secondary); }
.author-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
}
.post-date, .comment-date {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ============ 9. БЕЙДЖИ ============ */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    height: 22px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.005em;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-group,
.badge-signature {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
    font-weight: 500;
}

.badge-published {
    background: var(--green-soft);
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.22);
}
.badge-suggest {
    background: var(--yellow-soft);
    color: var(--yellow);
    border-color: rgba(251, 191, 36, 0.22);
}
.badge-scheduled {
    background: var(--violet-soft);
    color: var(--violet);
    border-color: rgba(167, 139, 250, 0.22);
}
.badge-repost {
    background: var(--blue-soft);
    color: var(--blue);
    border-color: rgba(96, 165, 250, 0.22);
}
.badge-deleted {
    background: var(--red-soft);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.22);
}

body.light-theme .badge-published { color: #059669; }
body.light-theme .badge-suggest   { color: #B45309; }
body.light-theme .badge-scheduled { color: #7C3AED; }
body.light-theme .badge-repost    { color: #0369A1; }
body.light-theme .badge-deleted   { color: #DC2626; }

/* ============ 10. TEXT-BLOCK ============ */
.text-block {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 52px 16px 18px;
    margin: 12px 0;
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease);
}
.text-block:hover { border-color: var(--border-strong); }

.text-content {
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    letter-spacing: 0.002em;
    text-rendering: optimizeLegibility;
}
.text-content.empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
}
.text-content.text-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
    max-height: calc(1.65em * 8);
}
.text-content.text-collapsed::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 48px;
    background: linear-gradient(to bottom, transparent, var(--bg-elevated));
    pointer-events: none;
}

.hashtag, .mention {
    display: inline-block;
    padding: 1px 7px;
    margin: 0 1px;
    border-radius: var(--r-xs);
    background: var(--accent-soft);
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--dur-fast) var(--ease);
}
.hashtag:hover, .mention:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

/* Кнопка копирования */
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-2px);
    padding: 0;
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                background var(--dur) var(--ease),
                color var(--dur) var(--ease),
                border-color var(--dur) var(--ease);
}
.text-block:hover .copy-btn,
.copy-btn:focus-visible {
    opacity: 1;
    transform: translateY(0);
}
.copy-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.copy-btn.copied {
    opacity: 1;
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.4);
    background: var(--green-soft);
}
@media (hover: none) {
    .copy-btn { opacity: 1; transform: none; }
}

/* ============ 11. ФОТО ============ */
.photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 14px 0;
}
.photo-item {
    aspect-ratio: 1;
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--surface-2);
    border: 1px solid var(--border);
    position: relative;
    transition: transform var(--dur) var(--ease),
                border-color var(--dur) var(--ease);
}
.photo-item:hover {
    transform: scale(1.015);
    border-color: var(--border-strong);
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out);
    background: var(--surface-2);
}
.photo-item img.loaded { opacity: 1; }

/* ============ 12. ACTION BAR ============ */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    transition: all var(--dur-fast) var(--ease);
}
.action-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.action-btn:active { transform: scale(0.96); }
.action-btn svg { flex-shrink: 0; }

.action-btn--primary {
    color: var(--text-primary);
    background: var(--surface-2);
    border-color: var(--border-strong);
}
.action-btn--primary:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

/* ============ 13. ПАГИНАЦИЯ ============ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 28px;
}
.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}
.pagination button:hover:not(:disabled):not(.active) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .dots { color: var(--text-muted); padding: 0 6px; }

/* ============ 14. СОСТОЯНИЯ ============ */
.loading, .empty {
    text-align: center;
    padding: 56px 16px;
    color: var(--text-muted);
}

.skeleton-item {
    background: linear-gradient(90deg,
        var(--surface) 0%,
        var(--surface-hover) 50%,
        var(--surface) 100%);
    background-size: 200% 100%;
    animation: skeletonShine 1.6s ease-in-out infinite;
    border-radius: var(--r-lg);
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
@keyframes skeletonShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 72px 24px;
    color: var(--text-muted);
}
.empty-state__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-elevated), var(--surface));
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.empty-state__title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.empty-state__text {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
}

/* Обновление: затемнение */
.posts.is-refreshing,
.comments.is-refreshing,
#feedWrap.is-refreshing,
.users-table-wrap.is-refreshing,
.users-cards.is-refreshing {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}

/* ============ 15. МОДАЛКИ ============ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
    cursor: zoom-out;
}
.modal.active { display: flex; }
.modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
}

/* История */
.history-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    z-index: 1100;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 16px;
    overflow-y: auto;
}
.history-modal.active { display: flex; }
.history-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 640px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalIn var(--dur-slow) var(--ease-out);
}
@keyframes modalIn {
    from {
        transform: translateY(16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.history-header h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.history-close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: all var(--dur) var(--ease);
}
.history-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.history-body {
    padding: 20px 24px 28px;
    max-height: 60vh;
    overflow-y: auto;
}
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.history-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 13.5px;
    transition: border-color var(--dur) var(--ease);
}
.history-item:hover { border-color: var(--border-strong); }
.history-date {
    color: var(--text-muted);
    font-size: 12.5px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.history-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.history-event {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.history-arrow { color: var(--text-muted); font-size: 12px; }
.history-extra { font-size: 12px; color: var(--text-muted); }
.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 0;
    font-size: 14px;
}

/* Event badges */
.event-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    height: 22px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}
.event-badge.status-published       { color: var(--green); border-color: rgba(52, 211, 153, 0.25); background: var(--green-soft); }
.event-badge.status-suggest         { color: var(--yellow); border-color: rgba(251, 191, 36, 0.25); background: var(--yellow-soft); }
.event-badge.status-scheduled       { color: var(--violet); border-color: rgba(167, 139, 250, 0.25); background: var(--violet-soft); }
.event-badge.status-repost          { color: var(--blue); border-color: rgba(96, 165, 250, 0.25); background: var(--blue-soft); }
.event-badge.status-deleted         { color: var(--red); border-color: rgba(248, 113, 113, 0.25); background: var(--red-soft); }
.event-badge.status-restored        { color: var(--green); border-color: rgba(52, 211, 153, 0.25); background: var(--green-soft); }
.event-badge.status-suggest_deleted { color: var(--red); border-color: rgba(248, 113, 113, 0.25); background: var(--red-soft); }

/* Confirm */
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.confirm-modal.active { opacity: 1; }
.confirm-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px 24px 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.94);
    transition: transform var(--dur-slow) var(--ease-spring);
}
.confirm-modal.active .confirm-dialog { transform: scale(1); }
.confirm-icon {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-primary);
    margin: 0 auto 16px;
}
.confirm-icon--danger {
    background: var(--red-soft);
    color: var(--red);
}
.confirm-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.confirm-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 22px;
}
.confirm-actions { display: flex; gap: 8px; }
.confirm-btn {
    flex: 1;
    height: 46px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}
.confirm-btn:active { transform: scale(0.97); }
.confirm-btn--cancel {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
.confirm-btn--cancel:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}
.confirm-btn--primary {
    background: var(--accent);
    color: var(--text-inverse);
}
.confirm-btn--primary:hover { background: var(--accent-hover); }
.confirm-btn--danger {
    background: var(--red-soft);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--red);
}
.confirm-btn--danger:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.5);
}

/* Command Palette */
.cp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    z-index: 1200;
    justify-content: center;
    align-items: flex-start;
    padding: 100px 16px 16px;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.cp-modal.active { display: flex; opacity: 1; }
.cp-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    width: 100%;
    max-width: 560px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: cpIn var(--dur-slow) var(--ease-out);
}
@keyframes cpIn {
    from { transform: translateY(-12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.cp-input {
    width: 100%;
    padding: 20px 24px;
    font-size: 16px;
    font-weight: 500;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    outline: none;
}
.cp-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}
.cp-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}
.cp-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
}
.cp-item:hover, .cp-item.active { background: var(--surface-hover); }
.cp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}
.cp-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.cp-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.cp-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============ 16. TOAST / NOTICE ============ */
.toast-stack {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 8px;
    z-index: 400;
    pointer-events: none;
    max-width: calc(100vw - 32px);
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    border-radius: var(--r-pill);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    max-width: 100%;
    transition: opacity var(--dur-slow) var(--ease-out),
                transform var(--dur-slow) var(--ease-out);
}
.app-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    cursor: pointer;
}
.app-toast svg { flex-shrink: 0; }
.app-toast--success { color: var(--green); border-color: rgba(52, 211, 153, 0.35); }
.app-toast--error   { color: var(--red);   border-color: rgba(248, 113, 113, 0.35); }

.toast-stack .app-toast {
    position: static;
    transform: translateY(20px);
}
.toast-stack .app-toast.visible {
    transform: translateY(0);
}

.new-items-notice {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 20px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: var(--r-pill);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    box-shadow: var(--shadow-lg);
    transition: opacity var(--dur-slow) var(--ease-out),
                transform var(--dur-slow) var(--ease-out);
    z-index: 200;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.new-items-notice.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============ 17. THEME / SCROLL-TOP ============ */
.theme-toggle,
.scroll-top {
    position: fixed;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 21, 26, 0.7);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 100;
    padding: 0;
    transition: all var(--dur) var(--ease);
}
body.light-theme .theme-toggle,
body.light-theme .scroll-top {
    background: rgba(255, 255, 255, 0.75);
}
.theme-toggle { top: 16px; right: 16px; }
.scroll-top {
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.9);
}
.scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.theme-toggle:hover,
.scroll-top:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.scroll-top:hover { transform: translateY(-2px) scale(1.02); }

/* ============ 18. SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 72px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 4px;
    z-index: 90;
}
.sidebar-logo {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    margin-bottom: 16px;
    flex-shrink: 0;
    transition: transform var(--dur) var(--ease-spring);
}
.sidebar-logo:hover { transform: scale(1.06); }
.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    width: 100%;
}
.sidebar-link {
    position: relative;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: background var(--dur) var(--ease),
                color var(--dur) var(--ease);
}
.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--text-primary);
    animation: sidebarBar var(--dur-slow) var(--ease-out);
}
@keyframes sidebarBar {
    from { height: 0; opacity: 0; }
    to { height: 20px; opacity: 1; }
}
.sidebar-link svg {
    display: block;
    pointer-events: none;
    transition: transform var(--dur) var(--ease-spring);
}
.sidebar-link:active svg { transform: scale(0.9); }

.sidebar-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}
.sidebar-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* ============ 19. BOTTOM NAV (FLOATING PILL) ============ */
.ios-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    display: none;
    align-items: stretch;
    justify-content: space-around;
    gap: 4px;
    padding: 6px;
    background: rgba(20, 21, 26, 0.72);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
body.light-theme .ios-tabbar {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}
.ios-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--r-lg);
    position: relative;
    transition: color var(--dur) var(--ease),
                transform var(--dur-fast) var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
}
.ios-tab:active { transform: scale(0.9); }
.ios-tab__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-md);
    transition: background var(--dur) var(--ease),
                color var(--dur) var(--ease);
}
.ios-tab__icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.85;
    display: block;
}
.ios-tab--active { color: var(--text-primary); }
.ios-tab--active .ios-tab__icon {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* ============ 20. APP-SHELL ============ */
.page-app {
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
}
.app-shell {
    max-width: 720px;
    margin: 0 auto;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(120px + env(safe-area-inset-bottom, 0px));
}

/* HERO */
.app-hero {
    position: relative;
    border-radius: var(--r-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 20px;
}
.app-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 100% at 100% 0%, rgba(167, 139, 250, 0.10), transparent 55%);
    pointer-events: none;
}
.app-hero__bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 60% at 0% 100%, rgba(96, 165, 250, 0.08), transparent 60%);
    pointer-events: none;
}
.app-hero__content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}
.app-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    background: linear-gradient(135deg, #2A2A30, #4A4A55);
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
body.light-theme .app-avatar {
    background: linear-gradient(135deg, #171717, #3A3A44);
}
.app-hero__info { min-width: 0; flex: 1; }
.app-hero__greeting {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}
.app-hero__info h1 {
    margin: 0 0 10px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    height: 22px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: var(--r-pill);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    letter-spacing: 0.01em;
}
.app-chip--role,
.app-chip--admin {
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}
.app-chip--admin {
    background: var(--violet-soft);
    color: var(--violet);
    border-color: rgba(167, 139, 250, 0.25);
}
.app-chip--muted {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.app-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 24px 0 14px;
}
.app-section-head:first-child { margin-top: 0; }
.app-section-head h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.app-screen {
    display: none;
    animation: appIn var(--dur-slow) var(--ease-out);
}
.app-screen--active { display: block; }
@keyframes appIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* KPI */
.app-kpi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.app-kpi__card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color var(--dur) var(--ease),
                transform var(--dur-fast) var(--ease);
}
.app-kpi__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(100% 80% at 100% 0%, rgba(96, 165, 250, 0.06), transparent 60%);
    pointer-events: none;
}
.app-kpi__card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.app-kpi__icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.app-kpi__icon--blue   { color: var(--blue);   background: var(--blue-soft);   border-color: rgba(96, 165, 250, 0.2); }
.app-kpi__icon--purple { color: var(--violet); background: var(--violet-soft); border-color: rgba(167, 139, 250, 0.2); }
.app-kpi__body { min-width: 0; flex: 1; }
.app-kpi__value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-kpi__label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
    font-weight: 600;
}

/* ROW */
.app-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all var(--dur) var(--ease);
}
.app-row:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.app-row:active { transform: translateY(0) scale(0.99); }
.app-row__icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.app-row__icon--red   { color: var(--red);   background: var(--red-soft);   border-color: rgba(248, 113, 113, 0.2); }
.app-row__icon--green { color: var(--green); background: var(--green-soft); border-color: rgba(52, 211, 153, 0.2); }
.app-row__body { flex: 1; min-width: 0; }
.app-row__title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.005em;
    line-height: 1.3;
}
.app-row__subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
}
.app-row__chev {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform var(--dur) var(--ease),
                color var(--dur) var(--ease);
}
.app-row:hover .app-row__chev {
    transform: translateX(3px);
    color: var(--text-primary);
}
.app-row--danger:hover {
    border-color: rgba(248, 113, 113, 0.3);
}

/* TILES (menu) */
.app-menu-tiles {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.app-tile {
    position: relative;
    min-height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 24px 26px;
    color: var(--text-primary);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: border-color var(--dur) var(--ease),
                background var(--dur) var(--ease),
                transform var(--dur-fast) var(--ease);
}
.app-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity var(--dur) var(--ease);
}
.app-tile:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
    transform: translateY(-2px);
}
.app-tile:hover::before { opacity: 1; }
.app-tile:active { transform: translateY(0) scale(0.99); }

.app-tile--blue::before   { background: radial-gradient(120% 100% at 100% 0%, rgba(96, 165, 250, 0.20), transparent 55%); }
.app-tile--purple::before { background: radial-gradient(120% 100% at 100% 0%, rgba(167, 139, 250, 0.20), transparent 55%); }
.app-tile--violet::before { background: radial-gradient(120% 100% at 100% 0%, rgba(139, 92, 246, 0.20), transparent 55%); }
.app-tile--green::before  { background: radial-gradient(120% 100% at 100% 0%, rgba(52, 211, 153, 0.20), transparent 55%); }
.app-tile--amber::before  { background: radial-gradient(120% 100% at 100% 0%, rgba(245, 158, 11, 0.20), transparent 55%); }
.app-tile--pink::before   { background: radial-gradient(120% 100% at 100% 0%, rgba(244, 114, 182, 0.20), transparent 55%); }
.app-tile--admin::before  { background: radial-gradient(120% 100% at 100% 0%, rgba(255, 255, 255, 0.08), transparent 55%); }

.app-tile__text {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1;
}
.app-tile__text h3 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1.1;
}
.app-tile__text p {
    font-size: 14.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.app-tile__visual {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    margin-left: 16px;
    pointer-events: none;
    opacity: 0.55;
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease-spring);
}
.app-tile:hover .app-tile__visual {
    opacity: 0.95;
    transform: scale(1.05);
}
.app-tile__visual svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* SESSIONS */
.app-sessions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.app-session {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color var(--dur) var(--ease);
}
.app-session:hover { border-color: var(--border-strong); }
.app-session--current {
    border-color: var(--border-strong);
    background: var(--surface-2);
}
.app-session__icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.app-session__main { flex: 1; min-width: 0; }
.app-session__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.app-session__badge {
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.app-session__ua,
.app-session__times {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-session__revoke {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all var(--dur) var(--ease);
}
.app-session__revoke:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
}

.app-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    margin-top: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.app-note svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--text-secondary);
}

.app-empty {
    text-align: center;
    padding: 36px 16px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}
.app-skeleton {
    height: 74px;
    border-radius: var(--r-lg);
    background: linear-gradient(90deg,
        var(--surface) 0%,
        var(--surface-hover) 50%,
        var(--surface) 100%);
    background-size: 200% 100%;
    animation: skeletonShine 1.6s ease-in-out infinite;
}

.app-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 8px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--dur) var(--ease);
}
.app-back:hover { background: var(--surface-hover); }
.app-back svg { flex-shrink: 0; }

/* ============ 21. ADMIN PANEL ============ */
.admin-quick {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.admin-quick__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 600;
    transition: all var(--dur) var(--ease);
}
.admin-quick__item:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.admin-quick__item svg { color: var(--text-secondary); }

.admin-search { margin-bottom: 12px; }
.admin-search .input-wrap { width: 100%; }
.admin-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.admin-filters::-webkit-scrollbar { display: none; }
.admin-filter {
    flex: 0 0 auto;
    padding: 0 16px;
    height: 34px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}
.admin-filter:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    border-color: var(--border-strong);
}
.admin-filter--active {
    color: var(--text-inverse);
    background: var(--accent);
    border-color: var(--accent);
}

.admin-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color var(--dur) var(--ease);
}
.admin-user:hover { border-color: var(--border-strong); }
.admin-user--banned {
    opacity: 0.65;
    border-color: rgba(248, 113, 113, 0.25);
}
.admin-user__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #2A2A30, #4A4A55);
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    letter-spacing: -0.5px;
}
body.light-theme .admin-user__avatar {
    background: linear-gradient(135deg, #171717, #3A3A44);
}
.admin-user__avatar--admin {
    background: linear-gradient(135deg, #4A2A80, #7C3AED);
}
.admin-user__main { flex: 1; min-width: 0; }
.admin-user__name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.admin-user__tag {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-user__tag--admin {
    color: var(--violet);
    background: var(--violet-soft);
    border-color: rgba(167, 139, 250, 0.25);
}
.admin-user__tag--banned {
    color: var(--red);
    background: var(--red-soft);
    border-color: rgba(248, 113, 113, 0.3);
}
.admin-user__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-user__vk {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--text-secondary);
}
.admin-user__time {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.admin-user__actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-user__btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    transition: all var(--dur-fast) var(--ease);
}
.admin-user__btn:active { transform: scale(0.94); }
.admin-user__btn--primary:hover,
.admin-user__btn--warn:hover,
.admin-user__btn--ok:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.admin-user__btn--danger:hover {
    background: var(--red-soft);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--red);
}

/* ============ 22. PROFILE ============ */
.page-profile {
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
}
.profile-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(80px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.profile-hero { margin-bottom: 0; }
.profile-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 0 4px;
}
.profile-breadcrumbs a {
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--r-xs);
    transition: all var(--dur-fast) var(--ease);
}
.profile-breadcrumbs a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.profile-breadcrumbs .separator { opacity: 0.35; }

.profile-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.profile-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    height: 42px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--r-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab--active {
    background: var(--surface-2);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ============ 23. USERS TABLE ============ */
.users-table-wrap { display: block; }
.users-cards { display: none; }

.users-table {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
.users-table thead th {
    text-align: left;
    padding: 14px 18px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease);
}
.users-table thead th:hover { color: var(--text-primary); }
.users-table thead th .sort-arrow {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}
.users-table thead th.sorted { color: var(--text-primary); }
.users-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--dur-fast) var(--ease);
}
.users-table tbody tr:last-child { border-bottom: none; }
.users-table tbody tr:hover { background: var(--surface-2); }
.users-table tbody td {
    padding: 14px 18px;
    color: var(--text-primary);
    vertical-align: middle;
}
.users-table .num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-secondary);
    font-weight: 600;
}
.users-table .vk-id {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12.5px;
    color: var(--text-muted);
}
.users-table .name-cell a {
    font-weight: 600;
    color: var(--text-primary);
}
.users-table .name-cell a:hover { color: var(--text-secondary); }
.users-table .screen {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-left: 6px;
}

.user-card {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 16px;
    margin-bottom: 10px;
    gap: 14px;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--dur) var(--ease);
}
.user-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
}
.user-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #2A2A30, #4A4A55);
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
}
body.light-theme .user-card__avatar {
    background: linear-gradient(135deg, #171717, #3A3A44);
}
.user-card__main { flex: 1; min-width: 0; }
.user-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-card__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.user-card__vk {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.user-card__badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: var(--r-pill);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* ============ 24. GROUPS ============ */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all var(--dur) var(--ease);
}
.group-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}
.group-card-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.group-card-id {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: var(--text-muted);
}
.group-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.group-card-stat { text-align: center; }
.group-card-stat .val {
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.group-card-stat .lbl {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
    font-weight: 600;
}
.group-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

/* ============ 25. FEED ============ */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom,
        transparent,
        var(--border) 10%,
        var(--border) 90%,
        transparent);
}
.timeline__group-title {
    position: relative;
    margin: 28px 0 14px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.timeline__group-title::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 3px var(--bg-secondary);
}

.feed-item {
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 8px;
    transition: all var(--dur) var(--ease);
}
.feed-item:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}
.feed-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.feed-icon.kind-post    { color: var(--blue);   background: var(--blue-soft);   border-color: rgba(96, 165, 250, 0.2); }
.feed-icon.kind-comment { color: var(--violet); background: var(--violet-soft); border-color: rgba(167, 139, 250, 0.2); }
.feed-icon.kind-user    { color: var(--green);  background: var(--green-soft);  border-color: rgba(52, 211, 153, 0.2); }

.feed-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.feed-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.feed-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.feed-title a {
    color: var(--text-primary);
    font-weight: 600;
}
.feed-title a:hover { color: var(--text-secondary); }
.feed-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.feed-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============ 26. INPUT / FORM ============ */
.input-wrap {
    position: relative;
    flex: 1 1 200px;
    display: flex;
    align-items: center;
}
.input-wrap svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}
.input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-size: 14.5px;
    outline: none;
    transition: all var(--dur) var(--ease);
}
.input-wrap input::placeholder { color: var(--text-muted); }
.input-wrap input:focus {
    background: var(--surface-2);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

select {
    padding: 12px 14px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-size: 14.5px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease);
}
select:focus { border-color: var(--border-focus); }

/* ============ 27. AUTH / LOGIN ============ */
.page-auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}
.page-auth::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.10), transparent 60%);
    pointer-events: none;
}
.auth-wrap { width: 100%; max-width: 440px; position: relative; }
.auth-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2xl);
    padding: 36px 32px 32px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-strong), transparent);
}
.auth-screen {
    display: none;
    animation: authIn var(--dur-slow) var(--ease-out);
}
.auth-screen--active { display: block; }
@keyframes authIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-illustration {
    width: 100%;
    max-width: 220px;
    margin: 0 auto 20px;
    aspect-ratio: 320 / 260;
}
.auth-illustration svg { display: block; width: 100%; height: 100%; }

.auth-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.auth-subtitle {
    font-size: 14.5px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 28px;
}
.auth-subtitle a {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 3px;
}

.auth-cta {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-inverse);
    background: var(--accent);
    border: none;
    border-radius: var(--r-lg);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: all var(--dur) var(--ease);
}
.auth-cta:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.auth-cta:active { transform: translateY(0) scale(0.99); }

.auth-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 26px;
}
.auth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: all var(--dur) var(--ease);
}
.auth-dot--active {
    background: var(--text-primary);
    transform: scale(1.3);
}

.auth-code-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.auth-code-head__label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.auth-code-head__timer {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}
.auth-code-head__timer--low {
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
    background: var(--red-soft);
}

.auth-code {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 26px 16px 18px;
    background: var(--bg-elevated);
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-xl);
    cursor: pointer;
    margin-bottom: 22px;
    transition: all var(--dur) var(--ease);
}
.auth-code:hover {
    background: var(--surface-hover);
    border-color: var(--text-primary);
}
.auth-code--copied {
    border-color: var(--green);
    border-style: solid;
    background: var(--green-soft);
}
.auth-code__text {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 12px;
    color: var(--text-primary);
    text-indent: 12px;
    user-select: all;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.auth-code__hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.auth-instruction {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    margin-bottom: 18px;
}
.auth-instruction__step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.auth-instruction__num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
}

.auth-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
    padding: 14px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 14px;
}
.auth-status--ok {
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.3);
    background: var(--green-soft);
}
.auth-status__pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-primary);
    animation: authPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
.auth-status__pulse--ok  { background: var(--green); animation: none; }
.auth-status__pulse--err { background: var(--red);   animation: none; }
@keyframes authPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.5); opacity: 0.4; }
}
.auth-link {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: color var(--dur) var(--ease);
}
.auth-link:hover { color: var(--text-primary); }

@media (max-width: 480px) {
    .auth-card { padding: 28px 22px 24px; border-radius: var(--r-xl); }
    .auth-title { font-size: 22px; }
    .auth-code__text { font-size: 36px; letter-spacing: 9px; text-indent: 9px; }
    .auth-illustration { max-width: 180px; }
}

/* ============ 28. НАСТРОЙКИ ============ */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 4px;
    margin-bottom: 16px;
    overflow: hidden;
}
.settings-section__title {
    padding: 14px 16px 10px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.settings-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-top: 1px solid var(--border);
}
.settings-row:first-of-type { border-top: none; }
.settings-row__body { flex: 1; min-width: 0; }
.settings-row__title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}
.settings-row__subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.45;
}
.settings-hint {
    padding: 14px 18px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Switch */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
    pointer-events: none;
}
.switch__track {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    background: var(--border-strong);
    border-radius: 999px;
    transition: background var(--dur) var(--ease);
}
.switch__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform var(--dur) var(--ease-spring);
}
.switch input:checked + .switch__track {
    background: var(--accent);
}
.switch input:checked + .switch__track .switch__thumb {
    transform: translateX(20px);
    background: var(--text-inverse);
}
body.light-theme .switch input:checked + .switch__track .switch__thumb {
    background: #fff;
}
.switch input:focus-visible + .switch__track {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
}

/* ============ 29. PROGRESS / CHART ============ */
.progress-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.progress-row__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
}
.progress-row__name {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.progress-row__name a { color: inherit; }
.progress-row__name a:hover { color: var(--text-secondary); }
.progress-row__count {
    color: var(--text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.progress-row__bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-row__fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 999px;
    transition: width 0.5s var(--ease-out);
}

.chart-bar {
    background: linear-gradient(to top, #4A4A55, #8B8D96);
    border-radius: 6px 6px 2px 2px;
}
body.light-theme .chart-bar {
    background: linear-gradient(to top, #B0B1B8, #5B5D66);
}
.chart-bar:hover { filter: brightness(1.2); }

/* ============ 30. INSTALL BANNER ============ */
.install-banner {
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    z-index: 95;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 16px 44px 16px 18px;
    box-shadow: var(--shadow-lg);
    animation: slideUp var(--dur-slow) var(--ease-out);
}
@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.install-banner__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all var(--dur) var(--ease);
}
.install-banner__close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.install-banner__content {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.install-banner__icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.install-banner__title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.install-banner__text {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.install-banner__text b {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============ 31. ДАШБОРД ============ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    overflow: hidden;
    transition: all var(--dur) var(--ease);
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(100% 80% at 100% 0%, rgba(255, 255, 255, 0.03), transparent 60%);
    pointer-events: none;
}
.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.stat-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    font-weight: 700;
}
.stat-value {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-change {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
    font-weight: 500;
}
.stat-change.positive { color: var(--green); }

.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    margin-bottom: 24px;
}
.chart-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
    color: var(--text-primary);
}
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 160px;
    padding-top: 24px;
}
.chart-bar {
    flex: 1;
    border-radius: 6px 6px 2px 2px;
    min-height: 3px;
    position: relative;
    cursor: default;
    transition: transform var(--dur) var(--ease),
                filter var(--dur) var(--ease);
}
.chart-bar:hover {
    transform: translateY(-3px);
    filter: brightness(1.2);
}
.chart-bar__value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}
.chart-bar:hover::after {
    content: attr(data-value);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: var(--r-sm);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    margin-bottom: 6px;
    z-index: 5;
    box-shadow: var(--shadow-md);
}

.two-cols-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .two-cols-grid { grid-template-columns: 1fr; }
    .chart-bars { gap: 2px; }
    .chart-bar__value { display: none; }
}

/* ============ 32. REDUCE MOTION ============ */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ============ 33. МОБИЛЬНАЯ АДАПТАЦИЯ ============ */
@media (max-width: 640px) {
    body.has-sidebar .container {
        padding-left: 14px;
        padding-right: 14px;
        max-width: 100%;
        margin-left: 0;
    }
    .container {
        padding-left: 14px;
        padding-right: 14px;
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    }
    .header { margin-bottom: 20px; }
    .header h1 { font-size: 24px; }
    .header p { font-size: 13.5px; }
    .breadcrumbs { font-size: 12.5px; margin-top: 12px; }
    .search-sticky__head h1 { font-size: 22px; }

    .post, .comment { padding: 16px; border-radius: var(--r-lg); margin-bottom: 10px; }
    .author-name { font-size: 15px; }
    .text-block { padding: 14px 48px 14px 16px; margin: 12px 0; }
    .copy-btn { width: 40px; height: 40px; top: 8px; right: 8px; }

    .filter-chip { padding: 0 18px; height: 40px; font-size: 14px; }
    .action-btn { padding: 0 14px; height: 44px; font-size: 14px; border-radius: var(--r-md); }
    .action-bar { gap: 8px; margin-top: 14px; padding-top: 14px; }
    .btn { padding: 0 24px; height: 48px; font-size: 15px; border-radius: var(--r-md); }
    .btn-small { padding: 0 16px; height: 40px; font-size: 14px; }
    .btn-expand { padding: 10px 20px; height: 42px; font-size: 14px; }
    .admin-filter { padding: 0 18px; height: 42px; font-size: 14px; }

    .photos {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 6px;
    }
    .pagination { gap: 6px; margin-top: 22px; }
    .pagination button {
        min-width: 44px;
        height: 44px;
        padding: 0 14px;
        font-size: 15px;
    }

    .history-modal { padding: 20px 12px; }
    .history-dialog { border-radius: var(--r-xl); }
    .history-header { padding: 16px 18px; }
    .history-close { width: 40px; height: 40px; }
    .history-body { padding: 16px 18px 22px; }
    .history-item { grid-template-columns: 1fr; gap: 8px; padding: 14px; }

    .groups-grid { grid-template-columns: 1fr; gap: 10px; }
    .group-card { padding: 16px; }

    .timeline { padding-left: 20px; }
    .timeline::before { left: 6px; }
    .timeline__group-title::before { left: -18px; width: 8px; height: 8px; }
    .timeline .feed-item { grid-template-columns: 40px 1fr; padding: 14px; }
    .feed-icon { width: 40px; height: 40px; }

    .users-table-wrap { display: none; }
    .user-card { display: flex; }
    .users-cards { display: block; }

    .scroll-top {
        width: 48px;
        height: 48px;
        right: 16px;
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }
    .theme-toggle {
        width: 38px;
        height: 38px;
        top: 12px;
        right: 12px;
    }

    .cp-modal { padding: 60px 12px 12px; }
    .cp-input { padding: 18px 20px; font-size: 16px; }
    .cp-item { padding: 14px 12px; min-height: 52px; }

    .modal { padding: 0; }
    .modal img { max-height: 100vh; max-width: 100vw; border-radius: 0; }

    .sidebar { display: none !important; }
    .ios-tabbar { display: flex; }
    body.has-ios-tabbar {
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }
    body.has-ios-tabbar .app-shell,
    body.has-ios-tabbar .container {
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    }

    .app-menu-tiles { gap: 12px; }
    .app-tile {
        min-height: 148px;
        padding: 22px 24px;
        border-radius: var(--r-xl);
        gap: 16px;
    }
    .app-tile__text h3 { font-size: 22px; letter-spacing: -0.05em; }
    .app-tile__text p { font-size: 14px; }
    .app-tile__visual { width: 92px; height: 92px; margin-left: 8px; }

    .app-hero__content { padding: 20px 18px; gap: 14px; }
    .app-avatar { width: 56px; height: 56px; font-size: 19px; }
    .app-hero__info h1 { font-size: 18px; }

    .app-kpi__value { font-size: 24px; }
    .app-kpi__card { padding: 16px; }
    .app-section-head h2 { font-size: 17px; }

    .settings-section { border-radius: var(--r-lg); }
    .settings-row { padding: 14px; }
    .toast-stack { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
    .new-items-notice { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
    /* на мобилке можно чуть-чуть пружиннее */
}

/* ============ 34. SEARCH PAGE FIX ============ */
@media (max-width: 640px) {
    .page-search .header { display: none; }
    .page-search .filter-chips { margin-bottom: 6px; }
    .page-search .filter-chips + .filter-chips { margin-top: -2px; }
}

/* ============ 35. ПЕЧАТЬ ============ */
@media print {
    .sidebar, .ios-tabbar, .theme-toggle, .scroll-top,
    .action-bar, .copy-btn, .toast-stack, .install-banner {
        display: none !important;
    }
    body { background: #fff; color: #000; }
    .post, .comment {
        border: 1px solid #ddd;
        break-inside: avoid;
        background: #fff;
    }
    .text-content { color: #000; }
}

/* ================================================================
   АВАТАРКИ v32
   ================================================================ */
.avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #2A2A30, #4A4A55);
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    overflow: hidden;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
body.light-theme .avatar {
    background: linear-gradient(135deg, #171717, #3A3A44);
    border-color: rgba(0, 0, 0, 0.06);
}
.avatar__initials { position: relative; z-index: 0; line-height: 1; }
.avatar--img { background: var(--surface-2, #1A1B21); }
.avatar--img img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    z-index: 1;
    background: var(--surface-2, #1A1B21);
}
.avatar--fallback {
    background: linear-gradient(135deg, #2A2A30, #4A4A55) !important;
}
body.light-theme .avatar--fallback {
    background: linear-gradient(135deg, #171717, #3A3A44) !important;
}

.app-avatar.avatar {
    width: 64px; height: 64px;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.post-avatar {
    width: 36px; height: 36px;
    font-size: 13px;
    border-radius: 12px;
}
.post-avatar.avatar--img img { border-radius: 12px; }

.post-header .author-block,
.comment-header .author-block {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.author-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.author-text .author-name { font-size: 15px; line-height: 1.2; }
.author-text .author-id { font-size: 11.5px; line-height: 1.2; }

.user-card__avatar.avatar { width: 48px; height: 48px; font-size: 16px; }
.admin-user__avatar.avatar { width: 42px; height: 42px; font-size: 14px; }
.admin-user__avatar--admin.avatar {
    background: linear-gradient(135deg, #4A2A80, #7C3AED);
}

body.dense-mode .post-avatar {
    width: 30px; height: 30px;
    font-size: 11px;
    border-radius: 10px;
}
body.dense-mode .post-header .author-block,
body.dense-mode .comment-header .author-block { gap: 10px; }
body.dense-mode .author-text .author-name { font-size: 14px; }

@media (max-width: 640px) {
    .app-avatar.avatar { width: 56px; height: 56px; font-size: 19px; }
    .post-avatar {
        width: 34px; height: 34px;
        font-size: 12px;
        border-radius: 11px;
    }
    .post-header .author-block,
    .comment-header .author-block { gap: 10px; }
}

/* ============ KEYWORD ROWS ============ */
.kw-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 6px;
}
.kw-row__text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kw-row__del {
    width: 30px; height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: all var(--dur) var(--ease);
}
.kw-row__del:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
}

/* ============ KEYWORD TAG-INPUT v33 ============ */
.kw-editor-wrap {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
}

.kw-editor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 52px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    cursor: text;
    transition: border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease),
                background var(--dur) var(--ease);
}
.kw-editor:focus-within {
    background: var(--surface-2);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.kw-editor__chips {
    display: contents;
}

.kw-editor__input {
    flex: 1 1 140px;
    min-width: 140px;
    height: 32px;
    padding: 0 4px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}
.kw-editor__input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Чипс */
.kw-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 6px 0 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid rgba(52, 211, 153, 0.30);
    border-radius: var(--r-pill);
    white-space: nowrap;
    max-width: 100%;
    transition: background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease-spring);
    animation: kwIn var(--dur) var(--ease-out);
}
.kw-chip:hover {
    background: rgba(52, 211, 153, 0.20);
    border-color: rgba(52, 211, 153, 0.5);
}
.kw-chip:active { transform: scale(0.97); }

.kw-chip__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.kw-chip__x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--green);
    opacity: 0.7;
    cursor: pointer;
    transition: opacity var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
}
.kw-chip__x:hover {
    opacity: 1;
    background: rgba(52, 211, 153, 0.25);
    color: #a7f3d0;
}

@keyframes kwIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
    .kw-chip { height: 28px; font-size: 12.5px; padding-left: 10px; }
    .kw-chip__text { max-width: 140px; }
    .kw-editor__input { font-size: 16px; }
    .kw-editor { padding: 7px 8px; min-height: 48px; }
}