/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 768px) {
    /* Сайдбар по умолчанию скрыт */
    .sidebar {
        transform: translateX(-100%);
        width: 250px !important;
    }
    .sidebar.active {
        transform: translateX(0);
    }

    /* Контент занимает всю ширину */
    .content {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 2px !important;
    }
    .sidebar.mini {
        width: 250px !important;
    }
    .sidebar.mini + .content {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 2px !important;
    }

    /* Верхняя панель: перенос элементов */
    .d-flex.justify-content-between.align-items-center {
        flex-wrap: wrap;
        gap: 10px;
        align-items: baseline !important;
    }

    /* Поиск и кнопки — в колонку */
    .btn-group[role="group"] {
        align-items: stretch;
        width: 100%;
    }
    .wrapper_search{
        width: 100%;
    }
    #searchInput {
        width: 100% !important;
    }
    .wrapper-btn-inst-filter {
        display: flex
    ;
    }
    /* Вкладки статусов — прокручиваемые */
    #statusTabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
    #statusTabs .nav-item {
        display: inline-block;
        flex: 0 0 auto;
    }

    /* Фильтр — растянуть поля */
    .filter-flex {
        flex-direction: column;
        gap: 5px;
    }
    .filter-flex span {
        display: none; /* убрать "–" между полями */
    }

    /* Таблица: горизонтальный скролл + компактность */
    .table-responsive {
        font-size: 11px;
    }


    /* Пагинация — компактная */
    .wrapper_pag {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    #perPageSelect {
        width: auto !important;
    }

    /* Модальные окна — растянуть */
    .modal-dialog {
        margin: 10px;
    }
    div#createApplicationModal,
    div#applicationModal{
        padding: 0 !important;
    }
    /* Формы в модалках — адаптировать поля */
    .modal-body .row > [class*="col-"] {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
    button.btn.btn-outline-secondary.print-btn{
        display: none;
    }
    /* Drop zone — компактнее */
    .drop-zone {
        padding: 12px;
    }
    .drop-zone span {
        font-size: 14px;
    }

    /* Кнопки действий в таблице — вертикально */
    .btn-block {
        flex-direction: column;
        gap: 4px;
    }
    .btn-block button {
        width: 100%;
        justify-content: center;
    }

    /* Скрыть "Расширенное меню", "Светлая тема" и т.п. в сайдбаре на мобильных */
    .btn-mode-menu,
    .btn-theme,
    .notification-btn {
        display: none !important;
    }

    /* Подвал директивы — адаптация */
    .panel_directive {
        margin-left: 0 !important;
        padding: 10px;
        font-size: 12px;
    }
    .wrapper-instrument {
        flex-direction: column;
        gap: 5px;
    }
    .hftm th{
        min-width: 120px;
    }
    .hftm th:last-child{
        min-width: 0;
    }
    input#fondsOperationsSearch {
        width: 100% !important;
    }
    /* Кнопки — в колонку или компактно */
    .btn-block {
        flex-direction: row !important;
        gap: 4px;
    }
    .btn-block .btn {
        padding: 4px 6px !important;
        font-size: 10px !important;
    }
    .btn-block .bi {
        font-size: 12px !important;
    }

    /* Итоговые строки — адаптировать */
    .total-row td {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    .table-responsive, .table-responsive > .table, .table-responsive > .table > tbody > tr, .table-responsive > .table > tbody > tr > td {
        overflow: auto !important;
    }
    .wrapper-btn {
        display: flex;
    }
    button.btn.btn-sm.btn-outline-secondary.drag-handle.me-1 {
        display: none;
    }
    .btn-group.period {
        width: 200px;
    }
    input#operationsSearch {
        width: 100% !important;
    }
    .hwr th{
        min-width: 205px;
    }
    .hwr th:last-child{
        min-width:0;
    }
    .mhfdc{
        flex-direction: column;
    }
}
@media (max-width: 991.98px) {
    .sidebar {
        width: 250px !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10000;
        box-shadow: 0 0 10px rgba(0,0,0,0.5);
    }

    .sidebar.sidebar-mobile-open {
        transform: translateX(0);
    }

    /* Контент всегда на всю ширину в мобильной версии */
    .content {
        margin-left: 0 !important;
        max-width: 100% !important;
    }
}