/* ==========================================================================
   Posradar — визуальный язык

   Четыре правила, из которых следует всё остальное.

   1. Разделяет не линия, а поверхность. Холст страницы серый (#f5f5f7),
      карточки белые, ни рамок, ни теней. Граница остаётся только там, где
      без неё теряется смысл: сетка таблицы и край закреплённой колонки.

   2. Почти монохром. Текст #1d1d1f, второстепенный #6e6e73. Синий #0071e3
      занят одним делом — главным действием; ссылки #0066cc. Цвет в таблице
      означает ровно одно: насколько это близко к верху выдачи.

   3. Воздух важнее плотности. Крупные скругления, пилюли у кнопок, широкие
      отступы. Данные при этом остаются плотными — это рабочий инструмент,
      а не витрина.

   4. В клетке — одно число. Позиция и её изменение. Адреса страниц, прочие
      позиции того же сайта и подробности ошибки живут в подсказке: в клетке
      шириной 60 px три строки данных не читаются, а мешают увидеть главное.
   ========================================================================== */

:root {
  /* Поверхности */
  --canvas: #f5f5f7;
  --paper: #ffffff;
  --wash: #e8e8ed;
  --wash-soft: #f0f0f3;

  /* Линии — только там, где без них нельзя */
  --hairline: #e3e3e6;
  --hairline-strong: #d2d2d7;

  /* Текст */
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --muted: #6e6e73;
  --muted-soft: #86868b;

  /* Акцент и состояния */
  --accent: #0071e3;
  --accent-press: #0062c4;
  --link: #0066cc;
  --accent-wash: #e8f1fd;
  --positive: #1d7f3f;
  --positive-wash: #e6f4ea;
  --negative: #c9372c;
  --negative-wash: #fdeceb;
  --warn: #b64400;
  --warn-wash: #fdf1e6;

  /* Типографика: системный шрифт Apple там, где он есть, Inter — везде ещё */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter',
          ui-sans-serif, system-ui, 'Segoe UI', Roboto, sans-serif;
  --text-micro: 11px;
  --text-caption: 12px;
  --text-small: 13px;
  --text-body: 15px;
  --text-body-lg: 17px;
  --text-title: 21px;
  --text-heading: 28px;

  /* Скругления */
  --radius-field: 12px;
  --radius-card: 20px;
  --radius-card-lg: 24px;
  --radius-pill: 999px;

  /* Высота элементов управления */
  --control-h: 36px;
  --control-h-sm: 30px;

  /* Таблица позиций.
     Ширину раздаёт сама таблица: колонки делят свободное место поровну, а
     min-width не даёт им сжаться до нечитаемого. Формула от 100vw не годится
     — вьюпорт шире контейнера на рельс, поля и полосу прокрутки, и колонка
     выходила за правый край при любом разрешении. */
  --pos-col-min: 60px;
  --pos-col-query-width: 300px;
  --pos-row-height: 40px;
  --pos-cols-visible: 22;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.47;
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: var(--text-body-lg); }
h2 { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: var(--text-title); letter-spacing: -0.015em; }
h3 { font-size: var(--text-body); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.45);
  outline-offset: 2px;
  border-radius: var(--radius-field);
}

/* --------------------------------------------------------------------------
   Оболочка
   -------------------------------------------------------------------------- */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 7;
  height: 100vh;
  width: 60px;
  flex: 0 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 23px 0 16px;
  background: var(--canvas);
}

.app-sidebar .sidebar-nav {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-sidebar .sidebar-nav svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-sidebar .sidebar-nav:hover,
.app-sidebar .sidebar-nav:focus-visible { background: var(--wash); color: var(--ink); text-decoration: none; }
.app-sidebar .sidebar-nav.active { background: var(--paper); color: var(--accent); }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 16px 24px 40px 4px;
}

/* --------------------------------------------------------------------------
   Верхняя панель
   -------------------------------------------------------------------------- */

.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 52px;
  margin-bottom: 16px;
  padding: 8px 8px 8px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding-right: 6px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: var(--accent);
}

.brand-mark svg { width: 20px; height: 20px; }

.brand h1 { font-size: var(--text-body); font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }

.project-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.project-controls label { display: none; }

.control-select { min-width: 130px; max-width: 220px; }
.control-select-wide { min-width: 170px; max-width: 260px; }

/* Строка контекста — подпись, а не кнопка: та же высота, но без рамки поля
   и без стрелки, чтобы не звала нажать. */
/* Контекст проекта — это подпись, а не элемент управления. Плашка вокруг
   него притворялась полем и добавляла на панель третью форму. */
.project-context {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  color: var(--muted);
  font-size: var(--text-small);
  white-space: nowrap;
}

