:root {
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1c1e21;
    --muted: #6b7280;
    --accent: #2d81e0;
    --accent-hover: #1f6fc4;
    --border: #e5e7eb;
    --danger: #d64545;
    --ok: #1f9d55;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.app {
    min-height: 100vh;
}

.screen {
    max-width: 980px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

/* Раскладка с узкой колонкой меню слева */

.layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    max-width: none;
    margin: 0;
    padding: 0;
}

.layout > .screen {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 16px 8px 40px 12px;
}

.sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 186px;
    width: 186px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
    background: var(--card);
    box-shadow: 1px 0 0 var(--border);
}

.sidebar__item {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar__item svg {
    flex: none;
    opacity: 0.85;
}

/* Активный премиум: пункт подсвечен, звезда золотая */

.sidebar__item--premium {
    color: #8a6100;
    background: rgba(240, 180, 41, 0.14);
}

.sidebar__item--premium svg {
    color: #e0a800;
    stroke: #e0a800;
    opacity: 1;
}

.sidebar__item:hover {
    background: rgba(45, 129, 224, 0.08);
    color: var(--text);
}

.sidebar__item.is-active {
    background: rgba(45, 129, 224, 0.12);
    color: var(--accent);
    font-weight: 600;
}

/* Премиум и платные шаблоны */

.premium-status {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.premium-status--active {
    color: var(--ok);
}

.tariff-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    margin-bottom: 0;
    padding: 16px;
}

.tariff-card__photo {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 4px;
}

.tariff-card__title {
    font-weight: 600;
    font-size: 16px;
}

.tariff-card__meta {
    color: var(--muted);
    font-size: 13px;
}

.tariff-card__price {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
    margin: 2px 0 8px;
}

.tariff-card .btn {
    width: 100%;
}

.template-card--locked {
    border: 1px dashed var(--border);
}

.template-card__lock {
    margin-top: 8px;
    font-size: 12px;
    color: var(--accent);
}

/* Вкладки разделов */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.tabs__item {
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    border-radius: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tabs__item:hover {
    color: var(--text);
}

.tabs__item.is-active {
    background: rgba(45, 129, 224, 0.12);
    border-color: transparent;
    color: var(--accent);
    font-weight: 600;
}

/* Переключатель аудитории «Всем / Гостям» */

.segmented {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.segmented__item {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 6px 18px;
    font: inherit;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.segmented__item:hover:not(:disabled) {
    color: var(--text);
}

.segmented__item.is-active {
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.segmented__item:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Сводка */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.stat {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.stat__value {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
}

.stat__label {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

/* Админка: список администраторов приложения */

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.admin-row--wide {
    flex-wrap: wrap;
}

.admin-row--wide .admin-row__main {
    flex: 1 1 260px;
}

.admin-row__date {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: var(--text);
}

.admin-row__main {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

/* Принудительный перенос внутри набора контролов */

.flags-break {
    flex-basis: 100%;
    height: 0;
}

.admin-row__id {
    font-weight: 600;
    font-size: 14px;
}

.admin-row__name,
.admin-row__note {
    color: var(--muted);
    font-size: 13px;
}

.admin-row__owner {
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(45, 129, 224, 0.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

.admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-form input {
    flex: 1 1 160px;
    min-width: 120px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

.admin-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 129, 224, 0.15);
}

.template-flags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

.tpl-price {
    width: 92px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
}

.tpl-title {
    width: 150px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
}

.tariff-photo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex: none;
}

/* Тексты помощи */

.help__list {
    margin: 0 0 12px;
    padding-left: 20px;
}

.help__list li {
    margin-bottom: 8px;
}

.help__note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 760px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        flex: none;
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        box-shadow: 0 1px 0 var(--border);
    }

    .sidebar__item {
        white-space: nowrap;
    }

    .layout > .screen {
        padding: 12px 12px 40px;
    }
}

/* Шапка */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.topbar__title {
    font-size: 20px;
    font-weight: 600;
}

.topbar__subtitle {
    color: var(--muted);
    font-size: 13px;
}

/* Карточки */

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 24px;
}

.card.empty h2 {
    margin: 0 0 8px;
    font-size: 17px;
    color: var(--text);
}

.card.empty p {
    margin: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.template-card {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    margin-bottom: 0;
}

.template-card:hover {
    box-shadow: 0 4px 14px rgba(45, 129, 224, 0.18);
    transform: translateY(-1px);
}

.template-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.template-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

/* Карточка виджета */

.widget-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.widget-card__title {
    font-weight: 600;
}

.widget-card__meta {
    color: var(--muted);
    font-size: 13px;
}

.widget-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* Подсветка карточки, к которой прокрутили после сохранения */
.widget-card--highlight {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    transition: outline-color 0.3s ease;
}

/* Предпросмотр */

.preview-table__icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
}

/* Флаг валюты в превью таблицы курсов */
.preview-table__flag {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: -3px;
    margin-right: 6px;
}

.preview-box {
    background: #f7f8fa;
    border-radius: 10px;
    padding: 8px;
    overflow: hidden;
}

.preview-widget {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 420px;
}

.preview-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
}

.preview-body {
    padding: 12px;
}

.preview-caption {
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 8px;
}

.preview-table th,
.preview-table td {
    border-bottom: 1px solid var(--border);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.preview-table th {
    font-weight: 600;
    color: #333;
}

/* Счётчик справа от заголовка таблицы */
.preview-counter {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.preview-table--poll td:last-child {
    white-space: nowrap;
    color: var(--muted);
}

.preview-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.preview-card__cover {
    display: block;
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
}

.preview-card__title {
    font-weight: 600;
    padding: 8px 10px 0;
}

.preview-card__descr {
    color: #666;
    font-size: 13px;
    padding: 2px 10px 8px;
}

.preview-card__button {
    display: inline-block;
    margin: 0 10px 10px;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
}

.preview-matches {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.preview-match {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.preview-match__team {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}

.preview-match__team--right {
    justify-content: flex-end;
    text-align: right;
}

.preview-match__logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: 0 0 auto;
}

/* Иконка матча (логотип турнира) в списке */
.preview-match__icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    flex: 0 0 auto;
    background: var(--bg);
}

/* Одиночный матч («Матч»): логотипы крупнее, под названиями — города */
.preview-match__logo--big {
    width: 28px;
    height: 28px;
}

.preview-match__names {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preview-match__descr {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.preview-goals {
    display: flex;
    gap: 12px;
    flex: 1 1 100%;
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.preview-goals__list {
    flex: 1 1 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Голы правой команды — по правому краю, как под своей командой */
.preview-goals__list--right {
    text-align: right;
}

.preview-match__score {
    font-weight: 600;
    flex: 0 0 auto;
}

.preview-match__state {
    flex: 1 1 100%;
    color: #888;
    font-size: 12px;
}

.preview-donate__bar {
    height: 8px;
    border-radius: 4px;
    background: #eceef2;
    overflow: hidden;
    margin: 6px 0;
}

.preview-donate__bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.preview-donate__sums {
    font-size: 13px;
    color: #333;
}

.preview-donate__backers {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* Голосование */
.poll-screen {
    padding: 12px;
    min-height: 100vh;
}

.poll-screen .card {
    max-width: 560px;
    margin: 0 auto;
}

/* Ссылка на сообщество в шапке экрана голосования */
.poll-community {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.poll-community:hover {
    color: var(--accent);
}

.poll-community__photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: #e6e9ee;
}

.poll-community__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.poll-community__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poll-community__arrow {
    flex: 0 0 auto;
    color: var(--muted);
}

.welcome__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome__ok {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef7ee;
    color: #2f6b2f;
    font-size: 14px;
}

/* Выбор сообщества на экране вне приложения */
.community-pick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 14px;
}

.community-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
}

.community-pick__photo {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg);
}

.community-pick__body {
    flex: 1;
    min-width: 0;
}

.community-pick__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.community-pick__state {
    font-size: 13px;
    color: var(--muted);
}

.community-pick .btn {
    flex: 0 0 auto;
}

.poll-question {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    margin-bottom: 6px;
}

.poll-status {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 14px;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.poll-option {
    text-align: left;
    padding: 10px 14px;
}

/* Строка «Проголосовало N человек» + лица последних */
.poll-voters-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}

.poll-voters-line__title {
    font-size: 13px;
    color: var(--muted);
}

.poll-voters-line__link {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.poll-faces {
    display: inline-flex;
    align-items: center;
}

.poll-faces > a {
    display: inline-block;
    margin-left: -6px;
    line-height: 0;
}

.poll-faces > a:first-child {
    margin-left: 0;
}

.poll-faces__item {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    background: #e6e9ee;
    box-shadow: 0 0 0 2px var(--card);
}

.poll-faces__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.poll-admin {
    margin-top: 10px;
    max-width: 560px;
}

/* Выход с экрана голосования у зрителя */
.poll-exit {
    margin-top: 12px;
}

.poll-back {
    margin-top: 14px;
}

.poll-back a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

/* Общее окно результата действия: затемнение и карточка с иконкой */
.modal-host:empty {
    display: none;
}

.action-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.action-modal__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 320px;
    padding: 22px 26px;
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: action-modal-in 0.18s ease-out;
}

.action-modal__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    font-size: 22px;
    line-height: 44px;
    text-align: center;
}

.action-modal__card--error .action-modal__icon {
    background: var(--danger);
}

.action-modal__card--info .action-modal__icon {
    background: var(--accent);
}

.action-modal__text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

@keyframes action-modal-in {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/*
 * Постоянная плашка ошибки: окно результата исчезает само, а текст ошибки
 * (например, ответ ВК) должен остаться на экране до закрытия.
 */
.error-banner-host:empty {
    display: none;
}

.error-banner-host {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 70;
    padding: 10px 12px 0;
    pointer-events: none;
}

.error-banner {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 720px;
    margin: 0 auto;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--danger);
    color: #fff;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.error-banner__text {
    flex: 1 1 auto;
    word-break: break-word;
}

.error-banner__close {
    flex: 0 0 auto;
    padding: 0 4px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    opacity: 0.85;
}

.error-banner__close:hover {
    opacity: 1;
}

/* Экран «Кто голосовал» */
.poll-voters-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.poll-back-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.poll-back-link:hover {
    text-decoration: underline;
}

.poll-voters-subtitle {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}

.poll-voters-more {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.poll-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 6px;
}

.poll-result__head {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 4px;
}

.poll-result__bar {
    height: 8px;
    border-radius: 4px;
    background: #eceef2;
    overflow: hidden;
}

.poll-result__bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.poll-voters__count {
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(45, 129, 224, 0.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
}

.poll-voter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.poll-voter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    background: #f7f8fa;
}

.poll-voter__avatar {
    display: inline-flex;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e6e9ee;
    box-shadow: 0 0 0 2px #fff;
}

.poll-voter__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.poll-voter__name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poll-voter__name:hover {
    color: var(--accent);
    text-decoration: underline;
}

.poll-voter__choice {
    flex: 0 0 34%;
    max-width: 34%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poll-voter__remove {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a0a6b1;
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.poll-voter__remove:hover {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

.preview-poll {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.preview-poll__item {
    margin-bottom: 10px;
}

.preview-poll__title {
    font-size: 14px;
    margin-bottom: 4px;
}

.preview-poll__bar {
    height: 6px;
    border-radius: 3px;
    background: #eceef2;
    overflow: hidden;
}

.preview-poll__bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.preview-poll__meta {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.preview-poll__button {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
}

.preview-note {
    font-size: 12px;
    color: #888;
}

.preview-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.preview-text {
    color: #444;
    font-size: 14px;
    margin-bottom: 10px;
}

/* Доп. текст (descr) у шаблона «Текст + ссылка» */
.preview-descr {
    color: #7a7f87;
    font-size: 13px;
    margin: -4px 0 10px;
}

.preview-button {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* Формы */

.field {
    display: block;
    margin-bottom: 14px;
}

.field > span {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

/* Селект: убираем системный вид и рисуем свою стрелку */
.field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 8px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 129, 224, 0.15);
}

.field textarea {
    resize: vertical;
}

.hint {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Картинка в настройках виджета */

.image-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.image-field__preview {
    display: block;
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    object-fit: contain;
}

.image-field__button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px dashed #c6ced9;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.image-field__button:hover {
    border-color: var(--accent);
    background: rgba(45, 129, 224, 0.06);
    color: var(--accent);
}

.image-field__button svg {
    flex: none;
    opacity: 0.85;
}

.image-field__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Повторяемые строки */

.rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}

.rows-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
}

.rows-item__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--muted);
}

.field--sub {
    margin-bottom: 10px;
}

/* Предпросмотр списка */

.preview-rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.preview-row:last-child {
    border-bottom: 0;
}

.preview-row__icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}

.preview-row__body {
    flex: 1 1 auto;
    min-width: 0;
}

.preview-row__title {
    font-weight: 500;
    font-size: 14px;
}

.preview-row__descr {
    color: var(--muted);
    font-size: 13px;
}

/* Подробный текст, адрес и время строки списка */
.preview-row__text {
    color: #444;
    font-size: 13px;
    margin-top: 2px;
}

.preview-row__meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.preview-row__button {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
}

.preview-more {
    margin-top: 10px;
    color: var(--accent);
    font-size: 14px;
}

/* «Персональное приглашение»: строка с аватаром */

.preview-invite {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.preview-invite__photo {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d8dde5;
}

.preview-invite__title {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.preview-tiles {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.preview-tile {
    flex: 0 0 auto;
    width: 84px;
    height: 84px;
    border-radius: 8px;
    background: #eef1f5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 6px;
}

.preview-tile__title {
    color: var(--text);
    font-weight: 500;
}

.preview-tile__icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Таймер-плитки: крупные цифры и подпись под каждой */
.preview-timer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-timer__cell {
    flex: 0 0 auto;
    width: 96px;
    text-align: center;
}

.preview-timer__image {
    display: block;
    width: 96px;
    height: 96px;
}

.preview-timer__label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.preview-tile-card {
    flex: 0 0 auto;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.preview-tile-card__icon {
    width: 84px;
    height: 84px;
    border-radius: 8px;
    object-fit: cover;
}

/* Высокие плитки 160×240 */
.preview-tile-card--tall .preview-tile-card__icon {
    height: 126px;
}

.preview-tile-card__link {
    font-size: 12px;
    color: var(--accent);
}

.preview-tile-card__title {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

/* Кнопки */

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 14px;
    line-height: 1.25;
    cursor: pointer;
}

.btn:hover {
    background: #f5f6f8;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--ghost {
    color: var(--danger);
}

/* Плашки */

.notice,
.alert {
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.notice {
    background: #e8f3fe;
    color: #1c5fa8;
}

/* Предупреждение: премиум заканчивается */
.notice--warning {
    background: #fff4e5;
    color: #8a4b00;
    border-left: 3px solid #f0a500;
}

.alert--error {
    background: #fdecec;
    color: var(--danger);
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

.badge--draft {
    background: #f1f2f4;
    color: var(--muted);
}

.badge--ok {
    background: #e6f6ec;
    color: var(--ok);
}

.badge--error {
    background: #fdecec;
    color: var(--danger);
}

.badge--paid {
    background: #fff5e0;
    color: #a86b00;
}

/* Редактор */

.editor {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
    gap: 8px;
    align-items: start;
}

.editor .card {
    margin-bottom: 0;
}

.editor__preview {
    position: sticky;
    top: 12px;
    padding: 10px;
}

@media (max-width: 760px) {
    .editor {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor__preview {
        position: static;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --------------------------------------------------------------------------
   Тёмная тема. ВК присылает её событием VKWebAppUpdateConfig (appearance),
   app.js ставит html[data-theme="dark"]. Перекрываем только то, что в светлой
   теме зашито литералами: остальное живёт на переменных из :root.
   -------------------------------------------------------------------------- */

html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #18181a;
    --card: #232326;
    --text: #e8e9ec;
    --muted: #9b9ea6;
    --accent: #5aa2f0;
    --accent-hover: #7ab6f6;
    --border: #3a3a3f;
    --danger: #f0736f;
    --ok: #57c98a;
}

html[data-theme="dark"] .tabs__item,
html[data-theme="dark"] .admin-row__date,
html[data-theme="dark"] .admin-form input,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .btn {
    background: #2a2a2e;
    color: var(--text);
}

/* В тёмной теме стрелка светлее */
html[data-theme="dark"] .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%239b9ea6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px 8px;
}

html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .tabs__item:hover {
    background: #333338;
}

html[data-theme="dark"] .btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

html[data-theme="dark"] .preview-box,
html[data-theme="dark"] .preview-widget,
html[data-theme="dark"] .preview-poll,
html[data-theme="dark"] .rows-item,
html[data-theme="dark"] .image-field__button {
    background: #26262a;
}

html[data-theme="dark"] .image-field__button {
    border-color: #44444a;
}

html[data-theme="dark"] .poll-voter {
    background: #26262a;
}

html[data-theme="dark"] .poll-voter__avatar,
html[data-theme="dark"] .poll-faces__item,
html[data-theme="dark"] .poll-community__photo {
    background: #3a3a3f;
}

html[data-theme="dark"] .poll-voter__avatar {
    box-shadow: 0 0 0 2px #2a2a2e;
}

html[data-theme="dark"] .poll-community {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .poll-voter__remove {
    color: #8e9199;
}

html[data-theme="dark"] .poll-voter__remove:hover {
    background: rgba(240, 115, 111, 0.16);
    color: var(--danger);
}

html[data-theme="dark"] .poll-result__bar,
html[data-theme="dark"] .preview-donate__bar,
html[data-theme="dark"] .preview-poll__bar {
    background: #3a3a3f;
}

html[data-theme="dark"] .preview-table th,
html[data-theme="dark"] .poll-note,
html[data-theme="dark"] .preview-donate__sums {
    color: var(--text);
}

html[data-theme="dark"] .preview-text {
    color: #c7c9cf;
}

html[data-theme="dark"] .preview-card__descr,
html[data-theme="dark"] .preview-match__state,
html[data-theme="dark"] .preview-donate__backers,
html[data-theme="dark"] .preview-poll__meta,
html[data-theme="dark"] .preview-note {
    color: var(--muted);
}

html[data-theme="dark"] .preview-row {
    border-bottom-color: #333338;
}

html[data-theme="dark"] .preview-tile,
html[data-theme="dark"] .badge--draft {
    background: #34343a;
}

html[data-theme="dark"] .notice {
    background: #1b2a3a;
    color: #8fc2f5;
}

html[data-theme="dark"] .alert--error,
html[data-theme="dark"] .badge--error {
    background: #3a2224;
}

html[data-theme="dark"] .badge--ok,
html[data-theme="dark"] .welcome__ok {
    background: #1e2f24;
    color: #7fd8a2;
}

html[data-theme="dark"] .badge--paid {
    background: #372c17;
    color: #e0b768;
}

html[data-theme="dark"] .sidebar__item--premium {
    color: #e6c07b;
    background: rgba(240, 180, 41, 0.16);
}

html[data-theme="dark"] .sidebar__item.is-active,
html[data-theme="dark"] .tabs__item.is-active,
html[data-theme="dark"] .admin-row__owner,
html[data-theme="dark"] .poll-voters__count {
    background: rgba(90, 162, 240, 0.18);
}

html[data-theme="dark"] .template-card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .admin-row {
    background: var(--card);
}
