/* SDP1-C08: Team page (internal staff messaging). Uses the console's existing
   palette: white panels on the canvas, the #e4e9f1 border, violet for the
   selected row and the unread count. No new fonts, gradients or shadows. */
#team .tm-toolbar{margin-bottom:12px}
#team .tm-tabs{margin:0 0 12px}
.tm-layout{display:grid;grid-template-columns:minmax(240px,300px) minmax(0,1fr);gap:0;background:#fff;border:1px solid var(--signal-border,#e4e9f1);border-radius:10px;overflow:hidden;min-height:420px}
.tm-list{border-right:1px solid var(--signal-border,#e4e9f1);overflow-y:auto;padding:8px 0;min-height:0;background:#fbfcfe}
.tm-list-heading{margin:14px 16px 4px;font-size:var(--fs-xs,11px);font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:#64748b}
.tm-people{list-style:none;margin:0;padding:0}
.tm-row{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;padding:9px 16px;text-align:left;color:#182230;cursor:pointer;font:inherit}
.tm-row:hover{background:#f3f1fb}
.tm-row.active{background:#f5f3ff;color:#182230;box-shadow:inset 3px 0 var(--signal-violet,#6d43dd)}
.tm-row-text{display:grid;min-width:0;flex:1}
.tm-row-text strong{font-size:var(--fs-md,14px);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-row-text small{font-size:var(--fs-sm,12px);color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-avatar{position:relative;flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:8px;background:#e9edf5;color:#344054;font-size:12px;font-weight:600}
.tm-hash{background:#ede9fe;color:#5b34c9;font-size:15px}
.tm-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#98a2b3;flex:none}
.tm-avatar .tm-dot{position:absolute;right:-2px;bottom:-2px;border:2px solid #fbfcfe}
.tm-dot.online{background:#16a34a}
.tm-dot.away{background:#d97706}
.tm-dot.offline{background:#98a2b3}
.tm-count{flex:none;min-width:20px;padding:1px 6px;border-radius:6px;background:var(--signal-violet,#6d43dd);color:#fff;font-size:11px;font-weight:600;text-align:center;line-height:16px}
.tm-thread{display:flex;flex-direction:column;min-width:0;min-height:0}
.tm-thread-head{display:flex;align-items:center;gap:10px;padding:12px 18px;border-bottom:1px solid var(--signal-border,#e4e9f1)}
.tm-thread-head>div{display:grid;gap:2px;min-width:0}
.tm-thread-head h3{margin:0;font-size:var(--fs-lg,16px)}
.tm-status{display:inline-flex;align-items:center;gap:6px;font-size:var(--fs-sm,12px);color:#64748b}
.tm-back{display:none;border:1px solid var(--signal-border,#e4e9f1);background:#fff;border-radius:7px;width:34px;height:34px;font-size:20px;line-height:1;cursor:pointer;color:#344054}
.tm-notice{margin:0;padding:7px 18px;font-size:var(--fs-sm,12px);color:#5b4a1f;background:#fdf8ec;border-bottom:1px solid #f3e7c4}
.tm-thread-body{flex:1;min-height:0;overflow-y:auto;padding:14px 18px;display:flex;flex-direction:column;gap:2px}
.tm-message{max-width:min(620px,88%);align-self:flex-start;margin-top:10px}
.tm-message.grouped{margin-top:2px}
.tm-message .tm-meta{display:flex;gap:8px;align-items:baseline;margin:0 0 3px}
.tm-message .tm-meta strong{font-size:var(--fs-sm,12px)}
.tm-message time{font-size:var(--fs-xs,11px);color:#667085}
.tm-message p{margin:0;padding:8px 11px;border-radius:9px;background:#f2f4f7;color:#182230;white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--fs-md,14px);line-height:1.45}
.tm-message.mine{align-self:flex-end}
.tm-message.mine .tm-meta{justify-content:flex-end}
.tm-message.mine p{background:#efeafd}
.tm-compose{display:flex;gap:10px;align-items:flex-end;padding:12px 18px;border-top:1px solid var(--signal-border,#e4e9f1)}
.tm-compose textarea{flex:1;min-height:44px;max-height:160px;resize:vertical;font:inherit}
.tm-compose button{flex:none;min-height:44px}
.tm-empty{margin:0;padding:18px 16px;color:#64748b;font-size:var(--fs-base,13px)}
.tm-pick{margin:auto;text-align:center}
.tm-thread-empty{margin:auto 0}

/* Desktop/tablet fixed shell: the Team page fills the main column; lists and the thread scroll inside. */
@media (min-width:768px){
  body:has(#app-shell:not(.hidden)) #app-shell>main>#team.active{display:flex;flex-direction:column;overflow:hidden}
  body:has(#app-shell:not(.hidden)) #app-shell>main>#team.active>.tm-layout:not(.hidden){flex:1 1 auto;min-height:0}
}
@media (min-width:768px) and (max-width:1023.98px){
  .tm-layout{grid-template-columns:minmax(210px,250px) minmax(0,1fr)}
}

/* Phones: one column. The list shows until a conversation is opened, then the thread with a back button. */
@media (max-width:767.98px){
  .tm-layout{grid-template-columns:minmax(0,1fr);min-height:0;border-radius:8px}
  .tm-list{border-right:0}
  .tm-layout .tm-thread{display:none}
  .tm-layout.tm-thread-open .tm-list{display:none}
  .tm-layout.tm-thread-open .tm-thread{display:flex;height:calc(100dvh - 220px);min-height:360px}
  .tm-back{display:inline-grid;place-items:center}
  .tm-row{padding:11px 14px;min-height:48px}
  .tm-thread-head,.tm-thread-body,.tm-compose{padding-left:12px;padding-right:12px}
  .tm-notice{padding-left:12px;padding-right:12px}
  .tm-message{max-width:92%}
}
@media (prefers-reduced-motion:reduce){.tm-row{transition:none}}

/* CR-0028 (4): TEAM ONLINE names open a direct team chat in the docked chat view. */
.team-list li:has(>.team-member){padding:0}
.team-member{display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:4px 12px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:12.5px;text-align:left;cursor:pointer}
.team-member:hover{background:#263244;color:#fff}
.team-member:focus-visible{outline:2px solid #a78bfa;outline-offset:-2px}
.team-unread{margin-left:auto;flex:none;min-width:18px;padding:1px 5px;border-radius:9px;background:#7c3aed;color:#fff;font-size:10.5px;font-weight:700;line-height:15px;text-align:center}
.mobile-team .team-member{gap:10px;min-height:44px;padding:6px 12px;font-size:14px;color:#e2e8f0}

/* The team chat takes the visitor chat's slot; the visitor chat and its profile column step aside. */
#team-dock{display:none}
#inbox.team-docked>.agent-layout>#team-dock:not(.hidden){display:flex;flex-direction:column;min-height:0;min-width:0;overflow:hidden}
#inbox.team-docked>.agent-layout>:is(#agent-conversation,.visitor-detail,.queue-panel,.visitor-context-scrim){display:none!important}
.team-dock .team-dock-head{display:flex;flex-direction:row;align-items:center;gap:6px 10px;padding:10px 14px;min-height:64px;border-bottom:1px solid var(--vb-line,#e4e7ec)}
.team-dock .team-dock-head .conversation-summary{flex:1 1 auto;min-width:0}
.team-dock .team-dock-head .eyebrow{display:none}
.team-dock .team-dock-head h2{margin:0;font-size:16px;line-height:21px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.team-dock .team-dock-head .conversation-meta{display:flex;gap:6px;font-size:12px;color:#667085}
.team-dock .team-dock-head .conversation-meta-item{display:inline-flex;align-items:center;gap:6px}
.team-dock .team-dock-head .conversation-controls{display:flex;gap:6px;flex:none;width:auto;max-width:none;overflow:visible;padding:0}
/* Header row is back | name | controls; the phone-wide visitor-chat rules must not stretch or shrink these. */
.team-dock .team-dock-head .conversation-identity{display:block;min-width:0}
.team-dock .team-dock-head .dk-head-btn{flex:none}
.team-dock .team-dock-back{display:none}
.team-dock-notice{margin:0;padding:6px 14px;border-bottom:1px solid var(--vb-line,#e4e7ec);background:#f7f8fa;color:#475467;font-size:11.5px}
.team-dock .team-dock-messages{flex:1 1 auto;min-height:0;overflow-y:auto;display:flex;flex-direction:column}
.team-dock .team-bubble{white-space:pre-wrap;word-break:break-word}
.team-dock .team-bubble.visitor{align-self:flex-start}
.team-dock .team-bubble.assistant{align-self:flex-end}
.team-dock .team-bubble .tm-delivery{text-align:right}
.team-dock .team-bubble .tm-delivery.failed{color:#b42318}
.team-dock .team-dock-reply{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:4px 10px;flex:0 0 auto}
.team-dock .team-dock-reply>textarea{grid-column:1;grid-row:1;min-height:44px;max-height:160px;resize:none}
.team-dock .team-dock-reply>button.primary{grid-column:2;grid-row:1;min-height:44px}
.team-dock .team-dock-reply>small{grid-column:1/-1;grid-row:2;color:#667085;font-size:11.5px}
.dk-team-mark{flex:none;font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#6d43dd;border:1px solid #d9d0fb;border-radius:3px;padding:0 3px}
.dk-tab.new .dk-team-mark{color:#fff;border-color:rgba(255,255,255,.6)}

@media(min-width:1280px){
  #inbox.board-view.docked.team-docked>.agent-layout{grid-template-columns:minmax(0,1fr)}
  #inbox.board-view.docked.team-docked>.agent-layout>#team-dock{grid-column:1/-1;height:100%;border:1px solid var(--vb-line,#e4e7ec);border-radius:12px;background:#fff}
}
/* Below the docked width the team chat is full screen with a back button, like a visitor chat. */
@media(max-width:1279px){
  #inbox.active.board-view.team-docked{display:flex;flex-direction:column;min-height:0}
  #inbox.active.board-view.team-docked>:not(.agent-layout){display:none!important}
  #inbox.active.board-view.team-docked>.agent-layout{display:flex!important;flex:1 1 auto;min-height:0;height:100%;border:0}
  #inbox.active.board-view.team-docked>.agent-layout>#team-dock{flex:1 1 auto;width:100%;height:100%;border:1px solid var(--vb-line,#e4e7ec);border-radius:12px;background:#fff}
  .team-dock .team-dock-back{display:inline-grid}
}
@media(max-width:767px){
  body:has(#inbox.active.board-view.team-docked){padding-bottom:0;overflow:hidden}
  #inbox.active.board-view.team-docked{position:fixed;z-index:20;inset:0 0 calc(64px + env(safe-area-inset-bottom));height:auto;margin:0;padding:8px 12px;background:var(--signal-canvas,#f6f8fb)}
  .team-dock .team-dock-reply>small{display:none}
  .team-dock .team-dock-head .dk-head-btn,.team-dock .team-dock-head .conversation-controls .dk-head-btn{width:44px;height:44px;min-height:44px;max-height:none;padding:0!important;font-size:22px;line-height:1}
}
@media(max-width:1279px){
  .team-dock .team-dock-head{flex-wrap:nowrap;padding:8px 10px;min-height:56px}
  .team-dock .team-dock-head [data-team-dock-minimise]{display:none}
}