.context-engine { color: var(--ink); font-weight: 500; }

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: var(--text-small);
}

.top-bar-user > span { padding-right: 4px; }

.top-bar-user a {
  display: inline-flex;
  align-items: center;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-soft);
  text-decoration: none;
}

.top-bar-user a:hover { background: var(--wash); color: var(--ink); text-decoration: none; }

.tabs { display: none; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Настройки — форма, а не таблица: колонка ограничена и стоит по центру.
   Строка в 1800 px нечитаема, а прижатая влево оставляет полэкрана пустым. */
#content-settings.active { max-width: 900px; margin: 0 auto; }

/* --------------------------------------------------------------------------
   Элементы управления
   -------------------------------------------------------------------------- */

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 400;
}

input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="url"],
input[type="search"],
select {
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-field);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-body);
  line-height: calc(var(--control-h) - 2px);
  min-width: 180px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  padding: 10px 14px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-field);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-body);
  line-height: 1.47;
  min-width: 180px;
}

input::placeholder, textarea::placeholder { color: var(--muted-soft); }
input:hover, select:hover, textarea:hover { border-color: var(--muted-soft); }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236e6e73' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

/* Поле со списком частых значений. Браузер рисует для него собственный
   чёрный треугольник, а у числового поля добавлял к нему ещё и стрелки
   «+1 / −1»: два разных механизма в одном поле выглядели поломкой. Свой
   рисунок у поля теперь тот же, что у выпадающего списка, а родной
   указатель оставлен прозрачным — только как область нажатия. */
