:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --danger: #ef4444;
  --in: #1a2332;
  --out: #1e3a5f;
  --out-border: rgba(96, 165, 250, .22);
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 72px;
  --scroll-track: #1a1d21;
  --scroll-thumb: #3e444a;
  --scroll-thumb-hover: #525961;
  --scroll-size: 6px;
}

/* Scrollbar fina e elegante (Chrome/Edge/Safari + Firefox) */
* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
html {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
*::-webkit-scrollbar {
  width: var(--scroll-size);
  height: var(--scroll-size);
}
*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-left: 1px solid rgba(255, 255, 255, .04);
}
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 0;
  border: none;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}
*::-webkit-scrollbar-corner {
  background: var(--scroll-track);
}
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1e293b, var(--bg));
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}
body.has-shell { overflow: hidden; }
a { color: inherit; text-decoration: none; }
.muted, .hint { color: var(--muted); font-size: .9rem; }

/* ===== Shell / menu lateral ===== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  /* 100dvh respeita a barra de navegação do Android (tablet/PWA) */
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
/* Transicao so apos o 1o paint (evita animar o estado salvo do localStorage) */
html.shell-ready .app-shell {
  transition: grid-template-columns .2s ease;
}
.app-shell.sidebar-collapsed,
html.sidebar-collapsed-init .app-shell {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}
/* Espelha o estado recolhido no 1o paint (antes do shell.js) */
html.sidebar-collapsed-init .sidebar-toggle .icon-open { display: block; }
html.sidebar-collapsed-init .sidebar-toggle .icon-close { display: none; }
html.sidebar-collapsed-init .brand-text,
html.sidebar-collapsed-init .nav-label { display: none; }
html.sidebar-collapsed-init .sidebar-head { justify-content: center; }
html.sidebar-collapsed-init .sidebar-brand { display: none; }
html.sidebar-collapsed-init .nav-item,
html.sidebar-collapsed-init .sidebar-user {
  justify-content: center;
  padding-left: .6rem;
  padding-right: .6rem;
}
.sidebar {
  display: flex;
  flex-direction: column;
  background: rgba(8, 12, 24, .96);
  border-right: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  max-height: 100%;
  z-index: 30;
  overflow: hidden;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .85rem .75rem;
  border-bottom: 1px solid var(--line);
  min-height: 58px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  font-weight: 700;
  color: #60a5fa;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: #3b82f6; color: #0b1220;
  flex-shrink: 0;
  overflow: hidden;
  font-weight: 800;
}
.brand-mark.has-img { background: transparent; padding: 0; }
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.brand-text { white-space: nowrap; overflow: hidden; }
.sidebar-toggle {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-toggle .icon-open { display: none; }
.sidebar-toggle .icon-close { display: block; }
.app-shell.sidebar-collapsed .sidebar-toggle .icon-open { display: block; }
.app-shell.sidebar-collapsed .sidebar-toggle .icon-close { display: none; }
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-head { justify-content: center; }
.app-shell.sidebar-collapsed .sidebar-brand { display: none; }
.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding-left: .6rem;
  padding-right: .6rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem .5rem;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .85rem;
  border-radius: 10px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active {
  background: rgba(96, 165, 250, .14);
  color: #93c5fd;
}
.nav-item svg { flex-shrink: 0; }
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: .75rem .5rem 1rem;
  display: grid;
  gap: .35rem;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .85rem;
  color: var(--muted);
  font-size: .9rem;
}
.user-avatar {
  width: 28px; height: 28px; min-width: 28px; min-height: 28px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line);
  flex-shrink: 0; font-size: .8rem; font-weight: 600;
  overflow: hidden;
  box-sizing: border-box;
}
.user-avatar.has-img { border-color: transparent; padding: 0; }
.user-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  padding: 0;
  box-sizing: border-box;
}
.nav-item.logout:hover { color: #fca5a5; }
.shell-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.shell-main--inbox {
  grid-template-rows: 1fr;
  position: relative;
}
.shell-main--inbox .app-main {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
body.is-inbox .inbox {
  height: 100%;
  min-height: 0;
}
.inbox-menu-fab { display: none !important; }

/* Modal editar cadastro (drawer da inbox — sem sair da Entrada) */
.modal-backdrop.cd-edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .72);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal-backdrop.cd-edit-modal.open {
  display: flex;
}
.cd-edit-modal .modal-panel {
  width: min(640px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #151b2b;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  padding: 1.35rem 1.4rem 1.2rem;
}
.cd-edit-modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.cd-edit-modal .modal-head h2 { margin: 0; font-size: 1.15rem; }
.cd-edit-modal .modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
}
.cd-edit-modal .modal-close:hover { background: var(--panel-2); color: #fff; }
.cd-edit-modal .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem 1rem;
}
.cd-edit-modal .modal-field {
  display: grid;
  gap: .35rem;
  margin-bottom: .35rem;
}
.cd-edit-modal .modal-field.full { grid-column: 1 / -1; }
.cd-edit-modal .modal-field > span {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
.cd-edit-modal .modal-field input,
.cd-edit-modal .modal-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--text);
  border-radius: 10px;
  padding: .65rem .8rem;
  font: inherit;
}
.cd-edit-cats {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.cd-edit-cat {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .55);
  font-size: .78rem;
  cursor: pointer;
}
.cd-edit-cat input { accent-color: #3b82f6; }
.cd-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  margin-top: 1rem;
}
#cd-edit-error { color: #fca5a5; margin: .35rem 0 0; }
@media (max-width: 640px) {
  .cd-edit-modal .grid-2 { grid-template-columns: 1fr; }
}
.inbox-topbar-title {
  display: none;
  font-size: .95rem;
  font-weight: 650;
  color: #e2e8f0;
}
/* ☰ só no compacto — .inbox-ico não pode sobrescrever o mobile-only */
.inbox-ico.inbox-menu-btn.mobile-only {
  display: none;
  flex-shrink: 0;
}
.chat-ico-btn.chat-app-menu.mobile-only {
  display: none;
  flex-shrink: 0;
}
.chat-back-label {
  display: none;
  font-size: .78rem;
  font-weight: 650;
  margin-left: .05rem;
}
.topbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15,23,42,.9);
  backdrop-filter: blur(8px);
  min-height: 58px;
}
.topbar-title { font-weight: 600; }
.mobile-only { display: none; }
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 25;
}
.app-main { min-height: 0; overflow: auto; height: 100%; }
.auth-main {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
}
.login-card, .card, .page.narrow .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(420px, 100%);
}
.login-card h1 { margin: 0 0 .25rem; color: #60a5fa; }
.login-brand {
  display: grid;
  place-items: center;
  margin: 0 0 .35rem;
}
.login-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  border-radius: 12px;
}
.login-tagline {
  text-align: center;
  margin: 0 0 .35rem;
}
.stack { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; font-size: .9rem; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: .65rem .75rem;
  font: inherit;
}
.login-pass-wrap {
  position: relative;
  display: block;
}
.login-pass-wrap input {
  padding-right: 2.6rem;
}
.login-pass-toggle {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.login-pass-toggle:hover { color: var(--text); background: rgba(148,163,184,.12); }
.login-pass-toggle svg { width: 1.15rem; height: 1.15rem; display: block; }
.login-pass-toggle .ico-eye-off { display: none; }
.login-pass-toggle.is-showing .ico-eye { display: none; }
.login-pass-toggle.is-showing .ico-eye-off { display: block; }
.login-remember {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
  color: var(--muted);
  user-select: none;
}
.login-remember input {
  width: auto;
  margin: 0;
  accent-color: var(--accent-2);
}
.btn {
  border: 0; border-radius: 8px; padding: .6rem 1rem;
  cursor: pointer; font: inherit; color: var(--text);
}
.btn-primary { background: var(--accent-2); color: #052e16; font-weight: 600; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: opacity .35s ease, transform .35s ease, margin .35s ease, padding .35s ease, max-height .35s ease;
  max-height: 8rem;
  overflow: hidden;
}
.alert-error { background: #7f1d1d; }
.alert-ok { background: #14532d; }

/* Toast in-app (estilo UmblerTalk) — mensagens novas com o app em foco */
.pz-toast-stack {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  width: min(360px, calc(100vw - 1.5rem));
  pointer-events: none;
}
.pz-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: .7rem;
  align-items: start;
  padding: .75rem .8rem;
  border-radius: 14px;
  background: #1e2433;
  border: 1px solid rgba(148, 163, 184, .28);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  color: #e2e8f0;
  cursor: pointer;
  animation: pz-toast-in .22s ease-out;
  transform-origin: top right;
}
.pz-toast.is-hiding {
  animation: pz-toast-out .2s ease-in forwards;
}
@keyframes pz-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes pz-toast-out {
  to { opacity: 0; transform: translateY(-10px) scale(.96); }
}
.pz-toast-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e3a5f, #3b82f6);
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
}
.pz-toast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pz-toast-body { min-width: 0; }
.pz-toast-body strong {
  display: block;
  font-size: .9rem;
  margin: 0 0 .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pz-toast-body span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .8rem;
  color: #94a3b8;
  line-height: 1.35;
}
.pz-toast-close {
  border: 0;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}
.pz-toast-close:hover {
  background: rgba(148, 163, 184, .14);
  color: #e2e8f0;
}
@media (max-width: 720px) {
  .pz-toast-stack {
    right: .65rem;
    left: .65rem;
    top: .75rem;
    width: auto;
  }
}
.alert.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  max-height: 0;
  pointer-events: none;
}
.inbox { display: grid; grid-template-columns: 360px 1fr; height: 100%; }
.conv-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: rgba(15, 18, 28, .92);
  overflow: hidden;
}
.conv-filters { display: flex; gap: .5rem; padding: .75rem; border-bottom: 1px solid var(--line); }
.conv-filters a {
  font-size: .8rem; padding: .3rem .55rem; border-radius: 999px; border: 1px solid var(--line);
}
.conv-filters a.active { background: var(--accent-2); color: #052e16; border-color: transparent; }

.inbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .7rem .85rem .55rem;
  flex-shrink: 0;
}
.inbox-topbar-left {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.inbox-ico {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #60a5fa;
  cursor: pointer;
  text-decoration: none;
  flex: 0 0 auto;
  padding: 0;
}
.inbox-ico-muted { color: #94a3b8; }
.inbox-ico-muted:hover { color: #e2e8f0; background: rgba(148,163,184,.1); }
.inbox-ico-chat { color: #60a5fa; cursor: default; }
.inbox-ico-bookmark.is-on,
.inbox-ico.is-on {
  color: #60a5fa;
  background: rgba(59,130,246,.12);
}
.inbox-count-pill {
  min-width: 1.55rem;
  height: 1.45rem;
  padding: 0 .5rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #3b82f6;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
}
.btn-new-conv {
  flex: 0 0 auto;
  width: 2.2rem; height: 2.2rem; border-radius: 999px; border: 0;
  background: #3b82f6; color: #fff; font-size: 1.4rem; font-weight: 600;
  line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(59,130,246,.35);
}
.btn-new-conv:hover { filter: brightness(1.08); }
.inbox-search-bar {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin: 0;
  padding: .45rem .65rem .55rem;
  border-top: 1px solid rgba(148,163,184,.12);
  flex-shrink: 0;
}
.inbox-search {
  display: flex; align-items: center; gap: .4rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 .15rem;
  padding: .35rem .55rem;
  border-radius: 8px;
  border: 0;
  background: transparent;
}
.inbox-search-ico { color: #64748b; display: inline-grid; place-items: center; flex-shrink: 0; }
.inbox-search input {
  border: 0; background: transparent; color: inherit; width: 100%;
  min-width: 0;
  font: inherit; font-size: .88rem; outline: none;
}
.inbox-search input::placeholder { color: #64748b; }
.inbox-sort-wrap { position: relative; flex: 0 0 auto; }
.inbox-sort-menu {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 180px;
  padding: .35rem;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.22);
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.inbox-sort-menu[hidden] { display: none !important; }
.inbox-sort-item {
  display: block;
  padding: .5rem .65rem;
  border-radius: 8px;
  color: #e2e8f0;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
}
.inbox-sort-item:hover { background: rgba(59,130,246,.12); }
.inbox-sort-item.active { background: rgba(59,130,246,.22); color: #93c5fd; }
.inbox-filter-bar.is-compact {
  margin-top: 0;
  padding: .35rem .65rem;
}
.inbox-bulk-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin: 0 .85rem .45rem;
  padding: .45rem .65rem;
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.1);
  font-size: .78rem;
  font-weight: 600;
  color: #bfdbfe;
  flex-shrink: 0;
}
.inbox-bulk-bar[hidden] { display: none !important; }
.inbox-bulk-bar .danger { color: #f87171; }
.contact-check {
  display: none;
  place-items: center;
  padding-left: .55rem;
  flex: 0 0 auto;
}
.conv-list.is-selecting .contact-check {
  display: inline-grid;
}
.conv-list.is-selecting .contact-row-item {
  display: flex;
  align-items: stretch;
}
.conv-list.is-selecting .contact-card {
  flex: 1;
  min-width: 0;
}
.conv-list.is-selecting .contact-row-item.is-checked {
  background: rgba(59,130,246,.08);
}
.contact-check input {
  width: 1rem;
  height: 1rem;
  accent-color: #3b82f6;
  cursor: pointer;
}
.inbox-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .25rem;
  margin: 0 .85rem .55rem;
  padding: .25rem;
  border-radius: 999px;
  background: rgba(148,163,184,.1);
  flex-shrink: 0;
}
.inbox-tab {
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  padding: .45rem .35rem;
  border-radius: 999px;
}
.inbox-tab em {
  font-style: normal;
  opacity: .85;
  margin-left: .15rem;
}
.inbox-tab.active {
  background: #3b82f6;
  color: #fff;
}
.inbox-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: 0 .85rem .55rem;
  padding: .45rem .65rem;
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.08);
  font-size: .78rem;
  flex-shrink: 0;
}
.inbox-filter-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #93c5fd;
  font-weight: 600;
}
.inbox-filter-actions { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.linkish {
  background: none; border: 0; color: #60a5fa; cursor: pointer;
  font: inherit; font-weight: 600; padding: 0;
}
.linkish.danger { color: #f87171; }
.inbox-filter-clear {
  color: #cbd5e1; text-decoration: none; font-size: 1.1rem; line-height: 1;
  padding: 0 .15rem;
}

.filter-drawer {
  border: 0;
  padding: 0;
  margin: 0;
  width: min(420px, 100vw);
  max-width: 100%;
  height: 100vh;
  max-height: 100vh;
  background: var(--panel, #0f172a);
  color: inherit;
  position: fixed;
  inset: 0 auto 0 0;
}
.filter-drawer::backdrop { background: rgba(2,6,23,.55); }
.filter-drawer-body {
  height: 100%;
  overflow: auto;
  padding: 1rem 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.filter-drawer-body header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .55rem;
  align-items: start;
}
.filter-drawer-body header h3 { margin: 0; font-size: 1.15rem; }
.filter-block strong {
  display: block;
  margin-bottom: .45rem;
  color: #93c5fd;
  font-size: .88rem;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: #cbd5e1;
  font-size: .78rem;
  cursor: pointer;
  user-select: none;
}
.filter-chip input { display: none; }
.filter-chip.on {
  border-color: #3b82f6;
  color: #93c5fd;
  background: rgba(59,130,246,.12);
}
.filter-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

.contact-rows { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.contact-row-item { border-bottom: 1px solid rgba(51, 65, 85, .55); }
.contact-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: .75rem;
  padding: .85rem .9rem .85rem .85rem;
  position: relative;
  align-items: start;
}
.contact-row-item:hover .contact-card { background: rgba(31, 41, 55, .55); }
.contact-row-item.selected .contact-card {
  background: rgba(37, 56, 88, .55);
}
.contact-row-item.selected .contact-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #60a5fa;
  border-radius: 0 2px 2px 0;
}
.avatar-wrap { position: relative; width: 44px; height: 44px; }
.avatar {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #1f2937, #334155);
  border: 1px solid var(--line);
  font-size: .85rem; font-weight: 700; color: #e2e8f0;
  overflow: hidden;
  box-sizing: border-box;
}
.avatar.has-img {
  padding: 0;
  border-color: transparent;
  background: #0f172a; /* sem verde atrás da foto */
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  padding: 0;
  box-sizing: border-box;
  border-radius: inherit;
}
.channel-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 18px; height: 18px; border-radius: 999px;
  display: grid; place-items: center;
  background: #25d366; color: #052e16;
  border: 2px solid #0f121c;
}
.contact-main { min-width: 0; }
.contact-top {
  display: flex; justify-content: space-between; gap: .5rem; align-items: baseline;
}
.contact-name {
  font-size: .95rem; font-weight: 650; color: #f8fafc;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-row-item.unread .contact-name { color: #fff; }
.contact-time {
  flex-shrink: 0; font-size: .75rem; color: var(--muted);
}
.contact-preview {
  display: flex; align-items: center; gap: .35rem;
  margin-top: .2rem; color: var(--muted); font-size: .82rem;
  min-width: 0;
}
.ticks { color: #67e8f9; font-size: .75rem; letter-spacing: -1px; }
.preview-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-tags {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  margin-top: .45rem;
}
.pill {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 600; line-height: 1;
  padding: .28rem .55rem; border-radius: 999px;
  border: 1px solid transparent;
}
.pill-cliente {
  background: rgba(34, 197, 94, .16);
  color: #86efac;
  border-color: rgba(34, 197, 94, .35);
}
.pill-bot {
  background: rgba(56, 189, 248, .14);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, .35);
}
.pill-sector {
  margin-left: auto;
  background: rgba(15, 23, 42, .7);
  color: #cbd5e1;
  border-color: var(--line);
}
.pill-label {
  color: #fff;
  max-width: 10.5rem;
  white-space: nowrap;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  gap: .25rem;
  position: relative;
}
.pill-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}
.pill-label-live .pill-label-x {
  display: none;
  border: 0;
  background: rgba(0,0,0,.25);
  color: #fff;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  line-height: 1;
  font-size: .85rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.pill-label-live:hover .pill-label-x,
.pill-label-live:focus-within .pill-label-x {
  display: inline-grid;
  place-items: center;
}
.pill-label-conv {
  outline: 1px dashed rgba(255,255,255,.35);
  outline-offset: 1px;
}
.btn-edit-labels {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148,163,184,.12);
  color: #94a3b8;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  position: relative;
  flex-shrink: 0;
}
.btn-edit-labels:hover {
  color: #e2e8f0;
  border-color: rgba(148,163,184,.45);
  background: rgba(148,163,184,.2);
}
/* Tooltip nativo via data-tip */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: .35rem .55rem;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 80;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
[data-tip]::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 80;
}
[data-tip]:hover::after,
[data-tip]:hover::before,
[data-tip]:focus-visible::after,
[data-tip]:focus-visible::before {
  opacity: 1;
}

/* Topo da inbox / header do chat: tip abaixo (overflow do painel cortava o de cima) */
.inbox-topbar [data-tip]::after,
.inbox-search-bar [data-tip]::after,
.chat-header [data-tip]::after,
[data-tip-pos="below"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}
.inbox-topbar [data-tip]::before,
.inbox-search-bar [data-tip]::before,
.chat-header [data-tip]::before,
[data-tip-pos="below"]::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: #1e293b;
}
/* Cantos da lista: tip encosta na borda interna para nao cortar nas laterais */
.inbox-topbar .btn-new-conv[data-tip]::after,
.inbox-search-bar #btn-inbox-select[data-tip]::after {
  left: auto;
  right: 0;
  transform: none;
}
.inbox-topbar .btn-new-conv[data-tip]::before,
.inbox-search-bar #btn-inbox-select[data-tip]::before {
  left: auto;
  right: .7rem;
  transform: none;
}
.inbox-search-bar #btn-edit-filter[data-tip]::after {
  left: 0;
  right: auto;
  transform: none;
}
.inbox-search-bar #btn-edit-filter[data-tip]::before {
  left: .7rem;
  right: auto;
  transform: none;
}
.header-labels {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .28rem;
  align-items: center;
}
.ch-modal-labels { width: min(420px, calc(100vw - 2rem)); }
.labels-head-actions { display: flex; align-items: center; gap: .35rem; }
.labels-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  margin-bottom: .75rem;
  background: rgba(148,163,184,.08);
  border-radius: 10px;
  padding: .25rem;
}
.labels-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: .45rem .6rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.labels-tab.active {
  background: rgba(34, 197, 94, .18);
  color: #86efac;
}
.labels-search {
  display: flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .75rem;
  margin-bottom: .85rem;
  background: var(--panel-2);
}
.labels-search input {
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  font: inherit;
  outline: none;
}
.labels-section { margin-bottom: .85rem; }
.labels-section-title {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .4rem;
  font-weight: 600;
}
.labels-list {
  display: grid;
  gap: .35rem;
  max-height: 180px;
  overflow: auto;
}
.labels-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .4rem .5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.labels-row:hover { background: rgba(148,163,184,.08); }
.labels-row.on { border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.08); }
.labels-row .pill-label { flex: 1; min-width: 0; }
.labels-check {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  border: 1.5px solid rgba(96, 165, 250, .85);
  display: grid;
  place-items: center;
  color: #60a5fa;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.labels-row.on .labels-check {
  background: rgba(59, 130, 246, .25);
}
.unread-count {
  font-style: normal;
  min-width: 1.2rem; height: 1.2rem;
  padding: 0 .35rem;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #052e16;
  font-size: .7rem; font-weight: 700;
}
.chat-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "chat-head"
    "chat-search"
    "chat-msgs"
    "chat-composer";
  min-height: 0;
  height: 100%;
}
.chat-pane > .chat-header { grid-area: chat-head; }
.chat-pane > .chat-msg-search { grid-area: chat-search; }
.chat-pane > .messages { grid-area: chat-msgs; }
.chat-pane > .composer { grid-area: chat-composer; }
.chat-pane > .composer-closed { grid-area: chat-composer; }
.chat-pane > .empty-chat {
  grid-area: chat-msgs;
  align-self: center;
  justify-self: center;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 18, 28, .55);
  min-height: 3.4rem;
}
.chat-head-left {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  flex: 1;
}
/* Voltar / menu no chat: só no layout compacto — desktop usa o X */
.chat-ico-btn.chat-back {
  display: none;
  flex-shrink: 0;
  width: auto;
  min-width: 2rem;
  padding: 0 .35rem;
  gap: .1rem;
  border-radius: 999px;
}
.chat-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, .16);
  color: #93c5fd;
  font-size: .78rem;
  font-weight: 700;
  overflow: hidden;
  box-sizing: border-box;
}
.chat-avatar.has-img { background: #0f172a; padding: 0; }
.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  padding: 0;
  box-sizing: border-box;
}
.chat-channel-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #25d366;
  color: #fff;
  border: 2px solid rgba(15, 18, 28, .95);
}
.chat-head-meta { min-width: 0; }
.chat-contact-name {
  margin: 0;
  font-size: .98rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42vw, 360px);
}
.chat-viewers { margin: .2rem 0 0; }
.pill-sector-soft {
  display: inline-flex;
  align-items: center;
  padding: .12rem .5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .4);
  background: transparent;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 600;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-actions {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex-shrink: 0;
}
.chat-ico-form { display: inline-flex; margin: 0; }
.chat-ico-btn {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.chat-ico-btn:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, .12);
}
.chat-ico-btn.is-on { color: #60a5fa; }
.chat-msg-search {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, .45);
}
/* Mantém a área no grid (senão .messages perde o 1fr e a conversa "encolhe") */
.chat-msg-search[hidden] {
  display: block !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  visibility: hidden;
  pointer-events: none;
}
.chat-msg-search input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  color: inherit;
  padding: .4rem .75rem;
  font: inherit;
}
.chat-msg-search-meta {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}
.bubble.msg-dim {
  opacity: .35;
}
.bubble.msg-hit {
  outline: 1px solid rgba(59, 130, 246, .75);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .2);
  opacity: 1;
}
.bubble.msg-hit-current {
  outline-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .35);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
