/* «Команда → Командный чат» (18.10.2026, erp/ui/team.js, erp/teamchat.py): темы слева, лента справа; на телефоне по очереди */
.tc{display:grid;grid-template-columns:300px minmax(0,1fr);gap:10px;height:calc(calc(100dvh/var(--z,1)) - 54px - 22px);min-height:420px}
.tc-side,.tc-main{background:var(--card);border:1px solid var(--line);border-radius:14px;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.tc-sh{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;padding:14px 14px 10px}
.tc-sh h2{margin:0;font-size:18px}
.tc-list{flex:1;overflow:auto;padding:0 6px 8px}
.tc-t{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;border:0;background:none;padding:9px 10px;border-radius:10px;cursor:pointer;color:var(--text);font:inherit}
.tc-t:hover{background:var(--soft)}
.tc-t.on{background:var(--accent-soft)}
.tc-tt{display:flex;align-items:center;gap:6px;min-width:0}
.tc-tt b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tc-t.new .tc-tt b{font-weight:800}
.tc-tw{margin-left:auto;font-size:11.5px;color:var(--faint);white-space:nowrap;font-variant-numeric:tabular-nums}
.tc-mut{display:inline-flex;color:var(--faint)}.tc-mut svg{width:14px;height:14px}
.tc-tl{display:flex;align-items:center;gap:6px;min-width:0;font-size:12.5px}
.tc-tl .muted{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tc-b{font-style:normal;min-width:20px;height:20px;line-height:20px;padding:0 6px;border-radius:10px;background:var(--accent);color:#fff;font-size:11.5px;font-weight:700;text-align:center;flex:none}
.tc-b.mut{background:var(--faint)}
.tc-b.at{background:var(--bad);padding:0;width:20px}
.tc-none{padding:20px 10px;display:flex;flex-direction:column;gap:4px}
.tc-nopush{padding:8px 14px 12px;border-top:1px solid var(--line);line-height:1.4}
.tc-others{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:0 14px 10px}
.tc-oth{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--card);border-radius:999px;padding:3px 4px 3px 10px;font:inherit;font-size:12.5px;cursor:pointer;color:var(--text)}
.tc-oth i{font-style:normal;background:var(--accent);color:#fff;border-radius:9px;font-size:11px;font-weight:700;padding:0 6px;line-height:18px}
.tc-pend{margin:0 10px 10px;padding:10px;border-radius:12px;background:var(--soft-info);display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.tc-pend .small{font-weight:600;color:var(--ink-info)}
.tc-pend .btn.lnk{padding:2px 0;min-height:0}

/* лента */
.tc-mh{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line)}
.tc-mt{flex:1;min-width:0;display:flex;flex-direction:column}
.tc-mt b{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tc-mh .btn.ic.tc-back{display:none}
.tc-mh .btn.ic{width:36px;height:36px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.tc-feed{flex:1;overflow:auto;padding:10px 14px 14px;background:var(--bg);display:flex;flex-direction:column;gap:3px}
.tc-empty{flex:1;display:flex;align-items:center;justify-content:center}
.tc-first{text-align:center;margin:auto;max-width:340px;line-height:1.5}
.tc-moreb{text-align:center;margin:4px 0 8px}
.tc-day{align-self:center;margin:10px 0 6px}
.tc-day span{font-size:11.5px;color:var(--muted);background:var(--card);border:1px solid var(--line);border-radius:999px;padding:2px 10px}
.tc-m{display:flex;align-items:flex-end;gap:8px;max-width:100%;position:relative;margin-top:6px}
.tc-m.cont{margin-top:0}
.tc-m.cont{padding-left:40px}
.tc-m.out{justify-content:flex-end;padding-left:40px}
.tc-ava{width:32px;height:32px;border-radius:50%;flex:none;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;
  background:hsl(var(--h) 55% 88%);color:hsl(var(--h) 45% 30%)}
.tc-ava.s{width:24px;height:24px;font-size:10px}
.tc-bub{position:relative;background:var(--card);border:1px solid var(--line);border-radius:14px;border-bottom-left-radius:5px;padding:7px 11px 6px;max-width:min(78%,560px);min-width:0;display:flex;flex-direction:column;gap:5px;line-height:1.42;overflow-wrap:anywhere}
.tc-m.cont .tc-bub{border-radius:14px}
.tc-m.out .tc-bub{background:var(--accent-soft);border-color:var(--accent-soft);border-bottom-left-radius:14px;border-bottom-right-radius:5px}
.tc-m.at:not(.out) .tc-bub{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.tc-m.hl .tc-bub{animation:tcHl 2.2s ease}
@keyframes tcHl{0%,40%{box-shadow:0 0 0 3px var(--accent)}100%{box-shadow:none}}
.tc-m.del .tc-bub{background:transparent;border-style:dashed}
.tc-nm{font-size:12.5px;font-weight:700;color:hsl(var(--h) 45% 38%)}
.tc-tx a{color:var(--accent);text-decoration:underline}
.tc-at{font-weight:700;color:var(--accent)}
.tc-at.me{background:var(--accent-soft);border-radius:4px;padding:0 2px}
.tc-meta{align-self:flex-end;font-size:11px;color:var(--faint);white-space:nowrap;font-variant-numeric:tabular-nums;margin-top:-2px}
.tc-seen{cursor:help}
.tc-q{display:flex;flex-direction:column;border-left:3px solid var(--accent);background:var(--soft);border-radius:6px;padding:4px 8px;font-size:12.5px;color:var(--muted);cursor:pointer;min-width:0}
.tc-q b{color:var(--text);font-size:12px}
.tc-ph img{display:block;max-width:100%;max-height:320px;border-radius:9px;object-fit:cover}
.tc-au{width:260px;max-width:100%;height:38px}
.tc-fl,.tc-ref{display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:10px;background:var(--soft);color:var(--text);text-decoration:none;cursor:pointer;min-width:0}
.tc-fl:hover,.tc-ref:hover{background:var(--line)}
.tc-fl svg,.tc-ref svg{flex:none;color:var(--accent)}
.tc-fl span,.tc-ref span{display:flex;flex-direction:column;min-width:0}
.tc-fl b,.tc-ref b{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis}
.tc-fl small,.tc-ref small{font-size:11.5px;color:var(--muted)}
.tc-m.out .tc-fl,.tc-m.out .tc-ref{background:var(--card)}
.tc-ref.c{background:var(--card);border:1px solid var(--line);padding:5px 9px}
.tc-task{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;font-size:12px;font-weight:600;padding:3px 9px;border-radius:999px;background:var(--soft-info);color:var(--ink-info);text-decoration:none}
.tc-task.s-done{background:var(--soft-ok);color:var(--ink-ok)}
.tc-task.s-deleted,.tc-task.s-cancelled{background:var(--soft);color:var(--muted)}
.tc-act{align-self:center;border:0;background:none;color:var(--muted);width:28px;height:28px;border-radius:50%;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;visibility:hidden;flex:none}
.tc-m.out .tc-act{order:-1}
.tc-act:hover{background:var(--soft);color:var(--accent)}
@media (hover:hover){.tc-m:hover .tc-act{visibility:visible}}
@media (hover:none){.tc-act{display:none}}

/* поле ввода */
.tc-comp{border-top:1px solid var(--line);padding:8px 10px;background:var(--card);position:relative}
.tc-comp.drop{background:var(--accent-soft)}
.tc-crow{display:flex;align-items:flex-end;gap:6px}
.tc-crow .btn.ic{width:40px;height:40px;padding:0;display:inline-flex;align-items:center;justify-content:center;flex:none}
.tc-crow #tc_mic.rec{width:auto;padding:0 12px;color:var(--bad);font-weight:700;font-variant-numeric:tabular-nums}
.tc-crow textarea{flex:1;min-width:0;resize:none;min-height:40px;max-height:160px;padding:9px 12px;border-radius:12px;line-height:1.4;font:inherit}
.tc-cbar{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.tc-cb{display:flex;align-items:center;gap:8px;min-width:0}
.tc-cb>span:not(.tc-ref){flex:1;min-width:0;display:flex;flex-direction:column}
.tc-cb .tc-q{flex:1}
.tc-cb .tc-ref{flex:1}
.tc-cb small{font-size:11.5px;color:var(--muted)}
.tc-cimg{width:44px;height:44px;border-radius:8px;object-fit:cover}
.tc-cx{border:0;background:var(--soft);color:var(--muted);width:28px;height:28px;border-radius:50%;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex:none}
.tc-atdd{position:absolute;left:10px;right:10px;bottom:calc(100% + 4px);background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 28px var(--sh);padding:4px;max-height:260px;overflow:auto;z-index:20}
.tc-atdd button{display:flex;align-items:center;gap:8px;width:100%;border:0;background:none;padding:7px 9px;border-radius:8px;cursor:pointer;font:inherit;color:var(--text);text-align:left}
.tc-atdd button.on,.tc-atdd button:hover{background:var(--accent-soft)}
.tc-ro{padding:12px;text-align:center;border-top:1px solid var(--line)}

/* окно «Прикрепить» */
.tcr-res{display:flex;flex-direction:column;gap:2px;margin-top:8px;max-height:min(52vh,420px);overflow:auto}
.tcr-g{display:flex;align-items:center;gap:6px}
.tcr-it{display:flex;align-items:center;gap:9px;flex:1;min-width:0;border:0;background:none;padding:8px;border-radius:9px;cursor:pointer;font:inherit;color:var(--text);text-align:left}
.tcr-it:hover{background:var(--accent-soft)}
.tcr-it svg{color:var(--accent);flex:none}
.tcr-it span{display:flex;flex-direction:column;min-width:0}
.tcr-it small{color:var(--muted);font-size:12px}
.tcr-it b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tcr-it.s{padding-left:30px}

/* темная тема: аватары и имена темнее фоном, светлее буквами */
:root[data-theme="dark"] .tc-ava{background:hsl(var(--h) 30% 26%);color:hsl(var(--h) 70% 82%)}
:root[data-theme="dark"] .tc-nm{color:hsl(var(--h) 65% 72%)}

/* меню: упоминание — красный счетчик */
.nav .tab.tc-mention .tbadge{background:var(--bad)}

@media (max-width:760px){
  .tc{grid-template-columns:1fr;height:calc(calc(100dvh/var(--z,1)) - 54px - 8px - 78px);min-height:320px}
  .tc .tc-main{display:none}
  .tc.open .tc-side{display:none}
  .tc.open .tc-main{display:flex}
  .tc-mh .btn.ic.tc-back{display:inline-flex}
  .tc-bub{max-width:86%}
  .tc-m.out,.tc-m.cont{padding-left:24px}
  .tc-feed{padding:8px 8px 12px}
  .tc-crow textarea{font-size:16px}
  body.has-pwa .tc{height:calc(calc(100dvh/var(--z,1)) - 54px - 8px - 78px - 160px)}   /* плашка «Установить лину» снизу не закрывает темы, как в «Диалогах» */
  body.has-pwa .tc.open{height:calc(calc(100dvh/var(--z,1)) - 54px - 8px - 78px)}
  body:has(.tc.open) #pwa{display:none}
}
