/* Экран «Настройки» — уведомления в Telegram (views/settings.js). Всё под .cqa-app. */

.cqa-app .st-page { max-width: 920px; }
.cqa-app .st-caption { margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.cqa-app .st-title { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.cqa-app .st-spacer { flex: 1; }
.cqa-app .st-card { padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.cqa-app .st-card code,
.cqa-app .st-code { font-family: var(--mono); font-size: 12.5px; }
.cqa-app .st-card code {
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text);
}

/* ---------- шапка карточки ---------- */
.cqa-app .st-card__head { display: flex; align-items: flex-start; gap: 14px; }
.cqa-app .st-card__icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--brand-50); color: var(--brand-700);
}
.cqa-app .st-card__titles { flex: 1; min-width: 0; }
.cqa-app .st-card__title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.cqa-app .st-card__sub { margin: 4px 0 0; max-width: 560px; font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }

.cqa-app .st-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border-control); background: var(--surface-2);
  font-size: 12.5px; font-weight: 500; color: var(--text-status); white-space: nowrap;
}
.cqa-app .st-pill .cqa-icon { color: var(--text-muted); }
.cqa-app .st-pill--on { border-color: var(--brand-border); background: var(--brand-50); color: var(--brand-700); }
.cqa-app .st-pill--on .cqa-icon { color: var(--brand-500); }

/* ---------- скелетон / ошибка ---------- */
.cqa-app .st-skel { display: flex; flex-direction: column; gap: 10px; }
.cqa-app .st-skel span {
  display: block; height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-muted), var(--surface-2), var(--surface-muted));
  background-size: 200% 100%; animation: st-shimmer 1.2s ease infinite;
}
.cqa-app .st-skel span:first-child { width: 60%; }
.cqa-app .st-skel span:last-child { width: 40%; }
@keyframes st-shimmer { to { background-position: -200% 0; } }

.cqa-app .st-error {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--chip-bad-border); border-radius: var(--radius); background: var(--bad-bg);
  color: var(--chip-bad-text); font-size: 13.5px;
}
.cqa-app .st-error span { flex: 1; }

/* ---------- не настроен: инструкция ---------- */
.cqa-app .st-setup {
  padding: 20px; border: 1px dashed var(--border-control); border-radius: var(--radius);
  background: var(--surface-2);
}
.cqa-app .st-setup__lead { margin: 0 0 14px; font-size: 14px; color: var(--text); font-weight: 500; }
.cqa-app .st-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cqa-app .st-steps li { display: flex; gap: 12px; font-size: 13.5px; line-height: 1.55; color: var(--text-body); }
.cqa-app .st-steps li > div { min-width: 0; }
.cqa-app .st-steps b { color: var(--text); font-weight: 600; }
.cqa-app .st-steps__n {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-control);
  font-size: 12px; font-weight: 600; color: var(--text);
}
.cqa-app .st-code {
  margin: 8px 0 0; padding: 10px 12px; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); line-height: 1.6; white-space: pre;
}
.cqa-app .st-actions { margin-top: 18px; display: flex; gap: 8px; }

/* ---------- заметки ---------- */
.cqa-app .st-note {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius); background: var(--info-bg); color: var(--text-body);
  font-size: 13px; line-height: 1.5;
}
.cqa-app .st-note .cqa-icon { flex-shrink: 0; margin-top: 2px; color: var(--info); }
.cqa-app .st-note--warn { background: var(--warn-bg); }
.cqa-app .st-note--warn .cqa-icon { color: var(--warn); }

/* ---------- подключение ---------- */
.cqa-app .st-connect__idle {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.cqa-app .st-connect__qr-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.cqa-app .st-connect__text { flex: 1; min-width: 0; }
.cqa-app .st-connect__title { font-size: 14px; font-weight: 600; color: var(--text); }
.cqa-app .st-connect__hint { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }

.cqa-app .st-qr {
  display: flex; gap: 24px; align-items: center; padding: 20px;
  border: 1px solid var(--brand-border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brand-50), var(--surface) 70%);
}
.cqa-app .st-qr__img {
  position: relative; flex-shrink: 0; width: 196px; height: 196px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow-sm);
}
.cqa-app .st-qr__img svg { display: block; width: 100%; height: 100%; }
.cqa-app .st-qr.is-expired .st-qr__img svg { opacity: .12; }
.cqa-app .st-qr__veil {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
}
.cqa-app .st-qr__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.cqa-app .st-qr__title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.cqa-app .st-qr__steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--text-body); }
.cqa-app .st-qr__steps b { color: var(--text); font-weight: 600; }
.cqa-app .st-qr__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cqa-app .st-qr__actions a { text-decoration: none; }
.cqa-app .st-qr__status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.cqa-app .st-qr__status .cqa-icon { flex-shrink: 0; color: var(--info); }
.cqa-app .st-qr__status b { color: var(--text); font-weight: 600; }

