/* ===========================================================================
   Панель маркетплейсов — дизайн-система.
   Опора на визуальный язык Apple: спокойный фон, крупная типографика,
   матовое стекло, мягкие тени, «пружинные» переходы.
   =========================================================================== */

:root {
  color-scheme: light;

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-hover: rgba(255, 255, 255, 0.92);
  --glass: rgba(250, 250, 252, 0.72);

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #a1a1a6;

  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);

  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --positive: #1d9c5c;
  --negative: #d7263d;
  --warning: #b7791f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1), 0 32px 64px rgba(0, 0, 0, 0.14);

  --wb: #cb11ab;
  --ozon: #005bff;
  --yandex: #fc3f1d;
  --ali: #ff6a00;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --pill: 980px;

  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gap: 20px;
  --topbar-height: 132px;
}

html[data-theme="dark"],
html[data-theme="auto"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { color-scheme: dark; }
}

html[data-theme="dark"],
html[data-theme="auto"]:where(.dark-preferred) { color-scheme: dark; }

/* Тёмная палитра: применяется и по системной настройке, и по ручному выбору */
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --surface: rgba(28, 28, 30, 0.72);
    --surface-solid: #1c1c1e;
    --surface-hover: rgba(44, 44, 46, 0.92);
    --glass: rgba(20, 20, 22, 0.72);

    --text: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #6e6e73;

    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);

    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --positive: #30d158;
    --negative: #ff453a;
    --warning: #ff9f0a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);

    --wb: #e754c8;
    --ozon: #4d94ff;
    --yandex: #ff6b4d;
    --ali: #ff8c3a;
  }
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --surface: rgba(28, 28, 30, 0.72);
  --surface-solid: #1c1c1e;
  --surface-hover: rgba(44, 44, 46, 0.92);
  --glass: rgba(20, 20, 22, 0.72);

  --text: #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary: #6e6e73;

  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);

  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --positive: #30d158;
  --negative: #ff453a;
  --warning: #ff9f0a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);

  --wb: #e754c8;
  --ozon: #4d94ff;
  --yandex: #ff6b4d;
  --ali: #ff8c3a;
}

*,
*::before,
*::after { box-sizing: border-box; }

/* Наши классы задают display, поэтому атрибут hidden нужно усилить явно. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Inter", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Едва заметная зернистость — убирает «пластиковость» больших плоскостей */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, select { font: inherit; color: inherit; }

::selection { background: var(--accent-soft); }

/* --- Общие элементы управления ------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--pill);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s var(--ease-out), transform 0.22s var(--ease-spring),
              border-color 0.22s var(--ease-out), opacity 0.2s;
}

.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }

.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { filter: brightness(1.08); }

.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--text); backdrop-filter: blur(20px); }
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--line-strong); }

.btn--wide { width: 100%; justify-content: center; height: 44px; }

.btn:disabled { opacity: 0.4; cursor: default; transform: none; filter: none; }

.btn--danger { color: var(--negative); }
.btn--danger:hover { background: color-mix(in srgb, var(--negative) 12%, transparent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(20px);
  cursor: pointer;
  transition: background 0.22s var(--ease-out), transform 0.22s var(--ease-spring),
              border-color 0.2s;
}

.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.icon-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.icon-btn.is-spinning svg { animation: spin 1.1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn:active { transform: scale(0.93); }

html[data-theme="dark"] .icon-sun, html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun, html[data-theme="dark"] .icon-moon { display: block; }
html[data-theme="auto"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .icon-sun { display: none; }
  html[data-theme="auto"] .icon-moon { display: block; }
}

/* --- Экран входа ---------------------------------------------------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.gate__card {
  width: min(380px, 100%);
  padding: 40px 32px 32px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: rise 0.7s var(--ease-spring) both;
}

.gate__mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #bf5af2);
  box-shadow: 0 10px 30px rgba(10, 132, 255, 0.35);
}

.gate__title { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.gate__hint { margin: 0 0 24px; color: var(--text-secondary); font-size: 14px; }

.gate__input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate__input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.gate__error { margin: 0 0 14px; color: var(--negative); font-size: 13px; }

/* --- Шапка ---------------------------------------------------------------- */

.app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 14px 28px 10px;
}

.topbar__brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #bf5af2);
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.3);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.brand__sub { font-size: 11px; color: var(--text-tertiary); letter-spacing: 0; }

.tabs { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s var(--ease-out), color 0.22s;
}

.tab:hover { background: var(--surface); color: var(--text); }
.tab.is-active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.tab__close { display: none; opacity: 0.5; font-size: 16px; line-height: 1; }
.tab.is-active .tab__close { display: inline; }
.tab__close:hover { opacity: 1; }

.topbar__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.filters {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 28px 14px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.segment {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.28s var(--ease-spring), color 0.2s, box-shadow 0.28s;
}

.segment:hover { color: var(--text); }
.segment.is-active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.24s var(--ease-out);
}

.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-tertiary)); transition: transform 0.24s var(--ease-spring); }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.is-active { background: var(--surface-solid); color: var(--text); border-color: transparent; box-shadow: var(--shadow-sm); }
.chip.is-active .chip__dot { transform: scale(1.25); }
.chip:not(.is-active) .chip__dot { opacity: 0.35; }

/* Счётчик рядом с именем кабинета — справка, а не тревога. Красный кружок
   приберегаем для входящих, где число действительно требует действия. */
.chip__count {
  margin-left: 3px;
  padding: 0 6px;
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--text-tertiary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chip.is-active .chip__count { color: var(--text-secondary); }


/* ---------------------------------------------------------------------------
   Переключатель разделов. Одно место на всех страницах: где вы сейчас —
   написано, куда можно уйти — в списке. Ведёт себя как меню в строке заголовка
   у Mac: нажали, выбрали, оно закрылось.
   --------------------------------------------------------------------------- */

.navpick { position: relative; }

.navpick__button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease-out);
}
.navpick__button:hover { background: var(--surface-hover); }
.navpick__button[aria-expanded="true"] { background: var(--surface-hover); }

.navpick__now { display: flex; flex-direction: column; line-height: 1.2; }
.navpick__title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.navpick__sub { font-size: 11px; color: var(--text-tertiary); }

.navpick__chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.24s var(--ease-spring);
}
.navpick__button[aria-expanded="true"] .navpick__chevron { transform: rotate(180deg); }

.navpick__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 268px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  animation: navpick-in 0.2s var(--ease-out);
}

@keyframes navpick-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.navpick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: background 0.16s var(--ease-out);
}
.navpick__item:hover { background: var(--surface-hover); }
.navpick__item.is-current { background: var(--accent-soft); }

.navpick__itemtext { display: flex; flex-direction: column; line-height: 1.25; margin-right: auto; }
.navpick__itemtitle { font-size: 14px; font-weight: 550; }
.navpick__itemsub { font-size: 11.5px; color: var(--text-tertiary); }
.navpick__tick { color: var(--accent); font-weight: 700; }

