/* The Team messages demo on /group-practices (templates/_team_demo.html), drawn like the real /app/huddle screen
   (templates/team_messages.html, static/messages-thread.css, static/team-messages.css): the conversations beside the
   open one, initials with presence dots, bubbles, the composer and its note. The frame, cursor and caption are the
   home page demos' (static/features.css .tdemo, static/tour.js). Theme variables only, so night mode follows.
   The thread has a fixed height, so a new message never moves the page. Classes start tmd-. */
.tmd { padding: 14px; }
.tmd [hidden] { display: none !important; }
.tmd-app { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr); gap: 12px; align-items: stretch; }

/* The conversations */
.tmd-list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; display: grid; gap: 2px; align-content: start; }
.tmd-h { margin: 10px 8px 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tmd-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink); padding: 7px 8px; border-radius: 10px; font: inherit; cursor: pointer; }
.tmd-row:hover { background: var(--ground); }
.tmd-row.on { background: var(--soft); }
.tmd-who { display: grid; min-width: 0; }
.tmd-who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmd-who small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmd-av { position: relative; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); color: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--ink)); }
.tmd-all { color: var(--accent); background: var(--soft); }
.tmd-sys { color: var(--info, var(--accent)); background: var(--info-soft, var(--soft)); }
.tmd-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 30%, var(--surface)); }
.tmd-dot.online { background: var(--ok); box-shadow: none; }
.tmd-dot.away { background: var(--warn-line); box-shadow: none; }
.tmd-av .tmd-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2px solid var(--surface); box-sizing: border-box; }
.tmd-av .tmd-dot.offline { background: var(--surface); }
.tmd-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 8px 2px; font-size: 12px; color: var(--muted); }
.tmd-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink, #fff); font-size: 11px; font-weight: 800; }
.tmd-count.pop { animation: tmd-pop .5s ease-out; }
@keyframes tmd-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* The open conversation */
.tmd-thread { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tmd-head { display: grid; padding: 12px 16px 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.tmd-head b { font-size: 16px; }
.tmd-head small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tmd-scroll { height: 250px; overflow: hidden; padding: 12px 16px 8px; display: flex; flex-direction: column; justify-content: flex-end; }
.tmd-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tmd-day { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tmd-day::before, .tmd-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tmd-msg { display: grid; justify-items: start; gap: 3px; max-width: 82%; }
.tmd-msg.me { align-self: flex-end; justify-items: end; }
.tmd-msg p { margin: 0; padding: 9px 13px; border-radius: 14px 14px 14px 5px; background: var(--ground); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tmd-msg.me p { border-radius: 14px 14px 5px 14px; background: var(--soft); border-color: transparent; }
.tmd-msg.sys p { background: var(--info-soft, var(--soft)); border-color: var(--info-line, var(--line)); border-left: 4px solid var(--info, var(--accent)); }
.tmd-msg small { font-size: 11px; color: var(--muted); padding: 0 4px; }
.tmd-from { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 0 4px; }
.tmd-msg.sys .tmd-from { color: var(--info, var(--accent)); }
.tmd-from em { font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--info-soft, var(--soft)); }
.tmd-mini { font-style: normal; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 9px; font-weight: 800;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); color: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--ink)); }
.tmd-msg.added { animation: tmd-in .35s ease-out; }
@keyframes tmd-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tmd-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 0; }

/* The composer */
.tmd-compose { border-top: 1px solid var(--line); padding: 10px 16px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tmd .tmd-compose input[type=text] { margin: 0; min-width: 0; }
.tmd-note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
/* The composer and the Notices note share one spot (only one shows), so switching never changes the height */
.tmd-foot { display: grid; border-top: 1px solid var(--line); }
.tmd-foot > * { grid-area: 1 / 1; }
.tmd-compose { border-top: 0; }
.tmd-auto { margin: 0; padding: 14px 16px 16px; font-size: 12px; color: var(--muted); visibility: hidden; }
.tmd.is-notices .tmd-auto { visibility: visible; }
.tmd.is-notices .tmd-compose { visibility: hidden; }
.tmd-head small, .tmd-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Beside it: the plain-words points */
.tmd-wrap { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tmd-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tmd-points li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.tmd-points b { font-size: 15px; }
.tmd-points span { font-size: 14px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

/* On the home pages' Group practices band */
.tmd-home { margin-top: 28px; display: grid; gap: 10px; }
.tmd-home h3 { margin: 0; font-size: 20px; font-weight: 800; }
.tmd-home > p { margin: 0; color: var(--muted); max-width: 720px; }

@media (prefers-reduced-motion: reduce) {
  .tmd-count.pop, .tmd-msg.added { animation: none; }
}
@media (max-width: 900px) {
  .tmd-wrap { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: the conversations become a compact strip above the open one */
@media (max-width: 640px) {
  .tmd { padding: 52px 10px 10px; }   /* room above for the Replay button, so it never covers a conversation */
  .tmd-app { grid-template-columns: minmax(0, 1fr); }
  .tmd-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 4px; padding: 8px; }
  .tmd-h, .tmd-legend { grid-column: 1 / -1; margin: 4px 4px 0; }
  .tmd-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 7px; padding: 6px; }
  .tmd-av { width: 30px; height: 30px; font-size: 11px; }
  .tmd-who small { display: none; }
  .tmd-who b { font-size: 13px; }
  .tmd-scroll { height: 230px; padding: 10px 12px 6px; }
  .tmd-msg { max-width: 90%; }
  .tmd-compose { padding: 10px 12px 12px; }
}
