:root {
  /* === СОВРЕМЕННАЯ ЦВЕТОВАЯ ПАЛИТРА === */
  
  /* Основные цвета */
  --primary-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --primary-light: #dcfce7;
  --primary-dark: #15803d;
  --primary-hover: #16a34a;
  
  /* Акцентные цвета */
  --accent-blue: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --accent-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --accent-orange: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --accent-pink: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  
  /* Нейтральные тона */
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --surface-white: #ffffff;
  --surface-light: #f8fafc;
  --surface-gray: #f1f5f9;
  --surface-dark: #1e293b;
  
  /* Границы */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  
  /* Текст */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-white: #ffffff;
  
  /* Статусы */
  --success-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --info-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  
  /* Тени */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* === АНИМАЦИИ === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-gradient);
  margin: 0;
  color: var(--text-primary);
}

.dashboard-container {
  max-width: 1480px;
  margin: 30px auto 0 auto;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1), 0 10px 25px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 32px 30px 34px 30px;
  min-height: 600px;
  position: relative;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* HEADER FLEX */
.dashboard-header {
  margin-bottom: 12px;
  position: relative;
}

.dashboard-header-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 18px;
}

.dashboard-titlebox {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-title {
  font-size: 2.1rem;
  margin: 0 0 5px 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.dashboard-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Логотип убран */
/*
.dashboard-logo {
  display: flex;
  align-items: center;
  height: 52px;
}
.dashboard-logo img {
  height: 44px;
  width: auto;
  margin-left: 16px;
}
*/

.switch-compare-headerbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  gap: 16px;
}

@media (max-width: 900px) {
  .dashboard-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    position: relative;
  }
  .switch-compare-headerbox {
    margin-left: 0;
    margin-top: 10px;
    height: auto;
    flex-wrap: wrap;
  }
  /* .dashboard-logo {
    margin-top: 10px;
  } */
}

/* МАЛЕНЬКИЙ КОМПАКТНЫЙ ПЕРЕКЛЮЧАТЕЛЬ */
.switch-label {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: 500;
  gap: 10px;
  user-select: none;
  background: var(--surface-white);
  border-radius: 16px;
  padding: 7px 15px;
  box-shadow: var(--shadow-md);
  border: 1.2px solid var(--border-light);
}
.switch-label .slider {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
  margin-left: 7px;
  background-color: #ccc;
  border-radius: 22px;
  vertical-align: middle;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
.switch-label input[type="checkbox"] {
  display: none;
}

.switch-label input[type="checkbox"]:focus + .slider {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}
.switch-label .slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}
.switch-label input[type="checkbox"]:checked + .slider {
  background: var(--primary-gradient);
  box-shadow: inset 0 2px 4px rgba(34, 197, 94, 0.2);
}
.switch-label input[type="checkbox"]:checked + .slider:before {
  transform: translateX(26px) scale(1.1);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3), 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* FILTER PANEL */
.calendar-row,
.calendar-row-full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.calendar-row input[type="date"], .calendar-row-full input[type="date"] {
  font-size: 15px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1.2px solid var(--border-light);
  min-width: 110px;
  max-width: 150px;
  background: var(--surface-white);
  transition: all .13s ease;
}
.calendar-row input[type="date"]:focus, .calendar-row-full input[type="date"]:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.calendar-form button.button,
.calendar-form button.button-outline {
  font-size: 15px;
  padding: 6px 14px;
  min-width: 80px;
  margin: 0;
}

.calendar-form button.button {
  background: var(--primary-gradient);
  color: var(--text-white);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  transition: all .13s ease;
  box-shadow: var(--shadow-sm);
}
.calendar-form button.button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.calendar-form button.button-outline {
  background: var(--surface-white);
  color: #ef4444;
  border: 1.2px solid #ef4444;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  transition: background .13s, color .13s;
}
.calendar-form button.button-outline:hover {
  background: #ef4444;
  color: #fff;
}

