/* ---------- chat da equipe (estilo Slack) ---------- */
.badge.tbadge { margin-left: 6px; }
.badge.alert { background: var(--danger); color: #fff; }
.tm { display: grid; grid-template-columns: 260px 1fr; height: 100%; }
.tm:has(.tm-thread:not([hidden])) { grid-template-columns: 260px 1fr 380px; }
.tm-side { background: #231c52; color: #c9c8e8; overflow: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.tm-brand { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.tm-brand strong { color: #fff; font-size: calc(17px * var(--fs, 1)); }
.tm-me { font-size: calc(12px * var(--fs, 1)); display: flex; align-items: center; gap: 6px; }
.tm-search { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; }
.tm-search::placeholder { color: #a9a8cf; }
.tm-sec-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 2px; font-size: calc(13px * var(--fs, 1)); font-weight: 700; color: #fff; }
.tm-plus { border: 0; border-radius: 4px; background: rgba(255,255,255,.12); color: #fff; width: 22px; height: 22px; line-height: 1; font-size: calc(16px * var(--fs, 1)); cursor: pointer; }
.tm-plus:hover { background: rgba(255,255,255,.25); }
.tm-ch { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: 0; background: none; color: #c9c8e8; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.tm-ch:hover { background: #2f2670; }
.tm-ch.sel { background: #453796; color: #fff; }
.tm-ch.unread { color: #fff; font-weight: 700; }
.tm-pref { opacity: .8; width: 16px; text-align: center; }
.tm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-more { display: block; width: 100%; text-align: left; border: 0; background: none; color: #a9a8cf; padding: 4px 10px; font-size: calc(13px * var(--fs, 1)); cursor: pointer; }
.tm-more:hover { color: #fff; }
.tm-none { color: #a9a8cf; font-size: calc(13px * var(--fs, 1)); padding: 2px 10px; }
.tm-none.big { padding: 24px; text-align: center; color: var(--muted); }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #8c8bb5; flex: none; }
.pdot.online { background: #2eb67d; border-color: #2eb67d; }
.pdot.away { background: #ecb22e; border-color: #ecb22e; }
.tm-main, .tm-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.tm-thread { border-left: 1px solid var(--line); }
.tm-thread[hidden] { display: none; }
.tm-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.tm-back { display: none; border: 0; background: none; color: var(--text); width: 36px; height: 36px; padding: 0; align-items: center; justify-content: center; font-size: 30px; line-height: 1; border-radius: 8px; }
.tm-back:hover, .tm-back:focus-visible { background: var(--accent-soft); }
.tm-title { display: flex; flex-direction: column; min-width: 0; }
.tm-title strong { font-size: calc(16px * var(--fs, 1)); }
.tm-topic { border: 0; background: none; color: var(--muted); text-align: left; padding: 0; font-size: calc(13px * var(--fs, 1)); cursor: pointer; }
.tm-topic:hover { text-decoration: underline; }
.tm-actions { display: flex; gap: 6px; }
.tm-x { border: 0; background: none; font-size: calc(22px * var(--fs, 1)); line-height: 1; color: var(--muted); cursor: pointer; }
.tm-msgs { flex: 1; overflow: auto; padding: 8px 0 12px; }
.tm-older { display: block; margin: 8px auto; }
.tm-day { display: flex; align-items: center; gap: 12px; margin: 14px 16px 6px; color: var(--muted); font-size: calc(12px * var(--fs, 1)); font-weight: 600; }
.tm-day::before, .tm-day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.tm-day span { text-transform: capitalize; }
.tm-msg { position: relative; display: flex; gap: 10px; padding: 3px 16px; }
.tm-msg:hover { background: var(--panel2); }
.tm-msg.deleted { color: var(--muted); }
.tm-gap { width: 36px; flex: none; text-align: right; }
.tm-t { visibility: hidden; font-size: calc(11px * var(--fs, 1)); color: var(--muted); }
.tm-msg:hover .tm-t { visibility: visible; }
.tm-av { width: 36px; height: 36px; flex: none; border-radius: 6px; color: #fff; display: grid; place-items: center; font-weight: 700; }
.tm-body { min-width: 0; flex: 1; }
.tm-mh { display: flex; gap: 8px; align-items: baseline; }
.tm-mh time { color: var(--muted); font-size: calc(12px * var(--fs, 1)); }
.tm-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tm-edited { color: var(--muted); }
.tm-mention { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 600; }
.tm-mention.me { background: rgba(236,178,46,.3); color: var(--text); }
.tm-text a { color: var(--accent); }
.tm-rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tm-chip { border: 1px solid var(--line); background: var(--panel2); border-radius: 12px; padding: 1px 8px; font-size: calc(13px * var(--fs, 1)); cursor: pointer; }
.tm-chip.on { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: var(--accent); }
.tm-replies { border: 0; background: none; color: var(--accent); padding: 2px 0; font-weight: 600; cursor: pointer; }
.tm-replies:hover { text-decoration: underline; }
.tm-bar { position: absolute; right: 14px; top: -14px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px; box-shadow: var(--shadow); }
.tm-msg:hover .tm-bar, .tm-msg:focus-within .tm-bar { display: flex; }
.tm-bar button { border: 0; background: none; padding: 3px 6px; border-radius: 4px; cursor: pointer; }
.tm-bar button:hover { background: var(--panel2); }
.tm-comp { position: relative; padding: 8px 16px 14px; flex: none; }
.tm-comp-row { display: flex; gap: 6px; align-items: flex-end; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--panel); }
.tm-comp textarea { border: 0; flex: 1; resize: none; max-height: 140px; min-height: 36px; background: transparent; }
.tm-comp textarea:focus { outline: none; }
.tm-attach { padding: 4px 8px; font-size: calc(16px * var(--fs, 1)); }
.tm-join { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 14px; border-top: 1px solid var(--line); background: var(--panel2); flex: none; }
.tm-suggest { position: absolute; left: 24px; bottom: 58px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); min-width: 220px; z-index: 5; overflow: hidden; }
.tm-suggest[hidden] { display: none; }
.tm-opt { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; cursor: pointer; }
.tm-opt.on, .tm-opt:hover { background: #453796; color: #fff; }
.tm-pop { position: fixed; z-index: 60; display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.tm-pop button { border: 0; background: none; font-size: calc(20px * var(--fs, 1)); padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.tm-pop button:hover { background: var(--panel2); }
.tm-empty { margin: auto; color: var(--muted); }
.tm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 70; padding: 16px; }
.tm-modal { background: var(--panel); border-radius: 10px; width: min(680px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.tm-modal > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tm-modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.tm-form, .tm-list { padding: 14px 18px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.tm-radio { display: flex; flex-direction: column; gap: 4px; }
.tm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tm-row p, .tm-pl { color: var(--muted); font-size: calc(13px * var(--fs, 1)); margin: 0; }
.tm-edit { width: 100%; }
.tm-hits { display: flex; flex-direction: column; }
.tm-hit { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 16px; cursor: pointer; }
.tm-hit:hover { background: var(--panel2); }
.tm-hit-top { display: flex; justify-content: space-between; gap: 8px; }
.tm-hit-top span { color: var(--muted); font-size: calc(12px * var(--fs, 1)); }
.tm-hit-body { color: var(--text); overflow-wrap: anywhere; }
mark { background: #ffe58f; color: #000; border-radius: 2px; }
@media (max-width: 900px) {
  .tm { grid-template-columns: 200px 1fr; }
  .tm:has(.tm-thread:not([hidden])) { grid-template-columns: 1fr; }
  .tm:has(.tm-thread:not([hidden])) .tm-side, .tm:has(.tm-thread:not([hidden])) .tm-main { display: none; }
}
@media (max-width: 600px) {
  .tm { grid-template-columns: 1fr; }
  .tm-side { max-height: 38vh; }
}

/* status personalizado e agendamento */
.tm-status-btn { background: none; border: 0; color: inherit; text-align: left; cursor: pointer; padding: 0; font: inherit; display: block; }
.tm-mystatus { color: #9aa7b2; }
.tm-smark { margin-left: 6px; font-size: calc(13px * var(--fs, 1)); }
.tm-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-status-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.tm-emoji-in { text-align: center; font-size: calc(20px * var(--fs, 1)); }
.tm-sched-link { margin: 8px 12px 0; border: 1px solid #3b4b66; background: transparent; color: #cfd8e3; border-radius: 8px; padding: 6px 10px; cursor: pointer; width: calc(100% - 24px); text-align: left; }
.tm-sched-body { color: #667781; margin: 2px 0 0; overflow-wrap: anywhere; }
.tm-modal > :not(header):not(footer) { overflow-y: auto; min-height: 0; flex: 1 1 auto; }

/* linha "Novas mensagens" e botao de pular para as novas */
.tm-newline { display: flex; align-items: center; gap: 10px; color: #d64545; font-size: calc(12px * var(--fs, 1)); font-weight: 700; margin: 12px 0 6px; }
.tm-newline::before, .tm-newline::after { content: ""; flex: 1; border-top: 1px solid #d64545; }
.tm-jump { display: block; position: sticky; bottom: 8px; margin: 0 auto; border: 0; border-radius: 999px; padding: 6px 14px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: pointer; z-index: 2; }
.tm-jump[hidden] { display: none; }

.tm-muted { margin-left: auto; opacity: .7; font-size: 12px; }
.tm-actions .btn.on { background: #f3e6a8; color: #4b3b00; }

/* ir para uma data (menu no separador de dia) */
.tm-day .tm-daybtn { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.tm-day .tm-daybtn:hover { text-decoration: underline; }
.tm-daymenu { position: fixed; z-index: 70; min-width: 250px; padding: 8px; border: 1px solid var(--line, #d9d7ee); border-radius: 10px; background: var(--card, #fff); color: var(--text, #222); box-shadow: 0 8px 28px rgba(0, 0, 0, .22); }
.tm-daymenu .tm-dm-title { margin: 2px 8px 6px; font-size: 12px; opacity: .7; }
.tm-daymenu .tm-dm-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 8px; border-radius: 6px; cursor: pointer; }
.tm-daymenu .tm-dm-item:hover, .tm-daymenu .tm-dm-item:focus { background: var(--accent-soft, #ece9fb); outline: none; }
.tm-daymenu hr { border: 0; border-top: 1px solid var(--line, #d9d7ee); margin: 6px 0; }
.tm-daymenu .tm-dm-pick { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px 6px; }
.tm-jumpbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; margin: 6px 0; border-radius: 8px; background: var(--accent-soft, #ece9fb); font-size: 13px; }
.tm-newer { align-self: center; margin: 8px auto; }

/* Controles nao podem impor a largura minima de uma conversa inteira. */
.tm { min-width: 0; min-height: 0; grid-template-columns: 260px minmax(0, 1fr); }
.tm:has(.tm-thread:not([hidden])) { grid-template-columns: 260px minmax(0, 1fr) minmax(0, 380px); }
.tm-side, .tm-msgs { min-width: 0; min-height: 0; }
.tm-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.tm-title { overflow-wrap: anywhere; }
.tm-comp textarea { min-width: 0; }
@media (min-width: 601px) and (max-width: 900px) {
  .tm { grid-template-columns: 200px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .tm:has(.tm-thread:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .tm { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
  .tm-side { max-height: none; padding: 6px 8px; gap: 6px; }
  .tm-main { display: none; }
  .tm.mobile-chat-open .tm-side { display: none; }
  .tm.mobile-chat-open .tm-main { display: flex; }
  .tm-back { display: inline-flex; flex: none; }
  .tm-head { gap: 6px; padding: 8px; }
  .tm-title { flex: 1 1 140px; width: auto; }
  .tm-actions { flex: 1 1 100%; flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
  .tm-actions .btn { flex: none; padding: 5px 8px; }
  .tm-comp { padding: 6px 8px max(8px, env(safe-area-inset-bottom)); }
  .tm-comp-row { display: grid; grid-template-columns: repeat(3, auto) minmax(0, 1fr); gap: 6px; }
  .tm-comp-row textarea { grid-column: 1 / -1; grid-row: 1; width: 100%; min-height: 44px; max-height: 25dvh; }
  .tm-comp-row > .btn { grid-row: 2; min-height: 36px; }
  .tm-comp-row > .btn.primary { justify-self: end; }
  .tm-msg { padding: 4px 8px; gap: 6px; }
  .tm-mh { flex-wrap: wrap; gap: 4px; }
  .tm-modal { max-height: 92dvh; }
}

/* Tablet e fio lateral tambem precisam reservar uma linha para a mensagem. */
.tm-thread .tm-comp-row { display: grid; grid-template-columns: repeat(3, auto) minmax(0, 1fr); gap: 6px; }
.tm-thread .tm-comp-row textarea { grid-column: 1 / -1; grid-row: 1; width: 100%; }
.tm-thread .tm-comp-row > .btn { grid-row: 2; }
.tm-thread .tm-comp-row > .btn.primary { justify-self: end; }
@media (min-width: 601px) and (max-width: 1100px) {
  .tm-comp-row { display: grid; grid-template-columns: repeat(3, auto) minmax(0, 1fr); gap: 6px; }
  .tm-comp-row textarea { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .tm-comp-row > .btn { grid-row: 2; }
  .tm-comp-row > .btn.primary { justify-self: end; }
}

@media (max-width: 600px) {
  .tm-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 600px) and (max-height: 600px) {
  .tm { grid-template-rows: minmax(0, 1fr); }
  .tm:has(.tm-thread:not([hidden])) { grid-template-rows: minmax(0, 1fr); }
  .tm-actions { max-height: 70px; overflow-y: auto; }
  #app.shell > .top { max-height: 28dvh; overflow-y: auto; }
}
