/* 團隊 (P7) on the phone: avatar tiles, the roster, a bot's sheet, the
   collaboration trail, @mention above the composer, bylines. 墨 Mono: a bot's
   tone lives only on its own tile; amber still means "waits for you". */

/* ── Avatar tile ───────────────────────────────────────────── */
.bot-av {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--c-bot-ink-bg);
  color: var(--c-bot-ink-fg);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  letter-spacing: 0;
}
.bot-av[data-size="sm"] {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: var(--text-2xs);
}
.bot-av[data-size="lg"] {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  font-size: var(--text-lg);
}
.bot-av[data-tone="ink"] {
  box-shadow: inset 0 0 0 1px var(--c-line-strong);
}
.bot-av[data-tone="vermilion"] {
  background: var(--c-bot-vermilion-bg);
  color: var(--c-bot-vermilion-fg);
}
.bot-av[data-tone="jade"] {
  background: var(--c-bot-jade-bg);
  color: var(--c-bot-jade-fg);
}
.bot-av[data-tone="indigo"] {
  background: var(--c-bot-indigo-bg);
  color: var(--c-bot-indigo-fg);
}
.bot-av[data-tone="ochre"] {
  background: var(--c-bot-ochre-bg);
  color: var(--c-bot-ochre-fg);
}
.bot-av[data-tone="plum"] {
  background: var(--c-bot-plum-bg);
  color: var(--c-bot-plum-fg);
}

/* ── Roster ────────────────────────────────────────────────── */
.tm-list,
.tp-list,
.tm-rules {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tm-list {
  margin-bottom: var(--space-6);
}
.tm-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  min-height: 88px;
  padding: var(--space-4) 0;
  border: 0;
  border-bottom: 1px solid var(--c-line);
  background: transparent;
  color: var(--c-ink);
  text-align: left;
}
.tm-row > svg {
  flex: none;
  color: var(--c-ink-faint);
}
.tm-row:active {
  background: var(--c-hover);
}
.tm-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.tm-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
}
.tm-name b {
  font-weight: var(--weight-semibold);
}
.tm-lead {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--space-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  color: var(--c-ink-soft);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  vertical-align: middle;
}
.cs-title .tm-lead {
  margin-left: var(--space-2);
}
.tm-role {
  overflow: hidden;
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-now {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
}
.tm-now span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-now .dot {
  width: 7px;
  height: 7px;
}
.tm-now[data-state="busy"] {
  color: var(--c-ink-soft);
}
.tm-now[data-state="busy"] .dot {
  background: var(--c-ink);
}
.tm-now[data-state="waiting"] {
  color: var(--c-attention);
}
.tm-now[data-state="waiting"] .dot {
  background: var(--c-attention);
  box-shadow: 0 0 0 3px var(--c-attention-soft);
}
.tm-row[data-state="waiting"] .tm-role {
  color: var(--c-ink-soft);
}

.tm-rules {
  margin-bottom: var(--space-4);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
}
.tm-rules li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 52px;
  padding: 0 var(--space-4);
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
}
.tm-rules li + li {
  border-top: 1px solid var(--c-line);
}
.tm-rules b {
  color: var(--c-ink);
  font-weight: var(--weight-medium);
  text-align: right;
}

/* ── Collaboration trail ───────────────────────────────────── */
.tp-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4) 0;
  border: 0;
  border-bottom: 1px solid var(--c-line);
  background: transparent;
  color: var(--c-ink);
  text-align: left;
}
.tp-row > svg {
  flex: none;
  align-self: center;
  color: var(--c-ink-faint);
}
.tp-row:active {
  background: var(--c-hover);
}
.tp-pair {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding-top: 1px;
}
.tp-arrow {
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
}
.tp-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tp-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.tp-head b {
  font-weight: var(--weight-semibold);
}
.tp-kind {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  /* Sheets are drawn on the raised surface: the chip needs its own fill and edge. */
  background: var(--c-active);
  box-shadow: inset 0 0 0 1px var(--c-line-strong);
  color: var(--c-ink-soft);
  font-size: var(--text-2xs);
  white-space: nowrap;
}
.tp-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--c-ink-soft);
  font-size: var(--text-sm);
  line-height: var(--leading-ui);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.tp-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
}
.tp-status {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--c-active);
  box-shadow: inset 0 0 0 1px var(--c-line-strong);
  color: var(--c-ink-soft);
  font-size: var(--text-2xs);
  white-space: nowrap;
}
.tp-status[data-status="done"] {
  background: var(--c-success-soft);
  box-shadow: none;
  color: var(--c-success);
}
.tp-status[data-status="denied"],
.tp-status[data-status="refused"],
.tp-status[data-status="failed"] {
  background: var(--c-danger-soft);
  box-shadow: none;
  color: var(--c-danger);
}

