/* 🌴 ОАЗИС TEAM - Дизайн-система */

:root {
  --ocean-blue: #0B3C5D;
  --sky-blue: #4FA3D1;
  --aqua-accent: #3EDBF0;
  --sand-light: #F2E8D5;
  --bg-dark: #0E1621;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.2);
  --primary: #3EDBF0;
  --warning: #FFA500;
  --danger: #FF4444;
  --success: #4CAF50;
  
  /* Трендовые эффекты 2026 */
  --glow-primary: 0 0 20px rgba(62, 219, 240, 0.4), 0 0 40px rgba(62, 219, 240, 0.2);
  --glow-hover: 0 0 30px rgba(62, 219, 240, 0.6), 0 0 60px rgba(62, 219, 240, 0.3);
  --gradient-primary: linear-gradient(135deg, #4FA3D1 0%, #3EDBF0 50%, #0B3C5D 100%);
  --gradient-animated: linear-gradient(135deg, #4FA3D1 0%, #3EDBF0 25%, #0B3C5D 50%, #3EDBF0 75%, #4FA3D1 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Скрываем скроллбары, но оставляем возможность прокрутки */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE и Edge */
}

*::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Для таблиц оставляем возможность горизонтального скролла, но скрываем скроллбар */
.table-container {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-container::-webkit-scrollbar {
  display: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(62, 219, 240, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(79, 163, 209, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(11, 60, 93, 0.15) 0%, transparent 50%);
  background-size: 100% 100%, 100% 100%, 100% 100%;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Улучшаем touch на мобильных */
  -webkit-tap-highlight-color: rgba(62, 219, 240, 0.2);
  touch-action: manipulation;
}

/* Анимированный градиентный фон (легкий, оптимизированный) */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 30% 40%, rgba(62, 219, 240, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(79, 163, 209, 0.04) 0%, transparent 50%);
  animation: gradientShift 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

@keyframes gradientShift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(5%, 5%) scale(1.1);
  }
}

/* Обеспечиваем, что контент выше фона */
#app,
.main-content {
  position: relative;
  z-index: 1;
}

/* Glassmorphism - улучшенная версия 2026 */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-deep);
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

/* Эффект свечения при hover */
.glass:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(62, 219, 240, 0.1);
  border-color: rgba(62, 219, 240, 0.3);
}

/* Градиентная граница для премиум эффекта */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(62, 219, 240, 0.3), rgba(79, 163, 209, 0.1), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.glass:hover::before {
  opacity: 1;
}

.glass-light {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
}

/* Градиентные заголовки только для основных заголовков страниц */
.page-header h1,
.page-header h2,
.card-title {
  position: relative;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--aqua-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: titleGradient 4s ease infinite;
  will-change: background-position;
}

@keyframes titleGradient {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.text-large { font-size: 1.5rem; }
.text-small { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* Numbers */
.number-large {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--aqua-accent);
  line-height: 1;
}

.number-medium {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--sky-blue);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  /* Улучшаем touch на мобильных */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  /* Минимальный размер для touch */
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  color: white;
  box-shadow: 0 4px 12px rgba(79, 163, 209, 0.3), var(--glow-primary);
  position: relative;
  overflow: hidden;
  will-change: transform, background-position;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Анимированный градиент */
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(79, 163, 209, 0.5), var(--glow-hover);
  background-position: 100% 0;
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, background, border-color;
}

.btn-secondary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(62, 219, 240, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-secondary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(62, 219, 240, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(62, 219, 240, 0.2);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--aqua-accent);
  box-shadow: 
    0 0 0 3px rgba(62, 219, 240, 0.1),
    0 0 20px rgba(62, 219, 240, 0.2);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* Темная тема для выпадающих списков, чтобы не сливался белый текст на ярком фоне */
.form-select {
  background-color: var(--bg-dark);
  color: var(--text-primary);
}

.form-select option {
  background-color: #020617; /* очень темный фон в списке */
  color: #f9fafb;
}

.form-select option:checked,
.form-select option:hover {
  background-color: #1f2937; /* тёмно-серый вместо ядовито-синего */
  color: #f9fafb;
}

/* Улучшенный селектор для дашборда */
/* Стили для селектора периода в дашборде */
.month-selector-wrapper {
  position: relative;
}

.month-selector-wrapper i[data-lucide="calendar"] {
  z-index: 1;
}

.month-selector-custom,
#month-selector {
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 12px !important;
  padding: 0.875rem 2.75rem 0.875rem 3rem !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%233edbf0" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') !important;
  background-repeat: no-repeat !important;
  background-position: right 0.875rem center !important;
  background-size: 1.125rem !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  min-width: 240px !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.month-selector-custom:hover,
#month-selector:hover {
  background-color: rgba(62, 219, 240, 0.08) !important;
  border-color: var(--aqua-accent) !important;
  transform: translateY(-2px) !important;
  box-shadow: 
    0 6px 20px rgba(62, 219, 240, 0.25),
    0 0 0 1px rgba(62, 219, 240, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.month-selector-custom:focus,
#month-selector:focus {
  outline: none !important;
  border-color: var(--aqua-accent) !important;
  background-color: rgba(62, 219, 240, 0.1) !important;
  box-shadow: 
    0 0 0 3px rgba(62, 219, 240, 0.15),
    0 6px 20px rgba(62, 219, 240, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.month-selector-custom option,
#month-selector option {
  background: rgba(15, 23, 42, 0.95) !important;
  color: #ffffff !important;
  padding: 0.75rem 1rem !important;
  border-radius: 8px !important;
}

.month-selector-custom option:hover,
#month-selector option:hover {
  background: rgba(62, 219, 240, 0.2) !important;
  color: #ffffff !important;
}

.month-selector-custom option:checked,
#month-selector option:checked {
  background: rgba(62, 219, 240, 0.3) !important;
  color: var(--aqua-accent) !important;
  font-weight: 600 !important;
}

