/* JARVIS COO — стили экрана «Сообщения» (fix6). Самодостаточные .jmsg* поверх палитры приложения. */
.jmsg {
  --jmsg-bg: #f5f7fb;
  --jmsg-paper: #ffffff;
  --jmsg-ink: #243149;
  --jmsg-muted: #78849a;
  --jmsg-line: #e2e7ef;
  --jmsg-blue: #326be8;
  --jmsg-tint: #eaf0ff;
  --jmsg-soft: #f4f7fd;
  --jmsg-danger: #a15443;
  --jmsg-danger-bg: #fff5f0;
  --jmsg-ok: #2c7a5b;
  --jmsg-warn: #9a6a2f;
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
  color: var(--jmsg-ink);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.jmsg[hidden] { display: none !important; }
.jmsg [hidden] { display: none !important; }
.jmsg-backdrop { position: absolute; inset: 0; background: #0c1b3566; backdrop-filter: blur(3px); }
.jmsg-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1120px, calc(100vw - 48px));
  height: min(780px, calc(100dvh - 48px));
  margin: auto;
  background: var(--jmsg-paper);
  border: 1px solid var(--jmsg-line);
  border-radius: 20px;
  box-shadow: 0 24px 110px #10254430;
  overflow: hidden;
}
.jmsg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--jmsg-line);
  background: linear-gradient(180deg, #fbfdff, #f5f8fe);
}
.jmsg-head-title { min-width: 0; }
.jmsg-head h2 { margin: 2px 0 0; font-size: 21px; letter-spacing: -0.35px; color: var(--jmsg-ink); }
.jmsg-eyebrow { margin: 0; font-size: 10px; font-weight: 700; letter-spacing: 1.8px; color: #5278b7; }
.jmsg-head-actions { display: flex; gap: 8px; }
.jmsg-icon-btn {
  min-width: 38px; min-height: 38px; padding: 8px; border-radius: 10px;
  border: 1px solid var(--jmsg-line); background: var(--jmsg-paper); color: #6b7f9f;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.jmsg-icon-btn:hover { background: #edf3ff; }
.jmsg-body { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); flex: 1; min-height: 0; }
.jmsg-list-pane { display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; border-right: 1px solid var(--jmsg-line); background: #fbfcff; min-height: 0; }
.jmsg-search-wrap { display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--jmsg-line); border-radius: 10px; background: #fff; }
.jmsg-search-icon { color: #8ea4c6; font-size: 18px; }
.jmsg-search { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 11px 0; color: var(--jmsg-ink); font: inherit; }
.jmsg-search::placeholder { color: #93a3bb; }
.jmsg-results { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.jmsg-results-caption { margin: 0 2px 2px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #8392aa; }
.jmsg-result, .jmsg-conv {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  border: 1px solid transparent; border-radius: 12px; background: transparent; padding: 10px; cursor: pointer; color: inherit;
}
.jmsg-result:hover, .jmsg-conv:hover { background: #edf3ff; }
.jmsg-result { border-color: var(--jmsg-line); background: #fff; }
.jmsg-result-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jmsg-result-name { font-weight: 600; color: #304563; overflow-wrap: anywhere; }
.jmsg-result-id { font-size: 11px; color: var(--jmsg-muted); }
.jmsg-avatar {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e6eefc; color: #527cc0; font-weight: 700; font-size: 13px;
}
.jmsg-conversations { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; flex: 1; }
.jmsg-conv { align-items: center; }
.jmsg-conv.is-active { background: var(--jmsg-tint); border-color: #dbe6fb; }
.jmsg-conv-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.jmsg-conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.jmsg-conv-name { font-weight: 600; color: #304563; overflow-wrap: anywhere; }
.jmsg-conv-time { font-size: 10px; color: #94a3b9; flex-shrink: 0; }
.jmsg-conv-last { font-size: 12px; color: var(--jmsg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jmsg-conv-meta { display: flex; gap: 6px; align-items: center; }
.jmsg-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--jmsg-blue); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.jmsg-tag { font-size: 9px; padding: 3px 6px; border-radius: 5px; background: #f0f3f9; color: #8491a8; }
.jmsg-tag.is-blocked { background: var(--jmsg-danger-bg); color: var(--jmsg-danger); }
.jmsg-list-status { margin: 0; padding: 0 4px; font-size: 11px; line-height: 1.5; color: var(--jmsg-muted); }
.jmsg-list-status.is-visible { color: var(--jmsg-warn); }
.jmsg-empty-list { padding: 18px 8px; text-align: center; color: var(--jmsg-muted); font-size: 12px; }
.jmsg-dialog-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.jmsg-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; color: var(--jmsg-muted); }
.jmsg-empty-mark { width: 54px; height: 54px; border-radius: 16px; background: var(--jmsg-tint); color: #6b8dbe; display: flex; align-items: center; justify-content: center; font-size: 25px; margin-bottom: 14px; }
.jmsg-empty h3 { color: #4a668e; font-size: 18px; margin: 0 0 7px; }
.jmsg-empty p { max-width: 42ch; margin: 0; font-size: 12px; line-height: 1.6; }
.jmsg-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.jmsg-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--jmsg-line); background: #fff; }
.jmsg-back { display: none; }
.jmsg-peer-box { min-width: 0; flex: 1; }
.jmsg-peer-name { margin: 0; font-weight: 650; color: #263f66; overflow-wrap: anywhere; }
.jmsg-peer-id { margin: 2px 0 0; font-size: 11px; color: var(--jmsg-muted); }
.jmsg-chat-actions { display: flex; gap: 8px; align-items: center; position: relative; flex-shrink: 0; }
.jmsg-menu { position: absolute; right: 0; top: 44px; z-index: 5; min-width: 190px; padding: 6px; border: 1px solid var(--jmsg-line); border-radius: 10px; background: #fff; box-shadow: 0 16px 50px #10254424; }
.jmsg-menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 7px; color: #3d5a84; font: inherit; font-size: 12px; cursor: pointer; }
.jmsg-menu-item:hover { background: #edf3ff; }
.jmsg-btn { min-height: 38px; padding: 9px 14px; border-radius: 9px; border: 1px solid #dce3ef; background: #fff; color: #526781; font: inherit; font-weight: 600; font-size: 12px; cursor: pointer; }
.jmsg-btn:hover { background: #f2f6fd; }
.jmsg-btn:disabled { opacity: 0.55; cursor: default; }
.jmsg-btn-primary { background: var(--jmsg-blue); border-color: var(--jmsg-blue); color: #fff; }
.jmsg-btn-primary:hover { background: #2b60d4; }
.jmsg-btn-danger { background: var(--jmsg-danger-bg); border-color: #efdcd4; color: var(--jmsg-danger); }
.jmsg-btn-danger:hover { background: #ffede6; }
.jmsg-btn-call { background: var(--jmsg-tint); border-color: #d7e4fb; color: #2f5aa8; }
.jmsg-btn-subtle { align-self: center; border: 0; background: transparent; color: var(--jmsg-blue); font-size: 11px; min-height: 28px; }
.jmsg-notice { margin: 0; padding: 9px 16px; font-size: 12px; line-height: 1.5; background: var(--jmsg-soft); border-bottom: 1px solid var(--jmsg-line); color: #5679ad; }
.jmsg-notice.is-error { background: #fff7f2; color: #9a5c49; }
.jmsg-messages-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 16px 4px; overflow: hidden; }
.jmsg-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 10px; scrollbar-width: thin; }
.jmsg-empty-thread { margin: auto; max-width: 34ch; text-align: center; color: var(--jmsg-muted); font-size: 12px; line-height: 1.6; }
.jmsg-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.jmsg-msg.is-mine { align-items: flex-end; }
.jmsg-bubble { max-width: min(72ch, 84%); padding: 9px 12px; border: 1px solid #e1e8f5; border-radius: 14px; background: #fff; }
.jmsg-msg.is-mine .jmsg-bubble { background: var(--jmsg-tint); border-color: #dbe6fb; border-bottom-right-radius: 5px; }
.jmsg-msg.is-theirs .jmsg-bubble { border-bottom-left-radius: 5px; }
.jmsg-msg.is-pending .jmsg-bubble { opacity: 0.82; border-style: dashed; }
.jmsg-msg.has-error .jmsg-bubble { border-color: #efdcd4; background: #fff7f2; }
.jmsg-text { margin: 0; font-size: 13px; line-height: 1.55; color: #344f75; white-space: pre-wrap; overflow-wrap: anywhere; }
.jmsg-msg-meta { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 4px; font-size: 10px; color: #94a3b9; }
.jmsg-status { color: #7e93b3; }
.jmsg-msg.has-error .jmsg-status { color: var(--jmsg-danger); }
.jmsg-retry { border: 0; background: transparent; color: var(--jmsg-blue); font: inherit; font-size: 10px; text-decoration: underline; cursor: pointer; padding: 0; }
.jmsg-composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--jmsg-line); background: #fbfcff; }
.jmsg-input { flex: 1; min-height: 40px; max-height: 120px; resize: none; border: 1px solid #dce4f2; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13px; color: #344f75; background: #fff; }
.jmsg-count { font-size: 10px; color: #94a3b9; min-width: 46px; text-align: right; }
.jmsg-call-layer { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0c1b3540; }
.jmsg-call-card { width: min(360px, 100%); padding: 24px; border-radius: 18px; border: 1px solid #dce5f6; background: #fbfcff; box-shadow: 0 22px 90px #10254438; text-align: center; }
.jmsg-call-card h3 { margin: 0 0 6px; font-size: 21px; color: #203f70; overflow-wrap: anywhere; }
.jmsg-call-status { margin: 0; font-size: 13px; color: #5679ad; }
.jmsg-call-timer { margin: 4px 0 14px; font-size: 22px; font-variant-numeric: tabular-nums; color: #2f5aa8; }
.jmsg-call-actions { display: flex; gap: 9px; justify-content: center; margin: 14px 0 10px; flex-wrap: wrap; }
.jmsg-call-note { margin: 10px 0 0; font-size: 10px; line-height: 1.5; color: #8a99b1; }
.jmsg-call-card.is-ringing { border-color: #f0d9b5; background: #fffaf1; }
.jmsg-call-card.is-connected { border-color: #cfe6d8; background: #f7fcf8; }
.jmsg-remote-audio { display: none; }
.jmsg-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 300; max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 10px; background: #203656; color: #fff; font-size: 12px; line-height: 1.5; box-shadow: 0 10px 40px #0b1a3026; }
.jmsg-modal { position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center; padding: 18px; background: #0c1b3566; }
.jmsg-modal-card { width: min(430px, 100%); padding: 22px; border-radius: 16px; border: 1px solid var(--jmsg-line); background: #fbfcff; box-shadow: 0 22px 90px #10254438; }
.jmsg-modal-card h3 { margin: 0 0 8px; font-size: 19px; color: #203f70; }
.jmsg-modal-text { margin: 0 0 12px; font-size: 12px; line-height: 1.6; color: #6b80a1; }
.jmsg-report-input { width: 100%; min-height: 96px; resize: vertical; border: 1px solid #dce4f2; border-radius: 9px; padding: 10px; font: inherit; font-size: 13px; color: #344f75; background: #fff; }
.jmsg-modal-error { margin: 8px 0 0; font-size: 11px; color: var(--jmsg-danger); }
.jmsg-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.jmsg :focus-visible { outline: 3px solid #93b7ff; outline-offset: 2px; }

@media (max-width: 900px) {
  .jmsg-shell { width: calc(100vw - 24px); height: calc(100dvh - 24px); border-radius: 16px; }
  .jmsg-body { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .jmsg { --jmsg-shell-pad: env(safe-area-inset-bottom, 0px); }
  .jmsg-shell { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .jmsg-head { padding: max(12px, env(safe-area-inset-top, 0px)) 14px 12px; }
  .jmsg-head h2 { font-size: 18px; }
  .jmsg-body { grid-template-columns: 1fr; position: relative; }
  .jmsg-list-pane { border-right: 0; border-bottom: 1px solid var(--jmsg-line); }
  .jmsg-dialog-pane { display: none; }
  .jmsg.is-dialog .jmsg-list-pane { display: none; }
  .jmsg.is-dialog .jmsg-dialog-pane { display: flex; }
  .jmsg-back { display: inline-flex; align-items: center; justify-content: center; }
  .jmsg-chat-head { padding: 10px 10px; }
  .jmsg-chat-actions .jmsg-btn { padding: 8px 10px; min-height: 36px; }
  .jmsg-messages-wrap { padding: 10px 10px 2px; }
  .jmsg-composer { padding: 9px 10px calc(9px + var(--jmsg-shell-pad)); gap: 6px; }
  .jmsg-input { font-size: 16px; }
  .jmsg-call-layer { align-items: flex-end; padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .jmsg-call-card { width: 100%; border-radius: 16px; }
  .jmsg-menu { right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .jmsg * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
