/* ============================================================
   Resonance — the messages page (WO7).
   Two panes on a wide screen, one at a time on a phone (390-first).
   Sits on assets/style.css + assets/member.css; borrows the network
   page's warmth: charcoal for people you know, cream for the room.
   ============================================================ */

.msg-wrap { max-width: 1020px; margin: 0 auto; padding: 0 24px 70px; }
.msg-panes { display: grid; grid-template-columns: 320px 1fr; gap: 22px; padding-top: 34px; min-height: 60vh; }

/* ---------- the list pane ---------- */
.msg-list h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 16px; }
.msg-rows { display: flex; flex-direction: column; gap: 10px; }
.msg-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; background: var(--white); border: 1px solid rgba(33,29,22,.07); border-left: 3px solid var(--charcoal); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; transition: transform .18s, box-shadow .18s; }
.msg-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.msg-row.open { border-left-color: var(--orange); }
.msg-row .who { font-weight: 700; color: var(--ink); }
.msg-row .line { display: block; font-size: .86rem; color: var(--ink-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.msg-row .msg-main { flex: 1; min-width: 0; }
/* the per-thread unread badge — the sanctioned count */
.msg-unread { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: var(--charcoal); font-size: .76rem; font-weight: 700; }
/* a muted thread: a word where the number would be, and nothing louder */
.msg-muted { flex: none; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #A79E8D; }
.msg-empty { background: var(--white); border: 1.5px dashed rgba(33,29,22,.16); border-radius: var(--radius); padding: 24px 22px; color: var(--ink-soft); }
.msg-empty p { margin: 0 0 12px; }
.msg-empty p:last-child { margin: 0; }

/* ---------- the thread pane ---------- */
.msg-thread { display: flex; flex-direction: column; background: var(--white); border: 1px solid rgba(33,29,22,.07); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 60vh; }
/* four quiet controls share this row on a phone (back, mute, report, block), so the
   name is the thing that gives way — never the row */
.msg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(33,29,22,.08); }
.msg-head .who { font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .msg-menu { flex: none; }
.msg-back { display: none; font: inherit; font-weight: 700; background: none; border: none; cursor: pointer; color: var(--orange-deep); padding: 6px 8px 6px 0; }
.msg-menu { font: inherit; font-size: .85rem; color: #8A8271; background: none; border: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(138,130,113,.45); }
.msg-menu:hover { color: var(--ink); }
/* WO9 — the way into this pair's Fast Friends room. Its own slim line under the header,
   not a fifth control inside it: at 390px that row is already exactly full, and the
   safety controls are not the things that give way. */
.msg-ffbar { display: flex; align-items: center; gap: 9px; padding: 9px 16px; border-bottom: 1px solid rgba(33,29,22,.08); background: linear-gradient(180deg, rgba(252,235,210,.55), rgba(255,253,248,0)); color: var(--orange-deep); font-size: .87rem; font-weight: 600; text-decoration: none; }
.msg-ffbar:hover { background: var(--orange-soft); color: var(--ink); text-decoration: none; }
.msg-ffbar svg { flex: none; }
.msg-ffbar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-ffbar .go { margin-left: auto; flex: none; }
.msg-ffbar:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ring); }
.msg-scroll { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg-bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: .97rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: break-word; }
.msg-bubble.them { align-self: flex-start; background: #F5F1E8; color: var(--ink); border-bottom-left-radius: 5px; }
.msg-bubble.mine { align-self: flex-end; background: var(--charcoal); color: var(--cream); border-bottom-right-radius: 5px; }
.msg-quietnote { text-align: center; font-size: .82rem; color: #A79E8D; padding: 8px 0; }

/* the composer */
.msg-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid rgba(33,29,22,.08); }
.msg-compose textarea { flex: 1; font: inherit; font-size: .97rem; border: 1.5px solid rgba(33,29,22,.14); border-radius: 14px; padding: 10px 13px; resize: none; max-height: 130px; background: var(--cream); }
.msg-compose textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--ring); }
.msg-send { font: inherit; font-weight: 700; border: none; cursor: pointer; background: var(--orange); color: var(--charcoal); border-radius: 999px; padding: 11px 20px; }
.msg-send[disabled] { opacity: .55; cursor: default; }
.msg-cap { padding: 0 16px 10px; font-size: .82rem; color: #A0522D; }
.msg-cap[hidden] { display: none; }

/* the confirm boxes (block / report), shared look with the network sheet */
.msg-confirm { margin: 0 14px 12px; background: #F5F1E8; border-radius: 14px; padding: 12px 14px; }
.msg-confirm .m-fine { margin: 0 0 10px; }
.msg-confirm textarea { width: 100%; font: inherit; font-size: .95rem; border: 1.5px solid rgba(33,29,22,.14); border-radius: 12px; padding: 9px 11px; margin-bottom: 10px; background: var(--white); resize: vertical; }

/* ---------- one pane at a time on a phone ---------- */
@media (max-width: 760px) {
  .msg-panes { grid-template-columns: 1fr; }
  .msg-panes.in-thread .msg-list { display: none; }
  .msg-panes:not(.in-thread) .msg-thread { display: none; }
  .msg-back { display: inline-block; }
  .msg-row .line { max-width: none; }
  .msg-thread { min-height: 70vh; }
}