.adstype-inline-btns {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.adstype-inline-btns.hidden {
  display: none;
}

/* CAMPAIGN FILTER */
.campaign-filter-container {
  position: relative;
  display: inline-block;
}

.campaign-filter-container .campaign-filter-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 12px !important;
  padding: 10px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 200px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.campaign-filter-container .campaign-filter-btn:hover {
  border-color: rgba(34, 197, 94, 0.4) !important;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  transform: translateY(-1px) !important;
}

.campaign-filter-container .campaign-filter-btn.active {
  border-color: rgba(34, 197, 94, 0.5) !important;
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.95) 0%, rgba(220, 252, 231, 0.9) 100%) !important;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.campaign-filter-text {
  flex: 1;
  text-align: left;
}

.campaign-filter-count {
  color: #666;
  font-size: 14px;
}

.campaign-filter-arrow {
  font-size: 12px;
  color: #666;
  transition: transform 0.2s;
}

.campaign-filter-container .campaign-filter-btn.open .campaign-filter-arrow {
  transform: rotate(180deg);
}

.campaign-filter-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
  max-height: 320px;
  overflow: hidden;
}

.campaign-filter-dropdown.open {
  display: block;
  animation: dropdownSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Адаптивность для фильтра кампаний */
@media (max-width: 768px) {
  .campaign-filter-dropdown {
    left: -50px;
    width: 280px;
  }
  
  .campaign-filter-container .campaign-filter-btn {
    min-width: 160px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}

.campaign-filter-search {
  padding: 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.3);
}

.campaign-filter-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(209, 213, 219, 0.3);
  border-radius: 10px;
  font-size: 14px;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
}

.campaign-filter-search input:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
  background: rgba(255, 255, 255, 0.95);
}

.campaign-filter-actions {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.3);
  display: flex;
  gap: 12px;
}

.campaign-filter-action {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.1) 0%, rgba(107, 114, 128, 0.05) 100%);
  border: 1px solid rgba(107, 114, 128, 0.2);
  color: #6b7280;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}

.campaign-filter-action:hover {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(107, 114, 128, 0.1) 100%);
  border-color: rgba(107, 114, 128, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.2);
}

.campaign-filter-action:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3);
}

.campaign-filter-action:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.campaign-filter-list {
  max-height: 200px;
  overflow-y: auto;
}

.campaign-filter-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  margin: 2px 8px;
}

.campaign-filter-item:hover {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.08) 0%, rgba(107, 114, 128, 0.04) 100%);
  transform: translateX(4px);
}

.campaign-filter-item input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #6b7280;
}

.campaign-filter-item input[type="checkbox"]:focus {
  outline: 2px solid rgba(34, 197, 94, 0.5);
  outline-offset: 2px;
}

.campaign-filter-item label {
  flex: 1;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  word-break: break-word;
}

.campaign-filter-item.hidden {
  display: none;
}

/* QUICK FILTER BUTTON */
.quick-filter-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.6) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 197, 94, 0.2);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  margin-right: 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-filter-btn:hover {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.9) 0%, rgba(220, 252, 231, 0.7) 100%);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(34, 197, 94, 0.15);
}

.quick-filter-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Tooltip для кнопки быстрого фильтра */
.quick-filter-btn::after {
  content: "Показать только эту кампанию";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1000;
  margin-bottom: 5px;
}

.quick-filter-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

.adstype-btn {
  padding: 6px 14px;
  border-radius: 7px;
  background: #f1f5f9;
  border: none;
  font-size: 15px;
  cursor: pointer;
  font-weight: 500;
  color: #222;
  transition: background .13s;
  min-width: 90px;
  white-space: nowrap;
  margin: 0;
  box-sizing: border-box;
}

.adstype-btn.active {
  background: #d9f3e2;
  color: #389e22;
  border: 1.6px solid #389e22;
  font-weight: 700;
}

/* ANALYTICS PANELS */
.compare-panels-row {
  display: flex;
  gap: 28px;
  justify-content: space-between;
}

