/* «Контакты»: таблица людей. Таблица и .who общие с «Аналитикой». Строки без линий: разделяет высота и тон при наведении. */
.cts { padding-bottom: 28px; }
.cts__n { color: var(--ink2); font-weight: 400; }
.cts__grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1280px) { .cts__grid { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 1279px) { .cts__grid > .card { display: none; } }
.tbl { min-width: 0; padding: 12px 8px 8px; border-radius: var(--r-row); background: var(--panel); border: 1px solid var(--line); }
.tbl__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 4px 8px; }
.tbl__bar .find { flex: 1 1 260px; margin: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0 2px; font-size: 14px; }
th { padding: 6px 8px; color: var(--ink2); font-size: 13px; font-weight: 400; text-align: left; white-space: nowrap; }
td { padding: 6px 8px; vertical-align: middle; }
tr td:first-child { border-radius: var(--r-row) 0 0 var(--r-row); } tr td:last-child { border-radius: 0 var(--r-row) var(--r-row) 0; }
tbody tr { transition: background-color var(--t-fast) var(--ease); }
tbody tr:hover { background: var(--ctl); }
.c-last { color: var(--ink2); white-space: nowrap; text-align: right; }
th.c-last { text-align: right; }
.who { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; }
.who span { display: grid; min-width: 0; }
.who b { font-weight: 500; font-size: 15px; }
td:has(> .who) { min-width: 210px; }
.who small { color: var(--ink2); font-size: 13px; }
.c-text, .c-rules { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.c-flag { white-space: nowrap; }
.c-no { color: var(--ink2); }
.c-n { white-space: nowrap; }
.who small { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr[data-href] { cursor: pointer; }
.tbl .empty { text-align: center; }
@media (min-width: 1200px) and (max-width: 1279px) { .who small { display: none; } }
@media (max-width: 1199px), (min-width: 1280px) { .c-text { display: none; } }
@media (max-width: 899px) { .c-rules, .c-flag { display: none; } }
@media (max-width: 599px) {
  .tbl { padding: 0; border: 0; background: transparent; }
  .tbl__bar { padding: 8px 0; }
  thead, .c-n { display: none; }
  tbody tr:hover { background: transparent; }
  td { padding: 4px 0; }
}
.tbl tbody tr[aria-current] { background: var(--well); }
.tbl tbody tr[aria-current] .who small, .tbl tbody tr[aria-current] .c-rules, .tbl tbody tr[aria-current] .c-text, .tbl tbody tr[aria-current] .c-last, .tbl tbody tr[aria-current] .c-no { color: var(--ink2-onmuted); }
.tbl tbody tr:focus-visible { outline-offset: -2px; border-radius: var(--r-row); }
.who:focus-visible { outline-offset: 2px; border-radius: var(--r-row); }

/* карточка выбранного человека: только поля из API */
.card { display: grid; align-content: start; gap: 14px; padding: 18px; border-radius: var(--r-row); background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.card__hd { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; }
.card__hd .conv__back { position: absolute; top: 0; right: 0; }
.av--xl { width: 64px; height: 64px; font-size: 24px; margin-bottom: 6px; }
.card__name { font-weight: 500; font-size: 18px; color: var(--ink); text-decoration: none; }
.card__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.card__hd small { color: var(--ink2); font-size: 13px; }
.card .say--sug { margin: 0; }
.card .say--sug p { font-size: 14px; }
.card__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; }
.card__facts .wide { grid-column: 1 / -1; }
.card__facts dt { color: var(--ink2); font-size: 13px; }
.card__facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.card__facts dd a { color: var(--data-text); text-decoration: none; }
.card__facts dd a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card__acts { display: grid; gap: 8px; }
.card__go { justify-content: center; }
.sheet .card { border: 0; padding: 0 0 8px; background: transparent; }
@media (max-width: 1279px) { .sheet .card__hd .conv__back { display: inline-grid; } }

/* десктоп ≥900 в окне: таблица прокручивается внутри панели, шапка таблицы стоит на месте */
.tbl__sc { min-width: 0; }
@media (min-width: 900px) {
  body[data-fit] .ib__hd { flex: none; }
  body[data-fit] .cts__grid { flex: 1; min-height: 0; align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  body[data-fit] .tbl { display: flex; flex-direction: column; min-height: 0; }
  body[data-fit] .tbl__sc { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; }
  body[data-fit] .tbl__sc th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
  body[data-fit] .card { overflow: auto; min-height: 0; }
}

/* шапка: подпись и «Скачать CSV» */
.cts__acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; }
@media (max-width: 599px) { .cts__acts { justify-content: flex-start; width: 100%; } .cts__acts .btn { flex: 1 0 100%; } }
@media (max-width: 599px) { .card__name { display: inline-flex; align-items: center; min-height: 44px; } } /* ник в листе — цель 44 px */

/* сегменты: ряд над таблицей (тот же .seg, что во «Входящих»), лист с условиями «и» */
.cts__sg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 100%; min-width: 0; }
.cts__sg[hidden] { display: none; }
.cts__sg .seg { min-width: 0; }
.cts__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cts__tags .chip { height: 28px; padding: 0 12px; font-size: 13px; }
.sgf { gap: 8px; }
.sgf__w { display: grid; gap: 8px; margin: 4px 0 0; padding: 0; border: 0; min-width: 0; justify-items: start; }
#sgW { display: grid; gap: 8px; width: 100%; }
.sgc { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; }
.sgc:has(.sgc__v) { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) minmax(0, 1fr) auto; }
.sgc select.fld { padding-right: 8px; }
.sgf__del { display: grid; gap: 8px; }
@media (max-width: 559px) {
  .sgc, .sgc:has(.sgc__v) { grid-template-columns: minmax(0, 1fr) 44px; }
  .sgc > [data-n] { grid-column: 1 / -1; grid-row: 2; }
  .sgc > [data-v] { grid-column: 1 / -1; grid-row: 3; }
  .sgc > span { display: none; }
  .sgc .ib { grid-column: 2; grid-row: 1; }
}
