/* Страница «Рейтинг офферов»: на всю ширину, карточки, границы столбцов */

.offer-rating-page {
  width: 100%;
  max-width: none;
}

/* Вкладки */
.or-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.or-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.35));
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.or-tab:hover {
  background: rgba(255, 255, 255, 0.06);
}
.or-tab--active {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.18);
  color: #e0e7ff;
}

/* Панель фильтров: одна строка, кнопки справа */
.or-toolbar-one-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.or-toolbar-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}
.or-toolbar-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-self: flex-end;
  padding-bottom: 0.05rem;
}

/* Архив: поля не слипаются — перенос строк и зазоры */
.or-archive-toolbar.or-toolbar-one-line {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  row-gap: 0.85rem;
}
.or-archive-toolbar .or-toolbar-filters {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  row-gap: 0.85rem;
  min-width: 0;
}
.or-archive-toolbar .offer-rating-field--compact {
  flex: 0 1 auto;
  min-width: min(100%, 11rem);
}
.or-archive-toolbar .offer-rating-field--arch-period {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 100%;
}
.or-archive-toolbar .offer-rating-field--arch-period .offer-rating-select--sm {
  min-width: 12rem;
  width: 100%;
  max-width: 22rem;
}
.or-archive-toolbar .offer-rating-field--geo {
  flex: 0 1 16rem;
  min-width: 9rem;
}

/* Селекты как у geo-picker (cell-creo-btn): те же высота, рамка, chevron */
.offer-rating-toolbar .offer-rating-select.offer-rating-select--sm {
  box-sizing: border-box;
  min-width: 8.5rem;
  max-width: 100%;
  min-height: var(--th-control-h, 36px);
  margin: 0;
  padding: 6px 28px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg);
  color: var(--text);
  font-size: var(--th-font-md);
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238888a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  transition: border-color var(--transition, 0.15s ease);
}
.offer-rating-toolbar .offer-rating-select.offer-rating-select--sm:hover {
  border-color: var(--border-hover);
}

.offer-rating-field--geo {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 18rem;
}

/* GEO: глобальные стили geo-picker; только ширина контейнера */
.offer-rating-toolbar .geo-picker-mount {
  min-width: 8.5rem;
  max-width: 16rem;
}

.offer-rating-input-dt {
  box-sizing: border-box;
  min-width: 11rem;
  min-height: var(--th-control-h, 36px);
  padding: 6px 12px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: var(--th-font-md);
}

/* Таблица на всю ширину области контента */
.offer-rating-page .statistics-table-inner.admin-table-wrap.offer-rating-main-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
}
.offer-rating-page .statistics-table-inner .admin-table.statistics-table.offer-rating-table {
  width: 100%;
  min-width: min(100%, 64rem);
  table-layout: auto;
}

/* Онлайн-таблица: I2R / R2D — отдельные ячейки, не слипаются */
.offer-rating-page #or-table td:nth-child(4),
.offer-rating-page #or-table td:nth-child(5),
.offer-rating-page #or-table td:nth-child(6),
.offer-rating-page #or-table td:nth-child(7),
.offer-rating-page #or-table td:nth-child(8) {
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  max-width: 9rem;
}

.offer-rating-page .statistics-table-inner .admin-table th:first-child,
.offer-rating-page .statistics-table-inner .admin-table td:first-child {
  text-align: left;
}

.offer-rating-meta {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.offer-rating-card {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.25));
}

.offer-rating-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.or-attention-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
}

.or-attention-card__subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  line-height: 1.35;
}

@media (max-width: 1100px) {
  .or-attention-grid {
    grid-template-columns: 1fr;
  }
}