.compare-panels-row .analytics-panel:first-child {
  animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.compare-panels-row .analytics-panel:last-child {
  animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}
.analytics-panel {
  width: 100%;
  /*max-width: 950px;*/
  background: linear-gradient(135deg, rgba(246, 251, 255, 0.9) 0%, rgba(241, 245, 249, 0.8) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 22px 32px 32px 32px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 16px;
  min-width: 0;
}



@media (max-width:1400px) {
  .analytics-panel {max-width:100%;}
  .compare-panels-row {flex-direction:column;gap:18px;}
}
.analytics-inner-block {
  margin-top:12px;
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.header-buttons-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.header-buttons-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analytics-icon {
  font-size: 1.3em;
}

.expand-all-btn, .collapse-all-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.expand-all-btn:hover {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

.collapse-all-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Стили для кнопки переключения графика */
.toggle-chart-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  color: #666;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9em;
  transition: background-color 0.2s, transform 0.2s;
}

.toggle-chart-btn:hover {
  background-color: #f0f0f0;
  color: #333;
}

.toggle-chart-btn.collapsed .toggle-chart-text {
  content: "Показать график";
}

.toggle-chart-btn.collapsed svg {
  transform: rotate(-180deg);
}

.toggle-chart-btn svg {
  transition: transform 0.2s;
}

/* Анимация для блока с графиком */
.campaigns-chart-block {
  background: #e0f1ff10;
  padding: 14px 8px 0 8px;
  border-radius: 10px;
  margin-bottom: 14px;
  transition: height 0.3s ease-out, opacity 0.3s ease-out, margin 0.3s ease-out;
  overflow: hidden;
}

.campaigns-chart-block.collapsed {
  height: 0 !important;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* METRICS SUMMARY */
.metrics-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.metric-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 18px 16px 16px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.metric-card:hover {
  border-color: rgba(34, 197, 94, 0.3);
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-card.active {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.2), 0 4px 16px rgba(34, 197, 94, 0.1);
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.9) 0%, rgba(220, 252, 231, 0.8) 100%);
  transform: translateY(-2px) scale(1.01);
}

.metric-card:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3), 0 8px 32px rgba(0, 0, 0, 0.1);
}

.metric-card.active::before {
  opacity: 1;
}

.metric-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  line-height: 1.2;
}

.metric-icon {
  font-size: 1.1rem;
  opacity: 0.8;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-card.border-green { 
  border-color: rgba(34, 197, 94, 0.3);
}

.metric-card.border-green::before {
  background: var(--success-gradient);
}

.metric-card.border-green:hover {
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.2), 0 4px 16px rgba(34, 197, 94, 0.1);
}

.metric-card.border-red { 
  border-color: rgba(239, 68, 68, 0.3);
}

.metric-card.border-red::before {
  background: var(--danger-gradient);
}

.metric-card.border-red:hover {
  box-shadow: 0 12px 40px rgba(239, 68, 68, 0.2), 0 4px 16px rgba(239, 68, 68, 0.1);
}

/* === ЦВЕТОВОЕ КОДИРОВАНИЕ МЕТРИК === */

/* Spend - синий градиент */
.metric-card[data-metric="spend"] .metric-icon {
  color: #3b82f6;
}
.metric-card[data-metric="spend"]:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="spend"]::before {
  background: var(--accent-blue);
}

/* Leads - зеленый градиент */
.metric-card[data-metric="leads"] .metric-icon {
  color: #22c55e;
}
.metric-card[data-metric="leads"]:hover {
  border-color: rgba(34, 197, 94, 0.3);
  box-shadow: 0 12px 40px rgba(34, 197, 94, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="leads"]::before {
  background: var(--success-gradient);
}

/* Cost per Lead - фиолетовый градиент */
.metric-card[data-metric="costPerLead"] .metric-icon {
  color: #8b5cf6;
}
.metric-card[data-metric="costPerLead"]:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="costPerLead"]::before {
  background: var(--accent-purple);
}

