/* ══════════════════════════════════════════════════════════════
   AutoKul Inbox — v2 redesign
   Calm, dense, readable. Built for people who live in it all day.
   Drop-in replacement: every class / id the JS uses is unchanged.
   ══════════════════════════════════════════════════════════════ */

/* ── Design tokens (dark = default) ───────────────────────── */
:root {
  /* legacy names kept — other dashboard code may read them */
  --inbox-bg: #0b0d11;
  --inbox-bg-secondary: #12151b;
  --inbox-card: #181c24;
  --inbox-border: rgba(255, 255, 255, 0.07);
  --inbox-accent: #3d8bff;
  --inbox-accent-hover: #5a9fff;
  --inbox-accent-soft: rgba(61, 139, 255, 0.14);
  --inbox-success: #2fcf7a;
  --inbox-text: #eceff5;
  --inbox-text-secondary: #a3acbb;
  --inbox-text-muted: #6f7888;
  --inbox-radius-sm: 8px;
  --inbox-radius-card: 12px;
  --inbox-radius-btn: 10px;
  --inbox-radius-input: 12px;
  --inbox-radius-bubble: 18px;
  --inbox-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --inbox-shadow-md: 0 8px 28px rgba(0, 0, 0, 0.4);
  --inbox-glow-blue: none;
  --inbox-hover: rgba(255, 255, 255, 0.045);
  --inbox-hover-strong: rgba(255, 255, 255, 0.08);
  --inbox-transition: 140ms cubic-bezier(0.2, 0, 0, 1);

  /* new tokens */
  --ak-font: "Inter", "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ak-sidebar-w: clamp(320px, 27vw, 392px);
  --ak-chat-bg: #0b0d11;
  --ak-dots: rgba(255, 255, 255, 0.035);
  --ak-bubble-in: #1a1f28;
  --ak-bubble-in-fg: #eceff5;
  --ak-bubble-in-line: rgba(255, 255, 255, 0.05);
  --ak-out-bg: #0f6a58;
  --ak-out-fg: #f4fffb;
  --ak-out-time: rgba(244, 255, 251, 0.6);
  --ak-tick: #7fd8ff;
  --ak-sep-bg: rgba(255, 255, 255, 0.06);
  --ak-sep-fg: #9aa3b2;
  --ak-active-bg: rgba(61, 139, 255, 0.12);
  --ak-popup-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --ak-warn: #f5a524;
}

html.theme-light {
  --inbox-bg: #f4f6f9;
  --inbox-bg-secondary: #ffffff;
  --inbox-card: #f1f3f7;
  --inbox-border: rgba(15, 23, 42, 0.09);
  --inbox-accent: #2563eb;
  --inbox-accent-hover: #1d4ed8;
  --inbox-accent-soft: rgba(37, 99, 235, 0.09);
  --inbox-success: #16a34a;
  --inbox-text: #0f172a;
  --inbox-text-secondary: #4b5565;
  --inbox-text-muted: #8a93a3;
  --inbox-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --inbox-shadow-md: 0 8px 28px rgba(15, 23, 42, 0.12);
  --inbox-hover: rgba(15, 23, 42, 0.045);
  --inbox-hover-strong: rgba(15, 23, 42, 0.08);

  --ak-chat-bg: #eef1f6;
  --ak-dots: rgba(15, 23, 42, 0.05);
  --ak-bubble-in: #ffffff;
  --ak-bubble-in-fg: #0f172a;
  --ak-bubble-in-line: rgba(15, 23, 42, 0.07);
  --ak-out-bg: #d5f5e3;
  --ak-out-fg: #06281b;
  --ak-out-time: rgba(6, 40, 27, 0.55);
  --ak-tick: #0e8fd0;
  --ak-sep-bg: rgba(15, 23, 42, 0.06);
  --ak-sep-fg: #5b6474;
  --ak-active-bg: rgba(37, 99, 235, 0.08);
  --ak-popup-shadow: 0 18px 50px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* ── Shell ────────────────────────────────────────────────── */
#section-inbox {
  height: 100%;
  background: var(--inbox-bg);
  font-family: var(--ak-font);
  color: var(--inbox-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#section-inbox button { font-family: inherit; }
#section-inbox .inbox-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
#section-inbox :focus-visible {
  outline: 2px solid var(--inbox-accent);
  outline-offset: 2px;
}

/* ══ Sidebar ═════════════════════════════════════════════════ */
#section-inbox .inbox-sidebar {
  width: var(--ak-sidebar-w);
  min-width: var(--ak-sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--inbox-bg-secondary);
  border-right: 1px solid var(--inbox-border);
}
#section-inbox .inbox-sidebar-header {
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--inbox-border);
}
/* optional title row (see README — add if you want a heading) */
#section-inbox .inbox-sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 4px 2px;
}

