/* фикс ширины страницы, чтобы меню не прыгало */
html {
    overflow-y: scroll;
}

/* базовая типографика и фон */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background-color: #f5f5f7;
    color: #111827;
}

.container {
    min-height: calc(100vh - 38px);
}

/* ============================
   КНОПКИ (единый стиль)
=============================== */

.button,
.btn {
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    padding: 7px 16px;
    border-width: 1px;
    border-style: solid;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s.ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* основной цвет (брендовый / акцентный) */
.btn-primary,
.button-primary {
    background-color: #21838c;
    border-color: #21838c;
    color: #ffffff;
}

.btn-primary:hover,
.button-primary:hover {
    background-color: #16626c;
    border-color: #16626c;
    color: #ffffff;
}

/* вторичная кнопка (серый контур) */
.btn-outline-secondary,
.button-secondary {
    background-color: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.btn-outline-secondary:hover,
.button-secondary:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

/* кнопка опасного действия (удаление и пр.) */
.btn-danger,
.button-danger {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.btn-danger:hover,
.button-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

/* отключенные / неактивные кнопки */
.btn:disabled,
.button:disabled,
.btn.disabled,
.button.disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* выравнивание и отступы для блоков с кнопками */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ============================
   КАРТОЧКИ / ПАНЕЛИ
=============================== */

.card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f3f4f6;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #111827;
    margin: 0;
}

.card-body {
    padding: 16px 18px 18px;
}

.panel {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
    margin-bottom: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.panel-body {
    margin-top: 4px;
}

/* ============================
   ФОРМЫ
=============================== */

.form-control {
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 7px 12px;
    transition: border-color .15s ease, box-shadow .15s.ease;
    background-color: #ffffff;
}

.form-control:focus {
    border-color: #21838c;
    box-shadow: 0 0 0 1px rgba(33, 131, 140, 0.15);
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 4px;
}

.form-text {
    font-size: 12px;
    color: #6b7280;
}

.form-select {
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 7px 36px 7px 12px;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, transparent 50%, #6b7280 50%),
        linear-gradient(135deg, #6b7280 50%, transparent 50%);
    background-position:
        calc(100% - 16px) 50%,
        calc(100% - 11px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-clip: border-box;
}

.form-select:focus {
    border-color: #21838c;
    box-shadow: 0 0 0 1px rgba(33, 131, 140, 0.15);
    outline: none;
}

/* мультиселект – скролл скрыт визуально */
.form-select[multiple] {
    overflow-y: auto;
    scrollbar-width: none;
}

.form-select[multiple]::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.group-select .form-select {
    height: auto;
}

/* селект в блоке "С отмеченными" – не растягиваем на 100% */
.bulk-gid-select {
    min-width: 220px;
    width: auto;
    display: inline-block;
}

.bulk-actions .form-select {
    width: auto;
}

/* ============================
   ВХОД
=============================== */

.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-box {
    margin-top: 6vh;
    margin-bottom: 6vh;
}

.login-logo {
    font-weight: 600;
    font-size: 22px;
    margin-bottom: 16px;
    text-align: center;
}

.login-form {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 20px 18px 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    max-width: 360px;
    margin: 48px auto 32px;
}

.login-form .form-label {
    font-size: 13px;
}

.login-form .btn-primary {
    width: 100%;
    margin-top: 6px;
}

.login-form .lock-icon {
    width: 25%;
    margin: auto;
}

.login-form .lock-icon path {
    fill: #b3dfdb;
}

/* ============================
   ВЕРХНЕЕ МЕНЮ
=============================== */

.top-menu {
    background-color: #ffffff;
    border-radius: 16px;
    margin-top: 24px;
    margin-bottom: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.top-menu ul {
    list-style: none;
    gap: 1.5em;
    margin-bottom: 0;
    padding-left: 0;
}

.top-menu a {
    text-decoration: none;
    background-color: transparent;
    color: #374151;
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 150ms.ease, color 150ms.ease;
}

.top-menu a:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.top-menu a.current {
    background-color: #21838c;
    color: #ffffff;
}

/* ВАЖНО: правильное оформление имени пользователя (admin и др.) */
.current-user label {
    margin-bottom: 0;
    margin-right: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    padding: 4px 10px;
    border-radius: 9999px;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.current-user .logout-form .btn {
    padding-inline: 14px;
}

/* ============================
   ГЛАВНАЯ С КАРТИНКОЙ
=============================== */

.robot-box {
    border-radius: 16px;
    background-color: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
    padding: 16px 18px;
}

.robot-box img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* главная картинка в .main */
.main img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================
   ТАБЛИЦЫ
=============================== */

.table {
    background-color: #ffffff;
    border-radius: 16px;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: none;
    margin-top: 4px;
}

.table thead th {
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    font-size: 14px;
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 10px;
}

.table tbody td {
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* симметрия по краям любой таблицы */
.table th:first-child,
.table td:first-child {
    padding-left: 16px;
    width: 40px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 16px; /* симметрия с левым краем */
}

/* уточнения для таблицы получателей */
#recipientsTable th:first-child,
#recipientsTable td:first-child {
    width: 36px;
}

#recipientsTable th:last-child,
#recipientsTable td:last-child {
    width: 90px;
    text-align: center;
}

/* ширина колонки "ФИО / Название" – базовая (десктоп) */
#recipientsTable th:nth-child(3),
#recipientsTable td:nth-child(3) {
    min-width: 220px;
}

/* бейдж внутри таблиц */
.table td .badge {
    font-size: 12px;
    border-radius: 9999px;
    padding: 3px 8px;
}

/* ============================
   ФЛЕШ-СООБЩЕНИЯ
=============================== */

.alert {
    border-radius: 9999px;
    padding: 8px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

/* ============================
   EMPTY-STATE
=============================== */

.empty-state {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #6b7280;
}

.empty-state img {
    max-width: 260px;
    height: auto;
    margin-bottom: 16px;
}

/* ============================
   ТУЛБАР / СПИСКИ
=============================== */

.toolbar-flat {
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

/* компактный блок "С отмеченными" */
.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 9999px;
    background-color: transparent; /* убрали бледный фон */
}


.bulk-actions span {
    font-size: 14px;
    color: #6b7280;
}

/* бейдж группы */
.badge-group {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    background-color: #eef2ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 500;
}

/* кнопки-ссылки (если используются) */
a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    text-decoration: none;
    color: #374151;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: background-color 150ms.ease, border-color 150ms.ease, box-shadow 150ms.ease, color 150ms.ease;
}

a.button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

a.button.add {
    background-color: #21838c;
    color: #ffffff;
    margin-left: auto;
}

.buttons {
    display: flex;
    gap: 8px;
    width: fit-content;
}

/* круглые иконки */
.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    color: #4b5563;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: background-color .15s.ease, border-color .15s.ease, box-shadow .15s.ease, transform .1s.ease;
}

.btn-icon:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}

.btn-icon:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

.btn-icon-danger {
    color: #dc2626;
    border-color: #fecaca;
}

.btn-icon-danger:hover {
    background-color: #fef2f2;
    border-color: #fca5a5;
}

/* ============================
   ФУТЕР
=============================== */

footer {
    margin: 20px 0 10px 0;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
}

/* ============================
   АДАПТИВ
=============================== */

@media (max-width: 768px) {

    .top-menu {
        margin-top: 16px;
        margin-bottom: 14px;
        padding: 12px 14px;
    }

    .top-menu.d-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .top-menu ul {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .top-menu.ul li {
        width: 100%;
        list-style: none;
    }

    .top-menu ul li a {
        display: block;
        width: 100%;
        text-align: left;
    }

    .top-menu .current-user {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: space-between;
    }

    /* тулбар в колонку */
    .toolbar-flat {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    /* ОДИНАКОВАЯ сетка и отступы для блока "С отмеченными"
       и для нижнего блока с двумя кнопками */
    .bulk-actions,
    .toolbar-right {
        box-sizing: border-box;
        width: 100%;
        padding: 0 10px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 8px;
        row-gap: 8px;
    }

    /* "С отмеченными:" и селект на всю ширину, поверх сетки */
    .bulk-actions span,
    .bulk-actions .bulk-gid-select {
        grid-column: 1 / -1;
        width: 100%;
    }

    .bulk-actions .bulk-gid-select,
    .bulk-actions .bulk-gid-select .form-select,
    .bulk-actions .form-select {
        width: 100%;
    }

    /* все кнопки внутри этих двух блоков – одинаковой ширины */
    .bulk-actions .btn,
    .toolbar-right .btn,
    .toolbar-right .button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* робот и главная картинка под экран, обрезаем по высоте */
    .robot-box {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .robot-box img {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    .main img {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    /* заголовки таблицы получателей на мобиле: компактнее и без переноса */
    #recipientsTable thead th {
        white-space: nowrap;
        font-size: 13px;
    }

    /* колонка ID – уже на мобиле */
    #recipientsTable thead th:nth-child(2) {
        min-width: 64px;
    }

    /* стрелка сортировки поменьше и ближе к тексту, чтобы не ломать шапку */
    #recipientsTable thead th[data-sort-dir="asc"]::after,
    #recipientsTable thead th[data-sort-dir="desc"]::after {
        right: 4px;
        border-left-width: 3px;
        border-right-width: 3px;
        border-top-width: 4px;
        border-bottom-width: 4px;
    }

    /* высота строк на мобиле – компактнее */
    #recipientsTable tbody td {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    /* ФИО/Название – динамическая ширина, без переноса; колонка растёт за счёт горизонтального скролла */
    #recipientsTable th:nth-child(3),
    #recipientsTable td:nth-child(3) {
        min-width: auto;
        white-space: nowrap;
    }

    /* последняя колонка (иконки действий) – иконки всегда в один ряд, не ломаем строку */
    #recipientsTable td:last-child {
        white-space: nowrap;
    }

    /* на мобиле горизонтальный скролл делаем на форме со списком */
    #pageForm {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #pageForm #recipientsTable {
        min-width: 640px;
    }
}

@media (max-width: 575.98px) {
    .panel {
        padding: 14px 14px;
        border-radius: 10px;
    }

    .card {
        border-radius: 14px;
    }

    .top-menu {
        border-radius: 12px;
    }

    .empty-state {
        margin-top: 24px;
    }

    .table {
        box-shadow: none;
    }
}

/* ============================
   Страница отписки
=============================== */

.unsubscribe-page {
    padding: 40px 16px;
}

.unsubscribe-box {
    max-width: 480px;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.unsubscribe-title {
    font-size: 20px;
    margin: 0 0 16px;
    color: #21838c;
}

.unsubscribe-text {
    margin: 0;
    font-size: 14px;
    color: #333333;
}

/* ============================
   Страница отправки сообщения
=============================== */

.email-sending-card {
    max-width: 100%;
}

.form-inputs {
    padding-right: 15px;
}

.email-preview {
    padding-left: 15px;
}

.preview-container {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.send-button,
.edit-preview-button {
    width: 100%;
    margin-top: 10px;
}

.code-insert textarea {
    font-family: monospace;
}

.nav-tabs .nav-link.active {
    background-color: #21838c;
    border-color: #21838c;
    color: #fff;
}

.nav-tabs .nav-link {
    color: #21838c;
}

.message-body {
    margin-top: 15px;
}

.hidden {
    display: none;
}

#email-preview-frame {
    height: 800px;
    border: 0;
}

@media (max-width: 767.98px) {
    .email-sending-page .form-inputs,
    .email-sending-page .email-preview {
        padding: 0;
    }
}

/* ============================
   Drag & drop для сортировки
=============================== */

.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.is-dragging {
    background-color: #eef2ff;
}

/* ============================
   Визуал сортировки таблицы получателей
=============================== */

#recipientsTable thead th {
    cursor: pointer;
    user-select: none;
    position: relative;
}

#recipientsTable thead th[data-sort-dir="asc"],
#recipientsTable thead th[data-sort-dir="desc"] {
    background-color: #eef2ff;
    color: #111827;
}

#recipientsTable thead th[data-sort-dir="asc"]::after,
#recipientsTable thead th[data-sort-dir="desc"]::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

#recipientsTable thead th[data-sort-dir="asc"]::after {
    border-bottom: 6px solid #4b5563;
    transform: translateY(-60%);
}