@media (max-width: 720px) {
  .navpick__sub { display: none; }
  .navpick__menu { min-width: 220px; }
}

.filters__meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.meta__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-tertiary); }
.meta__dot.is-live { background: var(--positive); box-shadow: 0 0 0 0 color-mix(in srgb, var(--positive) 60%, transparent); animation: pulse 2.4s infinite; }
.meta__dot.is-demo { background: var(--warning); }
.meta__dot.is-error { background: var(--negative); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--positive) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* --- Панель режима настройки ---------------------------------------------- */

.editbar {
  position: sticky;
  top: var(--topbar-height);
  z-index: 25;
  background: color-mix(in srgb, var(--accent) 10%, var(--glass));
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line);
  animation: slide-down 0.45s var(--ease-spring) both;
}

.editbar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1560px;
  margin: 0 auto;
  padding: 11px 28px;
}

.editbar__hint { font-size: 13.5px; color: var(--text-secondary); }
.editbar__hint strong { color: var(--text); font-weight: 600; }
.editbar__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Сетка блоков --------------------------------------------------------- */

/* Полоса-предупреждение над доской: например, что период глубже данных. */
.notice-strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 28px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Заметок может быть несколько — ставим их друг под другом, а не в строку. */
.notice-strip__lines { display: flex; flex-direction: column; gap: 4px; }

.notice-strip::before {
  content: "!";
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--warning) 20%, transparent);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
}

.notice-strip strong { color: var(--text); font-weight: 600; }

@media (max-width: 900px) {
  .notice-strip { padding: 14px 18px 0; }
}

/* Строка периода занимает всю ширину доски и стоит над карточками. */
.board__period {
  grid-column: 1 / -1;
  margin: -4px 0 2px;
  font-size: 13px;
  color: var(--text-secondary);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
  flex: 1;
  align-content: start;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise 0.6s var(--ease-spring) both;
  transition: box-shadow 0.35s var(--ease-out), transform 0.35s var(--ease-spring),
              opacity 0.3s, border-color 0.3s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card[data-size="sm"] { grid-column: span 1; }
.card[data-size="md"] { grid-column: span 2; }
.card[data-size="lg"] { grid-column: span 3; }
.card[data-size="xl"] { grid-column: span 4; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.01em; text-transform: uppercase; }
.card__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-tertiary); text-transform: none; letter-spacing: -0.01em; font-weight: 400; }
.card__body { flex: 1; min-width: 0; }