/* CTR - оранжевый градиент */
.metric-card[data-metric="ctr"] .metric-icon {
  color: #f59e0b;
}
.metric-card[data-metric="ctr"]:hover {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 12px 40px rgba(245, 158, 11, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="ctr"]::before {
  background: var(--accent-orange);
}

/* CPM - розовый градиент */
.metric-card[data-metric="cpm"] .metric-icon {
  color: #ec4899;
}
.metric-card[data-metric="cpm"]:hover {
  border-color: rgba(236, 72, 153, 0.3);
  box-shadow: 0 12px 40px rgba(236, 72, 153, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="cpm"]::before {
  background: var(--accent-pink);
}

/* CPC - индиго градиент */
.metric-card[data-metric="cpc"] .metric-icon {
  color: #6366f1;
}
.metric-card[data-metric="cpc"]:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
}
.metric-card[data-metric="cpc"]::before {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* === АКТИВНЫЕ СОСТОЯНИЯ С ЦВЕТОВЫМ КОДИРОВАНИЕМ === */

.metric-card[data-metric="spend"].active {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.9) 0%, rgba(191, 219, 254, 0.8) 100%);
  border-color: rgba(59, 130, 246, 0.4);
}

.metric-card[data-metric="leads"].active {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.9) 0%, rgba(220, 252, 231, 0.8) 100%);
  border-color: rgba(34, 197, 94, 0.4);
}

.metric-card[data-metric="costPerLead"].active {
  background: linear-gradient(135deg, rgba(237, 233, 254, 0.9) 0%, rgba(221, 214, 254, 0.8) 100%);
  border-color: rgba(139, 92, 246, 0.4);
}

.metric-card[data-metric="ctr"].active {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.9) 0%, rgba(254, 243, 199, 0.8) 100%);
  border-color: rgba(245, 158, 11, 0.4);
}

.metric-card[data-metric="cpm"].active {
  background: linear-gradient(135deg, rgba(253, 242, 248, 0.9) 0%, rgba(252, 231, 243, 0.8) 100%);
  border-color: rgba(236, 72, 153, 0.4);
}

.metric-card[data-metric="cpc"].active {
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.9) 0%, rgba(224, 231, 255, 0.8) 100%);
  border-color: rgba(99, 102, 241, 0.4);
}

/* CHARTS */
/* TABLE */
.campaigns-table {
  width: 100%;
  border-collapse: collapse;
  background: linear-gradient(135deg, rgba(227, 241, 251, 0.15) 0%, rgba(241, 245, 249, 0.1) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.campaigns-table th,
.campaigns-table td {
  border-bottom: 1px solid rgba(221, 234, 248, 0.3);
  padding: 8px 8px 8px 0;
  text-align: left;
  transition: background-color 0.2s ease;
}
.campaigns-table th {
  background: linear-gradient(135deg, rgba(224, 241, 255, 0.4) 0%, rgba(241, 245, 249, 0.3) 100%);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(34, 197, 94, 0.2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.campaigns-table tr:last-child td {
  border-bottom: none;
}


.campaigns-table tbody tr:nth-child(even) {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.3) 0%, rgba(241, 245, 249, 0.2) 100%);
}

.campaigns-table tbody tr:hover {
  background: linear-gradient(135deg, rgba(224, 241, 255, 0.25) 0%, rgba(240, 253, 244, 0.2) 100%) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Total строка */
.campaigns-table .total-row {
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.8) 0%, rgba(240, 253, 244, 0.6) 100%) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  border-top: 2px solid rgba(34, 197, 94, 0.4);
  font-weight: 600;
  box-shadow: 0 -2px 8px rgba(34, 197, 94, 0.1);
}
.campaigns-table .total-row:hover {
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.9) 0%, rgba(240, 253, 244, 0.7) 100%) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

/* Строки без данных */
.campaigns-table .no-data-row {
  opacity: 0.6;
  font-style: italic;
}
.campaigns-table .no-data-row:hover {
  background: #f8f9fa;
}

/* Expand/Collapse функциональность */
.campaigns-table .expandable-row {
  cursor: pointer;
  transition: background-color 0.2s;
}
.campaigns-table .expandable-row:hover {
  background: #e0f1ff55 !important;
}

.campaign-name-cell {
  position: relative;
}

.campaign-name-cell.expandable {
  padding-left: 20px;
}

.expand-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.6) 100%);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.expand-icon:hover {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.9) 0%, rgba(220, 252, 231, 0.7) 100%);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--primary-dark);
}

