/* =========================================================
   Админка на телефоне: краткая информация в одну строку
   Менеджер / клиент / сумма + кнопка раскрытия
   ========================================================= */

@media (max-width: 950px) {
    /* Карточка строки становится одной горизонтальной строкой */
    #adminSection tr.admin-mobile-prepared,
    #waitingLaunchSection tr.admin-mobile-prepared {
        display: grid !important;
        grid-template-columns: minmax(72px, .75fr) minmax(110px, 1.25fr) minmax(82px, .85fr) 34px !important;
        align-items: center !important;
        gap: 6px !important;

        padding: 9px 8px !important;
        padding-right: 8px !important;
        min-height: 48px !important;
        overflow: hidden !important;
    }

    /* Основные ячейки в кратком виде — одна строка без подписи слева */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-main-cell,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-main-cell {
        display: block !important;
        padding: 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;

        font-size: 12px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }

    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-main-cell::before,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-main-cell::before {
        display: none !important;
        content: none !important;
    }

    /* Детали в закрытом виде скрыты */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-detail-cell,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td.admin-mobile-detail-cell {
        display: none !important;
    }

    /* Кнопка + в этой же строке справа */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) .admin-mobile-toggle-cell,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) .admin-mobile-toggle-cell {
        position: static !important;
        display: block !important;
        width: 32px !important;
        padding: 0 !important;
        justify-self: end !important;
    }

    #adminSection .admin-mobile-toggle-cell::before,
    #waitingLaunchSection .admin-mobile-toggle-cell::before {
        display: none !important;
    }

    #adminSection .admin-mobile-toggle-btn,
    #waitingLaunchSection .admin-mobile-toggle-btn {
        width: 30px !important;
        min-width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        border-radius: 8px !important;
        font-size: 18px !important;
    }

    /* Клиент — самая важная часть строки */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"],
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"] {
        font-size: 13px !important;
        font-weight: 900 !important;
        color: #111827 !important;
    }

    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"] .client-name-cell,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"] .client-name-cell {
        display: inline-flex !important;
        max-width: 100% !important;
        gap: 5px !important;
    }

    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"] .client-name-cell span,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Клиент"] .client-name-cell span {
        display: inline-block !important;
        max-width: calc(100% - 26px) !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }

    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) .client-info-btn,
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) .client-info-btn {
        width: 20px !important;
        min-width: 20px !important;
        height: 20px !important;
        min-height: 20px !important;
        font-size: 11px !important;
    }

    /* Сумма компактно справа */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Сумма"],
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Деньги"],
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Сумма"],
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Деньги"] {
        text-align: right !important;
        font-size: 12px !important;
        font-weight: 900 !important;
    }

    /* Если в разделе нет суммы, третьей основной ячейкой может быть статус/роль */
    #adminSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Статус"],
    #waitingLaunchSection tr.admin-mobile-prepared:not(.admin-mobile-open) td[data-label="Статус"] {
        font-size: 12px !important;
        font-weight: 800 !important;
        color: #374151 !important;
    }

    /* Раскрытая строка снова становится вертикальной карточкой */
    #adminSection tr.admin-mobile-prepared.admin-mobile-open,
    #waitingLaunchSection tr.admin-mobile-prepared.admin-mobile-open {
        display: block !important;
        padding: 10px !important;
        padding-right: 54px !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    #adminSection tr.admin-mobile-prepared.admin-mobile-open td,
    #waitingLaunchSection tr.admin-mobile-prepared.admin-mobile-open td {
        display: grid !important;
        grid-template-columns: 92px 1fr !important;
        gap: 8px !important;
        padding: 6px 0 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        font-size: 13px !important;
        line-height: 1.25 !important;
    }

    #adminSection tr.admin-mobile-prepared.admin-mobile-open td::before,
    #waitingLaunchSection tr.admin-mobile-prepared.admin-mobile-open td::before {
        display: block !important;
        content: attr(data-label) !important;
        font-size: 11px !important;
        color: #6b7280 !important;
        font-weight: 900 !important;
    }

    #adminSection tr.admin-mobile-prepared.admin-mobile-open .admin-mobile-toggle-cell,
    #waitingLaunchSection tr.admin-mobile-prepared.admin-mobile-open .admin-mobile-toggle-cell {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        width: 34px !important;
        display: block !important;
        padding: 0 !important;
    }

    #adminSection tr.admin-mobile-prepared.admin-mobile-open .admin-mobile-toggle-cell::before,
    #waitingLaunchSection tr.admin-mobile-prepared.admin-mobile-open .admin-mobile-toggle-cell::before {
        display: none !important;
    }

    /* Нижние кнопки не перекрывают строки */
    #adminSection,
    #waitingLaunchSection {
        padding-bottom: 10px !important;
    }
}
