/* ============================================================
   КРОК — Дизайн-система v3
   ============================================================ */

:root {
    /* === Фоны — 4 чётких уровня, заметный шаг между ними === */
    --bg-base:       #0d1117;
    --bg-surface:    #161b22;
    --bg-elevated:   #21262d;
    --bg-hover:      #2a313b;

    /* === Бордеры — видимые в тёмной теме === */
    --border:        #30363d;
    --border-light:  #3d444d;

    /* === Текст === */
    --text-primary:  #e6edf3;
    --text-secondary:#8b949e;
    --text-muted:    #484f58;

    /* === Акцент === */
    --accent:        #388bfd;
    --accent-hover:  #58a6ff;
    --accent-dim:    rgba(56,139,253,0.12);

    /* === Состояния === */
    --warning:       #d29922;
    --danger:        #f85149;
    --success:       #2ea043;

    /* === Геометрия === */
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     14px;

    /* === Тени (для тёмной темы) === */
    --shadow:        0 1px 3px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.6), 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.7), 0 4px 12px rgba(0,0,0,0.5);

    /* === Фон для инпутов (тёмная: утоплен глубже) === */
    --input-bg:      #0d1117;
    --input-border:  var(--border);

    /* === Внутреннее свечение карточек === */
    --card-glow:     inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="light"] {
    --bg-base:       #f0f2f5;
    --bg-surface:    #ffffff;
    --bg-elevated:   #f6f8fa;
    --bg-hover:      #eaecf0;

    --border:        #c8d0da;
    --border-light:  #dde2e8;

    --text-primary:  #1a1f2e;
    --text-secondary:#4b5568;
    --text-muted:    #8c95a3;

    --accent:        #1a6ed8;
    --accent-hover:  #1455b5;
    --accent-dim:    rgba(26,110,216,0.08);

    --warning:       #9a6700;
    --danger:        #cf222e;
    --success:       #116329;

    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.03);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07);

    /* Инпуты в светлой — белые на сером фоне страницы */
    --input-bg:      #ffffff;
    --input-border:  #c8d0da;

    --card-glow:     none;
}

/* ============================================================
   БАЗА
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

/* ============================================================
   НАВБАР
   ============================================================ */
.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 54px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(22, 27, 34, 0.92);
}

[data-theme="light"] .navbar {
    background: rgba(255,255,255,0.92);
}

.navbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-right: 16px;
    flex-shrink: 0;
}
.navbar-brand span { color: var(--accent); }

.nav-links { display: flex; gap: 2px; flex: 1; }

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.user-menu { position: relative; }
.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-primary);
}
.user-trigger:hover { background: var(--bg-hover); }

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.user-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 190px;
    box-shadow: var(--shadow-md);
    display: none;
    animation: dropIn 0.15s ease-out;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-menu.open { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}
.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(248,81,73,0.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9px;
}

.theme-toggle {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-size: 0.9rem;
}
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
    line-height: 1.4;
    text-decoration: none;
    user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 0 2px 8px rgba(56,139,253,0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background: rgba(248,81,73,0.1); }

.btn-sm    { padding: 4px 10px; font-size: 0.8rem; }
.btn-full  { width: 100%; justify-content: center; }

/* ============================================================
   ФОРМЫ
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.5;
}

/* ============================================================
   КАРТОЧКИ
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.card-body { padding: 18px; }

/* ============================================================
   АЛЕРТЫ
   ============================================================ */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-error   { background: rgba(248,81,73,0.08); border-color: rgba(248,81,73,0.3); color: var(--danger); }
.alert-success { background: rgba(46,160,67,0.08); border-color: rgba(46,160,67,0.3); color: var(--success); }
.alert-info    { background: var(--accent-dim); border-color: rgba(56,139,253,0.3); color: var(--accent); }

/* ============================================================
   LAYOUT
   ============================================================ */
.page-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px;
}
.main-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .main-grid { grid-template-columns: 1fr; }
    .chat-sidebar { display: none; }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
}

/* ============================================================
   ГЛАВНАЯ — ГАЗЕТНАЯ ВЁРСТКА
   ============================================================ */
.news-hero {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-surface);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: var(--shadow);
}
.news-hero:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.news-hero__img-wrap {
    float: left;
    width: auto;
    max-width: 420px;
    height: auto;
    overflow: visible;
    margin: 0 20px 16px 0;
}
.news-hero__img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    object-position: top center;
    height: auto;
    display: block;
}
.news-hero__body { padding: 20px 22px; overflow: hidden; }
.news-hero::after { content: ''; display: table; clear: both; }
.news-hero__no-img { width: 100%; height: 120px; background: var(--bg-elevated); }

.news-hero__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 10px;
}
.news-hero__title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.2px;
}
.news-hero__excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 14px;
}

.news-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 600px) { .news-row-2 { grid-template-columns: 1fr; } }