input[list] {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%236e6e73' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

input[list]::-webkit-calendar-picker-indicator {
  width: 30px;
  height: 100%;
  margin: 0 -14px 0 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
  width: 17px;
  height: 17px;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Кнопки — пилюли. Залитая синим ровно одна на экран: главное действие. */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: var(--text-small);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

button:hover, .btn:hover { background: var(--accent-press); }
button:disabled, .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary, .btn.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.btn-secondary:hover { background: var(--wash); border-color: var(--hairline-strong); color: var(--ink); }

.btn-primary { background: var(--accent); }
.btn-danger { background: var(--negative); }
.btn-danger:hover { background: #a82c23; }

.btn-outline-danger {
  background: var(--paper) !important;
  border-color: rgba(201, 55, 44, 0.35) !important;
  color: var(--negative) !important;
}

.btn-outline-danger:hover { background: var(--negative-wash) !important; }

form { display: inline; }

/* Единственная сетка форм на весь сервис.
   Раньше каждая карточка сочиняла свою: где-то подпись слева, где-то сверху,
   поля то на 200 px, то на всю ширину. Из-за этого страница выглядела
   собранной из кусков. Теперь строка — всегда две равные колонки, поле
   всегда занимает свою колонку целиком, а на узком экране колонки
   складываются в одну. */
.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
  align-items: start;
}

.row + .row { margin-top: 20px; }
.row > * { min-width: 0; }

/* Внутри одной ячейки может стоять несколько полей подряд. Подпись, идущая
   после чего-либо, — это начало нового поля, и между ними нужен воздух.
   Без этого правила подпись прилипала к предыдущему полю вплотную. */
.row > div > * + label,
.row > div > * + .checkbox-line,
.row > div > * + .field-inline { margin-top: 18px; }

/* Подпись и её поле, наоборот, стоят вплотную — это одна вещь. */
.row > div > label + input,
.row > div > label + select,
.row > div > label + textarea,
.row > div > label + .field-inline { margin-top: 0; }
.row-single { grid-template-columns: minmax(0, 1fr); }
.row-full > * { grid-column: 1 / -1; }

/* В ячейке строки поле занимает всю её ширину — одно правило вместо
   десятка «ширина такая-то у этого конкретного поля». */
.row input:not([type]),
.row input[type="text"],
.row input[type="password"],
.row input[type="number"],
.row input[type="time"],
.row input[type="url"],
.row input[type="search"],
.row select,
.row textarea { width: 100%; min-width: 0; }

.toggle-wrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.toggle-wrap input { width: auto; min-width: auto; }

.is-hidden { display: none !important; }
.empty { color: var(--muted); }

/* --------------------------------------------------------------------------
   Карточки и сообщения
   -------------------------------------------------------------------------- */

.card {
  margin-bottom: 16px;
  padding: 24px 28px;
  background: var(--paper);
  border-radius: var(--radius-card-lg);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 18px;
  border-radius: var(--radius-card);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: var(--text-small);
}

.notice::before {
  content: 'i';
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--muted);
}

.notice-success { background: var(--positive-wash); color: #0f5c2e; }
.notice-success::before { content: '✓'; background: var(--positive); }
.notice-warning { background: var(--warn-wash); color: #8a3400; }
.notice-warning::before { content: '!'; background: var(--warn); }
.notice-danger { background: var(--negative-wash); color: #96271f; }
.notice-danger::before { content: '!'; background: var(--negative); }
.notice-muted { background: var(--wash-soft); color: var(--muted); }

/* --------------------------------------------------------------------------
   Полоса показателей
   -------------------------------------------------------------------------- */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(200px, 0.85fr) minmax(160px, 0.7fr) minmax(160px, 0.7fr) minmax(280px, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.overview-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 104px;
  padding: 18px 22px;
  background: var(--paper);
  border-radius: var(--radius-card);
}

.overview-label {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.overview-value {
  color: var(--ink);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.overview-note { color: var(--muted); font-size: var(--text-caption); }

.overview-ring { display: flex; align-items: center; gap: 16px; }

.overview-donut {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
}

.overview-donut::after {
  content: '';
  width: 38px;
  height: 38px;
  background: var(--paper);
  border-radius: 50%;
}

.overview-chip {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--wash);
  color: var(--ink-soft);
  font-size: var(--text-caption);
}

.overview-bars { display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.overview-bars i { display: block; width: 4px; border-radius: var(--radius-pill); background: var(--wash); }
.overview-bars i:last-child { background: var(--accent); }

.overview-moves { display: flex; flex-direction: column; gap: 5px; }

.overview-move {
  display: grid;
  grid-template-columns: 12px auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--text-small);
  line-height: 1.3;
}

.overview-move b { font-weight: 500; color: var(--ink); }
.overview-move .mark { font-size: 9px; text-align: center; }
.overview-move.up .mark { color: var(--positive); }
.overview-move.down .mark { color: var(--negative); }
.overview-move.flat .mark { color: var(--muted-soft); }

.overview-buckets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bucket {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-field);
  background: var(--wash-soft);
}

.bucket-name { color: var(--muted); font-size: var(--text-caption); white-space: nowrap; }
.bucket-count { color: var(--ink); font-size: var(--text-body); font-weight: 500; }
.bucket.is-top { background: var(--positive-wash); }
.bucket.is-top .bucket-name { color: #2e7d4f; }
.bucket.is-top .bucket-count { color: #0f5c2e; }

/* --------------------------------------------------------------------------
   Панель действий
   -------------------------------------------------------------------------- */

.capture-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.capture-actions, .export-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.export-actions .btn { padding: 0 16px !important; font-size: var(--text-small) !important; }
.capture-summary { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-small); }
.capture-summary-icon { display: none; }
.last-run { color: var(--muted); font-size: var(--text-small); }

.group-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1px solid var(--hairline-strong);
}

.group-filter-wrap select {
  height: calc(var(--control-h) - 2px);
  min-width: 150px;
  padding: 0 24px 0 0;
  border: 0;
  background-color: transparent;
  background-position: right 2px center;
  box-shadow: none;
}

.group-filter-wrap select:focus { box-shadow: none; }
.group-filter-icon { display: grid; place-items: center; color: var(--muted-soft); }

.query-search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 220px;
  display: flex;
  align-items: center;
}

.query-search-wrap .query-search-icon {
  position: absolute;
  left: 14px;
  display: grid;
  place-items: center;
  color: var(--muted-soft);
  pointer-events: none;
}

.query-search-wrap input {
  width: 100%;
  min-width: 0;
  padding-left: 38px;
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   Пользователи

   Ещё одна страница без оболочки сервиса. Её вид тоже жил встроенным блоком
   в разметке, и там же лежало правило `.row { align-items: flex-end }` -
   ровно то, которое однажды разъехало подписи в формах профиля. Общая сетка
   форм не должна переопределяться на отдельной странице.
   -------------------------------------------------------------------------- */

.users-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px;
}

.users-page h1 { margin: 0 0 16px; font-size: var(--text-title); }
.users-page h2 { margin-top: 0; }
.users-page .nav { margin-bottom: 20px; font-size: var(--text-small); }
.users-page table { width: 100%; border-collapse: collapse; }

.users-page th, .users-page td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
}

.users-page th {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 500;
}

.badge-admin { background: var(--accent-wash); color: var(--accent); }
.badge-user { background: var(--wash); color: var(--muted); }

.users-page .success, .users-page .error {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-field);
  font-size: var(--text-small);
}

.users-page .success { background: var(--positive-wash); color: var(--positive); }
.users-page .error { background: var(--negative-wash); color: var(--negative); }

.users-page .form-inline { display: inline; }
.users-page .btn-compact { min-height: var(--control-h-sm); padding: 0 12px; font-size: var(--text-caption); }

/* Галочка и её подпись стоят в одну строку, а не друг под другом. */
.users-page .checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
}

