/* Messagerie E-wenze */
.msg-app {
  --msg-navy: #003b95;
  --msg-blue: #0071c2;
  --msg-yellow: #ffb700;
  --msg-bg: #f5f5f5;
  --msg-line: #e6e6e6;
  --msg-text: #1a1a1a;
  --msg-muted: #6b6b6b;
  --msg-radius: 16px;
  background: var(--msg-bg);
  min-height: calc(100vh - 80px);
}
.msg-app .container,
.msg-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.msg-shell {
  background: #fff;
  border: 1px solid var(--msg-line);
  border-radius: 20px;
  overflow: hidden;
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}
.msg-toolbar {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--msg-line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  justify-content: space-between;
  background: #fff;
}
.msg-toolbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--msg-text);
}
.msg-toolbar p {
  margin: 4px 0 0;
  color: var(--msg-muted);
  font-size: 14px;
}
.msg-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}
.msg-search {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.msg-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--msg-muted);
  font-size: 13px;
}
.msg-search input {
  width: 100%;
  border: 1px solid var(--msg-line);
  border-radius: 999px;
  padding: 10px 14px 10px 36px;
  font-size: 14px;
  outline: none;
  background: #fafafa;
}
.msg-search input:focus {
  border-color: var(--msg-blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 113, 194, 0.12);
}
.msg-filter {
  display: flex;
  background: #f2f2f2;
  border-radius: 999px;
  padding: 3px;
}
.msg-filter button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #4a4a4a;
  cursor: pointer;
}
.msg-filter button.is-on {
  background: #fff;
  color: var(--msg-navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.msg-filter-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--msg-navy, #003b95);
  text-decoration: none;
  padding: 7px 12px;
}
.msg-list {
  display: flex;
  flex-direction: column;
}
.msg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.msg-item:hover,
.msg-item.is-open {
  background: #f7f9fc;
}
.msg-item.unread {
  background: #f3f7ff;
}
.msg-avatar,
.msg-avatar-ph {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.msg-avatar-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #003b95;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.msg-item-body {
  flex: 1;
  min-width: 0;
}
.msg-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.msg-item-top strong {
  font-size: 15px;
  color: var(--msg-text);
}
.msg-item.unread .msg-item-top strong {
  font-weight: 800;
}
.msg-item-time {
  font-size: 12px;
  color: var(--msg-muted);
  white-space: nowrap;
}
.msg-item-preview {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: #5c5c5c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-item.unread .msg-item-preview {
  color: #222;
  font-weight: 600;
}
.msg-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--msg-navy);
  background: #e8f0fe;
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 4px;
}
.msg-pill.cancel { background: #fff4e5; color: #9a6200; }
.msg-pill.auto { background: #eef2f6; color: #445; }
.msg-dot {
  width: 10px;
  height: 10px;
  background: var(--msg-yellow);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 183, 0, 0.25);
}
.msg-empty {
  text-align: center;
  padding: 72px 24px;
  color: var(--msg-muted);
}
.msg-empty i {
  font-size: 42px;
  color: var(--msg-navy);
  margin-bottom: 12px;
}
.msg-empty h2 {
  color: var(--msg-text);
  margin: 8px 0;
}
.msg-empty a {
  display: inline-flex;
  margin-top: 16px;
  background: var(--msg-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

/* Thread layout */
.msg-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 80px);
  background: #fff;
}
.msg-col-list {
  border-right: 1px solid var(--msg-line);
  display: flex;
  flex-direction: column;
  background: #fff;
  min-height: 0;
}
.msg-col-list .msg-toolbar {
  padding: 16px 16px 12px;
}
.msg-col-list .msg-toolbar h1 { font-size: 22px; }
.msg-col-list .msg-list {
  overflow-y: auto;
  flex: 1;
}
.msg-col-list .msg-item { padding: 12px 16px; }
.msg-col-list .msg-avatar,
.msg-col-list .msg-avatar-ph { width: 44px; height: 44px; font-size: 14px; }
.msg-thread {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  background: #f4f6f9;
}
.msg-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: #fff;
  border-bottom: 1px solid var(--msg-line);
}
.msg-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.msg-contact strong {
  display: block;
  font-size: 16px;
}
.msg-contact span {
  font-size: 12px;
  color: var(--msg-muted);
}
.msg-back {
  display: none;
  color: var(--msg-navy);
  font-size: 20px;
  margin-right: 4px;
}
.msg-history {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-day {
  align-self: center;
  background: #fff;
  border: 1px solid var(--msg-line);
  color: #555;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin: 8px 0;
}
.msg-listing {
  align-self: center;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--msg-line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.msg-listing a {
  color: var(--msg-blue);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.msg-row {
  display: flex;
  width: 100%;
}
.msg-row.is-me { justify-content: flex-end; }
.msg-row.is-them { justify-content: flex-start; }
.msg-row.is-system { justify-content: center; }
.msg-bubble {
  max-width: min(72%, 520px);
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.is-me .msg-bubble {
  background: var(--msg-navy);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-row.is-them .msg-bubble {
  background: #fff;
  border: 1px solid #e4e7ec;
  color: var(--msg-text);
  border-bottom-left-radius: 4px;
}
.msg-row.is-system .msg-bubble {
  max-width: min(88%, 440px);
  background: #fff;
  color: var(--msg-text);
  border: 1px solid #dbe7f5;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 59, 149, 0.05);
  white-space: normal;
}
.msg-card-body { white-space: pre-wrap; }
.msg-row.kind-cancel .msg-bubble { border-color: #f3d19e; }
.msg-row.kind-auto .msg-bubble { border-color: #e2e8f0; background: #f8fafc; }
.msg-card-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--msg-navy);
  margin-bottom: 6px;
}
.msg-row.kind-cancel .msg-card-kicker { color: #9a6200; }
.msg-row.kind-auto .msg-card-kicker { color: #475569; }
.msg-time {
  display: block;
  font-size: 10px;
  opacity: 0.7;
  margin-top: 6px;
  text-align: right;
}
.msg-row.is-system .msg-time { text-align: left; opacity: 0.55; }
.msg-composer {
  padding: 12px 16px 16px;
  background: #fff;
  border-top: 1px solid var(--msg-line);
}
.msg-quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.msg-quick button {
  flex-shrink: 0;
  border: 1px solid var(--msg-line);
  background: #fff;
  color: var(--msg-navy);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.msg-quick button:hover { border-color: var(--msg-blue); background: #f3f7ff; }
.msg-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.msg-form textarea {
  flex: 1;
  min-height: 48px;
  max-height: 140px;
  padding: 12px 16px;
  border: 1px solid var(--msg-line);
  border-radius: 24px;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
}
.msg-form textarea:focus { border-color: var(--msg-blue); }
.msg-send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--msg-navy);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}
.msg-send:disabled { opacity: 0.5; cursor: not-allowed; }
.msg-toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.msg-toast.show { opacity: 1; }
.msg-nav-badge {
  background: #003b95;
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  margin-left: 4px;
}
.msg-hidden { display: none !important; }
body.msg-body .search-bar-premium { display: none !important; }
body.msg-body header.site-header {
  position: sticky;
  top: 0;
}

@media (max-width: 860px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-col-list { display: none; }
  .msg-app.inbox-only .msg-col-list { display: block; }
  .msg-app.inbox-only .msg-shell { border: 0; border-radius: 0; min-height: calc(100vh - 80px); padding: 0 0 24px; }
  .msg-back { display: inline-flex; }
  .msg-thread { min-height: calc(100vh - 80px); }
  .msg-toolbar { padding: 14px 14px 12px; }
  .msg-toolbar h1 { font-size: 22px; }
  .msg-search input { font-size: 16px; min-height: 44px; }
  .msg-filter button, .msg-filter-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
  }
  .msg-item { padding: 12px 14px; }
}