/* Contact details drawer (direita → esquerda) */
.cd-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.cd-drawer:not([hidden]) { pointer-events: auto; }
.cd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .45);
  opacity: 0;
  transition: opacity .22s ease;
}
.cd-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(400px, 100vw);
  height: 100%;
  background: #12141c;
  border-left: 1px solid rgba(51, 65, 85, .65);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
}
.cd-drawer.is-open .cd-backdrop { opacity: 1; }
.cd-drawer.is-open .cd-panel { transform: translateX(0); }
.cd-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .55rem;
  align-items: start;
  padding: .85rem .9rem .55rem;
  border-bottom: 1px solid rgba(51, 65, 85, .55);
}
.cd-identity { display: flex; gap: .65rem; align-items: center; min-width: 0; }
.cd-identity-text {
  display: flex; flex-direction: column; gap: .1rem; min-width: 0;
}
.cd-identity-text strong {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cd-identity-text span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem;
}
.cd-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  margin: .65rem .85rem .35rem;
  padding: .2rem;
  border-radius: 10px;
  background: rgba(148,163,184,.08);
}
.cd-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  padding: .5rem .35rem;
  border-radius: 8px;
  cursor: pointer;
}
.cd-tab.active {
  color: #60a5fa;
  background: rgba(59,130,246,.12);
  box-shadow: inset 0 -2px 0 #3b82f6;
}
.cd-body {
  overflow: auto;
  flex: 1;
  padding: .25rem 0 1.2rem;
}
.cd-row {
  padding: .7rem .95rem;
  border-bottom: 1px solid rgba(51, 65, 85, .45);
}
.cd-label {
  display: block;
  color: #94a3b8;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .4rem;
}
.cd-labels { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.cd-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .75rem .95rem;
  border-bottom: 1px solid rgba(51, 65, 85, .45);
  font-size: .88rem;
}
.cd-field > span { color: #cbd5e1; }
.cd-field-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
}
.cd-value {
  font-style: normal;
  color: #e2e8f0;
  font-size: .86rem;
  word-break: break-all;
}
.cd-value.muted { color: #64748b; }
.cd-nav-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .8rem .95rem;
  border: 0;
  border-bottom: 1px solid rgba(51, 65, 85, .45);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.cd-nav-row:hover { background: rgba(59,130,246,.06); }
.cd-nav-ico {
  width: 1.7rem; height: 1.7rem; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(59,130,246,.15);
  font-size: .85rem;
}
.cd-chevron { color: #64748b; font-size: 1.1rem; }
.cd-create-field {
  display: block;
  text-align: center;
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
  font-size: .86rem;
  padding: 1rem;
}
.cd-skip-bot {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .35rem .95rem .15rem;
  padding: .7rem .75rem;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  cursor: pointer;
  background: rgba(15, 23, 42, .35);
}
.cd-skip-bot input {
  margin-top: .2rem;
  width: 1rem;
  height: 1rem;
  accent-color: #2563eb;
  flex-shrink: 0;
}
.cd-skip-bot span {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  line-height: 1.25;
}
.cd-skip-bot strong {
  font-size: .9rem;
  font-weight: 600;
  color: #e2e8f0;
}
.cd-skip-bot small {
  color: #94a3b8;
  font-size: .78rem;
}
.cd-foot {
  display: grid;
  gap: .55rem;
  padding: .85rem .95rem 1.2rem;
}
.cd-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.45);
  background: transparent;
  color: #e2e8f0;
  padding: .7rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cd-btn.danger {
  border-color: rgba(248,113,113,.55);
  color: #f87171;
}
.cd-btn:hover { background: rgba(148,163,184,.08); }
.chat-avatar.sm { width: 28px; height: 28px; font-size: .65rem; }
.cd-agent-line { display: flex; align-items: center; gap: .55rem; }
.cd-sub {
  position: absolute;
  inset: 0;
  background: #12141c;
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.cd-sub[hidden],
.cd-body[hidden],
.cd-drawer[hidden] {
  display: none !important;
}

.sch-head .cd-identity { grid-column: 2; }
.sch-contact-line {
  display: flex; align-items: center; gap: .45rem; margin-top: .35rem;
}
.sch-tabs { margin-top: .35rem; }
.sch-alert {
  margin: .75rem .95rem;
  padding: .7rem .8rem;
  border-radius: 10px;
  background: rgba(180, 130, 40, .18);
  border: 1px solid rgba(234, 179, 8, .35);
  color: #fde68a;
  font-size: .8rem;
  line-height: 1.35;
}
.sch-alert.note {
  background: rgba(180, 130, 40, .14);
}
.sch-empty {
  margin: 1rem .95rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, .12);
  border: 1px solid rgba(59, 130, 246, .25);
  color: #bfdbfe;
  font-size: .86rem;
}
.sch-empty strong { display: block; margin-bottom: .2rem; color: #fff; }
.sch-form { padding: 0 0 1.2rem; }
.sch-field {
  padding: .65rem .95rem;
  display: grid;
  gap: .4rem;
}
.sch-field label { font-size: .82rem; color: #94a3b8; font-weight: 600; }
.sch-field input[type="datetime-local"],
.sch-field input[type="search"],
.sch-field select,
.sch-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 42, .55);
  color: inherit;
  padding: .55rem .7rem;
  font: inherit;
}
.sch-field textarea { resize: vertical; min-height: 110px; }
.sch-field textarea.note-border { border-color: rgba(234, 179, 8, .55); }
.sch-rel {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, .18);
  color: #93c5fd;
  font-size: .78rem;
  font-weight: 600;
  width: fit-content;
}
.sch-toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.sch-switch {
  position: relative;
  width: 42px; height: 24px;
  display: inline-block;
}
.sch-switch input { opacity: 0; width: 0; height: 0; }
.sch-switch span {
  position: absolute; inset: 0;
  background: #334155; border-radius: 999px; cursor: pointer;
  transition: .2s;
}
.sch-switch span::before {
  content: "";
  position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff; border-radius: 999px; transition: .2s;
}
.sch-switch input:checked + span { background: #3b82f6; }
.sch-switch input:checked + span::before { transform: translateX(18px); }
.sch-attach-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.sch-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); cursor: pointer; font-size: .78rem; color: #cbd5e1;
}
.sch-cancel-list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .85rem .95rem 1rem;
}
.sch-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .65rem;
  margin: 0;
  padding: 0;
  font-size: .86rem;
  color: #e2e8f0;
  line-height: 1.4;
  cursor: pointer;
  width: 100%;
}
.sch-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: .18rem 0 0;
  accent-color: #3b82f6;
  cursor: pointer;
}
.sch-check > span {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}
.sch-check strong {
  font-weight: 700;
  color: #fff;
}
.sch-form-actions {
  display: grid; gap: .5rem;
  padding: .85rem .95rem 0;
}
.sch-bot-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sch-bot-toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem .95rem .4rem;
}
.sch-bot-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .55);
  min-width: 0;
}
.sch-bot-search input {
  border: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  font: inherit;
  outline: none;
}
.sch-bot-add {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
}
.sch-bot-list {
  display: grid;
  gap: 0;
  flex: 1;
  overflow: auto;
  min-height: 180px;
  max-height: none;
  border-top: 1px solid rgba(51,65,85,.35);
  margin-top: .25rem;
}
.sch-bot-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .7rem;
  align-items: center;
  padding: .75rem .95rem;
  border-bottom: 1px solid rgba(51,65,85,.4);
  cursor: pointer;
  margin: 0;
}
.sch-bot-item:hover { background: rgba(59,130,246,.06); }
.sch-bot-item.selected { background: rgba(59,130,246,.1); }
.sch-bot-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(180, 120, 40, .35);
  font-size: .95rem;
}
.sch-bot-name {
  font-size: .9rem;
  color: #e2e8f0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sch-bot-item input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #3b82f6;
}
.sch-bot-parallel {
  padding: .75rem .95rem .35rem;
  align-items: center;
  width: auto;
}
.sch-info {
  color: #60a5fa;
  cursor: help;
  font-size: .85rem;
}
#sch-bot-submit:disabled,
#sch-bot-submit.is-disabled,
#fin-bot-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.25);
}