.cqa-app .st-done {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border: 1px solid var(--brand-border); border-radius: var(--radius); background: var(--brand-50);
}
.cqa-app .st-done__icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%; background: var(--brand-500); color: #fff;
}
.cqa-app .st-done__title { font-size: 16px; font-weight: 600; color: var(--brand-700); }
.cqa-app .st-done__sub { margin-top: 2px; font-size: 13px; color: var(--text-body); }

/* ---------- получатели ---------- */
.cqa-app .st-subs { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; border-top: 1px solid var(--border-inner); }
.cqa-app .st-subs__head { display: flex; align-items: center; gap: 10px; padding-top: 16px; }
.cqa-app .st-subs__title { font-size: 15px; font-weight: 600; }
.cqa-app .st-subs__count { font-size: 13px; color: var(--text-muted); }
.cqa-app .st-empty { margin: 0; padding: 16px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; color: var(--text-secondary); }

.cqa-app .st-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cqa-app .st-sub {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 12px; transition: border-color 150ms ease;
}
.cqa-app .st-sub:hover { border-color: var(--border-control); }
.cqa-app .st-sub__main { display: flex; align-items: center; gap: 12px; }
.cqa-app .st-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--info-bg); color: var(--info); font-size: 13px; font-weight: 600;
}
.cqa-app .st-sub__who { flex: 1; min-width: 0; }
.cqa-app .st-sub__name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cqa-app .st-sub__meta { margin-top: 1px; font-size: 12.5px; color: var(--text-secondary); }
.cqa-app .st-sub__off:hover:not(:disabled) { color: var(--gross-text); border-color: var(--chip-bad-border); background: var(--bad-bg); }

.cqa-app .st-events { display: flex; flex-wrap: wrap; gap: 10px 24px; padding-left: 48px; }
.cqa-app .st-event { display: flex; white-space: nowrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-body); cursor: pointer; }
.cqa-app .st-switch {
  position: relative; flex-shrink: 0; width: 34px; height: 20px; padding: 0; border: 0;
  border-radius: 10px; background: #D5D9DF; cursor: pointer; transition: background-color 150ms ease;
}
.cqa-app .st-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.2); transition: transform 150ms ease;
}
.cqa-app .st-switch[aria-checked="true"] { background: var(--brand-500); }
.cqa-app .st-switch[aria-checked="true"]::after { transform: translateX(14px); }
.cqa-app .st-switch:disabled { cursor: progress; }

@media (max-width: 900px) {
  .cqa-app .st-events { padding-left: 0; }
}
@media (max-width: 640px) {
  .cqa-app .st-card { padding: 16px; }
  .cqa-app .st-card__head { flex-wrap: wrap; }
  .cqa-app .st-card__titles { flex-basis: calc(100% - 54px); }
  .cqa-app .st-pill { white-space: normal; height: auto; min-height: 28px; margin-left: 54px; }
  .cqa-app .st-qr__actions .cqa-btn { white-space: normal; }
  .cqa-app .st-connect__idle { flex-wrap: wrap; }
  .cqa-app .st-qr { flex-direction: column; align-items: stretch; }
  .cqa-app .st-qr__img { align-self: center; }
  .cqa-app .st-subs__head { flex-wrap: wrap; }
  .cqa-app .st-events { flex-direction: column; }
}

/* ---------- экран «Интеграции»: прочие карточки ---------- */
.cqa-app .cqa-nav-item[hidden] { display: none; }

.cqa-app .st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.cqa-app .st-card--sm { gap: 14px; }
.cqa-app .st-card__title--sm { font-size: 15px; }
.cqa-app .st-card__icon--muted { width: 36px; height: 36px; background: var(--surface-muted); color: var(--text-body); }
/* Логотип Telegram (assets/telegram.svg, локально — без CDN) */
.cqa-app .st-card__icon--tg { background: transparent; }
.cqa-app .st-tg-logo { display: block; width: 32px; height: 32px; flex-shrink: 0; }
.cqa-app .st-tg-logo--btn { width: 18px; height: 18px; }
.cqa-app .st-card__icon--info { background: var(--info-bg); color: var(--info); }
.cqa-app .st-gate { flex-direction: row; align-items: flex-start; gap: 14px; }