/* Search */
#section-inbox .inbox-sidebar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--inbox-card);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 8px 0 12px;
  height: 40px;
  transition: border-color var(--inbox-transition), background var(--inbox-transition), box-shadow var(--inbox-transition);
}
#section-inbox .inbox-sidebar-search:hover { border-color: var(--inbox-border); }
#section-inbox .inbox-sidebar-search:focus-within {
  border-color: var(--inbox-accent);
  box-shadow: 0 0 0 3px var(--inbox-accent-soft);
  background: var(--inbox-bg-secondary);
}
#section-inbox .inbox-sidebar-search svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--inbox-text-muted);
}
#section-inbox .inbox-sidebar-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--inbox-text);
  font-size: 14px;
  font-family: inherit;
}
#section-inbox .inbox-sidebar-search input::placeholder { color: var(--inbox-text-muted); }

/* Excel export */
#section-inbox .uni-export-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(47, 207, 122, 0.3);
  background: rgba(47, 207, 122, 0.1);
  color: var(--inbox-success);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--inbox-transition), transform var(--inbox-transition);
}
#section-inbox .uni-export-btn:hover { background: rgba(47, 207, 122, 0.2); }
#section-inbox .uni-export-btn:active { transform: scale(0.97); }
#section-inbox .uni-export-btn:disabled { opacity: 0.55; cursor: wait; }

/* Platform filter — segmented chips */
#section-inbox .inbox-filter-pills {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -2px;
  padding: 0 2px 2px;
}
#section-inbox .inbox-filter-pills::-webkit-scrollbar { display: none; }
#section-inbox .inbox-filter-pills {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
#section-inbox .inbox-filter-pill {
  flex-shrink: 0;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--inbox-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--inbox-transition), color var(--inbox-transition);
  white-space: nowrap;
}
#section-inbox .inbox-filter-pill:hover {
  background: var(--inbox-hover);
  color: var(--inbox-text);
}
#section-inbox .inbox-filter-pill--active,
#section-inbox .inbox-filter-pill--active:hover {
  background: var(--inbox-text);
  color: var(--inbox-bg-secondary);
  font-weight: 600;
}

/* Label pills (second row, only shown if tags exist) */
.inbox-label-pills {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 0 2px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.inbox-label-pills::-webkit-scrollbar { display: none; }
.inbox-label-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--inbox-border);
  background: transparent;
  color: var(--inbox-text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--inbox-transition), border-color var(--inbox-transition), color var(--inbox-transition);
}
.inbox-label-pill:hover { background: var(--inbox-hover); color: var(--inbox-text); }
.inbox-label-pill--active,
.inbox-label-pill--active:hover {
  background: var(--inbox-accent-soft);
  border-color: color-mix(in srgb, var(--inbox-accent) 55%, transparent);
  color: var(--inbox-text);
}
.inbox-label-pill__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Legacy label dropdown (kept for older markup) */
.inbox-tag-filter {
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--inbox-border);
  background: var(--inbox-card); color: var(--inbox-text-muted);
}
.inbox-tag-filter select {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--inbox-text); font-size: 13px; padding: 9px 0; cursor: pointer;
}
.inbox-tag-filter select option { background: var(--inbox-card); color: var(--inbox-text); }

/* List scroller */
#section-inbox .inbox-sidebar-contact-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 6px 20px;
  overscroll-behavior: contain;
}

/* ── Conversation row ─────────────────────────────────────── */
.inbox-cc {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  margin: 0 0 1px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--inbox-text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  transition: background var(--inbox-transition);
  -webkit-tap-highlight-color: transparent;
}
.inbox-cc:hover { background: var(--inbox-hover); }
.inbox-cc:active { background: var(--inbox-hover-strong); }
.inbox-cc--active,
.inbox-cc--active:hover { background: var(--ak-active-bg) !important; }
.inbox-cc--active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--inbox-accent);
}

/* Avatar + platform badge */
.inbox-cc__av {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
}
.inbox-cc__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.inbox-cc:not(.inbox-cc--has-av) > .inbox-cc__avatar { /* legacy markup without wrapper */ }
.inbox-cc__avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.inbox-cc__pbadge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2.5px var(--inbox-bg-secondary);
}
.inbox-cc__pbadge svg { width: 12px; height: 12px; display: block; }
.inbox-cc__pbadge--tt { box-shadow: 0 0 0 2.5px var(--inbox-bg-secondary), inset 0 0 0 1px rgba(255,255,255,.25); }
.inbox-cc__pbadge--wa svg, .inbox-cc__pbadge--waba svg { width: 13px; height: 13px; }
.inbox-cc:hover .inbox-cc__pbadge { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--inbox-bg-secondary) 94%, var(--inbox-text)); }
.inbox-cc--active .inbox-cc__pbadge { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--inbox-bg-secondary) 88%, var(--inbox-accent)); }

