/* Мобильные правки области monitoring: только внутри @media, десктоп не менять */
@media (max-width: 768px) {

  /* ---------- Форма заполнения: общее ---------- */
  .reports-form .reports-table-container { max-height: none !important; -webkit-overflow-scrolling: touch; }
  .reports-form .box:hover,
  .reports-form .question-row:hover,
  .reports-form .question-row.vertical-layout:hover,
  .reports-form .subcategory-panel:hover,
  .reports-form #children-list .list-group-item:hover { transform: none !important; }
  .reports-form .box-header { flex-wrap: wrap; gap: 8px; }
  .reports-form .box-header .box-title img { max-height: 56px !important; margin-right: 8px !important; }
  .reports-form .box-footer { flex-wrap: wrap; gap: 8px; justify-content: stretch !important; }
  .reports-form .box-footer .btn { flex: 1 1 140px; }
  .reports-form .report-info > [class*="col-"] { width: 50%; margin-bottom: 8px; }
  .reports-form .report-info > .col-md-3 { width: 100%; }

  /* Вкладки категорий: скролл вбок, крупные цели */
  .reports-form .nav-tabs { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .reports-form .nav-tabs::-webkit-scrollbar { display: none; }
  .reports-form .nav-tabs > li { flex: 0 0 auto; }
  .reports-form .nav-tabs > li > a { padding: 11px 14px !important; font-size: 13px !important; white-space: nowrap; min-height: 44px; display: flex; align-items: center; }

  /* Табличный режим: узкая колонка имени */
  .reports-form .name-column,
  .reports-form .reports-table td.name-column,
  .reports-form .reports-table th.name-column { min-width: 130px !important; max-width: 150px; white-space: normal !important; font-size: 12px; }
  .reports-form .question-column { min-width: 150px !important; max-width: 170px !important; }
  .reports-form .question-description { min-height: 0 !important; }
  .reports-form .answer-options-container th { height: 110px !important; }
  .reports-form .answer-options-container td { height: 44px !important; min-width: 44px; }

  /* Карточка ребёнка: список и контент друг под другом */
  .reports-form .ic-layout { flex-direction: column !important; }
  .reports-form #ic-sidebar { width: 100% !important; min-height: 0 !important; border-right: 0 !important; border-bottom: 1px solid #eee; }
  .reports-form #ic-sidebar .ic-sidebar-body { max-height: 220px !important; }
  .reports-form #ic-sidebar + div { padding: 10px !important; min-width: 0; }

  /* Режим По детям: список детей горизонтальной лентой */
  .reports-form #tab_individual > .row > [class*="col-"] { width: 100% !important; flex: 0 0 100% !important; max-width: 100%; }
  .reports-form #children-list { max-width: 100% !important; display: flex; flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 6px; padding: 6px !important; margin-bottom: 12px; }
  .reports-form #children-list .list-group-item { flex: 0 0 auto; min-width: 150px; max-width: 220px; margin-bottom: 0 !important; min-height: 44px; }
  .reports-form #children-list .list-group-item.active { transform: none !important; }
  .reports-form #children-list .list-group-item:after { display: none; }
  .reports-form .child-tab-content { padding: 14px 10px !important; }
  .reports-form .child-tab-header { font-size: 17px !important; margin-bottom: 14px !important; padding-bottom: 10px !important; }
  .reports-form .subcategory-heading { padding: 12px !important; min-height: 44px; }
  .reports-form .subcategory-content { padding: 12px 8px !important; }

  /* Вопросы: кнопки ответов крупные на всю ширину */
  .reports-form .question-row,
  .reports-form .question-row.vertical-layout { padding: 12px 10px !important; flex-direction: column; align-items: stretch; }
  .reports-form .question-code { width: auto !important; margin-bottom: 4px; }
  .reports-form .question-header { flex-wrap: wrap; gap: 6px; }
  .reports-form .answer-btn-group { flex-direction: column !important; gap: 8px !important; width: 100%; }
  .reports-form .answer-btn,
  .reports-form .answer-btn-group .answer-btn {
    flex: 0 0 auto !important; width: 100% !important; max-width: 100% !important;
    min-height: 48px !important; padding: 10px 14px !important; font-size: 15px !important;
    white-space: normal !important; text-align: left; animation: none !important; touch-action: manipulation;
  }
  .reports-form .answer-btn:hover,
  .reports-form .answer-btn.active { transform: none !important; }
  .reports-form .activity-question { padding-right: 0 !important; }
  .reports-form .answer-badge { position: static !important; display: inline-block; margin-top: 4px; }

  /* Подсказки по hover не работают на touch */
  [data-tooltip]::after,
  [data-tooltip]::before { display: none !important; }

  /* Поля и кастомные вкладки отчётов */
  .reports-form select, .reports-form input[type="text"], .reports-form .form-control { min-height: 44px; font-size: 16px; }
  .custom-tabs-header { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .custom-tabs-header::-webkit-scrollbar { display: none; }
  .custom-tab { flex: 0 0 auto; white-space: nowrap; padding: 12px 14px; min-height: 44px; }

  /* ---------- Список отчётов (Vue) ---------- */
  .reports-index .report-actions { gap: 8px; flex-wrap: wrap; }
  .reports-index .report-actions .action-btn { width: 40px !important; height: 40px !important; }
  .empty-state-pointer { display: none !important; }
  .list-view-controls { flex-wrap: wrap; gap: 8px; }
  .list-view-controls > * { max-width: 100%; }

  /* ---------- Своды: таблицы и фильтры ---------- */
  .reports-summary .summary-table { min-width: 640px; }
  .reports-summary .summary-table td.fio,
  .reports-summary .summary-table th.fio { min-width: 120px !important; max-width: 140px !important; white-space: normal !important; font-size: 12px; }
  .reports-summary .summary-scrollable,
  .table-container, .table-scroll-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .reports-summary .btn { min-height: 44px; }
  .svod-stats, .umc-stats { grid-template-columns: 1fr 1fr !important; }
  .svod-stats > *, .umc-stats > * { min-width: 0; }
  .methodist-select, .umc-select { width: 100% !important; min-width: 0 !important; height: 44px !important; font-size: 16px !important; }

  /* Графики ECharts: ширина 100%, высота меньше */
  .reports-summary [style*="height:500px"], .reports-summary [style*="height: 500px"] { height: 360px !important; }
  .reports-summary [style*="height:350px"], .reports-summary [style*="height: 350px"] { height: 300px !important; }
  .charts-row { grid-template-columns: 1fr !important; }
  .chart-box { min-width: 0; padding: 12px !important; }

  /* ---------- Кабинет методиста / УМЦ: вкладки ---------- */
  .umc-period-tabs, .methodist-period-tabs, .umc-tabs, .methodist-tabs, .umc-main-tabs, .main-tabs, .age-group-tabs, .svod-tabs {
    display: flex; flex-wrap: nowrap !important; overflow-x: auto; width: 100% !important; max-width: 100%;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .umc-period-tabs::-webkit-scrollbar, .methodist-period-tabs::-webkit-scrollbar, .umc-tabs::-webkit-scrollbar,
  .methodist-tabs::-webkit-scrollbar, .umc-main-tabs::-webkit-scrollbar, .main-tabs::-webkit-scrollbar,
  .age-group-tabs::-webkit-scrollbar, .svod-tabs::-webkit-scrollbar { display: none; }
  .umc-period-tabs > *, .methodist-period-tabs > *, .umc-tabs > *, .methodist-tabs > *,
  .umc-main-tabs > *, .main-tabs > *, .age-group-tabs > *, .svod-tabs > * { flex: 0 0 auto; white-space: nowrap; min-height: 44px; }
  .umc-main-tabs .umc-main-tab { padding: 11px 16px !important; font-size: 13px !important; }

  /* Таблицы кабинетов: без закреплённых колонок, чтобы осталось место */
  .umc-cabinet .table-scroll-wrapper, .methodist-cabinet .table-scroll-wrapper { touch-action: pan-x pan-y; user-select: auto; cursor: auto; }
  .methodist-cabinet .sticky-col-0, .methodist-cabinet .sticky-col-1, .methodist-cabinet .sticky-col-2,
  .umc-cabinet .sticky-col-0, .umc-cabinet .sticky-col-1, .umc-cabinet .sticky-col-2 { position: static !important; left: auto !important; }
  .methodist-cabinet .sticky-col-1, .umc-cabinet .sticky-col-1 { min-width: 140px !important; }
  .methodist-cabinet .sticky-col-2, .umc-cabinet .sticky-col-2 { min-width: 110px !important; }
  #dir-table { table-layout: auto !important; min-width: 560px; }
  #dir-table th.dir-org { width: auto !important; min-width: 160px; }
  #dir-table th.dir-region { width: auto !important; min-width: 100px; }

  /* Фильтры с inline min-width в УМЦ (тестирование, аналитика) */
  .umc-cabinet select, .umc-cabinet input[type="text"], .methodist-cabinet select, .methodist-cabinet input[type="text"] { min-width: 0 !important; max-width: 100%; font-size: 16px !important; min-height: 44px; }
  .umc-cabinet [style*="grid-template-columns"], .methodist-cabinet [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .umc-cabinet [style*="display:flex"], .umc-cabinet [style*="display: flex"] { flex-wrap: wrap; }

  /* Опрос школ */
  .school-survey .ss-totals-grid, .school-survey .ss-kpi, .school-survey .ss-kpi-levels { grid-template-columns: 1fr !important; }
  .school-survey [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* ---------- Тестирование (modules/test) и оценка ---------- */
  .rp-dash, .re-dash { grid-template-columns: 1fr !important; }
  .tp-kpi { flex: 1 1 calc(50% - 8px); min-width: 140px !important; }
  .tp-filter-search { min-width: 0 !important; width: 100%; }
  .assessment-result .parameter-label { min-width: 0; }

  /* ---------- Модальные окна ---------- */
  .modal-body .table-responsive, .modal-body table { max-width: 100%; }
}

@media (max-width: 420px) {
  .reports-form .report-info > [class*="col-"] { width: 100%; }
  .svod-stats, .umc-stats { grid-template-columns: 1fr !important; }
  .tp-kpi { flex-basis: 100%; }
}
