/* ============================================================================
   SellerLens — светлая, воздушная дизайн-система (вдохновлена аналитическими
   панелями в духе Яндекс Метрики: много белого, мягкие карточки, тёплый акцент,
   пропорциональные табличные цифры вместо «механического» моноширинного).
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  /* «Индиго-аналитика»: спокойный минимализм — глубокий индиго, янтарный акцент,
     мягкий серо-голубой фон-градиент. Никакого неона. */
  --bg: #f3f5fa;
  --bg-grad-a: #f7f9fd;
  --bg-grad-b: #edf0f8;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #edf0f7;
  --border: #e7eaf3;
  --border-strong: #d9deeb;
  --text: #1d2540;
  --text-muted: #5b6478;
  --text-faint: #6e778d;   /* контраст к белому 4.6:1 (было #98a0b5 — 2.6:1) */

  --primary: #4056c8;
  --primary-600: #3547b6;
  --primary-700: #2c3ba2;
  --primary-tint: #eef1fc;
  --primary-tint-2: #dfe5fa;

  --accent: #d97706;          /* янтарный акцент: вторая линия графиков, метки */
  --info: #2f6bff;
  --info-tint: #eaf1ff;
  --green: #1d9e6f;
  --green-tint: #e6f6ef;
  --red: #d64550;
  --red-tint: #fdeced;
  --amber: #d97706;
  --violet: #7c6bd0;

  --wb: #8b5cf6;
  --ozon: #2f6bff;

  /* Segoe UI первым: на Windows системный шрифт рендерится заметно чётче webфонта */
  --font-sans: "Segoe UI", -apple-system, "Inter", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
  --num: "Segoe UI", "Inter", system-ui, sans-serif;   /* цифры — табличные */

  --radius: 16px;
  --radius-sm: 12px;
  --shadow-xs: 0 1px 2px rgba(29, 37, 64, 0.05);
  --shadow: 0 2px 8px rgba(29, 37, 64, 0.05), 0 8px 24px rgba(29, 37, 64, 0.05);
  --shadow-lg: 0 12px 40px rgba(29, 37, 64, 0.10);
  --ring: 0 0 0 4px var(--primary-tint-2);
}

