/* Messages (2026-10-22): inbox, conversation, compose, badges and the announcement banner. */

.msg-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; vertical-align: 1px; }
.msg-badge[hidden] { display: none; }
.hd-msg { position: relative; }

.msg-wrap { display: grid; gap: 14px; }
.msg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.msg-head h2 { margin: 0; font-family: var(--font-display); }
.msg-head p { margin: 2px 0 0; }
.msg-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; align-items: start; }
.msg-list, .msg-pane { padding: 0; overflow: hidden; }
.msg-list-tabs { display: flex; gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--line-soft); }
.msg-list-tabs button { border: 0; background: none; padding: 8px 12px; font: inherit; font-weight: 700; color: var(--ink-soft);
  border-bottom: 2px solid transparent; cursor: pointer; }
.msg-list-tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.msg-threads { max-height: 68vh; overflow-y: auto; }
.msg-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; }
.msg-row:hover { background: #faf8ff; }
.msg-row.on { background: var(--accent-soft); }
.msg-row.unread .msg-row-top b { color: var(--accent-ink); }
.msg-row.unread .msg-snip { color: var(--ink); font-weight: 600; }
.msg-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.msg-row-top { display: flex; justify-content: space-between; gap: 8px; }
.msg-row-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-when { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; }
.msg-row-sub { display: flex; gap: 6px; align-items: center; font-size: .74rem; flex-wrap: wrap; }
.msg-row-sub:empty { display: none; }
.msg-snip { font-size: .84rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-unread { align-self: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 800; line-height: 22px; text-align: center; padding: 0 6px; }
.msg-empty { padding: 28px 16px; }

.msg-av { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800;
  font-size: .82rem; color: #fff; background: var(--av, #6A6480); }
.msg-av.ann { background: var(--gold-soft); font-size: 1.1rem; }
.msg-av.grp { background: var(--indigo-soft); font-size: 1.1rem; }
.msg-av.sm { width: 30px; height: 30px; font-size: .72rem; }

.msg-pane { display: flex; flex-direction: column; min-height: 420px; }
.msg-placeholder { margin: auto; text-align: center; color: var(--ink-faint); padding: 40px 16px; }
.msg-placeholder span { font-size: 2.4rem; }
.msg-pane-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.msg-pane-t { flex: 1; min-width: 0; }
.msg-pane-t h3 { margin: 0; font-size: 1.05rem; }
.msg-pane-t .faint { font-size: .78rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg-back { display: none; font-size: 1.3rem; text-decoration: none; color: var(--accent-ink); padding: 0 4px; }
.msg-log { flex: 1; overflow-y: auto; max-height: 58vh; padding: 14px; display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(180deg, #fbfaf7, #fff); }
.msg-day { text-align: center; margin: 6px 0; }
.msg-day span { font-size: .72rem; font-weight: 700; color: var(--ink-faint); background: var(--line-soft); border-radius: 999px; padding: 2px 10px; }
.msg-b { max-width: min(78%, 560px); align-self: flex-start; display: grid; gap: 2px; }
.msg-b.mine { align-self: flex-end; justify-items: end; }
.msg-b-name { font-size: .74rem; font-weight: 700; color: var(--ink-soft); padding-left: 4px; }
.msg-b-name i { font-style: normal; font-weight: 600; color: var(--ink-faint); text-transform: capitalize; }
.msg-b-body { background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 9px 13px;
  line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(38,33,59,.05); }
.msg-b.mine .msg-b-body { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); border-radius: 16px 16px 4px 16px; }
.msg-b.mine .msg-b-body a { color: #f6e7ff; }
.msg-b-at { font-size: .68rem; color: var(--ink-faint); padding: 0 4px; }
.msg-compose { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px 4px; border-top: 1px solid var(--line-soft); }
.msg-compose textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 220px; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: inherit; }
.msg-compose textarea:focus { outline: 2px solid var(--lilac-deep); outline-offset: 0; border-color: transparent; }
.msg-hint { margin: 0; padding: 0 14px 10px; font-size: .72rem; }
.msg-closed { padding: 12px 14px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-size: .88rem; color: var(--ink-soft); background: var(--gold-soft); }

.msg-modal { max-width: 560px; }
.msg-mode { display: flex; gap: 6px; margin-bottom: 12px; }
.msg-mode button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px; font: inherit; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; }
.msg-mode button.on { background: var(--accent-soft); border-color: var(--lilac-deep); color: var(--accent-ink); }
.msg-people { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.msg-person { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft);
  background: #fff; padding: 8px 10px; font: inherit; cursor: pointer; }
.msg-person span:last-child { display: grid; }
.msg-person .faint { font-size: .76rem; }
.msg-person:hover { background: #faf8ff; }
.msg-person.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.msg-check { gap: 8px; align-items: flex-start; font-size: .86rem; margin: -2px 0 12px; }
.msg-check input { margin-top: 3px; }

.msg-banner { position: fixed; right: 16px; bottom: 16px; z-index: 900; max-width: 420px; display: flex; gap: 10px; align-items: center;
  background: #fff; border: 1px solid var(--lilac); border-radius: 16px; padding: 12px 12px 12px 14px;
  box-shadow: 0 16px 40px -18px rgba(59,31,122,.6); animation: msg-in .35s ease-out; }
.msg-banner-i { font-size: 1.5rem; }
.msg-banner-t { flex: 1; min-width: 0; display: grid; }
.msg-banner-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-banner-t span { font-size: .78rem; color: var(--ink-soft); }
.msg-banner-x { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--ink-faint); cursor: pointer; padding: 4px; }
@keyframes msg-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 760px) {
  .msg-grid { grid-template-columns: 1fr; }
  .msg-wrap.has-thread .msg-list { display: none; }
  .msg-wrap:not(.has-thread) .msg-pane { display: none; }
  .msg-back { display: inline-block; }
  .msg-log { max-height: 60vh; }
  .msg-b { max-width: 88%; }
  .msg-head .btn { width: 100%; }
  .msg-banner { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .hd-msg-l { display: none; }
}
@media (prefers-reduced-motion: reduce) { .msg-banner { animation: none; } }
