/* Общие стили для ФПК РБ (theme_modern.css переопределяет оформление) */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Критические сообщения об ошибках */
.critical-alert {
    border: 2px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Навигация */
.navbar-brand {
    font-weight: bold;
}

.nav-dropdown-icon {
    margin-left: 0.35rem;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Выпадающее меню при наведении (desktop) */
@media (min-width: 992px) {
    .navbar .dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
    }
    .navbar .dropdown:hover > .nav-link {
        color: #fff;
    }
}

/* Карточки */
.card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Переопределение для модульных карточек - более высокая специфичность */
.card.module-card,
div.module-card,
.module-card.card {
    border: 1px solid #dbe3ee !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%) !important;
    background-color: transparent !important;
}

/* Календарь */
#calendar {
    margin-top: 2rem;
}

/* Филиалы */
.branch-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
}

.branch-list::-webkit-scrollbar {
    width: 8px;
}

.branch-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.branch-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.branch-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.branch-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #0d6efd;
    background: #f8f9fa;
    border-radius: 0.25rem;
    transition: all 0.3s;
}

.branch-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.branch-item.current-branch {
    background: #d1ecf1;
    border-left-color: #0c5460;
    font-weight: bold;
}

/* Единый стиль карточек модулей */
.module-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.module-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.module-title-icon,
.module-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #eaf2ff;
    color: #1d4ed8;
}

.module-title-icon {
    width: 36px;
    height: 36px;
    margin-right: 0.5rem;
}

.module-section-icon {
    width: 30px;
    height: 30px;
    margin-right: 0.4rem;
    font-size: 0.95rem;
}

.module-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
}

.module-card {
    border: 1px solid #dbe3ee !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%) !important;
}

.module-card .module-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eaf2ff;
    color: #1d4ed8;
    font-size: 1.1rem;
}

.module-card .module-actions .btn {
    text-align: left;
    font-weight: 600;
}

.module-card .module-actions .btn i {
    margin-right: 0.4rem;
}

.module-card .module-meta {
    color: #6c757d;
    font-size: 0.85rem;
}

.module-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
/**
 * Мобильная адаптация для проекта ФПК РБ
 * 
 * Обеспечивает корректное отображение на всех устройствах,
 * сохраняя весь функционал и интерфейс.
 */

/* ============================================
   БАЗОВЫЕ НАСТРОЙКИ ДЛЯ МОБИЛЬНЫХ
   ============================================ */

/* Улучшенный viewport для мобильных */
@media screen and (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Уменьшаем отступы контейнера */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================
   НАВИГАЦИЯ (HEADER)
   ============================================ */

@media screen and (max-width: 991px) {
    /* Навигация на мобильных */
    .navbar-nav {
        margin-top: 1rem;
    }
    
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0;
        background-color: #343a40;
        border: 0;
        box-shadow: none;
    }
    
    .navbar-nav .dropdown-item {
        color: rgba(255, 255, 255, 0.75);
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .navbar-nav .dropdown-item:hover {
        color: #fff;
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.1);
        margin: 0.5rem 0;
    }
    
    /* Бренд на мобильных */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Профиль пользователя */
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
}

/* ============================================
   ТАБЛИЦЫ
   ============================================ */

@media screen and (max-width: 768px) {
    /* Все таблицы становятся прокручиваемыми */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
    }
    
    /* Улучшаем отображение таблиц */
    .table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    
    .table th {
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    /* Карточки вместо строк для очень маленьких экранов */
    @media screen and (max-width: 576px) {
        .table-responsive {
            display: block;
        }
        
        .table-responsive table {
            display: block;
            width: 100%;
        }
        
        .table-responsive thead {
            display: none;
        }
        
        .table-responsive tbody {
            display: block;
        }
        
        .table-responsive tbody tr {
            display: block;
            margin-bottom: 1rem;
            border: 1px solid #dee2e6;
            border-radius: 0.375rem;
            background: white;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .table-responsive tbody td {
            display: block;
            text-align: right;
            padding: 0.5rem 1rem;
            border: none;
            border-bottom: 1px solid #f0f0f0;
            position: relative;
            padding-left: 50%;
        }
        
        .table-responsive tbody td:before {
            content: attr(data-label);
            position: absolute;
            left: 0;
            width: 45%;
            padding-left: 1rem;
            text-align: left;
            font-weight: 600;
            color: #495057;
        }
        
        .table-responsive tbody td:last-child {
            border-bottom: none;
        }
    }
}

/* Специальные таблицы (например, экран выполнения нормативов) */
@media screen and (max-width: 768px) {
    .execution-table-wrapper {
        font-size: 0.75rem;
    }
    
    .execution-table-wrapper table {
        min-width: 1200px;
    }
    
    .execution-table-wrapper thead th {
        font-size: 0.7rem;
        padding: 0.4rem 0.3rem;
    }
    
    .execution-table-wrapper tbody td {
        padding: 0.4rem 0.3rem;
        font-size: 0.7rem;
    }
    
    .execution-document-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.4rem;
    }
}

