.messenger-auth {
  padding: 35px 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.messenger-auth input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--primary-color);
  border-radius: 7px;
  box-sizing: border-box;
}

#messengerAuthSubmit,
#messengerAuthToggle {
  width: 100%;
  min-height: 36px;
  border-radius: 7px;
  border: none;
  background: var(--primary-color);
  color: var(--button-text-color);
  cursor: pointer;
}

#messengerAuthError {
  font-size: 13px;
  color: #7a0000; /* error red — intentional, not muddy text */
  line-height: 1.3;
}















/* ============================================================================
   OSIRIS Messenger — paste-back module CSS.
   - Original CSS preserved verbatim (top section).
   - Extensions only use your existing CSS variables:
       --primary-color (default #007a5e), --accent-color, --button-text-color
   - No new color theme is introduced; only neutral grays/whites are used for
     non-branded UI primitives (borders, muted text, modal backdrop).
============================================================================ */
.messenger-panel {
  position: fixed;
  top: 60px;
  right: -360px;
  width: 320px;

 height: calc(100vh - 130px);
 max-height: calc(100vh - 130px);
  overflow-y: auto;

  background: var(--accent-color);
  border-radius: 7px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 1100;
  padding: 15px;
  transition: right 0.3s ease;

  display: none;
  flex-direction: column;
}

.messenger-panel.open {
  display: flex;
  right: 10px;
}

@media (max-width: 768px) {
  .messenger-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: -100%;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .messenger-panel.open {
    right: 0;
  }
}

.messenger-close {
  position: absolute;
  top: 8px;
  right: 10px;
  cursor: pointer;
  color: var(--primary-color, #007a5e);
  font-size: 16px;
}



.messenger-chat {
  flex: 1;
  overflow-y: auto;
  margin-top: 30px;
  margin-bottom: 5px;
  padding: 10px;
  background: white;
  border-radius: 7px;
}

.messenger-preview { margin-bottom: 5px; }

.messenger-preview img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 7px;
}

.messenger-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 5px;
}

