/* Темы (TRACKER-369): метка темы, выбор темы, список тем и страница темы (topics.js). Только токены style.css — тёмная тема сама */

/* метка темы: бренд-синим, как ссылка; длинное название сокращается */
.chip.tp-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 220px; min-width: 0; vertical-align: middle; background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.chip.tp-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.tp-chip > .i-svg { flex: none; }
.chip.tp-chip:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--primary); }
.chip.tp-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
td.tt > .chip.tp-chip, .bl-row .chip.tp-chip, .modal-h .chip.tp-chip { margin-left: var(--sp-1); flex: none; }
.ic-labels > .chip.tp-chip { flex: none; }   /* тема важнее меток: сжимаются метки */

/* окно «Добавить в тему» */
.tp-modal { display: flex; flex-direction: column; gap: var(--sp-3); }
.tp-lead { margin: 0; }
.tp-h3 { margin: 0; font-size: var(--fs-m); }
.tp-cur { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-m); background: var(--panel2); }
.tp-pick { display: flex; flex-direction: column; gap: var(--sp-1); max-height: 300px; overflow-y: auto; }
.tp-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-m);
  background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tp-opt:hover, .tp-opt:focus-visible { background: var(--hover); }
.tp-opt-t { font-weight: 500; overflow-wrap: anywhere; }
.tp-new { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.tp-new-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.tp-new-row > input { flex: 1 1 220px; min-width: 0; }

/* список тем: число открытых обращений крупно слева — «топ тем» читается сверху вниз */
.tp-list { display: flex; flex-direction: column; gap: 2px; }
.tp-line { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-m); color: var(--text); }
.tp-line:hover, .tp-line:focus-visible { background: var(--hover); text-decoration: none; }
.tp-line > .i-svg { flex: none; color: var(--muted); }
.tp-n { flex: none; min-width: 36px; padding: 2px var(--sp-2); border-radius: var(--r-s); background: var(--primary-soft); color: var(--primary); font-size: var(--fs-l); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.tp-n.zero { background: var(--panel2); color: var(--muted); }
.tp-line-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tp-line-t { font-weight: 500; overflow-wrap: anywhere; }

/* страница темы */
.tp-hero { align-items: flex-start; }
.tp-hero h1 { overflow-wrap: anywhere; }
.tp-page > .card { margin-bottom: var(--sp-4); }
.tp-texts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); }
.tp-text .h-sec { margin: 0 0 var(--sp-1); font-size: var(--fs-m); }
.tp-text p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tp-all { padding: var(--sp-3) var(--sp-4); }
.tp-all .h-sec, .tp-issues .h-sec { margin: 0 0 var(--sp-2); font-size: var(--fs-m); }
.tp-say { display: flex; gap: var(--sp-2); align-items: flex-end; }
.tp-say > textarea { flex: 1; min-width: 0; }
.tp-all > p { margin: var(--sp-1) 0 var(--sp-3); }
.tp-move { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.tp-issues .h-sec { padding: 0 var(--sp-2); }
.tp-row { display: flex; align-items: center; gap: var(--sp-1); }
.tp-row > .trow { flex: 1; min-width: 0; }
.tp-x { flex: none; }
.tp-add { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-2) var(--sp-1); }
.tp-add > input { flex: 0 1 260px; min-width: 0; }
.tp-boards { margin: var(--sp-2) var(--sp-2) 0; color: var(--muted); }
.tp-fail { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--sp-2); }

@media (max-width: 700px) {
  .tp-texts { grid-template-columns: minmax(0, 1fr); }
  .tp-hero > .grow { flex: 1 1 100%; }   /* «Изменить» и «⋯» — под заголовком, а не теснят его */
  .tp-say { flex-direction: column; align-items: stretch; }
  .tp-add > input { flex: 1 1 100%; }
  .chip.tp-chip { max-width: 160px; }
  .modal-h .chip.tp-chip { max-width: 96px; }   /* шапка окна задачи: ключ не переносится из-за темы */
}
.tp-report > p { margin: 0 0 var(--sp-2); }
