.luperiq-msg-thread {
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}
.luperiq-msg-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.luperiq-msg-item {
  border: 1px solid #efefef;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
}
.luperiq-msg-item.is-unread {
  border-color: #ffd1a1;
  box-shadow: 0 0 0 2px rgba(255, 193, 126, 0.25) inset;
}
.luperiq-msg-item.is-mine {
  border-color: #d6ecff;
  background: #f3faff;
  align-self: flex-end;
}
.luperiq-msg-item.role-customer {
  border-left: 4px solid rgba(124, 58, 237, 0.35);
}
.luperiq-msg-item.role-tech {
  border-left: 4px solid rgba(16, 185, 129, 0.35);
}
.luperiq-msg-item.role-office {
  border-left: 4px solid rgba(59, 130, 246, 0.35);
}
.luperiq-msg-meta {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 13px;
  opacity: 0.9;
}
.luperiq-msg-author {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.luperiq-msg-author-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.luperiq-msg-author-name {
  font-weight: 800;
}
.luperiq-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(15, 17, 21, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.75);
  flex: 0 0 30px;
}
.luperiq-msg-item.is-mine .luperiq-msg-avatar {
  background: rgba(32, 129, 240, 0.12);
  border-color: rgba(32, 129, 240, 0.25);
}
.luperiq-msg-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(15, 17, 21, 0.06);
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
  letter-spacing: 0.2px;
}
.luperiq-msg-badge.role-customer {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
  color: #5b21b6;
}
.luperiq-msg-badge.role-tech {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: #065f46;
}
.luperiq-msg-badge.role-office {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
}
.luperiq-msg-body {
  white-space: pre-wrap;
}
.luperiq-msg-time {
  opacity: 0.8;
  font-size: 12px;
  white-space: nowrap;
}
.luperiq-msg-alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.luperiq-msg-alert-success {
  background: #e9f8ef;
  border: 1px solid #bde8cd;
}
.luperiq-msg-alert-error {
  background: #fdecec;
  border: 1px solid #f5bcbc;
}

.luperiq-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}

/* Frontend form controls (avoid overriding wp-admin styles) */
body:not(.wp-admin) .luperiq-msg-thread textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

body:not(.wp-admin) .luperiq-msg-thread .button,
body:not(.wp-admin) .luperiq-msg-thread a.button,
body:not(.wp-admin) .luperiq-msg-thread button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 850;
  border: 1px solid rgba(15, 17, 21, 0.10);
  background: rgba(15, 17, 21, 0.06);
  color: rgba(15, 17, 21, 0.78);
  cursor: pointer;
}

body:not(.wp-admin) .luperiq-msg-thread .button:hover,
body:not(.wp-admin) .luperiq-msg-thread a.button:hover,
body:not(.wp-admin) .luperiq-msg-thread button.button:hover {
  background: rgba(15, 17, 21, 0.10);
  color: #111;
}

body:not(.wp-admin) .luperiq-msg-thread .button.button-primary,
body:not(.wp-admin) .luperiq-msg-thread .button-primary {
  background: #0f1115;
  border-color: #0f1115;
  color: #fff;
}

body:not(.wp-admin) .luperiq-msg-thread .button.button-primary:hover,
body:not(.wp-admin) .luperiq-msg-thread .button-primary:hover {
  background: #1a1d24;
  border-color: #1a1d24;
}

body:not(.wp-admin) .luperiq-msg-thread .button:focus,
body:not(.wp-admin) .luperiq-msg-thread a.button:focus,
body:not(.wp-admin) .luperiq-msg-thread button.button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.18);
}