/* Крупное число — главный визуальный акцент карточки показателя */
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric__value {
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
/* Две величины в одной карточке: штуки крупно, деньги рядом и чуть тише. */
/* Цепочка «куда уходят деньги»: от продажи до суммы на расчётный счёт. */
.costs { display: flex; flex-direction: column; gap: 10px; }
.costs__row {
  display: grid;
  grid-template-columns: minmax(120px, 1.3fr) minmax(60px, 2fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.costs__name { color: var(--text-secondary); }
.costs__track { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.costs__fill { height: 100%; border-radius: 4px; background: var(--negative); opacity: 0.55; }
.costs__value { font-variant-numeric: tabular-nums; white-space: pre; color: var(--text-tertiary); }
.costs__row.is-in .costs__fill,
.costs__row.is-out .costs__fill { background: var(--positive); opacity: 0.75; }
.costs__row.is-in .costs__name,
.costs__row.is-out .costs__name,
.costs__row.is-in .costs__value,
.costs__row.is-out .costs__value { color: var(--text); font-weight: 600; }

/* Подпись под названием строки таблицы — категория товара у родителя. */
.cell-note { display: block; margin-top: 2px; font-size: 12px; color: var(--text-tertiary); }

.metric__pair { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.metric__value--second {
  font-size: clamp(19px, 1.7vw, 26px);
  color: var(--text-secondary);
}

.metric__value.is-long { font-size: clamp(23px, 2.1vw, 32px); }
.metric__value.is-very-long { font-size: clamp(19px, 1.7vw, 26px); }
.metric__value--second.is-long { font-size: clamp(16px, 1.4vw, 21px); }
.metric__value--second.is-very-long { font-size: clamp(14px, 1.2vw, 18px); }

.metric__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.metric__foot { font-size: 12.5px; color: var(--text-tertiary); }
/* Среднее за день — второй по важности ориентир после самой цифры. */
.metric__perday {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-secondary);
}

.delta--up { background: color-mix(in srgb, var(--positive) 14%, transparent); color: var(--positive); }
.delta--down { background: color-mix(in srgb, var(--negative) 14%, transparent); color: var(--negative); }
.delta svg { width: 12px; height: 12px; fill: currentColor; }

.spark { margin-top: 14px; width: 100%; height: 96px; display: block; overflow: visible; cursor: crosshair; }
.spark__marker, .spark__rule { transition: opacity 0.15s var(--ease-out); pointer-events: none; }
/* Разлиновка и подписи не спорят с данными: волосяная сплошная линия
   на шаг от фона и текст обычным приглушённым цветом, не цветом ряда. */
.spark__grid { stroke: var(--line); stroke-width: 1; }
.spark__tick {
  font-size: 10px;
  fill: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* --- Режим настройки: элементы управления блоком --------------------------- */

.board.is-editing .card { cursor: grab; border-color: var(--line-strong); }
.board.is-editing .card:active { cursor: grabbing; }
.board.is-editing .card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.board.is-editing .card:hover::after { opacity: 1; }

.card.is-hidden { opacity: 0.42; }
.card.is-hidden .card__body { filter: grayscale(1); }

.card.is-dragging {
  opacity: 0.35;
  transform: scale(0.97);
  box-shadow: var(--shadow-lg);
}

.card.is-drop-target { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }

.card__tools {
  display: none;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.board.is-editing .card__tools { display: inline-flex; }

.tool {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease-spring);
}

.tool svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--surface-solid); color: var(--text); transform: scale(1.08); }
.tool--danger:hover { color: var(--negative); }
.tool--size { width: auto; padding: 0 9px; border-radius: var(--pill); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }

/* --- Графики -------------------------------------------------------------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart__grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.chart__axis { font-size: 11px; fill: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.chart__line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart__area { opacity: 0.16; }
.chart__dot { transition: r 0.2s var(--ease-spring); }
.chart__hit { fill: transparent; cursor: crosshair; }
.chart__bar { transition: opacity 0.2s; }
.chart__bar:hover { opacity: 0.75; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); cursor: default; }
.legend__swatch { width: 9px; height: 9px; border-radius: 3px; }
.legend__value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.tooltip {
  position: fixed;
  z-index: 50;
  padding: 9px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  font-size: 12.5px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.15s;
  white-space: nowrap;
}

.tooltip.is-visible { opacity: 1; }
.tooltip__title { color: var(--text-tertiary); margin-bottom: 3px; }
.tooltip__row { display: flex; align-items: center; gap: 7px; }
.tooltip__value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Кольцевая диаграмма и прогресс --------------------------------------- */

.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut__chart { flex-shrink: 0; }
.donut__center { text-anchor: middle; }
.donut__total { font-size: 17px; font-weight: 600; fill: var(--text); letter-spacing: -0.02em; }
.donut__total--long { font-size: 13px; }
.donut__caption { font-size: 10px; fill: var(--text-tertiary); }
.donut__list { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 9px; }

.share-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.share-row__dot { width: 10px; height: 10px; border-radius: 3px; }
.share-row__name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row__value { font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-list { display: flex; flex-direction: column; gap: 13px; }
.bar-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.bar-item__name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-item__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-item__track { grid-column: 1 / -1; height: 6px; border-radius: var(--pill); background: color-mix(in srgb, var(--text) 7%, transparent); overflow: hidden; }
.bar-item__fill { height: 100%; border-radius: var(--pill); transform-origin: left; animation: grow 0.9s var(--ease-spring) both; }

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- Таблицы -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -22px -6px; padding: 0 22px 6px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 0 12px 10px 0;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.table th:first-child, .table td:first-child { text-align: left; padding-left: 0; }
.table td { padding: 11px 12px 11px 0; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody tr { transition: background 0.18s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.table td.is-name { white-space: normal; min-width: 200px; max-width: 340px; color: var(--text); }
.table td.is-muted { color: var(--text-secondary); }
.cell-mp { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.cell-mp__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 9px; border-radius: 6px; background: color-mix(in srgb, var(--text) 7%, transparent); font-size: 11px; font-weight: 700; color: var(--text-secondary); }

/* --- Списки (остатки, отзывы) --------------------------------------------- */

.list { display: flex; flex-direction: column; gap: 2px; }
.list__row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list__row:first-child { border-top: 0; }
.list__main { flex: 1; min-width: 0; }
.list__name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.list__value { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--pill); font-size: 11.5px; font-weight: 600; }
.badge--critical { background: color-mix(in srgb, var(--negative) 15%, transparent); color: var(--negative); }
.badge--warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge--ok { background: color-mix(in srgb, var(--positive) 14%, transparent); color: var(--positive); }
.badge--muted { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text-secondary); }

.stars { display: inline-flex; gap: 1px; color: var(--warning); font-size: 12px; letter-spacing: 1px; }
.review { padding: 12px 0; border-top: 1px solid var(--line); }
.review:first-child { border-top: 0; }
.review__head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.review__name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review__text { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }

/* --- Воронка -------------------------------------------------------------- */

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel__step { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.funnel__name { color: var(--text-secondary); }
.funnel__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel__track { grid-column: 1 / -1; height: 28px; border-radius: 9px; background: color-mix(in srgb, var(--text) 5%, transparent); overflow: hidden; }
.funnel__fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #bf5af2)); transform-origin: left; animation: grow 0.9s var(--ease-spring) both; }
.funnel__conv { font-size: 11.5px; color: var(--text-tertiary); margin-top: -4px; }

/* --- Юнит-экономика ------------------------------------------------------- */

.economics { display: flex; flex-direction: column; gap: 16px; }
.economics__bar { display: flex; height: 34px; border-radius: 11px; overflow: hidden; background: color-mix(in srgb, var(--text) 5%, transparent); }
.economics__seg { position: relative; transition: filter 0.2s; animation: grow 0.85s var(--ease-spring) both; transform-origin: left; }
.economics__seg:hover { filter: brightness(1.12); }
.economics__legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.eco-item { display: flex; flex-direction: column; gap: 2px; }
.eco-item__label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.eco-item__swatch { width: 9px; height: 9px; border-radius: 3px; }
.eco-item__value { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.eco-item__share { font-size: 11.5px; color: var(--text-tertiary); }

.block-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-tertiary);
}

/* --- План продаж ---------------------------------------------------------- */

.goal { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.goal__ring { transform: rotate(-90deg); }
.goal__track { fill: none; stroke: color-mix(in srgb, var(--text) 8%, transparent); }
.goal__value { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease-spring); }
.goal__center { text-align: center; }
.goal__percent { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.goal__caption { font-size: 12.5px; color: var(--text-tertiary); }
.goal__input { width: 130px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; outline: none; }
.goal__input:focus { border-color: var(--accent); }

/* --- Статус подключений --------------------------------------------------- */

.health { display: flex; flex-direction: column; gap: 2px; }
.health__row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line); }
.health__row:first-child { border-top: 0; }
.health__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.health__name { flex: 1; font-size: 13.5px; }
.health__warning {
  padding: 0 0 8px 20px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-tertiary);
}

/* --- Пустое состояние и скелетоны ------------------------------------------ */

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 26px 12px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.empty svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; opacity: 0.5; }

.board-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 90px 20px; text-align: center; color: var(--text-secondary); }
.board-empty h2 { margin: 0; font-size: 21px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.board-empty p { margin: 0; max-width: 380px; font-size: 14px; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, color-mix(in srgb, var(--text) 11%, transparent) 37%, color-mix(in srgb, var(--text) 6%, transparent) 63%); background-size: 400% 100%; animation: shimmer 1.5s ease infinite; }
.skeleton--value { height: 38px; width: 62%; margin-bottom: 10px; }
.skeleton--line { height: 11px; width: 100%; margin-bottom: 8px; }
.skeleton--line.is-short { width: 45%; }
.skeleton--block { height: 130px; width: 100%; }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* --- Выдвижные панели ------------------------------------------------------ */

.sheet { position: fixed; inset: 0; z-index: 45; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(3px); animation: fade 0.3s ease both; }

.sheet__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.45s var(--ease-spring) both;
}

.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.sheet__hint {
  margin: 0;
  padding: 14px 22px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-tertiary);
}
.sheet__body { flex: 1; overflow-y: auto; padding: 16px 22px 28px; }

.sheet--center { display: grid; place-items: center; padding: 20px; }
.dialog { position: relative; width: min(340px, 100%); padding: 24px; border-radius: 22px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: rise 0.45s var(--ease-spring) both; }
.dialog__title { margin: 0 0 18px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; font-size: 14px; color: var(--text-secondary); }
.field input { height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); outline: none; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Страница ключей маркетплейсов ----------------------------------------- */

.sheet__panel--wide { width: min(620px, 100%); }
.sheet__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-tertiary); }

.keys__intro { margin: 0 0 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.notice {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.5;
}

.notice--warning {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warning) 32%, transparent);
}

.keycard {
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--text) 2.5%, transparent);
}

.keycard__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.keycard__dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.keycard__title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.keycard__docs { margin-left: auto; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.keycard__docs:hover { text-decoration: underline; }

.store {
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  transition: opacity 0.25s;
}

.store--off { opacity: 0.55; }
.store__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }

.store__title {
  flex: 1;
  min-width: 140px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.store__title:hover:not(:disabled) { border-color: var(--line); }
.store__title:focus { border-color: var(--accent); background: var(--bg); }
.store__title:disabled { color: var(--text-secondary); }

.store__actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.store__actions .btn { height: 32px; font-size: 13px; }

.store-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.store-add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.store-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.keyfield { margin-bottom: 12px; }
.keyfield__label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.keyfield__name { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.keyfield__optional { font-size: 11px; color: var(--text-tertiary); }

.keyfield__control { display: flex; gap: 6px; }

.keyfield__input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.keyfield__input::placeholder { font-family: inherit; color: var(--text-tertiary); }
.keyfield__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.keyfield__input:disabled { background: transparent; color: var(--text-tertiary); }

.keyfield__eye {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.keyfield__eye svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.keyfield__eye:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }

.keyfield__foot { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.keyfield__hint { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.4; }

.keyfield__erase {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 11.5px;
  color: var(--negative);
  cursor: pointer;
  text-decoration: underline;
}

/* Результат проверки связи */
.probe {
  margin-top: 14px;
  padding: 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg);
  animation: rise 0.4s var(--ease-spring) both;
}

.probe--ok { border-color: color-mix(in srgb, var(--positive) 40%, transparent); }
.probe--warn { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.probe--bad { border-color: color-mix(in srgb, var(--negative) 35%, transparent); }
.probe__head { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.probe__row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; flex-wrap: wrap; }
.probe__label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-secondary); }
.probe__rows { font-size: 11.5px; color: var(--text-tertiary); margin-left: auto; }

.probe__error {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--negative) 10%, transparent);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.probe__fields { margin: 0 0 8px; }
.probe__fields summary { font-size: 11.5px; color: var(--accent); cursor: pointer; }
.probe__grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 8px; }
.probe__key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-secondary); }
.probe__shape { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-tertiary); }
.probe__summary { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-secondary); }

.lib-group { margin-bottom: 22px; }
.lib-group__title { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }

.lib-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.22s var(--ease-out), border-color 0.22s, transform 0.22s var(--ease-spring);
}

.lib-item:hover { background: color-mix(in srgb, var(--text) 4%, transparent); border-color: var(--line-strong); transform: translateY(-1px); }
.lib-item:active { transform: scale(0.985); }
.lib-item__icon { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.lib-item__icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.lib-item__name { font-size: 14px; font-weight: 500; }
.lib-item__desc { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.4; }
.lib-item__count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent); }

/* Переключатель «показать / убрать» — одно место, где видно все показатели. */
.lib-item__toggle {
  margin-left: auto;
  flex-shrink: 0;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.lib-item__toggle:hover { border-color: var(--line-strong); color: var(--text); }
.lib-item.is-on { border-color: transparent; background: var(--accent-soft); }
.lib-item.is-on .lib-item__toggle { border-color: transparent; color: var(--accent); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* --- Уведомления ---------------------------------------------------------- */

.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }

.toast {
  padding: 11px 20px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--text) 88%, transparent);
  color: var(--bg-elevated);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.45s var(--ease-spring) both;
}

.toast.is-leaving { animation: toast-out 0.3s var(--ease-out) both; }

@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.96); } }

.footer { max-width: 1560px; width: 100%; margin: 0 auto; padding: 8px 28px 34px; font-size: 12px; color: var(--text-tertiary); }

/* --- Адаптив -------------------------------------------------------------- */

@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card[data-size="lg"], .card[data-size="xl"] { grid-column: span 2; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 158px; }
  .topbar__inner { flex-wrap: wrap; padding: 12px 18px 8px; }
  .tabs { order: 3; width: 100%; }
  .filters { padding: 0 18px 12px; }
  .filters__meta { margin-left: 0; width: 100%; }
  /* Узкий экран: переключатель периодов прокручивается, а не обрезается. */
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segment { white-space: nowrap; }
  .board { padding: 20px 18px; gap: 16px; }
  .footer { padding: 4px 18px 28px; }
  .editbar__inner { padding: 10px 18px; }
}

