/* threadit.co — member messages + notifications UI. Load with /messaging.js.
   Warm palette matching style.css. */

.msg-badge {
  display: inline-block;
  min-width: 1.1em;
  padding: 0 .3em;
  margin-left: .2em;
  border-radius: .6em;
  background: var(--cranberry);
  color: #fff;
  font-size: .72em;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  vertical-align: text-top;
}
.msg-badge[hidden] { display: none; }
.msg-badge-n { background: var(--choc); font-size: .68em; }

.msg-app { max-width: 56rem; margin: 1.5rem auto; padding: 0 1rem 3rem; }
.msg-loading { color: var(--muted); }
.msg-err { color: var(--cranberry); }

.msg-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--line); }
.msg-tabs button {
  background: none; border: 0; padding: .5rem 1rem; font: inherit;
  cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.msg-tabs button.on { color: var(--choc); border-bottom-color: var(--cranberry); font-weight: 600; }
.msg-tabs button .msg-badge { margin-left: .35em; }

.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-item {
  display: flex; gap: .75rem; align-items: baseline;
  padding: .65rem .5rem; border-bottom: 1px solid var(--line); cursor: pointer;
}
.msg-item:hover { background: var(--cream); }
.msg-item.unread { background: #fdf0f3; }
.msg-peer { font-weight: 600; min-width: 8rem; color: var(--choc); }
.msg-preview {
  flex: 1; color: var(--muted); overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.msg-time { color: var(--muted); font-size: .85em; white-space: nowrap; }
.msg-unread-n { color: var(--cranberry); font-weight: 700; font-size: .8em; }

.msg-thread-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: .5rem; margin-bottom: .75rem;
}
.msg-thread-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--serif); color: var(--choc); }
.msg-thread-head a { font-size: .85em; }

.msg-bubbles { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.msg-bubble {
  max-width: 75%; padding: .5rem .8rem; border-radius: .9rem;
  background: var(--cream); align-self: flex-start;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg-bubble.mine { background: #f3dfd9; align-self: flex-end; }
.msg-bubble .msg-meta { display: block; font-size: .72em; color: var(--muted); margin-top: .25rem; }
.msg-bubble .msg-del { color: var(--cranberry); cursor: pointer; margin-left: .4em; }

.msg-compose textarea {
  width: 100%; box-sizing: border-box; min-height: 4.5rem;
  padding: .5rem; font: inherit; border: 1px solid var(--line); border-radius: .4rem;
  background: #fff; color: var(--ink);
  resize: vertical;
}
.msg-compose textarea:focus { outline: none; border-color: var(--rust); }
.msg-compose .row { display: flex; gap: .75rem; align-items: center; margin-top: .4rem; }
.msg-compose input[type="text"] {
  flex: 0 0 14rem; padding: .45rem; font: inherit;
  border: 1px solid var(--line); border-radius: .4rem;
  background: #fff; color: var(--ink);
}
.msg-compose button {
  padding: .45rem 1.2rem; font: inherit; cursor: pointer;
  background: var(--cranberry); color: #fff; border: 0; border-radius: 999px; font-weight: 600;
}
.msg-compose button:hover { background: #7f0e30; }
.msg-compose button[disabled] { opacity: .5; cursor: default; }
.msg-compose .note { font-size: .8em; color: var(--muted); }

.msg-notif { display: flex; gap: .75rem; align-items: baseline; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.msg-notif.unread { background: #fdf0f3; }
.msg-notif .kind { font-size: .75em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); min-width: 6.5rem; }
.msg-notif .body { flex: 1; }
.msg-notif .body a { color: var(--cranberry); }
.msg-notif .msg-time { white-space: nowrap; }

.msg-blocked-banner {
  padding: .6rem .8rem; margin-bottom: .75rem;
  background: #fdf0ec; border: 1px solid #e8c4ae; border-radius: .4rem;
  color: #7c3118; font-size: .9em;
}

/* focused DM — a separated area holding only this conversation */
.msg-app.msg-focus {
  max-width: 44rem; border: 1px solid var(--line); border-radius: .8rem;
  padding: 1rem 1.25rem; background: #fffdf9;
  box-shadow: 0 6px 24px rgba(92,58,33,.08);
}
.msg-app.msg-focus .msg-bubbles {
  max-height: 55vh; overflow-y: auto; padding-right: .4rem;
}

/* member directory + autocomplete */
.msg-dir { max-height: 18rem; overflow-y: auto; border: 1px solid var(--line); border-radius: .4rem; }
.msg-dir .msg-item:last-child { border-bottom: 0; }
.msg-acbox { position: relative; flex: 0 0 14rem; }
.msg-acbox input[type="text"] { width: 100%; }
.msg-acdrop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: .4rem;
  margin-top: 2px; box-shadow: 0 6px 18px rgba(92,58,33,.15);
  max-height: 14rem; overflow-y: auto;
}
.msg-acopt { padding: .45rem .6rem; cursor: pointer; font-size: .95em; }
.msg-acopt:hover { background: var(--cream); }
