/* ==========================================================================
   Messages · direct and group conversations. The Club's palette (members.css), a quiet aurora behind
   (backdrops.js "basic"), two glass panes: the inbox and the conversation. Loaded on every page: the
   badge, the alert toast and the card button live here too.
   ========================================================================== */
.ms-page { --c: #1d8fc4; min-height: calc(100vh - 60px); padding-bottom: 16px; }
.ms-bg .mc-bubbles i { --bubble: rgba(120, 220, 255, .28); }
.ms-back { margin-bottom: 8px; }
.ms-shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; height: calc(100vh - 128px); min-height: 480px; max-width: 1180px; margin: 0 auto; }
.ms-list, .ms-thread { border-radius: 26px; background: rgba(10, 16, 32, .72); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ms-list-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 20px 18px 10px; }
.ms-list-head h1 { margin: 0; color: #fff; font: 600 30px/1 var(--mc-serif); }
.ms-list-head .mc-kicker { margin-bottom: 6px; }
.ms-new { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #1d8fc4, #3fa356); box-shadow: 0 8px 20px rgba(29, 143, 196, .4); }
.ms-new svg, .ms-head-back svg, .ms-head-menu svg, .ms-attach svg, .ms-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ms-head-menu svg { fill: currentColor; stroke: none; }
.ms-search { display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; padding: 0 12px; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .08); }
.ms-search svg { width: 16px; height: 16px; fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 2; flex: none; }
.ms-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font: 15px system-ui, sans-serif; padding: 10px 0; outline: none; }
.ms-search input::placeholder { color: rgba(255, 255, 255, .4); }
.ms-threads { flex: 1; overflow-y: auto; padding: 4px 8px 8px; scrollbar-width: thin; }
.ms-empty { color: rgba(255, 255, 255, .55); text-align: center; padding: 30px 16px; font-size: 14px; line-height: 1.5; }
.ms-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; width: 100%; text-align: left; padding: 10px 10px; border-radius: 16px; border: 0; background: transparent; color: #fff; cursor: pointer; transition: background .2s ease; opacity: 0; animation: ev-rise .5s var(--mc-ease) forwards; animation-delay: calc(var(--i, 0) * 30ms); }
.ms-row:hover { background: rgba(255, 255, 255, .07); }
.ms-row.is-on { background: rgba(255, 255, 255, .12); }
.ms-row b { display: block; font: 600 15px/1.25 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-row small { display: block; color: rgba(255, 255, 255, .6); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ms-row.is-unread b { color: #fff; }
.ms-row.is-unread small { color: rgba(255, 255, 255, .85); font-weight: 600; }
.ms-row-right { display: grid; justify-items: end; gap: 5px; }
.ms-row time { font: 600 10.5px/1 var(--mc-mono); color: rgba(255, 255, 255, .45); letter-spacing: .04em; }
.ms-dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font: 700 10.5px/1 system-ui; color: #052e1b; background: #34d399; box-shadow: 0 0 12px rgba(52, 211, 153, .6); }
.ms-faces { position: relative; width: 46px; height: 46px; }
.ms-faces .ev-face { width: 46px; height: 46px; margin: 0; font-size: 17px; border-color: rgba(255, 255, 255, .5); cursor: pointer; }
.ms-faces.is-group .ev-face { width: 30px; height: 30px; font-size: 12px; position: absolute; }
.ms-faces.is-group .ev-face:nth-child(1) { left: 0; top: 0; }
.ms-faces.is-group .ev-face:nth-child(2) { right: 0; bottom: 0; }
.ms-faces.is-group .ev-face:nth-child(n+3) { display: none; }
.ms-list-foot { padding: 10px 14px 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 8px; }
.ms-pref { display: grid; gap: 5px; }
.ms-pref span { font: 700 10px/1 var(--mc-mono); letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.ms-pref select { width: 100%; padding: 9px 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .08); color: #fff; font: 14px system-ui, sans-serif; }
.ms-pref select option { color: #13233f; }
.ms-alerts { appearance: none; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #fff; border-radius: 10px; padding: 9px 12px; font: 600 13px/1 system-ui; cursor: pointer; }

/* the conversation */
.ms-none { flex: 1; display: grid; place-content: center; text-align: center; color: rgba(255, 255, 255, .7); padding: 20px; }
.ms-none-art { width: 72px; height: 72px; margin: 0 auto 10px; color: rgba(255, 255, 255, .35); }
.ms-none h2 { margin: 0; color: #fff; font: 600 26px/1.1 var(--mc-serif); }
.ms-none p { margin: 8px 0 0; font-size: 14px; max-width: 320px; }
.ms-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.ms-head-back, .ms-head-menu { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.ms-head-back { display: none; }
.ms-head-faces { display: flex; }
.ms-head-faces .ev-face { width: 38px; height: 38px; margin-left: -10px; border-color: rgba(20, 28, 48, .9); cursor: pointer; }
.ms-head-faces .ev-face:first-child { margin-left: 0; }
.ms-head-who { flex: 1; min-width: 0; display: grid; }
.ms-head-who b { color: #fff; font: 600 17px/1.2 var(--mc-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-head-who small { color: rgba(255, 255, 255, .55); font-size: 12.5px; }
.ms-log { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; overscroll-behavior: contain; }
.ms-more { align-self: center; margin-bottom: 10px; background: rgba(255, 255, 255, .08); border: 0; color: #fff; border-radius: 10px; padding: 7px 12px; font: 600 12.5px/1 system-ui; cursor: pointer; }
.ms-day { align-self: center; margin: 10px 0 6px; font: 700 10px/1 var(--mc-mono); letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .4); }
.ms-msg { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; align-items: end; max-width: min(78%, 620px); animation: ms-in .35s var(--mc-ease) backwards; }
@keyframes ms-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.ms-msg.is-mine { grid-template-columns: minmax(0, 1fr); align-self: flex-end; }
.ms-msg.is-same { margin-top: -2px; }
.ms-msg .ev-face { width: 32px; height: 32px; margin: 0; font-size: 12px; border-color: transparent; cursor: pointer; }
.ms-msg.is-same .ev-face { visibility: hidden; }
.ms-body { position: relative; display: grid; gap: 4px; }
.ms-name { font: 700 10.5px/1 var(--mc-mono); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .5); margin: 0 0 2px 4px; }
.ms-bubble { position: relative; padding: 10px 14px; border-radius: 20px; font-size: 15.5px; line-height: 1.5; color: #13233f; background: #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, .25); white-space: pre-wrap; overflow-wrap: anywhere; cursor: default; }
.ms-msg:not(.is-mine) .ms-bubble { border-bottom-left-radius: 6px; }
.ms-msg.is-mine .ms-bubble { color: #fff; background: linear-gradient(135deg, #1d8fc4, #3fa356); border-bottom-right-radius: 6px; }
.ms-bubble.is-deleted { font-style: italic; opacity: .6; }
.ms-bubble a { color: inherit; text-decoration: underline; }
.ms-photo { display: block; max-width: 100%; max-height: 360px; border-radius: 18px; cursor: zoom-in; box-shadow: 0 10px 26px rgba(0, 0, 0, .25); }
.ms-meta { display: flex; gap: 8px; align-items: center; padding: 0 6px; font: 600 10px/1 var(--mc-mono); letter-spacing: .06em; color: rgba(255, 255, 255, .38); }
.ms-msg.is-mine .ms-meta { justify-content: flex-end; }
.ms-rx { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -2px; }
.ms-msg.is-mine .ms-rx { justify-content: flex-end; }
.ms-rx button { appearance: none; border: 1px solid rgba(255, 255, 255, .15); background: rgba(10, 16, 32, .8); color: #fff; border-radius: 10px; padding: 3px 8px; font: 600 12px/1 system-ui; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.ms-rx button[aria-pressed="true"] { background: #fff; color: #13233f; border-color: #fff; }
.ms-bar { position: absolute; z-index: 4; bottom: calc(100% + 6px); left: 0; display: flex; gap: 2px; padding: 5px; border-radius: 10px; background: rgba(10, 16, 32, .96); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); animation: ms-pop .25s cubic-bezier(.34, 1.56, .64, 1); }
.ms-msg.is-mine .ms-bar { left: auto; right: 0; }
@keyframes ms-pop { from { opacity: 0; transform: translateY(6px) scale(.9); } }
.ms-bar button { appearance: none; border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.ms-bar button:hover { transform: scale(1.25); background: rgba(255, 255, 255, .1); }
.ms-bar button[aria-pressed="true"] { background: rgba(255, 255, 255, .18); }
.ms-bar .ms-bar-del { font-size: 13px; color: #fca5a5; width: auto; padding: 0 10px; }
.ms-composer { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: 8px; align-items: end; padding: 10px 12px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.ms-attach, .ms-send { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 0; }
.ms-attach { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8); }
.ms-send { color: #fff; background: linear-gradient(135deg, #1d8fc4, #3fa356); box-shadow: 0 8px 20px rgba(29, 143, 196, .4); }
.ms-send:disabled { opacity: .4; cursor: default; }
.ms-composer textarea { resize: none; max-height: 160px; min-height: 40px; box-sizing: border-box; padding: 10px 14px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .08); color: #fff; font: 15.5px/1.4 system-ui, sans-serif; outline: none; scrollbar-width: none; }
.ms-composer textarea:focus { border-color: rgba(75, 227, 255, .6); box-shadow: 0 0 0 4px rgba(75, 227, 255, .15); }
.ms-composer textarea::placeholder { color: rgba(255, 255, 255, .4); }
.ms-preview { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.ms-preview img { height: 64px; border-radius: 10px; }
.ms-preview button { appearance: none; border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 10px; padding: 6px 10px; font: 600 12px/1 system-ui; cursor: pointer; }
.ms-typing { font-size: 12px; color: rgba(255, 255, 255, .45); padding: 0 16px 4px; }
.ms-seen { font-size: 10.5px; color: rgba(255, 255, 255, .45); text-align: right; padding: 0 8px; }
.ms-menu { position: absolute; z-index: 6; right: 12px; top: 56px; display: grid; min-width: 200px; padding: 6px; border-radius: 16px; background: rgba(10, 16, 32, .98); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 20px 50px rgba(0, 0, 0, .5); animation: ms-pop .2s ease; }
.ms-menu button { appearance: none; border: 0; background: transparent; color: #fff; text-align: left; padding: 10px 12px; border-radius: 10px; font: 500 14px/1 system-ui; cursor: pointer; }
.ms-menu button:hover { background: rgba(255, 255, 255, .08); }
.ms-menu button.is-danger { color: #fca5a5; }
.ms-thread { position: relative; }

/* the group picker */
.ms-picker { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(3, 8, 20, .7); backdrop-filter: blur(10px); overflow-y: auto; }
.ms-picker-card { width: min(560px, 100%); }
.ms-picker-search { margin: 14px 0 10px; background: rgba(19, 35, 63, .06); border-color: rgba(19, 35, 63, .1); }
.ms-picker-search input { color: #13233f; }
.ms-picker-search input::placeholder { color: #8a96a8; }
.ms-picker-search svg { stroke: #5b6b85; }
.ms-picks { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; }
.ms-pick { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; border: 1px solid transparent; background: rgba(255, 255, 255, .75); cursor: pointer; text-align: left; color: #13233f; }
.ms-pick .ev-face { width: 36px; height: 36px; margin: 0; }
.ms-pick b { font-size: 14px; }
.ms-pick small { display: block; color: #5b6b85; font-size: 12px; }
.ms-pick[aria-pressed="true"] { background: #fff; border-color: var(--mc-ocean); box-shadow: 0 0 0 2px rgba(29, 143, 196, .25); }
.ms-pick[aria-pressed="true"]::after { content: "✓"; color: var(--mc-ocean); font-weight: 700; }

/* mobile: one pane at a time */
@media (max-width: 760px) {
  .ms-shell { grid-template-columns: 1fr; height: calc(100vh - 110px); }
  .ms-shell.is-open .ms-list { display: none; }
  .ms-shell:not(.is-open) .ms-thread { display: none; }
  .ms-head-back { display: grid; }
  .ms-msg { max-width: 88%; }
  .ms-back { display: none; }
}

/* everywhere: the badge on the account chip and the drawer, the alert toast, the card button */
.ms-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; font: 700 10.5px/1 system-ui; color: #052e1b; background: #34d399; box-shadow: 0 0 0 2px #0b1020, 0 0 12px rgba(52, 211, 153, .7); pointer-events: none; animation: ms-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.account-chip { position: relative; }
.drawer-messages { position: relative; }
.drawer-messages .ms-badge { top: 10px; right: 12px; }
.ms-toast { position: fixed; z-index: 2147483001; left: 50%; top: 70px; transform: translateX(-50%); display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; max-width: min(420px, calc(100vw - 24px)); padding: 10px 14px 10px 10px; border-radius: 18px; background: rgba(10, 16, 32, .96); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); color: #fff; text-decoration: none; animation: ms-toast .45s var(--mc-ease); }
@keyframes ms-toast { from { opacity: 0; transform: translate(-50%, -16px); } }
.ms-toast .ev-face { width: 40px; height: 40px; margin: 0; }
.ms-toast b { display: block; font-size: 14px; }
.ms-toast small { display: block; color: rgba(255, 255, 255, .7); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-toast.is-gone { opacity: 0; transition: opacity .4s ease; }
.mc-msg-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; align-self: flex-start; padding: 9px 14px; border-radius: 10px; border: 0; cursor: pointer; color: #fff; background: linear-gradient(135deg, #1d8fc4, #3fa356); font: 600 13.5px/1 system-ui; box-shadow: 0 8px 20px rgba(29, 143, 196, .35); }
.mc-msg-btn svg { width: 16px; height: 16px; }
.mc-msg-btn:disabled { opacity: .6; cursor: default; }
.mc-msg-why { font-size: 12.5px; color: var(--mc-muted); margin: 6px 0 0; }
.mc-cover-msg { position: absolute; right: 12px; top: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: rgba(10, 16, 32, .55); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .25); transition: transform .2s var(--mc-ease), background .2s ease; }
.mc-cover-msg svg { width: 18px; height: 18px; }
.mc-cover-msg:hover { transform: scale(1.1); background: #1d8fc4; }
.ms-acct { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: inherit; text-decoration: none; }
.ms-acct-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #1d8fc4, #3fa356); color: #fff; position: relative; }
.ms-acct-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-acct b { display: block; font-size: 15px; }
.ms-acct small { display: block; opacity: .7; font-size: 12.5px; }
.ms-acct-go { font: 600 13px/1 system-ui; opacity: .8; }