.fin-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .3rem;
  margin: .65rem .85rem .35rem;
  padding: .2rem;
  border-radius: 12px;
  background: rgba(148,163,184,.08);
}
.fin-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .76rem;
  font-weight: 600;
  padding: .55rem .25rem;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-tab.active {
  color: #60a5fa;
  border-color: rgba(59,130,246,.55);
  background: rgba(59,130,246,.12);
}
.fin-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.fin-pane .sch-form-actions {
  margin-top: auto;
}
.fin-drawer .cd-panel {
  display: flex;
  flex-direction: column;
}
.sch-item {
  display: grid;
  gap: .2rem;
  padding: .75rem .95rem;
  border-bottom: 1px solid rgba(51,65,85,.45);
}
.sch-item-top { display: flex; justify-content: space-between; gap: .5rem; }
.sch-item-actions { display: flex; gap: .45rem; margin-top: .35rem; }
.cd-sub-head {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem .85rem;
  border-bottom: 1px solid rgba(51, 65, 85, .55);
}
.cd-sub-body { overflow: auto; flex: 1; padding: .5rem 0 1rem; }
.cd-log-item {
  padding: .65rem .95rem;
  border-bottom: 1px solid rgba(51, 65, 85, .4);
}
.cd-log-item strong { display: block; font-size: .82rem; }
.cd-log-item span { color: #94a3b8; font-size: .75rem; }
.cd-edit-box { padding: .85rem .95rem; display: grid; gap: .55rem; }
.cd-edit-box textarea,
.cd-edit-box input,
.cd-edit-box select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15,23,42,.55);
  color: inherit;
  padding: .55rem .7rem;
  font: inherit;
}
.cd-edit-actions { display: flex; justify-content: flex-end; gap: .45rem; }
.messages {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  position: relative;
  /* Evita “pulo” de largura quando a barra de rolagem aparece */
  scrollbar-gutter: stable;
}
/* Empurra as bolhas para baixo (perto do composer), mesmo com poucas mensagens */
.messages::before {
  content: "";
  flex: 1 1 auto;
  min-height: 12px;
  pointer-events: none;
}