/* A request's sheet: steps on a hairline, then the teammate's conversation. */
.tp-sheet .cs-origin {
  flex-wrap: wrap;
}
.tp-steps {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
}
.tp-step {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0 0 var(--space-3) var(--space-5);
  color: var(--c-ink-soft);
  font-size: var(--text-sm);
}
.tp-step::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: -2px;
  left: 3px;
  width: 1px;
  background: var(--c-line-strong);
}
.tp-step:last-child::before {
  display: none;
}
.tp-step-dot {
  position: absolute;
  top: 6px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-ink-faint);
}
.tp-step[data-kind="answered"] .tp-step-dot {
  background: var(--c-success);
}
.tp-step[data-kind="card"] .tp-step-dot,
.tp-step[data-kind="approval"] .tp-step-dot {
  background: var(--c-attention);
}
.tp-step[data-kind="denied"] .tp-step-dot,
.tp-step[data-kind="refused"] .tp-step-dot,
.tp-step[data-kind="failed"] .tp-step-dot {
  background: var(--c-danger);
}
.tp-step-word {
  flex: 1;
  min-width: 0;
}
.tp-step-word span {
  color: var(--c-ink-muted);
}
.tp-step-at {
  flex: none;
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
.tp-convo {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--c-surface-sunken);
}
.tp-convo .group-title {
  margin: 0;
}
.tp-msg {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}
.tp-msg p {
  margin: 0;
  color: var(--c-ink-soft);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  overflow-wrap: anywhere;
}
.tp-msg[data-role="system"] p {
  color: var(--c-ink-muted);
}
.tp-msg[data-role="system"] b {
  margin-right: 2px;
  color: var(--c-ink-soft);
  font-weight: var(--weight-medium);
}
.tp-msg-sys {
  color: var(--c-ink-faint);
  font-size: var(--text-sm);
  text-align: center;
}
.tp-actions,
.tb-sheet .cs-actions {
  grid-template-columns: 1fr;
}
.btn.secondary[data-tone="danger"] {
  border-color: var(--c-danger-line);
  color: var(--c-danger);
}

/* ── A bot's sheet ─────────────────────────────────────────── */
.tb-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.tb-hero-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tb-hero .cs-title {
  font-size: var(--text-xl);
}
.tb-hero .cs-summary {
  font-size: var(--text-sm);
}
.tb-sheet > .tm-now {
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--c-surface-sunken);
  font-size: var(--text-sm);
}
.tb-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3) var(--space-5);
  margin: var(--space-1) 0;
  font-size: var(--text-sm);
}
.tb-facts dt {
  color: var(--c-ink-muted);
}
.tb-facts dd {
  margin: 0;
  color: var(--c-ink);
  overflow-wrap: anywhere;
}
.tb-instr {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--c-line-strong);
  color: var(--c-ink-soft);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}
.tb-instr .group-title {
  margin: 0;
}
.tb-recent-title {
  margin: var(--space-2) 0 0;
}
.tb-sheet .tp-list .mem-empty {
  padding: var(--space-2) 0;
  text-align: left;
}

/* ── Chat: bylines, @mention list, who the message goes to ── */
.msg-by {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--c-ink-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.mention {
  margin-bottom: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-lg);
  background: var(--c-surface-raised);
  box-shadow: var(--shadow-md);
}
.mention-head {
  margin: 0;
  padding: var(--space-1) var(--space-3) var(--space-2);
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
}
.mention-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--c-ink);
  text-align: left;
}
.mention-row:active,
.mention-row:first-of-type {
  background: var(--c-active);
}
.mention-name {
  flex: none;
  font-size: var(--text-md);
}
.mention-role {
  overflow: hidden;
  min-width: 0;
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.to-slot:empty {
  display: none;
}
.to-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  margin: 0 0 var(--space-2) var(--space-2);
  padding: 0 var(--space-1) 0 5px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  background: var(--c-surface-raised);
  color: var(--c-ink-soft);
  font-size: var(--text-xs);
}
.to-chip > span:not(.bot-av) {
  padding-right: var(--space-2);
}
.to-chip-x {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: calc(var(--space-2) * -1);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-ink-faint);
}

/* The composer's own border shows focus; no second ring inside it. */
.composer-input:focus-visible {
  box-shadow: none;
}

.tb-note {
  margin: var(--space-2) 0 0;
  color: var(--c-ink-faint);
  font-size: var(--text-xs);
}
