/* ═══════════════════════════════════════════════════════════
   DESIGN SYSTEM — переменные
   Палитра и шрифты соответствуют брендбуку mpindex (2026):
   Зелёный #1C882D · Оранжевый #E56200 · Фиолетовый #5E2B9A ·
   Графит #1A1A1F · Бумага #F7F6F3. См. раздел "Brand & design
   system" в CLAUDE.md — все новые/изменённые стили обязаны
   использовать эти переменные, а не произвольный hex.
═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Manrope:wght@400;500;600&display=swap');

:root {
  --primary: #5E2B9A;
  --primary-dark: #4D237E;
  --primary-light: #ECE6F3;
  --primary-glass: rgba(94, 43, 154, 0.08);

  --success: #1C882D;
  --success-light: #E4F1E6;
  --success-dark: #166D24;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-dark: #b91c1c;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-dark: #92400e;
  --purple: #5E2B9A;
  --purple-light: #ECE6F3;
  --orange: #E56200;
  --orange-light: #FCECE0;

  --text: #1A1A1F;
  --text-secondary: #55555c;
  --text-muted: #86868f;

  --bg: #F7F6F3;
  --bg-card: #ffffff;
  --bg-hover: #EFEEEA;

  --border: #E4E2DC;
  --border-strong: #CFCCC3;

  /* ─── Светлый сайдбар ─── */
  --sidebar-bg: #ffffff;
  --sidebar-text: #86868f;
  --sidebar-text-hover: #1A1A1F;
  --sidebar-text-active: #5E2B9A;
  --sidebar-active-bg: #ECE6F3;
  --sidebar-hover-bg: #EFEEEA;
  --sidebar-w: 256px;

  --topbar-h: 60px;

  --r-xs: 4px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --sh: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --sh-lg: 0 10px 25px rgba(0, 0, 0, 0.09), 0 4px 8px rgba(0, 0, 0, 0.04);

  --font: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --font-heading: 'Space Grotesk', var(--font);
  --font-mono: 'Consolas', 'SF Mono', 'Fira Code', monospace;
}

/* ═══════════════════════════════════════════════════════════
   BASE / RESET
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
code { font-family: var(--font-mono); }
h2, h3 { color: var(--text); margin-top: 0; font-family: var(--font-heading); }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }

.container {
  max-width: 1100px;
  background: var(--bg-card);
  padding: 28px;
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  margin: 28px auto;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
  transition: transform 0.25s ease;
  box-shadow: var(--sh-sm);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-text {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.3;
}
.logo-text .logo-mp { color: var(--primary); }
.logo-sub { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
  padding: 8px 8px 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 7px; bottom: 7px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  height: 20px;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-item .nav-icon svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: inherit;
}
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--border);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.nav-item.active .nav-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 8px;
}

.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Пользователь наверху сайдбара */
.sidebar-user-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
  text-decoration: none;
  transition: background 0.12s;
  flex-shrink: 0;
}
.sidebar-user-top:hover { background: var(--primary-light); }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  background: var(--primary-light);
  border: 1.5px solid rgba(94, 43, 154, 0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Сворачиваемые группы навигации */
.nav-section { margin-top: 2px; }

.nav-section-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px 5px 10px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  transition: color .15s;
  text-align: left;
  box-sizing: border-box;
  border-radius: var(--r-sm);
  gap: 6px;
  font-family: var(--font);
}
.nav-section-btn:hover { color: var(--text-secondary); }

.nav-section-btn-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav-section-chevron {
  width: 12px; height: 12px;
  opacity: .5;
  transition: transform .22s;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-section-btn.open .nav-section-chevron { transform: rotate(180deg); }

.nav-item-sub { padding-left: 28px !important; }

.nav-group-body {
  overflow: hidden;
  max-height: 800px;
  transition: max-height .26s ease;
}
.nav-group-body.collapsed { max-height: 0; }

.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--sh-xs);
}
.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
}
.topbar-menu-btn:hover { background: var(--bg); }
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all 0.12s;
  white-space: nowrap;
}
.topbar-link:hover { background: var(--border); color: var(--text); }