/* Cards - с 3D эффектом */
.card {
  padding: 2rem;
  margin-bottom: 1.5rem;
  transform-style: preserve-3d;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.card:hover {
  transform: translateY(-4px) rotateX(2deg);
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(62, 219, 240, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Ограничение ширины контента для читаемости на больших экранах */
.main-content {
  max-width: 100%;
}

@media (min-width: 1920px) {
  .main-content {
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
  }
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  animation: headerLine 2s ease infinite;
}

@keyframes headerLine {
  0%, 100% {
    width: 100px;
    opacity: 1;
  }
  50% {
    width: 200px;
    opacity: 0.7;
  }
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: rgba(11, 60, 93, 0.8);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 2rem 0 0 0;
  z-index: 100;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Убираем overflow-y, чтобы контролировать скролл внутри */
}

.sidebar > nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 2rem;
}

.sidebar-logo {
  flex-shrink: 0;
  padding: 0 2rem 2rem 2rem;
}

/* Мобильная кнопка меню */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 101;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  min-width: 44px; /* Минимальный размер для touch */
  min-height: 44px;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlayFadeIn 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar-logo {
  padding: 0 2rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Стили для текстового логотипа (если понадобится) */
.sidebar-logo h1 {
  font-size: 1.5rem;
  color: var(--aqua-accent);
  margin: 0;
}

.logo-image {
  max-width: 100%;
  height: auto;
  max-height: 120px;
  min-height: 80px;
  width: auto;
  object-fit: contain;
  display: block;
}

.login-logo {
  max-width: 300px;
  width: 100%;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
  min-height: 100px;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-item {
  margin: 0.5rem 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  position: relative;
  overflow: hidden;
  will-change: transform, background, color;
}

.sidebar-nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.sidebar-nav-link:hover::before {
  transform: scaleY(1);
}

.sidebar-nav-link.active {
  color: var(--aqua-accent);
  background: rgba(62, 219, 240, 0.1);
  border-left-color: var(--aqua-accent);
  transform: translateX(4px);
}

.sidebar-nav-link.active::before {
  transform: scaleY(1);
}

.sidebar-nav-link svg {
  width: 20px;
  height: 20px;
}

/* Блок информации о пользователе в сайдбаре */
.sidebar-user-info {
  flex-shrink: 0;
  padding: 1.5rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  margin-top: auto; /* Прижимаем к низу */
  order: 999; /* Всегда в конце */
}

.sidebar-user-details {
  flex: 1;
  min-width: 0; /* Позволяет тексту обрезаться при необходимости */
  overflow: hidden;
}

.sidebar-user-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  margin-left: 280px;
  padding: 2rem;
  min-height: 100vh;
  width: calc(100% - 280px);
  box-sizing: border-box;
}

/* На мобильных устройствах контент занимает всю ширину */
@media (max-width: 1023px) {
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-top: 4rem; /* Отступ сверху для кнопки меню */
  }
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 2rem;
  border-radius: 12px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* Минимальная ширина для горизонтального скролла на мобильных */
}

.table th {
  text-align: left;
  padding: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap; /* Предотвращаем перенос текста в заголовках */
}

  .table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    word-wrap: break-word; /* Разрешаем перенос длинных слов */
  }

/* Черный текст на белых/светлых фонах - только для реально белых фонов */
.card-white .table th,
.card-white .table td,
.modal-white .table th,
.modal-white .table td {
  color: #000 !important;
}

/* Для обычных таблиц в glass - белый текст */
.glass .table th,
.glass .table td {
  color: var(--text-primary);
}

/* Для белых карточек и модалок */
.card-white,
.modal-white,
.white-bg {
  background: #ffffff !important;
  color: #000 !important;
}

.card-white *,
.modal-white *,
.white-bg * {
  color: #000 !important;
}

.card-white .form-label,
.modal-white .form-label,
.white-bg .form-label {
  color: #333 !important;
}

.table tr {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.table tr::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.3s ease;
}

.table tr:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.table tr:hover::before {
  transform: scaleY(1);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(62, 219, 240, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(62, 219, 240, 0.2);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientText 3s ease infinite;
  will-change: background-position;
}

@keyframes gradientText {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.stat-change {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.stat-change.positive {
  color: #10b981;
}

.stat-change.negative {
  color: #ef4444;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.badge::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.badge:hover {
  transform: scale(1.1);
}

.badge:hover::before {
  width: 200px;
  height: 200px;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(62, 219, 240, 0.2);
  color: var(--aqua-accent);
  border: 1px solid rgba(62, 219, 240, 0.3);
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(14, 22, 33, 0.95);
  backdrop-filter: blur(8px);
  margin: 0;
  padding: 0;
}

#main-content .loading {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(14, 22, 33, 0.95) !important;
}

.loading .spinner {
  position: relative;
  margin: 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--aqua-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: relative;
}

.spinner::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: rgba(62, 219, 240, 0.3);
  animation: spin 1.2s linear infinite reverse;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: #f59e0b;
}

.alert-info {
  background: rgba(62, 219, 240, 0.1);
  border-color: var(--aqua-accent);
  color: var(--aqua-accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  animation: overlayFadeIn 0.3s ease;
}

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

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    var(--shadow-deep),
    0 0 40px rgba(62, 219, 240, 0.1);
  animation: modalAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.modal-title {
  font-size: 1.5rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Оптимизация производительности */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  body::before {
    animation: none !important;
  }
  
  .stat-value,
  .page-header h1,
  .page-header h2,
  .card-title {
    animation: none !important;
    background: var(--aqua-accent) !important;
    -webkit-text-fill-color: var(--aqua-accent) !important;
  }
  
  .page-header::after {
    animation: none !important;
  }
}

/* GPU ускорение для критических элементов */
.glass,
.btn,
.card,
.stat-card,
.sidebar-nav-link,
.table tr {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

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

/* Большие экраны (1920px+) */
@media (min-width: 1920px) {
  .container {
    max-width: 1800px;
  }
  
  .main-content {
    padding: 2rem 3rem;
  }
  
  .card {
    padding: 2.5rem;
  }
  
  h1 { font-size: 3rem; }
  h2 { font-size: 2.5rem; }
  h3 { font-size: 2rem; }
}

/* Десктопы (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
  .container {
    max-width: 1400px;
  }
  
  .main-content {
    padding: 2rem;
  }
}

/* Ноутбуки (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
  .container {
    max-width: 1200px;
    padding: 0 1.5rem;
  }
  
  .main-content {
    padding: 1.5rem;
  }
  
  .sidebar {
    width: 260px;
  }
  
  .main-content {
    margin-left: 260px;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
}

/* Большие телефоны / маленькие планшеты (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar-user-name {
    font-size: 0.9rem;
  }
  
  .sidebar-user-email {
    font-size: 0.7rem;
  }
  .container {
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1rem;
    padding-top: 4.5rem; /* Отступ для кнопки меню */
  }
  
  .sidebar {
    width: 100%;
    max-width: 100%;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    padding-bottom: 0;
  }
  
  .sidebar > nav {
    padding: 0 1.5rem;
  }
  
  .sidebar-user-info {
    padding: 1.25rem 1.5rem;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .card {
    padding: 1.25rem;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
  }
  
  .btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
  
  .modal {
    max-width: 90%;
    padding: 1.5rem;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }
}

/* Современные смартфоны (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
  .sidebar-user-info {
    padding: 1.25rem 1.5rem;
  }
  
  .sidebar-user-name {
    font-size: 0.9rem;
  }
  
  .sidebar-user-email {
    font-size: 0.7rem;
  }
  
  .sidebar-logout-btn {
    padding: 10px;
    min-width: 44px;
  }
  .container {
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1rem;
    padding-top: 4.5rem; /* Отступ для кнопки меню */
  }
  
  .sidebar {
    width: 100%;
    max-width: 100%;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    padding-bottom: 0;
  }
  
  .sidebar > nav {
    padding: 0 1.5rem;
  }
  
  .sidebar-user-info {
    padding: 1.25rem 1.5rem;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .card-title {
    font-size: 1.25rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
    font-size: 0.875rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 0.875rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  
  .modal {
    max-width: 95%;
    padding: 1.25rem;
    margin: 1rem;
  }
  
  .modal-overlay {
    padding: 1rem;
  }
  
  .modal-title {
    font-size: 1.25rem;
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }
  
  .page-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  /* Адаптация кнопок в page-header для средних экранов */
  .page-header.flex-between .btn {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
  }
  
  .top-bar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .user-menu {
    width: 100%;
    justify-content: space-between;
  }
}

/* Старые и компактные телефоны (320px - 480px) */
@media (max-width: 480px) {
  .sidebar-user-info {
    padding: 1rem 1.5rem;
  }
  
  .sidebar-user-details {
    flex: 1;
    min-width: 0;
  }
  
  .sidebar-user-name {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
  }
  
  .sidebar-user-email {
    font-size: 0.65rem;
  }
  
  .sidebar-logout-btn {
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
  }
  
  .sidebar-logout-btn svg {
    width: 18px;
    height: 18px;
  }
  html {
    font-size: 14px; /* Уменьшаем базовый размер шрифта */
  }
  
  .container {
    max-width: 100%;
    padding: 0 0.75rem;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0.75rem;
    padding-top: 4rem; /* Отступ для кнопки меню */
    box-sizing: border-box;
  }
  
  .sidebar {
    width: 100%;
    max-width: 100%;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 0;
  }
  
  .sidebar > nav {
    padding: 0 1.5rem;
  }
  
  .sidebar-user-info {
    padding: 1rem 1.5rem;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.625rem;
    min-width: 44px; /* Стандартный размер для touch */
    min-height: 44px;
  }
  
  /* На очень маленьких экранах сайдбар также на полный экран */
  @media (max-width: 360px) {
    .sidebar {
      width: 100%;
      max-width: 100%;
    }
    
    .main-content {
      padding: 0.5rem;
      padding-top: 3.5rem;
    }
  }
  
  .sidebar-logo {
    padding: 0 1.5rem 1.5rem;
    justify-content: flex-start;
  }
  
  .logo-image {
    max-height: 90px;
    min-height: 60px;
  }
  
  .sidebar-nav-link {
    padding: 10px 1.5rem;
    font-size: 0.9rem;
  }
  
  .card {
    padding: 0.875rem;
    margin-bottom: 0.875rem;
    border-radius: 12px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.75rem;
  }
  
  .card-title {
    font-size: 1.125rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 0.875rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.875rem;
    padding: 0 0.875rem;
    position: relative;
  }
  
  .table-container::after {
    content: '→';
    position: sticky;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--aqua-accent);
    font-size: 1.5rem;
    pointer-events: none;
    opacity: 0.5;
    margin-right: 0.5rem;
  }
  
  .table {
    min-width: 500px;
    font-size: 0.8rem;
    width: 100%;
  }
  
  .table th,
  .table td {
    padding: 0.625rem 0.375rem;
  }
  
  .table th {
    font-size: 0.7rem;
    padding: 0.5rem 0.375rem;
  }
  
  .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    gap: 6px;
  }
  
  .btn svg {
    width: 16px;
    height: 16px;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.375rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    padding: 8px 12px;
    font-size: 0.875rem;
    border-radius: 6px;
  }
  
  .form-textarea {
    min-height: 100px;
  }
  
  .modal {
    max-width: calc(100vw - 1rem);
    width: calc(100vw - 1rem);
    padding: 1rem;
    margin: 0.5rem;
    border-radius: 12px;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }
  
  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 3rem; /* Отступ сверху для кнопки меню */
  }
  
  .modal-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }
  
  .modal-title {
    font-size: 1.125rem;
  }
  
  .modal-close {
    width: 28px;
    height: 28px;
    font-size: 1.25rem;
  }
  
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.125rem; }
  h3 { font-size: 1rem; }
  h4 { font-size: 0.95rem; }
  
  .text-large { font-size: 1.125rem; }
  .text-small { font-size: 0.75rem; }
  
  .number-large {
    font-size: 1.75rem;
  }
  
  .number-medium {
    font-size: 1.25rem;
  }
  
  .page-header {
    margin-bottom: 0.875rem;
    padding-bottom: 0.625rem;
    padding-top: 0.5rem; /* Дополнительный отступ сверху */
  }
  
  .page-header h1 {
    font-size: 1.25rem;
    margin-bottom: 0.375rem;
    line-height: 1.3;
    word-wrap: break-word;
  }
  
  .page-header p {
    font-size: 0.875rem;
    line-height: 1.4;
  }
  
  .page-header::after {
    width: 60px; /* Уменьшаем анимацию на мобильных */
  }
  
  .flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  /* Адаптация кнопок в page-header для маленьких экранов */
  .page-header.flex-between .btn {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
  }
  
  .top-bar {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.875rem;
    border-radius: 8px;
  }
  
  .user-menu {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .badge {
    padding: 3px 8px;
    font-size: 0.65rem;
  }
  
  .alert {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
  }
  
  .empty-state {
    padding: 2rem 1rem;
  }
  
  .empty-state svg {
    width: 48px;
    height: 48px;
  }
  
  /* На мобильных сайдбар на полный экран, показываем и текст и иконки */
  .sidebar-nav-link span {
    display: inline; /* Показываем текст на мобильных */
  }
  
  .sidebar-nav-link {
    justify-content: flex-start;
    padding: 12px 1.5rem;
    min-width: 44px; /* Минимальный размер для touch */
    min-height: 44px;
  }
  
  .sidebar {
    width: 100%;
    max-width: 100%;
  }
  
  .sidebar-logo {
    padding: 0 2rem 1.5rem;
    justify-content: flex-start;
  }
  
  .logo-image {
    max-height: 100px;
    min-height: 70px;
  }
  
  .login-logo {
    max-width: 250px;
    min-height: 80px;
  }
  
  /* Адаптация для карточек с кнопками */
  .card-header .btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  /* Адаптация для форм с несколькими кнопками */
  .form-group:has(button) {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  /* Улучшение читаемости текста */
  body {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  /* Ограничение ширины текста для читаемости */
  .card p,
  .card div:not(.table-container):not(.stats-grid):not(.card-header) {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Адаптация для кнопок в группах */
  .page-header .btn,
  .card-header .btn {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  /* Адаптация для flex-контейнеров с кнопками */
  .flex-between .btn {
    width: 100%;
  }
  
  /* Улучшение для модальных окон с формами */
  .modal form .form-group:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal form .form-group:last-child button {
    width: 100%;
  }
  
  /* Улучшаем читаемость текста */
  .card p,
  .card div:not(.table-container):not(.stats-grid):not(.card-header) {
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  /* Улучшаем отображение кнопок в группах */
  .flex-between .btn,
  .page-header .btn {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  /* Улучшаем отображение карточек с действиями */
  .card-header .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .card-header .btn-group .btn {
    width: 100%;
  }
}

/* Дополнительные улучшения для читаемости текста на всех экранах */
@media (min-width: 1440px) {
  /* Ограничение ширины строк для читаемости на больших экранах */
  .main-content {
    max-width: 1600px;
  }
  
  .card p,
  .card .text-secondary,
  .card .text-muted {
    max-width: 75ch; /* Оптимальная длина строки для чтения */
  }
}

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

/* Адаптивный заголовок страницы - применяется глобально для всех страниц */
@media (max-width: 767px) {
  .page-header.flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .page-header.flex-between .btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  .page-header.flex-between > div {
    width: 100%;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    word-wrap: break-word;
  }
  
  .page-header p {
    font-size: 0.875rem;
    word-wrap: break-word;
  }
  
  /* Улучшаем отображение кнопок в заголовке */
  .page-header .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ ТАБЛИЦЫ МАНУАЛОВ
   ============================================ */

@media (max-width: 767px) {
  /* Таблица мануалов */
  #manuals-table + .table-container,
  .table-container {
    margin: 0 -1rem;
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 100%;
    font-size: 0.875rem;
  }
  
  .table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
    word-wrap: break-word;
  }
  
  /* ВАЖНО: не скрываем колонки глобально для всех таблиц.
     Скрытие колонок должно быть только для конкретных страниц/таблиц (через классы или #...-table). */
  
  /* Делаем кнопки действий компактнее */
  .table td:last-child {
    white-space: nowrap;
  }
  
  .table td:last-child .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    min-width: auto;
    margin: 0.25rem;
  }
  
  .table td:last-child .btn i {
    width: 14px;
    height: 14px;
  }
  
  /* Группировка кнопок действий */
  .table td:last-child > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
}

/* Для очень маленьких экранов (320px - 480px) */
@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.25rem;
  }
  
  .table-container {
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
  }
  
  .table {
    font-size: 0.8rem;
    min-width: 100%;
  }
  
  .table th {
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
  }
  
  .table td {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
  }
  
  /* ВАЖНО: не скрываем 2-ю колонку глобально для всех таблиц (ломает Лиды / Public offers / Users и т.д.).
     Точечное скрытие делаем в отдельных секциях по классам таблиц. */
  
  .table td:last-child .btn {
    padding: 4px 8px;
    font-size: 0.7rem;
    margin: 0.125rem;
  }
  
  .table td:last-child .btn i {
    width: 12px;
    height: 12px;
  }
  
  /* На очень маленьких экранах кнопки в колонку */
  .table td:last-child > div {
    flex-direction: column;
    width: 100%;
  }
  
  .table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Стили для редактора контента мануалов */
#content-editor {
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Стили для списков в редакторе - чтобы маркеры не вылезали за границы */
#content-editor ul,
#content-editor ol,
#preview ul,
#preview ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  list-style-position: outside;
  overflow-x: hidden;
}

#content-editor ul,
#preview ul {
  list-style-type: disc;
}

#content-editor ol,
#preview ol {
  list-style-type: decimal;
}

#content-editor li,
#preview li {
  margin: 0.25rem 0;
  padding-left: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Для вложенных списков */
#content-editor ul ul,
#content-editor ol ol,
#content-editor ul ol,
#content-editor ol ul,
#preview ul ul,
#preview ol ol,
#preview ul ol,
#preview ol ul {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-left: 1.5rem;
}

