/* ── Screen page ─────────────────────────────────────────────────────────── */

.sc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sc-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
}

.sc-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.sc-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sc-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  flex: 1;
  max-width: 320px;
}

.sc-search-wrap svg { flex-shrink: 0; color: var(--text-muted); }

.sc-search {
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 100%;
}

.sc-filters { display: flex; gap: 6px; }

.sc-filter-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sc-filter-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sc-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Grid of cards ───────────────────────────────────────────────────────── */

.sc-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sc-empty {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

.sc-card {
  display: grid;
  grid-template-columns: 56px 1fr 36px;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.sc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.sc-card__photo {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sc-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sc-card__no-photo {
  font-size: 20px;
  color: var(--text-muted);
  opacity: 0.4;
}

.sc-card__body {
  min-width: 0;
}

.sc-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-card__link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.sc-card__link-val {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.sc-card__edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.sc-card__edit:hover {
  background: var(--surface-2, #f1f5f9);
  color: var(--accent);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.sc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sc-badge--linked  { background: #dcfce7; color: #166534; }
.sc-badge--unlinked{ background: #f1f5f9; color: #94a3b8; }
.sc-badge--tn      { background: #dbeafe; color: #1e40af; }
.sc-badge--sku     { background: #fef9c3; color: #854d0e; }

/* ── Modal ───────────────────────────────────────────────────────────────── */

.sc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sc-modal {
  background: #ffffff;
  border-radius: 12px;
  width: 520px;
  max-width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.sc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sc-modal__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.sc-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.12s;
}

.sc-modal__close:hover { background: var(--surface-2, #f1f5f9); }

.sc-modal__preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  flex-shrink: 0;
}

.sc-modal__photo {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sc-modal__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sc-modal__meta { flex: 1; min-width: 0; }

.sc-modal__screen-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.sc-modal__current {
  font-size: 12px;
  color: var(--text-muted);
}

.sc-modal__search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 8px;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
  min-height: 0;
}

.sc-modal__search-icon { color: var(--text-muted); flex-shrink: 0; width: 16px; height: 16px; }

.sc-modal__search {
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 100%;
}

.sc-modal__results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 8px;
  min-height: 100px;
}

.sc-modal__hint {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.sc-modal__group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 0 4px;
}

.sc-modal__result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.sc-modal__result-item:hover { background: var(--surface-2, #f1f5f9); }

.sc-result__name {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-result__sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sc-modal__unlink {
  color: #dc2626;
  border-color: #fecaca;
}

.sc-modal__unlink:hover { background: #fef2f2; }

/* ── TN assignment chips ─────────────────────────────────────────────────── */

.sc-modal__tn-section {
  padding: 10px 20px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sc-modal__tn-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sc-modal__tn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: center;
}

.sc-tn-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.sc-tn-chip__badge {
  font-size: 9px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sc-tn-chip__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #1e40af;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.6;
  transition: opacity 0.1s;
}

.sc-tn-chip__remove:hover { opacity: 1; }

/* ── Search result states ────────────────────────────────────────────────── */

.sc-modal__result-item--added {
  background: #f0fdf4;
}

.sc-modal__result-item--added:hover { background: #dcfce7; }

/* ── Subgroup badge ──────────────────────────────────────────────────────── */

.sc-badge--sg { background: #fef3c7; color: #92400e; }

/* ── Releases tab ────────────────────────────────────────────────────────── */

#sc-releases-body {
  max-width: 1000px;
  margin: 0 auto;
}

.scr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.scr-select {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.scr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scr-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.scr-row:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,.06); }

.scr-row__main { flex: 1; min-width: 0; }
.scr-row__store { font-size: 13px; font-weight: 600; }
.scr-row__week  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.scr-row__count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.scr-row__actions { display: flex; gap: 4px; flex: none; }

/* ── Editor ──────────────────────────────────────────────────────────────── */

.scr-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.scr-editor-title { font-size: 14px; font-weight: 600; }

.scr-export-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

.scr-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 0;
  /* Липнет к верху при скролле — не нужно листать вверх, чтобы добавить позицию */
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-page, #fff);
}

/* Общий grid на весь список — колонки выравниваются по всем строкам одинаково,
   независимо от того, насколько длинное название товара в конкретной строке
   (оно просто обрезается многоточием, см. .scr-item__name). */
#scr-items {
  display: grid;
  grid-template-columns: 28px 48px minmax(0, 1fr) 100px 165px 195px;
  gap: 0 10px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.scr-item {
  display: contents;
}

.scr-item > * {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.scr-item:last-child > * { border-bottom: none; }

.scr-item__order {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  justify-content: center;
}

.scr-item__locs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scr-loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.scr-item__photo {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.scr-item__photo img { width: 100%; height: 100%; object-fit: cover; }

.scr-item__body { min-width: 0; flex-direction: column; align-items: flex-start; }

.scr-item__name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scr-item__fields {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scr-field { padding: 1px 4px; border-radius: 4px; }
.scr-field--auto   { color: var(--text-muted); }
.scr-field--manual { background: #fef9c3; color: #854d0e; font-weight: 600; }

.scr-item__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.scr-item__actions-row {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ── Photo library picker (блок Промо) ──────────────────────────────────────── */

.scr-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.scr-photo-picker__toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.scr-photo-tile {
  width: 84px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.12s;
}

.scr-photo-tile:hover { border-color: var(--accent); }

.scr-photo-tile img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  display: block;
}

.scr-photo-tile__name {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-muted);
  padding: 3px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Вкладки раздела "Экран" ─────────────────────────────────────────────────── */

.scr-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.scr-tab {
  padding: 8px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.scr-tab:hover { color: var(--text); }
.scr-tab--active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Вкладка "Фото" (библиотека фото товаров) ───────────────────────────────── */

.scrp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scrp-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.scrp-row__photo {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2, #f1f5f9);
}

.scrp-row__photo img { width: 100%; height: 100%; object-fit: cover; }

.scrp-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.scrp-row__filename {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scrp-row__alt { max-width: 420px; }

.scrp-row__assignments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scrp-row__actions { display: flex; gap: 12px; align-items: center; font-size: 12px; }
.scrp-row__actions a { color: var(--accent); }
.scrp-drop {
  margin: 0 0 12px; padding: 12px 14px; border: 1px dashed var(--border);
  border-radius: 8px; color: var(--text-muted); font-size: 12px; text-align: center;
}
.scrp-drop--active { border-color: var(--accent); background: var(--surface-2, #f1f5f9); color: var(--accent); }