.inbox-cc__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inbox-cc__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}
.inbox-cc__name {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  color: var(--inbox-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-cc__nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-cc__name > .uni-loop-flag,
.inbox-cc__name > .uni-fav-star { flex-shrink: 0; }
/* long labels shrink with an ellipsis instead of crushing the name */
.inbox-cc__name > .uni-tag-badge { flex-shrink: 1; min-width: 0; max-width: 44%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-cc__name--unread { font-weight: 700; }
.inbox-cc__time {
  font-size: 11.5px;
  color: var(--inbox-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.inbox-cc__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-cc__preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--inbox-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-cc__meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
/* the platform name is now carried by the avatar badge — keep for a11y only */
.inbox-cc__platform {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.inbox-cc__platform-dot { display: none; }
.inbox-cc__ai {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--inbox-success);
  background: rgba(47, 207, 122, 0.12);
}
.inbox-cc__ai--off {
  color: var(--inbox-text-muted);
  background: var(--inbox-hover);
}
.inbox-cc__unread {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--inbox-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* badges that live inside names (list + header) */
.uni-tag-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 6px;
  border-radius: 999px;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.55;
  vertical-align: 1px;
  cursor: pointer;
  transition: transform var(--inbox-transition), filter var(--inbox-transition);
}
.uni-tag-badge:hover { transform: translateY(-1px); filter: brightness(1.1); }
.uni-ad-badge {
  display: inline-block;
  max-width: 220px;
  padding: 1px 8px;
  margin-left: 6px;
  border-radius: 999px;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.55;
  vertical-align: 1px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uni-fav-star { font-size: 11px; margin-right: 4px; }
.uni-loop-flag { font-size: 11px; margin-left: 4px; }

/* ── Skeleton rows (shown while the list loads) ───────────── */
.inbox-skel { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.inbox-skel__av,
.inbox-skel__l1,
.inbox-skel__l2 {
  background: linear-gradient(90deg, var(--inbox-hover) 25%, var(--inbox-hover-strong) 50%, var(--inbox-hover) 75%);
  background-size: 200% 100%;
  animation: akShimmer 1.4s linear infinite;
}
.inbox-skel__av { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; }
.inbox-skel__body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.inbox-skel__l1 { height: 11px; width: 48%; border-radius: 6px; }
.inbox-skel__l2 { height: 10px; width: 82%; border-radius: 6px; }
@keyframes akShimmer { to { background-position: -200% 0; } }

/* ══ Chat panel ══════════════════════════════════════════════ */
#section-inbox .inbox-chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--ak-chat-bg);
}
#section-inbox .inbox-chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
  background-image: radial-gradient(var(--ak-dots) 1px, transparent 1px);
  background-size: 22px 22px;
}
#section-inbox .inbox-chat-empty-state svg {
  width: 56px; height: 56px;
  padding: 14px;
  border-radius: 18px;
  color: var(--inbox-accent);
  background: var(--inbox-accent-soft);
}
#section-inbox .inbox-chat-empty-state h3 {
  margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; color: var(--inbox-text);
}
#section-inbox .inbox-chat-empty-state p {
  margin: 0;
  color: var(--inbox-text-muted);
  font-size: 13.5px;
  max-width: 280px;
  line-height: 1.55;
}

/* ── Header ───────────────────────────────────────────────── */
.inbox-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  padding: 10px 18px;
  background: var(--inbox-bg-secondary);
  border-bottom: 1px solid var(--inbox-border);
  position: relative;
  z-index: 5;
}
.inbox-chat-header__back {
  display: none;
  width: 36px; height: 36px;
  margin-left: -6px;
  align-items: center; justify-content: center;
  background: none; border: none; border-radius: 10px;
  color: var(--inbox-text-secondary);
  font-size: 22px; line-height: 1;
  cursor: pointer;
}
.inbox-chat-header__back:hover { background: var(--inbox-hover); color: var(--inbox-text); }
.inbox-chat-header__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.inbox-chat-header__info { flex: 1; min-width: 0; }
.inbox-chat-header__name {
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--inbox-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inbox-chat-header__meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 1px;
  font-size: 12px;
  color: var(--inbox-text-muted);
}
.inbox-chat-header__status {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inbox-chat-header__status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--inbox-success);
  box-shadow: 0 0 0 3px rgba(47, 207, 122, 0.16);
  flex-shrink: 0;
}