.users-page .checkbox-line input { min-width: 0; }
.users-page .checkbox-line label { margin: 0; cursor: pointer; }

/* --------------------------------------------------------------------------
   Вход

   Единственная страница без оболочки сервиса, поэтому центрирование описано
   здесь. Раньше весь её вид жил встроенным блоком в самой разметке, и она
   отставала от остального сервиса при каждой правке: карточка была цвета
   холста и на холсте не читалась вовсе.
   -------------------------------------------------------------------------- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 36px;
  background: var(--paper);
  border-radius: var(--radius-card-lg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);
}

.login-head {
  margin-bottom: 28px;
  text-align: center;
}

.login-card .brand-mark {
  width: 48px;
  height: 48px;
  flex: none;
  margin: 0 auto 16px;
  border-radius: 15px;
  background: var(--accent-wash);
}

.login-card .brand-mark svg { width: 26px; height: 26px; }

.login-card h1 {
  margin: 0 0 6px;
  font-size: var(--text-heading);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-card .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-small);
}

.login-field + .login-field { margin-top: 18px; }
.login-card input { width: 100%; min-width: 0; }

.login-card button {
  width: 100%;
  height: 44px;
  margin-top: 28px;
  font-size: var(--text-body);
}

/* Отказ во входе - это сообщение, а не мелкая красная строчка под заголовком. */
.login-error {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius-field);
  background: var(--negative-wash);
  color: var(--negative);
  font-size: var(--text-small);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Таблица позиций
   -------------------------------------------------------------------------- */

.results-card { padding: 0; overflow: hidden; }

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 14px;
}

.results-toolbar h2 { margin: 0; font-size: var(--text-body-lg); }
.results-caption { color: var(--muted); font-size: var(--text-caption); text-align: right; }

.empty-state { max-width: 44rem; padding: 8px 28px 32px; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); }

.table-scroll-shell { position: relative; }

.table-scroll-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  overscroll-behavior-x: contain;
}

.table-scroll-wrap table {
  width: 100%;
  min-width: calc(var(--pos-col-query-width) + var(--pos-cols-visible) * var(--pos-col-min));
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--text-small);
}

/* Сетка. Линии тонкие и светлые, но есть: без них соседние клетки сливаются
   в полосу, и взгляд не находит, где кончается один съём. */
th, td {
  padding: 0;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
  vertical-align: middle;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline-strong);
  color: var(--muted);
  font-weight: 400;
}

.table-scroll-wrap .col-query {
  position: sticky;
  left: 0;
  z-index: 2;
  width: var(--pos-col-query-width);
  min-width: var(--pos-col-query-width);
  max-width: var(--pos-col-query-width);
  padding: 0 16px;
  background: var(--paper);
  border-right: 1px solid var(--hairline-strong);
  text-align: left;
}

.table-scroll-wrap thead .col-query { z-index: 5; }

.query-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--pos-row-height);
}

.query-cell form { display: inline-flex; }

.keyword {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: var(--text-small);
  cursor: help;
}

/* Ручку не видно — значит, о перетаскивании никто не узнает. Поэтому она
   показана всегда: бледно в покое и отчётливо на строке под курсором. */
.drag-handle {
  display: grid;
  place-items: center;
  width: 14px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hairline-strong);
  cursor: grab;
  user-select: none;
}

.drag-handle::before {
  content: "";
  width: 10px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--icon-grip) center / 10px 16px no-repeat;
  mask: var(--icon-grip) center / 10px 16px no-repeat;
}

tr:hover .drag-handle { color: var(--muted); }
.drag-handle:active { cursor: grabbing; }

.indicator {
  width: 7px;
  height: 7px;
  min-width: 7px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--muted-soft);
}

.indicator.status-on { background: var(--positive); }
.indicator.status-off { background: var(--wash); border: 1px solid var(--hairline-strong); }

/* Выключенный колокольчик отличается перечёркнутой формой, а не бледностью:
   на 20-процентной прозрачности его попросту не было видно. */
.bell-indicator {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}

.bell-indicator::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--icon-bell) center / contain no-repeat;
  mask: var(--icon-bell) center / contain no-repeat;
}

.bell-indicator.off { color: var(--hairline-strong); }
.bell-indicator.off::before {
  -webkit-mask-image: var(--icon-bell-off);
  mask-image: var(--icon-bell-off);
}

.bell-indicator:hover { background: none; color: var(--ink); }