.main-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1600px;
  width: 100%;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ═══════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 16px 18px; }

/* ═══════════════════════════════════════════════════════════
   KPI КАРТОЧКИ
═══════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.kpi-card.kpi-success::before { background: var(--success); }
.kpi-card.kpi-danger::before  { background: var(--danger); }
.kpi-card.kpi-warning::before { background: var(--warning); }
.kpi-card.kpi-purple::before  { background: var(--purple); }
.kpi-card.kpi-orange::before  { background: var(--orange); }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.kpi-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--text-muted); }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 2px;
  width: fit-content;
}
.kpi-delta.up   { background: var(--success-light); color: var(--success-dark); }
.kpi-delta.down { background: var(--danger-light);  color: var(--danger-dark); }
.kpi-delta.flat { background: var(--bg);            color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   КНОПКИ
═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.12s;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.97) translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-blue, .btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(94, 43, 154,0.25); }
.btn-blue:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: var(--primary-dark); opacity: 1; }
.btn-green, .btn-success { background: var(--success); color: #fff; box-shadow: 0 1px 3px rgba(5,150,105,0.25); }
.btn-green:hover:not(:disabled), .btn-success:hover:not(:disabled) { background: var(--success-dark); opacity: 1; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-gray, .btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-gray:hover:not(:disabled), .btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
  opacity: 1;
  transform: translateY(-1px);
}

.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 10px 22px; font-size: 14px; }
.btn-xs  { padding: 3px 9px; font-size: 11px; }

/* ═══════════════════════════════════════════════════════════
   БЕЙДЖИ
═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-blue   { background: var(--primary-light); color: var(--primary); border-color: #ddd6fe; }
.badge-green  { background: var(--success-light); color: var(--success-dark); border-color: #a7f3d0; }
.badge-red    { background: var(--danger-light);  color: var(--danger-dark);  border-color: #fca5a5; }
.badge-yellow { background: var(--warning-light); color: var(--warning-dark); border-color: #fde68a; }
.badge-purple { background: var(--purple-light);  color: var(--purple);       border-color: #ddd6fe; }
.badge-gray   { background: #f1f5f9; color: var(--text-muted); border-color: var(--border); }
.badge-orange { background: var(--orange-light);  color: #c2410c; border-color: #fed7aa; }

/* ═══════════════════════════════════════════════════════════
   ТАБЛИЦЫ
═══════════════════════════════════════════════════════════ */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 13px;
  table-layout: auto;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  background-color: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-strong);
}
td.no-clip { overflow: visible; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background-color: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

/* Числовые колонки */
td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.tabnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Карточка-обёртка для таблиц */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-card);
}
.table-card-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-card-actions { display: flex; align-items: center; gap: 8px; }

/* Горизонтальный скролл с заморозкой первой колонки */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.table-scroll table { table-layout: auto; min-width: 700px; }
.table-scroll td { overflow: visible; }
.table-scroll th:first-child,
.table-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--bg-card);
  box-shadow: 2px 0 4px rgba(0,0,0,0.04);
}
.table-scroll th:first-child { background: var(--bg); z-index: 6; }
.table-scroll tbody tr:hover td:first-child { background: var(--primary-light); }

/* ═══════════════════════════════════════════════════════════
   ФОРМЫ
═══════════════════════════════════════════════════════════ */
input[type="date"],
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"] { font-family: var(--font); }

.form-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glass);
}
.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════
   ПАГИНАЦИЯ
═══════════════════════════════════════════════════════════ */
.pagination {
  margin-top: 20px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
}
.page-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
}
.page-link.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(94, 43, 154, 0.3);
}
.page-dots { padding: 0 4px; color: var(--text-muted); font-weight: bold; }