#recipientsTable thead th[data-sort-dir="desc"]::after {
    border-top: 6px solid #4b5563;
    transform: translateY(-40%);
}

/* ============================
   iOS-стиль модального окна подтверждения
=============================== */

.ios-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.ios-modal-backdrop.is-visible {
    display: flex;
}

.ios-modal {
    min-width: 280px;
    max-width: 320px;
    background: #f9fafb;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.35);
    padding: 16px 16px 8px;
    text-align: center;
}

.ios-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.ios-modal-text {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 12px;
}

.ios-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 6px;
}

.ios-modal-btn {
    flex: 1;
    border-radius: 9999px;
    padding: 7px 0;
    font-size: 14px;
    font-weight: 500;
    border-width: 1px;
    border-style: solid;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.ios-modal-cancel {
    background-color: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.ios-modal-ok {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.ios-modal-ok:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

/* ============================
   ДОПОЛНИТЕЛЬНО: Нумерация строк + скролл таблицы получателей
=============================== */

/* первый столбец таблицы получателей – резервируем место под маленький номер */
#recipientsTable td:first-child {
    position: relative;
    padding-left: 22px; /* 16 базовый + ~6 до чекбокса */
}

/* маленький номер строки, по центру промежутка между краем и чекбоксом */
#recipientsTable .row-index {
    position: absolute;
    left: 11px;                    /* середина от 0 до 22 */
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 500;
    color: #9ca3af;
    text-align: center;
    pointer-events: none;
}

/* чекбокс – без дополнительного отступа, его позиция задаётся padding'ом ячейки */
#recipientsTable td:first-child input[type="checkbox"] {
    margin-left: 0;
}