.campaigns-table .daily-data-row {
  background: linear-gradient(135deg, rgba(248, 251, 255, 0.6) 0%, rgba(241, 245, 249, 0.4) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 11px;
  opacity: 0.95;
  border-left: 3px solid rgba(34, 197, 94, 0.3);
}
.campaigns-table .daily-data-row:hover {
  background: linear-gradient(135deg, rgba(240, 247, 255, 0.8) 0%, rgba(240, 253, 244, 0.6) 100%);
  border-left-color: rgba(34, 197, 94, 0.5);
}

.daily-date {
  color: var(--text-secondary);
  font-style: italic;
  font-weight: 500;
  padding-left: 25px;
  font-size: 11px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-radius: 4px;
  padding: 2px 8px 2px 25px;
  display: inline-block;
}

/* VISITORS, AUDIENCE, MATERIALS, SOCIAL, POST */
.section-block {
  background: #f6fbff;
  border-radius: 15px;
  padding: 20px 20px 16px 20px;
  margin: 18px 0 0 0;
  box-shadow: 0 1.5px 7px #b3b9be1a;
}
.section-heading {
  margin: 0 0 9px 0;
  font-size: 1.24em;
  font-weight: 600;
  letter-spacing: .01em;
  color: #1d2231;
}
.visitors-block, .auditory-block, .materials-block, .social-block {
  font-size: 1.08em;
  margin-bottom: 4px;
}

.tag {
  display: inline-block;
  background: #e0f7fa;
  color: #1d2231;
  border-radius: 8px;
  padding: 5px 12px;
  margin-right: 6px;
  margin-bottom: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.tag:hover {
  background: #b2ebf2;
  color: #00796b;
}

.social-btn {
  display: inline-block;
  background: #e9eef9;
  color: #1d2231;
  border-radius: 8px;
  padding: 6px 16px;
  margin-right: 6px;
  margin-bottom: 6px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border: none;
  transition: background .15s, color .15s;
}
.social-btn:hover {
  background: #d1e7ff;
  color: #1565c0;
}

/* POST CREATE/PREVIEW */
.post-preview-content {
  background: #f8fafb;
  padding: 16px 13px;
  margin: 16px 0 7px 0;
  border-radius: 10px;
  font-size: 16px;
  white-space: pre-wrap;
}
.post-preview-actions {
  margin-bottom: 10px;
}
.button, .button-outline {
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
}
.button {
  background: var(--primary-gradient);
  color: var(--text-white);
  border: none;
  transition: all .13s ease;
  box-shadow: var(--shadow-sm);
}
.button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3), var(--shadow-md);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
}

.button-outline {
  background: var(--surface-white);
  color: #ef4444;
  border: 1.2px solid #ef4444;
  transition: all .13s ease;
}
.button-outline:hover {
  background: #ef4444;
  color: #fff;
}

.button-outline:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
  background: #ef4444;
  color: #fff;
}

.button-outline:active {
  transform: scale(0.98);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.success-message { color: #22c55e; margin-top: 10px;}
.error-message { color: #ef4444; margin-top: 10px;}

/* SCROLL TO TOP */
#scrollToTopBtn {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99;
  background: #22c55e;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px #22c55e33;
  cursor: pointer;
  padding: 0;
  transition: background .15s;
}
#scrollToTopBtn:hover {
  background: #1b9f41;
}
#scrollToTopBtn svg {
  display: block;
}

/* AUTH OVERLAY DUPLICATE (for fallback) */
#loginBox[style*="display:none"] {display:none !important;}

/* QUICK DATES PANEL */
.quick-dates-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-date-option {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
  color: #222;
  transition: all 0.2s;
  user-select: none;
}

.quick-date-option:hover {
  background: #e2e8f0;
}

.quick-date-option input[type="radio"] {
  display: none;
}

.quick-date-option input[type="radio"]:checked + span {
  color: #389e22;
  font-weight: 600;
}

.quick-date-option input[type="radio"]:checked + span::before {
  content: "✓";
  margin-right: 4px;
}

.quick-date-option:has(input[type="radio"]:focus) {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
  background: #e2e8f0;
}

@media (max-width: 768px) {
  .calendar-row-full {
    gap: 12px;
  }
  
  .quick-dates-panel {
    gap: 6px;
  }
  
  .quick-date-option {
    padding: 3px 8px;
    font-size: 13px;
  }
}