/* Мониторинг цен — приложение во фрейме Bitrix24. Светлая «ледовая» тема: тёмная шапка с живым фоном, белые карточки,
   градиент бренда cyan → blue → violet. Без внешних шрифтов и сборки; CSP запрещает inline-стили — всё здесь.
   Движение — только transform/opacity; при prefers-reduced-motion анимации выключаются (в конце файла). */
:root {
  color-scheme: light;
  --canvas: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0d1726;
  --ink-2: #364152;
  --muted: #6b7686;
  --faint: #98a2b3;
  --line: rgba(16, 24, 40, .08);
  --line-2: rgba(16, 24, 40, .14);
  --brand: #2a78d6;
  --brand-strong: #1c5cab;
  --brand-soft: #e8f1fc;
  --grad: linear-gradient(135deg, #22c3ee 0%, #2a78d6 52%, #6d4fe0 100%);
  --grad-soft: linear-gradient(135deg, rgba(34, 195, 238, .12), rgba(42, 120, 214, .10) 50%, rgba(109, 79, 224, .12));
  --hero-1: #08122b;
  --hero-2: #10265a;
  /* разделы рекомендаций — проверенная палитра (dataviz validate_palette: ΔE CVD ≥ 9.1); текст — всегда чернилами */
  --c-lower: #e34948;
  --c-equal: #4a3aa7;
  --c-cant: #eda100;
  --c-raise: #1baf7a;
  --c-ok: #2a78d6;
  --t-lower: #fdeeee;
  --t-equal: #efedfa;
  --t-cant: #fff6e0;
  --t-raise: #e6f7f0;
  --t-ok: #e8f1fc;
  --k-lower: #b42322;
  --k-equal: #3b2e8a;
  --k-cant: #8a5a00;
  --k-raise: #0d7a54;
  --k-ok: #1c5cab;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 2px 4px -2px rgba(16, 24, 40, .06), 0 12px 28px -8px rgba(16, 24, 40, .14);
  --shadow-3: 0 30px 60px -16px rgba(13, 23, 38, .35);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink-2); }
