/* ===== Cosmic Design Impact — блок «Дизайн-изменения» в аналитиках (MR 11, design-impact.js) ===== */
/* Палитра из crm-theme.css; переиспользуемый компонент .di (живёт внутри вкладок
   аналитик), скоуп по классу компонента. Entrance cosmicDiRise, hover-glow,
   prefers-reduced-motion, 390px без глобального overflow. */

.di { min-width: 0; }
@keyframes cosmicDiRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --- Шапка блока --- */
.di-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px;
}
.di-eyebrow { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.di-title {
  margin: 4px 0 2px; font-size: 18px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.di-title svg, .di-link svg {
  width: 16px; height: 16px; stroke: var(--accent-2); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.di-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  background: transparent; border: 1px solid var(--border); border-radius: 10px; color: var(--text-2);
  cursor: pointer; transition: color .15s, border-color .15s, box-shadow .15s;
}
.di-icon-btn:hover { color: var(--text); border-color: var(--border-2); box-shadow: 0 0 14px var(--accent-soft); }
.di-icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Политика режима и подписи --- */
.di-policy {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin: 0 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-left: 2px solid var(--violet);
  border-radius: 12px; color: var(--text-2); font-size: 12.5px; line-height: 1.5;
}
.di-policy svg {
  width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px;
  stroke: var(--violet); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.di-note { font-size: 12px; color: var(--text-3); line-height: 1.5; margin: 6px 0; }
.di-src { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; }
.di-muted { color: var(--text-3); }
.di-small { font-size: 11px; }

/* --- Задачи --- */
.di-task {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px;
  animation: cosmicDiRise .5s ease both; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.di-task:hover { border-color: var(--border-2); box-shadow: 0 6px 20px rgba(0,0,0,.28), 0 0 14px var(--accent-soft); }
.di-task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.di-task-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.di-link { color: var(--info); text-decoration: none; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.di-link:hover { text-decoration: underline; }
.di-link svg { width: 13px; height: 13px; stroke: var(--info); }

/* --- Бейджи (статус — текстом, не только цветом) --- */
.di-badge {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.di-badge--good { border-color: var(--good); color: var(--good); background: var(--good-soft); }
.di-badge--warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.di-badge--info { border-color: var(--info); color: var(--info); background: var(--info-soft); }
.di-badge--confirmed { border-color: var(--info); color: var(--info); background: var(--info-soft); }
.di-badge--muted { color: var(--text-3); }

/* --- Ключ-значение и метрики --- */
.di-kv { display: grid; gap: 4px; margin: 8px 0; }
.di-kv-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; line-height: 1.5; }
.di-kv-k { color: var(--text-3); min-width: 170px; }
.di-kv-v { color: var(--text-2); }
.di-sub { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.di-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.di-metric {
  border: 1px dashed var(--border-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; min-width: 0;
}
.di-metric-lbl { display: block; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.di-metric-val { display: block; font-weight: 700; margin: 2px 0; }
.di-metric-why { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; }

/* --- Плитки «до/после» --- */
.di-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 8px; }
.di-tile {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); border-left: 2px solid var(--cyan);
  border-radius: 12px; padding: 12px 14px; min-width: 0;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.di-tile:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.di-tile-lbl { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.di-tile-val { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; }
.di-tile-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.4; }

/* --- Состояния --- */
.di-loading { padding: 20px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.di-nodata {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 8px 0;
  background: var(--surface); border: 1px dashed var(--border-2); border-radius: 12px;
  color: var(--text-2); font-size: 13px; line-height: 1.5;
}
.di-nodata svg {
  width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px;
  stroke: var(--text-3); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.di-nodata-why { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* --- 390px --- */
@media (max-width: 560px) {
  .di-head { flex-direction: column; align-items: stretch; }
  .di-kv-k { min-width: 0; flex-basis: 100%; }
  .di-tiles { grid-template-columns: 1fr 1fr; }
  .di-tile-val { font-size: 18px; }
  .di-metrics { grid-template-columns: 1fr; }
  .di-title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .di-task, .di-tile { animation: none; }
  .di-tile:hover { transform: none; }
}