/* ═══════════════════════════════════════════════════════════
   ОПОВЕЩЕНИЯ
═══════════════════════════════════════════════════════════ */
.success, .alert { padding: 12px 16px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.success, .alert-success { background: var(--success-light); color: var(--success-dark); border-color: #a7f3d0; }
.alert-warning { background: var(--warning-light); color: var(--warning-dark); border-color: #fde68a; }
.alert-danger  { background: var(--danger-light);  color: var(--danger-dark);  border-color: #fca5a5; }
.alert-info    { background: var(--primary-light); color: var(--primary); border-color: #ddd6fe; }

/* ═══════════════════════════════════════════════════════════
   ПУСТОЕ СОСТОЯНИЕ (Empty State)
═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.empty-state-icon {
  font-size: 40px;
  line-height: 1;
  opacity: 0.6;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
  margin: 0;
}
.empty-state-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   СЕКЦИИ / ЗАГОЛОВКИ
═══════════════════════════════════════════════════════════ */
.section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title span { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   STATS BAR
═══════════════════════════════════════════════════════════ */
.stats-bar {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--sh-sm);
  flex-wrap: wrap;
}
.stat-cell {
  flex: 1;
  min-width: 160px;
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.12s;
}
.stat-cell:hover { background: var(--bg-hover); }
.stat-cell:last-child { border-right: none; }
.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; display: block; }
.stat-icon-blue   { background: #ECE6F3; }
.stat-icon-green  { background: var(--success-light); }
.stat-icon-purple { background: var(--purple-light); }
.stat-icon-orange { background: var(--orange-light); }
.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-value {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════
   ФИЛЬТР ДАТ (sticky)
═══════════════════════════════════════════════════════════ */
.date-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--sh-sm);
}
.date-presets { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.date-preset-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1.5px solid var(--border-strong);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  font-family: var(--font);
}
.date-preset-btn:hover {
  background: var(--primary-light);
  border-color: #bfdbfe;
  color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════
   ACTIONS PANEL (legacy)
═══════════════════════════════════════════════════════════ */
.actions-panel {
  background: var(--bg);
  padding: 14px 16px;
  border-radius: var(--r);
  margin: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--border);
}
.stats-info { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.buttons-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 540px;
}
.search-input {
  width: 100%;
  padding: 9px 36px 9px 36px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glass);
}
.search-icon {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
  display: none;
}
.search-clear:hover { color: var(--text-secondary); }

/* Active filter chip */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 12px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  color: var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.filter-chip-remove {
  cursor: pointer;
  color: var(--primary);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  opacity: 0.7;
}
.filter-chip-remove:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   СВОДНЫЕ ПАНЕЛИ (Comparison / Summary)
═══════════════════════════════════════════════════════════ */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--sh-sm);
}
.summary-cell {
  padding: 16px 18px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.1s;
}
.summary-cell:hover { background: var(--bg-hover); }
.summary-cell:last-child { border-right: none; }
.summary-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  font-weight: 700;
}
.summary-value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.summary-prev { font-size: 11px; color: var(--text-muted); }
.summary-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}
.summary-delta.up   { color: var(--success-dark); }
.summary-delta.down { color: var(--danger-dark); }

/* ═══════════════════════════════════════════════════════════
   CHARTS — универсальная обёртка
   Все графики Chart.js должны использовать этот класс-обёртку.
   Ограничение: максимальная ширина 800 px, соотношение 16:9.
═══════════════════════════════════════════════════════════ */
.chart-wrap {
  position: relative;
  max-width: 800px;
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--sh-lg); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar-menu-btn { display: flex; align-items: center; justify-content: center; }
  .main-content { padding: 14px 16px; }
}

@media (max-width: 600px) {
  .main-content { padding: 10px 12px; }
  .stat-cell { min-width: 50%; }
  .container { margin: 12px; padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .summary-bar { grid-template-columns: 1fr 1fr; }
}