.news-card-md {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}
.news-card-md:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.news-card-md__img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.news-card-md__no-img { width: 100%; height: 60px; background: var(--bg-elevated); }
.news-card-md__body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.news-card-md__title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.news-card-md__excerpt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-compact-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow);
}
.news-compact-list__header {
    padding: 10px 16px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.news-compact-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.news-compact-item:last-child { border-bottom: none; }
.news-compact-item:hover { background: var(--bg-hover); }
.news-compact-item__title {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
}
.news-compact-item:hover .news-compact-item__title { color: var(--accent); }
.news-compact-item__date {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.news-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.news-read-more { color: var(--accent); font-weight: 500; }

/* News modal */
#news-modal-img img {
    float: left;
    max-width: 340px;
    width: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin: 0 20px 16px 0;
}
#news-modal-content { overflow: hidden; }
#news-modal-img { display: block; }
.modal-body::after { content: ''; display: table; clear: both; }

/* ============================================================
   МИКРОФОН
   ============================================================ */
.mic-list { display: flex; flex-direction: column; gap: 12px; }

.mic-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}
.mic-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.mic-card__author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.mic-card__title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
    text-decoration: none;
    transition: color 0.15s;
    letter-spacing: -0.1px;
}
.mic-card__title:hover { color: var(--accent); }
.mic-card__excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mic-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.mic-reactions { display: flex; gap: 4px; flex-wrap: wrap; }
.mic-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    line-height: 1;
}
.mic-react-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: scale(1.06);
}
.mic-react-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-dim);
}
.mic-react-btn__icon { font-size: 1rem; line-height: 1; }
.mic-react-btn__count { font-weight: 600; min-width: 12px; }

.post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.post-author { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.post-date   { font-size: 0.75rem; color: var(--text-muted); }
.post-stars  { color: var(--warning); font-size: 0.85rem; letter-spacing: 1px; }

.post-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tag {
    padding: 2px 9px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
}
.tag:hover, .tag.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================================
   БИБЛИОТЕКА
   ============================================================ */
.lib-mode-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lib-mode-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.lib-mode-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.alpha-btn--current {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}

.lib-letter-section { margin-bottom: 32px; scroll-margin-top: 70px; }

.lib-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}
.lib-row { border-bottom: 1px solid var(--border); }
.lib-row:last-child { border-bottom: none; }
.lib-row--open { background: var(--bg-elevated); }

.lib-row__main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.lib-row__main:hover { background: var(--bg-hover); }
.lib-row--open .lib-row__main { background: var(--bg-elevated); }

.lib-row__toggle {
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 18px;
    transition: color 0.15s, transform 0.2s;
}
.lib-row--open .lib-row__toggle {
    color: var(--accent);
    transform: rotate(90deg);
}

.lib-row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.lib-row__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.lib-row__author { font-size: 0.76rem; color: var(--accent); flex-shrink: 0; }
.lib-row__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lib-row__download {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.lib-row__download:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}
.lib-row__edit {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.lib-row__edit:hover { color: var(--accent); background: var(--bg-elevated); }

.lib-card-expand {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}
.lib-card-expand__inner {
    display: flex;
    gap: 16px;
    padding: 14px 16px 14px 38px;
    align-items: flex-start;
}
.lib-expand__cover {
    width: 60px;
    height: 86px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 2px 4px 8px rgba(0,0,0,0.4);
}
.lib-expand__cover-placeholder {
    width: 60px;
    height: 86px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 800;
    color: rgba(255,255,255,0.85);
    background: linear-gradient(160deg, #1e3a5f 0%, #0d1f36 100%);
    box-shadow: 2px 4px 8px rgba(0,0,0,0.4);
    border-left: 3px solid var(--accent);
}
.lib-expand__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lib-expand__desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.65;
}
.lib-expand__category { font-style: italic; }

.lib-expand__reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    line-height: 1;
}
.lib-react-btn:hover { background: var(--bg-hover); transform: scale(1.05); }
.lib-react-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.lib-react-btn__count { font-weight: 600; min-width: 8px; }

/* Star rating */
.lib-stars {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}
.lib-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--border-light);
    padding: 0 2px;
    line-height: 1;
    transition: color 0.1s, transform 0.1s;
}
.lib-star--on { color: var(--warning); }
.lib-star:not(:disabled):hover { color: var(--warning); transform: scale(1.2); }
.lib-star:disabled { cursor: default; }
.lib-stars:hover .lib-star:not(:disabled) { color: var(--warning); }
.lib-stars .lib-star:not(:disabled):hover ~ .lib-star:not(:disabled) { color: var(--border-light); }
.lib-stars__avg {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--warning);
    margin-left: 6px;
    min-width: 20px;
    transition: opacity 0.2s;
}

/* ============================================================
   РЕПУТАЦИЯ
   ============================================================ */
.rep-tab {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-decoration: none;
    display: inline-block;
    margin-bottom: -1px;
}
.rep-tab:hover { color: var(--text-primary); }
.rep-tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.alpha-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.alpha-btn--active {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--accent);
}
.alpha-btn--active:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}
.alpha-btn--empty {
    color: var(--text-muted);
    cursor: default;
    border: 1px solid transparent;
}

.letter-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    padding: 6px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 1px;
}