/* AI switch lives in #uni-chat-controls */
.inbox-ai-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--inbox-border);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--inbox-text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--inbox-transition), border-color var(--inbox-transition), color var(--inbox-transition);
}
.inbox-ai-toggle:hover { background: var(--inbox-hover); }
.inbox-ai-toggle:has(.inbox-ai-toggle__input:checked) {
  color: var(--inbox-success);
  border-color: rgba(47, 207, 122, 0.35);
  background: rgba(47, 207, 122, 0.09);
}
.inbox-ai-toggle__switch { position: relative; width: 28px; height: 16px; flex-shrink: 0; }
.inbox-ai-toggle__input { opacity: 0; width: 0; height: 0; position: absolute; }
.inbox-ai-toggle__track {
  position: absolute; inset: 0;
  background: var(--inbox-hover-strong);
  border-radius: 999px;
  transition: background var(--inbox-transition);
  cursor: pointer;
}
.inbox-ai-toggle__track::after {
  content: "";
  position: absolute; left: 2px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform var(--inbox-transition);
}
.inbox-ai-toggle__input:checked + .inbox-ai-toggle__track { background: var(--inbox-success); }
.inbox-ai-toggle__input:checked + .inbox-ai-toggle__track::after { transform: translateX(12px); }
.inbox-ai-toggle__input:focus-visible + .inbox-ai-toggle__track { outline: 2px solid var(--inbox-accent); outline-offset: 2px; }

/* Header action buttons */
.inbox-chat-header__actions { display: flex; align-items: center; gap: 2px; }
#uni-chat-header-actions { position: relative; }
.inbox-chat-header__action {
  position: relative;
  width: 36px; height: 36px;
  border: none; border-radius: 10px;
  background: transparent;
  color: var(--inbox-text-secondary);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--inbox-transition), color var(--inbox-transition);
}
.inbox-chat-header__action:hover { background: var(--inbox-hover-strong); color: var(--inbox-text); }
.inbox-chat-header__action svg { width: 18px; height: 18px; }
.inbox-chat-header__action--fav-active { color: var(--ak-warn); }
.inbox-chat-header__action--fav-active svg { fill: var(--ak-warn); stroke: var(--ak-warn); }
.inbox-chat-header__action--tag-active { color: var(--ak-warn); background: rgba(245, 165, 36, 0.12); }

/* ── Messages ─────────────────────────────────────────────── */
.inbox-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px max(20px, calc((100% - 820px) / 2)) 26px;
  background-color: var(--ak-chat-bg);
  background-image: radial-gradient(var(--ak-dots) 1px, transparent 1px);
  background-size: 22px 22px;
  overscroll-behavior: contain;
}
.inbox-msg {
  display: flex;
  width: 100%;
  animation: inboxMsgIn 160ms ease both;
}
@keyframes inboxMsgIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}
.inbox-msg--in  { justify-content: flex-start; align-self: flex-start; }
.inbox-msg--out { justify-content: flex-end;   align-self: flex-end; }
/* breathing room whenever the speaker changes */
.inbox-msg--in  + .inbox-msg--out,
.inbox-msg--out + .inbox-msg--in { margin-top: 12px; }

.inbox-msg__bubble {
  position: relative;
  max-width: min(68%, 560px);
  padding: 8px 12px 7px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  border-radius: 18px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}
.inbox-msg--in .inbox-msg__bubble {
  background: var(--ak-bubble-in);
  color: var(--ak-bubble-in-fg);
  border: 1px solid var(--ak-bubble-in-line);
}
.inbox-msg--out .inbox-msg__bubble {
  background: var(--ak-out-bg);
  color: var(--ak-out-fg);
}
/* tighter corner on the side the sender is on, last bubble of a run */
.inbox-msg--in:not(:has(+ .inbox-msg--in)) .inbox-msg__bubble { border-bottom-left-radius: 5px; }
.inbox-msg--out:not(:has(+ .inbox-msg--out)) .inbox-msg__bubble { border-bottom-right-radius: 5px; }
.inbox-msg--in + .inbox-msg--in .inbox-msg__bubble { border-top-left-radius: 7px; }
.inbox-msg--out + .inbox-msg--out .inbox-msg__bubble { border-top-right-radius: 7px; }

