:root {
    --bg: #14181c;
    --bg-panel: #1d2328;
    --bg-element: #263038;
    --bg-element-hover: #2e3a45;
    --text: #eef1f4;
    --text-muted: #8a97a5;
    --border: #2e3a45;
    --accent: #00c186;
    --accent-text: #062019;
    --ok: #26d07c;
    --want: #4f9cf7;
    --watching: #f7b731;
    --error: #f5587a;
    --radius: 10px;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Шапка */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(29, 35, 40, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 4px 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

main { padding: 24px 0 48px; }

/* Заголовки страниц */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-head h1 { margin: 0; }

/* Группа кнопок действий в шапке страницы */
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

h1 { font-size: 1.5rem; margin: 0 0 16px; }

/* Кнопки */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-element);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    text-align: center;
}

.btn:hover { background: var(--bg-element-hover); color: var(--accent); }

.btn-accent {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
}

.btn-accent:hover { background: var(--ok); color: var(--accent-text); }

button {
    padding: 8px 16px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.15s;
}

button:hover { opacity: 0.88; }

.link-btn {
    background: none;
    color: var(--text-muted);
    padding: 0;
    font-weight: 500;
}

.link-btn:hover { color: var(--accent); opacity: 1; }

.inline { display: inline; }

/* Панель фильтров */
.filters {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 14px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filters input[type="search"],
.filters select {
    padding: 8px 12px;
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 150px;
    flex: 1 1 140px;
}

.filters select { min-width: 120px; }

/* Переключатель вида */
.view-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 18px;
}

.seg {
    padding: 8px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--bg-panel);
    transition: background 0.15s, color 0.15s;
}

.seg + .seg { border-left: 1px solid var(--border); }
.seg:hover { color: var(--text); }

.seg.active {
    background: var(--accent);
    color: var(--accent-text);
}

/* Таблица */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.table tr:last-child td { border-bottom: none; }

.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-element);
}

.table tr:hover td { background: rgba(38, 48, 56, 0.5); }

.muted { color: var(--text-muted); }
.error { color: var(--error); font-size: 0.85rem; margin: 2px 0 0; }
.help { color: var(--text-muted); font-size: 0.8rem; margin: 2px 0 0; }

/* Сообщения (flash-уведомления) */
.messages { margin-bottom: 16px; }

.message {
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-panel);
    font-size: 0.9rem;
}

.message-info { border-color: var(--want); color: var(--want); }
.message-success { border-color: var(--ok); color: var(--ok); }
.message-error { border-color: var(--error); color: var(--error); }

/* Поиск на TMDB */
.tmdb-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tmdb-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, transform 0.15s;
}

.tmdb-row:hover { border-color: var(--accent); transform: translateY(-2px); }

.tmdb-poster {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.tmdb-poster-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-element);
    color: var(--text-muted);
    font-size: 0.6rem;
    text-align: center;
}