.person-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.person-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.person-item:last-child { border-bottom: none; }
.person-item:hover { background: var(--bg-hover); }

.person-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.person-photo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.person-name  { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.person-role  { font-size: 0.78rem; color: var(--text-secondary); }
.person-arrow { margin-left: auto; color: var(--text-muted); }

/* ============================================================
   ЛИЧНЫЕ СООБЩЕНИЯ
   ============================================================ */
.inbox-list { display: flex; flex-direction: column; gap: 2px; }
.inbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item.unread { background: var(--accent-dim); }
.inbox-preview { font-size: 0.82rem; color: var(--text-secondary); }
.inbox-time { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

.conversation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dm-msg {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
}
.dm-msg.mine {
    background: var(--accent);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.dm-msg.theirs {
    background: var(--bg-elevated);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}
.dm-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.conversation-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

/* ============================================================
   МОДАЛЬНЫЕ ОКНА
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.1px; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================================
   ПОИСК И ФИЛЬТРЫ
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.search-input {
    flex: 1;
    min-width: 200px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ============================================================
   АУТЕНТИФИКАЦИЯ
   ============================================================ */
.auth-wrap {
    min-height: calc(100vh - 54px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.auth-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    background: var(--bg-elevated);
}
.auth-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}
.auth-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.auth-body  { padding: 24px 28px; }
.auth-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
}

/* ============================================================
   ПУСТЫЕ СОСТОЯНИЯ
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 14px;
    opacity: 0.35;
    display: block;
}
.empty-state-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================================
   ВИДЕО
   ============================================================ */
.video-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    margin-bottom: 16px;
}
.video-preview__thumb {
    width: 100%;
    display: block;
    max-height: 360px;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.video-preview:hover .video-preview__thumb { opacity: 0.65; }
.video-preview__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-preview__play {
    width: 64px;
    height: 64px;
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    transition: background 0.2s, transform 0.2s, border-color 0.2s;
    padding-left: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.video-preview:hover .video-preview__play {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}
.video-preview--no-thumb {
    padding: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    text-align: center;
}
.video-preview__play-text { font-size: 1rem; font-weight: 600; color: var(--accent); }

.video-iframe-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    background: #000;
}
.video-iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ============================================================
   ПОМОЩЬ
   ============================================================ */
.help-cat-btn {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-cat-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.help-cat-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.help-section { margin-bottom: 32px; }
.help-section__title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.help-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: var(--shadow);
}
.help-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.help-card__header { display: flex; flex-direction: column; gap: 3px; }
.help-card__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.help-card__location { font-size: 0.75rem; color: var(--text-muted); }
.help-card__desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.help-card__video { border-radius: var(--radius-sm); overflow: hidden; }
.help-card__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.help-card__link--primary {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s;
}
.help-card__link--primary:hover { color: var(--accent-hover); }
.help-card__contact { font-size: 0.78rem; color: var(--text-secondary); }

.help-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 860px) {
    .help-layout { grid-template-columns: 1fr; }
    .help-layout__aside { order: -1; }
}
.help-layout__main { display: flex; flex-direction: column; gap: 16px; }
.help-layout__aside {
    position: sticky;
    top: 70px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.help-layout__aside::-webkit-scrollbar { width: 4px; }
.help-layout__aside::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.help-aside-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.help-aside-section { margin-bottom: 16px; }
.help-aside-cat {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-top: 4px;
}
.help-aside-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}
.help-aside-card:hover { border-color: var(--border-light); }
.help-aside-card__name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}
.help-aside-card__desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.help-block {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    transition: border-color 0.15s;
    box-shadow: var(--shadow);
}
.help-block__type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.help-block__type--urgent      { background: rgba(248,81,73,0.12); border: 1px solid rgba(248,81,73,0.3); color: var(--danger); }
.help-block__type--instruction { background: rgba(56,139,253,0.12); border: 1px solid rgba(56,139,253,0.3); color: var(--accent); }
.help-block__type--info        { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); }
.help-block__type--report      { background: rgba(210,153,34,0.12); border: 1px solid rgba(210,153,34,0.3); color: var(--warning); }

.help-block__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 14px;
    letter-spacing: -0.2px;
}
.help-block__media-wrap {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 14px;
}
@media (max-width: 600px) { .help-block__media-wrap { grid-template-columns: 1fr; } }
.help-block__img-side {
    width: 100%;
    max-width: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}
.help-block__img-full {
    display: block;
    max-width: 480px;
    max-height: 320px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}
.help-block__content {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 14px;
}
.help-block__video { margin-bottom: 14px; border-radius: var(--radius-sm); overflow: hidden; }
.help-block__file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 4px;
}
.help-block__file:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent    { color: var(--accent); }
.text-danger    { color: var(--danger); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-sm  { font-size: 0.82rem; }
.text-xs  { font-size: 0.72rem; }
.fw-600   { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-1  { gap: 8px; }
.gap-2  { gap: 16px; }
.ml-auto { margin-left: auto; }
.w-full  { width: 100%; }

.help-block__type--video { background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.3); color: #a78bfa; }
