/*
 * inbox · area styles (Inbox, Chat, New message).
 * Every selector is an ib- class or scoped under one; shared classes (.row,
 * .card, .chip…) are only ever styled through an ib- parent or modifier.
 */

/* ── Thread list ───────────────────────────────────────────────────────── */
/* A grid, not the shared row's flex: at the largest text sizes the text
   column wraps and the avatar and unread count keep their places. */
.row.ib-thread {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: var(--s3);
  padding-top: 12px;
  padding-bottom: 12px;
}
.ib-thread .av {
  margin-top: 2px;
}
.ib-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}
.ib-name {
  font-size: var(--fs-body);
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-time {
  flex: none;
  font-size: var(--fs-foot);
  color: var(--text-2);
}
.ib-topic {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-foot);
  font-weight: 600;
  color: var(--text-2);
}
.ib-prev {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: var(--fs-sub);
  line-height: 1.38;
  color: var(--text-2);
}
.ib-unread .ib-name {
  font-weight: 700;
}
.ib-unread .ib-prev {
  color: var(--text);
}
.ib-unread .ib-time {
  color: var(--brand-ink);
  font-weight: 600;
}
.ib-count {
  align-self: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-foot);
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}
.ts-ax .ib-top,
.ts-xl .ib-top {
  flex-wrap: wrap;
}
.ts-ax .ib-name,
.ts-xl .ib-name {
  white-space: normal;
}
.ts-ax .row.ib-thread {
  grid-template-columns: 44px minmax(0, 1fr);
}
.ts-ax .ib-count {
  grid-column: 2;
  justify-self: start;
  margin-top: 6px;
}

/* ── Chat ──────────────────────────────────────────────────────────────── */
.ib-chat {
  padding: var(--s2) var(--s4) var(--s4);
}
.ib-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s3) var(--s4) var(--s2);
}
.ib-head .av-wrap .presence {
  width: 16px;
  height: 16px;
}
.ib-reply {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.ib-private {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: var(--s3) auto var(--s2);
  padding: 6px 12px;
  width: fit-content;
  max-width: 100%;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  font-size: var(--fs-foot);
  color: var(--text-2);
  text-align: center;
}
.ib-private .ic,
.ib-reply .ic,
.ib-system .ic {
  flex: none;
}
.ib-day {
  margin: var(--s5) 0 var(--s3);
  text-align: center;
  font-size: var(--fs-foot);
  font-weight: 600;
  color: var(--text-2);
}

.ib-msg {
  display: flex;
  gap: var(--s2);
  margin-top: 3px;
}
.ib-msg.tail {
  margin-bottom: var(--s3);
}
.ib-msg.me {
  justify-content: flex-end;
}
.ib-msg-av {
  flex: none;
  width: 32px;
  align-self: flex-end;
  margin-bottom: 22px;
}
.ib-msg-col {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  min-width: 0;
}
.ib-msg.me .ib-msg-col {
  align-items: flex-end;
}
.ib-bubble {
  padding: 10px 14px;
  border-radius: 20px;
  font-size: var(--fs-body);
  line-height: 1.38;
  overflow-wrap: anywhere;
}
.ib-msg.them .ib-bubble {
  background: var(--surface-sunken);
  color: var(--text);
}
.ib-msg.me .ib-bubble {
  background: var(--brand);
  color: #fff;
}
.ib-msg.them.tail .ib-bubble {
  border-bottom-left-radius: 6px;
}
.ib-msg.me.tail .ib-bubble {
  border-bottom-right-radius: 6px;
}
.hc .ib-msg.them .ib-bubble {
  box-shadow: inset 0 0 0 1px var(--slate-400);
}
.ib-msg-att {
  width: 100%;
  margin-bottom: 4px;
}
.ib-msg.me .ib-msg-att {
  display: flex;
  justify-content: flex-end;
}
.ib-receipt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 0 4px;
  font-size: var(--fs-cap);
  color: var(--text-2);
}
.ib-receipt.wait {
  color: var(--attn);
  font-weight: 600;
}
.ib-system {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: var(--s2) auto 0;
  max-width: 34ch;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--info-tint);
  font-size: var(--fs-foot);
  line-height: 1.4;
  color: var(--text);
}
.ib-system .ic {
  margin-top: 1px;
  color: var(--info);
}

/* Attachment cards (a reading, a result, a file) */
.ib-att {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  width: 100%;
  max-width: 280px;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--e1);
  text-align: left;
  color: var(--text);
  transition: transform var(--d-press) var(--ease-out);
}
button.ib-att:active {
  transform: scale(0.985);
}
.hc .ib-att {
  box-shadow: inset 0 0 0 1px var(--slate-400);
}
.ib-att-ic {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface-sunken);
}
.ib-att-ic .ic {
  width: 18px;
  height: 18px;
}
.ib-att-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.ib-att-k {
  font-size: var(--fs-foot);
  font-weight: 600;
  color: var(--text-2);
}
.ib-att-v {
  font-size: var(--fs-t3);
  line-height: 1.2;
}
.ib-att-v .unit {
  font-size: var(--fs-foot);
}
.ib-att-s {
  font-size: var(--fs-cap);
  color: var(--text-2);
}
.ib-att-pill {
  margin-top: 6px;
}

/* ── Composer (the screen's sticky foot) ──────────────────────────────── */
.ib-alert[hidden] {
  display: none;
}
.ib-alert .banner {
  margin: 0 0 var(--s3);
}
.ib-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.ib-attach {
  flex: none;
  color: var(--text-2);
}
textarea.ib-input {
  flex: 1;
  min-height: var(--tap);
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 22px;
  resize: none;
  line-height: 1.35;
  overflow-y: auto;
}
.ib-send {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  transition: opacity var(--d-fast) var(--ease-out), transform var(--d-press) var(--ease-out);
}
.ib-send:active:not([disabled]) {
  transform: scale(0.94);
}
.ib-send[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.ib-pending {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s2);
  padding: 4px 4px 4px 12px;
  border-radius: var(--r);
  background: var(--brand-tint);
  color: var(--brand-ink);
}
.ib-pending-ic .ic {
  width: 18px;
  height: 18px;
}
.ib-pending-t {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sub);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-pending-x {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--brand-ink);
}
.ts-ax .ib-pending-t,
.ts-xl .ib-pending-t {
  white-space: normal;
}

/* ── New message: pick a recipient, pick a topic ───────────────────────── */
.ib-pick-mark {
  flex: none;
  width: 30px;
  display: grid;
  place-items: center;
  color: var(--brand-ink);
}
.ib-pick-ring {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--line-strong);
}
.ib-topics .chip[aria-checked="true"] {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
.ib-eyebrow {
  margin: var(--s5) 0 var(--s2);
}