/* Превью тоже должно быть адаптивным */
#preview {
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Адаптивное модальное окно редактора мануалов */
@media (max-width: 767px) {
  .modal {
    max-width: 95%;
    max-height: 95vh;
    padding: 1rem;
    overflow-y: auto;
  }
  
  .modal-header {
    padding: 1rem;
    margin: -1rem -1rem 1rem -1rem;
  }
  
  .modal-title {
    font-size: 1.25rem;
  }
  
  .modal-close {
    width: 32px;
    height: 32px;
    padding: 6px;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
  
  .form-input {
    font-size: 0.875rem;
    padding: 0.75rem;
  }
  
  /* Редактор контента */
  #content-editor {
    min-height: 200px;
    font-size: 0.875rem;
    padding: 0.75rem;
  }
  
  #editor-toolbar {
    gap: 0.25rem;
    margin-bottom: 0.75rem;
  }
  
  #editor-toolbar .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  
  /* Кнопки действий в модальном окне */
  .modal form > div:last-child {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .modal form > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Превью обложки */
  #cover-preview {
    max-width: 120px;
    max-height: 80px;
  }
}

@media (max-width: 480px) {
  .modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  
  .modal-header {
    margin: -1rem -1rem 0.75rem -1rem;
    padding: 0.75rem;
  }
  
  .modal-title {
    font-size: 1.125rem;
  }
  
  #content-editor {
    min-height: 150px;
    font-size: 0.8rem;
  }
  
  #editor-toolbar .btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
  
  #editor-toolbar .btn i {
    width: 14px;
    height: 14px;
  }
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ СТРАНИЦЫ ЛИДОВ
   ============================================ */

