:root {
  --bg: #ffffff;
  --card: #ffffff;
  --border: #d7dde7;
  --border-strong: #c2cad7;
  --text: #16305f;
  --muted: #6d7c96;
  --link: #1a73e8;        /* стандартный синий ссылок */
  --link-hover: #1557b0;
  --accent: #2a4d8f;
  --accent-strong: #213c70;
  --accent-soft: #eaedf4;
  --accent-ring: rgba(42, 77, 143, .2);
  --mark: #fde68a;
  --mark-text: #4b3a00;
  --font-sans: 'Golos Text', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-pill: 999px;
  --radius-card: 26px;
  --radius-soft: 20px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 18px 40px -24px rgba(15, 23, 42, .34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

/* ─── Шапка ──────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1010px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -.01em;
}

.brand__logo {
  display: block;
  height: 30px;
  width: auto;
}

.brand__name { font-size: 16px; }

.auth {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.auth__user {
  display: inline-grid;
  justify-items: center;
  gap: 3px;
  color: var(--muted);
}

.auth__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
}

.auth__avatar--empty { display: block; }

.auth__name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

/* ─── Кнопки ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-strong); }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn--ghost:hover { background: #f3f6fa; color: var(--text); }

.btn--icon { padding: 0; width: 36px; height: 36px; border-radius: 50%; }

.linklike {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
}
.linklike:hover { text-decoration: underline; }

/* ─── Страница ───────────────────────────────────────────────────────────── */

.page {
  max-width: 1010px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 700;
}

.hero__sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 16px;
  max-width: 560px;
}

.panel {
  /* Подложки нет: поиск и источники лежат прямо на фоне страницы. */
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* ─── Строка поиска ──────────────────────────────────────────────────────── */

.query { display: flex; gap: 10px; }

.query__field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.query__field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.query__icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }

.query__field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: none;
  padding: 10px 18px 10px 40px;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.query__field input::placeholder { color: #93a1b8; }
.query__field input::-webkit-search-cancel-button { display: none; }

.query__submit { padding: 0 26px; border-radius: 999px; font-size: 15px; }

/* ─── Источники ──────────────────────────────────────────────────────────── */

.sources { margin-top: 18px; }

.sources__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.label--muted { font-weight: 500; color: var(--muted); }

.sources__box {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

/* Источники — таблица: номер | название | @username | удалить */
.chips { display: grid; }

.source-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto 20px;
  align-items: baseline;
  column-gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.source-row__num {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.source-row__title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-row__meta { color: var(--muted); font-size: 13px; }

.source-row__remove {
  align-self: center;
  border: 0;
  background: none;
  color: #9aa5b4;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.source-row__remove:hover { color: var(--text); }




.sources__add {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  transition: border-color .15s ease;
}
.sources__add:focus-within { border-bottom-color: var(--accent); }

.sources__add input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  padding: 4px 4px 4px 6px;
  font-size: 14px;
  color: var(--text);
}
.sources__add input::placeholder { color: #93a1b8; }

/* «Плюс» — просто иконка без кружка и рамки. */
.sources__add .btn--icon {
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  color: var(--muted);
}
.sources__add .btn--icon:hover { background: none; color: var(--accent); }
.sources__add .btn--icon:disabled { color: #b9c3d3; }

.sources__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.sources__hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.list-actions { display: flex; gap: 8px; margin-left: auto; }

.btn--small { padding: 3px 9px; font-size: 11px; font-weight: 500; line-height: 1.35; }

/* выпадающий список подсказок */
.suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 280px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-soft);
  background: #fff;
  box-shadow: 0 16px 36px -16px rgba(16, 24, 40, .35);
  max-height: 288px;
  overflow: auto;
}

.suggest__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  text-align: left;
  cursor: pointer;
}
.suggest__item:hover, .suggest__item.is-active { background: #f1f3f9; }
.suggest__item[disabled] { opacity: .45; cursor: default; }
.suggest__item img.suggest__avatar { object-fit: cover; }

.suggest__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.suggest__text { display: grid; line-height: 1.3; min-width: 0; }
.suggest__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest__meta { font-size: 12px; color: var(--muted); }
.suggest__empty { padding: 10px; font-size: 13px; color: var(--muted); }

/* ─── Режимы ─────────────────────────────────────────────────────────────── */

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.filter input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ─── Результаты ─────────────────────────────────────────────────────────── */

.results { margin-top: 28px; }

.results__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.results__count { font-weight: 650; color: var(--text); }

.results__note {
  margin: -6px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.result {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
}
.result:last-child { border-bottom: 0; }

.result__num {
  padding-top: 1px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.result__body { display: grid; gap: 6px; min-width: 0; }

.result__head { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }

.result__avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: none;
  line-height: 1;
  object-fit: cover;
  background: var(--accent-soft);
}

.result__source { font-weight: 650; color: #000; }
.result__handle { color: var(--muted); }
.result__date { margin-left: auto; white-space: nowrap; }

.result__text {
  margin: 0;
  font-size: 12px;   /* на 20% меньше основного текста (15px) */
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;   /* переводы строк одного уровня, без пустых строк */
  word-break: break-word;
}

/* Сниппет — одна «плоская» строка: переносы только по ширине карточки. */
.result__text[data-short] { white-space: normal; }

.result__more {
  align-self: start;
  border: 0;
  background: none;
  padding: 0;
  margin-top: -2px;
  color: var(--link);   /* обычный «ссылочный» синий */
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;   /* подчёркнуто всегда, не только при наведении */
  text-underline-offset: 2px;
}
.result__more:hover { color: var(--link-hover); }

.result__text mark { background: var(--mark); color: var(--mark-text); border-radius: 4px; padding: 0 2px; }

.result__foot { display: flex; align-items: center; gap: 12px; font-size: 12px; }

.pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-strong);
  font-weight: 600;
}

.result__link {
  margin-left: auto;
  color: var(--link);   /* обычный «ссылочный» синий */
  text-decoration: underline;   /* подчёркнуто всегда */
  text-underline-offset: 2px;
  font-weight: 600;
}
.result__link:hover { color: var(--link-hover); }

/* пустое состояние / скелет */
.empty {
  padding: 40px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  text-align: center;
  color: var(--muted);
}
.empty__icon { font-size: 26px; }
.empty__title { margin: 8px 0 4px; font-weight: 650; color: var(--text); font-size: 15px; }
.empty__text { margin: 0; font-size: 14px; }

.skeleton {
  height: 92px;
  margin-bottom: 10px;
  border-radius: var(--radius-soft);
  background: linear-gradient(90deg, #eef1f6 25%, #e4e9f1 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ─── Тост ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ─── Мобильные ──────────────────────────────────────────────────────────── */

@media (max-width: 620px) {
  .page { padding: 28px 16px 64px; }
  .topbar { padding: 14px 16px 0; }
  .query { flex-direction: column; }
  .query__submit { width: 100%; padding: 14px; }
  .result__date { font-size: 12px; }
}
