:root {
  --bg: #f2f3f6;
  --panel: #ffffff;
  --border: #e3e5ea;
  --border-soft: #f0f1f4;
  --text: #1a1d24;
  --muted: #767a87;
  --muted-2: #8b8f9c;
  --muted-3: #a2a5b0;
  --accent: #3b5bdb;
  --accent-hover: #2c46b3;
  --accent-soft: #eef0fd;
  --ok: #2f9e5c;
  --ok-bg: #e7f4ec;
  /* «Почти готов» — 80–89% заполненности: до порога выгрузки не хватает
     одного шага. Тон жёлтый (~50° по кругу), а не янтарный: янтарь читается
     как оранжевый и путается с var(--warn). */
  --near: #d9b300;
  --warn: #c9772e;
  --warn-bg: #fff4e5;
  --err: #c93b3b;
  --err-bg: #fbecec;
  --topbar: #14171d;
  --topbar-muted: #9199a8;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font: "Manrope", system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --shadow-fab: 0 6px 18px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d6dd; border-radius: 4px; }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); font-size: 13.5px; }
.error { color: var(--err); margin-top: 8px; min-height: 18px; }
.page-lead {
  margin: -10px 0 24px;
  font-size: 13.5px;
  color: var(--muted);
}
.card-title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
}