@media (max-width: 767px) {
  /* Статистика на мобильных */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }
  
  .stat-card {
    padding: 1rem !important;
  }
  
  .stat-value {
    font-size: 1.5rem !important;
  }
  
  /* Формы добавления лидов */
  .card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  /* Кнопки фильтров */
  #leads-list + .card > div[style*="flex"],
  .card:has(#leads-list) > div[style*="flex"] {
    flex-direction: column;
    gap: 1rem;
  }
  
  #leads-list + .card > div[style*="flex"] > div,
  .card:has(#leads-list) > div[style*="flex"] > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }
  
  #leads-list + .card > div[style*="flex"] > div button,
  .card:has(#leads-list) > div[style*="flex"] > div button {
    flex: 1;
    min-width: 0;
  }
  
  /* Таблица лидов - карточный вид на мобильных */
  .leads-table {
    display: block;
    width: 100%;
  }
  
  .leads-table thead {
    display: none;
  }
  
  .leads-table tbody {
    display: block;
  }
  
  .leads-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .leads-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    text-align: left !important;
  }
  
  .leads-table td:last-child {
    border-bottom: none;
  }
  
  .leads-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .leads-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .leads-table td:first-child::before {
    content: '';
  }
  
  /* Telegram username на мобильных - исправляем отображение */
  .leads-table td:nth-child(2) {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }
  
  .leads-table td:nth-child(2)::before {
    content: attr(data-label) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .leads-table td:nth-child(2) > div {
    flex: 1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    min-width: 0;
  }
  
  .leads-table td:nth-child(2) .telegram-username-display {
    flex: 1 !important;
    min-width: 0 !important;
    word-break: break-word;
    font-size: 0.875rem;
  }
  
  .leads-table td:nth-child(2) .btn {
    flex-shrink: 0 !important;
    padding: 4px 8px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
  }
  
  /* Кнопки действий в колонку на мобильных */
  .leads-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .leads-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 1023px) {
  /* Планшеты - скрываем менее важные колонки */
  .table th:nth-child(8),
  .table td:nth-child(8),
  .table th:nth-child(9),
  .table td:nth-child(9),
  .table th:nth-child(10),
  .table td:nth-child(10) {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Мобильные - карточки вместо таблицы */
  #performance-table {
    display: block;
  }
  
  #performance-table tr {
    display: block;
    margin-bottom: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
  }
  
  #performance-table thead {
    display: none;
  }
  
  #performance-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
  }
  
  #performance-table td:last-child {
    border-bottom: none;
  }
  
  #performance-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
  }
  
  #performance-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  #performance-table td:first-child::before {
    content: '';
  }
}

