/* ===== Messaging (§21, §22, §28, §38) =====
   Conversational shapes borrowed from any modern messenger, but the palette, radii and type
   are Crew Connect's — no imported chat-app look. */
.msg-layout{ display:grid; grid-template-columns:270px 1fr; gap:0; border:1.5px solid var(--line); border-radius:12px; overflow:hidden; min-height:420px; }
.msg-threads{ border-right:1.5px solid var(--line); background:var(--paper); overflow-y:auto; max-height:560px; }
.msg-thread{
  display:block; width:100%; text-align:left; background:none; border:none; cursor:pointer;
  padding:14px 16px; border-bottom:1px solid var(--line); font-family:inherit;
  transition:background .15s ease;
}
.msg-thread:hover{ background:#eef2f7; }
.msg-thread.active{ background:#fff; box-shadow:inset 3px 0 0 var(--safety); }
.msg-thread-title{ display:block; font-size:13.5px; font-weight:700; color:var(--ink); margin-bottom:3px; line-height:1.3; }
.msg-thread-sub{ display:block; font-size:12px; color:var(--ink-soft); margin-bottom:4px; }
.msg-thread-preview{ display:block; font-size:12.5px; color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msg-thread-meta{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:5px; }
.msg-thread-when{ font-size:11.5px; color:var(--ink-soft); }
.msg-unread{ min-width:19px; height:19px; padding:0 6px; border-radius:999px; background:var(--safety); color:#fff; font-size:11px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }

.msg-pane{ display:flex; flex-direction:column; background:#fff; min-width:0; }
.msg-pane-head{ padding:13px 18px; border-bottom:1.5px solid var(--line); }
.msg-pane-title{ font-size:14px; font-weight:700; color:var(--ink); margin:0; }
.msg-pane-sub{ font-size:12.5px; color:var(--ink-soft); margin:2px 0 0; }
.msg-scroll{ flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:10px; min-height:220px; max-height:420px; }
.msg-empty{ margin:auto; text-align:center; font-size:13.5px; color:var(--ink-soft); max-width:280px; line-height:1.6; }

.msg-row{ display:flex; }
.msg-mine{ justify-content:flex-end; }
.msg-theirs{ justify-content:flex-start; }
.msg-bubble{ max-width:78%; padding:9px 14px 7px; border-radius:16px; }
.msg-theirs .msg-bubble{ background:var(--paper); border:1.5px solid var(--line); border-bottom-left-radius:5px; }
.msg-mine .msg-bubble{ background:var(--safety); border-bottom-right-radius:5px; }
.msg-text{ margin:0; font-size:14px; line-height:1.5; color:var(--ink); word-wrap:break-word; }
.msg-mine .msg-text{ color:#fff; }
.msg-time{ display:block; margin-top:3px; font-size:10.5px; color:var(--ink-soft); }
.msg-mine .msg-time{ color:rgba(255,255,255,.72); text-align:right; }

.msg-composer{
  display:flex; align-items:center; gap:8px; margin:0 14px 14px;
  padding:5px 5px 5px 16px; border-radius:999px;
  background:rgba(241,244,248,.82); border:1.5px solid var(--line);
  transition:border-color .18s ease, background .18s ease;
}
.msg-composer:focus-within{ border-color:var(--safety); background:#fff; }
.msg-composer-input{
  flex:1; min-width:0; border:none; background:none; outline:none;
  font-family:inherit; font-size:14px; color:var(--ink); padding:8px 0;
}
.msg-composer-input::placeholder{ color:var(--ink-soft); }
/* The global input:focus rule paints a 2px near-black outline, which inside a rounded pill
   reads as a black box. The pill already signals focus by changing its own border colour, so
   the outline is both redundant and wrong here. */
.msg-composer-input:focus{ outline:none; box-shadow:none; border:none; }
.msg-send-btn{
  width:36px; height:36px; flex-shrink:0; border-radius:50%; border:none; cursor:pointer;
  background:var(--safety); color:#fff; display:flex; align-items:center; justify-content:center;
  transition:transform .15s ease, opacity .15s ease;
}
.msg-send-btn svg{ width:17px; height:17px; }
.msg-send-btn:hover{ transform:scale(1.06); }
.msg-send-btn:active{ transform:scale(.96); }

.msg-layout-widget{ min-height:0; border:none; border-radius:0; }
.job-chat-pane{ border:1.5px solid var(--line); border-radius:12px; overflow:hidden; }
.job-chat-pane .msg-scroll{ max-height:320px; min-height:140px; }
.msg-layout-widget .msg-threads{ max-height:300px; }
.msg-layout-widget .msg-scroll{ max-height:240px; min-height:140px; }

@media(max-width:860px){
  .msg-layout{ grid-template-columns:1fr; min-height:0; }
  .msg-threads{ border-right:none; border-bottom:1.5px solid var(--line); max-height:190px; }
  .msg-scroll{ max-height:300px; }
}

