/* BAND-inspired conversation styling, scoped to the choir chat. */
.chat {
  --bg: #fff;
  --surface: #f5f6f7;
  --fg: #24282c;
  --muted: #73797e;
  --line: #e9ecee;
  --gold: #d4efe4;
  --gold-ink: #25664e;
  --on-gold: #203e32;
  color-scheme: light;
  background: var(--bg);
  color: var(--fg);
  border-color: var(--line);
  border-radius: 18px;
  overflow: hidden;
  height: min(78dvh, 820px);
  font-family: var(--body);
}
.chat-side { background: #fafbfb; }
.cs-h { font-size: 12px; text-transform: none; letter-spacing: 0; padding: 18px 16px 8px; }
.chat .btn { color: var(--fg); border-color: var(--line); background: #fff; box-shadow: none; }
.cv { padding: 13px 16px; gap: 12px; }
.cv.on { background: #eaf5f0; box-shadow: inset 3px 0 0 #459476; }
.cv:hover { background: #f0f3f2; }
.cv-ic { border: 0; border-radius: 50%; width: 34px; height: 34px; background: #e3efe9; color: #45725e; font-size: 18px; font-weight: 500; }
.cv-t { gap: 3px; }
.cv-t strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv .person-avatar { margin: 0; }
.cv .badge { background: #388668; }
.chat .person-avatar { background: #e0ece6; color: #416552; }
.chat-main { grid-template-rows: auto auto minmax(0, 1fr) auto auto; background: #fff; }
.cm-h { min-height: 72px; padding: 14px 20px; background: #ffffffed; }
.cm-h > div { min-width: 0; gap: 3px; }
.cm-h strong { font-family: var(--display); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-h small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-back { flex-shrink: 0; border: 0; background: #f4f5f6; color: #32383c; }
.cm-msgs { padding: 12px 20px 24px; gap: 5px; overscroll-behavior: contain; scrollbar-width: thin; }
.cm-day { margin: 14px 0 18px; }
.cm-day span { display: inline-block; padding: 6px 13px; border-radius: 20px; background: #656c72; color: #fff; font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.msg { display: flex; align-items: flex-start; gap: 9px; max-width: min(620px, 94%); margin-top: 10px; flex-shrink: 0; }
.cm-avatar { flex: 0 0 32px; padding-top: 1px; }
.cm-avatar .person-avatar { margin: 0; }
.cm-message-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg-who { display: block; margin: 0 0 5px; line-height: 1.3; }
.msg-who strong { font-size: 11px; font-weight: 600; }
.msg-who span { color: #6e757b; text-transform: none; letter-spacing: 0; font-size: 10px; font-weight: 400; }
.cm-bubble-row { display: flex; align-items: flex-end; gap: 5px; max-width: 100%; }
.bubble { min-width: 0; background: #f0f0f3; border: 0; border-radius: 3px 17px 17px; padding: 9px 12px; font-size: 14px; line-height: 1.45; color: #24282c; }
.msg.mine .bubble { background: #d4efe4; border: 0; border-radius: 17px 3px 17px 17px; color: #243b32; }
.msg.mine .cm-message-body { align-items: flex-end; }
.msg.mine .cm-bubble-row { flex-direction: row-reverse; }
.msg time { color: #85898d; font-size: 9px; white-space: nowrap; margin: 0 0 2px; line-height: 1.3; }
.msg.grp { margin-top: 0; }
.msg.grp .bubble { border-radius: 17px; }
.cm-message-actions { gap: 3px; margin: 4px 0 0; }
.cm-message-actions button { min-height: 24px; padding: 2px 7px; border-color: #e6e8ea; background: #fff; color: #454b50; font-size: 10px; }
.cm-message-actions button span { font-size: 14px; }
.cm-message-actions button:hover, .cm-message-actions button[aria-pressed="true"] { color: #24523d; background: #edf8f2; border-color: #8bc8ac; }
.cm-compose { display: grid; grid-template-columns: auto minmax(0, 1fr) 40px; align-items: center; gap: 8px; padding: 12px; background: #fafbfc; border-color: #f0f1f3; }
.cm-compose textarea { grid-row: 2; grid-column: 2; width: 100%; margin: 0; min-height: 42px; padding: 11px 14px; background: #fff; color: #24282c; border: 1px solid #edf0f1; border-radius: 23px; font-size: 13px; line-height: 20px; box-shadow: 0 2px 8px #273e3210; }
.cm-compose textarea::placeholder { color: #868d92; }
.chat .cm-send { grid-row: 2; grid-column: 3; padding: 0; width: 40px; height: 40px; display: grid; place-items: center; background: #d4efe4; border: 0; color: #32684f; }
.cm-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chat .cm-send:hover { background: #bde1d1; }
.chat .cm-send:disabled { opacity: .5; }
.ca-tools { display: contents; }
.ca-actions { grid-column: 1; grid-row: 2; flex-wrap: nowrap; gap: 2px; margin: 0; }
.ca-actions .ca-icon { width: 32px; height: 36px; min-height: 36px; padding: 6px; border: 0; border-radius: 50%; background: transparent; color: #697379; display: grid; place-items: center; }
.ca-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ca-actions .ca-icon:hover { background: #eaf0ed; color: #32684f; }
.ca-actions .ca-icon[aria-pressed="true"] { background: #ffe6e3; color: #b53a33; }
.ca-actions .ca-icon[aria-pressed="true"] svg { fill: currentColor; }
.ca-actions small { display: none; }
#ca-pending, #ca-status, #ca-picker { grid-column: 1 / -1; min-width: 0; }
#ca-picker { grid-row: 4; margin: 0; background: #fff; border-radius: 12px; }
#ca-pending { grid-row: 3; }
#ca-status { grid-row: 5; color: #526c60; padding: 0; }
#ca-pending:empty, #ca-status:empty, #cm-action-status:empty { display: none; }
#cm-reply { grid-row: 1; grid-column: 1 / -1; position: relative; border: 0; border-left: 3px solid #8dc6ad; border-radius: 6px; padding: 7px 70px 7px 10px; margin: 0; background: #eef4f1; color: #354d41; }
#cm-reply .btn { position: absolute; right: 4px; top: 4px; border: 0; background: transparent; }
.cm-quote { border-color: #88bba4; background: #ffffff66; border-radius: 5px; color: #456052; white-space: normal; }
.cm-ro { background: #fafbfb; font-size: 12px; color: #68746d; }
#cm-action-status { background: #fff; color: #a33d34; font-size: 12px; }
.cm-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#cm-reaction-picker { color-scheme: light; position: fixed; inset: auto; margin: 0; width: min(312px, calc(100vw - 24px)); max-width: none; border: 1px solid #edf0ee; border-radius: 22px; background: #fff; color: #343b37; font-family: "Inter", "Pretendard", sans-serif; box-shadow: 0 5px 24px #233b3226; overflow: hidden; }
#cm-reaction-picker::backdrop { background: transparent; }
.cm-reaction-panel { padding: 8px; }
.cm-reaction-panel > .cm-sr-only { margin: -1px; }
.cm-reaction-options { display: flex; gap: 2px; margin: 0; }
.cm-reaction-options button { display: grid; place-items: center; flex: 1; min-width: 0; min-height: 44px; padding: 4px 0; border: 0; border-radius: 50%; background: #fff; font-size: 27px; }
.cm-reaction-options button:hover, .cm-reaction-options button[aria-pressed="true"] { background: #e8f5ee; }
.cm-picker-actions { display: flex; justify-content: space-between; border-top: 1px solid #f0f1f2; margin-top: 5px; padding-top: 5px; }
.cm-picker-actions button { font: inherit; font-size: 12px; min-height: 32px; padding: 5px 14px; border: 0; border-radius: 16px; color: #53615a; background: #fff; cursor: pointer; }
.cm-picker-actions button:hover { background: #f0f5f2; }
.cm-picker-actions button:last-child { margin-left: auto; }
.cm-reaction-options button:focus-visible, .cm-picker-actions button:focus-visible { outline: 2px solid #388668; outline-offset: -2px; }
@media (max-width: 760px) {
  .chat { height: max(470px, calc(100dvh - 210px)); min-height: 0; border-radius: 14px; }
  .cm-h { min-height: 64px; padding: 10px 12px; }
  .cm-h strong { font-size: 15px; }
  .cm-msgs { padding: 8px 10px 20px; }
  .msg { gap: 7px; max-width: 98%; }
  .msg.mine { max-width: 90%; }
  .bubble { font-size: 13px; padding: 8px 11px; }
  .cm-compose { padding: 9px 7px max(9px, env(safe-area-inset-bottom)); gap: 4px; grid-template-columns: auto minmax(0, 1fr) 36px; }
  .ca-actions .ca-icon { width: 28px; padding: 4px; }
  .chat .cm-send { width: 36px; height: 36px; }
  .cm-compose textarea { padding: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
  .cm-reaction-options button { transition: transform .12s ease, background .12s ease; }
  .cm-reaction-options button:hover { transform: translateY(-2px); }
}

.cm-reaction-options button span, .cm-message-actions button span { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