/* time + ticks, tucked bottom-right inside the bubble */
.inbox-msg__meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0 -2px 12px;
  position: relative;
  top: 2px;
}
.inbox-msg__time {
  font-size: 10.5px;
  color: var(--ak-out-time);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.inbox-msg--in .inbox-msg__time { color: var(--inbox-text-muted); }
.inbox-msg__ticks { width: 15px; height: 11px; color: var(--ak-tick); flex-shrink: 0; }

/* Day separator */
.inbox-day-sep {
  align-self: center;
  margin: 16px 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--ak-sep-bg);
  color: var(--ak-sep-fg);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.inbox-day-sep:first-child { margin-top: 2px; }

/* Per-platform outgoing colour (set by renderMessages via data-platform) */
.inbox-chat-messages[data-platform="fb"] { --ak-out-bg: #1d6ff2; --ak-out-fg: #fff; --ak-out-time: rgba(255,255,255,.7); --ak-tick: #cfe3ff; }
.inbox-chat-messages[data-platform="ig"] { --ak-out-bg: linear-gradient(135deg, #5b51e0, #b149df); --ak-out-fg: #fff; --ak-out-time: rgba(255,255,255,.7); --ak-tick: #f0dcff; }
.inbox-chat-messages[data-platform="tt"] { --ak-out-bg: #e8294f; --ak-out-fg: #fff; --ak-out-time: rgba(255,255,255,.7); --ak-tick: #ffd3dc; }
.inbox-chat-messages[data-platform="tg"] { --ak-out-bg: #2a9fdc; --ak-out-fg: #fff; --ak-out-time: rgba(255,255,255,.72); --ak-tick: #d6f1ff; }
html.theme-light .inbox-chat-messages[data-platform="fb"],
html.theme-light .inbox-chat-messages[data-platform="ig"],
html.theme-light .inbox-chat-messages[data-platform="tt"],
html.theme-light .inbox-chat-messages[data-platform="tg"] { --ak-out-fg: #fff; }

/* ── Media in bubbles ─────────────────────────────────────── */
.inbox-msg__bubble--media { padding: 4px; overflow: hidden; max-width: min(76%, 380px); }
.inbox-msg--in .inbox-msg__bubble--media { background: var(--ak-bubble-in); }
.inbox-msg__media-img {
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 340px;
  border-radius: 14px;
  cursor: zoom-in;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
}
.inbox-msg__media-img--sticker { max-height: 150px; background: transparent; }
.inbox-msg__caption { font-size: 14px; line-height: 1.45; padding: 7px 8px 3px; word-break: break-word; }
.inbox-msg__bubble--media .inbox-msg__meta { padding: 0 6px 2px 0; margin-top: 2px; }

.inbox-voice { display: flex; align-items: center; gap: 10px; min-width: 232px; padding: 6px 8px 6px 6px; }
.inbox-voice__play {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--inbox-bg);
  background: var(--inbox-text);
  transition: transform var(--inbox-transition);
}
.inbox-msg--out .inbox-voice__play { background: rgba(255, 255, 255, 0.92); color: #0b1b16; }
.inbox-voice__play:hover { transform: scale(1.07); }
.inbox-voice__play:active { transform: scale(0.95); }
.inbox-voice__icon { flex: 0 0 auto; opacity: 0.6; display: none; }
.inbox-voice__wave {
  flex: 1 1 auto;
  height: 22px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 20%, #000 80%, transparent 100%);
  opacity: 0.38;
  position: relative;
  overflow: hidden;
}
.inbox-voice__prog { position: absolute; inset: 0; width: 0%; background: var(--inbox-accent); opacity: 0.9; transition: width 150ms linear; }
.inbox-voice__dur { flex: 0 0 auto; min-width: 28px; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; opacity: 0.75; }

.inbox-file { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 6px 10px 6px 6px; text-decoration: none; color: inherit; }
.inbox-file__icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444);
}
.inbox-file__meta { display: flex; flex-direction: column; min-width: 0; }
.inbox-file__name { font-size: 13px; font-weight: 600; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.inbox-file__size { font-size: 11px; opacity: 0.65; }
.inbox-file__dl { margin-left: auto; font-size: 15px; opacity: 0.7; }
.inbox-file:hover .inbox-file__dl { opacity: 1; }
.inbox-media-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; opacity: 0.92; }
.inbox-media-chip__emoji { font-size: 16px; line-height: 1; }

/* Lightbox */
.ak-inbox-lightbox { display: none; position: fixed; inset: 0; z-index: 99999; align-items: center; justify-content: center; }
.ak-inbox-lightbox.is-open { display: flex; }
.ak-inbox-lightbox__backdrop { position: absolute; inset: 0; background: rgba(5, 7, 10, 0.9); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ak-inbox-lightbox__img { position: relative; z-index: 1; max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); animation: inboxMsgIn 160ms ease both; }
.ak-inbox-lightbox__close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff; font-size: 15px; cursor: pointer;
}
.ak-inbox-lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }

/* ══ Composer ════════════════════════════════════════════════ */
.inbox-composer {
  position: relative;
  padding: 10px max(16px, calc((100% - 820px) / 2)) 16px;
  background: var(--ak-chat-bg);
  border-top: none;
}
.inbox-composer__inner {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--inbox-bg-secondary);
  border: 1px solid var(--inbox-border);
  border-radius: 22px;
  padding: 5px 5px 5px 8px;
  box-shadow: var(--inbox-shadow-sm);
  transition: border-color var(--inbox-transition), box-shadow var(--inbox-transition);
}
.inbox-composer__inner:focus-within {
  border-color: color-mix(in srgb, var(--inbox-accent) 55%, transparent);
  box-shadow: 0 0 0 3px var(--inbox-accent-soft);
}
.inbox-composer__btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none; background: transparent;
  color: var(--inbox-text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color var(--inbox-transition), background var(--inbox-transition);
}
.inbox-composer__btn svg { width: 19px; height: 19px; }
.inbox-composer__btn:hover { color: var(--inbox-text); background: var(--inbox-hover-strong); }
.inbox-composer__input {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 140px;
  padding: 8px 6px;
  background: transparent;
  border: none; outline: none; resize: none;
  color: var(--inbox-text);
  font-size: 14.5px; font-family: inherit; line-height: 1.5;
}
.inbox-composer__input::placeholder { color: var(--inbox-text-muted); }
.inbox-composer__send {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--inbox-accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--inbox-transition), transform var(--inbox-transition), opacity var(--inbox-transition);
}
.inbox-composer__send svg { width: 18px; height: 18px; }
.inbox-composer__send:hover { background: var(--inbox-accent-hover); transform: scale(1.06); }
.inbox-composer__send:active { transform: scale(0.94); }
.inbox-composer__send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
/* send button follows the platform colour */
.inbox-chat-messages[data-platform="fb"] ~ .inbox-composer .inbox-composer__send { background: #1d6ff2; }
.inbox-chat-messages[data-platform="ig"] ~ .inbox-composer .inbox-composer__send { background: linear-gradient(135deg, #5b51e0, #b149df); }
.inbox-chat-messages[data-platform="tt"] ~ .inbox-composer .inbox-composer__send { background: #e8294f; }
.inbox-chat-messages[data-platform="tg"] ~ .inbox-composer .inbox-composer__send { background: #2a9fdc; }
.inbox-chat-messages[data-platform="wa"] ~ .inbox-composer .inbox-composer__send,
.inbox-chat-messages[data-platform="waba"] ~ .inbox-composer .inbox-composer__send { background: #17a37f; }

/* Emoji panel */
.uni-emoji-panel {
  position: absolute;
  bottom: calc(100% - 4px);
  left: max(16px, calc((100% - 820px) / 2));
  z-index: 60;
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  width: 300px;
  max-width: calc(100% - 32px);
  padding: 8px;
  background: var(--inbox-bg-secondary);
  border: 1px solid var(--inbox-border);
  border-radius: 16px;
  box-shadow: var(--ak-popup-shadow);
  animation: uniPopupIn 140ms ease;
}
.uni-emoji-panel__item {
  width: 38px; height: 38px;
  border: none; border-radius: 10px; background: transparent;
  font-size: 20px; line-height: 1; cursor: pointer;
  transition: background var(--inbox-transition), transform var(--inbox-transition);
}
.uni-emoji-panel__item:hover { background: var(--inbox-hover-strong); transform: scale(1.14); }

/* Attachment preview */
.uni-attach-preview {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--inbox-bg-secondary);
  border: 1px solid var(--inbox-border);
  border-radius: 16px;
  box-shadow: var(--inbox-shadow-sm);
  animation: inboxMsgIn 140ms ease both;
}
.uni-attach-preview__thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.uni-attach-preview__icon {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 10px;
  background: var(--inbox-accent-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.uni-attach-preview__meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; gap: 1px; }
.uni-attach-preview__name { font-size: 13px; font-weight: 600; color: var(--inbox-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uni-attach-preview__hint { font-size: 11.5px; color: var(--inbox-text-muted); }
.uni-attach-preview__remove {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--inbox-hover); color: var(--inbox-text-secondary);
  cursor: pointer; font-size: 12px;
  transition: background var(--inbox-transition), color var(--inbox-transition);
}
.uni-attach-preview__remove:hover { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Voice recording */
.uni-rec-timer {
  position: absolute; top: -12px; left: max(16px, calc((100% - 820px) / 2)); z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 13px; border-radius: 999px;
  background: #e5484d; color: #fff;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(229, 72, 77, 0.45);
}
.uni-rec-timer__dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: uniRecPulse 1s ease infinite; }
.uni-rec-timer__hint { opacity: 0.85; font-weight: 500; }
@keyframes uniRecPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }
.inbox-composer__btn--mic.recording { color: #fff; background: #e5484d; animation: uniRecPulse 1s ease infinite; }

/* ══ Popups: tag popover + more menu ═════════════════════════ */
.uni-tag-menu,
.uni-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  background: var(--inbox-bg-secondary);
  border: 1px solid var(--inbox-border);
  border-radius: 16px;
  box-shadow: var(--ak-popup-shadow);
  padding: 12px;
  color: var(--inbox-text);
  transform-origin: top right;
  animation: uniPopupIn 140ms ease;
}
@keyframes uniPopupIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.uni-tag-menu { width: 256px; max-width: calc(100vw - 32px); }
.uni-tag-menu__title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--inbox-text-muted); margin-bottom: 10px; }
.uni-tag-menu__presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.uni-tag-chip {
  border: none; color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; opacity: 0.88;
  transition: opacity var(--inbox-transition), transform var(--inbox-transition), box-shadow var(--inbox-transition);
}
.uni-tag-chip:hover { opacity: 1; transform: translateY(-1px); }
.uni-tag-chip--active { opacity: 1; box-shadow: 0 0 0 2px var(--inbox-bg-secondary), 0 0 0 4px var(--ak-warn); }
.uni-tag-menu__custom { display: flex; gap: 6px; margin-bottom: 6px; }
.uni-tag-menu__custom input {
  flex: 1; min-width: 0; font-size: 13px; padding: 8px 11px;
  border-radius: 10px; border: 1px solid var(--inbox-border);
  background: var(--inbox-card); color: var(--inbox-text); outline: none;
  transition: border-color var(--inbox-transition);
}
.uni-tag-menu__custom input::placeholder { color: var(--inbox-text-muted); }
.uni-tag-menu__custom input:focus { border-color: var(--inbox-accent); }
.uni-tag-menu__custom button {
  border: none; background: var(--inbox-accent); color: #fff;
  font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: 10px; cursor: pointer;
}
.uni-tag-menu__custom button:hover { background: var(--inbox-accent-hover); }
.uni-tag-menu__clear {
  width: 100%; border: none; background: transparent;
  color: var(--inbox-text-secondary); font-size: 12px; padding: 8px; border-radius: 9px; cursor: pointer;
  transition: background var(--inbox-transition), color var(--inbox-transition);
}
.uni-tag-menu__clear:hover { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

.uni-more-menu { width: 232px; max-width: calc(100vw - 32px); padding: 6px; }
.uni-more-menu button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; border: none; background: transparent;
  color: var(--inbox-text); font-size: 13.5px; font-weight: 500; text-align: left;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background var(--inbox-transition);
}
.uni-more-menu button span { color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uni-more-menu button svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.uni-more-menu button:hover { background: var(--inbox-hover-strong); }
.uni-more-menu button:last-child { color: #ef4444; }
.uni-more-menu button:last-child:hover { background: rgba(239, 68, 68, 0.12); }

/* ══ Customer panel (right) ══════════════════════════════════ */
.inbox-panel {
  width: 0; overflow: hidden; flex-shrink: 0;
  background: var(--inbox-bg-secondary);
  border-left: 1px solid var(--inbox-border);
  transition: width 200ms cubic-bezier(0.2, 0, 0, 1);
}
.inbox-panel--open { width: 320px; }
.inbox-panel__inner { width: 320px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; padding: 16px; gap: 12px; box-sizing: border-box; }
.inbox-panel__section { background: var(--inbox-card); border: 1px solid var(--inbox-border); border-radius: 14px; padding: 14px 16px; }
.inbox-panel__label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--inbox-text-muted); margin-bottom: 10px; }
.inbox-panel__profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 10px 0 4px; }
.inbox-panel__profile-avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 22px; color: #fff; overflow: hidden; flex-shrink: 0; }
.inbox-panel__profile-name { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; color: var(--inbox-text); line-height: 1.3; }
.inbox-panel__profile-platform { font-size: 12.5px; color: var(--inbox-text-muted); }
.inbox-panel__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.inbox-panel__row + .inbox-panel__row { border-top: 1px solid var(--inbox-border); }
.inbox-panel__row-key { color: var(--inbox-text-muted); font-size: 12.5px; }
.inbox-panel__row-value { color: var(--inbox-text-secondary); text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
#uni-panel-labels, #uni-panel-notes { color: var(--inbox-text-muted); font-size: 13px; }

/* ══ States ══════════════════════════════════════════════════ */
.inbox-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 44px 20px; color: var(--inbox-text-muted); font-size: 13px; }
.inbox-loading__spinner { width: 16px; height: 16px; border: 2px solid var(--inbox-border); border-top-color: var(--inbox-accent); border-radius: 50%; animation: inboxSpin 0.7s linear infinite; }
@keyframes inboxSpin { to { transform: rotate(360deg); } }
.inbox-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 24px; color: var(--inbox-text-muted); font-size: 13.5px; text-align: center; line-height: 1.5; }
.inbox-error { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #ef4444; font-size: 13px; text-align: center; }

/* Scrollbars */
#section-inbox * { scrollbar-width: thin; scrollbar-color: var(--inbox-hover-strong) transparent; }
#section-inbox ::-webkit-scrollbar { width: 6px; height: 6px; }
#section-inbox ::-webkit-scrollbar-track { background: transparent; }
#section-inbox ::-webkit-scrollbar-thumb { background: var(--inbox-hover-strong); border-radius: 6px; }
#section-inbox ::-webkit-scrollbar-thumb:hover { background: var(--inbox-text-muted); }

@media (min-width: 769px) {
  .inbox-chat-header__back { display: none !important; }
}

/* ══ Narrow desktop: collapse the customer panel first ═══════ */
@media (max-width: 1180px) {
  .inbox-panel--open { width: 280px; }
  .inbox-panel__inner { width: 280px; }
}

/* ══ Mobile (≤768px) — list ⇄ chat, driven by body.uni-chat-open ══ */
@media (max-width: 768px) {
  #section-inbox .inbox-sidebar { width: 100% !important; min-width: 0 !important; display: flex !important; border-right: none; }
  #section-inbox .inbox-chat-panel { display: none !important; }
  .inbox-panel { display: none !important; }
  .inbox-chat-header__back { display: none !important; }

  body.uni-chat-open #section-inbox .inbox-sidebar { display: none !important; }
  body.uni-chat-open #section-inbox .inbox-chat-panel { display: flex !important; width: 100% !important; }
  body.uni-chat-open .inbox-panel { display: none !important; }
  body.uni-chat-open .inbox-chat-header__back { display: inline-flex !important; }
  body.uni-chat-open .inbox-chat-messages { flex: 1; min-height: 0; }

  #section-inbox .inbox-sidebar-header { padding: 12px 12px 8px; gap: 8px; }
  #section-inbox .inbox-sidebar-search { height: 42px; }
  #section-inbox .inbox-sidebar-search input { font-size: 16px; } /* no iOS zoom */
  #section-inbox .inbox-filter-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  #section-inbox .inbox-filter-pills::-webkit-scrollbar { display: none; }
  #section-inbox .inbox-filter-pill { flex-shrink: 0; height: 32px; padding: 0 14px; }
  .inbox-cc { padding: 12px 10px; }

  .inbox-chat-header { padding: 8px 10px; min-height: 56px; gap: 8px; }
  .inbox-chat-header__avatar { width: 36px; height: 36px; font-size: 14px; }
  .inbox-chat-header__name { font-size: 15px; }
  .inbox-chat-header__meta { font-size: 11px; }
  .inbox-chat-header__actions { gap: 0; }
  .inbox-chat-header__action { width: 36px; height: 36px; }
  /* AI pill: label shrinks to "AI" so the contact name keeps room */
  .inbox-ai-toggle { height: 28px; padding: 0 9px 0 7px; font-size: 0; gap: 6px; }
  .inbox-ai-toggle::after { content: "AI"; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; }
  .inbox-chat-header .uni-tag-badge, .inbox-chat-header .uni-ad-badge { display: none; }
  .uni-tag-menu, .uni-more-menu { position: fixed; top: 60px; right: 10px; left: auto; z-index: 200; }
  .uni-more-menu button { padding: 13px 12px; font-size: 14.5px; }

  .inbox-chat-messages { padding: 14px 10px 16px; scrollbar-width: none; }
  .inbox-chat-messages::-webkit-scrollbar { display: none; }
  .inbox-msg__bubble { max-width: 86%; font-size: 15px; }
  .inbox-msg__bubble--media { max-width: 82%; }

  .inbox-composer { padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .inbox-composer__input { font-size: 16px; }
  .uni-emoji-panel { left: 10px; max-width: calc(100vw - 20px); }
  .uni-rec-timer { left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  #section-inbox *, .inbox-msg, .uni-tag-menu, .uni-more-menu, .uni-emoji-panel { animation: none !important; transition: none !important; }
}