/* Шапка колонки: дата, время и доля топ-10. Состояние съёма — точка,
   а не слово: слово занимало строку и кричало на каждой колонке. */
.col-result { width: auto; min-width: var(--pos-col-min); }

.col-result-header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 4px;
  line-height: 1.3;
}

.col-result-header .capture-date {
  display: block;
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: 500;
  white-space: nowrap;
}

.col-result-header .capture-time { display: block; color: var(--muted-soft); font-size: var(--text-micro); white-space: nowrap; }
.col-result-header .capture-meta { color: var(--muted); font-size: var(--text-micro); }

.col-result-header .capture-top10 {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--text-micro);
  font-variant-numeric: tabular-nums;
}

.capture-run-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  vertical-align: 2px;
  background: var(--muted-soft);
}

.capture-run-dot.run-running { background: var(--accent); }
.capture-run-dot.run-partial { background: var(--warn); }
.capture-run-dot.run-empty { background: var(--muted-soft); }
.capture-run-dot.run-error { background: var(--negative); }
.capture-run-dot.run-cancelled { background: var(--warn); }

.delete-capture-btn {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: transparent;
  font-size: 12px;
  line-height: 1;
}

.col-result-header:hover .delete-capture-btn { color: var(--muted-soft); }
.delete-capture-btn:hover { background: var(--negative-wash); color: var(--negative); }

/* Ячейка позиции: одно число и его изменение. */
.pos-cell { position: relative; }

/* Число и его изменение стоят по центру клетки, а дельта чуть выше строки —
   как верхний индекс. Так позиция читается первой, а изменение не спорит
   с ней за внимание. */
.pos-cell-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--pos-row-height);
}

.pos-num {
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.pos-delta {
  position: relative;
  top: -5px;
  font-size: var(--text-micro);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pos-delta.up { color: var(--positive); }
.pos-delta.down { color: var(--negative); }

/* Уголок в клетке — как в Topvisor: совпала целевая страница или нашлась
   другая. Прежняя точка посреди строки читалась как разделитель колонок. */
.pos-corner {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-bottom: 7px solid var(--positive);
  opacity: 0.85;
}

.pos-corner.not-target { border-bottom-color: var(--warn); }

/* Точка слева — у сайта есть и другие страницы в выдаче, они в подсказке. */
.pos-more {
  position: absolute;
  left: 4px;
  bottom: 5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-soft);
  opacity: 0.6;
}

/* Оттенки состояний. Значение tier приходит из api/position_style.py:
   «1»…«10» — место в топ-10, «deep» — дальше десятого, «out» — выпал из
   топа, «beyond» — и раньше не был, «error» — съём не удался, «empty» —
   запрос не снимался. */
td[data-tier="1"],
td[data-tier="2"],
td[data-tier="3"] { background: #e3f3e8; }

td[data-tier="4"],
td[data-tier="5"],
td[data-tier="6"],
td[data-tier="7"],
td[data-tier="8"],
td[data-tier="9"],
td[data-tier="10"] { background: #eef4fb; }

td[data-tier="deep"] { background: var(--paper); }
td[data-tier="out"] { background: #fbe9e8; }
td[data-tier="beyond"] { background: var(--wash-soft); }
td[data-tier="error"] { background: var(--warn-wash); }
td[data-tier="empty"] { background: var(--wash-soft); }

td[data-tier="1"] .pos-num,
td[data-tier="2"] .pos-num,
td[data-tier="3"] .pos-num { color: #0f5c2e; font-weight: 600; }

td[data-tier="4"] .pos-num,
td[data-tier="5"] .pos-num,
td[data-tier="6"] .pos-num,
td[data-tier="7"] .pos-num,
td[data-tier="8"] .pos-num,
td[data-tier="9"] .pos-num,
td[data-tier="10"] .pos-num { color: #1a4f8a; }

td[data-tier="deep"] .pos-num { color: var(--ink-soft); }
td[data-tier="out"] .pos-num { color: var(--negative); }
td[data-tier="beyond"] .pos-num,
td[data-tier="empty"] .pos-num { color: var(--muted-soft); font-weight: 400; }
td[data-tier="error"] .pos-num { color: var(--warn); font-weight: 600; }

tbody tr:hover td { background-image: linear-gradient(rgba(0, 113, 227, 0.07), rgba(0, 113, 227, 0.07)); }

/* Края горизонтальной прокрутки */
.table-scroll-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  display: none;
  align-items: flex-start;
  padding-top: 60px;
  width: 32px;
  pointer-events: none;
}

.table-scroll-edge.is-available { display: flex; }
.table-scroll-edge-left { left: var(--pos-col-query-width); }
.table-scroll-edge-right { right: 0; }

.table-scroll-edge-btn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: var(--text-small);
}

.table-scroll-edge-btn:hover { background: var(--wash); color: var(--ink); }

.floating-h-scroll {
  position: fixed;
  bottom: 0;
  z-index: 6;
  overflow-x: auto;
  overflow-y: hidden;
  height: 12px;
  background: var(--paper);
}

.floating-h-scroll.hidden { display: none; }
.floating-h-scroll-inner { height: 1px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  font-size: var(--text-small);
}

.pagination a, .pagination span { padding: 6px 14px; border-radius: var(--radius-pill); color: var(--muted); text-decoration: none; }
.pagination a:hover { background: var(--wash); color: var(--ink); text-decoration: none; }
.pagination .current { background: var(--wash); color: var(--ink); }
.pagination .disabled { color: var(--muted-soft); pointer-events: none; }

/* --------------------------------------------------------------------------
   Настройки
   -------------------------------------------------------------------------- */

/* Полоса контекста: что сейчас открыто. Это не поле формы, поэтому и
   выглядит иначе — одной строкой, без рамки поля и без подписи сверху.
   Раньше эта информация стояла посреди формы и ломала её ритм. */
.info-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  padding: 12px 18px;
  border-radius: var(--radius-card);
  background: var(--wash-soft);
}

.info-strip-label { color: var(--muted); font-size: var(--text-small); }
.info-strip-value { color: var(--ink); font-size: var(--text-small); font-weight: 500; }
.info-strip-link { margin-left: auto; color: var(--link); font-size: var(--text-small); }

.profile-lead, .card-lead { max-width: 72ch; margin: 0 0 16px; color: var(--muted); font-size: var(--text-small); }
.card-lead + .card-lead { margin-top: -8px; }
.card-lead:last-of-type { margin-bottom: 20px; }

.profile-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }

/* Номер стоит в строке с заголовком, а не висит в углу: раньше текст
   начинался с отступом 48 px, а кружок — с 16 px, и левый край карточки
   получался рваным. */
.profile-guide-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  background: var(--wash-soft);
}

.profile-guide-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-small);
  font-weight: 500;
}