.chat-history-fab {
  position: sticky;
  top: .15rem;
  z-index: 5;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 auto .35rem;
  padding: .15rem;
  pointer-events: auto;
}
.chat-hist-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: rgba(15, 23, 42, .92);
  color: #60a5fa;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: background .15s, border-color .15s, transform .12s;
}
.chat-hist-btn:hover:not(.is-disabled):not(:disabled) {
  background: rgba(30, 41, 59, .98);
  border-color: rgba(96, 165, 250, .55);
  transform: translateY(-1px);
}
.chat-hist-btn.is-disabled,
.chat-hist-btn:disabled {
  opacity: .38;
  cursor: default;
  color: #64748b;
  box-shadow: none;
}

.ch-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}
.ch-drawer[hidden] { display: none !important; }
.ch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .55);
}
.ch-panel {
  position: relative;
  width: min(420px, 100vw);
  height: 100%;
  background: #0f172a;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .35);
}
.ch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ch-head strong {
  font-size: .98rem;
  color: #f1f5f9;
}
.ch-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem 1rem .35rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ch-new-form { display: inline-flex; margin: 0; }
.ch-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: rgba(30, 41, 59, .7);
  color: #e2e8f0;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  padding: .42rem .8rem;
  cursor: pointer;
}
.ch-action-btn.primary {
  background: #3b82f6;
  border-color: transparent;
  color: #fff;
}
.ch-action-btn.primary:hover { filter: brightness(1.06); }
.ch-action-btn:disabled { opacity: .45; cursor: default; }
.ch-tabs-mini {
  display: flex;
  gap: .25rem;
  margin: .35rem 1rem .55rem;
  padding: .2rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, .1);
  flex-shrink: 0;
}
.ch-mini-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  font-weight: 600;
  padding: .4rem .35rem;
  border-radius: 999px;
  cursor: pointer;
}
.ch-mini-tab.active {
  background: #3b82f6;
  color: #fff;
}
.ch-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: .25rem .85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.ch-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 12px;
  background: rgba(15, 23, 42, .65);
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.ch-item:hover {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(30, 41, 59, .55);
}
.ch-item.is-current {
  border-color: rgba(59, 130, 246, .55);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .25);
}
.ch-item-head {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .75rem;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.ch-wa {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: #25d366;
  color: #fff;
  font-size: .72rem;
  flex-shrink: 0;
}
.ch-item-date {
  font-size: .82rem;
  font-weight: 600;
  color: #e2e8f0;
}
.ch-badge {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.ch-badge.open {
  background: rgba(134, 239, 172, .2);
  color: #86efac;
}
.ch-badge.closed {
  background: rgba(148, 163, 184, .18);
  color: #cbd5e1;
}
.ch-item-chevron {
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  margin-left: .15rem;
}
.ch-item-body {
  padding: .7rem .75rem .85rem;
}
.ch-preview-bubble {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  max-width: 92%;
  padding: .55rem .7rem;
  border-radius: 10px;
  background: rgba(51, 65, 85, .55);
  color: #e2e8f0;
  font-size: .8rem;
  line-height: 1.35;
}
.ch-preview-bubble.out {
  margin-left: auto;
  background: rgba(37, 99, 235, .22);
}
.ch-preview-meta {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  color: #94a3b8;
  font-size: .68rem;
}
.ch-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.bubble-row {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: .35rem;
  /* Cresce com o texto (menus ficam estreitos; paragrafos longos abrem ate ~80%) */
  width: fit-content;
  max-width: min(80%, 40rem);
  align-self: flex-start;
  box-sizing: border-box;
}
.bubble-row.out {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.bubble-row.in { align-self: flex-start; }
.bubble-row .bubble {
  position: relative;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.bubble {
  width: fit-content;
  max-width: 100%;
  padding: .55rem .75rem;
  border-radius: 12px;
  background: var(--in);
  border: 1px solid var(--line);
  font-size: .84rem;
  line-height: 1.45;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: normal;
}
.bubble.out {
  background: var(--out);
  border-color: var(--out-border);
}
.bubble.in {
  background: var(--in);
}
.bubble-toolbar {
  position: relative;
  display: none;
  align-items: center;
  gap: .05rem;
  padding: .18rem .28rem;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid rgba(148,163,184,.28);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 8;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.bubble-row:hover .bubble-toolbar,
.bubble-row.is-hover .bubble-toolbar,
.bubble-row.is-menu-open .bubble-toolbar {
  display: inline-flex;
  opacity: 1;
  pointer-events: auto;
}
.btb-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: .95rem;
  line-height: 1;
  padding: 0;
}
.btb-btn:hover { background: rgba(148,163,184,.16); }
.bubble-more-menu,
.bubble-react-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #1e2330;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  padding: .35rem;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.bubble-row.out .bubble-more-menu,
.bubble-row.out .bubble-react-menu { left: auto; right: 0; }
.bubble-more-menu[hidden],
.bubble-react-menu[hidden] { display: none !important; }
.bubble-more-menu button,
.bubble-more-menu a,
.bubble-react-menu button {
  border: 0;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  padding: .5rem .6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .86rem;
  text-decoration: none;
  display: block;
}
.bubble-more-menu button:hover,
.bubble-more-menu a:hover,
.bubble-react-menu button:hover {
  background: rgba(148,163,184,.12);
}
.bubble-more-menu button.danger { color: #f87171; }
.bubble-more-menu hr {
  border: 0;
  border-top: 1px solid rgba(148,163,184,.2);
  margin: .25rem .2rem;
}
.bubble-react-menu {
  min-width: auto;
  flex-direction: row;
  padding: .35rem .4rem;
}
.bubble-react-menu button { font-size: 1.15rem; padding: .25rem .35rem; }
.bubble-reaction {
  position: absolute;
  bottom: -10px;
  left: .55rem;
  background: #1f2937;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 999px;
  padding: .05rem .35rem;
  font-size: .85rem;
  z-index: 2;
}
.bubble-row.out .bubble-reaction { left: auto; right: .55rem; }
.bubble-star {
  position: absolute;
  top: .35rem;
  right: .45rem;
  color: #fbbf24;
  font-size: .75rem;
}
.composer-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin: 0 0 .45rem;
  padding: .45rem .65rem;
  border-radius: 10px;
  border-left: 3px solid #3b82f6;
  background: rgba(59,130,246,.1);
}
.composer-reply-bar[hidden] { display: none !important; }
.composer-reply-meta {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.composer-reply-meta strong { font-size: .76rem; color: #93c5fd; }
.composer-reply-meta span {
  font-size: .8rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Citação estilo WhatsApp (dentro da bolha) */
.bubble-quote {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  margin: 0 0 .4rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, .18);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  max-width: 100%;
  box-sizing: border-box;
}
.bubble.out .bubble-quote {
  background: rgba(0, 0, 0, .22);
}
.bubble.in .bubble-quote {
  background: rgba(255, 255, 255, .06);
}
.bubble-quote-bar {
  width: 4px;
  flex-shrink: 0;
  background: #53bdeb;
}
.bubble.out .bubble-quote-bar { background: #06cf9c; }
.bubble.in .bubble-quote-bar { background: #53bdeb; }
.bubble-quote-content {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
  padding: .35rem .55rem .4rem;
  flex: 1;
}
.bubble-quote-text {
  font-size: .78rem;
  line-height: 1.35;
  color: rgba(226, 232, 240, .92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bubble-quote.kind-audio .bubble-quote-text::before,
.bubble-quote.kind-image .bubble-quote-text::before,
.bubble-quote.kind-video .bubble-quote-text::before,
.bubble-quote.kind-file .bubble-quote-text::before,
.bubble-quote.kind-location .bubble-quote-text::before,
.bubble-quote.kind-contact .bubble-quote-text::before,
.bubble-quote.kind-sticker .bubble-quote-text::before {
  margin-right: .3rem;
  opacity: .85;
}
.bubble-quote.kind-audio .bubble-quote-text::before { content: '🎤'; }
.bubble-quote.kind-image .bubble-quote-text::before { content: '📷'; }
.bubble-quote.kind-video .bubble-quote-text::before { content: '🎬'; }
.bubble-quote.kind-file .bubble-quote-text::before { content: '📄'; }
.bubble-quote.kind-location .bubble-quote-text::before { content: '📍'; }
.bubble-quote.kind-contact .bubble-quote-text::before { content: '👤'; }
.bubble-quote.kind-sticker .bubble-quote-text::before { content: '💟'; }
.bubble-quote:hover { filter: brightness(1.08); }
.bubble-row.quote-flash .bubble {
  outline: 2px solid rgba(83, 189, 235, .85);
  outline-offset: 2px;
  transition: outline-color .3s ease;
}
#msg-forward-modal input[type="search"] {
  width: 100%;
  margin: .35rem 0 .55rem;
}
.bubble p,
.bubble .bubble-text {
  margin: 0;
  /* pre-wrap: respeita \n do bot (menus); texto longo quebra so no limite da bolha */
  white-space: pre-wrap;
  font-size: inherit;
  line-height: inherit;
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.bubble.media-location,
.bubble.media-contact { min-width: 240px; max-width: min(320px, 86vw); }
.bubble-location {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: 0 0 .15rem;
}
.bubble-location-map {
  width: 100%;
  height: 140px;
  border: 0;
  border-radius: 10px;
  background: #0f172a;
  pointer-events: none;
}
.bubble-location-meta {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.bubble-location-meta strong { font-size: .9rem; }
.bubble-location-meta small,
.bubble-location-coords {
  font-size: .75rem;
  color: #94a3b8;
}
.bubble-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: .2rem;
}
.bubble-location-actions a {
  color: #86efac;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}
.bubble-location-actions a:hover { text-decoration: underline; }
.bubble-contact-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
  margin: 0 0 .1rem;
  min-width: 220px;
}
.bubble-contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  color: #e2e8f0;
  background: #2563eb;
}
.bubble-contact-meta {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.bubble-contact-meta strong {
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble-contact-meta small {
  font-size: .75rem;
  color: #94a3b8;
}
.bubble-contact-open {
  border: 0;
  background: transparent;
  color: #86efac;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  padding: .2rem .1rem;
}
.bubble-contact-open:hover { text-decoration: underline; }
/* Formatacao WhatsApp no painel (*negrito* _italico_ ~riscado_ `mono`) */
.bubble .wa-bold { font-weight: 700; }
.bubble .wa-italic { font-style: italic; }
.bubble .wa-strike { text-decoration: line-through; opacity: .9; }
.bubble .wa-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .92em;
  padding: .05rem .28rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, .45);
}
.bubble .wa-code-block {
  display: block;
  white-space: pre-wrap;
  padding: .45rem .55rem;
  margin: .25rem 0;
  border-radius: 8px;
}
.bubble time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .28rem;
  margin-top: .28rem;
  color: var(--muted);
  font-size: .68rem;
  width: 100%;
}
.bubble.in time { justify-content: flex-end; }
.msg-ticks {
  display: inline-flex;
  align-items: center;
  position: relative;
  width: 16px;
  height: 11px;
  color: #94a3b8;
  flex-shrink: 0;
  line-height: 1;
  font-weight: 700;
}
.msg-ticks.delivered,
.msg-ticks.read { width: 20px; }
.msg-ticks svg { display: block; }
.msg-ticks .tick-1 { position: absolute; left: 0; top: 0; }
.msg-ticks .tick-2 { position: absolute; left: 5px; top: 0; }
.msg-ticks.sent { color: #94a3b8; }
.msg-ticks.pending { color: #94a3b8; opacity: .85; }
.msg-ticks.delivered { color: #94a3b8; }
.msg-ticks.read { color: #53bdeb; }
.msg-ticks.failed {
  width: auto;
  color: #f87171;
  font-size: .75rem;
}
.bubble .agent-name {
  display: block;
  font-size: .74rem;
  font-weight: 650;
  color: #93c5fd;
  margin: 0 0 .15rem;
}
.bubble.agent-stacked .agent-name { display: block; margin: 0 0 .15rem; }
.bubble.agent-inline { display: block; }
.bubble.agent-inline p,
.bubble.agent-inline .bubble-text { display: block; }
.composer {
  border-top: 1px solid var(--line);
  padding: .75rem 1.1rem 1rem;
  background: rgba(17,24,39,.72);
  box-sizing: border-box;
}

.msg-system-closed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin: .85rem auto 1.1rem;
  padding: .35rem .85rem;
  width: fit-content;
  max-width: 92%;
  color: #94a3b8;
  font-size: .78rem;
  font-weight: 500;
}
.msg-system-closed-ico {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1.5px solid #64748b;
  font-size: .65rem;
  line-height: 1;
  color: #94a3b8;
}

.composer-closed {
  border-top: 1px solid var(--line);
  padding: .85rem 1.1rem 1.05rem;
  background: rgba(17, 24, 39, .78);
}
.closed-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(30, 41, 59, .72);
}
.closed-banner-main {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.closed-banner-ico {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, .12);
  color: #93c5fd;
}
.closed-banner-text {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.closed-banner-text strong {
  color: #f1f5f9;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.25;
}
.closed-banner-text span {
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1.35;
}
.closed-banner-form { flex: 0 0 auto; }
.closed-reopen-btn {
  border-radius: 999px !important;
  padding: .55rem 1.15rem !important;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(59, 130, 246, .28);
}
@media (max-width: 720px) {
  .closed-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .closed-reopen-btn { width: 100%; }
}
.simulate-box { margin-bottom: .55rem; }
.simulate-box summary { cursor: pointer; list-style: none; }
.simulate-box summary::-webkit-details-marker { display: none; }
.plus-quick-search {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: .35rem 0 .15rem;
  padding: .45rem .65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: #94a3b8;
}
.plus-quick-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  min-width: 0;
}
.plus-quick-empty { padding: .55rem .2rem; }
#plus-quick-modal .plus-pick-list { max-height: min(50vh, 380px); }
.mention-suggest {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  max-height: min(40vh, 260px);
  overflow: auto;
  margin: 0 0 .45rem;
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
}
.mention-suggest[hidden] { display: none !important; }
.mention-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .05rem;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: .45rem .55rem;
  cursor: pointer;
  font: inherit;
}
.mention-suggest-item:hover,
.mention-suggest-item.is-active {
  background: rgba(59, 130, 246, .16);
}
.mention-suggest-item strong { font-size: .88rem; }
.mention-suggest-item small { color: #94a3b8; font-size: .76rem; }
.bubble-mention {
  color: #53bdeb;
  font-weight: 600;
}
.quick-replies { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.quick-replies[hidden],
.composer-emoji-bar[hidden],
.composer-rec-pill[hidden],
#composer-bot-btn[hidden] { display: none !important; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 999px; padding: .25rem .65rem; cursor: pointer; font-size: .8rem;
}
.send-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: end; }

.composer-modes {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  margin-bottom: .45rem;
}
.composer-mode {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: .82rem;
  padding: .28rem .7rem;
  border-radius: 999px;
  cursor: pointer;
}
.composer-mode:hover { color: #e2e8f0; background: rgba(148,163,184,.08); }
.composer-mode.active {
  background: #2563eb;
  color: #fff;
}
.composer-mode[data-composer-mode="note"].active {
  background: #ca8a04;
  color: #fff;
}

.composer-box {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  border: 1px solid #3b82f6;
  border-radius: 14px;
  background: #1a1d27;
  padding: .7rem .85rem .55rem;
  box-shadow: 0 0 0 1px rgba(59,130,246,.15);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.composer-box[data-mode="note"] {
  border-color: #ca8a04;
  background: #2a2410;
  box-shadow: 0 0 0 1px rgba(202,138,4,.22);
}
.composer-box[data-mode="note"] .composer-primary {
  background: #ca8a04;
}
.composer-box[data-mode="note"] .composer-primary:hover {
  background: #a16207;
}
.composer-box.is-drag {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, .12);
}

.composer-attach-preview {
  position: relative;
  display: inline-flex;
  margin: 0 0 .45rem;
  max-width: 100%;
}
.composer-attach-preview[hidden] { display: none !important; }
.attach-preview-card {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(148,163,184,.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.attach-preview-card img,
.attach-preview-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-preview-card .attach-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  width: 100%;
  height: 100%;
  padding: .35rem;
  text-align: center;
}
.attach-preview-card .attach-file strong {
  font-size: .62rem;
  color: #e2e8f0;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.attach-preview-card .attach-file small {
  font-size: .58rem;
  color: #94a3b8;
  text-transform: uppercase;
}
.attach-preview-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: #334155;
  color: #fff;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.attach-preview-clear:hover { background: #ef4444; }

.bubble-row:has(.media-image),
.bubble-row:has(.media-video),
.bubble-row:has(.media-doc) {
  max-width: min(80%, 28rem);
}
.bubble.media-image,
.bubble.media-video,
.bubble.media-doc {
  max-width: 100%;
  padding: .55rem .65rem .45rem;
}
.bubble-media {
  display: block;
  position: relative;
  margin: .2rem 0 .35rem;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
  border: 0;
  padding: 0;
  width: 100%;
  cursor: zoom-in;
  text-align: left;
}
.bubble-media img,
.bubble-media video {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #0b1220;
  pointer-events: none;
}
.bubble-media-video { cursor: pointer; }
.bubble-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.bubble-file {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: .25rem 0 .35rem;
  padding: .45rem .55rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(148,163,184,.2);
  text-decoration: none;
  color: inherit;
  width: 100%;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.bubble-file:hover { border-color: #60a5fa; }

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.media-lightbox[hidden] { display: none !important; }
.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .88);
  backdrop-filter: blur(2px);
}
.media-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: #0b1220;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.media-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid rgba(148,163,184,.18);
  background: rgba(15, 23, 42, .9);
}
.media-lightbox-head strong {
  font-size: .92rem;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-lightbox-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-shrink: 0;
}
.media-lightbox-zoom {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
  margin-right: .2rem;
  padding-right: .35rem;
  border-right: 1px solid rgba(148,163,184,.22);
}
.media-lightbox-zoom[hidden] { display: none !important; }
.media-lightbox-zoom-label {
  min-width: 3.1rem;
  text-align: center;
  font-size: .78rem;
  font-weight: 600;
  color: #94a3b8;
  user-select: none;
}
.media-lightbox-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
  background: #020617;
  overflow: hidden;
  touch-action: none;
}
.media-lightbox-body.is-image-zoom {
  cursor: grab;
}
.media-lightbox-body.is-image-zoom.is-panning {
  cursor: grabbing;
}
.media-lightbox-body img {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
  border-radius: 8px;
  transform-origin: center center;
  transition: transform .08s ease-out;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.media-lightbox-body video {
  width: 100%;
  max-height: calc(100vh - 7rem);
  border-radius: 8px;
  background: #000;
}
.media-lightbox-body iframe {
  width: 100%;
  height: min(78vh, 820px);
  border: 0;
  border-radius: 8px;
  background: #fff;
}
.media-lightbox-fallback {
  text-align: center;
  color: #cbd5e1;
  padding: 2rem 1rem;
}
.media-lightbox-fallback p { margin: 0 0 1rem; }
body.media-lightbox-open { overflow: hidden; }
.bubble-file-ico {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  background: #6366f1;
  flex-shrink: 0;
}
.bubble-file-ico.pdf { background: #dc2626; }
.bubble-file-ico.zip { background: #7c3aed; }
.bubble-file-ico.doc { background: #2563eb; }
.bubble-file-ico.file { background: #475569; }
.bubble-file-meta {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.bubble-file-meta strong {
  font-size: .86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble-file-meta small {
  color: #94a3b8;
  font-size: .72rem;
  text-transform: uppercase;
}
.bubble-link {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: .35rem 0;
  padding: .55rem .65rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(148,163,184,.2);
  text-decoration: none;
  color: inherit;
}
.bubble-link:hover { border-color: #60a5fa; }
.bubble-link-host {
  color: #93c5fd;
  font-size: .78rem;
  font-weight: 600;
}
.bubble-link-url {
  color: #94a3b8;
  font-size: .72rem;
  word-break: break-all;
}
.composer-box #message-text {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  resize: none;
  min-height: 44px;
  max-height: 160px;
  padding: .15rem .1rem .35rem;
  font-size: .92rem;
  line-height: 1.4;
  outline: none;
  box-shadow: none;
}
.composer-box #message-text::placeholder { color: #64748b; }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.composer-tools,
.composer-right {
  display: flex;
  align-items: center;
  gap: .2rem;
  flex-wrap: wrap;
}
.composer-right { margin-left: auto; gap: .35rem; }
.cmp-sep {
  width: 1px;
  height: 18px;
  background: rgba(148,163,184,.35);
  margin: 0 .25rem;
}
.cmp-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}
.cmp-ico:hover { color: #e2e8f0; background: rgba(148,163,184,.1); }
.cmp-ico.sm { width: 24px; height: 24px; }
.cmp-ico.danger { color: #94a3b8; }
.cmp-ico.danger:hover { color: #fca5a5; background: rgba(248,113,113,.12); }
.cmp-sig-wrap {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
}
.cmp-sig-wrap[hidden] { display: none !important; }
.cmp-sig {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #e2e8f0;
  font-size: .82rem;
  cursor: pointer;
  user-select: none;
}
.cmp-sig .sch-switch { flex-shrink: 0; }

.composer-rec-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .55rem .2rem .25rem;
  border-radius: 999px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(148,163,184,.25);
  color: #e2e8f0;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,.55);
  animation: rec-pulse 1.2s ease-out infinite;
}
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); }
  70% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.composer-primary {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: #2563eb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, transform .1s ease;
}
.composer-primary:hover { background: #1d4ed8; }
.composer-primary:active { transform: scale(.96); }
.composer-primary:disabled { opacity: .55; cursor: not-allowed; }
.composer-primary .ico-mic,
.composer-primary .ico-send { display: none; line-height: 0; }
.composer-primary[data-mode="mic"] .ico-mic { display: inline-flex; }
.composer-primary[data-mode="send"] .ico-send { display: inline-flex; }

.composer-emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  padding: .15rem 0 .35rem;
}
.cmp-emoji {
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  border-radius: 6px;
  padding: .15rem .25rem;
}
.cmp-emoji:hover { background: rgba(148,163,184,.12); }

.composer-pinned,
.composer-shortcuts {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  flex-wrap: wrap;
}
.composer-shortcuts .cmp-shortcut {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  max-width: 9.5rem;
  height: 32px;
  padding: 0 .55rem;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 99, 235, .18);
  color: #bfdbfe;
  font: inherit;
  font-size: .72rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.composer-shortcuts .cmp-shortcut:hover {
  background: rgba(37, 99, 235, .32);
  color: #fff;
}
.composer-shortcuts .cmp-shortcut span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Personalizar barra */
.bar-prefs-modal .bar-prefs-body { width: min(420px, 96vw); }
.bar-prefs-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  padding: 0 .2rem .75rem;
}
.bar-prefs-tab {
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  border-radius: 10px;
  padding: .55rem .7rem;
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  cursor: pointer;
}
.bar-prefs-tab.is-on {
  border-color: #38bdf8;
  color: #e0f2fe;
  background: rgba(56, 189, 248, .08);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .25) inset;
}
.bar-prefs-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: .4rem;
}
.bar-prefs-preview {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem .65rem;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid #1e293b;
  min-height: 48px;
}
.bar-prefs-preview .pv-plus {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: #1e293b; color: #e2e8f0; font-weight: 700;
}
.bar-prefs-preview .pv-ico {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(148,163,184,.12); color: #e2e8f0; font-size: .9rem;
}
.bar-prefs-preview .pv-input {
  flex: 1; height: 28px; border-radius: 8px;
  background: #1e293b; border: 1px solid #334155;
}
.bar-prefs-tools { display: flex; flex-direction: column; gap: .15rem; max-height: 280px; overflow: auto; }
.bar-prefs-tool {
  display: flex; align-items: center; gap: .65rem;
  width: 100%; border: 0; background: transparent;
  color: #e2e8f0; padding: .55rem .35rem; border-radius: 10px;
  font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.bar-prefs-tool:hover { background: rgba(148,163,184,.08); }
.bar-prefs-pin {
  width: 1.35rem; height: 1.35rem; border-radius: 999px;
  display: grid; place-items: center; font-size: .75rem;
  color: #64748b; border: 1px solid #475569;
}
.bar-prefs-tool.is-pinned .bar-prefs-pin {
  background: #2563eb; border-color: #2563eb; color: #fff;
}
.bar-prefs-empty { text-align: center; padding: 1.25rem .5rem 1rem; color: #94a3b8; }
.bar-prefs-empty strong { display: block; color: #e2e8f0; margin-bottom: .35rem; }
.bar-prefs-empty p { margin: 0; font-size: .85rem; }
.bar-prefs-sc-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .65rem; }
.bar-prefs-sc-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .55rem; border-radius: 10px;
  background: rgba(15,23,42,.55); border: 1px solid #1e293b;
}
.bar-prefs-sc-row strong { flex: 1; font-size: .88rem; color: #e2e8f0; }
.bar-prefs-sc-row button {
  border: 0; background: transparent; color: #94a3b8; cursor: pointer; font-size: 1rem;
}
.bar-prefs-sc-row button:hover { color: #fca5a5; }
.bar-prefs-link {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .45rem; border: 0; background: transparent;
  color: #38bdf8; font: inherit; font-size: .88rem; font-weight: 650;
  cursor: pointer; padding: 0; text-decoration: none;
}
.bar-prefs-link.muted { color: #94a3b8; font-weight: 500; display: block; margin-top: .75rem; }
.bar-prefs-link:hover { color: #7dd3fc; }
.bar-prefs-add-box {
  margin-top: .55rem; padding: .65rem; border-radius: 12px;
  background: #0f172a; border: 1px solid #1e293b;
}

.composer-plus-wrap { position: relative; }
.composer-plus-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  width: min(320px, calc(100vw - 2rem));
  background: #1e2330;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  padding: .75rem;
}
.composer-plus-menu[hidden] { display: none !important; }
.plus-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .55rem;
  margin-bottom: .7rem;
}
.plus-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .28rem;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  padding: .2rem;
  font-size: .72rem;
}
.plus-tile em { font-style: normal; font-weight: 500; }
.plus-tile small { color: #94a3b8; font-size: .62rem; }
.plus-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #fff;
}
.plus-ico-file { background: #2563eb; }
.plus-ico-lib { background: #1e3a8a; }
.plus-ico-reply { background: #a16207; }
.plus-ico-bot { background: #166534; }
.plus-list {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  border-top: 1px solid rgba(148,163,184,.2);
  padding-top: .45rem;
}
.plus-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  padding: .45rem .4rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .88rem;
}
.plus-row:hover { background: rgba(148,163,184,.1); }

.plus-lib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  max-height: min(50vh, 360px);
  overflow: auto;
  margin: .4rem 0 .8rem;
}
.plus-lib-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: .35rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.plus-lib-item img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #0f172a;
  display: block;
}
.plus-lib-item .doc {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: #0f172a;
  border-radius: 6px;
}
.plus-lib-item span {
  display: block;
  margin-top: .3rem;
  font-size: .68rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plus-pick-list {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  max-height: min(45vh, 320px);
  overflow: auto;
  margin: .55rem 0;
}
.plus-pick-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: inherit;
  border-radius: 10px;
  padding: .55rem .7rem;
  cursor: pointer;
  text-align: left;
}
.plus-pick-item:hover { border-color: #3b82f6; }
.plus-pick-item strong { font-size: .9rem; }
.plus-pick-item small { color: #94a3b8; }
.plus-loc-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin: .45rem 0 .7rem;
}
.plus-sticker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .35rem;
  margin: .4rem 0 .8rem;
}
.plus-sticker {
  border: 0;
  background: rgba(148,163,184,.08);
  border-radius: 10px;
  font-size: 1.45rem;
  padding: .45rem;
  cursor: pointer;
}
.plus-sticker:hover { background: rgba(148,163,184,.18); }
#plus-contact-modal input[type="search"],
#plus-location-modal input {
  width: 100%;
  margin: .25rem 0 .45rem;
}

@media (max-width: 720px) {
  .composer-modes { justify-content: flex-start; }
  .cmp-sig { font-size: .75rem; }
}
.bubble.audio-msg {
  min-width: min(100%, 20.5rem);
  max-width: min(100%, 26rem);
  padding: .65rem .85rem .5rem;
}
.bubble.audio-msg .agent-name { margin-bottom: .3rem; }
.bubble-audio {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  min-width: 0;
}
.bubble-audio-avatar,
.bubble-side-avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #1e3a5f, #60a5fa);
  border: 1px solid rgba(148, 163, 184, .22);
  box-sizing: border-box;
}
.bubble-side-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  font-size: .72rem;
  align-self: flex-end;
  margin-bottom: .15rem;
}
.bubble-audio-avatar.has-img,
.bubble-side-avatar.has-img {
  background: #0f172a;
  padding: 0;
}
/* cover: preenche o círculo sem deformar (corta bordas se a arte for retangular) */
.bubble-audio-avatar img,
.bubble-side-avatar img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
  padding: 0;
  box-sizing: border-box;
}
.bubble-audio-player {
  flex: 1;
  min-width: 0;
}
/* Player custom estilo UmblerTalk */
.pz-audio {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  min-height: 2.5rem;
  padding: .35rem .55rem .35rem .4rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(148, 163, 184, .18);
  box-sizing: border-box;
}
.bubble.out .pz-audio {
  background: rgba(15, 23, 42, .35);
}
.pz-audio audio { display: none; }
.pz-audio-play {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #3b82f6;
  color: #fff;
  padding: 0;
  transition: background .15s ease, transform .12s ease;
}
.pz-audio-play:hover { background: #60a5fa; }
.pz-audio-play:active { transform: scale(.96); }
.pz-audio-play svg {
  width: 14px;
  height: 14px;
  display: block;
}
.pz-audio-play.is-playing svg.pz-ico-play { display: none; }
.pz-audio-play:not(.is-playing) svg.pz-ico-pause { display: none; }
.pz-audio-time {
  flex-shrink: 0;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
  letter-spacing: .01em;
  min-width: 5.4rem;
}
.pz-audio-seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 4.5rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(226, 232, 240, .28);
  outline: none;
  cursor: pointer;
}
.pz-audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #60a5fa;
  border: 2px solid #eff6ff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, .35);
  cursor: pointer;
}
.pz-audio-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #60a5fa;
  border: 2px solid #eff6ff;
  cursor: pointer;
}
.pz-audio-seek::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(226, 232, 240, .28);
}
.bubble-audio-missing {
  display: block;
  font-size: .82rem;
  color: #93c5fd;
  font-style: italic;
  padding: .35rem 0;
}
.bubble-row.audio-row {
  max-width: min(92%, 30rem);
  align-items: flex-end;
}
.bubble-row.out.audio-row {
  /* side-avatar | bubble | toolbar  (row-reverse: avatar à direita) */
  gap: .4rem;
}
.bubble-row:has(.note-msg) {
  max-width: min(100%, 26rem);
  align-self: center;
}
.bubble.note-msg {
  max-width: 100%;
  background: rgba(234, 179, 8, .12);
  border-color: rgba(234, 179, 8, .35);
  color: #fde68a;
}
.empty, .empty-chat { color: var(--muted); padding: 2rem; text-align: center; }
.page { padding: 1.25rem; }
.page.narrow { max-width: 720px; }
.page h1 { margin-top: 0; }
.table-wrap { overflow: auto; }
.contact-row {
  display: grid; grid-template-columns: 1.2fr 1fr 1.5fr auto; gap: .5rem; padding: .5rem 0;
  border-bottom: 1px solid var(--line);
}
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; }
pre {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: .75rem; overflow: auto; font-size: .8rem;
}
.sig-toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .45rem;
  cursor: pointer;
}
.sig-toggle input { width: auto; }

.ch-modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--panel);
  color: inherit;
  width: min(440px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
}
.nc-modal { width: min(560px, calc(100vw - 1.5rem)); }
.nc-body { display: flex; flex-direction: column; min-height: min(70vh, 640px); max-height: calc(100vh - 2rem); padding-bottom: .85rem; }
.nc-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .3rem;
  padding: .25rem;
  margin-bottom: .75rem;
  border-radius: 999px;
  background: rgba(148,163,184,.1);
}
.nc-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  padding: .5rem .35rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nc-tab.active { background: #3b82f6; color: #fff; }
.nc-toolbar {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .65rem;
}
.nc-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .55);
  min-width: 0;
}
.nc-search input {
  border: 0; background: transparent; color: inherit; width: 100%;
  font: inherit; outline: none;
}
.nc-label-select {
  max-width: 7.5rem;
  border-radius: 999px !important;
  padding: .4rem .65rem !important;
  font-size: .78rem !important;
}
.nc-add-btn {
  width: 2.1rem; height: 2.1rem; flex-shrink: 0;
  border: 0; border-radius: 999px;
  background: #3b82f6; color: #fff;
  font-size: 1.35rem; font-weight: 600; line-height: 1;
  cursor: pointer; box-shadow: 0 4px 12px rgba(59,130,246,.35);
}
.nc-add-btn:hover { filter: brightness(1.08); }
.nc-create {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .85rem;
  margin-bottom: .65rem;
  background: rgba(15, 23, 42, .45);
}
.nc-create-actions { display: flex; justify-content: flex-end; gap: .45rem; }
.nc-hint { margin: 0 0 .45rem; }
.nc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 220px;
  max-height: min(58vh, 520px);
  border-top: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.nc-count {
  margin: .45rem 0 0;
  text-align: center;
}
.nc-empty { padding: 1.4rem .5rem; text-align: center; }
.nc-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: .7rem;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(51, 65, 85, .45);
  background: transparent;
  color: inherit;
  text-align: left;
  padding: .7rem .35rem;
  cursor: pointer;
  font: inherit;
}
.nc-item:hover { background: rgba(59,130,246,.08); }
.nc-item .avatar {
  width: 42px; height: 42px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(59,130,246,.18); color: #93c5fd;
  font-size: .78rem; font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.nc-item .avatar.has-img { background: #0f172a; padding: 0; }
.nc-item .avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.nc-item-main { min-width: 0; }
.nc-item-top {
  display: flex; justify-content: space-between; gap: .5rem; align-items: baseline;
}
.nc-item-name {
  font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-item-when { color: var(--muted); font-size: .72rem; flex-shrink: 0; }
.nc-item-sub {
  color: var(--muted); font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: .1rem;
}
.nc-item-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.nc-tag {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .12rem .45rem; border-radius: 999px;
  font-size: .68rem; font-weight: 600; color: #fff;
  max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nc-chevron { color: var(--muted); font-size: 1.1rem; }
.ch-modal::backdrop { background: rgba(2, 6, 23, .72); }
.ch-modal-body { padding: 1.15rem 1.25rem 1.2rem; }
.ch-modal-body header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .85rem;
}
.ch-modal-body header h3 { margin: 0; font-size: 1.1rem; }
.ch-modal-body footer {
  display: flex;
  gap: .55rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.ch-modal-body .field { display: grid; gap: .35rem; margin-bottom: .75rem; }
.ch-modal-body .field > span { font-size: .82rem; color: var(--muted); }
.ch-modal-body select,
.ch-modal-body textarea,
.ch-modal-body input[type="number"],
.ch-modal-body input[type="text"] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: inherit;
  padding: .55rem .7rem;
  font: inherit;
}
.ch-icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}

/* Grupos WhatsApp (painel Entrada) */
.wa-groups-modal {
  width: min(720px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
}
.wa-groups-body {
  width: 100%;
  padding: 1.35rem 1.5rem 1.4rem;
  overflow-x: hidden;
}
.wa-groups-hint { margin: 0 0 .75rem; font-size: .9rem; line-height: 1.45; }
.wa-groups-list {
  display: grid;
  gap: .65rem;
  max-height: min(58vh, 480px);
  overflow: auto;
  margin: .45rem 0 1.1rem;
  padding-right: .25rem;
}
.wa-group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .45);
}
.wa-group-meta { min-width: 0; }
.wa-group-meta strong {
  display: block;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-group-meta span { font-size: .75rem; color: var(--muted); }
.wa-group-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, .35);
  overflow: hidden;
}
.wa-group-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .7rem;
  cursor: pointer;
}
.wa-group-toggle button.is-on {
  background: #16a34a;
  color: #fff;
}
.wa-group-toggle button.is-on-no {
  background: #475569;
  color: #e2e8f0;
}
.pill-grupo {
  background: rgba(59, 130, 246, .22);
  color: #93c5fd;
}
.bubble .agent-name.group-sender {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .45rem;
  color: #93c5fd;
  font-weight: 700;
  font-size: .78rem;
  margin: 0 0 .25rem;
}
.bubble .agent-name.group-sender .group-sender-phone {
  font-weight: 500;
  font-size: .7rem;
  color: #94a3b8;
}
.bubble-edited {
  margin-left: .35rem;
  font-size: .68rem;
  font-style: italic;
  color: var(--muted);
  font-weight: 500;
}
.msg-edit-modal { width: min(480px, calc(100vw - 2rem)); }
.msg-edit-body header h3 {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.msg-edit-ico {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, .2);
  color: #60a5fa;
  font-size: .95rem;
}
.msg-edit-box {
  position: relative;
  margin: .35rem 0 .65rem;
}
.msg-edit-box textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, .3);
  background: rgba(2, 6, 23, .55);
  color: inherit;
  font: inherit;
  padding: .85rem 3.2rem .85rem .95rem;
  line-height: 1.4;
}
.msg-edit-box textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
}
.msg-edit-send {
  position: absolute;
  right: .65rem;
  bottom: .65rem;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.msg-edit-send:hover { filter: brightness(1.08); }
.msg-edit-send:disabled { opacity: .45; cursor: not-allowed; }
.msg-edit-hint { margin: 0; }
.contact-row-item.is-group .avatar {
  background: rgba(59, 130, 246, .25);
}

/* ===== Tablet paisagem: 2 painéis (desktop intacto acima de 1100px) ===== */
@media (max-width: 1100px) and (min-width: 861px) and (orientation: landscape) {
  .inbox {
    grid-template-columns: minmax(260px, 300px) 1fr;
  }
  .chat-contact-name {
    max-width: min(36vw, 280px);
  }
  .chat-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 52%;
  }
}