.tmdb-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tmdb-title { font-weight: 600; }
.tmdb-overview {
    font-size: 0.8rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tmdb-cancel { margin-top: 8px; width: 100%; text-align: center; }

/* Локальные результаты на странице поиска */
.section-title {
    font-size: 1rem;
    margin: 18px 0 10px;
    color: var(--text-muted);
}

.tmdb-row--local .tmdb-title {
    color: var(--text);
    text-decoration: none;
}

.tmdb-row--local .tmdb-title:hover { color: var(--accent); }

.tmdb-row-action { margin-left: auto; flex-shrink: 0; }

.search-provider-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.filters input[type="number"] { flex: 0 1 90px; }

/* Бейджи */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok { background: rgba(38, 208, 124, 0.15); color: var(--ok); }
.badge-muted { background: var(--bg-element); color: var(--text-muted); }
.badge-deleted { background: rgba(245, 88, 122, 0.15); color: var(--error); }
.badge-want { background: rgba(79, 156, 247, 0.15); color: var(--want); }
.badge-watching { background: rgba(247, 183, 49, 0.15); color: var(--watching); }
.badge-watched { background: rgba(38, 208, 124, 0.15); color: var(--ok); }

.watched-check {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Сетка карточек */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.poster {
    position: relative;
    height: 240px;
    background: var(--bg-element);
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.poster-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.poster-badge {
    position: absolute;
    top: 8px;
    left: 8px;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.card-meta { color: var(--text-muted); font-size: 0.8rem; margin: 0; }
.card-genres { color: var(--text-muted); font-size: 0.75rem; margin: 0; }
.card-overview { font-size: 0.8rem; margin: 0; color: var(--text); }

.card-action { margin-top: auto; padding-top: 8px; }
.card-action .btn { width: 100%; }

/* Пагинация */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

/* Формы */
.form-card {
    max-width: 360px;
    margin: 0 auto;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.form-card--wide { max-width: 640px; }

.form-card h1 { text-align: center; }

.form-field {
    margin-bottom: 14px;
}

.form-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-field textarea { resize: vertical; min-height: 140px; }

.form-field ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 18px;
}

.form-field ul li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-field ul input[type="radio"] { width: auto; margin: 0; accent-color: var(--accent); }

.form-field ul label { display: inline; margin: 0; font-weight: 400; }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.form-actions .btn,
.form-actions button { flex: 1; }

.form-card > .muted { text-align: center; font-size: 0.9rem; }

@media (max-width: 1100px) {
    .cards-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 640px) {
    .header-inner { justify-content: center; }
    .page-head {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }
}

/* Вкладки (архив: просмотренные / отклонённые) */
.tabs {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
}

.tab {
    padding: 8px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--bg-panel);
    transition: background 0.15s, color 0.15s;
}

.tab + .tab { border-left: 1px solid var(--border); }
.tab:hover { color: var(--text); }

.tab.active {
    background: var(--accent);
    color: var(--accent-text);
}

/* Кнопки-действия */
.btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
}

.btn-danger:hover { opacity: 0.88; background: var(--error); color: #fff; }

.btn-danger-text { color: var(--error) !important; }

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 10px;
    align-items: center;
}

.card-actions {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-actions .btn,
.card-actions button { width: 100%; }

/* Модальное окно */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    max-width: 420px;
    width: 100%;
}

.modal h3 { margin: 0 0 8px; }
.modal p { margin: 0 0 16px; color: var(--text-muted); }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-actions .btn,
.modal-actions button { flex: 1 1 auto; }

/* Детальная страница тайтла */
.card-link { display: block; }

.detail {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.detail-backdrop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(10px) brightness(0.35);
    transform: scale(1.1);
}

.detail-main {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 24px;
    padding: 24px;
    flex-wrap: wrap;
}

.detail-poster {
    width: 220px;
    flex-shrink: 0;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-element);
    box-shadow: var(--shadow);
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-info {
    flex: 1 1 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-info h1 { margin: 0; }

.detail-meta { color: var(--text-muted); margin: 0; }
.detail-overview { margin: 10px 0 0; }
.detail-info p { margin: 0; }

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.detail-ratings {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rating {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(245, 197, 24, 0.15);
    color: #f7c531;
    font-size: 0.85rem;
    font-weight: 700;
}

.detail-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 24px 24px;
}

.detail-actions .btn,
.detail-actions button { flex: 0 1 auto; }

@media (max-width: 640px) {
    .detail-main { padding: 16px; gap: 16px; }
    .detail-poster { width: 150px; }
    .detail-actions { padding: 0 16px 16px; }
}

/* Бейдж-счётчик в навигации */
.nav-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
}

/* Постеры в таблице очереди */
.poster-cell { width: 44px; }

.table-poster {
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.table-poster-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-element);
    color: var(--text-muted);
    font-size: 1rem;
}

/* Селект статуса очереди */
.status-select {
    padding: 6px 10px;
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.status-select:hover { border-color: var(--accent); }

/* Аватары */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-element);
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-ph {
    color: var(--text);
    background: var(--accent);
    color: var(--accent-text);
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.8rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }
.avatar-nav { width: 20px; height: 20px; font-size: 0.7rem; vertical-align: middle; }

.nav .avatar { margin-right: 2px; }

/* Личный кабинет */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.profile-card {
    padding: 14px 16px;
    margin: 0;
    max-width: none;
    box-shadow: none;
}

.profile-card h2 { font-size: 1.15rem; }
.profile-card h3 { margin: 0 0 8px; }

/* Компактные таблицы внутри кабинета */
.table-compact th,
.table-compact td {
    padding: 6px 8px;
    font-size: 0.85rem;
}

.profile-card-actions { margin-top: 10px; }

/* Внутренние прокручиваемые области — кабинет помещается в один экран */
.scroll-box {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.profile-nick { margin: 0; }

.profile-form-row {
    display: flex;
    gap: 10px;
}

.profile-form-row .form-field { flex: 1; }

.profile-form .form-field { margin-bottom: 8px; }
.profile-form .form-field textarea { min-height: 60px; }
.profile-form input[type="file"] {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}

.form-actions { margin-top: 10px; }

/* Контроль версий */
.changelog-form {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.changelog-form textarea {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-element);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 44px;
}

.changelog-form button { flex-shrink: 0; }

.changelog-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.changelog-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.changelog-list li:last-child { border-bottom: none; }

.changelog-ver {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent);
    margin-right: 8px;
}

.changelog-date { font-size: 0.78rem; }

.changelog-notes { margin-top: 2px; font-size: 0.88rem; }

@media (max-width: 640px) {
    .profile-form-row { flex-direction: column; gap: 0; }
}

.code {
    font-family: monospace;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

/* Участники */
.participant {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.participant:hover .participant-name { color: var(--accent); }

.participant-name { font-weight: 600; }

/* Дерево приглашений */
.tree, .tree ul {
    list-style: none;
    margin: 0;
    padding-left: 24px;
    position: relative;
}

.tree > li { padding-left: 0; }

.tree li {
    position: relative;
    padding: 4px 0;
}

.tree li::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--border);
}

.tree li:last-child::before { bottom: auto; height: 14px; }

.tree li::after {
    content: "";
    position: absolute;
    left: -14px;
    top: 14px;
    width: 14px;
    border-top: 1px solid var(--border);
}

.tree > li::before,
.tree > li::after { display: none; }

.tree-node {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.tree-name { font-weight: 600; }

/* Уведомления и комментарии */
.bell { font-size: 1rem; text-decoration: none; }

.comments {
    margin-top: 20px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.comments h2 { margin-top: 0; }

.comment {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

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

.comment-head {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 4px;
}

.comment-author { font-weight: 600; }

.comment-text { margin: 0 0 6px; white-space: pre-wrap; }

.comment-form { margin-top: 16px; }
.comment-form .form-field textarea { min-height: 60px; }

.poster-upload .btn-file { position: relative; overflow: hidden; cursor: pointer; }
.poster-upload .btn-file input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.notifications {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.notification-unread { border-left: 3px solid var(--accent); }

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

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ===== Мобильная адаптация (этап 9) ===== */

.no-scroll { overflow: hidden; }

/* Мобильные элементы скрыты на десктопе */
.header-mobile,
.burger,
.drawer-overlay,
.drawer,
.tabbar,
.fab,
.filters-toggle,
.rows-mobile { display: none; }

@keyframes drawer-in {
    from { transform: translateX(100%); }
}

@keyframes fade-in {
    from { opacity: 0; }
}

@media (max-width: 760px) {
    /* --- Шапка (зеркально): ☰ · аватар · 🔔 слева, «Кинобаза» справа --- */
    .header-inner {
        flex-wrap: nowrap;
        justify-content: space-between;
        padding: 8px 12px;
        gap: 12px;
    }

    .nav { display: none; }

    .header-mobile {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-left: 0;
        order: 0;
    }

    .header-inner .brand { order: 3; }

    /* Порядок в левой группе: меню → профиль → колокольчик */
    .burger { order: 1; }
    .header-profile { order: 2; }
    .header-mobile .bell { order: 3; }

    .header-mobile > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        min-height: 42px;
        text-decoration: none;
    }

    .header-mobile .bell { font-size: 1.3rem; }

    .header-mobile .avatar-nav {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .burger {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 42px;
        height: 42px;
        background: none;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0;
        cursor: pointer;
        opacity: 1;
    }

    .burger span {
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: var(--text);
    }

    /* --- Drawer (выезжающая панель справа) --- */
    .drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(0, 0, 0, 0.55);
        animation: fade-in 0.2s ease-out;
    }

    /* display:flex/block выше перебивает скрытие по умолчанию */
    .drawer[hidden],
    .drawer-overlay[hidden] { display: none; }

    .drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 95;
        width: min(320px, 85vw);
        background: var(--bg-panel);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow);
        animation: drawer-in 0.22s ease-out;
    }

    .drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .drawer-title {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--accent);
    }

    .drawer-close {
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.25rem;
        line-height: 1;
        padding: 10px;
        cursor: pointer;
    }

    .drawer-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 8px;
        overflow-y: auto;
        flex: 1;
    }

    .drawer-nav a,
    .drawer-nav form {
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 48px;
        padding: 10px 14px;
        margin: 0;
        border-radius: 8px;
        color: var(--text);
        text-decoration: none;
        font-weight: 500;
    }

    .drawer-nav form button.link-btn {
        min-height: 44px;
        padding: 10px 0;
        text-align: left;
        font-size: 0.95rem;
    }

    .drawer-nav a.active {
        background: rgba(0, 193, 134, 0.12);
        color: var(--accent);
    }

    /* --- Нижнее таб-меню + FAB --- */
    .tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        background: rgba(29, 35, 40, 0.97);
        backdrop-filter: blur(8px);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .tabbar-item {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 56px;
        padding: 6px 4px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: inherit;
        font-size: 0.75rem;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
    }

    .tabbar-item.active { color: var(--accent); }

    main.container {
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: 16px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        z-index: 85;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent);
        color: var(--accent-text);
        font-size: 30px;
        font-weight: 700;
        line-height: 1;
        text-decoration: none;
        box-shadow: var(--shadow);
    }

    .page-add .fab,
    .page-search .fab { display: none; }

    /* --- Фильтры сворачиваются в кнопку «Фильтры ▾» --- */
    .filters-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        min-height: 44px;
        margin-bottom: 10px;
        background: var(--bg-panel);
        color: var(--text);
        border: 1px solid var(--border);
        font-family: inherit;
        font-weight: 600;
        font-size: 0.9rem;
        cursor: pointer;
    }

    .filters-arrow { transition: transform 0.15s; }
    .filters-toggle.open .filters-arrow { transform: rotate(180deg); }

    .filters-toggle.has-active::after {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--accent);
    }

    .filters--collapsible .filter-row { display: none; }
    .filters--collapsible.open .filter-row { display: flex; }

    /* --- Таблицы → строки-карточки --- */
    .table { display: none; }

    .rows-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mrow {
        display: flex;
        gap: 12px;
        background: var(--bg-panel);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 10px;
    }

    .mrow-poster {
        flex-shrink: 0;
        width: 56px;
        height: 84px;
        border-radius: 6px;
        overflow: hidden;
        background: var(--bg-element);
    }

    .mrow-poster img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .mrow-poster .table-poster {
        width: 100%;
        height: 100%;
        border-radius: 6px;
    }

    /* Аватар участника в мобильной строке (слот мини-постера) */
    .mrow-avatar {
        flex-shrink: 0;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        overflow: hidden;
        background: var(--bg-element);
        display: flex;
        align-items: center;
        justify-content: center;
        align-self: flex-start;
    }

    .mrow-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .mrow-avatar .avatar-ph {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        color: var(--text-muted);
    }

    .mrow-body {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mrow-title {
        font-weight: 600;
        color: var(--text);
        text-decoration: none;
    }

    .mrow-title small {
        display: block;
        font-weight: 400;
        font-size: 0.78rem;
    }

    .mrow-meta { font-size: 0.78rem; margin: 0; }

    .mrow-badges {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 2px;
    }

    .mrow-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: auto;
        padding-top: 8px;
    }

    .mrow-actions .btn { flex: 1 1 auto; }

    /* --- Тач-удобство --- */
    .btn,
    button:not(.link-btn):not(.tabbar-item):not(.drawer-close):not(.burger) {
        min-height: 44px;
    }

    .watched-check {
        width: 24px;
        height: 24px;
    }

    /* Кнопки действий — одинакового размера (на всю ширину контейнера) */
    .hide-mobile { display: none !important; }

    .card-actions {
        flex-direction: column;
        gap: 6px;
    }

    .card-actions .btn,
    .card-actions button {
        width: 100%;
        min-height: 44px;
    }

    .mrow-actions > .btn,
    .mrow-actions > button,
    .mrow-actions form.grow {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        padding-left: 10px;
        padding-right: 10px;
        text-align: center;
        overflow-wrap: break-word;
    }

    .mrow-actions form.grow .btn,
    .mrow-actions form.grow button {
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }

    .modal-actions .btn,
    .modal-actions button {
        flex: 1 1 0;
        min-height: 44px;
    }

    .pagination .btn { padding: 12px 18px; }

    /* Инпуты 16px — запрет iOS-zoom */
    .filters input[type="search"],
    .filters input[type="number"],
    .filters select,
    .form-field input[type="text"],
    .form-field input[type="password"],
    .form-field input[type="email"],
    .form-field input[type="number"],
    .form-field input[type="search"],
    .form-field select,
    .form-field textarea,
    .status-select {
        font-size: 16px;
    }

    /* Кабинет в одну колонку */
    .profile-grid { grid-template-columns: 1fr; }

    .changelog-form {
        flex-direction: column;
        align-items: stretch;
    }
}