/* счётчик выбранных рядом с ID (в заголовке) */
.selected-count {
    margin-left: 4px;
    font-size: 9px;
    color: #9ca3af;
    font-weight: 500;
}

/* обёртка для горизонтального скролла таблицы получателей (если используешь .recipients-table-scroll) */
.recipients-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.recipients-table-scroll table {
    width: 100%;
    min-width: 640px;
}

/* ============================
   ДОПОЛНИТЕЛЬНО: Центрирование названий групп на мобиле
=============================== */

@media (max-width: 768px) {
    /* 5-й столбец таблицы (Группа) – текст по центру */
    #recipientsTable td:nth-child(5) {
        text-align: center;
    }

    /* бейдж группы на мобиле – как блок по центру, многострочный текст тоже центрируется */
    #recipientsTable td:nth-child(5) .badge-group {
        display: inline-block;
        text-align: center;
        white-space: normal;
    }
}
/* Оформление имени пользователя рядом с кнопкой "Выйти" */
.top-menu .current-user {
    align-items: center;   /* на всякий случай выравниваем по середине по вертикали */
    gap: 8px;              /* небольшой зазор между именем и кнопкой */
}

/* Сам текст admin/username — делаем аккуратный бейдж в стиле интерфейса */
.top-menu .current-user label {
    margin: 0;
    padding: 4px 10px;
    border-radius: 9999px;
    background-color: #f3f4f6;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}
/* Мобильная версия: нормализуем высоту и ширину кнопок в очереди сообщений */
/* Работает только на мобильных, только внутри #messagesToolbarForm */
@media (max-width: 768px) {

    #messagesToolbarForm .bulk-actions .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 42px;        /* одинаковая высота кнопок */
        width: 100%;         /* все кнопки одинаковой ширины */
        white-space: nowrap; /* запрет переноса строк */
    }
}
/* Мобилка: точное центрирование кнопки "Добавить группу" */
@media (max-width: 768px) {
    a.btn-primary[href$="add/"] {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-top: 18px !important;
        margin-bottom: 18px !important;
    }
}
/* Мобильная выравниваем кнопку "Добавить группу" по центру
   между верхним меню и таблицей групп */
