/* ==========================================================================
   sites.css — страница «Сайты»
   ========================================================================== */

.sites-page {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* ==========================================================================
   Верхняя полоса: три показателя
   ========================================================================== */
.sites-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

/* ==========================================================================
   Таблица сайтов
   ========================================================================== */
.sites-table-card { padding: 14px 16px 8px; }

/* шапка таблицы: поиск слева, счётчик и экспорт справа */
.table-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 14px;
}

.table-head__search {
  width: 340px;
  max-width: 100%;
  height: 40px;
}

.table-head__count {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.sites-table { font-size: 12.5px; }

.sites-table th {
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border);
}

.sites-table td {
  padding: 13px 12px;
  border-top: 1px solid var(--border);
}

.sites-table tbody tr:first-child td { border-top: 0; }

.sites-table th:first-child,
.sites-table td:first-child { padding-left: 4px; }

.sites-table th:last-child,
.sites-table td:last-child { padding-right: 4px; text-align: right; }

.sites-table .kebab { margin-left: auto; }

/* Домен занимает всё свободное место, числовые колонки — фиксированной
   ширины: иначе при переключении периода таблица дёргается, потому что
   "1,2 тыс." и "842" занимают разное место */
.sites-table th:nth-child(1) { width: auto; }
.sites-table th:nth-child(2) { width: 128px; }
.sites-table th:nth-child(3) { width: 78px; }
.sites-table th:nth-child(4),
.sites-table th:nth-child(5) { width: 100px; }
.sites-table th:nth-child(6),
.sites-table th:nth-child(7) { width: 80px; }
.sites-table th:nth-child(8) { width: 90px; }
.sites-table th:nth-child(9) { width: 44px; }

/* ==========================================================================
   Ячейка домена
   ========================================================================== */
.site-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.site-link:hover .site-cell__name { color: var(--brand); text-decoration: underline; }

/* ==========================================================================
   Показатели
   ========================================================================== */
.site-metric {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.site-delta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.site-spark {
  /* Ячейке нужна своя ширина: спарклайн рисуется по clientWidth, а у
     пустой ячейки он равен нулю и график не появился бы вовсе */
  width: 92px;
  vertical-align: middle;
}
.site-spark svg { display: block; }

.sites-foot {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
}
.sites-foot:empty { display: none; }

/* страна */
.country-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* переезд */
.move-none { color: var(--text-2); }
.move-link { color: var(--brand); font-weight: 500; }

/* последняя проверка */
.check-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--text-2);
}
.check-cell__ico--ok   { color: var(--green); }
.check-cell__ico--wait { color: var(--brand); }
.check-cell--empty { color: var(--text-3); }

/* ==========================================================================
   Нижний ряд карточек
   ========================================================================== */
.sites-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  align-items: stretch;
}

.card__desc {
  margin: -8px 0 14px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}

/* --- Автоподтверждение --- */
.autoverify__codes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.autoverify__code {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.autoverify__code-label {
  flex: none;
  width: 96px;
  font-size: 11.5px;
  color: var(--text-3);
}

.autoverify__code-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text);
}

.autoverify__title {
  margin: 16px 0 6px;
  font-size: 12px;
  color: var(--text-3);
}

.autoverify__list { display: flex; flex-direction: column; }

.autoverify__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.autoverify__item:first-child { border-top: 0; }

.autoverify__ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
}
.autoverify__ico .icon { width: 15px; height: 15px; }
.autoverify__ico--done     { background: var(--green-soft); color: var(--green); }
.autoverify__ico--checking { background: var(--brand-soft); color: var(--brand); }
.autoverify__ico--waiting  { background: var(--surface-2);  color: var(--text-3); }
.autoverify__ico--error    { background: var(--red-soft);   color: var(--red); }

.autoverify__body { flex: 1; min-width: 0; }

.autoverify__url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.autoverify__note {
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-3);
}

.autoverify__method {
  flex: none;
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.verify__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}
.verify__foot .btn { margin-left: auto; }

/* --- История переездов --- */
.moves__list { display: flex; flex-direction: column; gap: 10px; }

.moves__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.moves__ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
}
.moves__ico .icon { width: 15px; height: 15px; }
.moves__ico--done   { background: var(--green-soft); color: var(--green); }
.moves__ico--active { background: var(--brand-soft); color: var(--brand); }

.moves__route {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-2);
}
.moves__route span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.moves__arrow { flex: none; color: var(--text-3); }

.moves__meta { margin-left: auto; text-align: right; white-space: nowrap; }
.moves__date { font-size: 11.5px; color: var(--text-2); }

.moves__status { font-size: 11.5px; font-weight: 600; }
.moves__status--done   { color: var(--text-3); }
.moves__status--active { color: var(--brand); }

/* --- Права доступа --- */
.roles__list { display: flex; flex-direction: column; }

.roles__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.roles__item:first-child { border-top: 0; }

.roles__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.roles__avatar--blue   { background: var(--brand); }
.roles__avatar--violet { background: #7c4dff; }
.roles__avatar--amber  { background: #f5a524; }

.roles__mail {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.roles__foot {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 1150px) {
  .sites-bottom { grid-template-columns: 1fr 1fr; }
  .sites-bottom > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .sites-summary,
  .sites-bottom { grid-template-columns: 1fr; }
  .sites-bottom > :last-child { grid-column: auto; }
  .table-head { flex-wrap: wrap; }
  .table-head__search { width: 100%; }
  .sites-table-card { overflow-x: auto; }
  .sites-table { min-width: 980px; }
}

/* Рынок выбран автоматически из нескольких или угадан по домену —
   пунктир отличает догадку от того, что сайт объявил прямо */
.q-market--guess {
  border-style: dashed;
  color: var(--amber);
}
