/* app-team.css — экран «Состав» (we:Hub v2, b5). Блоки — из hub.css (hub-list, hub-row, hub-avatar, hub-gap, hub-group__title),
   элементы — ui-kit (.ui-btn, .ui-chip, UI.seg, UI.dialog, .ui-input). Здесь раскладка экрана, строки позиций с глубиной
   и лист. Размеры кратны 4, цвета — токены, движение — только под prefers-reduced-motion: no-preference. */

.tm-screen { --tm-pad: 20px; padding: calc(env(safe-area-inset-top) + 12px) var(--tm-pad) calc(var(--hub-dock-h) + env(safe-area-inset-bottom) + 48px); box-sizing: border-box; max-width: 560px; margin: 0 auto; }
.tm-top { height: 44px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.tm-top__spacer { margin-right: auto; }
.tm-back { height: 44px; padding: 0 16px 0 8px; border-radius: 22px; gap: 4px; background: var(--ui-surface); font-size: 15px; font-weight: 500; letter-spacing: 0; max-width: 100%; }
.tm-back__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.tm-ic { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.tm-head { padding: 12px 0 16px; }
.tm-title { margin: 0 0 8px; }
.tm-sub { margin: 0; min-height: 24px; }
.tm-body { min-height: 360px; }
.tm-note { margin: 12px 0; }
.tm-empty { margin-top: 16px; }

.tm-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tm-seg { flex: 1 1 auto; min-width: 0; }
.tm-seg .ui-seg { width: 100%; box-sizing: border-box; border-radius: 22px; padding: 4px; background: var(--ui-surface); }
.tm-seg .ui-seg > button { flex: 1 1 0; height: 36px; min-height: 36px; border-radius: 18px; justify-content: center; font-weight: 600; font-size: 14px; letter-spacing: 0; color: var(--ui-muted); padding: 0 8px; }
.tm-seg .ui-seg > button[aria-pressed="true"] { background: var(--ui-surface-2); color: var(--ui-text); box-shadow: inset 0 0 0 1px var(--hub-line-strong); }
.tm-tree { height: 44px; border-radius: 22px; padding: 0 16px; gap: 8px; font-weight: 600; letter-spacing: 0; background: var(--ui-surface); flex: none; text-decoration: none; }

.tm-layout { display: block; }
.tm-nav { display: none; }

/* блок */
.tm-block { margin-top: 28px; scroll-margin-top: 16px; }
.tm-block__head { display: flex; align-items: flex-start; gap: 12px; margin: 0 2px 12px; }
.tm-block__titles { min-width: 0; flex: 1; }
.tm-block__title { margin: 0; display: flex; align-items: baseline; gap: 8px; font: 600 17px/1.25 var(--ui-font); }
.tm-block__name { overflow-wrap: anywhere; }
.tm-block__count { font: 600 13px/1 var(--hub-display); color: var(--ui-accent); white-space: nowrap; }
.tm-block__lead { margin: 4px 0 0; font-size: 14px; line-height: 1.35; color: var(--ui-muted); }
.ui-btn.tm-give { height: 44px; border-radius: 22px; padding: 0 16px; gap: 8px; font-size: 14px; font-weight: 600; letter-spacing: 0; background: var(--ui-surface); flex: none; }

/* позиции: строка = место; вложенность — отступом и линией-коннектором */
.tm-list { position: relative; }
.tm-pos { position: relative; }
.tm-pos + .tm-pos::before, .tm-pos + .tm-add::before { content: ''; position: absolute; left: 68px; right: 0; top: 0; border-top: 1px solid var(--ui-border); }
.tm-pos .hub-row::before { display: none; }
.tm-row { box-sizing: border-box; width: 100%; min-height: 68px; text-align: left; background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; }
.tm-row:focus-visible, .tm-add:focus-visible, .tm-act:focus-visible, .tm-cand__open:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; border-radius: var(--hub-r-row); }
.tm-pos[data-depth="1"] .tm-row { padding-left: 40px; }
.tm-pos[data-depth="2"] .tm-row { padding-left: 64px; }
.tm-pos[data-depth="3"] .tm-row { padding-left: 88px; }
.tm-pos:not([data-depth="0"])::after { content: ''; position: absolute; top: 0; height: 50%; width: 12px; border-left: 1px solid var(--hub-line-strong); border-bottom: 1px solid var(--hub-line-strong); border-bottom-left-radius: 8px; pointer-events: none; }
.tm-pos[data-depth="1"]::after { left: 24px; }
.tm-pos[data-depth="2"]::after { left: 48px; }
.tm-pos[data-depth="3"]::after { left: 72px; }
.tm-row__body { display: grid; gap: 2px; }
.tm-row__title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.tm-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--ui-muted); font-size: 14px; line-height: 1.3; }
.tm-row__who { color: var(--ui-text); }
.tm-row__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tm-row__chips:empty { display: none; }
.tm-row .ui-chip, .tm-pane .ui-chip, .tm-cand .ui-chip { height: 28px; padding: 0 12px; font-size: 13px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.tm-add { box-sizing: border-box; position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; background: transparent; border: 0; color: var(--ui-muted); font: 600 15px/1 var(--ui-font); cursor: pointer; }
.tm-add .tm-ic { width: 44px; justify-content: center; }

/* лист */
.tm-pane { display: grid; gap: 16px; padding: 4px 0 8px; align-content: start; }
.tm-pane__h { margin: 8px 0 0; }
.tm-pane__note { margin: 0; color: var(--ui-muted); font-size: 14px; line-height: 1.4; }
.tm-pane__status { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-pane__acts, .tm-pane__facts { display: grid; gap: 12px; }
.tm-pane__back { justify-self: start; height: 44px; padding: 0 16px 0 8px; gap: 4px; }
.ui-btn.tm-wide { width: 100%; height: 48px; border-radius: 24px; justify-content: center; gap: 8px; font-weight: 600; letter-spacing: 0; }
.tm-act { box-sizing: border-box; width: 100%; min-height: 56px; text-align: left; background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; }
.tm-act__label { font-weight: 600; }
.tm-search { height: 48px; border-radius: 24px; padding: 0 20px; background: var(--ui-surface); width: 100%; box-sizing: border-box; }
.tm-results { display: grid; gap: 12px; min-height: 160px; align-content: start; }
.tm-cand { align-items: center; }
.tm-cand__open { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ui-btn.tm-cand__btn { height: 44px; border-radius: 22px; padding: 0 16px; flex: none; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.tm-cand__avail { font-size: 14px; line-height: 1.3; font-weight: 500; }
.tm-cand__avail.is-free { color: var(--ui-success); }
.tm-cand__avail.is-busy { color: var(--ui-warning); }
.tm-cand .hub-row__meta { white-space: normal; }
.tm-cand__note { color: var(--ui-muted); font-size: 14px; line-height: 1.35; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tm-hints { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; }
.ui-chip.tm-hint { height: 36px; padding: 0 16px; font-size: 14px; cursor: pointer; background: var(--ui-surface); border: 1px solid var(--ui-border); }
.tm-addrow { display: flex; align-items: center; gap: 12px; }
.tm-qty__label { display: flex; align-items: center; gap: 12px; color: var(--ui-muted); font-size: 14px; }
.tm-qty { width: 96px; height: 44px; }
.ui-btn.tm-round { width: 44px; height: 44px; padding: 0; border-radius: 22px; background: var(--ui-surface-2); flex: none; }
/* плотный фон — только у бокового слоя-экрана; нижний лист — стекло ui-kit (personal-os#1620) */
.tm-layer.ui-dialog--side .ui-dialog__panel { background: var(--ui-bg); }
.tm-layer.ui-dialog--side { width: min(440px, 100vw); }

@media (min-width: 1024px) {
  .tm-screen { --tm-pad: 40px; max-width: 1240px; padding-top: 32px; padding-bottom: 48px; }
  .tm-head { padding-top: 8px; }
  .tm-bar { max-width: 560px; }
  .tm-bar .tm-tree { margin-left: auto; }
  .tm-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
  .tm-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; position: sticky; top: 24px; align-content: start; }
  .tm-nav__item { box-sizing: border-box; width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: transparent; color: var(--ui-muted); font: 500 15px/1.25 var(--ui-font); text-align: left; cursor: pointer; }
  .tm-nav__item:hover, .tm-nav__item:focus-visible { background: var(--ui-surface); color: var(--ui-text); outline: none; }
  .tm-nav__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tm-nav__count { font: 600 13px/1 var(--hub-display); color: var(--ui-accent); }
  .tm-block:first-child { margin-top: 0; }
  .tm-list { display: grid; grid-template-columns: 1fr 1fr; }
  .tm-pos + .tm-pos::before, .tm-pos + .tm-add::before { content: none; }
  .tm-pos { border-top: 1px solid var(--ui-border); }
  .tm-pos:nth-child(2n+1) { border-right: 1px solid var(--ui-border); }
  .tm-pos:nth-child(-n+2) { border-top: 0; }
  .tm-pos:not([data-depth="0"])::after { content: none; }
  .tm-add { grid-column: 1 / -1; border-top: 1px solid var(--ui-border); }
  .tm-bar .tm-seg { max-width: 420px; }
}

@media (prefers-reduced-motion: no-preference) {
  .tm-row, .tm-add, .tm-act, .tm-nav__item { transition: background-color var(--hub-dur-1) var(--hub-ease); }
  .tm-row:hover, .tm-add:hover, .tm-act:hover { background: var(--ui-surface-2); }
}

/* состав внутри вкладки «Команда» карточки проекта: своих отступов и ширины нет, их задаёт карточка */
.tm-screen.tm-screen--embedded { max-width: none; margin: 0; padding: 0; }