/* Улучшение для touch-устройств */
.touch-device * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.touch-device .btn,
.touch-device .nav-link,
.touch-device .dropdown-item {
    min-height: 44px; /* Минимальный размер для удобного нажатия */
    display: flex;
    align-items: center;
}

/* Закрытие dropdown при клике на затемненный фон */
.multi-select-container.active::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Клик на затемненный фон закрывает dropdown */
.multi-select-container.active::after {
    cursor: pointer;
}

/* ============================================
   ФИЛЬТРЫ (МУЛЬТИСЕЛЕКТ)
   ============================================ */

@media screen and (max-width: 768px) {
    /* Мультиселект фильтры */
    .multi-select-container {
        margin-bottom: 1rem;
        position: relative;
    }
    
    .multi-select-input {
        min-height: 44px;
        font-size: 16px; /* Предотвращает зум на iOS */
        cursor: pointer;
    }
    
    .multi-select-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        width: 90vw !important;
        max-width: 500px !important;
        max-height: 70vh !important;
        z-index: 1050 !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.3);
        border-radius: 0.5rem;
        background: white;
        border: 1px solid #dee2e6;
    }
    
    
    .multi-select-options {
        max-height: calc(70vh - 100px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .multi-select-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    
    .multi-select-item label {
        font-size: 0.95rem;
        margin-left: 0.5rem;
    }
    
    .multi-select-search input {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 0.75rem;
    }
    
    .selected-tags {
        margin-top: 0.5rem;
    }
    
    .selected-tags .badge {
        margin: 0.25rem;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   СПЕЦИАЛЬНЫЕ КОМПОНЕНТЫ МОДУЛЕЙ
   ============================================ */

/* Управление нормативами - боковая панель */
@media screen and (max-width: 991px) {
    .normative-manage-card {
        margin-bottom: 1.5rem;
    }
}

/* Экран выполнения нормативов - фильтры */
@media screen and (max-width: 768px) {
    .execution-table-wrapper {
        margin: 0 -0.75rem;
    }
    
    #executionStats .row > div {
        margin-bottom: 0.75rem;
    }
    
    #executionStats h5 {
        font-size: 0.9rem;
    }
    
    #executionStats h2 {
        font-size: 1.5rem;
    }
}

/* Список документов нормативов */
@media screen and (max-width: 768px) {
    .table-responsive table {
        min-width: 800px;
    }
}

/* Дашборд нормативов */
@media screen and (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
}