.profile-guide-number {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: var(--text-micro);
  font-weight: 500;
}

.profile-guide-card span { color: var(--muted); font-size: var(--text-caption); line-height: 1.45; }

.profile-list { display: grid; gap: 10px; margin-bottom: 20px; }

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: var(--radius-card);
  background: var(--wash-soft);
}

.profile-card.is-current { background: var(--accent-wash); }
.profile-card-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }

.profile-engine-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: 500;
}

.profile-engine-mark.yandex { color: var(--negative); }
.profile-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--ink); font-size: var(--text-body); font-weight: 500; }

.profile-badge, .profile-state {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-micro);
  white-space: nowrap;
}

.profile-badge { background: var(--paper); color: var(--muted); }
.profile-state.enabled { background: var(--positive-wash); color: #0f5c2e; }
.profile-state.paused { background: var(--wash); color: var(--muted); }
.profile-description { margin-top: 3px; color: var(--muted); font-size: var(--text-caption); }
.profile-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-open-link { color: var(--link); font-size: var(--text-small); }
.profile-card-actions .btn-secondary { min-height: var(--control-h-sm); padding: 0 14px; font-size: var(--text-small); }

.profile-panel-body { padding: 4px 20px 20px; }
.profile-panel-note { margin: 12px 0 16px; color: var(--muted); font-size: var(--text-caption); }
/* Никакого выравнивания по нижнему краю: из-за него подписи в одной строке
   стояли на разной высоте, когда у соседнего поля была подсказка снизу. */
.profile-form { margin-top: 12px; }
.profile-advanced { grid-column: 1 / -1; width: 100%; }
.profile-advanced summary { color: var(--link); font-size: var(--text-caption); cursor: pointer; }
.profile-advanced-fields { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 12px; }
.profile-advanced-fields > div { flex: 1 1 180px; min-width: 180px; }

.profile-schedule-choice {
  flex: 1 1 240px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  background: var(--warn-wash);
  color: #8a3400;
  font-size: var(--text-caption);
}

.profile-schedule-choice label { color: #8a3400; font-weight: 500; }
/* Раскрывающийся блок — один вид на все такие места. */
.profile-panel, .profile-faq {
  margin-top: 10px;
  border-radius: var(--radius-card);
  background: var(--wash-soft);
  overflow: hidden;
}

.profile-panel > summary, .profile-faq > summary {
  padding: 14px 20px;
  color: var(--ink);
  font-size: var(--text-small);
  font-weight: 500;
  cursor: pointer;
  list-style-position: inside;
}

.profile-panel > summary::marker, .profile-faq > summary::marker { color: var(--muted); }
.profile-faq p { max-width: 76ch; margin: 0 0 14px; padding: 0 20px; color: var(--muted); font-size: var(--text-caption); }
.profile-faq[open] > summary { padding-bottom: 8px; }

.help-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  min-height: 0;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: help;
}

/* Общее правило кнопки закрашивало знак вопроса синим: `button:hover`
   перебивает `.help-tip` по весу селектора, и под курсором вместо знака
   оставалась синяя точка. */
.help-tip:hover, .help-tip:focus {
  background: var(--paper);
  border-color: var(--muted-soft);
  color: var(--ink);
}

/* Подсказка живёт отдельным слоем в <body>, а не псевдоэлементом внутри
   карточки. Карточка обрезает всё, что вылезает за её край (`overflow`), и
   подсказка приходила обрубленной — текст начинался с середины фразы. Слой с
   `position: fixed` не зависит ни от одного контейнера, а скрипт удерживает
   его в границах окна. */
.tooltip-layer {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: var(--radius-field);
  background: var(--ink);
  color: #fff;
  font-size: var(--text-caption);
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tooltip-layer[data-open] { opacity: 1; transform: none; }

/* Значки строки запроса. Маска берёт форму из фигуры, а цвет — из `color`,
   поэтому значок подчиняется теме и состоянию так же, как текст. */
:root {
  --icon-grip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Ccircle cx='3' cy='4' r='1.3'/%3E%3Ccircle cx='7' cy='4' r='1.3'/%3E%3Ccircle cx='3' cy='8' r='1.3'/%3E%3Ccircle cx='7' cy='8' r='1.3'/%3E%3Ccircle cx='3' cy='12' r='1.3'/%3E%3Ccircle cx='7' cy='12' r='1.3'/%3E%3C/svg%3E");
  --icon-bell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8.5a6 6 0 1 0-12 0c0 6-2.4 7.5-2.4 7.5h16.8S18 14.5 18 8.5'/%3E%3Cpath d='M13.7 19.4a2 2 0 0 1-3.4 0'/%3E%3C/svg%3E");
  --icon-bell-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8.5a6 6 0 1 0-12 0c0 6-2.4 7.5-2.4 7.5h16.8S18 14.5 18 8.5'/%3E%3Cpath d='M13.7 19.4a2 2 0 0 1-3.4 0'/%3E%3Cpath d='M3.6 3.6 20.4 20.4'/%3E%3C/svg%3E");
}

.icon { flex: 0 0 auto; width: 16px; height: 16px; display: block; }
.btn .icon, button .icon { width: 15px; height: 15px; }

.group-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.group-tag { padding: 3px 10px; border-radius: var(--radius-pill); background: var(--wash); color: var(--muted); font-size: var(--text-micro); }

.groups-list { list-style: none; margin: 0; padding: 0; }

/* Группа — две строки: сверху имя и её судьба, снизу целевая страница.
   Пять элементов в одну линию не помещались и превращались в обрубки. */
.groups-list li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}

.groups-list li:last-child { border-bottom: none; }
.group-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-head .field-inline { flex: 1 1 260px; }
.group-target-form label { margin: 0; white-space: nowrap; }
.group-meta { flex: 0 0 auto; color: var(--muted); font-size: var(--text-caption); white-space: nowrap; }

/* Поле с прилегающей кнопкой — один приём на все такие места. */
.field-inline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-inline input[type="text"],
.field-inline input[type="url"],
.field-inline select { flex: 1; min-width: 0; }
.field-inline button { flex: 0 0 auto; }

.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  background: var(--wash-soft);
}

