/* Групповой чат команды: чат слева, рабочее веб-окно справа. */
#teamView { padding: 16px; }
.team-workspace { display: flex; flex-direction: column; flex: 1 1 auto; width: 100%; min-width: 0;
    height: calc(100vh - 32px); min-height: 420px; }
.team-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.team-top .section-title { margin: 0 8px 0 0; }
.team-badge { font-size: 12px; color: var(--muted); background: var(--hover); border-radius: 10px; padding: 3px 9px; }
.team-layout { display: flex; flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0;
    gap: 10px; --team-web-w: 75%; }
.team-sidebar { width: 230px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
    background: var(--card, #fff); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.team-sidebar-head { padding: 10px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
#teamChats { flex: 1; overflow: auto; padding: 6px; }
.team-chat-row { padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.team-chat-row:hover { background: var(--hover); }
.team-chat-row.active { background: var(--hover); }
.team-chat-row .t { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-chat-row .s { font-size: 11px; color: var(--muted2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-main { flex: 1 1 0; display: flex; flex-direction: column; min-width: 200px; min-height: 0;
    background: var(--card, #fff); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.team-chat-head { padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px;
    display: flex; align-items: center; gap: 8px; }
.team-messages { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.team-msg { max-width: 78%; padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45;
    background: var(--hover); color: var(--text); word-wrap: break-word; white-space: pre-wrap; }
.team-msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.team-msg.lead { align-self: flex-start; border-left: 3px solid var(--accent); }
.team-msg.subagent { align-self: flex-start; border-left: 3px solid #8a7; }
.team-msg.omp { align-self: flex-start; border-left: 3px solid #c9a227; }
.team-msg.system { align-self: center; font-size: 11px; color: var(--muted2); background: transparent; max-width: 95%; }
.team-msg .who { font-size: 10px; color: var(--muted2); margin-bottom: 3px; }
.team-msg.user .who { color: rgba(255,255,255,.8); }
.team-msg .tm { font-size: 10px; opacity: .65; margin-top: 3px; text-align: right; }
.team-composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.team-composer input { flex: 1; }
.team-state { max-height: 140px; overflow: auto; border-top: 1px solid var(--border); padding: 8px 10px; font-size: 12px; }
.team-state-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 4px; font-size: 11px; color: var(--muted2); }
.team-state-toggle { border: 0; background: transparent; color: var(--blue); cursor: pointer;
    font-size: 11px; padding: 0; }
.team-task { display: flex; gap: 8px; align-items: center; padding: 4px 0;
    border-bottom: 1px dashed var(--border); min-width: 0; }
.team-task:last-child { border-bottom: 0; }
.team-task .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-task.latest { align-items: flex-start; white-space: normal; padding: 6px 0; }
.team-task.latest .txt { white-space: normal; overflow: visible; }
.team-task .res { font-size: 11px; color: var(--muted2); margin-top: 2px; white-space: pre-wrap; }
.team-task .st { font-size: 10px; border-radius: 8px; padding: 1px 7px; background: var(--hover); }
.team-task .st.done { background: #e6f4ea; color: #1e7b34; }
.team-task .st.error { background: #fdecea; color: #b3261e; }
.team-task .st.running, .team-task .st.queued { background: #fff4e5; color: #8a5a00; }
.team-web { flex: 0 1 var(--team-web-w); width: auto; min-width: 360px; max-width: 80%;
    display: none; flex-direction: column; min-height: 0;
    background: var(--card, #fff); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.team-layout.split .team-web { display: flex; }
.team-splitter { display: none; flex: 0 0 12px; cursor: col-resize; position: relative; touch-action: none; }
.team-splitter::after { content: ''; position: absolute; left: 4px; top: 12%; bottom: 12%; width: 3px;
    background: var(--border); border-radius: 3px; }
.team-splitter:hover::after, .team-splitter.dragging::after { background: var(--accent); }
.team-layout.split .team-splitter { display: block; }
/* В рабочем режиме список чатов по умолчанию свёрнут: он отнимал место
   у браузера. Кнопка «Чаты» в шапке возвращает его. */
.team-layout.split.sidebar-collapsed .team-sidebar { display: none; }
/* Полноэкранный браузер: чат и список чатов временно скрыты. */
.team-layout.web-max .team-sidebar,
.team-layout.web-max .team-main,
.team-layout.web-max .team-splitter { display: none; }
.team-layout.web-max .team-web { display: flex; flex: 1 1 100%; max-width: none; min-width: 0; }
.team-web-bar { display: flex; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.team-web-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.team-web-tab { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 7px; cursor: pointer;
    font-size: 12px; white-space: nowrap; background: var(--hover); }
.team-web-tab.active { background: var(--accent); color: #fff; }
.team-web-tab button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; }
.team-web-add { font-size: 11px; white-space: nowrap; }
.team-web-nav { display: flex; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.team-web-nav button { width: 28px; }
.team-web-nav input { flex: 1; font-size: 12px; }
.team-web-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.team-web-frame[hidden] { display: none; }
.team-web-empty { flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px; padding: 20px; text-align: center; color: var(--muted); }
.team-web-empty[hidden] { display: none; }
.team-web-empty .t { font-weight: 600; color: var(--text); }
.team-web-empty .s { font-size: 12px; }
.team-web-empty .btns { display: flex; gap: 8px; margin-top: 4px; }
.team-modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center;
    justify-content: center; z-index: 1000; }
.team-modal[hidden] { display: none; }
.team-modal-card { width: min(680px, 94vw); max-height: 86vh; background: var(--card, #fff); border-radius: 12px;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.team-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
    border-bottom: 1px solid var(--border); font-weight: 600; }
.team-modal-head button { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.team-modal-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.team-modal-body .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.team-hosts { flex: 1; overflow: auto; min-height: 160px; border: 1px solid var(--border); border-radius: 8px; }
.team-host { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--border); cursor: pointer; }
.team-host:last-child { border-bottom: 0; }
.team-host:hover { background: var(--hover); }
.team-host .nm { flex: 1; min-width: 0; }
.team-host .nm b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-host .nm span { font-size: 11px; color: var(--muted2); }
.team-host .on { font-size: 10px; border-radius: 8px; padding: 1px 6px; background: #e6f4ea; color: #1e7b34; }
.team-host .off { font-size: 10px; border-radius: 8px; padding: 1px 6px; background: var(--hover); color: var(--muted2); }
.team-modal-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
@media (max-width: 960px) {
    .team-layout { flex-direction: column; }
    .team-sidebar { width: 100%; max-height: 160px; }
    .team-web { flex: 1 1 45%; width: 100%; min-width: 0; max-width: none; }
    .team-splitter { display: none !important; }
    .team-layout.split .team-main { flex: 1 1 45%; }
}