body {
  background:
    radial-gradient(1200px 380px at 12% -80px, rgba(34, 195, 238, .10), transparent 70%),
    radial-gradient(900px 320px at 95% -60px, rgba(109, 79, 224, .09), transparent 70%),
    var(--canvas);
  font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -.015em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16.5px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
[hidden] { display: none !important; }
::selection { background: rgba(42, 120, 214, .18); }

#root { max-width: 1340px; margin: 0 auto; padding: 18px 22px 28px; }

/* ---------- иконки */
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.ico.sm { width: 15px; height: 15px; vertical-align: -2px; }
.ico.lg { width: 22px; height: 22px; }
.spin { animation: spin 1s linear infinite; }

/* ---------- шапка */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; padding: 22px 26px 20px;
  background: linear-gradient(140deg, var(--hero-1) 0%, var(--hero-2) 62%, #1b2f74 100%); color: #fff;
  box-shadow: var(--shadow-3); margin-bottom: 16px;
}
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; will-change: transform; }
.orb-a {
  width: 520px; height: 520px; left: -140px; top: -260px;
  background: radial-gradient(circle at center, rgba(34, 195, 238, .55), rgba(34, 195, 238, 0) 62%);
  animation: drift-a 22s var(--ease) infinite alternate;
}
.orb-b {
  width: 560px; height: 560px; right: -180px; top: -300px;
  background: radial-gradient(circle at center, rgba(109, 79, 224, .55), rgba(109, 79, 224, 0) 62%);
  animation: drift-b 26s var(--ease) infinite alternate;
}
.orb-c {
  width: 420px; height: 420px; left: 38%; bottom: -320px;
  background: radial-gradient(circle at center, rgba(42, 120, 214, .5), rgba(42, 120, 214, 0) 62%);
  animation: drift-c 30s var(--ease) infinite alternate;
}
.hero-grid {
  position: absolute; inset: 0; opacity: .5;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 70% 0%, #000 0%, transparent 70%);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 8px 18px rgba(34, 195, 238, .35)); }
.logo svg { width: 100%; height: 100%; display: block; }
.logo .trace { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 1.4s .25s var(--ease) forwards; }
.logo .tip-dot { transform-origin: 30px 27px; animation: pop .5s 1.35s var(--spring) both; }
.brand-title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.brand-sub { font-size: 13px; color: rgba(255, 255, 255, .68); margin-top: 1px; }
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hstat {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px 8px 10px; border-radius: 14px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .10);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.hstat .ico { color: #7dd3fc; }
.hstat-label { font-size: 11.5px; color: rgba(255, 255, 255, .6); line-height: 1.2; }
.hstat-value { font-size: 13.5px; font-weight: 650; color: #fff; line-height: 1.3; font-variant-numeric: tabular-nums; }

/* ---------- ход сбора (в шапке) */
.runbox {
  margin-top: 18px; padding: 16px 18px; border-radius: 18px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: rise .55s var(--ease) both;
}
.run-head { display: flex; align-items: center; gap: 16px; }
.run-pct { font-size: 38px; font-weight: 750; letter-spacing: -.03em; line-height: 1; min-width: 92px; color: #fff;
  font-variant-numeric: tabular-nums; }
.run-pct small { font-size: 18px; font-weight: 600; opacity: .7; margin-left: 2px; }
.run-info { flex: 1; min-width: 0; }
.run-title { font-weight: 650; color: #fff; }
.run-meta { font-size: 13px; color: rgba(255, 255, 255, .68); }
.bar { position: relative; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden;
  margin: 14px 0 12px; }
.bar-fill {
  position: relative; height: 100%; width: 0; border-radius: 99px; overflow: hidden;
  background: linear-gradient(90deg, #22c3ee, #60a5fa 55%, #a78bfa);
  box-shadow: 0 0 18px rgba(34, 195, 238, .55); transition: width .9s var(--ease);
}
.bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: translateX(-100%); animation: sheen 1.8s ease-in-out infinite;
}
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.steps li {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 99px; font-size: 12.5px;
  color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .04); transition: all .4s var(--ease);
}
.steps li i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); position: relative; }
.steps li.active { color: #fff; background: rgba(34, 195, 238, .16); }
.steps li.active i { background: #22c3ee; box-shadow: 0 0 0 0 rgba(34, 195, 238, .6); animation: pulse 1.6s infinite; }
.steps li.done { color: rgba(255, 255, 255, .85); }
.steps li.done i { background: #34d399; }
.run-sites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12.5px;
  background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8); animation: pop .4s var(--spring) both;
}
.chip.done { background: rgba(52, 211, 153, .16); color: #b7f5dc; }
.chip.fail { background: rgba(248, 113, 113, .16); color: #fecaca; }

/* ---------- кнопки */
.btn {
  appearance: none; position: relative; overflow: hidden; isolation: isolate; border: 1px solid transparent;
  border-radius: 12px; padding: 0 16px; height: 40px; font: inherit; font-weight: 650; font-size: 13.5px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  text-decoration: none; transition: transform .25s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease),
    border-color .3s var(--ease), color .3s var(--ease), opacity .2s;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--grad); background-size: 140% 140%; color: #fff;
  box-shadow: 0 8px 20px -8px rgba(42, 120, 214, .7), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primary:hover:not(:disabled) { background-position: 100% 0; transform: translateY(-1px);
  box-shadow: 0 14px 28px -10px rgba(42, 120, 214, .8), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.primary::after, .btn.run::after {
  content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
}
.btn.primary:hover:not(:disabled)::after, .btn.run:hover:not(:disabled)::after { animation: sheen 1s var(--ease); }
.btn.run { height: 44px; padding: 0 20px; border-radius: 14px; background: #fff; color: var(--ink);
  box-shadow: 0 10px 30px -10px rgba(34, 195, 238, .65), 0 0 0 1px rgba(255, 255, 255, .6); }
.btn.run .ico { color: var(--brand); }
.btn.run:hover:not(:disabled) { transform: translateY(-1px);
  box-shadow: 0 16px 36px -12px rgba(34, 195, 238, .9), 0 0 0 4px rgba(34, 195, 238, .18); }
.btn.run:disabled { opacity: .9; }
.btn.run.busy { background: rgba(255, 255, 255, .92); }
.btn.glass { background: rgba(255, 255, 255, .09); color: #fff; border-color: rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn.glass:hover:not(:disabled) { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); }
.btn.glass.on .ico { color: #7dd3fc; }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.btn.ghost:hover:not(:disabled) { border-color: rgba(42, 120, 214, .45); color: var(--brand-strong);
  box-shadow: 0 0 0 4px rgba(42, 120, 214, .08); }
.btn.danger { background: var(--surface); color: var(--k-lower); border-color: rgba(227, 73, 72, .35); }
.btn.danger:hover:not(:disabled) { background: var(--t-lower); box-shadow: 0 0 0 4px rgba(227, 73, 72, .08); }
.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.link { background: none; border: 0; color: var(--brand); padding: 0; height: auto; font-weight: 600; }
.btn.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ripple { position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; transform: scale(0); opacity: .35;
  background: currentColor; animation: ripple .65s var(--ease) forwards; }
.btn.primary .ripple { background: #fff; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible { outline-offset: 3px; }

/* ---------- вкладки: скользящая подложка под активной */
.tabs {
  position: relative; display: flex; gap: 2px; padding: 5px; margin: 0 0 18px; width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; background: rgba(255, 255, 255, .78); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-1); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-ink {
  position: absolute; top: 5px; left: 0; bottom: 5px; width: 0; border-radius: 12px; background: var(--grad);
  box-shadow: 0 8px 18px -8px rgba(42, 120, 214, .75); transition: transform .5s var(--ease), width .5s var(--ease);
  z-index: 0;
}
.tabs a {
  flex: none; position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden;
  transition: color .35s var(--ease);
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: #fff; }
.tabs a .ico { width: 17px; height: 17px; }

/* ---------- карточки */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 20px 22px; margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px; }
.head-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.head-ico {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; color: var(--brand);
  background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(42, 120, 214, .12);
}
.card-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid2 > .card { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.note { border-radius: 14px; padding: 13px 16px; background: var(--brand-soft); color: #164a8a;
  display: flex; gap: 10px; align-items: flex-start; }
.note .ico { margin-top: 1px; }
.note.warn { background: var(--t-cant); color: var(--k-cant); }
.note.bad { background: var(--t-lower); color: var(--k-lower); }
.note.good { background: var(--t-raise); color: var(--k-raise); }
.card.note { border: 0; }
.spot::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(42, 120, 214, .09), transparent 60%);
  transition: opacity .4s var(--ease);
}
.spot:hover::before { opacity: 1; }

/* ---------- отчёт: шапка и распределение */
.report-head .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.mchip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mchip .ico { color: var(--faint); }
select {
  font: inherit; height: 40px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 36px 0 13px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 13px center;
  -webkit-appearance: none; appearance: none; color: var(--ink); cursor: pointer;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
select:hover { border-color: rgba(42, 120, 214, .45); }
.dist { margin-top: 18px; }
.dist-bar { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; }
.dist-seg { appearance: none; border: 0; padding: 0; height: 100%; min-width: 6px; border-radius: 4px; cursor: pointer;
  transform-origin: left center; animation: grow-x .9s var(--ease) both; transition: filter .25s, transform .25s; }
.dist-seg:hover { filter: brightness(1.08) saturate(1.1); }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.legend-item { appearance: none; border: 0; background: none; padding: 3px 6px; margin: -3px -6px; border-radius: 8px;
  font: inherit; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  transition: background .2s; }
.legend-item:hover { background: var(--surface-2); }
.legend-item b { color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-item .muted { font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.s-lower { background: var(--c-lower); } .s-equal { background: var(--c-equal); } .s-cant_lower { background: var(--c-cant); }
.s-raise { background: var(--c-raise); } .s-ok { background: var(--c-ok); }

/* ---------- сводка-фильтры */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  appearance: none; position: relative; overflow: hidden; isolation: isolate; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 15px;
  box-shadow: var(--shadow-1); transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.kpi-share { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-value { font-size: 30px; font-weight: 750; line-height: 1.05; letter-spacing: -.03em; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.35; }
.kpi.lower .kpi-ico { background: var(--t-lower); color: var(--c-lower); }
.kpi.equal .kpi-ico { background: var(--t-equal); color: var(--c-equal); }
.kpi.cant_lower .kpi-ico { background: var(--t-cant); color: var(--k-cant); }
.kpi.raise .kpi-ico { background: var(--t-raise); color: var(--c-raise); }
.kpi.ok .kpi-ico { background: var(--t-ok); color: var(--c-ok); }
.kpi.drops .kpi-ico { background: var(--t-lower); color: var(--c-lower); }
.kpi.neutral .kpi-ico { background: var(--grad-soft); color: var(--brand); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform: scaleX(0);
  transform-origin: left; transition: transform .5s var(--ease); }
.kpi.lower::after { background: var(--c-lower); } .kpi.equal::after { background: var(--c-equal); }
.kpi.cant_lower::after { background: var(--c-cant); } .kpi.raise::after { background: var(--c-raise); }
.kpi.ok::after { background: var(--c-ok); }
.kpi.active { border-color: transparent; box-shadow: var(--shadow-2), 0 0 0 2px rgba(42, 120, 214, .5); }
.kpi.active::after { transform: scaleX(1); }
.kpi.lower.active { box-shadow: var(--shadow-2), 0 0 0 2px rgba(227, 73, 72, .55); }
.kpi.equal.active { box-shadow: var(--shadow-2), 0 0 0 2px rgba(74, 58, 167, .5); }
.kpi.cant_lower.active { box-shadow: var(--shadow-2), 0 0 0 2px rgba(237, 161, 0, .6); }
.kpi.raise.active { box-shadow: var(--shadow-2), 0 0 0 2px rgba(27, 175, 122, .55); }

/* ---------- ИИ */
.ai-card { border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; }
.ai-card .head-ico { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(109, 79, 224, .7); }
.ai-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ai-list li { position: relative; padding: 10px 14px 10px 36px; border-radius: 12px; background: var(--surface-2);
  color: var(--ink-2); line-height: 1.5; }
.ai-list li::before { content: ""; position: absolute; left: 15px; top: 17px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad); }
.ai-text { white-space: pre-line; }

.problems { list-style: none; margin: 0; padding: 0; }
.problems li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.problems li:first-child { border-top: 0; padding-top: 0; }
.problems b { color: var(--ink); }

/* ---------- значки */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.badge.lower, .badge.error, .badge.failed { background: var(--t-lower); color: var(--k-lower); }
.badge.lower .dot, .badge.error .dot, .badge.failed .dot { background: var(--c-lower); }
.badge.error .dot, .badge.failed .dot { animation: pulse-red 1.8s infinite; }
.badge.equal, .badge.stale { background: var(--t-equal); color: var(--k-equal); }
.badge.equal .dot, .badge.stale .dot { background: var(--c-equal); }
.badge.cant_lower, .badge.partial, .badge.running { background: var(--t-cant); color: var(--k-cant); }
.badge.cant_lower .dot, .badge.partial .dot, .badge.running .dot { background: var(--c-cant); }
.badge.raise, .badge.ok, .badge.done { background: var(--t-raise); color: var(--k-raise); }
.badge.raise .dot, .badge.ok .dot, .badge.done .dot { background: var(--c-raise); }
.badge.cheapest { background: var(--t-ok); color: var(--k-ok); }
.badge.cheapest .dot { background: var(--c-ok); }
.badge.own { background: var(--brand-soft); color: var(--k-ok); }
.badge.own .dot { background: var(--grad); }

/* ---------- панель фильтров */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: #eef2f7; border-radius: 13px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button {
  appearance: none; position: relative; overflow: hidden; border: 0; background: none; font: inherit; font-size: 13px;
  color: var(--muted); padding: 7px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; transition: background .3s var(--ease), color .3s, box-shadow .3s;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08),
  0 4px 10px -4px rgba(16, 24, 40, .15); }
.seg .count { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: rgba(16, 24, 40, .06);
  color: var(--muted); font-variant-numeric: tabular-nums; }
.seg button.active .count { background: var(--brand-soft); color: var(--k-ok); }
.field { position: relative; flex: 1 1 240px; min-width: 0; }
.field .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none;
  transition: color .25s; }
.field:focus-within .ico { color: var(--brand); }
input[type=text], input[type=search] {
  font: inherit; height: 40px; width: 100%; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px;
  background: var(--surface); color: var(--ink); min-width: 0;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.field input { padding-left: 40px; }
input[type=text]:hover, input[type=search]:hover { border-color: rgba(42, 120, 214, .35); }
input[type=text]:focus, input[type=search]:focus, select:focus { border-color: var(--brand); outline: none;
  box-shadow: 0 0 0 4px rgba(42, 120, 214, .14); }
.field.big input { height: 52px; font-size: 16px; border-radius: 16px; padding-left: 48px; }
.field.big .ico { left: 17px; width: 20px; height: 20px; }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; user-select: none; }

/* переключатель */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d5dbe3; transition: background .3s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(16, 24, 40, .25); transition: transform .35s var(--spring); }
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px rgba(42, 120, 214, .2); }

/* ---------- таблицы */
/* по вертикали не прокручиваем: строки въезжают снизу, и на время анимации мелькала бы полоса прокрутки */
.table-wrap { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: 14px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.grid th {
  position: relative; background: var(--surface-2); color: var(--muted); font-weight: 650; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.grid th.sortable { cursor: pointer; user-select: none; transition: color .2s; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid th .arrow { color: var(--brand); margin-left: 4px; display: inline-block; animation: pop .3s var(--spring); }
table.grid td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; transition: background .2s; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: #f6f9fd; }
table.grid tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid .strong { font-weight: 700; color: var(--ink); }
table.grid .title-cell { min-width: 260px; max-width: 470px; }
table.grid .title-cell a { color: var(--ink); font-weight: 550; }
table.grid .title-cell a:hover { color: var(--brand); }
table.grid .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
table.grid tr.own td { background: #f3f8fe; }
table.grid tr.details td { background: var(--surface-2); padding: 0 14px 0 50px; }
table.grid tr.details:hover td { background: var(--surface-2); box-shadow: none; }
tr.row-in { animation: row-in .5s var(--ease) both; }
.price-pill { display: inline-block; padding: 3px 10px; border-radius: 9px; font-weight: 700; color: var(--ink); }
.price-pill.lower { background: var(--t-lower); } .price-pill.equal { background: var(--t-equal); }
.price-pill.raise { background: var(--t-raise); } .price-pill.cant_lower { background: var(--t-cant); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.pos { color: var(--k-raise); }
.neg { color: var(--k-lower); }
.overbar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.overbar .track { display: block; width: 46px; height: 6px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.overbar .fill { display: block; height: 100%; border-radius: 99px; background: var(--c-lower); transform-origin: left;
  animation: grow-x .9s .2s var(--ease) both; }
.overbar.neg .fill { background: var(--c-raise); }
.warn-mark { color: var(--k-cant); cursor: help; margin-left: 6px; }
.toggle { appearance: none; border: 0; background: none; cursor: pointer; color: var(--faint); width: 26px; height: 26px;
  border-radius: 8px; display: grid; place-items: center; transition: background .2s, color .2s; }
.toggle:hover { background: #eef2f7; color: var(--ink); }
.toggle .ico { transition: transform .35s var(--ease); }
.toggle[aria-expanded=true] .ico { transform: rotate(90deg); color: var(--brand); }
.reveal { animation: reveal .45s var(--ease) both; padding: 12px 0 14px; }
.comp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.comp-list li { display: grid; grid-template-columns: 170px 120px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 7px 10px; border-radius: 10px; font-size: 13px; }
.comp-list li:nth-child(odd) { background: rgba(255, 255, 255, .7); }
.comp-list li.best { background: var(--t-ok); }
.comp-list .site { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink); }
.more { text-align: center; padding: 14px 0 2px; display: flex; justify-content: center; align-items: center; gap: 12px;
  flex-wrap: wrap; }

/* ---------- полосы (кто чаще самый дешёвый) */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.hbar-name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: block; height: 12px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c-ok); transform-origin: left;
  animation: grow-x 1s var(--ease) both; }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; min-width: 90px; text-align: right; }

/* ---------- магазины */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.site-card { display: flex; flex-direction: column; gap: 12px; margin: 0; transition: transform .35s var(--ease),
  box-shadow .35s var(--ease); overflow: hidden; }
.site-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.site-card.own { border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; }
.site-top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff;
  font-weight: 750; font-size: 16px; text-transform: uppercase; background: var(--grad);
  box-shadow: 0 8px 18px -10px rgba(42, 120, 214, .9); }
.avatar.a1 { background: linear-gradient(135deg, #22c3ee, #2a78d6); }
.avatar.a2 { background: linear-gradient(135deg, #6d4fe0, #a855f7); }
.avatar.a3 { background: linear-gradient(135deg, #1baf7a, #22c3ee); }
.avatar.a4 { background: linear-gradient(135deg, #f97316, #e34948); }
.avatar.a5 { background: linear-gradient(135deg, #2a78d6, #6d4fe0); }
.site-name { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-name a { color: var(--ink); }
.site-num { font-size: 28px; font-weight: 750; letter-spacing: -.03em; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums; }
.site-num small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto;
  padding-top: 12px; border-top: 1px solid var(--line); }
.chips-off { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* ---------- каталог */
.drop {
  position: relative; display: flex; align-items: center; gap: 18px; border-radius: 18px; padding: 22px; cursor: pointer;
  border: 2px dashed rgba(42, 120, 214, .28); background: linear-gradient(180deg, #fbfdff, #f5f9ff);
  transition: border-color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease);
}
.drop:hover { border-color: rgba(42, 120, 214, .6); }
.drop.over { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.01); }
.drop input[type=file] { display: none; }
.drop-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: none;
  background: var(--grad); box-shadow: 0 12px 24px -12px rgba(42, 120, 214, .9); transition: transform .4s var(--spring); }
.drop:hover .drop-ico, .drop.over .drop-ico { transform: translateY(-3px) rotate(-4deg); }
.drop-title { font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.indeterminate { height: 4px; border-radius: 99px; background: #e6eef9; overflow: hidden; margin-top: 12px; position: relative; }
.indeterminate::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 99px;
  background: var(--grad); animation: indet 1.2s var(--ease) infinite; }
.stat-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.ring { width: 76px; height: 76px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-track { stroke: #eef2f7; }
.ring .ring-val { stroke: var(--c-raise); transition: stroke-dashoffset 1.2s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; color: var(--ink);
  font-size: 15px; font-variant-numeric: tabular-nums; }
.big-num { font-size: 32px; font-weight: 750; letter-spacing: -.03em; color: var(--ink); line-height: 1.05;
  font-variant-numeric: tabular-nums; }

/* ---------- правила */
.rules { display: grid; gap: 10px; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; align-items: center; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .3s, background .3s, box-shadow .3s; }
.rule:hover { border-color: rgba(42, 120, 214, .25); background: #fbfdff; }
.rule.changed { box-shadow: inset 3px 0 0 var(--brand); }
.rule-title { font-weight: 650; color: var(--ink); }
.rule-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; }
.rule-input { position: relative; display: flex; align-items: center; }
.rule-input input, .rule-input select { width: 100%; }
.rule-input input { padding-right: 38px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rule-input .unit { position: absolute; right: 14px; color: var(--muted); font-weight: 600; pointer-events: none; }
.rule-error { color: var(--k-lower); font-size: 12.5px; grid-column: 1 / -1; margin-top: -6px;
  animation: shake .4s var(--ease); }
.rule.invalid { border-color: rgba(227, 73, 72, .45); background: #fffafa; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------- состояние */
.info-card .big { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.users { display: grid; gap: 2px; }
.user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 9px 10px; border-radius: 12px; transition: background .2s; }
.user-row:hover { background: var(--surface-2); }
.user-row .avatar { width: 34px; height: 34px; border-radius: 50%; font-size: 13px; }
.user-name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- пусто и загрузка */
.empty { text-align: center; padding: 40px 18px 34px; }
.empty h2 { margin: 6px 0 8px; font-size: 19px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 18px; }
.empty-art { width: 150px; height: 120px; margin: 0 auto; display: block; animation: float 5s ease-in-out infinite; }
.sk { position: relative; overflow: hidden; border-radius: 10px; background: #eef2f7; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: sheen 1.5s infinite; }
.sk-line { height: 12px; margin: 10px 0; }
.sk-title { height: 20px; width: 34%; margin-bottom: 14px; }
.sk-kpi { height: 116px; border-radius: var(--radius); }
.sk-row { height: 40px; margin: 8px 0; border-radius: 10px; }

/* ---------- сообщения, окна, подсказки */
.toast {
  position: absolute; left: 50%; top: 12px; z-index: 80; transform: translateX(-50%); width: max-content;
  max-width: min(560px, calc(100% - 32px)); display: flex; gap: 12px; align-items: flex-start; overflow: hidden;
  padding: 13px 18px 15px 14px; border-radius: 16px; background: rgba(13, 23, 38, .94); color: #fff; font-size: 13.5px;
  box-shadow: 0 20px 44px -12px rgba(13, 23, 38, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: toast-in .55s var(--spring) both;
}
.toast .t-ico { width: 26px; height: 26px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: rgba(52, 211, 153, .18); color: #6ee7b7; }
.toast.bad .t-ico { background: rgba(248, 113, 113, .2); color: #fca5a5; }
.toast .t-text { padding-top: 3px; line-height: 1.45; }
.toast .t-life { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, #22c3ee, #a78bfa); animation: life linear forwards; }
.toast.bad .t-life { background: linear-gradient(90deg, #f87171, #fb923c); }
.toast.out { animation: toast-out .35s var(--ease) forwards; }
.shade { position: fixed; inset: 0; z-index: 60; background: rgba(13, 23, 38, .28);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .3s var(--ease) both; }
.dialog { position: absolute; left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 32px)); z-index: 61;
  text-align: center; padding: 26px 24px 22px; box-shadow: var(--shadow-3); border: 0;
  animation: dialog-in .45s var(--spring) both; }
.dialog .d-ico { width: 48px; height: 48px; border-radius: 15px; margin: 0 auto 12px; display: grid; place-items: center;
  background: var(--t-lower); color: var(--c-lower); }
.tip { position: absolute; z-index: 90; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none;
  padding: 7px 11px; border-radius: 10px; background: rgba(13, 23, 38, .94); color: #fff; font-size: 12.5px;
  white-space: nowrap; box-shadow: 0 10px 24px -8px rgba(13, 23, 38, .5); animation: fade .15s ease both; }
.foot { color: var(--faint); font-size: 12px; text-align: center; margin-top: 20px; display: flex; justify-content: center;
  align-items: center; gap: 8px; }
.foot .live { width: 7px; height: 7px; border-radius: 50%; background: var(--c-raise); animation: pulse-green 2.4s infinite; }
.loading { color: var(--muted); padding: 28px 0; text-align: center; }
body.plain { background: var(--canvas); }
body.plain .notice-page { max-width: 560px; margin: 48px auto; padding: 0 16px; }
body.plain .notice-page .card { padding: 28px; animation: rise .6s var(--ease) both; }
body.plain .notice-page h1 { margin-bottom: 10px; }

/* ---------- появление */
.rise { animation: rise .7s var(--ease) both; }

@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sheen { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes indet { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -10px) scale(.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -8px) scale(.97); } }
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 195, 238, .6); } 100% { box-shadow: 0 0 0 10px rgba(34, 195, 238, 0); } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(227, 73, 72, .55); } 100% { box-shadow: 0 0 0 8px rgba(227, 73, 72, 0); } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(27, 175, 122, .5); } 100% { box-shadow: 0 0 0 8px rgba(27, 175, 122, 0); } }
@keyframes drift-a { to { transform: translate(140px, 70px) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-160px, 90px) scale(1.1); } }
@keyframes drift-c { to { transform: translate(-120px, -60px) scale(1.2); } }

/* ---------- узкие экраны */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  #root { padding: 10px 10px 20px; }
  .hero { padding: 18px 16px; border-radius: 20px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn.run { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 25px; }
  .card { padding: 16px; }
  .rule { grid-template-columns: 1fr; }
  .comp-list li { grid-template-columns: 1fr; gap: 2px; }
  .hbar { grid-template-columns: 1fr auto; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .run-pct { font-size: 30px; min-width: 70px; }
  .drop { flex-direction: column; text-align: center; }
  .tabs { width: 100%; }
  .btn.glass .b-text { display: none; }
  .btn.glass { padding: 0 12px; }
}

/* ---------- без движения: кто попросил систему не анимировать */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .orb { animation: none !important; }
}
