/* WhatsApp chats (Update 106, wa-chats-ui.js): the list of conversations on the left, one conversation on the right; on a phone one at a time. */
.wc-page { display: flex; flex-direction: column; min-width: 0; }
.wc-head { margin-bottom: 10px; }
.wc-lead { margin: 2px 0 0; }
.wc-split { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 0; height: calc(100vh - 200px); min-height: 460px;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.wc-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.wc-tools { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.wc-search input { width: 100%; box-sizing: border-box; }
.wc-filters { max-width: 100%; overflow-x: auto; }
.wc-filters .seg-btn { white-space: nowrap; }
.wc-list { flex: 1; min-height: 0; overflow-y: auto; }
.wc-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-2, var(--line));
  background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.wc-item:hover { background: var(--hover, var(--surface-2)); }
.wc-item.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--primary, var(--gold)); }
.wc-item:focus-visible { outline: 2px solid var(--focus, var(--primary)); outline-offset: -2px; }
.wc-av { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3, var(--surface-2)); color: var(--muted); font-weight: 700; font-size: .8rem; }
.wc-mid { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wc-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-item.unread .wc-name { font-weight: 800; }
.wc-time { flex: 0 0 auto; font-size: .72rem; color: var(--muted); }
.wc-item.unread .wc-time { color: var(--metric-green); font-weight: 700; }
.wc-prev { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-item.unread .wc-prev { color: var(--text, var(--ink)); }
.wc-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .72rem; color: var(--muted); }
.wc-tag { padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); }
.wc-tag.warn { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.wc-tag.bad { color: var(--metric-danger); border-color: currentColor; }
.wc-badge { flex: 0 0 auto; align-self: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--metric-green); color: #fff; font-size: .7rem; font-weight: 800; }
.wc-more, .wc-older { display: flex; justify-content: center; padding: 10px; }
.wc-empty { margin: 16px; }

.wc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-2); }
.wc-none { margin: auto; display: grid; gap: 6px; text-align: center; color: var(--muted); padding: 24px; max-width: 360px; }
.wc-none b { color: var(--ink); }
.wc-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wc-chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wc-chat-title { flex: 1; min-width: 0; }
.wc-chat-title h2 { margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-chat-title .small { overflow-wrap: anywhere; }
.wc-chat-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.wc-back { display: none; }
.wc-msgs { flex: 1; min-height: 0; max-height: none; border: 0; border-radius: 0; margin: 0; }
#wc-foot { padding: 0 14px 12px; background: var(--surface); border-top: 1px solid var(--line); }
#wc-foot .chat-compose { margin-top: 4px; }
.wc-acts-row { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 4px; }
.wc-opener { display: grid; gap: 8px; }
.wc-opener .field { display: grid; gap: 4px; }
.wc-opener select { max-width: 100%; }
.wc-opener-text { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; color: var(--text, var(--ink)); white-space: pre-wrap; overflow-wrap: anywhere; }
.wc-opener .btn { justify-self: start; }

/* a phone (and a narrow window): the list, or the chat with a Back button */
@media (max-width: 820px) {
  .wc-split { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 190px); min-height: 420px; border-radius: 12px; }
  .wc-split[data-view="chat"] .wc-side { display: none; }
  .wc-split[data-view="list"] .wc-main { display: none; }
  .wc-side { border-right: 0; }
  .wc-back { display: inline-flex; }
  .wc-chat-head { padding: 8px 10px; gap: 8px; }
  .wc-chat-head .wc-av { display: none; }
  .wc-lead { display: none; }
  #wc-foot { padding: 0 10px 10px; }
}