.selection-toolbar .selection-count { color: var(--muted); font-size: var(--text-small); }

.settings-queries-wrap { max-height: 480px; overflow: auto; border-radius: var(--radius-card); background: var(--wash-soft); }
.settings-queries-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; }

.settings-queries-wrap th,
.settings-queries-wrap td {
  padding: 10px 16px;
  border-right: 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: middle;
}

.settings-queries-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--wash-soft);
  border-bottom: 1px solid var(--hairline-strong);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 400;
}

.settings-queries-wrap tbody tr:last-child td { border-bottom: 0; }
.settings-queries-wrap tbody tr.is-selected td { background: var(--accent-wash); }
.settings-queries-wrap .keyword { white-space: normal; cursor: default; font-size: var(--text-small); }
.settings-queries-wrap .col-query { width: 32%; }
.settings-queries-wrap td:nth-child(2) { width: 16%; }
.settings-queries-wrap td:last-child { width: 1%; white-space: nowrap; }

.url-list { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: var(--text-caption); }
.url-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.url-row a { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-row form { display: inline-flex; }

.url-remove {
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1;
}

.url-remove:hover { background: var(--negative-wash); border-color: transparent; color: var(--negative); }

.js-add-target-url { display: flex; gap: 8px; width: 100%; }
.js-add-target-url input { flex: 1; min-width: 0; }
.js-add-target-url button { flex: 0 0 auto; }

.marquee-rect { position: fixed; z-index: 30; border: 1px solid var(--accent); background: rgba(0, 113, 227, 0.08); pointer-events: none; }
.project-link { margin-right: 6px; color: var(--ink-soft); }
.project-link.active { color: var(--accent); font-weight: 500; }

/* Опасное действие стоит отдельно: мимоходом не нажать, но и прятать
   нельзя — проект должно быть можно удалить. */
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 18px 22px;
  border-radius: var(--radius-card);
  background: var(--negative-wash);
}