/*
 * Compacto estilo WhatsApp:
 * - celular (qualquer orientação ≤860)
 * - tablet em RETRATO (≤1100)
 * Tela principal = conversas; ☰ = menu do app; ← Conversas = volta da lista
 */
@media (max-width: 860px), ((max-width: 1100px) and (orientation: portrait)) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .app-shell,
  .shell-main,
  .shell-main--inbox,
  .app-main,
  .inbox {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(80vw, 280px);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .35);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label {
    display: inline;
  }
  .app-shell.sidebar-collapsed .sidebar-brand {
    display: flex;
  }
  .app-shell.sidebar-collapsed .sidebar-toggle .icon-open { display: none; }
  .app-shell.sidebar-collapsed .sidebar-toggle .icon-close { display: block; }
  .mobile-only { display: grid; }
  .sidebar-backdrop {
    z-index: 35;
  }

  .inbox {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
  }
  .inbox .conv-list {
    max-height: none;
    height: 100%;
    border-right: 0;
    min-width: 0;
    max-width: 100%;
  }
  .inbox .chat-pane {
    display: none;
    height: 100%;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
  }
  /* Lista OU chat — nunca os dois empilhados */
  .inbox.is-chat-open .conv-list { display: none; }
  .inbox.is-chat-open .chat-pane { display: grid; }

  .inbox-topbar-title { display: inline; }
  .inbox-ico.inbox-menu-btn.mobile-only {
    display: inline-grid;
    place-items: center;
  }

  .chat-ico-btn.chat-app-menu.mobile-only {
    display: inline-grid;
    place-items: center;
  }
  .chat-ico-btn.chat-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #93c5fd;
  }
  .chat-back-label { display: inline; }
  /* No compacto o X do header é redundante com ← Conversas */
  .chat-actions > a.chat-ico-btn[aria-label="Fechar"] {
    display: none;
  }

  .chat-header {
    padding: .55rem .65rem;
    gap: .35rem;
    padding-top: max(.55rem, env(safe-area-inset-top, 0px));
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .chat-head-left {
    gap: .3rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .chat-head-meta {
    min-width: 0;
    overflow: hidden;
  }
  .chat-contact-name {
    max-width: 100%;
    font-size: .92rem;
  }
  .chat-viewers {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-actions {
    gap: .1rem;
    flex-wrap: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 42%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chat-actions::-webkit-scrollbar { display: none; }
  .chat-ico-btn {
    width: 2.15rem;
    height: 2.15rem;
  }
  .chat-ico-btn.chat-back {
    width: auto;
    height: 2.15rem;
    max-width: 7.5rem;
  }
  .header-labels { display: none; }

  .contact-card {
    padding-top: .7rem;
    padding-bottom: .7rem;
  }
  .messages {
    padding-left: .65rem;
    padding-right: .65rem;
    padding-bottom: max(.5rem, env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    max-width: 100%;
  }
  .bubble-row {
    max-width: 100%;
  }
  .bubble {
    max-width: min(88%, 28rem);
  }
  .bubble.media-contact {
    min-width: 0;
    max-width: min(92%, 280px);
  }
  .composer {
    padding: .55rem .65rem .65rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .composer-tools {
    flex-wrap: wrap;
    gap: .35rem;
    max-width: 100%;
  }
  .page,
  .app-main {
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
  }
  .contact-row { grid-template-columns: 1fr; }

  .topbar {
    padding-left: .75rem;
    padding-right: .75rem;
  }
  .card, .page.narrow .card {
    width: min(100%, 420px);
  }
}

/* Celular estreito: composer e lista ainda mais focados */
@media (max-width: 480px) {
  .inbox-count-pill { font-size: .72rem; }
  .chat-avatar-wrap,
  .chat-avatar {
    width: 36px;
    height: 36px;
  }
  .chat-contact-name { max-width: 36vw; }
  .chat-back-label { display: none; }
  .chat-actions { max-width: 48%; }
  .cmp-sig { font-size: .72rem; }
  .composer-modes { justify-content: flex-start; }
}