/* ---------- тёмная тема ----------
   Основная тема — СВЕТЛАЯ. Тёмная включается ТОЛЬКО явным выбором пользователя
   (переключатель в профиле ставит data-theme="dark"); систему не слушаем.
   Дизайн полностью на переменных, поэтому переопределения палитры достаточно. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12141a; --bg-grad-a: #14161d; --bg-grad-b: #0d0f14;
  --surface: #1c1f27; --surface-2: #232733; --surface-3: #2b3040;
  --border: #2a2f3b; --border-strong: #3a4150;
  --text: #e8ebf2; --text-muted: #a3adba; --text-faint: #808a99;
  --primary: #7d8ff0; --primary-600: #94a3f5; --primary-700: #aab6f8;
  --primary-tint: #20273f; --primary-tint-2: #2c375a;
  --accent: #f0a93a; --amber: #f0a93a; --violet: #9d8ff0;
  --info: #5b8bff; --info-tint: #18233a; --green: #35c07a; --green-tint: #123024;
  --red: #f0666b; --red-tint: #331a1c;
  --wb: #a78bfa; --ozon: #5b8bff;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 2px 8px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  --ring: 0 0 0 4px rgba(125,143,240,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text);
  /* мягкий градиентный фон; лёгкая тонировка по активной площадке ниже */
  background: linear-gradient(165deg, var(--bg-grad-a) 0%, var(--bg-grad-b) 100%) fixed;
  font-family: var(--font-sans); line-height: 1.55;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  text-rendering: optimizeLegibility;   /* без antialiased: на Windows так чётче */
}
body[data-mp="wb"] { background: linear-gradient(165deg, #f8f6fd 0%, #eeebf8 100%) fixed; }
body[data-mp="ozon"] { background: linear-gradient(165deg, #f5f8fd 0%, #e9f0fa 100%) fixed; }
/* в тёмной теме тонировка площадки не должна возвращать светлый фон */
:root[data-theme="dark"] body[data-mp="wb"] { background: linear-gradient(165deg, #17141f 0%, #100e17 100%) fixed; }
:root[data-theme="dark"] body[data-mp="ozon"] { background: linear-gradient(165deg, #121722 0%, #0d0f16 100%) fixed; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.02em; }
a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* доступность */
a, button, select, input[type=checkbox], .feature, .mp-toggle button, .kpi { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82);
  backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
:root[data-theme="dark"] .topbar { background: rgba(24,27,34,.82); }
/* ---------- быстрый поиск товара (Ctrl/⌘+K) ---------- */
.cmdk { position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(15,18,28,.45); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmdk.open { display: flex; }
.cmdk-box { width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; }
.cmdk-input { border: none; outline: none; background: transparent; color: var(--text);
  font-size: 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmdk-results { max-height: 52vh; overflow-y: auto; }
.cmdk-item { display: flex; align-items: baseline; gap: 10px; padding: 10px 18px;
  cursor: pointer; border-bottom: 1px solid var(--border); }
.cmdk-item:last-child { border-bottom: none; }
.cmdk-item.sel, .cmdk-item:hover { background: var(--primary-tint); }
.cmdk-item .ci-sku { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--primary-600); white-space: nowrap; }
.cmdk-item .ci-name { color: var(--text-muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cmdk-empty { padding: 22px 18px; color: var(--text-muted); font-size: 14px; text-align: center; }
.cmdk-hint { padding: 8px 18px; font-size: 12px; color: var(--text-faint);
  border-top: 1px solid var(--border); background: var(--surface-2); }
.cmdk-hint kbd { font: inherit; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 0 5px; margin: 0 2px; }
/* круглые иконки-кнопки: переключатель темы и поиск (в топбаре и в сайдбаре) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; padding: 0; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: .15s; }
.icon-btn:hover { color: var(--primary); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.nav .icon-btn { margin-left: 4px; }
.sb-brand .icon-btn { width: 30px; height: 30px; }
/* тумблер (переключатель темы в профиле) */
/* Лимит дохода на НПД: полоса заполнения с предупреждающими порогами. */
.npd-sum { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 10px; }
.npd-sum small { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.npd-bar { height: 12px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; border: 1px solid var(--border); }
.npd-bar span { display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--green); transition: width .3s; }
.npd-bar span.warn { background: var(--amber); }
.npd-bar span.bad { background: var(--red); }

/* Экран «подписка закончилась» — поверх всего, мимо не пройти. */
.paywall { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
  background: rgba(20, 24, 40, .55); backdrop-filter: blur(4px); padding: 20px; }
.paywall-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 28px; max-width: 440px; text-align: center;
  box-shadow: 0 24px 60px rgba(20, 24, 40, .25); }
.paywall-ic { font-size: 34px; margin-bottom: 8px; }
.paywall-card h3 { margin: 0 0 8px; font-size: 21px; }
.paywall-card p { color: var(--text-muted); font-size: 15px; margin: 0 0 20px; }
.paywall-card .btn { display: block; margin: 8px auto 0; max-width: 260px; }

/* Полоса «осталось N дней» перед закрытием доступа. */
.grace-bar { background: #fff6e6; border: 1px solid #f0d08a; color: #7a5200;
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600;
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grace-bar a { color: var(--primary-700); text-decoration: underline; }
:root[data-theme="dark"] .grace-bar { background: #3a2f14; border-color: #6b5520; color: #f0d08a; }

/* Юридические страницы: длинный текст, читаемая типографика. */
.legal p, .legal li { font-size: 15px; line-height: 1.65; color: var(--text-muted); }
.legal h3 { font-size: 18px; color: var(--text); margin: 30px 0 8px; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin-bottom: 6px; }
.legal b { color: var(--text); }
.legal code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; font-size: 13px; }

/* Согласие с офертой и обработкой ПД при регистрации. */
.consent-row { display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  font-size: 13px; line-height: 1.45; color: var(--text-muted); margin: 2px 0 14px; }
.consent-row input { margin: 2px 0 0; flex: none; width: 16px; height: 16px; cursor: pointer; }
.consent-row a { color: var(--primary); }

.theme-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider { position: absolute; inset: 0; background: var(--surface-3);
  border: 1px solid var(--border-strong); border-radius: 999px; transition: .15s; pointer-events: none; }
.switch .slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-xs); transition: .15s; }
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }
.topbar-inner { display: flex; align-items: center; gap: 22px; height: 66px;
  max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800;
  font-size: 19px; letter-spacing: -.03em; color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4c62d6, var(--primary-700)); color: #fff;
  font-size: 15px; font-weight: 800; box-shadow: 0 6px 16px rgba(64,86,200,.30); }
.brand-mark svg { width: 19px; height: 19px; display: block; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--text-faint);
  letter-spacing: 0; margin-top: -2px; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a { padding: 8px 13px; border-radius: 10px; color: var(--text-muted); font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { color: var(--primary-700); background: var(--primary-tint); }
.nav-cta { background: var(--primary); color: #fff !important; box-shadow: 0 4px 12px rgba(64,86,200,.28); }
.nav-cta:hover { background: var(--primary-600); color: #fff !important; }
.nav .who { color: var(--text); font-weight: 700; font-size: 13.5px; padding: 7px 12px;
  background: var(--surface-2); border-radius: 999px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 48px; }
.hero::before { content: ""; position: absolute; inset: -30% -10% auto -10%; height: 560px; z-index: 0;
  background: radial-gradient(50% 55% at 22% 18%, rgba(64,86,200,.12), transparent 70%),
              radial-gradient(45% 50% at 82% 8%, rgba(47,107,255,.10), transparent 70%); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  color: var(--primary-700); background: var(--primary-tint); padding: 7px 14px; border-radius: 999px; margin-bottom: 20px; }
.eyebrow svg { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(32px, 5.2vw, 54px); letter-spacing: -.035em; max-width: 15ch; font-weight: 800; }
.hero h1 .grad { color: var(--primary); }
.hero p.lead { font-size: clamp(16px, 2.1vw, 20px); color: var(--text-muted); max-width: 56ch; margin: 20px 0 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stat-row { display: flex; gap: 36px; margin-top: 46px; flex-wrap: wrap; }
.stat-row .s b { font-size: 26px; letter-spacing: -.03em; display: block; font-weight: 800; }
.stat-row .s span { font-size: 13.5px; color: var(--text-faint); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; font-family: inherit; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(64,86,200,.26); }
.btn.primary:hover { background: var(--primary-600); }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }
.btn.sm { padding: 8px 15px; font-size: 13.5px; border-radius: 10px; }
.btn.ghost { background: transparent; }
.btn.success { background: var(--green); color: #fff; border-color: transparent; }

/* ---------- sections ---------- */
section.block { padding: 60px 0; }
.section-head { text-align: center; max-width: 62ch; margin: 0 auto 44px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.03em; font-weight: 800; }
.section-head p { color: var(--text-muted); font-size: 17px; }
.kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 10px; }

/* ---------- feature grid ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-xs); transition: transform .16s ease, box-shadow .16s ease, border-color .16s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.feature .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  margin-bottom: 16px; background: var(--primary-tint); color: var(--primary); }
.feature .ico svg { width: 24px; height: 24px; }
.feature h3 { font-size: 18px; font-weight: 700; }
.feature p { color: var(--text-muted); font-size: 14.5px; margin: 0; }
.feature .tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  margin-top: 14px; background: var(--surface-2); color: var(--text-faint); }
.feature .tag.live { background: var(--green-tint); color: var(--green); }

/* ---------- методики (split) ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.method-card { border-radius: var(--radius); padding: 28px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); }
.method-card.ours { border-top: 3px solid var(--primary); }
.method-card.theirs { border-top: 3px solid var(--info); }
.method-card h3 { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.m-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; vertical-align: -1px; }
.method-card ul { margin: 16px 0 0; padding-left: 0; list-style: none; }
.method-card li { padding: 9px 0 9px 26px; position: relative; color: var(--text-muted); border-top: 1px solid var(--border); font-size: 14.5px; }
.method-card li::before { content: "→"; position: absolute; left: 0; color: var(--primary); font-weight: 800; }
.method-card.theirs li::before { color: var(--info); }

/* ---------- panels / inputs ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-xs); }
.panel h3 { font-size: 16px; margin-bottom: 16px; font-weight: 700; }
.mp-toggle { display: flex; gap: 5px; background: var(--surface-2); padding: 5px; border-radius: 12px; }
.mp-toggle button { flex: 1; padding: 9px 12px; border: none; border-radius: 9px; background: transparent;
  font-weight: 700; font-size: 14px; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: .15s; }
.mp-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.mp-toggle button.active[data-mp="wb"] { color: var(--wb); }
.mp-toggle button.active[data-mp="ozon"] { color: var(--ozon); }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field .in { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface); overflow: hidden; transition: .15s; }
.field .in:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.field input, .field select { width: 100%; border: none; background: transparent; padding: 11px 13px; font-size: 15px; color: var(--text); font-family: inherit; outline: none; }
.field input.num { font-variant-numeric: tabular-nums; }
.field .unit { padding: 0 13px; color: var(--text-faint); font-size: 13px; white-space: nowrap; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--text-faint); margin: 5px 0 0; }
input[type=date] { border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px; background: var(--surface); color: var(--text); font-family: inherit; font-variant-numeric: tabular-nums; font-size: 13.5px; }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-xs); transition: box-shadow .15s; }
.kpi:hover { box-shadow: var(--shadow); }
.kpi .cap { font-size: 12.5px; color: var(--text-faint); font-weight: 600; }
.kpi .num { font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.kpi .num.neg { color: var(--red); } .kpi .num.pos { color: var(--text); }
.kpi .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ---------- cards / charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-xs); margin-bottom: 20px; }
.chart-card h3 { font-size: 16px; font-weight: 700; }
.card-sub { color: var(--text-muted); font-size: 13.5px; margin: 2px 0 0; }
.trend { width: 100%; height: 280px; display: block; }
.trend text { font-family: var(--num); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--border); }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 700; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.pos { color: var(--green); } .neg { color: var(--red); }
.warn-text { color: var(--amber); }

/* ---------- реклама: флаги/полосы ---------- */
.pill-flag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill-flag.ok { background: var(--green-tint); color: var(--green); }
.pill-flag.warn { background: var(--primary-tint); color: var(--primary-700); }
.pill-flag.loss { background: var(--red-tint); color: var(--red); }
.bar { width: 110px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; }

/* ---------- водопад P&L ---------- */
.waterfall { display: flex; flex-direction: column; gap: 11px; margin-top: 10px; }
/* label и сумма не наезжают: label сжимается с многоточием, сумма не переносится */
.wf-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr max-content;
  align-items: center; gap: 14px; }
.wf-label { font-size: 13.5px; color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wf-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.wf-track span { display: block; height: 100%; border-radius: 999px; min-width: 4px; }
.wf-start { background: linear-gradient(90deg, #4f7cff, #7aa2ff); }
.wf-mid   { background: linear-gradient(90deg, #4056c8, #7c8de0); }
.wf-end   { background: linear-gradient(90deg, #0ea968, #4ed6a0); }
.wf-neg   { background: linear-gradient(90deg, #f0666b, #f9a3a6); }
/* легенда цветными точками вместо эмодзи (эмодзи рисуются с контуром) */
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  vertical-align: -1px; margin: 0 3px 0 6px; }
.wf-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: 14px; white-space: nowrap; }
.wf-val.neg { color: var(--red); }
@media (max-width: 640px) { .wf-row { grid-template-columns: 130px 1fr 92px; gap: 8px; } .wf-label { font-size: 12px; } }

/* ---------- панель периода / загрузка ---------- */
.src-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-xs); }
.src-dates { display: inline-flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 13.5px; font-weight: 600; }

/* прогресс загрузки данных */
.load-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-xs); margin-bottom: 20px; }
.load-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--primary-tint-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 10px 0; }
.load-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #7c8de0); border-radius: 999px; transition: width .4s ease; }
.load-steps { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.load-step { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-muted); }
.load-step .mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; background: var(--surface-3); color: var(--text-faint); }
.load-step.done .mark { background: var(--green-tint); color: var(--green); }
.load-step.active .mark { background: var(--primary-tint); color: var(--primary); }
.load-step.active { color: var(--text); font-weight: 600; }
.load-step .cnt { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-faint); font-size: 13px; }
.load-step .mini-spin { width: 12px; height: 12px; border: 2px solid var(--primary-tint-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.ok { border-color: var(--green-tint); border-top-color: var(--green); animation: none; position: relative; }
.spinner.ok::after { content: "✓"; position: absolute; inset: -2px; display: grid; place-items: center; color: var(--green); font-size: 12px; font-weight: 700; }
.load-counter { font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.load-counter b { color: var(--primary); }
.load-log { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 3px; max-height: 140px; overflow: hidden; }
.load-log-line { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.load-log-line:last-child { color: var(--text-muted); font-weight: 500; }
.slow-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); background: var(--primary-tint); border: 1px solid var(--primary-tint-2); border-radius: 999px; padding: 6px 14px; margin-bottom: 14px; }
.slow-chip .mini-spin { width: 12px; height: 12px; border: 2px solid var(--primary-tint-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }

/* во время смены периода контент мягко «пригашен» */
main.refetching .kpi-row, main.refetching .chart-card, main.refetching .two-col {
  opacity: .45; pointer-events: none; transition: opacity .2s ease; }

/* ---------- «что если»: ползунки ---------- */
.wi-slider { margin: 14px 0; }
.wi-slider label { display: flex; justify-content: space-between; font-size: 13.5px;
  color: var(--text-muted); margin-bottom: 6px; }
.wi-slider label b { color: var(--primary-700); font-variant-numeric: tabular-nums; }
.wi-slider input[type=range] { width: 100%; accent-color: var(--primary); }

/* ---------- тариф ---------- */
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); border-top: 3px solid var(--primary); }
.price-name { font-weight: 700; font-size: 17px; }
.price-val { font-size: 42px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 16px; }
.price-val span { font-size: 17px; font-weight: 600; color: var(--text-faint); }
.price-list { list-style: none; padding: 0; margin: 0 0 20px; }
.price-list li { padding: 8px 0 8px 26px; position: relative; border-top: 1px solid var(--border); font-size: 14px; }
.price-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }

/* ---------- онбординг-мастер ---------- */
.wiz-step { display: flex; gap: 16px; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px;
  margin-bottom: 14px; box-shadow: var(--shadow-xs); }
.wiz-step.done { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.wiz-mark { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; background: var(--primary-tint); color: var(--primary-700); }
.wiz-step.done .wiz-mark { background: var(--green-tint); color: var(--green); }
.wiz-body { flex: 1; } .wiz-body b { font-size: 16px; }
.wiz-body p { color: var(--text-muted); font-size: 14px; margin: 4px 0 12px; }

/* ---------- пустое состояние ---------- */
#empty_area { display: none; }
main.is-empty #empty_area { display: block; margin-top: 8px; }
/* .src-bar НЕ прячем: там поля периода и кнопка «Обновить» — ровно то, что
   советует нажать текст пустого состояния. Пряча их, мы заводили в тупик. */
main.is-empty .kpi-row, main.is-empty .chart-card, main.is-empty .two-col { display: none; }
.empty-state { text-align: center; padding: 52px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.empty-state .es-ico { width: 60px; height: 60px; margin: 0 auto 18px; color: var(--primary); display: grid; place-items: center; background: var(--primary-tint); border-radius: 18px; }
.empty-state h3 { font-size: 21px; margin-bottom: 6px; font-weight: 700; }
.empty-state p { color: var(--text-muted); max-width: 48ch; margin: 0 auto 20px; }
.empty-steps { display: inline-flex; flex-direction: column; gap: 9px; text-align: left; margin-bottom: 22px; padding: 0; }
.empty-steps li { display: flex; align-items: center; gap: 11px; color: var(--text-muted); list-style: none; }
.empty-steps .n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; flex: none; }

/* ---------- auth / профиль ---------- */
.auth-wrap { max-width: 460px; margin: 0 auto; }
.auth-tabs { display: flex; gap: 5px; background: var(--surface-2); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 10px; border: none; border-radius: 9px; background: transparent; font-weight: 700; color: var(--text-muted); font-family: inherit; cursor: pointer; transition: .15s; }
.auth-tabs button.active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-xs); }
.form-field { margin-bottom: 15px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-field input { width: 100%; border: 1px solid var(--border-strong); border-radius: 11px; padding: 12px 14px; font-size: 15px; background: var(--surface); color: var(--text); font-family: inherit; }
.form-field input:focus-visible { border-color: var(--primary); outline: none; box-shadow: var(--ring); }
.form-field input.mono-key { font-family: var(--mono); font-size: 13.5px; letter-spacing: -.01em; }
.form-msg { font-size: 13.5px; margin-top: 9px; min-height: 18px; }
.form-msg.ok { color: var(--green); } .form-msg.err { color: var(--red); }
.form-msg.info { color: var(--info); }
.key-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.key-status .dot { width: 9px; height: 9px; border-radius: 50%; }
.key-status.on { color: var(--green); } .key-status.on .dot { background: var(--green); }
.key-status.off { color: var(--text-faint); } .key-status.off .dot { background: var(--text-faint); }
.gate { display: none; }
.verify-note { background: var(--info-tint); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--text); margin-top: 6px; word-break: break-word; }
.verify-note a { font-weight: 700; }

/* магазины */
.store-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); margin-bottom: 10px; }
.store-badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.store-badge.wb { background: var(--wb); } .store-badge.ozon { background: var(--ozon); }
.store-meta { min-width: 0; } .store-meta b { font-size: 14.5px; } .store-meta div { font-size: 12.5px; color: var(--text-faint); }
.store-item .btn { margin-left: auto; }

/* ---------- калькулятор (перестроен для ясности) ---------- */
.calc-lead { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow-xs); margin-bottom: 20px; text-align: center; }
.calc-lead .cl-cap { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.calc-lead .cl-val { font-size: clamp(34px, 6vw, 48px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.calc-lead .cl-val.pos { color: var(--green); } .calc-lead .cl-val.neg { color: var(--red); }
.calc-lead .cl-sub { color: var(--text-muted); font-size: 15px; }
.calc-lead .cl-sub b { color: var(--text); }
.calc-grid { display: grid; grid-template-columns: 390px 1fr; gap: 22px; align-items: start; }
.flow { display: flex; flex-direction: column; gap: 2px; }
.flow-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.flow-row:last-child { border-bottom: none; }
.flow-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); }
.flow-ic svg { width: 15px; height: 15px; }
.flow-row .fl-name { font-size: 14px; color: var(--text-muted); }
.flow-row .fl-name small { display: block; color: var(--text-faint); font-size: 11.5px; }
.flow-row .fl-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; text-align: right; }
.flow-row.minus .fl-val { color: var(--red); }
.flow-row.result { background: var(--green-tint); border-radius: 12px; padding: 14px 12px; margin-top: 6px; border: none; }
.flow-row.result .fl-name { color: var(--text); font-weight: 700; font-size: 15px; }
.flow-row.result .fl-val { color: var(--green); font-size: 18px; }
.flow-row.result.neg { background: var(--red-tint); } .flow-row.result.neg .fl-val { color: var(--red); }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.mini-m { background: var(--surface-2); border-radius: 12px; padding: 14px; text-align: center; }
.mini-m .mm-cap { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.mini-m .mm-val { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 3px; letter-spacing: -.02em; }
.compare-toggle { margin-top: 20px; }
.compare-box { margin-top: 12px; display: none; }
.compare-box.open { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.cmp-card.ours { border-top: 3px solid var(--primary); }
.cmp-card.theirs { border-top: 3px solid var(--info); }
.cmp-card h4 { margin: 0 0 4px; font-size: 14px; }
.cmp-card .big { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.cmp-card .small { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.cmp-note { margin-top: 12px; font-size: 13px; color: var(--text-muted); background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }

.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
.foot-links a { color: var(--text-muted); text-decoration: none; }
.foot-links a:hover { color: var(--primary); }

/* ---------- предупреждения по месяцам периода ---------- */
.period-warn { display: flex; gap: 10px; align-items: flex-start; font-size: 13px;
  line-height: 1.45; color: var(--text-muted); background: var(--primary-tint);
  border: 1px solid var(--primary-tint-2); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; }
.period-warn.bad { background: var(--red-tint); border-color: var(--red); color: var(--text); }
.period-warn .pw-ic { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--primary); color: #fff; margin-top: 1px; }
.period-warn.bad .pw-ic { background: var(--red); }
.period-warn .pw-body > div + div { margin-top: 3px; }

/* ---------- индикатор свежести данных (под выбором магазина) ---------- */
.sb-fresh { margin: 8px 0 4px; }
.sb-fresh:empty { display: none; }
.sbf-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  background: var(--surface-2); border-radius: 11px; }
.sbf-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
  background: var(--green); }
.sb-fresh.busy .sbf-dot { background: var(--primary); animation: sbf-pulse 1.1s ease-in-out infinite; }
.sb-fresh.stale .sbf-dot { background: var(--amber); }
@keyframes sbf-pulse { 0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.75); } }
.sbf-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sbf-txt b { font-size: 12px; font-weight: 700; }
.sbf-txt span { font-size: 11px; color: var(--text-muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.sbf-btn { flex: 0 0 auto; width: 24px; height: 24px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 15px;
  line-height: 1; font-family: inherit; transition: .15s; }
.sbf-btn:hover { background: var(--surface); color: var(--primary); }
.sbf-btn:disabled { opacity: .4; cursor: default; }

/* ---------- здоровье товара ---------- */
.hl-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.hl-w { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2);
  border-radius: 999px; padding: 7px 14px 7px 8px; font-size: 13px; color: var(--text-muted); }
.hl-w b { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.hl-score { display: inline-block; font-weight: 800; font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.hl-score.ok { color: var(--green); }
.hl-score.warn { color: var(--amber, #c98a12); }
.hl-score.loss { color: var(--red); }

/* ---------- цена безубыточности и слайдер скидки ---------- */
.be-panel { margin-top: 20px; }
.be-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.be-card { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.be-card .be-cap { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.be-card .be-val { font-size: 22px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; margin: 3px 0 2px; }
.be-card .be-val.neg { color: var(--red); }
.be-card .be-val.pos { color: var(--green); }
.be-card .be-sub { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

.be-slider { margin-top: 18px; }
.be-slider-head { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.be-slider-head b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.be-slider input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }
.be-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.be-out .bo { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; text-align: center; }
.be-out .bo-cap { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.be-out .bo-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; margin-top: 2px; }
.be-out .bo-val.neg { color: var(--red); } .be-out .bo-val.pos { color: var(--green); }
.be-chart { width: 100%; height: auto; margin-top: 16px; display: block; }

@media (max-width: 720px) {
  .be-row, .be-out { grid-template-columns: 1fr; }
}

/* ---------- changelog ---------- */
.changelog { max-width: 780px; margin: 0 auto; }
.rel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-xs); margin-bottom: 18px; }
.rel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rel-head h3 { margin: 0; font-size: 19px; font-weight: 700; }
.rel-ver { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: var(--primary-700); background: var(--primary-tint); padding: 4px 10px; border-radius: 999px; }
.rel-date { color: var(--text-faint); font-size: 13px; }
.rel ul { margin: 0; padding-left: 20px; color: var(--text-muted); }
.rel li { padding: 3px 0; }
.rel .tag-new { color: var(--green); font-weight: 700; }
.rel .tag-fix { color: var(--accent); font-weight: 700; }

/* ---------- extension mock ---------- */
.ext-mock { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); padding: 20px; box-shadow: var(--shadow-lg); max-width: 340px; }
.ext-mock .pill { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: var(--ozon); padding: 3px 9px; border-radius: 7px; margin-bottom: 12px; }
.ext-line { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.ext-line .v { font-variant-numeric: tabular-nums; font-weight: 700; }

/* площадку задаёт активный магазин — переключатель WB/Ozon в аналитике не нужен */
body[data-page="dashboard"] #mp_toggle,
body[data-page="ads"] #mp_toggle,
body[data-page="finance"] #mp_toggle { display: none; }

/* ---------- AI-разбор рекламы ---------- */
.insights { display: flex; flex-direction: column; gap: 12px; }
.insight { border: 1px solid var(--border); border-left: 4px solid var(--text-faint);
  border-radius: 14px; padding: 15px 18px; background: var(--surface); }
.insight.critical { border-left-color: var(--red); }
.insight.warn { border-left-color: var(--amber); }
.insight.idea { border-left-color: var(--info); }
.insight.ok { border-left-color: var(--green); }
.insight .pill-flag { float: right; margin-left: 10px; }
.insight h4 { margin: 0 0 4px; font-size: 15px; }
.insight p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.insight .skus { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.sku-chip { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border-radius: 7px; padding: 3px 8px; color: var(--text-muted); }
.pill-flag.info { background: var(--info-tint); color: var(--info); }
.pill-flag.dim { background: var(--surface-3); color: var(--text-faint); }

/* ---------- умная таблица товаров ---------- */
.tbl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.tbl-toolbar .grow { flex: 1; min-width: 170px; }
.tbl-toolbar input[type=search], .tbl-toolbar input[type=text],
.tbl-toolbar input[type=number], .tbl-toolbar select {
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 12px;
  font-family: inherit; font-size: 13.5px; background: var(--surface); color: var(--text); }
.tbl-toolbar input[type=search] { width: 100%; }
.src-bar select { border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; }
.col-picker { position: relative; }
.col-menu { position: absolute; right: 0; top: 100%; margin-top: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-lg);
  padding: 10px; z-index: 30; display: none; min-width: 220px; max-height: 320px; overflow-y: auto; }
.col-menu.open { display: block; }
.col-menu label { display: flex; align-items: center; gap: 8px; font-size: 13.5px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text); white-space: nowrap; }
.col-menu label:hover { background: var(--surface-2); }
/* пресеты периода, тренды KPI, чипы-фильтры */
.presets { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; }
.preset-btn { border: none; background: transparent; padding: 7px 11px; border-radius: 9px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.preset-btn:hover { background: var(--surface-2); color: var(--text); }
.preset-btn.active { background: var(--primary-tint); color: var(--primary-700); }
.kpi-trend { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  vertical-align: 4px; white-space: nowrap; display: inline-block; line-height: 1.5; }
.kpi-trend.up { background: var(--green-tint); color: var(--green); }
.kpi-trend.down { background: var(--red-tint); color: var(--red); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 14px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.active { background: var(--primary); border-color: transparent; color: #fff; }
.chip-auto { border-style: dashed; opacity: .72; }

/* красная (опасная) кнопка — удаление в админке и т.п. */
.btn.danger { color: var(--red); border-color: var(--red-tint); }
.btn.danger:hover { background: var(--red-tint); border-color: var(--red); color: var(--red); }

/* лайтбокс: просмотр фото прямо на сайте */
.sl-lb { position: fixed; inset: 0; z-index: 120; background: rgba(14, 17, 27, .88);
  display: none; align-items: center; justify-content: center;
  padding: 56px 72px 104px; animation: lbIn .15s ease; }
.sl-lb.open { display: flex; }
@keyframes lbIn { from { opacity: 0 } to { opacity: 1 } }
body.lb-open { overflow: hidden; }
.sl-lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 100%; max-height: 100%; }
.sl-lb-fig img { max-width: 100%; max-height: calc(100vh - 210px); object-fit: contain;
  border-radius: 12px; background: #fff; box-shadow: 0 18px 60px rgba(0, 0, 0, .45); }
.sl-lb-fig figcaption { color: #fff; font-size: 13px; font-weight: 600; opacity: .85; }
.sl-lb-x, .sl-lb-nav { position: absolute; border: none; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, .14); backdrop-filter: blur(4px); transition: .15s; }
.sl-lb-x:hover, .sl-lb-nav:hover { background: rgba(255, 255, 255, .3); }
.sl-lb-x { top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; font-size: 17px; }
.sl-lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px;
  border-radius: 50%; font-size: 30px; line-height: 1; padding-bottom: 4px; }
.sl-lb-nav.prev { left: 16px; }
.sl-lb-nav.next { right: 16px; }
.sl-lb-strip { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; max-width: 92vw; overflow-x: auto; padding: 4px; }
.sl-lb-strip img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px;
  cursor: pointer; opacity: .5; border: 2px solid transparent; transition: .15s; flex: 0 0 auto; }
.sl-lb-strip img:hover { opacity: .85; }
.sl-lb-strip img.on { opacity: 1; border-color: #fff; }
@media (max-width: 700px) {
  .sl-lb { padding: 48px 10px 96px; }
  .sl-lb-nav { width: 38px; height: 38px; font-size: 24px; }
  .sl-lb-nav.prev { left: 6px; } .sl-lb-nav.next { right: 6px; }
}

/* фото в отзыве */
.rv-photos { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 2px; }
.rv-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); display: block; transition: .15s; }
.rv-photos a:hover img { border-color: var(--primary); transform: scale(1.04); }
.rv-answered { margin-top: 10px; font-size: 13px; color: var(--green);
  background: var(--green-tint); border-radius: 10px; padding: 8px 12px; }

/* ответ на отзыв */
.rv-answer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.rv-answer .rv-text { flex: 1; resize: vertical; min-height: 40px; font-family: inherit;
  font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--text); }
.rv-answer .btn { flex: 0 0 auto; }

.tbl th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .arr { font-size: 9px; color: var(--primary); }
/* Артикул — узкий, в одну строку; название — обрезаем многоточием (полное в
   подсказке), иначе длинные наименования распирают таблицу и приходится
   скроллить по горизонтали. */
/* Артикул: длинные вариант-коды WB (ПС5790ШОКОЛАД/Ж6032АШ) растягивали колонку
   до 220px. max-width на самой td в авто-таблице игнорируется — обрезаем через
   вложенный span, полный код в подсказке. */
/* «Здоровье»: фиксированная раскладка — колонки держат заданную ширину (см.
   colgroup), таблица всегда по ширине контейнера, горизонтального скролла нет. */
#hl_table { table-layout: fixed; width: 100%; }
#hl_table td, #hl_table th { overflow: hidden; }
.tbl td a { color: var(--primary-600); }
.tbl td a:hover { color: var(--primary-700); text-decoration: underline; }
.tbl td.c-art a { display: block; }
.tbl td.c-art span { display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tbl td.c-name { max-width: 190px; }
.tbl td.c-name span { display: inline-block; max-width: 190px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* «Что не так» на «Здоровье»: плашки переносятся внутри ограниченной ширины,
   а не тянут таблицу вправо. */
.tbl td.c-problems { max-width: 250px; white-space: normal; line-height: 1.9; }
.tbl td.c-problems .pill-flag { white-space: nowrap; }
@media (max-width: 720px) {
  .tbl td.c-art { max-width: 90px; }
  .tbl td.c-name, .tbl td.c-name span { max-width: 130px; }
  .tbl td.c-problems { max-width: 190px; }
}
.tbl-count { font-size: 12.5px; color: var(--text-faint); margin-top: 10px; }

/* ---------- левый сайдбар (app-оболочка) ---------- */
.app-shell { padding-left: 252px; }
/* внутри приложения страница адаптивна: занимает весь экран (с полями),
   а широкая таблица скроллится по горизонтали внутри своей карточки */
.app-shell .wrap { max-width: none; padding-right: 32px; }
.app-shell main.wrap { overflow-x: hidden; }         /* страница не расползается */
.chart-card { min-width: 0; }
.chart-card > div[style*="overflow-x"] { max-width: 100%; }
.tbl th, .tbl td { white-space: nowrap; }
/* SKU-колонка узкая по содержимому, «Товар» получает всё остальное место */
.tbl th:first-child, .tbl td:first-child { width: 1%; }
.tbl td:nth-child(2) { white-space: normal; min-width: 220px; max-width: 420px; }
.tbl thead th, .tbl tr:first-child th { position: sticky; top: 0;
  background: var(--surface); z-index: 2; }

/* ---------- пагинация таблиц ---------- */
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.pager .grow { flex: 1; }
.pager button { border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 9px; padding: 6px 12px; font-family: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-muted); cursor: pointer; }
.pager button:hover { border-color: var(--primary); color: var(--text); }
.pager button.active { background: var(--primary); border-color: transparent; color: #fff; }

/* ---------- профиль: кабинет с вкладками ---------- */
body[data-page="profile"] .auth-wrap { max-width: 1080px; }
#keys_panel { display: block; }
#keys_panel.gate { display: none; }
#keys_panel .panel { margin: 0; }

/* шапка аккаунта */
.prof-account { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow-xs); margin-bottom: 16px; flex-wrap: wrap; }
.prof-id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.prof-av { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800;
  font-size: 18px; text-transform: uppercase; }
.prof-id > div { min-width: 0; }
.prof-id b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.prof-plan { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.prof-plan .pill-flag { margin-left: 2px; }
.prof-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* вкладки настроек */
.prof-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 5px; border-radius: 14px;
  margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.prof-tabs::-webkit-scrollbar { display: none; }
.prof-tabs button { flex: 0 0 auto; padding: 9px 16px; border: none; border-radius: 10px;
  background: transparent; font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); white-space: nowrap; transition: .15s; }
.prof-tabs button:hover { color: var(--text); }
.prof-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.prof-sec { display: none; }
.prof-sec.active { display: block; animation: profFade .18s ease; }
@keyframes profFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .prof-grid { grid-template-columns: 1fr; } }
.app-shell .topbar { display: none; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 252px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px 12px;
  overflow-y: auto; z-index: 40; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 12px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.03em; }
.sb-store { position: relative; margin: 0 2px 6px; }
.sb-store-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface); cursor: pointer; text-align: left; font-family: inherit; }
.sb-store-btn:hover { border-color: var(--primary); }
.sb-store-btn .sb-store-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; flex: none; }
.sb-store-badge.wb { background: var(--wb); } .sb-store-badge.ozon { background: var(--ozon); } .sb-store-badge.none { background: var(--text-faint); }
.sb-store-info { min-width: 0; flex: 1; } .sb-store-info b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-store-info span { font-size: 11.5px; color: var(--text-faint); }
.sb-store-btn .chev { color: var(--text-faint); flex: none; }
.sb-store-menu { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none; }
.sb-store-menu.open { display: block; }
.sb-store-opt { padding: 9px 10px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); }
.sb-store-opt:hover { background: var(--surface-2); }
.sb-store-opt.add { color: var(--primary-700); font-weight: 700; }
.sb-store-opt .dotb { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }
.sb-group { margin-top: 12px; }
.sb-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 700; padding: 8px 12px 4px; }
.sb-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: var(--text-muted); font-weight: 600; font-size: 14px; }
.sb-item svg { width: 18px; height: 18px; flex: none; }
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item.active { background: var(--primary-tint); color: var(--primary-700); }
.sb-user { margin-top: auto; padding: 10px 8px 4px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sb-user .av { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-tint); color: var(--primary-700); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.sb-user .um { min-width: 0; flex: 1; } .sb-user .um b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .um span { font-size: 11px; color: var(--text-faint); }
.sb-user .lo { color: var(--text-faint); cursor: pointer; background: none; border: none; padding: 6px; border-radius: 8px; }
.sb-user .lo:hover { background: var(--surface-2); color: var(--red); }
.sb-toggle { display: none; }
@media (max-width: 900px) {
  .app-shell { padding-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sb-open .sidebar { transform: none; }
  .sb-toggle { display: inline-flex; position: fixed; top: 12px; left: 12px; z-index: 45; width: 42px; height: 42px;
    align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 11px; cursor: pointer; box-shadow: var(--shadow); }
  .app-shell main.wrap, .app-shell .wrap { padding-top: 8px; }
}

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 34px 0; color: var(--text-faint); font-size: 13.5px; }
.foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .features { grid-template-columns: 1fr 1fr; }
  .calc-grid, .split, .two-col, .cmp-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .nav a:not(.nav-cta):not(.who) { display: none; }
  /* На лендинге и других страницах БЕЗ сайдбара гамбургера нет, поэтому прятать
     меню целиком нельзя — иначе с телефона недостижимы «Тариф» и «Справка».
     Оставляем ссылки, но компактнее и с горизонтальной прокруткой. */
  /* min-width:0 обязателен: без него флекс-элемент не сжимается меньше своего
     содержимого, и вместо прокрутки внутри меню горизонтально едет вся страница */
  body:not(.app-shell) .nav { overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin-left: auto; min-width: 0; flex: 1 1 auto; }
  body:not(.app-shell) .topbar-inner { overflow: hidden; }
  body:not(.app-shell) .nav::-webkit-scrollbar { display: none; }
  body:not(.app-shell) .nav a:not(.nav-cta):not(.who) {
    display: inline-block; padding: 7px 9px; font-size: 13px; white-space: nowrap; }
  body:not(.app-shell) .topbar-inner { gap: 12px; }
  body:not(.app-shell) .brand small { display: none; }
}
@media (max-width: 560px) {
  .features, .kpi-row, .field-row, .mini-metrics { grid-template-columns: 1fr; }
  .mini-metrics { grid-template-columns: repeat(3,1fr); }
}

/* ---------- мобильные (телефон) ---------- */
@media (max-width: 640px) {
  .wrap, .app-shell .wrap { padding-left: 14px; padding-right: 14px; }
  .kpi-row, #ov_kpi { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .kpi { padding: 14px 15px; } .kpi .num { font-size: 22px; }
  .chart-card { padding: 16px 15px; }
  h2 { font-size: 22px !important; }
  /* тулбары таблиц переносятся и растягиваются на всю ширину */
  .tbl-toolbar { gap: 8px; }
  .tbl-toolbar > *, .tbl-toolbar .grow { flex: 1 1 100%; min-width: 0; }
  .tbl-toolbar select, .tbl-toolbar input, .tbl-toolbar .btn { width: 100%; }
  .src-bar { flex-direction: column; align-items: stretch; }
  .src-dates { flex-wrap: wrap; }
  .presets { width: 100%; }
  .presets .preset-btn { flex: 1; }
  /* верхняя панель на app-страницах — компактнее под кнопку-гамбургер */
  .app-shell main.wrap { padding-top: 54px; }
  /* горизонтальный скролл таблиц с явной подсказкой-тенью */
  .chart-card > div[style*="overflow-x"] { -webkit-overflow-scrolling: touch; }
  .wf-row { grid-template-columns: minmax(90px,1fr) 1.2fr max-content; gap: 8px; }
  .price-val { font-size: 34px; }
}

/* спарклайн (мини-график выручки) */
.spark { width: 100%; height: 90px; display: block; }

/* на телефоне первую колонку (SKU/название) «примораживаем» при горизонтальном
   скролле — видно, к какой строке относятся столбцы справа */
@media (max-width: 640px) {
  .tbl th:first-child, .tbl td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .tbl tr:hover td:first-child { background: var(--surface-2); }
  .tbl thead th:first-child, .tbl tr:first-child th:first-child { z-index: 3; }
  .spark { height: 70px; }
}

/* ---- плавающий горизонтальный скролл широких таблиц (низ экрана) ---- */
.hscroll-dock { position: fixed; bottom: 0; height: 14px; overflow-x: auto; overflow-y: hidden;
  z-index: 70; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(4px); border-top: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.hscroll-dock > div { height: 1px; }

/* ================= Редизайн «Индиго-аналитика»: полировка ================= */
/* карточка товара: фото — компактная колонка, не полэкрана */
body[data-page="card"] #cd_grid { grid-template-columns: minmax(230px, 320px) 1fr; }
body[data-page="card"] #cd_photo { max-height: 320px; }
@media (max-width: 900px) { body[data-page="card"] #cd_grid { grid-template-columns: 1fr; } }

/* KPI-плитки: спокойнее и чётче */
.kpi { transition: box-shadow .18s ease, transform .18s ease; }
.kpi:hover { box-shadow: var(--shadow); }
.kpi .cap { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.kpi-trend { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: 3px; }
.kpi-trend.up { color: var(--green); background: var(--green-tint); }
.kpi-trend.down { color: var(--red); background: var(--red-tint); }

/* таблицы: тише границы, воздух */
.tbl th { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; color: var(--text-faint); }
.tbl td { border-color: var(--border); }
.tbl tr:hover td { background: var(--surface-2); }

/* график */
.trend { width: 100%; height: 300px; }

/* кнопки и переключатели: мягкие */
.btn { transition: background .16s ease, box-shadow .16s ease, color .16s ease; }
.mp-toggle button.active { background: var(--primary); color: #fff; }
.preset-btn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.preset-btn:hover { border-color: var(--primary); color: var(--primary-700); }
.preset-btn.active { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-700); }

/* ---- модалка-расшифровка метрик (клик по KPI) ---- */
.sl-modal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center;
  background: rgba(29, 37, 64, .38); backdrop-filter: blur(3px); padding: 20px; }
.sl-modal.open { display: grid; }
.sl-modal-box { position: relative; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px 26px; max-width: 520px; width: 100%;
  max-height: 80vh; overflow-y: auto; }
.sl-modal-x { position: absolute; top: 12px; right: 12px; border: none; background: var(--surface-2);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer; color: var(--text-muted); }
.sl-modal-x:hover { background: var(--surface-3); color: var(--text); }
.sl-modal-box ul { margin: 6px 0 10px; padding-left: 20px; }
.sl-modal-box li { margin-bottom: 4px; }

/* ---- полноэкранный отчёт-таблица ---- */
.sl-modal-box.full { max-width: min(1180px, 96vw); width: 96vw; height: 92vh;
  max-height: 92vh; display: flex; flex-direction: column; padding: 20px 22px; }
.sl-modal-box.full .sl-modal-x { position: static; flex: none; }
.sl-modal-box.full .pager { flex: none; margin-top: 10px; }

/* ---- поле-ловушка для ботов: невидимо, но не display:none (боты его пропускают) ---- */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- опасная зона: удаление аккаунта ---- */
.danger-zone { border: 1px solid var(--red); }
.danger-zone h3 { color: var(--red); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover { filter: brightness(.94); }

/* ---- полоса демо-режима ---- */
.demo-bar { background: var(--primary-tint); border: 1px solid var(--primary);
  color: var(--primary-700); border-radius: var(--radius); padding: 10px 14px;
  margin: 0 0 16px; font-size: 13.5px; }
.demo-bar a { font-weight: 600; }

/* ---- витрина тарифов: три карточки ---- */
.price-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); align-items: start; }
.price-card.tier { position: relative; }
.price-card.featured { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.price-card.current { border-color: var(--green); }
.tier-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; border-radius: 999px; padding: 3px 12px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tier-badge.cur { background: var(--green); top: auto; bottom: -11px; }
@media (max-width: 860px) { .price-grid { grid-template-columns: 1fr; } }

/* ---- магазин сверх лимита тарифа ---- */
.store-item.locked { opacity: .72; border-color: var(--red); }
.hint.limit-full { color: var(--red); }

/* ---- реквизиты в подвале главной ---- */
.foot-req { padding: 10px 0 4px; font-size: 12.5px; color: var(--text-muted);
  border-top: 1px solid var(--border); margin-top: 12px; }
.foot-req a { color: var(--text-muted); }
.foot-req a:hover { color: var(--primary); }