@media (max-width: 480px) {
  /* Очень маленькие экраны - еще более компактно */
  #performance-table td {
    font-size: 0.875rem;
    padding: 0.5rem 0;
  }
  
  #performance-table td:first-child {
    font-size: 1rem;
  }
  
  .table-container {
    overflow-x: visible;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .stat-value {
    font-size: 1.25rem !important;
  }
  
  /* Скрываем "Дата добавления" только в таблице лидов на очень маленьких экранах */
  .leads-table th:nth-child(4),
  .leads-table td:nth-child(4) {
    display: none !important;
  }
}

/* ============================================
   УЛУЧШЕННАЯ АДАПТИВНОСТЬ ДЛЯ ТАБЛИЦ ОФФЕРОВ
   ============================================ */

/* Планшеты - скрываем менее важные колонки */
@media (max-width: 1023px) {
  /* Для таблицы офферов скрываем "Сеть" (колонка 2) и "Комментарий" (колонка 6) */
  .offers-table th:nth-child(2),
  .offers-table th:nth-child(6),
  .offers-table td:nth-child(2),
  .offers-table td:nth-child(6) {
    display: none;
  }
  
  /* Для таблицы мануалов скрываем "Статус" (колонка 3) и "Создан" (колонка 4) */
  .table-container:has(#manuals-table) .table th:nth-child(3),
  .table-container:has(#manuals-table) .table th:nth-child(4),
  .table-container:has(#manuals-table) .table td:nth-child(3),
  .table-container:has(#manuals-table) .table td:nth-child(4) {
    display: none;
  }
  
  /* Для таблицы пользователей скрываем ID на планшетах */
  .users-table th:nth-child(1),
  .users-table td:nth-child(1) {
    display: none;
  }
}

/* Мобильные устройства - карточный вид для таблиц */
@media (max-width: 767px) {
  /* Улучшаем отображение таблиц на мобильных */
  .table-container {
    margin: 0 -1rem;
    padding: 0 1rem;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Таблица офферов - карточный вид на мобильных */
  .offers-table {
    display: block;
    width: 100%;
  }
  
  .offers-table thead {
    display: none;
  }
  
  .offers-table tbody {
    display: block;
  }
  
  .offers-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .offers-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    text-align: left !important;
  }
  
  .offers-table td:last-child {
    border-bottom: none;
  }
  
  .offers-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .offers-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .offers-table td:first-child::before {
    content: '';
  }
  
  /* Кнопки действий в колонку на мобильных */
  .offers-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .offers-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Таблица транзакций - карточный вид на мобильных */
  .transactions-table {
    display: block;
    width: 100%;
  }
  
  .transactions-table thead {
    display: none;
  }
  
  .transactions-table tbody {
    display: block;
  }
  
  .transactions-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .transactions-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    text-align: left !important;
  }
  
  .transactions-table td:last-child {
    border-bottom: none;
  }
  
  .transactions-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .transactions-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .transactions-table td:first-child::before {
    content: '';
  }
  
  /* Кнопки действий в колонку на мобильных */
  .transactions-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .transactions-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Таблица источников трафика - карточный вид на мобильных */
  .sources-table {
    display: block;
    width: 100%;
  }
  
  .sources-table thead {
    display: none;
  }
  
  .sources-table tbody {
    display: block;
  }
  
  .sources-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .sources-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.75rem 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    text-align: left !important;
  }
  
  .sources-table td:last-child {
    border-bottom: none;
  }
  
  .sources-table td::before {
    content: attr(data-label) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .sources-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .sources-table td:first-child::before {
    content: '';
  }
  
  .sources-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .sources-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Таблица холда - карточный вид на мобильных */
  .hold-table {
    display: block;
    width: 100%;
  }
  
  .hold-table thead {
    display: none;
  }
  
  .hold-table tbody {
    display: block;
  }
  
  .hold-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .hold-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.75rem 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    text-align: left !important;
  }
  
  .hold-table td:last-child {
    border-bottom: none;
  }
  
  .hold-table td::before {
    content: attr(data-label) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
  }
  
  .hold-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .hold-table td:first-child::before {
    content: '';
  }
  
  .hold-table td:nth-child(5)::before {
    content: 'Net Amount' !important;
  }
  
  .hold-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .hold-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Таблица пользователей - карточный вид на мобильных */
  .users-table {
    display: block;
    width: 100%;
  }
  
  .users-table thead {
    display: none;
  }
  
  .users-table tbody {
    display: block;
  }
  
  .users-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .users-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.75rem 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    text-align: left !important;
  }
  
  .users-table td:last-child {
    border-bottom: none;
  }
  
  .users-table td::before {
    content: attr(data-label) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 120px;
    flex-shrink: 0;
    display: block !important;
  }
  
  /* Email на мобильных - должен быть виден */
  .users-table td:nth-child(3) {
    word-break: break-all !important;
    font-size: 0.875rem !important;
    display: flex !important;
  }
  
  .users-table td:nth-child(3)::before {
    content: "Email" !important;
  }
  
  /* Поток на мобильных - должен быть виден */
  .users-table td:nth-child(5) {
    word-break: break-word !important;
    font-size: 0.875rem !important;
    display: flex !important;
  }
  
  .users-table td:nth-child(5)::before {
    content: "Поток" !important;
  }
  
  /* Имя пользователя - заголовок карточки */
  .users-table td:nth-child(2)::before {
    content: '' !important;
  }
  
  /* Баланс на мобильных */
  .users-table td:nth-child(6) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .users-table td:nth-child(6) > div {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }
  
  .users-table td:nth-child(6) .btn {
    flex-shrink: 0;
  }
  
  .users-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
  }
  
  .users-table td:first-child::before {
    content: '';
  }
  
  /* Кнопки действий в колонку на мобильных */
  .users-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .users-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Email на мобильных - должен быть виден */
  .users-table td:nth-child(3) {
    word-break: break-word;
  }
  
  /* Баланс на мобильных */
  .users-table td:nth-child(6) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .users-table td:nth-child(6) > div {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }
  
  .users-table td:nth-child(6) .btn {
    flex-shrink: 0;
  }
  
  /* Для таблицы мануалов - скрываем "Потоки", "Статус", "Создан" (колонки 2, 3, 4) */
  .table-container:has(#manuals-table) .table th:nth-child(2),
  .table-container:has(#manuals-table) .table th:nth-child(3),
  .table-container:has(#manuals-table) .table th:nth-child(4),
  .table-container:has(#manuals-table) .table td:nth-child(2),
  .table-container:has(#manuals-table) .table td:nth-child(3),
  .table-container:has(#manuals-table) .table td:nth-child(4) {
    display: none;
  }
  
  /* Уменьшаем размер шрифта в таблицах */
  .table {
    font-size: 0.875rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
  
  /* Кнопки действий в таблицах */
  .table td:last-child {
    white-space: nowrap;
  }
  
  .table td:last-child .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    min-width: auto;
    margin: 0.25rem;
  }
  
  .table td:last-child .btn i {
    width: 14px;
    height: 14px;
  }
  
  /* Группировка кнопок действий */
  .table td:last-child > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-start;
  }
}

/* Очень маленькие экраны - еще более компактно */
@media (max-width: 480px) {
  .table-container {
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
  }
  
  .table {
    font-size: 0.8rem;
    min-width: 100%;
  }
  
  .table th,
  .table td {
    padding: 0.625rem 0.375rem;
  }
  
  .table th {
    font-size: 0.7rem;
    padding: 0.5rem 0.375rem;
  }
  
  /* На очень маленьких экранах уменьшаем размеры */
  .leads-table tr,
  .offers-table tr,
  .users-table tr,
  .sources-table tr,
  .hold-table tr,
  .transactions-table tr {
    padding: 0.875rem;
    margin-bottom: 0.875rem;
  }
  
  .leads-table td,
  .offers-table td,
  .users-table td,
  .sources-table td,
  .hold-table td,
  .transactions-table td {
    font-size: 0.875rem;
    padding: 0.5rem 0;
  }
  
  .leads-table td:first-child,
  .offers-table td:first-child,
  .users-table td:first-child,
  .sources-table td:first-child,
  .hold-table td:first-child,
  .transactions-table td:first-child {
    font-size: 1rem;
  }
  
  .leads-table td::before,
  .offers-table td::before,
  .users-table td::before,
  .sources-table td::before,
  .hold-table td::before,
  .transactions-table td::before {
    font-size: 0.8rem;
    min-width: 120px;
  }
  
  /* Модальные окна на очень маленьких экранах */
  .modal-overlay {
    padding: 0.5rem !important;
    align-items: flex-start !important;
    padding-top: 1rem !important;
    overflow-y: auto !important;
  }
  
  .modal {
    max-width: calc(100vw - 1rem) !important;
    width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 2rem) !important;
    padding: 1rem !important;
    margin: 0.5rem !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }
  
  .modal-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  .modal-title {
    font-size: 1.25rem !important;
  }
  
  .modal .form-group {
    margin-bottom: 1rem;
  }
  
  .modal .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  .modal .form-input,
  .modal .form-textarea,
  .modal .form-select {
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Заголовок карточки с кнопками на мобильных */
  .card-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .card-header > div {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .card-header .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Для таблицы мануалов на очень маленьких экранах оставляем только название и действия */
  .table-container:has(#manuals-table) .table th:nth-child(2),
  .table-container:has(#manuals-table) .table td:nth-child(2) {
    display: none;
  }
  
  /* Кнопки действий еще компактнее */
  .table td:last-child .btn {
    padding: 4px 8px;
    font-size: 0.7rem;
    margin: 0.125rem;
  }
  
  .table td:last-child .btn i {
    width: 12px;
    height: 12px;
  }
  
  /* На очень маленьких экранах кнопки в колонке действий в колонку */
  .table td:last-child > div {
    flex-direction: column;
    width: 100%;
  }
  
  .table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
}

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

@media (max-width: 767px) {
  /* Улучшаем отображение карточек */
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  /* Улучшаем формы */
  .form-group {
    margin-bottom: 1rem;
  }
  
  /* Кнопки в формах на всю ширину */
  .form-group:has(button),
  form > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .form-group:has(button) .btn,
  form > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Улучшаем отображение page-header с кнопками */
  .page-header.flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .page-header.flex-between .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Улучшаем stats-grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  /* На очень маленьких экранах stats-grid в одну колонку */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 0.875rem;
  }
  
  .stat-value {
    font-size: 1.25rem;
  }
  
  /* Улучшаем модальные окна */
  .modal {
    max-width: calc(100vw - 1rem);
    width: calc(100vw - 1rem);
    padding: 1rem;
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
  }
  
  .modal-overlay {
    padding: 0.5rem !important;
    align-items: flex-start !important;
    padding-top: 1rem !important;
    overflow-y: auto !important;
  }
  
  .modal {
    max-width: calc(100vw - 1rem) !important;
    width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 2rem) !important;
    padding: 1rem !important;
    margin: 0.5rem !important;
    overflow-y: auto !important;
  }
  
  .modal-header {
    margin-bottom: 1rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  .modal-title {
    font-size: 1.25rem !important;
  }
  
  /* Улучшаем кнопки в модальных окнах */
  .modal form > div:last-child {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal form > div:last-child .btn {
    width: 100%;
  }
  
  /* Формы в модальных окнах на мобильных */
  .modal .form-group {
    margin-bottom: 1rem;
  }
  
  .modal .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ АКТУАЛЬНОГО СПИСКА ОФФЕРОВ
   ============================================ */

@media (max-width: 767px) {
  /* Таблица актуальных офферов - карточный вид на мобильных */
  .public-offers-table {
    display: block;
    width: 100%;
  }
  
  .public-offers-table thead {
    display: none;
  }
  
  .public-offers-table tbody {
    display: block;
  }
  
  .public-offers-table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(14px);
  }
  
  .public-offers-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.75rem 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    text-align: left !important;
  }
  
  .public-offers-table td:last-child {
    border-bottom: none;
  }
  
  .public-offers-table td::before {
    content: attr(data-label) !important;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    min-width: 140px;
    flex-shrink: 0;
    display: block !important;
  }
  
  .public-offers-table td:first-child {
    font-size: 1.125rem;
    font-weight: 700;
    border-bottom: 2px solid var(--aqua-accent);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-accent);
    display: flex !important;
  }
  
  .public-offers-table td:first-child::before {
    content: '' !important;
  }
  
  /* Выплата за оффер - должна быть видна */
  .public-offers-table td:nth-child(2) {
    display: flex !important;
  }
  
  .public-offers-table td:nth-child(2)::before {
    content: "Выплата за оффер" !important;
  }
  
  /* Выплата лиду - должна быть видна */
  .public-offers-table td:nth-child(3) {
    display: flex !important;
  }
  
  .public-offers-table td:nth-child(3)::before {
    content: "Выплата лиду" !important;
  }
  
  /* Кнопки действий в колонку на мобильных */
  .public-offers-table td:last-child > div {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .public-offers-table td:last-child .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Убираем отступы у контейнера таблицы на мобильных */
  .table-container:has(.public-offers-table) {
    margin: 0 -1rem !important;
    padding: 0 1rem !important;
  }
  
  /* Fallback для браузеров без :has() - применяем ко всем карточкам с таблицами */
  .card:has(.public-offers-table) .table-container,
  .card .table-container:has(.public-offers-table) {
    margin: 0 -1rem !important;
    padding: 0 1rem !important;
  }
  
  /* УБРАЛИ глобальный fallback .card .table-container — он ломает другие таблицы (Offers/Transactions). */
}

@media (max-width: 480px) {
  .public-offers-table tr {
    padding: 0.875rem;
    margin-bottom: 0.875rem;
  }
  
  .public-offers-table td {
    font-size: 0.875rem;
    padding: 0.5rem 0;
  }
  
  .public-offers-table td:first-child {
    font-size: 1rem;
  }
  
  .public-offers-table td::before {
    font-size: 0.8rem;
    min-width: 120px;
  }
}