.danger-zone strong { font-size: var(--text-body); font-weight: 500; }
.danger-zone .field-hint { max-width: 62ch; margin-top: 4px; color: #96271f; }

/* --------------------------------------------------------------------------
   Формы: общие классы вместо встроенных стилей
   -------------------------------------------------------------------------- */

/* Классы ширины оставлены как синонимы: ширину теперь задаёт ячейка строки,
   а не сам элемент. Так одинаковые по смыслу поля не могут разъехаться. */
.field-col { min-width: 0; }
.field-wide, .field-medium, .field-narrow { width: 100%; max-width: 100%; }
.field-bottom { align-self: flex-end; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: var(--text-caption); line-height: 1.4; }
.field-hint-block { display: block; }
.form-actions { margin-top: 24px; }
.form-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-ok { margin: 0 0 12px; color: var(--positive); font-size: var(--text-small); }
.form-bad { margin: 0 0 12px; color: var(--negative); font-size: var(--text-small); }
.state-ok { color: var(--positive); font-size: var(--text-micro); }
.state-bad { color: var(--negative); font-size: var(--text-micro); }
.muted-inline { color: var(--muted); font-weight: 400; }

.checkbox-line { display: flex; align-items: center; gap: 12px; cursor: pointer; margin: 0; color: var(--ink); font-size: var(--text-body); }
.checkbox-line-top { align-items: flex-start; }
/* Во флекс-строке чекбокс сжимался под длинным текстом и становился
   меньше соседних. Запрещаем ему меняться в размере. */
.checkbox-line input { flex: 0 0 17px; margin-top: 1px; }
.checkbox-title { display: block; color: var(--ink); font-weight: 500; }

.inline-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: var(--text-small); white-space: nowrap; }

/* Сегментированный переключатель — одна форма на все подобные места. */
.mode-switch {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 20px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--wash-soft);
}

.btn-add-mode {
  min-height: var(--control-h-sm);
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--muted);
  font-size: var(--text-small);
}

.btn-add-mode:hover { background: var(--wash); color: var(--ink); }
.btn-add-mode.active-mode { background: var(--paper); color: var(--ink); font-weight: 500; }

/* --------------------------------------------------------------------------
   Узкие экраны
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  :root { --pos-col-query-width: 250px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-guide { grid-template-columns: 1fr; }
  .card { padding: 20px 22px; }
}

@media (max-width: 900px) {
  :root { --pos-col-query-width: 200px; --control-h: 34px; }
  .app-sidebar { width: 52px; flex-basis: 52px; }
  .app-main { padding: 12px 12px 32px; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .results-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .settings-queries-wrap .col-query { width: auto; }
  .card { padding: 18px; border-radius: var(--radius-card); }
}

/* Подзаголовок внутри карточки: карточка одна, но разделов в ней может быть
   несколько — как в оповещениях, где настройка проекта и общие каналы
   про одно и то же, но принадлежат разным людям. */
/* Метка состояния рядом с подзаголовком: «ключ задан» / «не заполнено».
   Не кнопка и не ссылка - только подпись, поэтому без рамки и без нажатия. */
.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 500;
  vertical-align: middle;
}

.pill-ok { background: var(--positive-wash); color: var(--positive); }
.pill-warn { background: var(--warn-wash); color: var(--warn); }
.pill-muted { background: var(--wash); color: var(--muted); }

/* Несколько равнозначных действий в строку. Отдельно от .form-actions: там
   одно главное действие формы, здесь - выбор из нескольких. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.section-subhead {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-subhead-divided {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

/* Блок про съём по расписанию занимает всю ширину строки: это не поле,
   а решение, и рядом с ним ничего стоять не должно. */
.profile-schedule-choice { grid-column: 1 / -1; }
.row-full, .form-actions.row-full { grid-column: 1 / -1; }
