/* ============================================================
   Ospaces — Team Chat (light + dark)
   A non-blocking right-hand drawer: realtime team conversation
   with @mentions, #file references, and ==highlights==.
   ============================================================ */
.tc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 388px; max-width: 94vw; z-index: 130;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 34px rgba(8, 9, 22, 0.24);
  font-family: var(--font);
  animation: tc-slide-in 0.18s ease;
}
@keyframes tc-slide-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- header ---- */
.tc-head {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--border);
}
.tc-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px; font-family: var(--font-display);
  text-transform: uppercase; letter-spacing: 0.2px;
}
.tc-head-info { flex: 1; min-width: 0; }
.tc-team-name {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-team-sub { font-size: 11.5px; color: var(--text-light); margin-top: 1px; }
.tc-x {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 15px; transition: background 0.12s, color 0.12s;
}
.tc-x:hover { background: var(--bg-hover); color: var(--text); }

/* ---- shared-files strip ---- */
.tc-files { flex-shrink: 0; padding: 8px 12px 6px; border-bottom: 1px solid var(--border); background: var(--bg-callout); }
.tc-files-label {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-faint); margin: 0 2px 5px;
}
.tc-files-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tc-file-chip {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  max-width: 190px; padding: 4px 9px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border-strong);
  font-size: 12.5px; color: var(--text); transition: border-color 0.12s, background 0.12s;
}
.tc-file-chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.tc-file-ic { flex-shrink: 0; font-size: 13px; }
.tc-file-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- thread ---- */
.tc-thread { flex: 1; overflow-y: auto; padding: 12px 12px 14px; min-height: 0; }
.tc-empty {
  color: var(--text-faint); font-size: 13.5px; text-align: center;
  padding: 40px 20px; line-height: 1.6;
}
.tc-new-divider {
  display: flex; align-items: center; gap: 8px; margin: 10px 2px;
  color: var(--danger); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
}
.tc-new-divider::before, .tc-new-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--danger) 40%, transparent); }

.tc-msg {
  position: relative; display: flex; gap: 9px; padding: 3px 34px 3px 2px; border-radius: 8px;
}
.tc-msg:hover { background: var(--bg-hover); }
.tc-grouped { margin-top: -2px; }
.tc-msg-avatar { width: 30px; height: 30px; font-size: 11.5px; margin-top: 2px; }
.tc-avatar-ghost { background: transparent !important; }
.tc-msg-body { flex: 1; min-width: 0; }
.tc-msg-meta { display: flex; align-items: baseline; gap: 7px; margin-bottom: 1px; }
.tc-msg-author { font-weight: 600; font-size: 13px; color: var(--text); }
.tc-msg-time { font-size: 10.5px; color: var(--text-faint); }
.tc-msg-text { font-size: 13.5px; line-height: 1.5; color: var(--text); word-break: break-word; white-space: pre-wrap; }
.tc-msg-text code.tc-code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 4px; padding: 0.5px 4px;
}
.tc-msg-text mark.tc-hl {
  background: color-mix(in srgb, var(--star) 42%, transparent); color: inherit;
  border-radius: 3px; padding: 0 2px;
}

/* mention + file chips inside messages */
.tc-mention {
  font-weight: 600; border-radius: 4px; padding: 0 3px;
  color: var(--mc, var(--accent));
  background: color-mix(in srgb, var(--mc, var(--accent)) 14%, transparent);
}
.tc-mention-me { color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.tc-ref {
  display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500;
  border-radius: 5px; padding: 0 5px; margin: 0 1px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  vertical-align: baseline; transition: background 0.12s;
}
.tc-ref:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.tc-ref-missing { color: var(--text-faint); background: var(--bg-hover); border-color: var(--border); text-decoration: line-through; }

/* per-message hover actions */
.tc-msg-actions {
  position: absolute; top: 2px; right: 6px; display: none; gap: 2px;
  background: var(--bg-modal); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-card);
}
.tc-msg:hover .tc-msg-actions, .tc-msg-actions.tc-confirming { display: flex; }
.tc-act {
  height: 24px; min-width: 24px; padding: 0 7px; border-radius: 6px;
  font-size: 12px; color: var(--text-light); transition: background 0.12s, color 0.12s;
}
.tc-act:hover { background: var(--bg-hover); color: var(--text); }
.tc-act-danger { color: var(--danger); font-weight: 600; }
.tc-act-primary { color: #fff; background: var(--accent); font-weight: 600; }
.tc-act-primary:hover { background: var(--accent-hover); color: #fff; }

/* inline editor */
.tc-edit { margin-top: 2px; }
.tc-edit-input {
  width: 100%; resize: none; font-family: var(--font); font-size: 13.5px; line-height: 1.5;
  color: var(--text); background: var(--bg-input); border: 1px solid var(--accent); border-radius: 8px; padding: 7px 9px;
}
.tc-edit-input:focus { outline: none; }
.tc-edit-foot { display: flex; gap: 5px; margin-top: 5px; }

/* ---- composer ---- */
.tc-composer { flex-shrink: 0; position: relative; padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.tc-input {
  width: 100%; resize: none; font-family: var(--font); font-size: 13.5px; line-height: 1.5;
  color: var(--text); background: var(--bg-input);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 11px;
  transition: border-color 0.12s;
}
.tc-input:focus { outline: none; border-color: var(--accent); }
.tc-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.tc-hint { font-size: 11px; color: var(--text-faint); }
.tc-hint b { color: var(--text-light); font-weight: 600; }
.tc-send {
  padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: #fff; background: var(--accent); transition: background 0.12s, opacity 0.12s;
}
.tc-send:hover:not(:disabled) { background: var(--accent-hover); }
.tc-send:disabled { opacity: 0.45; cursor: default; }

/* ---- @/# autocomplete ---- */
.tc-suggest {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px);
  background: var(--bg-modal); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-popover); overflow: hidden; z-index: 5; max-height: 240px; overflow-y: auto;
}
.tc-suggest-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 10px; font-size: 13px; color: var(--text); transition: background 0.1s;
}
.tc-suggest-item:hover, .tc-suggest-item.active { background: var(--bg-hover); }
.tc-suggest-ic {
  width: 24px; height: 24px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.tc-suggest-av { border-radius: 50%; color: #fff; font-weight: 700; font-size: 10.5px; font-family: var(--font-display); text-transform: uppercase; }
.tc-suggest-text { display: flex; flex-direction: column; min-width: 0; }
.tc-suggest-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-suggest-sub { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- page-open highlight pulse (target lives in the main editor) ---- */
.tc-page-flash { animation: tc-page-pulse 1.2s ease; border-radius: var(--radius-pane); }
@keyframes tc-page-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  30%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 28%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---- sidebar unread dot (rendered by teams.js row) ---- */
.teams-sb-unread {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-soft); flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--frame);
}

@media (max-width: 800px) {
  .tc-drawer { width: 100%; max-width: 100vw; left: 0; border-left: none; }
}