@media (max-width: 640px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .card[data-size="sm"], .card[data-size="md"],
  .card[data-size="lg"], .card[data-size="xl"] { grid-column: span 1; }
  .brand__text { display: none; }
  .btn span { display: none; }
  .btn { padding: 0 12px; }
  .editbar__hint { display: none; }
  .editbar__actions { margin-left: 0; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px -6px; padding: 0 18px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===========================================================================
   Входящие: обращения покупателей
   =========================================================================== */

.btn--primary.btn--danger { background: var(--negative); color: #fff; }
.btn--primary.btn--danger:hover { filter: brightness(1.08); background: var(--negative); }

.icon-btn--badged { position: relative; overflow: visible; }
.icon-btn__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--negative);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.sheet__head-actions { display: flex; align-items: center; gap: 6px; }

.inbox__loading { margin: 24px 0; font-size: 13px; color: var(--text-secondary); }

.products__error { margin: 24px 0 8px; font-size: 13px; color: var(--negative); }

.inbox__count {
  margin-left: 7px;
  padding: 0 6px;
  border-radius: var(--pill);
  background: var(--negative);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.inbox__count.is-zero { background: var(--line-strong); color: var(--text-secondary); }

.inbox__trouble {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.inbox__trouble strong { color: var(--text); }

.inbox__empty { padding: 40px 0 30px; text-align: center; }
.inbox__zero {
  font-size: 54px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--positive);
}
.inbox__emptyText {
  margin: 8px auto 0;
  max-width: 340px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.inbox__list { display: flex; flex-direction: column; gap: 12px; }

.inbox-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.inbox-card--urgent { border-color: color-mix(in srgb, var(--negative) 35%, transparent); }
.inbox-card--done {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--positive) 45%, transparent);
  box-shadow: none;
}
.inbox-card__done { font-size: 12px; font-weight: 600; color: var(--positive); }
.inbox-card__answer { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

.inbox-card__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-card__store { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.inbox-card__dot { width: 7px; height: 7px; border-radius: 50%; }
.inbox-card__when { margin-left: auto; font-size: 11.5px; color: var(--text-tertiary); }
.inbox-card__flag {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--negative) 12%, transparent);
  color: var(--negative);
  font-size: 11px;
  font-weight: 600;
}

.inbox__stars { display: inline-flex; gap: 1px; font-size: 12px; color: var(--line-strong); }
.inbox__star.is-on { color: #f0a500; }

.inbox-card__product {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.inbox-card__article { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-tertiary); }

.inbox-card__text { margin: 8px 0 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

.inbox-card__photos { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inbox-card__photo { display: block; width: 58px; height: 58px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.inbox-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.inbox-card__reply { margin-top: 12px; }
.inbox-card__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.inbox-card__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inbox-card__foot { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.inbox-card__note { font-size: 11.5px; color: var(--text-tertiary); }
.inbox-card__foot .btn { margin-left: auto; flex-shrink: 0; }

@media (max-width: 640px) {
  .inbox-card__foot { flex-direction: column; align-items: stretch; }
  .inbox-card__foot .btn { margin-left: 0; }
}

.inbox-card__hint {
  margin-bottom: 8px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.inbox-card__hint strong { color: var(--warning); }

.inbox__count.is-urgent { background: var(--negative); }
.inbox__count { background: var(--accent); }

/* Подпись под кнопками, а не между ними: так она не сжимается в столбик. */
.inbox-card__reply > .inbox-card__note { margin: 8px 0 0; text-align: right; }
.inbox-card__foot { justify-content: space-between; }

/* Конвейер: разбор пачки и массовая отправка. */
.inbox__conveyor {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}
.inbox__progress { font-size: 12.5px; color: var(--text-secondary); margin-right: auto; }
.inbox__conveyor .btn { height: 32px; font-size: 13px; }

/* Задачи: строка «всего у площадки / загружено сейчас». */
.tasks__tally {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.tasks__total { font-weight: 600; color: var(--text); }
.tasks__total.is-unknown { color: var(--warning); font-weight: 500; }
.tasks__loaded { color: var(--text-tertiary); }
.tasks__tally .btn { margin-left: auto; height: 30px; font-size: 12.5px; }

/* ===========================================================================
   Отдельная страница «Задачи»
   =========================================================================== */

.page { min-height: 100vh; }

.page__head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
/* Ширина полосы содержимого. Раньше было 900 пикселей на всё подряд: для
   текста в самый раз, а для сетки из тысяч карточек — половина экрана впустую.
   Теперь полоса широкая, а текстовые блоки сами держат себя в узде. */
.page__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 22px;
}
.page__body {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 22px 60px;
}

/* Читать длинные строки тяжело, поэтому текстовые списки держат свою ширину. */
.page__body--reading { max-width: 980px; }

@media (max-width: 640px) {
  .page__inner, .page__body { padding-left: 14px; padding-right: 14px; }
}

/* Ссылки, оформленные как кнопки, не должны выглядеть как текст со ссылкой. */
a.btn, a.icon-btn { text-decoration: none; color: inherit; }
a.btn--ghost { color: var(--text); }

/* ===========================================================================
   Справочник товаров
   =========================================================================== */

.know__lead {
  margin: 0 0 16px;
  max-width: 640px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.know__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.know__tally { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.know__search {
  flex: 1 1 220px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.know__search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.know__list { display: flex; flex-direction: column; gap: 12px; }

.know-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.know-card--filled { border-color: color-mix(in srgb, var(--positive) 35%, transparent); }
.know-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.know-card__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
}
.know-card__state {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
  font-size: 11px;
  font-weight: 600;
}
.know-card__state.is-filled {
  background: color-mix(in srgb, var(--positive) 14%, transparent);
  color: var(--positive);
}

.know-card__title,
.know-card__facts {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}
.know-card__title { margin-bottom: 8px; }
.know-card__facts { resize: vertical; }
.know-card__title:focus,
.know-card__facts:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.know-card__foot { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.know-card__hint { font-size: 11.5px; color: var(--text-tertiary); }
.know-card__foot .btn { margin-left: auto; height: 32px; font-size: 13px; }

.know__refresh {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}
.know__progress { font-size: 12.5px; color: var(--text-secondary); margin-right: auto; }
.know__refresh .btn { height: 32px; font-size: 13px; }

/* Кабинет, который не ответил при сборе. Остаётся на виду до следующего
   сбора: без этого непонятно, почему его товаров нет. */
.know__trouble {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--negative);
}

.know-card__cards {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.know-card__sample {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-tertiary);
}


/* ---------------------------------------------------------------------------
   Панель над списком: поиск, категория, взгляд «требуют внимания», счётчик.
   Одна строка вместо четырёх: раньше фильтры съедали первый экран целиком и
   товаров не было видно вовсе.
   --------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.toolbar__search {
  flex: 0 1 340px;
  min-width: 200px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.toolbar__search::placeholder { color: var(--text-tertiary); }
.toolbar__search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.toolbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface-solid);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
}
.toolbar__toggle:hover { border-color: var(--line-strong); color: var(--text); }
.toolbar__toggle.is-active {
  border-color: transparent;
  background: color-mix(in srgb, var(--warning) 16%, var(--surface-solid));
  color: var(--warning);
}
.toolbar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  opacity: 0.55;
}
.toolbar__toggle.is-active .toolbar__dot { opacity: 1; }

.toolbar__tally { margin-left: auto; font-size: 13px; color: var(--text-secondary); }
.toolbar__tally strong { color: var(--text); font-weight: 600; }

.toolbar__quiet {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.toolbar__quiet:hover { color: var(--text); background: var(--surface-hover); }

/* Выпадающий выбор ---------------------------------------------------------- */

.picker { position: relative; }

.picker__button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface-solid);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
}
.picker__button:hover { border-color: var(--line-strong); color: var(--text); }
.picker__button.is-set { color: var(--text); border-color: var(--line-strong); }
.picker__count {
  padding: 1px 7px;
  border-radius: var(--pill);
  background: var(--bg);
  font-size: 11px;
  color: var(--text-tertiary);
}
.picker__chevron {
  width: 15px; height: 15px;
  fill: none; stroke: var(--text-tertiary);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.picker__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 55;
  width: 300px;
  max-width: min(300px, calc(100vw - 32px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  animation: navpick-in 0.2s var(--ease-out);
}

.picker__search {
  width: 100%;
  height: 32px;
  margin-bottom: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.picker__search:focus { outline: none; border-color: var(--accent); }

.picker__list { max-height: 340px; overflow-y: auto; }

.picker__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease-out);
}
.picker__item:hover { background: var(--surface-hover); }
.picker__item.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.picker__itemtitle { margin-right: auto; }
.picker__itemcount { font-size: 11.5px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.picker__item.is-current .picker__itemcount { color: var(--accent); }


/* Кабинеты в сборе: до кого дошла очередь и чем кончилось. Прямой ответ
   на вопрос «а где мой второй Озон» — без чтения журналов сервера. */
.shops { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.shops__item { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.shops__mark { width: 12px; text-align: center; font-weight: 700; }
.shops__title { color: var(--text); }
.shops__state { color: var(--text-tertiary); }
.shops__item.is-done .shops__mark { color: var(--positive); }
.shops__item.is-running .shops__mark { color: var(--accent); }
.shops__item.is-waiting .shops__mark { color: var(--text-tertiary); }
.shops__item.is-waiting .shops__title { color: var(--text-secondary); }
.shops__item.is-error .shops__mark,
.shops__item.is-error .shops__state { color: var(--warning); }

/* Путь до задачи: площадка › кабинет › задача — одной строкой. */
.path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.path__sep { color: var(--text-tertiary); font-size: 16px; }

/* ---------------------------------------------------------------------------
   Справочник: очередь, а не стена форм. Строка на товар, открыта одна.
   --------------------------------------------------------------------------- */

.progress {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}
.progress__head { display: flex; align-items: baseline; gap: 8px; }
.progress__count {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.progress__label { font-size: 13px; color: var(--text-secondary); }

.progress__track {
  margin: 12px 0 10px;
  height: 6px;
  border-radius: var(--pill);
  background: var(--bg);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  border-radius: var(--pill);
  background: var(--accent);
  transition: width 0.5s var(--ease-spring);
}
.progress__hint { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-tertiary); }

.know__list { display: flex; flex-direction: column; gap: 8px; }

.know-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  overflow: hidden;
  transition: box-shadow 0.24s var(--ease-out), border-color 0.24s var(--ease-out);
}
.know-row.is-open { border-color: var(--line-strong); box-shadow: var(--shadow-md); }

.know-row__head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s var(--ease-out);
}
.know-row__head:hover { background: var(--surface-hover); }

.know-row__shot {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.know-row__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.know-row__text { min-width: 0; margin-right: auto; }
.know-row__name {
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Имя с площадки — подсказка, а не название: показываем его бледнее. */
.know-row__name.is-empty { color: var(--text-tertiary); font-weight: 400; }

.know-row__meta {
  display: flex;
  gap: 10px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.know-row__code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.know-row__state {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: var(--pill);
  background: var(--bg);
  font-size: 11px;
  color: var(--text-tertiary);
}
.know-row__state.is-filled {
  background: color-mix(in srgb, var(--positive) 14%, transparent);
  color: var(--positive);
}

.know-row__editor {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
  animation: row-open 0.26s var(--ease-out);
}
@keyframes row-open {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.know-row__sample { margin: 10px 0 8px; font-size: 12px; color: var(--text-tertiary); }

.know-row__title,
.know-row__facts {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.know-row__facts { margin-top: 8px; resize: vertical; }
.know-row__title:focus,
.know-row__facts:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.know-row__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.know-row__hint { margin-right: auto; font-size: 12px; color: var(--text-tertiary); }
.know-row__foot .btn { height: 34px; font-size: 13px; }

/* ===========================================================================
   Товары: каталог и карточки
   =========================================================================== */

.products__grid {
  display: grid;
  /* Плитка уже: на широком экране помещается шесть в ряд вместо четырёх.
     Товаров сотни — чем больше видно за раз, тем меньше прокрутки. */
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}

.ptile, .ctile {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-out);
}
.ptile:hover, .ctile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ctile--noted { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }

.ptile__shot, .ctile__shot {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ptile__shot img, .ctile__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot__none { font-size: 11.5px; color: var(--text-tertiary); }

.ptile__body, .ctile__body { padding: 10px 12px 12px; }
.ptile__name, .ctile__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ptile__code, .ctile__code {
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--text-tertiary);
  overflow-wrap: anywhere;
}
.ptile__marks, .ctile__marks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}
/* Число карточек — справка, а не заголовок: раньше оно было синим и кричало
   громче названия товара. Кричать должно только то, что требует работы. */
.ptile__count { color: var(--text-secondary); }
.ptile__note { color: var(--text-tertiary); }
.ptile__undescribed { color: var(--text-tertiary); }
.ctile__noted { color: var(--warning); font-weight: 600; }

/* Метка прямо на снимке: владелец смотрит на картинки, а не читает подписи. */
.ptile__flag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--warning) 88%, transparent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
}

.products__back { margin-bottom: 12px; height: 32px; font-size: 13px; }
.products__back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.products__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.products__title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.products__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.products__tally { margin: 0 0 14px; font-size: 12.5px; color: var(--text-secondary); }
.products__more { margin-top: 14px; }

/* Знания о товаре внутри рабочего места каталога — тот же блок, что и на
   рабочем месте площадки, чтобы не плодить второй похожий стиль. */
.products__knowledge { margin: 0 0 16px; max-width: 560px; }
.products__knowledge .ws-link { min-width: 0; width: fit-content; }

.card__facts {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}
.card__fact { display: flex; flex-direction: column; gap: 2px; }
.card__factLabel { font-size: 11px; color: var(--text-tertiary); }
.card__factValue { font-size: 15px; font-weight: 600; }

.card__shots { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.card__shot {
  position: relative;
  width: 150px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  display: grid;
  place-items: center;
}
.card__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__shot.is-hero { border-color: var(--accent); }
.card__hero {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
}

.card__note { margin-top: 18px; }
.card__noteLabel { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; }

.products__shelves { margin-bottom: 14px; }

.ctile__rate {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11px;
}
.ctile__stars { display: inline-flex; align-items: center; gap: 1px; font-size: 11px; color: var(--line-strong); }
.ctile__stars .inbox__star.is-on { color: #f0a500; }
.ctile__rating { margin-left: 4px; font-weight: 600; color: var(--text); }
.ctile__reviews { color: var(--text-tertiary); }
.ctile__waiting { color: var(--text-tertiary); font-style: italic; }
.ctile__sales { color: var(--positive); font-weight: 600; }

.products__cabinets { margin-bottom: 14px; }

/* ===========================================================================
   Рабочее место площадки: /mp/{код}. Спокойные блоки в общем стиле панели:
   кабинеты, показатели месяца, переходы в разделы. Фирменный цвет площадки
   не разливается по экрану — его достаточно в точке навигации слева.
   =========================================================================== */

.section--workspace { display: flex; flex-direction: column; gap: 20px; }

.ws-block { display: flex; flex-direction: column; gap: 10px; }
.ws-block__head { display: flex; align-items: baseline; gap: 10px; }
.ws-block__title { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.ws-block__note { font-size: 12px; color: var(--text-tertiary); }

/* Кабинеты: нажимаемые карточки, активная обведена акцентом. */
.ws-stores { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-store {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--speed) var(--ease-ui),
              box-shadow var(--speed) var(--ease-ui);
}
.ws-store:hover { border-color: var(--line-strong); }
.ws-store.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ws-store__name { font-size: 13px; font-weight: 600; color: var(--text); }
.ws-store__meta { font-size: 11.5px; color: var(--text-secondary); }
.ws-store__meta.is-error { color: var(--negative); }

/* Показатели месяца. */
.ws-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.ws-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.ws-kpi__label { font-size: 11.5px; color: var(--text-secondary); }
.ws-kpi__value { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.ws-kpi__note { font-size: 11px; color: var(--text-tertiary); }

.ws-notes { display: flex; flex-direction: column; gap: 2px; }
.ws-notes__line { margin: 0; font-size: 12px; color: var(--text-secondary); }

/* Переходы в разделы, понимающие контекст площадки. */
.ws-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ws-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 200px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  text-decoration: none;
  transition: border-color var(--speed) var(--ease-ui);
}
.ws-link:hover { border-color: var(--line-strong); }
.ws-link__name { font-size: 13px; font-weight: 600; color: var(--text); }
.ws-link__desc { font-size: 11.5px; color: var(--text-secondary); }

/* Площадка без кабинетов: честный экран подключения. */
.ws-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 460px;
  padding: 20px 0;
}
.ws-empty h2 { margin: 0; font-size: 16px; }
.ws-empty p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ===========================================================================
   Центр действий: покупатели и операционные задачи без второй копии друг
   друга. Группы свёрнуты по умолчанию — компактно, без ковра из карточек.
   =========================================================================== */

.section--actions { display: flex; flex-direction: column; gap: 22px; }
.ws-kpi.is-warn { border-color: color-mix(in srgb, var(--negative) 35%, transparent); }

.actions__section { display: flex; flex-direction: column; gap: 10px; }
.actions__empty { padding: 16px 0; text-align: left; }

.actions__group {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
}
.actions__group + .actions__group { margin-top: 8px; }
.actions__group.is-open { border-color: var(--line-strong); }

.actions__groupHead {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.actions__groupHead:hover { background: var(--surface-hover); }
.actions__groupTitle { flex: 1; font-size: 13px; font-weight: 600; }
.actions__groupChevron {
  display: inline-block;
  color: var(--text-tertiary);
  transform: rotate(90deg);
  transition: transform var(--speed) var(--ease-ui);
}
.actions__groupChevron.is-open { transform: rotate(-90deg); }

.actions__groupBody { padding: 0 14px 14px; }
.actions__groupBody .inbox__list { display: flex; flex-direction: column; gap: 10px; }

.actions__coverageList { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.actions__coverageRow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 6px 0 0;
  border-top: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
}
.actions__coverageRow:first-child { border-top: none; padding-top: 0; }
.actions__coverageLabel { font-weight: 600; color: var(--text); }
.actions__coverageReason { color: var(--text-secondary); }

/* ============================================================================
   Финансы — отдельный data-backed workspace поверх существующего /api/overview
   ============================================================================ */

.section--finance {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.finance__periodbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.finance__periods { flex: 0 1 auto; }

.finance__range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.finance__range-label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.finance__date {
  min-width: 145px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.finance__date:focus {
  outline: none;
  border-color: var(--line-strong);
}

.finance__coverage {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  min-width: 0;
}

.finance__coverage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.finance__coverage-head span,
.finance__coverage-line {
  color: var(--text-secondary);
}

.finance__coverage-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.finance__block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.finance__block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.finance__block-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.finance__block-note {
  font-size: 12px;
  color: var(--text-tertiary);
}

.finance__kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.finance-kpi {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
}

.finance-kpi__label,
.finance-kpi__note,
.finance-kpi__delta {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.finance-kpi__value {
  font-size: clamp(19px, 2vw, 27px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.finance-kpi__delta { color: var(--text-secondary); }

.finance__chart {
  min-height: 96px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  padding: 8px 6px 0;
}

.finance__empty-line {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--text-tertiary);
  font-size: 12.5px;
}

.finance__rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
}

.finance-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) repeat(5, minmax(105px, 1fr));
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.finance-row:last-child { border-bottom: 0; }
.finance-row:hover { background: var(--surface-hover); }
.finance-row--account { grid-template-columns: minmax(190px, 1.7fr) repeat(3, minmax(110px, 1fr)); }

.finance-row__name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.finance-row__name > span:not(.finance-row__dot):not(.finance-row__warning),
.finance-row__name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-row__name small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.finance-row__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.finance-row__warning {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--negative);
}

.finance-row__metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.finance-row__metric-label {
  font-size: 10.5px;
  color: var(--text-tertiary);
}

.finance-row__metric strong {
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.finance-settlement {
  padding-top: 2px;
}

.finance-settlement__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  min-width: 0;
}

.finance-settlement__grid--balance {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.finance-settlement__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
}

.finance-settlement__label,
.finance-settlement__note {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.finance-settlement__value {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.finance__truth,
.finance__empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.finance__truth {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.finance__truth strong { color: var(--text); }
.finance__empty h2 { margin: 0; font-size: 16px; }
.finance__empty p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.finance__empty .btn { align-self: flex-start; margin-top: 4px; }

@media (max-width: 1100px) {
  .finance__kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-row { grid-template-columns: minmax(170px, 1.4fr) repeat(2, minmax(115px, 1fr)); }
  .finance-row .finance-row__metric:nth-of-type(n+4) { display: none; }
}

@media (max-width: 700px) {
  .finance__kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-row,
  .finance-row--account {
    grid-template-columns: minmax(0, 1fr) minmax(100px, auto);
    gap: 8px;
  }
  .finance-row .finance-row__metric:nth-of-type(n+3) { display: none; }
  .finance__range { width: 100%; }
  .finance__date { flex: 1 1 130px; min-width: 0; }
}

@media (max-width: 430px) {
  .finance__kpis { grid-template-columns: 1fr; }
  .finance__periodbar,
  .finance__range { align-items: stretch; }
  .finance__range-label { align-self: center; }
  .finance__range .btn { flex: 1 1 auto; }
  .finance-row,
  .finance-row--account { grid-template-columns: minmax(0, 1fr); }
  .finance-row .finance-row__metric { display: none; }
  .finance-row__name { flex-wrap: wrap; }
}

/* ==========================================================================
   Data Health / синхронизация
   ========================================================================== */
.section--data { display: flex; flex-direction: column; gap: 18px; }
.data-summary,
.data-store,
.data-truth,
.data-empty {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
}
.data-summary { padding: 16px 18px; }
.data-summary__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.data-summary__copy { min-width: 0; }
.data-summary__title { margin: 0; font-size: 18px; font-weight: 670; letter-spacing: -0.02em; }
.data-summary__note,
.data-summary__running { margin: 5px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.data-summary__running { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 12px; }
.data-summary__sync { flex: 0 0 auto; }

.data-stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); gap: 14px; }
.data-store { padding: 16px; min-width: 0; }
.data-store__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.data-store__title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.data-store__title h3 { margin: 0; font-size: 15px; font-weight: 650; }
.data-store__title p { margin: 3px 0 0; font-size: 12px; color: var(--text-tertiary); }
.data-store__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.data-store__storage { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--text-tertiary); }
.data-store__storage strong { color: var(--text-secondary); font-weight: 600; }

.data-state { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 620; white-space: nowrap; background: var(--surface-hover); color: var(--text-secondary); }
.data-state--fresh { color: var(--positive); background: color-mix(in srgb, var(--positive) 11%, transparent); }
.data-state--stale,
.data-state--missing { color: var(--warning); background: color-mix(in srgb, var(--warning) 11%, transparent); }
.data-state--error { color: var(--negative); background: color-mix(in srgb, var(--negative) 11%, transparent); }
.data-state--live { color: var(--text-secondary); }

.data-sources { margin-top: 10px; display: flex; flex-direction: column; }
.data-source { display: grid; grid-template-columns: minmax(145px, .7fr) minmax(0, 1.3fr); gap: 8px 18px; padding: 11px 0; border-top: 1px solid var(--line); }
.data-source__name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.data-source__name strong { font-size: 13px; font-weight: 590; }
.data-source__name .data-state { margin-left: auto; }
.data-source__meta { margin: 0; font-size: 12px; color: var(--text-tertiary); line-height: 1.45; align-self: center; }
.data-source__error { grid-column: 1 / -1; margin: -2px 0 0; font-size: 12px; color: var(--negative); line-height: 1.45; overflow-wrap: anywhere; }

.data-live { margin-top: 14px; padding: 14px; background: var(--surface-hover); border-radius: 10px; }
.data-live strong { display: block; font-size: 13px; font-weight: 620; }
.data-live p { margin: 5px 0 0; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.data-truth { display: flex; gap: 10px; align-items: baseline; padding: 13px 16px; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.data-truth strong { color: var(--text); white-space: nowrap; }
.data-empty { padding: 30px 22px; text-align: center; }
.data-empty h2 { margin: 0 0 8px; font-size: 18px; }
.data-empty p { margin: 0 auto 16px; max-width: 620px; color: var(--text-secondary); line-height: 1.5; }

@media (max-width: 640px) {
  .section--data { gap: 14px; }
  .data-summary { padding: 14px; }
  .data-summary__top { align-items: stretch; flex-direction: column; }
  .data-summary__sync { width: 100%; justify-content: center; }
  .data-store { padding: 14px; }
  .data-source { grid-template-columns: 1fr; gap: 5px; }
  .data-source__name .data-state { margin-left: 0; }
  .data-source__error { grid-column: auto; }
  .data-truth { flex-direction: column; gap: 4px; }
  .data-truth strong { white-space: normal; }
}

/* --- Pricing workspace ----------------------------------------------------- */
.section--pricing { max-width: 1500px; }
.pricing__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.pricing__tabs { width: max-content; }
.pricing__readonly, .pricing__badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px;
  font-size: 11px; font-weight: 650; color: var(--text-secondary);
  background: var(--surface-soft); border: 1px solid var(--line);
}
.pricing__choose, .pricing__block, .pricing__storehead, .pricing__promohead, .pricing__metered, .pricing__empty {
  border: 1px solid var(--line); background: var(--surface-solid); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.pricing__choose { padding: 22px; }
.pricing__choose h2, .pricing__promohead h2 { margin: 0; font-size: 18px; }
.pricing__choose > p, .pricing__promohead p { margin: 7px 0 0; color: var(--text-secondary); font-size: 13px; }
.pricing__stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; margin-top: 18px; }
.pricing-store {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: inherit;
  border-radius: var(--radius-md); padding: 15px; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; transition: .15s ease;
}
.pricing-store:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.pricing-store__title { display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; column-gap: 9px; }
.pricing-store__title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pricing-store__title small { grid-column: 2; color: var(--text-tertiary); font-size: 11px; }
.pricing-store__dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.pricing-store__cap { font-size: 12px; color: var(--text-secondary); padding-left: 19px; }
.pricing__storehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; margin-bottom: 12px; }
.pricing__storetitle { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pricing__storetitle > div { display: flex; flex-direction: column; min-width: 0; }
.pricing__storetitle strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pricing__storetitle span { font-size: 11px; color: var(--text-tertiary); }
.pricing__metered { padding: 20px; }
.pricing__metered strong { display: block; font-size: 15px; }
.pricing__metered p { margin: 7px 0 14px; color: var(--text-secondary); font-size: 13px; max-width: 760px; }
.pricing__block { padding: 18px 22px; margin-bottom: 14px; }
.pricing__blockhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pricing__blockhead h2 { margin: 0; font-size: 17px; }
.pricing__blockhead span { font-size: 12px; color: var(--text-tertiary); }
.pricing__tablewrap { margin-top: 4px; }
.pricing-table td:nth-child(2), .pricing-table td:nth-child(3) { font-weight: 600; }
.pricing__product { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pricing__product > strong, .pricing__catalog-link { font-size: 13px; font-weight: 650; color: var(--text); text-decoration: none; }
.pricing__catalog-link:hover { text-decoration: underline; }
.pricing__product > span { font-size: 11px; color: var(--text-tertiary); }
.pricing__variants { margin-top: 6px; font-size: 11px; color: var(--text-secondary); }
.pricing__variants summary { cursor: pointer; }
.pricing__variantrows { margin-top: 6px; display: grid; gap: 4px; }
.pricing__variant { display: flex; justify-content: space-between; gap: 12px; max-width: 280px; }
.pricing__pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.pricing__promos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 10px; }
.pricing-promo {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: inherit;
  border-radius: var(--radius-md); padding: 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 7px; min-width: 0;
}
.pricing-promo:hover { background: var(--surface-hover); }
.pricing-promo__head { display: flex; align-items: center; gap: 7px; }
.pricing-promo__head strong { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pricing-promo__meta, .pricing-promo__counts { font-size: 11px; color: var(--text-secondary); }
.pricing__detail { display: grid; gap: 12px; }
.pricing__back { justify-self: start; }
.pricing__promohead { padding: 17px 20px; }
.pricing__states { width: max-content; }
.pricing__empty { padding: 20px; }
.pricing__empty strong { display: block; }
.pricing__empty p { margin: 7px 0 14px; color: var(--text-secondary); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pricing__error { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.pricing__emptyline, .pricing__muted { color: var(--text-tertiary); font-size: 13px; }
.pricing__truth { margin: 16px 2px 0; color: var(--text-tertiary); font-size: 11px; line-height: 1.5; }

@media (max-width: 720px) {
  .pricing__toolbar { align-items: flex-start; flex-direction: column; }
  .pricing__choose, .pricing__block, .pricing__metered { padding: 15px; }
  .pricing__storehead { align-items: flex-start; }
  .pricing__tablewrap { margin-left: -15px; margin-right: -15px; padding-left: 15px; padding-right: 15px; }
  .pricing-table { min-width: 720px; }
  .pricing__pager { justify-content: flex-start; flex-wrap: wrap; }
}

/* WO-010 UX audit: secondary Settings actions used to be 17–18 px high on
   touch screens. Keep the compact text treatment, but give the whole target
   enough vertical area to hit deliberately. */
.keycard__docs,
.keyfield__erase {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 6px;
  border-radius: 7px;
}

@media (max-width: 640px) {
  .keycard__docs,
  .keyfield__erase { min-height: 40px; }
}

/* WO-010: a product can have thousands of child cards. Search stays local to
   the product workspace and avoids turning pagination into manual archaeology. */
.products__cardsearch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.products__cardsearch .toolbar__search { flex: 1 1 360px; }