@media (max-width: 768px) {
    #groupsForm .bulk-actions {
        margin-top: 22px;    /* расстояние сверху */
        margin-bottom: 22px; /* такое же снизу, чтобы блок был по центру */
    }
}
/* Мобила: кнопка "Добавить группу" строго посередине по вертикали
   между верхним меню и таблицей групп */
@media (max-width: 768px) {

    /* только тулбар групп, другие страницы не трогаем */
    .toolbar-groups {
        margin-bottom: 0;
    }

    /* только таблица групп */
    #groupsTable {
        margin-top: 18px; /* столько же, сколько нижний margin у .top-menu */
    }
}
/* Мобила: выровнять кнопку "Добавить группу" по вертикали
   между верхним меню и таблицей */
@media (max-width: 768px) {
    /* только тулбар на странице групп */
    .toolbar-groups {
        margin-top: 22px;   /* отступ от нижнего края меню */
        margin-bottom: 12px;/* отступ до таблицы */
    }

    /* чтобы лишний общий отступ таблицы не съедал баланс */
    .toolbar-groups + #groupsTable {
        margin-top: 0;
    }
}
.top-menu .home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #f3f4f6;
    color: #6b7280;
    text-decoration: none;
}

.top-menu .home-link:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.top-menu .home-link svg {
    display: block;
}