.messenger-text {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--primary-color, #007a5e);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

.messenger-plus,
.messenger-send {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  font-size: 18px;
  cursor: pointer;
}

.messenger-call {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color, #007a5e);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.messenger-call img { width: 26px; height: 26px; object-fit: contain; }

/* ============================================================================
   EXTENSIONS — added only for the WhatsApp-style messaging functionality.
   These rules use only your three OSIRIS CSS variables for branded surfaces;
   neutral grays/whites are used for borders, muted text, and the modal
   backdrop. They are scoped to the messenger panel — diagnostic UI is not
   touched.
============================================================================ */

/* ---------- Auth screen (logged out) ---------- */
.messenger-auth {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 30px;
  background: #fff;
  border-radius: 7px;
  padding: 14px;
}
.messenger-panel.is-auth .messenger-auth { display: flex; }
.messenger-panel.is-auth .messenger-shell { display: none; }

.messenger-auth h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: var(--primary-color, #007a5e);
}
.messenger-auth p { margin: 0; font-size: 12px; color: #555; }
.messenger-auth input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d0d4d9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: #111;
}
.messenger-auth input:focus { border-color: var(--primary-color, #007a5e); }
.messenger-auth button {
  height: 36px;
  border: none;
  border-radius: 6px;
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.messenger-auth .messenger-auth-toggle {
  background: transparent;
  color: var(--primary-color, #007a5e);
  font-weight: 500;
  text-decoration: underline;
  height: auto;
  padding: 4px 0 0 0;
  font-size: 12px;
}
.messenger-auth-error {
  color: #b00020;
  font-size: 12px;
  min-height: 14px;
}

/* ---------- Shell (logged in) ---------- */
.messenger-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin-top: 26px;
}
.messenger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--primary-color, #007a5e);
  padding: 0 4px 6px 4px;
}
.messenger-header .messenger-me { font-weight: 600; }
.messenger-header .messenger-logout {
  background: transparent;
  border: none;
  color: var(--primary-color, #007a5e);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- View switcher ---------- */
.messenger-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messenger-view[data-view="chat"] .messenger-list { display: none; }
.messenger-view[data-view="list"] .messenger-active { display: none; }
.messenger-view[data-view="list"] .messenger-input { display: none; }
.messenger-view[data-view="list"] .messenger-preview { display: none; }

/* ---------- Conversation list ---------- */
.messenger-list {
  flex: 1;
  overflow-y: auto;
  background: white;
  border-radius: 7px;
  padding: 6px;
}
.messenger-list-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  padding: 8px 6px 4px 6px;
}
.messenger-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease;
}
.messenger-list-item:hover { background: #f4f4f5; }
.messenger-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.messenger-list-item .meta { flex: 1; min-width: 0; }
.messenger-list-item .name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-list-item .last {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.messenger-badge {
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

/* ---------- Active chat ---------- */
.messenger-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messenger-active-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 6px;
}
.messenger-back {
  background: transparent;
  border: none;
  color: var(--primary-color, #007a5e);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
.messenger-active-header .name { font-size: 13px; font-weight: 600; color: #111; }

.messenger-osiris-btn {
  margin-left: auto;
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  border: none;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Bubbles ---------- */
.messenger-bubble-wrap { display: flex; margin: 4px 0; }
.messenger-bubble-wrap.sent { justify-content: flex-end; }
.messenger-bubble-wrap.received { justify-content: flex-start; }

.messenger-bubble {
  max-width: 80%;
  padding: 7px 10px 5px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}
.messenger-bubble-wrap.sent .messenger-bubble {
  background: var(--accent-color);
  color: #111;
  border: 1px solid var(--primary-color, #007a5e);
  border-bottom-right-radius: 3px;
}
.messenger-bubble-wrap.received .messenger-bubble {
  background: #ffffff;
  color: #111;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 3px;
}
.messenger-bubble img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 4px;
}
.messenger-bubble .time {
  display: block;
  font-size: 10px;
  color: #6b7280;
  text-align: right;
  margin-top: 2px;
}

/* OSIRIS Summary card (relay only — NOT a diagnostic conclusion) */
.messenger-osiris-card {
  background: #ffffff;
  border: 1px solid var(--primary-color, #007a5e);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #111;
}
.messenger-osiris-card .title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-color, #007a5e);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.messenger-osiris-card .section { margin-top: 6px; }
.messenger-osiris-card .section h5 {
  margin: 0 0 2px 0;
  font-size: 11px;
  color: #374151;
  font-weight: 700;
}
.messenger-osiris-card ul { margin: 0; padding-left: 16px; }
.messenger-osiris-card li { margin: 0; }
.messenger-osiris-card .note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #d4d4d8;
  font-style: italic;
  color: #374151;
}
.messenger-osiris-card .disclaimer {
  margin-top: 6px;
  font-size: 10px;
  color: #6b7280;
}

/* ---------- OSIRIS share modal ---------- */
.messenger-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.messenger-modal-backdrop.open { display: flex; }
.messenger-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.messenger-modal h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: var(--primary-color, #007a5e);
}
.messenger-modal p { margin: 0 0 10px 0; font-size: 12px; color: #555; }
.messenger-modal label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #111;
  padding: 6px 4px;
  border-bottom: 1px solid #f4f4f5;
}
.messenger-modal label small {
  display: block;
  color: #6b7280;
  font-size: 11px;
}
.messenger-modal textarea {
  width: 100%;
  min-height: 60px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #d0d4d9;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.messenger-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.messenger-modal-actions button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.messenger-modal-actions .cancel {
  background: #e5e7eb;
  color: #111;
}
.messenger-modal-actions .send {
  background: var(--primary-color, #007a5e);
  color: var(--button-text-color, #ffffff);
  font-weight: 600;
}

/* ---------- Empty state + connection dot ---------- */
.messenger-empty {
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  padding: 30px 10px;
}
.messenger-conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color, #007a5e);
  display: inline-block;
  margin-right: 4px;
}
.messenger-conn-dot.offline { background: #b00020; }
/* =============================================================
   OSIRIS text-colour enforcement (Messenger)
   All readable text must be primary OSIRIS colour, white on
   solid primary backgrounds, or error red (#7a0000) for errors.
   No grey / slate / brown tones.
   ============================================================= */
.messenger-panel,
.messenger-panel *,
.messenger-auth p,
.messenger-list-section,
.messenger-list-item .name,
.messenger-list-item .last,
.messenger-chat,
.messenger-bubble,
.messenger-bubble .time,
.messenger-active-header .name,
.messenger-modal,
.messenger-modal p,
.messenger-osiris-card,
.messenger-osiris-card * ,
.messenger-input input,
.messenger-text {
  color: #007a5e;
}
.messenger-send,
.messenger-osiris-btn,
#messengerAuthSubmit,
#messengerAuthToggle,
.messenger-call,
.messenger-plus,
button.osiris-close,
.messenger-primary-btn {
  color: #ffffff;
}
.messenger-bubble.sent,
.messenger-bubble.sent * {
  color: #ffffff;
}

/* =============================================================
   OSIRIS Messenger — view state & layout helpers (new HTML)
   ============================================================= */

/* Auth form visible only when not logged in */
.messenger-panel .messenger-view { display: none; }
.messenger-panel .messenger-auth { display: flex; }
.messenger-panel.is-auth .messenger-view { display: none; }
.messenger-panel:not(.is-auth) .messenger-view { display: flex; flex-direction: column; height: 100%; }
.messenger-panel:not(.is-auth) .messenger-auth { display: none; }

/* Header with user info + connection dot + logout */
.messenger-header {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0 8px;
  border-bottom: 1px solid rgba(0,122,94,0.25);
  font-size: 13px; color: #007a5e;
}
.messenger-me { flex: 1; font-weight: 600; }
.messenger-logout {
  background: transparent; color: #007a5e; border: 1px solid #007a5e;
  border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px;
}
.messenger-conn {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2ecc71; display: inline-block;
}
.messenger-conn.offline { background: #c0392b; }

/* List view shows list, hides chat+input */
.messenger-view[data-view="list"] .messenger-list   { display: block; flex: 1; overflow-y: auto; }
.messenger-view[data-view="list"] .messenger-active-header,
.messenger-view[data-view="list"] .messenger-chat,
.messenger-view[data-view="list"] .messenger-preview,
.messenger-view[data-view="list"] .messenger-input { display: none; }

/* Chat view shows active header+chat+input, hides list */
.messenger-view[data-view="chat"] .messenger-list { display: none; }
.messenger-view[data-view="chat"] .messenger-active-header { display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid rgba(0,122,94,0.25); }
.messenger-view[data-view="chat"] .messenger-chat { display: block; flex: 1; overflow-y: auto; padding: 8px 0; }
.messenger-view[data-view="chat"] .messenger-input { display: flex; gap: 6px; align-items: center; padding-top: 8px; }
.messenger-back {
  background: transparent; color: #007a5e; border: none;
  font-size: 22px; cursor: pointer; padding: 0 4px;
}

/* List rows */
.messenger-list-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 4px 4px; color: #007a5e; font-weight: 700;
}
.messenger-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; cursor: pointer;
  border-radius: 8px; color: #007a5e;
}
.messenger-list-item:hover { background: rgba(0,122,94,0.08); }
.messenger-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #007a5e; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.messenger-list-item .meta { flex: 1; min-width: 0; }
.messenger-list-item .name { font-weight: 600; font-size: 14px; }
.messenger-list-item .last { font-size: 12px; color: #007a5e; opacity: 0.75;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messenger-badge {
  background: #007a5e; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 2px 8px;
}
.messenger-empty {
  padding: 20px 6px; color: #007a5e; opacity: 0.7; font-size: 13px; text-align: center;
}

/* Chat bubbles */
.messenger-bubble-wrap { display: flex; margin: 4px 0; }
.messenger-bubble-wrap.sent { justify-content: flex-end; }
.messenger-bubble {
  max-width: 80%; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; line-height: 1.35;
  background: #ffffff; color: #007a5e; border: 1px solid rgba(0,122,94,0.2);
}
.messenger-bubble-wrap.sent .messenger-bubble { background: #007a5e; color: #fff; border: none; }
.messenger-bubble .time { display: block; font-size: 10px; opacity: 0.7; margin-top: 4px; text-align: right; }
.messenger-bubble img { max-width: 100%; border-radius: 6px; display: block; }