/* Мини-таблицы топа: Оффер | GEO | Трафик % | Изм.% */
.offer-rating-table--attention-mini {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}
.offer-rating-table--attention-mini th,
.offer-rating-table--attention-mini td {
  padding: 0.28rem 0.45rem;
  vertical-align: top;
}
.offer-rating-table--attention-mini th:nth-child(1),
.offer-rating-table--attention-mini td:nth-child(1) {
  white-space: normal;
  max-width: none;
  overflow: visible;
}
.offer-rating-table--attention-mini th:nth-child(2),
.offer-rating-table--attention-mini td:nth-child(2) {
  text-align: center;
  white-space: nowrap;
  width: 2.75rem;
  max-width: 3.5rem;
}
.offer-rating-table--attention-mini th:nth-child(3),
.offer-rating-table--attention-mini td:nth-child(3) {
  text-align: right;
  white-space: nowrap;
  min-width: 3.75rem;
  font-variant-numeric: tabular-nums;
}
.offer-rating-table--attention-mini th:nth-child(4),
.offer-rating-table--attention-mini td:nth-child(4) {
  text-align: right;
  min-width: 4.5rem;
  max-width: 9rem;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.offer-rating-card__lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

.offer-rating-mini-wrap,
.offer-rating-main-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
}

.offer-rating-toolbar {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.25));
}

.offer-rating-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
}

.offer-rating-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle, rgba(148, 163, 184, 0.2));
}

.offer-rating-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.offer-rating-field__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
}

.offer-rating-select {
  min-width: 11rem;
  max-width: 100%;
}

/* Вертикальные разделители столбцов */
.offer-rating-table th,
.offer-rating-table td {
  white-space: nowrap;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
}

/* Архив: Оффер|…|GEO || I2R|I2R%|изм. || R2D|R2D%|изм. || Traffic|изм. — толстые после 3, 6, 9 */
.offer-rating-table--archive th.or-archive-th--gthick,
.offer-rating-table--archive td:nth-child(3),
.offer-rating-table--archive td:nth-child(6),
.offer-rating-table--archive td:nth-child(9) {
  border-right: 2px solid rgba(148, 163, 184, 0.45);
}

.offer-rating-table--archive th.or-archive-th--izm,
.offer-rating-table--archive td:nth-child(6),
.offer-rating-table--archive td:nth-child(9),
.offer-rating-table--archive td:nth-child(11) {
  font-size: 0.78rem;
  max-width: 4rem;
  text-align: right;
}

#or-archive-table td {
  white-space: normal;
}
#or-archive-table td:nth-child(6),
#or-archive-table td:nth-child(9),
#or-archive-table td:nth-child(11) {
  white-space: nowrap;
}

.offer-rating-table th:last-child,
.offer-rating-table td:last-child {
  border-right: none;
}

.offer-rating-table td:first-child,
.offer-rating-table th:first-child {
  white-space: normal;
  max-width: min(28rem, 42vw);
}

.offer-rating-slot--badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}

.offer-rating-delta--up {
  color: #4ade80;
  font-weight: 600;
}

.offer-rating-delta--good {
  color: #4ade80;
  font-weight: 600;
}

.offer-rating-delta--flat {
  color: var(--text-muted, #94a3b8);
}

.offer-rating-delta--down {
  color: #f87171;
  font-weight: 600;
}

.offer-rating-delta--bad {
  color: #f87171;
  font-weight: 600;
}

/* Перебиваем .admin-table td { color: color-mix(...) } — иначе зел/крас не видны */
.offer-rating-page .admin-table td.offer-rating-delta--good,
.offer-rating-page .admin-table td.offer-rating-delta--good span {
  color: #22c55e !important;
  font-weight: 600;
}

.offer-rating-page .admin-table td.offer-rating-delta--bad,
.offer-rating-page .admin-table td.offer-rating-delta--bad span {
  color: #ef4444 !important;
  font-weight: 600;
}

.offer-rating-page .admin-table td.offer-rating-delta--flat {
  color: var(--text-muted, #94a3b8) !important;
}

@media (max-width: 720px) {
  .offer-rating-toolbar__row {
    flex-direction: column;
    align-items: stretch;
  }

  .offer-rating-select {
    width: 100%;
  }

  .offer-rating-table td:first-child,
  .offer-rating-table th:first-child {
    max-width: 12rem;
  }

  .or-toolbar-one-line {
    flex-wrap: nowrap;
  }
}