/* Отчеты нормативов */
@media screen and (max-width: 768px) {
    .card.shadow-sm {
        margin-bottom: 1rem;
    }
    
    .card-header h5 {
        font-size: 0.95rem;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ГОРИЗОНТАЛЬНОЙ ПРОКРУТКИ
   ============================================ */

@media screen and (max-width: 768px) {
    /* Улучшаем горизонтальную прокрутку таблиц */
    .table-responsive {
        position: relative;
    }
    
    .table-responsive::before,
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        z-index: 1;
        pointer-events: none;
    }
    
    .table-responsive::before {
        left: 0;
        background: linear-gradient(to right, rgba(245, 245, 245, 0.9), transparent);
    }
    
    .table-responsive::after {
        right: 0;
        background: linear-gradient(to left, rgba(245, 245, 245, 0.9), transparent);
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ФОРМ
   ============================================ */

@media screen and (max-width: 768px) {
    /* Группы полей в формах */
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    /* Кнопки в формах */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Чекбоксы и радиокнопки */
    .form-check {
        margin-bottom: 0.75rem;
        padding-left: 1.75rem;
    }
    
    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        margin-top: 0.2rem;
    }
    
    .form-check-label {
        font-size: 0.9rem;
        padding-left: 0.5rem;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ СПИСКОВ И КАРТОЧЕК
   ============================================ */

@media screen and (max-width: 768px) {
    /* Списки */
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Карточки статистики */
    .card.shadow-lg {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    }
    
    /* Иконки в карточках */
    .card-body i[style*="font-size: 3rem"] {
        font-size: 2rem !important;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ТАБЛИЦ С ДЕЙСТВИЯМИ
   ============================================ */

@media screen and (max-width: 576px) {
    /* Кнопки действий в таблицах */
    .table-actions,
    .normative-table-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        white-space: normal;
    }
    
    .table-actions .btn,
    .normative-table-actions .btn {
        width: 100%;
        margin: 0;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ГРАФИКОВ
   ============================================ */

@media screen and (max-width: 768px) {
    .chart-container {
        height: 250px !important;
        margin: 1rem 0;
    }
    
    /* Графики Chart.js */
    canvas {
        max-width: 100%;
        height: auto !important;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ПАГИНАЦИИ
   ============================================ */

@media screen and (max-width: 576px) {
    .pagination {
        font-size: 0.8rem;
    }
    
    .page-link {
        padding: 0.35rem 0.5rem;
        min-width: 36px;
    }
    
    .pagination .page-item:not(:first-child):not(:last-child) .page-link {
        display: none;
    }
    
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        display: block;
    }
    
    /* Показываем только первую, последнюю и текущую страницу */
    .pagination .page-item.active .page-link {
        display: block;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ХЛЕБНЫХ КРОШЕК
   ============================================ */

@media screen and (max-width: 576px) {
    .breadcrumb {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .breadcrumb-item {
        display: inline-block;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ЗАГОЛОВКОВ С КНОПКАМИ
   ============================================ */

@media screen and (max-width: 768px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between h1,
    .d-flex.justify-content-between h2,
    .d-flex.justify-content-between h3 {
        margin-bottom: 0;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ ЛЕГЕНДЫ И ИНФОРМАЦИОННЫХ БЛОКОВ
   ============================================ */

@media screen and (max-width: 768px) {
    .alert {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .alert h4,
    .alert h5,
    .alert h6 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   УЛУЧШЕНИЯ ДЛЯ СПЕЦИАЛЬНЫХ ТАБЛИЦ
   ============================================ */

@media screen and (max-width: 768px) {
    /* Таблицы с множеством колонок */
    .table-responsive-acceptance {
        font-size: 0.75rem;
    }
    
    .table-responsive-acceptance table {
        min-width: 1500px;
    }
    
    .table-responsive-acceptance thead th {
        font-size: 0.7rem;
        padding: 0.4rem 0.3rem;
    }
    
    .table-responsive-acceptance tbody td {
        font-size: 0.7rem;
        padding: 0.4rem 0.3rem;
    }
}

/* ============================================
   ФОРМЫ И ФИЛЬТРЫ
   ============================================ */

@media screen and (max-width: 768px) {
    /* Формы */
    .form-control,
    .form-select {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 500;
        margin-bottom: 0.4rem;
    }
    
    /* Кнопки */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Мультиселект фильтры */
    .multi-select-container {
        position: relative;
    }
    
    .multi-select-dropdown {
        max-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .multi-select-options {
        max-height: 250px;
    }
    
    .selected-tags {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .selected-tags .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ============================================
   КАРТОЧКИ (CARDS)
   ============================================ */

@media screen and (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* Статистические карточки */
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* ============================================
   СЕТКА (GRID)
   ============================================ */

@media screen and (max-width: 768px) {
    /* Колонки на мобильных становятся полной ширины */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* Специальные случаи - 2 колонки на средних экранах */
    @media screen and (min-width: 576px) and (max-width: 768px) {
        .col-md-3 {
            flex: 0 0 50%;
            max-width: 50%;
        }
        
        .col-md-4 {
            flex: 0 0 50%;
            max-width: 50%;
        }
    }
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА
   ============================================ */

@media screen and (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .modal-header .btn-close {
        margin-left: auto;
        margin-top: -0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 100px;
        margin: 0;
    }
    
    /* На очень маленьких экранах модальное окно на всю высоту */
    @media screen and (max-width: 576px) {
        .modal-dialog {
            margin: 0;
            max-width: 100%;
            height: 100vh;
        }
        
        .modal-content {
            height: 100%;
            border-radius: 0;
        }
        
        .modal-body {
            max-height: calc(100vh - 150px);
        }
    }
}

/* ============================================
   ХЛЕБНЫЕ КРОШКИ (BREADCRUMBS)
   ============================================ */

@media screen and (max-width: 768px) {
    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        margin-bottom: 1rem;
    }
    
    .breadcrumb-item {
        display: inline-block;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.5rem;
    }
}

/* ============================================
   ЗАГОЛОВКИ
   ============================================ */

@media screen and (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    h5 {
        font-size: 1rem;
    }
}

/* ============================================
   АЛЕРТЫ (ALERTS)
   ============================================ */

@media screen and (max-width: 768px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .alert-dismissible {
        padding-right: 3rem;
    }
}

/* ============================================
   ПАГИНАЦИЯ
   ============================================ */

@media screen and (max-width: 768px) {
    .pagination {
        font-size: 0.85rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 0.4rem 0.6rem;
    }
}

/* ============================================
   БЕЙДЖИ И МЕТКИ
   ============================================ */

@media screen and (max-width: 768px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .badge-lg {
        font-size: 0.85rem;
        padding: 0.35rem 0.65rem;
    }
}

/* ============================================
   СПЕЦИАЛЬНЫЕ КОМПОНЕНТЫ
   ============================================ */

/* Фильтры в боковой панели */
@media screen and (max-width: 991px) {
    .col-md-3:has(.card.shadow-sm) {
        margin-bottom: 1.5rem;
    }
}

/* Графики Chart.js */
@media screen and (max-width: 768px) {
    .chart-container {
        height: 250px !important;
    }
}

/* Таблицы с действиями */
@media screen and (max-width: 576px) {
    .table-actions {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-actions .btn {
        width: 100%;
    }
}

/* ============================================
   УТИЛИТЫ
   ============================================ */

/* Скрытие на мобильных */
@media screen and (max-width: 768px) {
    .d-none-mobile {
        display: none !important;
    }
}

/* Показ только на мобильных */
@media screen and (min-width: 769px) {
    .d-mobile-only {
        display: none !important;
    }
}

/* Улучшенная прокрутка */
@media screen and (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Улучшаем скроллбар на мобильных */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* ============================================
   ОПТИМИЗАЦИЯ ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ
   ============================================ */

@media screen and (max-width: 375px) {
    body {
        font-size: 13px;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
}
/* Стили для модульных карточек с цветными кнопками */

/* Стили для кнопок на карточках модулей */
.module-actions .btn {
    transition: all 0.2s ease;
    font-weight: 500;
    border: none;
}

.module-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Принудительные стили для модульных карточек */
.card.module-card,
div.card.module-card,
.module-card.card,
div.module-card,
[class*="module-card"] {
    border: 1px solid #dbe3ee !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%) !important;
    background-color: transparent !important;
}

.module-icon,
span.module-icon,
[class*="module-icon"] {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #eaf2ff !important;
    color: #1d4ed8 !important;
    font-size: 1.1rem !important;
}

.module-icon i {
    color: inherit !important;
}
/* Единый минималистичный стиль для всех модулей */
/* Основан на дизайне модуля "Плавность хода" */

/* ============================================
   ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ МОДУЛЕЙ
   ============================================ */

/* Контейнер модуля */
.module-container {
    padding: 1.5rem 0;
}

/* Заголовок модуля */
.module-title {
    font-size: 2rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.module-title i {
    color: #0d6efd;
}

/* Подзаголовок модуля */
.module-subtitle {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* ============================================
   КАРТОЧКИ МОДУЛЕЙ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

/* Базовые карточки модулей */
.module-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
    height: 100%;
    overflow: hidden;
}

.module-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Заголовок карточки */
.module-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-radius: 12px 12px 0 0;
}

.module-card .card-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
}

.module-card .card-header.bg-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
}

.module-card .card-header.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
}

.module-card .card-header.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
}

.module-card .card-header.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
}

.module-card .card-header.bg-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

/* Тело карточки */
.module-card .card-body {
    padding: 1.5rem;
}

/* Навигационные карточки (как в Плавность хода) */
.module-nav-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
    height: 100%;
    text-align: center;
    padding: 2rem 1.5rem;
}

.module-nav-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-color: #0d6efd;
}

.module-nav-card.border-primary:hover {
    border-color: #0d6efd;
}

.module-nav-card.border-success:hover {
    border-color: #198754;
}

.module-nav-card.border-info:hover {
    border-color: #0dcaf0;
}

.module-nav-card.border-warning:hover {
    border-color: #ffc107;
}

.module-nav-card.border-danger:hover {
    border-color: #dc3545;
}

.module-nav-card.border-secondary:hover {
    border-color: #6c757d;
}

/* Иконки в навигационных карточках */
.module-nav-card i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.module-nav-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #212529;
}

.module-nav-card .card-text {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    min-height: 2.5rem;
}

/* ============================================
   КНОПКИ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

/* Базовые кнопки */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Цветные кнопки */
.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #146c43 0%, #0f5132 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
    color: #000;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0aa2c0 0%, #087990 100%);
    color: #000;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffb300 0%, #cc8f00 100%);
    color: #000;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b02a37 0%, #842029 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    color: white;
}

/* Кнопки outline */
.btn-outline-primary {
    border: 2px solid #0d6efd;
    color: #0d6efd;
    background: transparent;
}

.btn-outline-primary:hover {
    background: #0d6efd;
    color: white;
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

/* Размеры кнопок */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* ============================================
   ФОРМЫ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

/* Контейнер формы */
.form-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Группы полей формы */
.form-group {
    margin-bottom: 1.5rem;
}

/* Метки полей */
.form-label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label i {
    color: #0d6efd;
    font-size: 1.1rem;
}

.form-label .text-danger {
    color: #dc3545;
    margin-left: 0.25rem;
}

/* Поля ввода */
.form-control,
.form-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #ffffff;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    outline: none;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #198754;
}

/* Текст помощи */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Ошибки формы */
.invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invalid-feedback i {
    font-size: 1rem;
}

/* Карточки в формах */
.form-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.form-card .card-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.form-card .card-body {
    padding: 1.5rem;
}

/* ============================================
   СТАТИСТИЧЕСКИЕ КАРТОЧКИ
   ============================================ */

.stat-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
    height: 100%;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.stat-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.stat-card .card-body {
    padding: 1.5rem;
    text-align: center;
}

.stat-card h2,
.stat-card h3 {
    font-weight: 700;
    margin: 0;
}

/* ============================================
   ТАБЛИЦЫ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #e0e0e0;
}

/* ============================================
   АЛЕРТЫ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alert-primary {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(0, 86, 179, 0.1) 100%);
    color: #0d6efd;
    border-left: 4px solid #0d6efd;
}

.alert-success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(20, 108, 67, 0.1) 100%);
    color: #198754;
    border-left: 4px solid #198754;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 179, 0, 0.1) 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(176, 42, 55, 0.1) 100%);
    color: #dc3545;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.1) 0%, rgba(10, 162, 192, 0.1) 100%);
    color: #0dcaf0;
    border-left: 4px solid #0dcaf0;
}

/* ============================================
   ХЛЕБНЫЕ КРОШКИ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* ============================================
   БЭДЖИ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
}

.badge.rounded-pill {
    border-radius: 50rem;
}

/* ============================================
   СПИСКИ (ЕДИНЫЙ СТИЛЬ)
   ============================================ */

.list-group-item {
    border: 1px solid #e0e0e0;
    padding: 1rem 1.5rem;
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
}

.list-group-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 768px) {
    .module-title {
        font-size: 1.5rem;
    }
    
    .module-nav-card {
        padding: 1.5rem 1rem;
    }
    
    .module-nav-card i {
        font-size: 2.5rem;
    }
    
    .form-container {
        padding: 1.5rem;
    }
}

/* ============================================
   УТИЛИТЫ
   ============================================ */

.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12) !important;
}

.shadow-lg {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Плавные переходы — НЕ применяем к select/option/input чтобы не блокировать нативные дропдауны */
.btn,
.card,
.alert,
.badge,
.list-group-item,
.module-card,
.stat-card,
.nav-link,
.breadcrumb-item a {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Гарантируем, что нативные form-элементы не имеют паразитных transition */
select,
select option,
input[type="date"],
.form-select,
.form-control {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}
/* Тема оформления ФПК РБ — улучшенный вид при тёмной шапке */

:root {
    --fpk-bg: #f1f3f5;
    --fpk-surface: #ffffff;
    --fpk-border: #dee2e6;
    --fpk-card-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body {
    background: var(--fpk-bg) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.5;
}

/* Контент — компактный отступ сверху */
.container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 0.5rem;
}

@media (min-width: 768px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
        padding-top: 0.75rem;
    }
}

/* Карточки — мягкие тени, скругления */
.card {
    border: 1px solid var(--fpk-border) !important;
    border-radius: 12px !important;
    box-shadow: var(--fpk-card-shadow) !important;
    background: var(--fpk-surface) !important;
}

.card-header {
    padding: 0.875rem 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1rem 1.25rem;
}

/* Статистические карточки — лёгкий hover */
.stat-card {
    border-radius: 12px !important;
    transition: box-shadow 0.2s !important;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important;
}

/* Алерты — скругления */
.alert {
    border-radius: 10px;
}

/* Карточки админ-дашборда — тени, лёгкий акцент по левому краю */
.admin-dashboard-card {
    background: #ffffff !important;
    border: 1px solid #e2e6ea !important;
    border-left: 3px solid #6c757d !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.06) !important;
    transition: box-shadow 0.2s ease, transform 0.15s ease !important;
}

.admin-dashboard-card:hover {
    box-shadow: 0 10px 28px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08) !important;
}

a.admin-card-link:hover .admin-dashboard-card {
    transform: translateY(-1px);
}

.admin-card-number {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.admin-card-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

/* Компактная шапка — поуже, без лишнего отступа сверху */
body {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.navbar {
    min-height: 44px !important;
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
    margin-bottom: 0 !important;
}

.navbar .container-fluid {
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
}

html {
    scroll-padding-top: 0;
}

.navbar .navbar-brand {
    font-size: 1.1rem;
}

.navbar .nav-link,
.navbar-nav .nav-link {
    font-size: 0.9rem !important;
    padding: 0.35rem 0.6rem !important;
}


/* ============================================
   ИНЛАЙН-СТИЛИ ИЗ BASE.HTML (перенесены)
   ============================================ */

.module-card {
    border: 1px solid #dbe3ee !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%) !important;
}
.module-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #eaf2ff !important;
    color: #1d4ed8 !important;
    font-size: 1.1rem !important;
}
.module-icon i { color: inherit !important; }
.module-title-icon,
.module-section-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    background: #eaf2ff !important;
    color: #1d4ed8 !important;
}
.module-title-icon { width: 36px !important; height: 36px !important; margin-right: 0.5rem !important; }
.module-section-icon { width: 30px !important; height: 30px !important; margin-right: 0.4rem !important; font-size: 0.95rem !important; }
.nav-dropdown-icon { margin-left: 0.35rem; font-size: 0.75rem; opacity: 0.8; }

.module-actions .btn,
.module-actions a.btn {
    background-color: var(--bs-btn-bg, #0d6efd) !important;
    border-color: var(--bs-btn-border-color, #0d6efd) !important;
    color: var(--bs-btn-color, #fff) !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}
.module-actions .btn-primary, .module-actions a.btn-primary { background-color: #0d6efd !important; border-color: #0d6efd !important; color: #fff !important; }
.module-actions .btn-success, .module-actions a.btn-success { background-color: #198754 !important; border-color: #198754 !important; color: #fff !important; }
.module-actions .btn-info, .module-actions a.btn-info { background-color: #0dcaf0 !important; border-color: #0dcaf0 !important; color: #000 !important; }
.module-actions .btn-warning, .module-actions a.btn-warning { background-color: #ffc107 !important; border-color: #ffc107 !important; color: #000 !important; }
.module-actions .btn-danger, .module-actions a.btn-danger { background-color: #dc3545 !important; border-color: #dc3545 !important; color: #fff !important; }
.module-actions .btn-secondary, .module-actions a.btn-secondary { background-color: #6c757d !important; border-color: #6c757d !important; color: #fff !important; }
.module-actions .btn-outline-secondary, .module-actions a.btn-outline-secondary { background-color: transparent !important; border-color: #6c757d !important; color: #6c757d !important; }
.module-actions .btn:hover, .module-actions a.btn:hover { transform: translateY(-2px) !important; box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important; opacity: 0.9 !important; }

@media (min-width: 992px) {
    .navbar .dropdown:hover > .dropdown-menu { display: block; margin-top: 0; }
}
.navbar { position: sticky; top: 0; z-index: 1030; }
.navbar-nav { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; }
.navbar-nav .nav-item { position: relative; margin: 0 0.25rem; }
.navbar-nav .nav-link { padding: 0.5rem 1rem; white-space: nowrap; }
.navbar-nav .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; min-width: 200px; }
.navbar-nav .dropdown-menu-end { right: 0; left: auto; }
.navbar-toggler { border: none; padding: 0.25rem 0.5rem; }
.navbar-collapse { flex-grow: 1; }