/* --- Логин --- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(59, 91, 219, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(26, 29, 36, 0.06), transparent 55%),
    var(--bg);
}
.login-card {
  background: var(--panel); padding: 32px; border-radius: 12px; width: 340px;
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(20, 23, 29, 0.06);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.login-card label { display: block; margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%; padding: 9px 10px; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.login-card .btn { width: 100%; margin-top: 20px; }

/* --- Каркас --- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: linear-gradient(180deg, #181b22 0%, #14171d 100%);
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 2px 14px rgba(0, 0, 0, .16);
  padding: 0 28px; height: 60px; position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 500; font-size: 16px; flex-shrink: 0;
  color: #fff; letter-spacing: 0.2px; margin-right: 8px;
  border: none; background: none; padding: 0; margin-left: 0;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s ease;
}
.brand:hover { opacity: .8; }
.brand::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .28);
}
.nav-toggle,
.nav-panel-top,
.nav-scrim,
.nav-close { display: none; }
.nav-panel {
  display: contents;
}
.tabs {
  display: flex; gap: 22px; flex: 1;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  align-items: stretch; height: 100%;
}
.tab {
  background: none; border: none; padding: 8px 2px;
  cursor: pointer; border-radius: 6px;
  color: var(--topbar-muted); font-size: 13.5px; font-weight: 600;
  font-family: inherit; white-space: nowrap;
  border-bottom: 2px solid transparent;
  height: 100%;
  display: inline-flex; align-items: center;
  transition: color .15s ease, background-color .15s ease;
}
.tab:hover { color: #d5d9e2; background: rgba(255, 255, 255, .05); }
.tab.active {
  background: transparent;
  color: #fff;
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* --- Меню как маршрут «1 → 2 → 3 → Настройки» --- */
/* Номер шага перед рабочими вкладками (Каталог/Цены/Экспорт…) */
.tab-flow::before {
  content: attr(data-step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-right: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #d5d9e2;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; line-height: 1;
  vertical-align: middle; flex-shrink: 0;
  transition: background-color .15s ease, color .15s ease;
}
.tab-flow.active::before { background: var(--accent); color: #fff; }
/* Стрелка-коннектор между шагами (горизонтальное меню) */
.tab-flow:not(.tab-flow-last)::after {
  content: "→";
  margin-left: 14px;
  color: var(--topbar-muted); font-weight: 400; opacity: .55;
}
/* «Настройки» — это конфиг, а не шаг: отделяем разделителем, без номера */
.tab-config {
  margin-left: 10px;
}
.user {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  color: #c7cad3; font-size: 13px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, .1);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .1);
}
.user-meta { line-height: 1.25; min-width: 0; }
.user-name {
  font-weight: 600; color: #fff; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}
.user-logout {
  display: block; margin: 0; padding: 0;
  border: none; background: none; cursor: pointer;
  font: inherit; font-size: 11.5px; color: var(--muted-2);
  text-align: left;
}
.user-logout:hover { color: #fff; }

main { padding: 32px 40px; max-width: 1360px; margin: 0 auto; width: 100%; }
h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
h3 { margin: 28px 0 12px; font-size: 14.5px; color: var(--text); font-weight: 700; }

/* --- Кнопки --- */
.btn {
  padding: 8px 14px; border: 1px solid var(--border); background: var(--panel);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: inherit; color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: none; }
.btn.ghost { border: none; color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --- Карточки и формы --- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.card input, .card select {
  display: block; width: 100%; max-width: 420px; margin-top: 4px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.row select, .filters select, .filters input {
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 600; background: var(--panel); font-family: inherit;
  color: #4b4f5b;
}
.search-widget { position: relative; flex: 0 0 auto; }
.search-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.search-toggle-btn:hover { background: var(--bg); color: var(--text); }
.search-toggle-btn .icon-clear { display: none; }
.search-toggle-btn.is-clear { color: var(--accent); border-color: var(--accent); }
.search-toggle-btn.is-clear .icon-search { display: none; }
.search-toggle-btn.is-clear .icon-clear { display: block; }
.search-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
  width: max(320px, min(480px, 90vw));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(20, 24, 32, .16);
}
.search-panel.hidden { display: none; }
.search-panel input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: var(--panel);
  font-family: inherit;
  color: var(--text);
}
.search-panel .btn { flex-shrink: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters select {
  flex: 1 1 170px;
  min-width: 140px;
  max-width: 240px;
  font-weight: 500;
}
.filters .filter-ai { flex: 0 0 auto; }
.filters #f-reset { flex: 0 0 auto; margin-left: auto; }
.filter-ai {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.filter-ai .filter-ai-btn {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--muted);
}
.filter-ai .filter-ai-btn + .filter-ai-btn {
  border-left: 1px solid var(--border);
}
.filter-ai .filter-ai-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.filter-ai .filter-ai-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
label.inline {
  display: flex; align-items: center; gap: 6px; margin: 0;
  font-size: 14px; color: var(--text); white-space: nowrap;
}
label.inline input { width: auto; margin: 0; }

.content-batch-card { margin-bottom: 18px; }
.content-batch-row { align-items: flex-end; }
.content-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.content-field select {
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: var(--panel);
  color: var(--text);
}
.content-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.content-thumb-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
  border-radius: 6px;
}
#content-table td { vertical-align: middle; }
#content-detail { margin-top: 16px; scroll-margin-top: 16px; }
.content-desc {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: 13px/1.45 inherit;
  max-height: 280px;
  overflow: auto;
}
.content-row-warn { background: #fff8e8; }
.content-version-card { margin-top: 12px; }

/* --- Экспорт --- */
.export-lead {
  margin: 0 0 14px;
  max-width: 52rem;
  line-height: 1.45;
}
.export-marketplace {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--panel);
}
.export-mkt-btn {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.export-mkt-btn + .export-mkt-btn { border-left: 1px solid var(--border); }
.export-mkt-btn:hover { background: var(--bg); color: var(--text); }
.export-mkt-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.export-controls { align-items: flex-end; margin-bottom: 12px; }
.export-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.export-field select {
  min-width: 160px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
}
/* Тот же закруглённый сегментный тоггл, что и AI-фильтр */
.export-scope-tabs {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.export-scope-tab {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.export-scope-tab + .export-scope-tab { border-left: 1px solid var(--border); }
.export-scope-tab:hover { color: var(--text); }
.export-scope-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.export-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0;
  background: var(--panel);
}
.export-summary-inline {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 600;
}
.export-summary-inline.is-ready { color: var(--ok); }
.export-summary-inline.is-empty { color: var(--warn); }
/* Подсказка «выберите поставщика» — это не проблема, а обычный шаг,
   поэтому спокойный серый вместо оранжевого var(--warn). */
.export-summary-inline.is-hint { color: var(--muted); font-weight: 500; }
/* Колонка «Заполнено»: дотянувшие до порога выделяем, остальные приглушаем —
   но показываем всем, чтобы было видно, сколько осталось добить. */
.export-list .ex-fill { font-variant-numeric: tabular-nums; font-weight: 600; }
.export-list .ex-fill.is-ok { color: var(--ok); }
/* 80–89% — тот же жёлтый, что и в каталоге: один шаг до выгрузки. */
.export-list .ex-fill.is-near { color: var(--near); }
.export-list .ex-fill.is-low { color: var(--muted-2); font-weight: 500; }
.export-list-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
}
.export-history-wrap {
  max-height: 320px;
  overflow-y: auto;
}
.export-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.export-list th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted-3);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.export-list td {
  padding: 13px 20px;
  border-bottom: 1px solid #f7f8fa;
  vertical-align: middle;
}
.export-list tr.export-row { cursor: pointer; }
.export-list tr.export-row:hover { background: #f7f8fa; }
.export-list tr.export-row.is-selected { background: var(--accent-soft); }
.export-list tr.export-row.is-exported { color: #5a6472; }
.export-list tr.export-row.is-exported .ex-title { color: #5a6472; }
.export-list tr.export-row.is-disabled { opacity: 0.55; cursor: not-allowed; }
.export-col-check { width: 36px; text-align: center; }
.export-col-thumb { width: 48px; }
.ex-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #eef0f4;
  border: 1px solid var(--border);
}
.ex-thumb.empty {
  display: inline-block;
  background: #eef0f4;
}
.ex-sku {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}
.ex-title { max-width: 320px; font-weight: 600; }
.ex-status {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ex-status.fresh {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}
.ex-status.done {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.ex-status.wait {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: transparent;
}
.mark.ready-export { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.mark.exported { background: #f2f0fb; color: #6b4fc9; border-color: transparent; }
.mark.exported-stale {
  background: #f7efe6;
  color: #9a5b00;
  border-color: transparent;
}
.mark.need-photos { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.export-preview { margin-top: 12px; }
.export-preview summary { cursor: pointer; color: var(--muted); }
.export-preview pre {
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* --- Статистика --- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat .label {
  color: var(--muted-2); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 10px;
}
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.stat.is-warn .value { color: var(--warn); }
.stat.is-err .value { color: var(--err); }
button.stat-link {
  display: block; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s;
}
button.stat-link:hover {
  border-color: #c8cfe8;
  box-shadow: 0 4px 14px rgba(20, 23, 29, 0.06);
  transform: translateY(-1px);
}
button.stat-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dash-secondary {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}
.dash-card { margin-bottom: 0; padding: 22px 24px; }
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
}
.pipe-step {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 6px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.pipe-step .n {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.pipe-step .s {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  font-family: inherit;
  word-break: break-word;
}
.pipe-step .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted-3); flex-shrink: 0;
}
.pipe-step[data-stage="imported"] .dot { background: #a2a5b0; }
.pipe-step[data-stage="matched"] .dot { background: #7c92e8; }
.pipe-step[data-stage="content_ready"] .dot { background: #3b5bdb; }
.pipe-step[data-stage="ai_processed"] .dot { background: #5a7ae0; }
.pipe-step[data-stage="priced"] .dot { background: #2f9e5c; }
.pipe-step[data-stage="exported"] .dot { background: #1a1d24; }
button.pipe-link {
  display: flex; text-align: center; cursor: pointer;
  font: inherit; color: inherit; transition: opacity .15s;
}
button.pipe-link:hover { opacity: 0.75; }
button.pipe-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

.keepa-list { font-size: 13px; }
.keepa-alerts { margin-bottom: 8px; }
.keepa-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.keepa-row:last-child { border-bottom: none; }
.keepa-name { font-size: 13px; font-weight: 600; color: var(--text); }
.keepa-meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
}
.keepa-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0;
}
.keepa-dot.is-warn { background: var(--warn); }
.keepa-dot.is-err { background: var(--err); }
.keepa-row-neg .keepa-name,
.keepa-neg { color: var(--err); }
tr.keepa-key-neg td { color: var(--err); }
input.is-invalid {
  border-color: var(--err) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--err) 18%, transparent);
}
#sourcing-limit-hint.err { color: var(--err); }
.keepa-empty { color: var(--muted); font-size: 13px; }

/* --- Таблицы --- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto;
}
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 12px; }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; max-width: 340px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-family: ui-monospace, monospace; background: var(--bg);
  border: 1px solid var(--border);
}
.badge.priced { background: #e7f5ec; color: var(--ok); border-color: #bfe3cc; }
.badge.exported { background: #eaf0fd; color: var(--accent); border-color: #c7d8fa; }
.badge.imported { background: #fdf4e3; color: var(--warn); border-color: #f2dcb3; }
.badge.none { color: var(--muted); }

pre {
  background: #1c2128; color: #e6edf3; padding: 14px; border-radius: 8px;
  overflow-x: auto; font-size: 12px; line-height: 1.5;
}
.notice { padding: 12px 14px; border-radius: 8px; margin: 12px 0; border: 1px solid var(--border); background: var(--panel); }
.notice.ok { background: #e7f5ec; border-color: #bfe3cc; color: var(--ok); }
.notice.err { background: #fdeceb; border-color: #f5c6c2; color: var(--err); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 24px;
  padding: 28px 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fafbfc 0%, var(--panel) 100%);
  max-width: 520px;
}
.empty-state-card {
  margin: 24px auto;
  max-width: 480px;
  border-style: solid;
}
.empty-state-title {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--text);
}
.empty-state-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.enrich-progress {
  margin: 10px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #f7f9fc 0%, var(--panel) 100%);
}
.enrich-progress.hidden { display: none; }
.enrich-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}
.enrich-progress-close {
  border: none; background: transparent; cursor: pointer; font-size: 13px;
  color: var(--muted-3); line-height: 1; padding: 2px 4px; margin-left: auto;
}
.enrich-progress-close:hover { color: var(--text); }
.enrich-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e4e9f0;
  overflow: hidden;
}
.enrich-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b6fd9, #5b8def);
  transition: width 0.25s ease;
}
.enrich-progress.is-done .enrich-progress-fill {
  background: linear-gradient(90deg, #2f9e62, #49b87a);
}
.enrich-progress.is-failed .enrich-progress-fill {
  background: linear-gradient(90deg, #c0392b, #e57373);
}
.enrich-progress-msg {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.enrich-progress-meta {
  margin-top: 4px;
  font-size: 12px;
}
.enrich-progress-log {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--muted, #667);
}
.enrich-progress-log li {
  padding: 2px 0;
  border-top: 1px solid rgba(0,0,0,0.05);
}
.enrich-progress-log li:first-child { border-top: 0; }

/* --- Документация --- */
.docs-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; } }

.docs-side { position: sticky; top: 74px; }
.doc-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 6px; font-size: 13px; color: var(--text);
  position: relative;
}
.doc-item:hover { background: var(--bg); }
.doc-item.active { border-color: var(--accent); background: #eaf0fd; }
.doc-name { display: block; font-weight: 600; padding-right: 42px; }
.doc-file {
  display: block; font-size: 11px; color: var(--muted);
  font-family: ui-monospace, monospace; margin-top: 2px;
}
.doc-progress {
  position: absolute; right: 10px; top: 9px;
  font-size: 11px; padding: 1px 7px; border-radius: 20px;
  background: #fdf4e3; color: var(--warn); border: 1px solid #f2dcb3;
}
.doc-progress.full { background: #e7f5ec; color: var(--ok); border-color: #bfe3cc; }

.docs-main {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; min-height: 400px;
}
#doc-editor {
  width: 100%; min-height: 620px; padding: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical; background: #fbfcfd; color: var(--text);
}

/* Рендер markdown */
.md { line-height: 1.65; }
.md h1 { font-size: 22px; margin: 0 0 14px; }
.md h2 { font-size: 18px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 15px; margin: 20px 0 8px; color: var(--text); }
.md h4 { font-size: 14px; margin: 16px 0 6px; }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 5px; }
.md code {
  background: var(--bg); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, monospace; font-size: 12px; border: 1px solid var(--border);
}
.md pre { margin: 0 0 14px; }
.md pre code { background: none; border: none; color: #e6edf3; padding: 0; }
.md table { margin: 0 0 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.md th, .md td { white-space: normal; }
.md blockquote {
  margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--accent);
  background: var(--bg); color: var(--muted);
}
.md a { color: var(--accent); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.md input.doc-check {
  width: 15px; height: 15px; margin-right: 6px;
  vertical-align: -2px; cursor: pointer;
}
.md li:has(input.doc-check) { list-style: none; margin-left: -18px; }

/* --- Поставщики: карточки и действия --- */
.supplier-cards {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.supplier-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.supplier-card:hover { border-color: #c8cfe8; box-shadow: 0 4px 14px rgba(20, 23, 29, 0.05); }
.supplier-card.active {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59, 91, 219, .12);
}
.supplier-card .sc-name { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.supplier-card .sc-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.supplier-card .sc-stats {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 8px 14px; font-size: 12px; color: var(--muted);
}
.supplier-card .sc-stats b { font-weight: 600; color: var(--text); }

.actions-bar {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.p-pick { width: 16px; height: 16px; cursor: pointer; }

.catalog-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 8px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.catalog-pager-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.catalog-pager-gap {
  color: var(--muted);
  padding: 0 4px;
  font-size: 13px;
}
.catalog-pager .catalog-page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.catalog-pager .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Поставщики: фото, источники, карточка товара --- */
.thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); display: block;
}
.thumb.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1;
}

td.sources { white-space: normal; max-width: 320px; }
.src {
  display: inline-block; margin: 1px 0; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; text-decoration: none; border: 1px solid var(--border);
}
.src.amazon { background: #fdf4e3; color: #9a5b00; border-color: #f2dcb3; }
.src.site { background: #eaf0fd; color: var(--accent); border-color: #c7d8fa; }
.src:hover { filter: brightness(.96); }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head .pipeline-bits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#product-card:not(:empty):not(.listing-panel) {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; margin-bottom: 16px;
}
.sources-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.source-col { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--bg); }
.source-title {
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 10px;
}
.kv { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 3px 0; font-size: 13px; }
.kv span { color: var(--muted); flex-shrink: 0; }
.kv b {
  text-align: right; font-weight: 500;
  min-width: 0; flex: 1 1 auto;
  overflow-wrap: anywhere; word-break: break-word;
}
.kv-block { margin-top: 10px; font-size: 12px; }
.kv-block span { color: var(--muted); display: block; margin-bottom: 4px; }
.kv-block ul { margin: 6px 0 0; padding-left: 18px; }
.kv-block li { margin-bottom: 4px; }
.desc-box {
  margin-top: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; line-height: 1.45; white-space: pre-wrap;
  max-height: 220px; overflow: auto; color: var(--text);
}
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.mini-table th, .mini-table td {
  border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: left;
}
.mini-table th { color: var(--muted); font-weight: 500; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
}

.gallery { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.shot { display: block; text-decoration: none; text-align: center; }
.shot img {
  width: 120px; height: 120px; object-fit: contain; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; display: block;
}
.shot span { font-size: 10px; color: var(--muted); }

.enrich-cell { white-space: normal; max-width: 180px; }
.badge.enrich-ok { background: #e7f6ed; color: #1b7a3d; border: 1px solid #c6e6d1; }
.badge.enrich-need { background: #fff6e5; color: #9a5b00; border: 1px solid #f2dcb3; }
.badge.enrich-ready { background: #eaf0fd; color: var(--accent); border: 1px solid #c7d8fa; }
.badge.enrich-partial { background: #f5f0e8; color: #6b5a3e; border: 1px solid #e4d8c4; }
.badge.enrich-empty { background: #f4f4f4; color: var(--muted); border: 1px solid var(--border); }

/* --- Каталог листингов --- */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.listing-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: inherit;
}
.listing-card:hover {
  border-color: #c8cfe8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(20, 23, 29, 0.06);
}
.listing-card-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  outline: none;
}
.listing-card-main:focus-visible {
  box-shadow: inset 0 0 0 2px #2f6fed;
}
.listing-check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(255,255,255,.92); border-radius: 6px; padding: 4px;
  border: 1px solid var(--border);
}
.listing-photo {
  aspect-ratio: 16 / 10; background: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.listing-photo img {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #fff;
}
.listing-photo-stack {
  width: 100%; height: 100%; display: flex; flex-direction: column; background: #fff;
}
.listing-photo-main {
  flex: 1; min-height: 0; width: 100%; object-fit: contain; display: block; background: #fff;
}
.listing-photo-minis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 4px;
  background: #eef1f5;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.listing-photo-minis img {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  background: #fff;
  border: 1px solid transparent;
}
.listing-photo-minis img.is-active {
  border-color: var(--accent, #3b6fd8);
}
.listing-photo-empty {
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background:
    linear-gradient(135deg, #e8ebf0 0%, #f4f5f7 50%, #e4e7ec 100%);
  border: 0;
}
.listing-photo-empty-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px dashed #b8bec9;
  background:
    linear-gradient(to bottom right, transparent 46%, #b8bec9 46%, #b8bec9 54%, transparent 54%),
    linear-gradient(to top right, transparent 46%, #b8bec9 46%, #b8bec9 54%, transparent 54%);
  background-size: 60% 2px, 2px 60%;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
}
.listing-photo-empty-text { letter-spacing: 0.01em; }
.listing-main-photo.empty {
  min-height: 220px;
  display: flex;
  align-items: stretch;
}
.listing-main-photo.empty .listing-photo-empty {
  border-radius: 8px;
}
.photo-source-mini.empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #eef0f4;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 4px;
}
.ex-thumb.empty {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #e8ebf0 0%, #f4f5f7 100%);
  border: 1px dashed #c5cad3;
}
.listing-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.listing-marks { display: flex; gap: 6px; flex-wrap: wrap; min-height: 18px; }
.mark {
  font-size: 10.5px; padding: 3px 8px; border-radius: 5px; font-weight: 700;
  border: 1px solid transparent; color: var(--muted);
}
.mark.amazon { background: #fdf4e3; color: #9a5b00; border-color: #f2dcb3; }
.mark.site { background: #eaf0fd; color: var(--accent); border-color: #c7d8fa; }
.mark.bare { background: #f4f4f4; }
.mark.seo { background: #e7f5ec; color: var(--ok); border-color: #bfe3cc; }
.mark.ai-photo { background: #eef2ff; color: #3f51b5; border-color: #c5cae9; }
.sup-seo-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
  background: var(--bg);
}
.sup-seo-block label {
  display: block;
  margin: 0 0 10px;
  font-size: 13px;
}
.sup-seo-block select,
.sup-seo-block textarea {
  width: 100%;
  margin-top: 6px;
  font: 13px/1.45 inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.sup-seo-block textarea {
  min-height: 160px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.sup-col-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sup-col-map-item {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
}
.sup-col-map-item input { width: 100%; margin-top: 6px; }
.photo-slot-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 8px 10px 0;
}
.photo-slot-template-row select {
  flex: 1;
  min-width: 120px;
  margin: 0;
  font-size: 12px;
  padding: 6px 8px;
}
.photo-slot-template-row .btn {
  margin: 0;
  flex-shrink: 0;
}

.listing-fill {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.listing-fill-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}
.listing-fill-pct {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color .2s ease;
}
.listing-fill-pct.tone-low { color: #c2670a; }
.listing-fill-pct.tone-mid { color: #2f6feb; }
/* 80–89% — почти дотянули до порога выгрузки (90%), но ещё нельзя. */
.listing-fill-pct.tone-near { color: var(--near); }
.listing-fill-pct.tone-ok { color: #17803d; }
.listing-fill-bar {
  height: 10px;
  border-radius: 999px;
  background: #e8ecf1;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(20, 24, 32, .08);
}
.listing-fill-value {
  height: 100%;
  border-radius: 999px;
  background: #9aa7b8;
  transition: width .25s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.listing-fill-value.tone-low { background: linear-gradient(90deg, #f0a94e, #d97706); }
.listing-fill-value.tone-mid { background: linear-gradient(90deg, #6a95f4, #2f6feb); }
.listing-fill-value.tone-near { background: linear-gradient(90deg, #f5d949, #d9b300); }
.listing-fill-value.tone-ok { background: linear-gradient(90deg, #3cbf75, #17803d); }
.listing-fill-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.listing-title {
  margin: 2px 0 0; font-size: 13px; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.listing-price { font-size: 16px; font-weight: 400; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.listing-stock {
  font-size: 11px; font-weight: 400; padding: 2px 7px; border-radius: 999px;
  font-family: var(--mono);
}
.listing-stock.tone-ok { background: rgba(23, 128, 61, .14); color: #17803d; }
.listing-stock.tone-low { background: rgba(217, 119, 6, .14); color: #d97706; }
.listing-stock.tone-out { background: rgba(220, 38, 38, .14); color: #dc2626; }
.listing-moq {
  font-size: 11px; font-weight: 400; padding: 2px 7px; border-radius: 999px;
  font-family: var(--mono);
  background: var(--bg); color: var(--muted);
}
.listing-meta {
  font-size: 11px; color: var(--muted-3); margin-top: auto;
  font-family: var(--mono);
}

/* --- Панель листинга --- */
#product-card.listing-panel:not(:empty) {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 0; margin-bottom: 20px; overflow: hidden;
}
.listing { padding: 18px 20px 24px; }
.listing-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.listing-top-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto;
}
.listing-top-meta { font-size: 13px; color: var(--muted); }
.listing-enrich-force { font-size: 12px; color: var(--muted); margin: 0; }
#listing-enrich-result { margin: 0 0 12px; }
.listing-enrich-hint {
  margin: 6px 0 10px; font-size: 12px; line-height: 1.4;
}

/* Две колонки: скромный исходник | рабочая генерация */
.listing-split {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(360px, 1.35fr);
  gap: 0;
  border-top: 1px solid var(--border);
  margin: 0 -20px -24px;
}
@media (max-width: 1100px) {
  .listing-split { grid-template-columns: 1fr; }
}
.listing-source {
  padding: 14px 16px 20px;
  border-right: 1px solid var(--border);
  background: #f7f8fa;
  color: #5a6170;
  min-width: 0;
}
@media (max-width: 1100px) {
  .listing-source { border-right: none; border-bottom: 1px solid var(--border); }
}
.listing-workspace {
  padding: 18px 20px 28px;
  background: var(--panel);
}
.listing-col-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: #9aa1ad; font-weight: 600; margin-bottom: 10px;
}
.listing-col-label-work {
  color: var(--muted); font-weight: 700; font-size: 11px; margin-bottom: 10px;
}
.listing-work-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
}
.listing-work-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.listing-work-tab:hover { color: var(--text); }
.listing-work-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.listing-work-tab.is-dirty {
  color: var(--text);
}
.listing-work-tab.is-dirty::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: #c45c26;
  vertical-align: middle;
}
.seo-dirty-hint {
  color: #c45c26;
  font-size: 12px;
  align-self: center;
}
.seo-dirty-hint.hidden { display: none; }
.seo-empty-note {
  margin: 8px 0 12px;
  font-size: 13px;
}
.seo-empty-note.hidden { display: none; }
#listing-seo-platform-hint {
  margin: 4px 0 10px;
}
#listing-seo-save.seo-save-dirty {
  border-color: #c45c26;
  color: #8a3a12;
  font-weight: 600;
}
#product-card.seo-dirty #close-card {
  color: #8a3a12;
}
.workspace-block {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.workspace-title {
  margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--text);
}
.seo-studio-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
  margin: 12px 0;
}
.seo-platform-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 10px;
}
.seo-platform-row select {
  width: auto; min-width: 90px; margin: 0;
  padding: 5px 8px; font-size: 12px; border-radius: 8px;
}
.seo-platform-row .muted { font-size: 11px; }
.seo-studio-actions select { width: auto; min-width: 140px; margin: 0; }
.seo-field-inline {
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted);
}
.seo-field-inline span { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.seo-field {
  display: block; margin: 12px 0;
}
.seo-field input[type="text"],
.seo-field textarea {
  width: 100%; max-width: none; margin-top: 4px;
  font-size: 13px; line-height: 1.45;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font-family: inherit; box-sizing: border-box;
}
.seo-field input[type="text"] { padding: 9px 12px; }
.seo-field textarea { resize: vertical; min-height: 72px; padding: 10px 12px; }
.seo-field-hint { margin-top: 4px; font-size: 12px; }
.seo-field-card {
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
}
.seo-field-card .seo-field { margin: 0; }
.seo-field-card .btn { margin-top: 8px; }
#listing-seo-result { margin-top: 8px; }
.seo-preview {
  margin-top: 12px; padding: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: #fafbfc;
}
.seo-preview-title {
  font-size: 16px; font-weight: 700; line-height: 1.35; margin-bottom: 10px;
  color: var(--text);
}
.seo-preview-desc {
  font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  color: var(--text); margin-bottom: 12px;
}

.listing-source .listing-main-photo {
  background: #fff; border: 1px solid #e4e7ec; border-radius: 8px;
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; max-width: 280px;
}
.listing-main-photo img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.listing-main-photo.empty {
  color: #9aa1ad; font-size: 12px; background: #eef0f3;
}
.listing-thumbs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.listing-thumb {
  width: 44px; height: 44px; padding: 0; border: 1px solid #e4e7ec;
  border-radius: 6px; overflow: hidden; cursor: pointer; background: #fff;
}
.listing-thumb.active { border-color: #a8b3c5; }
.listing-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.listing-brand {
  font-size: 11px; letter-spacing: .04em;
  color: #9aa1ad; font-weight: 500; margin: 10px 0 2px;
  text-transform: none;
}
.listing-source .listing-h1 {
  margin: 0 0 6px; font-size: 15px; line-height: 1.35; font-weight: 600;
  color: #3d4450;
}
.listing-source .listing-price-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  margin-bottom: 8px; font-size: 12px; color: #6b7280;
}
.listing-source .listing-price-lg {
  font-size: 15px; font-weight: 600; letter-spacing: 0; color: #3d4450;
}
.listing-compare { font-size: 12px; color: #9aa1ad; text-decoration: line-through; }
.listing-source .stock { font-size: 12px; font-weight: 500; }
.stock.in { color: #5b8f66; }
.stock.out { color: #b56b66; }
.listing-kv { margin: 4px 0 8px; }
.listing-kv .kv {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 3px 0; border-bottom: 1px solid #eceef2; font-size: 12px;
}
.listing-kv .kv span { color: #9aa1ad; flex-shrink: 0; }
.listing-kv .kv b {
  font-weight: 500; text-align: right; color: #5a6170;
  min-width: 0; flex: 1 1 auto;
  overflow-wrap: anywhere; word-break: break-word;
}
.listing-links {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px;
  font-size: 12px;
}
.listing-text-link {
  color: #6b7c99; text-decoration: underline; text-underline-offset: 2px;
}
.listing-text-link:hover { color: var(--accent); }
.listing-more {
  margin-top: 8px;
  border-top: 1px solid #eceef2;
  padding-top: 6px;
}
.listing-more > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: #8b93a3;
  padding: 4px 0;
  user-select: none;
}
.listing-more > summary::-webkit-details-marker { display: none; }
.listing-more > summary::before { content: '▸ '; }
.listing-more[open] > summary::before { content: '▾ '; }
.listing-section-label {
  font-size: 11px; letter-spacing: .04em;
  color: #9aa1ad; font-weight: 500; margin-bottom: 6px;
  text-transform: none;
}
.listing-options { margin-top: 4px; }
.opt-block { margin-bottom: 8px; }
.opt-title { font-size: 12px; font-weight: 500; margin-bottom: 4px; color: #5a6170; }
.opt-values { display: flex; flex-wrap: wrap; gap: 4px; }
.opt-chip {
  font-size: 11px; padding: 3px 7px; border: 1px solid #e4e7ec;
  border-radius: 6px; background: #fff; color: #6b7280;
}
.listing-desc-block { margin-top: 4px; padding-top: 0; }
.listing-bullets { margin: 0 0 8px; padding-left: 16px; font-size: 12px; color: #5a6170; }
.listing-bullets li { margin-bottom: 4px; }
.listing-desc {
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; color: #5a6170;
}
.listing-desc-details[open] .listing-desc-block {
  max-height: none;
  overflow: visible;
}
.seo-field textarea#listing-seo-description {
  min-height: 160px;
  max-height: none;
  resize: vertical;
}
.listing-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.listing-tag {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}

/* --- AI-фото студия (правая колонка) --- */
.photo-studio { margin-top: 0; padding-top: 0; border-top: none; }
.photo-studio-lead { margin: 0 0 12px; font-size: 13px; line-height: 1.45; }
.photo-studio-prompt-label {
  display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px;
}
.photo-model-select {
  width: 100%; max-width: 420px; margin-bottom: 12px;
  font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.photo-model-hint { font-size: 12px; margin: -4px 0 12px; }
.photo-prompt {
  width: 100%; min-height: 72px; resize: vertical;
  font-family: inherit; font-size: 13px; line-height: 1.45;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text);
}
.photo-studio-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 10px 0 8px;
}
.photo-source-pick {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px;
  margin: 10px 0 14px;
}
.photo-source-mini {
  width: 48px; height: 48px; object-fit: contain;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.photo-studio-col-title {
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.photo-listing-block {
  margin: 8px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
}
.photo-listing-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.photo-listing-item {
  position: relative;
  width: 96px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 1;
}
.photo-listing-item.is-draggable { cursor: grab; }
.photo-listing-item.is-dragging { opacity: 0.45; }
.photo-listing-item.drag-over { outline: 2px solid var(--accent); outline-offset: 1px; }
.photo-listing-item img {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #fff;
  pointer-events: none;
}
.photo-listing-badge {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(255,255,255,.92); border: 1px solid var(--border);
  color: var(--text);
}
.photo-listing-remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: rgba(255,255,255,.95); color: var(--err);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.photo-listing-remove:hover { background: var(--err-bg); }
.photo-source-thumbs {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.photo-source-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px; border-radius: 10px;
}
.photo-source-card.active { background: var(--accent-soft); }
.photo-source-card.in-listing .photo-source-thumb { border-color: #2f9e44; }
.photo-source-mark { font-size: 11px; }
.photo-source-thumb {
  width: 56px; height: 56px; padding: 0; border: 2px solid var(--border);
  border-radius: 8px; overflow: hidden; background: #fff; cursor: pointer;
}
.photo-source-thumb.active { border-color: var(--accent); }
.photo-source-thumb img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.photo-gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: start;
}
.photo-gen-slot {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.photo-gen-slot.saved { border-color: #2f9e44; box-shadow: 0 0 0 1px #2f9e44 inset; }
.photo-gen-slot.empty-form {
  background: #f8f9fb;
  border-style: dashed;
}
.photo-gen-slot.generating {
  border-style: solid;
  border-color: #adb5bd;
  background: #f8f9fb;
}
.photo-gen-slot.error {
  border-style: solid;
  border-color: #f03e3e;
  background: #fff5f5;
}
.photo-gen-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  cursor: default;
  background: #fff5f5;
}
.photo-gen-error-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--err);
  font-weight: 600;
  text-align: center;
}
.photo-gen-busy {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  background: linear-gradient(135deg, #f1f3f5, #e9ecef);
}
.photo-gen-spinner {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  animation: photo-gen-pulse 1.2s ease-in-out infinite;
}
@keyframes photo-gen-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.photo-gen-empty-label {
  padding: 14px 12px 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.photo-gen-preview {
  position: relative;
  aspect-ratio: 1;
  background: #f5f6f8;
  cursor: zoom-in;
}
.photo-gen-preview:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.photo-gen-preview img {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #fff;
  pointer-events: none;
}
.photo-gen-zoom-hint {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 8px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  opacity: 0;
  transition: opacity .15s ease;
}
.photo-gen-preview:hover .photo-gen-zoom-hint,
.photo-gen-preview:focus .photo-gen-zoom-hint { opacity: 1; }

/* Lightbox */
body.lightbox-open { overflow: hidden; }
.photo-lightbox {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.photo-lightbox.hidden { display: none; }
.photo-lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 24, 32, .72);
  backdrop-filter: blur(2px);
}
.photo-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 40px));
  height: min(88vh, 860px);
  max-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.photo-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.photo-lightbox-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.photo-lightbox-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
}
.photo-lightbox-group .btn {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  line-height: 1;
}
.photo-lb-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  user-select: none;
}
.photo-lb-close-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
}
.photo-lightbox-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #111418;
  cursor: grab;
  touch-action: none;
}
.photo-lightbox-stage.dragging { cursor: grabbing; }
.photo-lightbox-canvas {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px 56px;
}
.photo-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 56px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(20,24,32,.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.photo-lb-nav:hover { background: rgba(20,24,32,.82); }
.photo-lb-nav.hidden { display: none; }
.photo-lb-nav-prev { left: 10px; }
.photo-lb-nav-next { right: 10px; }
#photo-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform .05s linear;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}
#photo-lightbox-img.zoomed {
  cursor: grab;
}
.photo-lightbox-hint {
  margin: 0;
  padding: 8px 14px 12px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.photo-gen-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.92); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 6px;
}
.photo-slot-prompt {
  border-top: 1px solid var(--border);
  padding: 0;
  background: #fafbfc;
}
.photo-slot-prompt > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  color: var(--text);
  user-select: none;
}
.photo-slot-prompt > summary::-webkit-details-marker { display: none; }
.photo-slot-prompt > summary::before {
  content: '▸ ';
  color: var(--muted);
}
.photo-slot-prompt[open] > summary::before { content: '▾ '; }
.photo-slot-prompt[open] > summary {
  border-bottom: 1px solid var(--border);
}
.photo-slot-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  resize: vertical;
  min-height: 72px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  background: #fff;
  color: var(--text);
}
.photo-slot-prompt .btn {
  margin: 6px 10px 8px;
}
.photo-slot-template-row .btn {
  margin: 0;
}
.photo-gen-btns {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px; background: var(--panel); border-top: 1px solid var(--border);
}
.btn.btn-sm {
  font-size: 11px; padding: 4px 8px; line-height: 1.2;
}

.photo-archive {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8f9fb;
  padding: 0;
}
.photo-archive > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  user-select: none;
}
.photo-archive > summary::-webkit-details-marker { display: none; }
.photo-archive > summary::before { content: '▸ '; color: var(--muted); }
.photo-archive[open] > summary::before { content: '▾ '; }
.photo-archive[open] > summary { border-bottom: 1px solid var(--border); }
.photo-archive-empty { margin: 0; padding: 10px 14px 14px; font-size: 12px; }
.photo-archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
}
.photo-archive-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.photo-archive-thumb {
  display: block; width: 100%; padding: 0; border: none;
  background: #f5f6f8; cursor: zoom-in; aspect-ratio: 1;
}
.photo-archive-thumb img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.photo-archive-meta {
  font-size: 11px; padding: 4px 8px 0;
}

.photo-advantage-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.photo-advantage-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 10px 0 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
}
.photo-advantage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.photo-advantage-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  padding-bottom: 8px;
}
.photo-advantage-card.saved { border-color: #bfe3cc; }
.photo-advantage-card .photo-gen-preview {
  aspect-ratio: 1;
  background: #f5f6f8;
}
.photo-advantage-card .photo-gen-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.photo-advantage-title {
  font-size: 12px;
  padding: 6px 8px 0;
  line-height: 1.3;
  min-height: 28px;
}
.photo-advantage-card .photo-gen-btns {
  padding: 6px 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* --- Настройки: выбор сервиса для ключа --- */
.key-service-picks { margin-bottom: 8px; }
.key-pick-label {
  font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600;
}
.key-pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.key-pick {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); cursor: pointer; font: inherit; color: var(--text);
  text-align: left; min-width: 140px;
}
.key-pick:hover { border-color: var(--accent); }
.key-pick.active {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff);
  box-shadow: 0 0 0 1px var(--accent);
}
.key-pick b { font-size: 14px; }
.key-pick-tag {
  font-size: 11px; color: var(--accent); font-weight: 600; letter-spacing: 0.02em;
}
.key-pick.photo { border-style: solid; }

/* --- Поставщики: единый рабочий блок --- */
.ws-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}
.ws-supplier-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 240px;
}
.ws-supplier-pick select { margin: 0; min-width: 240px; }
.ws-subtabs { margin-bottom: 18px; }
.ws-panel-intro h3 { margin: 0 0 6px; }
.ws-panel-intro p { margin: 0 0 16px; max-width: 720px; }

.ws-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 980px) {
  .ws-flow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .ws-flow { grid-template-columns: 1fr; }
}
.ws-step {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 16px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.ws-step:hover {
  border-color: #b8c9e8;
  transform: translateY(-1px);
}
.ws-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2f8;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.ws-step-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.ws-step-desc {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.ws-supplier-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ws-supplier-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel);
}
.ws-supplier-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.ws-supplier-card-top h3 { margin: 0; font-size: 15px; }
.ws-supplier-card-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  margin-bottom: 12px;
}
.ws-supplier-card-meta span { color: var(--muted); margin-right: 6px; }
.ws-supplier-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ws-schedule-list { display: flex; flex-direction: column; gap: 12px; }
.ws-schedule-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel);
}
.ws-schedule-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.ws-schedule-hints { margin-top: 6px; font-size: 12px; }
.ws-schedule-hints code {
  background: #f0f2f5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.ws-cron-status {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* --- Настройки --- */
.subtabs {
  display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.subtab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 2px; cursor: pointer; color: var(--muted-3); font-size: 13.5px;
  font-weight: 600; font-family: inherit; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 700; }

.row.between { justify-content: space-between; }
.btn.danger { color: var(--err); border-color: #f5c6c2; }
.btn.danger:hover { background: #fdeceb; }
td.nowrap { white-space: nowrap; }
h4 { margin: 20px 0 8px; font-size: 14px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.grid2 label.wide { grid-column: 1 / -1; }
.card .grid2 input, .card .grid2 select { max-width: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 6px; margin: 0;
  border: 1px solid var(--border); border-radius: 20px; padding: 6px 12px;
  background: var(--panel); cursor: pointer; font-size: 13px; color: var(--text);
}
.chip input { width: auto; margin: 0; }

.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg); }
.perm-group-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
label.perm {
  display: block; margin: 0 0 8px; padding: 6px 8px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--border);
  font-size: 13px; color: var(--text); cursor: pointer;
}
label.perm input { width: auto; margin: 0 4px 0 0; }
label.perm.by-role { opacity: .75; cursor: default; }
.perm-title { font-size: 11px; margin-top: 2px; }
.badge.admin { background: #fdf4e3; color: var(--warn); border-color: #f2dcb3; }
.alert-text { color: var(--err); }

.card textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--border); border-radius: 7px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical;
}
label.perm input[type="text"] {
  width: 100%; margin-top: 4px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}

/* --- Заявки: лампочка + модалка + список --- */
.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--topbar);
  color: #f5c542;
  box-shadow: var(--shadow-fab);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feedback-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
.feedback-fab.hidden { display: none; }
.feedback-fab-icon { display: block; }

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.feedback-modal.hidden { display: none; }
.feedback-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 32, 0.45);
}
.feedback-modal-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}
.feedback-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.feedback-modal-head h3 { margin: 0; font-size: 18px; }
.feedback-modal-lead { margin: 0 0 14px; font-size: 13px; }
.feedback-capture {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
}
.feedback-capture-row { margin-bottom: 10px; }
.feedback-capture-row:last-child { margin-bottom: 0; }
.feedback-page-url {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  word-break: break-all;
  color: #445;
}
.feedback-shot-box {
  margin: 6px 0;
  min-height: 72px;
  border: 1px dashed #cfd5df;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.feedback-shot-preview {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}
.feedback-shot-preview.hidden { display: none; }

.feedback-cards { display: flex; flex-direction: column; gap: 10px; }
.feedback-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px 16px;
}
.feedback-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 6px;
}
.feedback-card-title { margin: 0; font-size: 15px; font-weight: 700; flex: 1; min-width: 180px; }
.feedback-card-body {
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--text);
  margin: 8px 0;
}
.feedback-card-meta { font-size: 12px; color: var(--muted); }
.feedback-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.feedback-card-shot {
  margin-top: 10px;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fafbfc;
}
.feedback-card-shot img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  cursor: zoom-in;
}
.fb-kind, .fb-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.fb-kind-bug { background: #fdeceb; color: #b42318; border-color: #f5c6c2; }
.fb-kind-improvement { background: #eef4ff; color: #3558a8; border-color: #c9d7f5; }
.fb-status-open { background: #fff8e8; color: #9a6b00; border-color: #f0d69a; }
.fb-status-in_progress { background: #eaf6ff; color: #1769aa; border-color: #b7d7f0; }
.fb-status-done { background: #e7f5ec; color: #1f7a45; border-color: #bfe3cc; }
.fb-status-declined { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; }
.feedback-admin-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f6f9;
  font-size: 12px;
  color: #445;
}

/* --- Мобильная вёрстка --- */
.nav-toggle-bars {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 6px 0 #fff, 0 -6px 0 #fff;
}

/* Drawer-меню: планшеты и средний диапазон (иначе табы скроллятся/обрезаются) */
@media (max-width: 1100px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: -6px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
  }
  .nav-toggle:active { background: rgba(255, 255, 255, 0.12); }

  .topbar {
    height: 56px;
    padding: 0 16px;
    gap: 12px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .brand { font-size: 15px; margin-right: 0; }

  .nav-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    z-index: 10020;
    background: var(--panel);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(20, 24, 32, .18);
    padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform .22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open .nav-panel { transform: translateX(0); }

  .nav-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 4px 4px 12px;
    border-bottom: 1px solid var(--border);
  }
  .nav-panel-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
  }
  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
  }
  .nav-close:active { background: var(--bg); }

  .tabs {
    flex: 1;
    flex-direction: column;
    overflow: visible;
    gap: 2px;
    height: auto;
  }
  .tab {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    min-height: 44px;
    font-size: 15px;
    border-radius: 10px;
    border-bottom: none;
    color: var(--muted);
    height: auto;
  }
  .tab:hover { color: var(--text); background: var(--bg); }
  .tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-bottom: none;
  }
  /* В вертикальном меню-шторке стрелки не нужны, а бейдж — тёмный на светлом */
  .tab-flow:not(.tab-flow-last)::after { display: none; }
  .tab-flow::before { background: rgba(20, 23, 32, .07); color: var(--muted); }
  .tab-flow.active::before { background: var(--accent); color: #fff; }
  .tab-config {
    margin-left: 0; padding-left: 14px;
    border-left: none; border-top: 1px solid var(--border);
    margin-top: 8px; padding-top: 14px;
  }

  .user {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: none;
  }
  .user-name {
    color: var(--text);
    max-width: none;
  }
  .user-logout {
    color: var(--muted);
    font-size: 13px;
    min-height: 28px;
  }
  .user-logout:hover { color: var(--accent); }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(20, 24, 32, .42);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  .nav-scrim[hidden] { display: none !important; }
  body.nav-open { overflow: hidden; }
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  main {
    padding: 18px 14px 88px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(88px, calc(72px + env(safe-area-inset-bottom)));
  }

  .login-wrap {
    padding: 20px 14px;
    align-items: flex-start;
    padding-top: max(40px, env(safe-area-inset-top));
  }
  .login-card {
    width: 100%;
    max-width: 400px;
    padding: 24px 18px;
  }
  .login-card input,
  .login-card .btn {
    min-height: 44px;
    font-size: 16px; /* iOS: без автозума */
  }

  h2 { font-size: 20px; margin-bottom: 4px; }
  .page-lead { margin-bottom: 18px; }

  .btn { min-height: 40px; }
  .btn.primary { min-height: 44px; }

  .catalog-search {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .catalog-search input {
    width: 100%;
    max-width: none;
    min-width: 0 !important;
    min-height: 44px;
    font-size: 16px;
  }
  .catalog-search .btn {
    width: 100%;
    min-height: 44px;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  /* Отступа справа под кнопку обратной связи здесь больше нет: она
     position:fixed в нижнем углу ЭКРАНА, а фильтры стоят вверху страницы —
     перекрыть их она не может. Зазор лишь сужал контролы на 64px и ломал
     выравнивание с карточками ниже. Снизу отбивку даёт padding-bottom у main. */
  .filters select,
  .filters .filter-ai,
  .row select,
  .card input,
  .card select {
    width: 100%;
    max-width: none;
    min-width: 0 !important;
    min-height: 44px;
    font-size: 16px;
  }
  /* Обязательный сброс: контейнер здесь становится колонкой, и flex-basis
     из общего правила (.filters select { flex: 1 1 170px }) начинает работать
     как ВЫСОТА — каждый селект раздувался в блок на 170px. */
  .filters select {
    flex: 0 0 auto;
    height: auto;
  }
  /* margin-left:auto из общего правила в колонке прижимал кнопку вправо */
  .filters #f-reset {
    margin-left: 0;
    width: 100%;
  }
  .filters .filter-ai {
    display: flex;
  }
  .filters .filter-ai-btn {
    flex: 1;
    min-height: 44px;
  }
  .actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .actions-bar .btn,
  .actions-bar label.inline {
    width: 100%;
  }
  .actions-bar label.inline {
    white-space: normal;
    padding: 8px 0;
  }
  .catalog-pager {
    flex-direction: column;
    gap: 8px;
  }
  .catalog-pager .btn {
    min-height: 40px;
  }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stat { padding: 14px 16px; }
  .stat .value { font-size: 24px; }
  .stat .label { margin-bottom: 8px; }

  .dash-secondary { grid-template-columns: 1fr; gap: 12px; }
  .pipeline {
    flex-wrap: wrap;
    gap: 14px 0;
  }
  .pipe-step {
    flex: 1 1 33%;
    min-width: 30%;
    padding: 4px;
  }
  .pipe-step .n { font-size: 18px; }

  .supplier-cards,
  .ws-supplier-cards {
    grid-template-columns: 1fr;
  }

  .listings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .listing-body { padding: 10px; }
  .listing-card .listing-title { font-size: 13px; }

  .listing-split {
    margin-left: -12px;
    margin-right: -12px;
  }
  .listing-source,
  .listing-workspace {
    padding: 12px;
  }
  .listing-top {
    flex-direction: column;
    align-items: stretch;
  }
  .listing-top-actions {
    margin-left: 0;
    width: 100%;
  }
  .listing-top-actions .btn {
    flex: 1 1 auto;
  }
  .listing-work-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .listing-work-tab {
    flex: 0 0 auto;
    padding: 10px 12px;
    min-height: 44px;
  }

  .photo-gen-grid {
    grid-template-columns: 1fr;
  }
  .photo-studio-actions,
  .seo-studio-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .photo-studio-actions .btn,
  .seo-studio-actions .btn,
  .seo-studio-actions select,
  .photo-model-select {
    width: 100%;
    max-width: none;
    min-height: 44px;
  }
  .photo-gen-preview:hover .photo-gen-zoom-hint,
  .photo-gen-preview .photo-gen-zoom-hint { opacity: 1; }

  .subtabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0;
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
  }
  .subtab {
    flex: 0 0 auto;
    padding: 12px 14px;
    min-height: 44px;
    white-space: nowrap;
  }

  .ws-head {
    flex-direction: column;
    align-items: stretch;
  }
  .ws-supplier-pick,
  .ws-supplier-pick select {
    min-width: 0;
    width: 100%;
  }

  .table-wrap {
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  th, td { padding: 10px 10px; }

  .docs-side { position: static; }
  .card { padding: 14px; }
  .card-head { flex-direction: column; }
  .sources-grid { grid-template-columns: 1fr; }

  .photo-lightbox {
    padding: 0;
    align-items: stretch;
  }
  .photo-lightbox-panel {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .photo-lightbox-toolbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding-top: max(10px, env(safe-area-inset-top));
    min-height: 0;
  }
  .photo-lightbox-title {
    width: 100%;
    flex: 1 1 100%;
  }
  .photo-lightbox-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .photo-lightbox-canvas {
    padding: 10px 48px;
  }
  .photo-lightbox-hint { display: none; }
  .photo-lb-nav {
    width: 40px;
    height: 48px;
    font-size: 24px;
  }

  .feedback-fab {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }

  .feedback-modal {
    align-items: flex-end;
    padding: 0;
  }
  .feedback-modal-panel {
    width: 100%;
    max-width: none;
    max-height: min(92vh, 100%);
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .listings-grid {
    grid-template-columns: 1fr;
  }
  .stats { grid-template-columns: 1fr; }
  .pipe-step { flex: 1 1 45%; min-width: 40%; }
}

@media (min-width: 861px) and (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-secondary { grid-template-columns: 1fr; }
  .supplier-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  main { padding: 28px 24px; }
}

/* Горизонтальные табы чуть плотнее, пока ещё не drawer */
@media (min-width: 1101px) and (max-width: 1280px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .tabs { gap: 12px; }
  .tab { font-size: 12.5px; padding: 8px 0; }
  .brand { font-size: 15px; margin-right: 0; }
  .user { gap: 8px; }
  .user-name { max-width: 110px; }
}