.cqa-app .st-text { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-body); }
.cqa-app .st-text--muted { color: var(--text-secondary); }
.cqa-app .st-link-btn { align-self: flex-start; text-decoration: none; }

.cqa-app .st-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cqa-app .st-table th {
  padding: 6px 8px; text-align: left; font-size: 12px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-inner);
}
.cqa-app .st-table td { padding: 8px; border-bottom: 1px solid var(--border-row); color: var(--text-body); }
.cqa-app .st-table td:first-child, .cqa-app .st-table th:first-child { padding-left: 0; }
.cqa-app .st-table tr:last-child td { border-bottom: 0; }
.cqa-app .st-table .st-r { text-align: right; }
.cqa-app .st-table td.num { color: var(--text); font-weight: 600; }

.cqa-app .st-prov { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cqa-app .st-prov__item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.cqa-app .st-prov__main { flex: 1; min-width: 0; }
.cqa-app .st-prov__name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.cqa-app .st-prov__meta { margin-top: 2px; font-size: 12.5px; color: var(--text-secondary); }
.cqa-app .st-prov__reason { margin-top: 4px; font-size: 12.5px; color: var(--text-body); }
.cqa-app .st-prov__state { flex-shrink: 0; font-size: 12.5px; color: var(--text-status); }
.cqa-app .st-dot { flex-shrink: 0; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--st-not-evaluated); }
.cqa-app .st-dot--on { background: var(--good); }
.cqa-app .st-tag {
  padding: 1px 6px; border-radius: var(--radius-xs); background: var(--surface-muted);
  font-size: 11px; font-weight: 500; color: var(--text-secondary);
}

.cqa-app .st-event { align-items: flex-start; }
.cqa-app .st-event .st-switch { margin-top: 0; }
.cqa-app .st-event__text { display: flex; flex-direction: column; line-height: 20px; }
.cqa-app .st-event__hint { font-size: 11.5px; line-height: 1.3; color: var(--text-muted); }

@media (max-width: 900px) {
  .cqa-app .st-grid { grid-template-columns: 1fr; }
}

/* ---------- Мобильная версия (≤ 640px): карточки в колонку, QR по центру, меньше текста ---------- */
@media (max-width: 640px) {
  .cqa-app .st-caption { display: none; }
  .cqa-app .st-title { font-size: 24px; }
  .cqa-app .st-grid { gap: 16px; }
  .cqa-app .st-card__sub { display: none; }
  .cqa-app .st-card--sm .st-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .cqa-app .st-note { font-size: 13px; }

  /* «Подключите свой Telegram»: иконка + заголовок, ниже кнопка на всю ширину */
  .cqa-app .st-connect__idle { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 12px; }
  .cqa-app .st-connect__idle > .cqa-btn,
  .cqa-app .st-connect__idle > :last-child:not(.st-connect__text):not(.st-connect__qr-icon) { grid-column: 1 / -1; width: 100%; height: 48px; }
  .cqa-app .st-connect__hint { display: none; }

  /* QR — по центру, крупно; действия — во всю ширину */
  .cqa-app .st-qr { padding: 16px; gap: 16px; align-items: center; text-align: center; }
  .cqa-app .st-qr__img { width: min(240px, 100%); height: auto; aspect-ratio: 1; }
  .cqa-app .st-qr__body { align-items: stretch; width: 100%; }
  .cqa-app .st-qr__steps { text-align: left; }
  .cqa-app .st-qr__status { justify-content: center; }
  .cqa-app .st-qr__actions { flex-direction: column; }
  .cqa-app .st-qr__actions .cqa-btn { width: 100%; height: 44px; }

  .cqa-app .st-subs__head .cqa-btn, .cqa-app .st-actions .cqa-btn, .cqa-app .st-link-btn { min-height: 44px; }
  .cqa-app .st-sub__off { min-height: 40px; }
  .cqa-app .st-event { min-height: 44px; align-items: center; white-space: normal; }
  .cqa-app .st-prov__item { flex-wrap: wrap; }
  .cqa-app .st-prov__name { flex-wrap: wrap; }
}
