* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button, input, textarea, select { font: inherit; }

button {
  background: none;
  border: 0;
  color: inherit;
}

:root.dark {
  color-scheme: dark;
}


/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-toggle {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink-soft);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin: 8px;
  transition: transform 0.3s ease, background 0.2s;
}

.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.sidebar-toggle:hover {
  background: var(--line);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .brand-version,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-link span:last-child {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  font-size: 18px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-version {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 6px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-group {
  margin-bottom: 18px;
}

.nav-label {
  display: block;
  padding: 6px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--soft);
  color: var(--ink);
}

.nav-link.active {
  background: var(--brand-50);
  color: var(--ink);
  border-left: 3px solid var(--brand-600);
  margin-left: -3px;
}

.dark .nav-link.active {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  color: var(--ink);
  border-left-color: var(--brand-500);
}

.nav-link.active .nav-icon {
  color: var(--brand-600);
}

.dark .nav-link.active .nav-icon {
  color: var(--brand-400);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: color 0.15s;
  flex: none;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-link:hover .nav-icon {
  color: var(--brand-600);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.sidebar-branding {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.sidebar-branding:hover {
  opacity: 0.8;
}

.onsiite-mark {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.sidebar-footer a:hover {
  color: var(--ink);
}

/* Topbar - REMOVED */
/* .topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.account-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--soft);
  border: 1px solid var(--line);
}

.account-menu:hover,
.account-menu:focus-within {
  border-color: var(--line-strong);
}

.account-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 100;
}

.account-menu:hover .account-dropdown,
.account-menu:focus-within .account-dropdown {
  display: block;
}

.account-dropdown a,
.account-dropdown form {
  display: block;
  padding: 8px 16px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.account-dropdown a:hover {
  background: var(--soft);
}

.account-dropdown form {
  margin: 0;
} */

.link-button {
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.link-button:hover {
  color: var(--ink);
}

.dark .link-button {
  color: var(--ink-soft);
}

/* Phosphor Icons sizing */
.ph, .ph-bold, .ph-fill {
  font-size: 18px;
  vertical-align: middle;
}

.nav-icon .ph,
.nav-icon .ph-bold,
.nav-icon .ph-fill {
  font-size: 15px;
}

.rail-link .ph-bold,
.rail-link .ph {
  font-size: 20px;
}

.rail-brand .ph {
  font-size: 24px;
}

/* Main layout offset */
main.with-sidebar {
  margin-left: var(--sidebar-width);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: none;
  }
  main.with-sidebar {
    margin-left: 0;
  }
}

/* Workspace & panels */
.workspace,
.chat-layout {
  min-height: calc(100vh - 60px);
  display: block;
  padding: 24px;
}

@media (max-width: 700px) {
  .workspace,
  .chat-layout {
    padding: 16px;
  }
}

.conversation-list {
  background: var(--surface);
  overflow: auto;
  flex: 1;
}

.conversation-list.wide {
  width: min(960px, calc(100vw - var(--sidebar-width) - 48px));
  margin: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--surface-elevated);
}

.list-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.list-heading h1 {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dark .eyebrow {
  color: var(--muted);
}

.count {
  background: var(--soft);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.filters {
  display: flex;
  gap: 8px;
  padding: 0 24px 18px;
  flex-wrap: wrap;
}

.filters button,
.filters select,
.filters input {
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  padding: 7px 12px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.filters .selected {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
}

/* Conversation items */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.conversation-item:hover {
  background: var(--soft);
}

.conversation-item.unread strong {
  color: var(--ink);
}

.dark .conversation-item.unread strong {
  color: var(--ink);
}

.avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500, #6366f1), var(--brand-600, #4f46e5));
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  flex: none;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 1px 3px rgba(0, 0, 0, 0.22);
}

/* Cores por contato em todos os avatares (bom contraste com texto branco). */
.avatar.avatar-tone-0 { background: linear-gradient(135deg, #34d399, #047857); }
.avatar.avatar-tone-1 { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.avatar.avatar-tone-2 { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.avatar.avatar-tone-3 { background: linear-gradient(135deg, #f87171, #b91c1c); }
.avatar.avatar-tone-4 { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }
.avatar.avatar-tone-5 { background: linear-gradient(135deg, #fbbf24, #b45309); }
.avatar.avatar-tone-0,
.avatar.avatar-tone-1,
.avatar.avatar-tone-2,
.avatar.avatar-tone-3,
.avatar.avatar-tone-4,
.avatar.avatar-tone-5 { color: #ffffff; }

/* Foto do contato/atendente: recorta em circulo perfeito, sem esticar nem
   criar forma eliptica (a imagem original pode ter proporcao diferente). */
.avatar > img,
.message-avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  display: block;
}

.conversation-meta,
.item-copy {
  flex: 1;
  min-width: 0;
}

.conversation-meta strong,
.item-copy strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.conversation-meta small,
.item-copy small {
  color: var(--muted);
  font-size: 12px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-side {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

/* Chat panel */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-elevated);
}

.chat-header h1 {
  margin: 0;
  font-size: 16px;
}

.chat-header span {
  font-size: 12px;
  color: var(--muted);
}

.back-button {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.back-button:hover {
  background: var(--brand-50);
  color: var(--ink);
  border-color: var(--brand-200);
}

.dark .back-button:hover {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--brand-500) 25%, transparent);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.day-separator {
  align-self: center;
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 4px 0;
}

.day-separator span {
  background: var(--surface-elevated);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: var(--shadow);
}

.dark .day-separator span {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .1);
}

.bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-shadow: var(--shadow);
}

.bubble.inbound {
  align-self: flex-start;
  background: var(--surface-elevated);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.bubble.outbound {
  align-self: flex-end;
  background: var(--brand-600);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.internal {
  align-self: flex-end;
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #111111;
  font-size: 13px;
  border-radius: 12px;
  max-width: 70%;
}

.dark .bubble.internal {
  background: #facc15;
  border-color: #eab308;
  color: #111111;
}

.bubble.private {
  background: #fef3c7;
  border: 1px solid #fde047;
  color: #111111;
  align-self: flex-end;
  border-radius: 12px;
}

.dark .bubble.private {
  background: #facc15;
  border-color: #eab308;
  color: #111111;
}

.internal-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  color: #111111;
  font-weight: 700;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.channel-badge.whatsapp {
  background: #dcfce7;
  color: #166534;
}

.channel-badge.instagram {
  background: #fce7f3;
  color: #9d174d;
}

.channel-badge.messenger {
  background: #dbeafe;
  color: #1e40af;
}

.composer-window-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  line-height: 1.35;
}

.dark .composer-window-note {
  background: rgb(146 64 14 / 0.22);
  color: #fcd34d;
}

.quick-reply-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  align-items: center;
}

.quick-reply-row input {
  flex: 1;
  min-width: 0;
}

.dark .internal-label {
  color: #111111;
}

.bubble small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.8;
}

.audio-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0;
}

.audio-player-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  min-width: 220px;
  max-width: 300px;
}

.bubble.outbound .audio-player-pill {
  background: rgba(0, 0, 0, 0.06);
}

.dark .bubble.outbound .audio-player-pill {
  background: rgba(255, 255, 255, 0.08);
}

/* Player de áudio enviado: cinza neutro, só o botão play fica vermelho */
:root .bubble.outbound:has(.audio-message) {
  background: var(--bubble-audio-bg);
  color: var(--bubble-audio-text);
}

:root .bubble.outbound:has(.audio-message) small {
  color: var(--bubble-audio-text);
  opacity: 0.7;
}

:root .bubble.outbound:has(.audio-message) .audio-progress-bar {
  background: rgba(0, 0, 0, 0.12);
}

:root.dark .bubble.outbound:has(.audio-message) .audio-progress-bar {
  background: rgba(255, 255, 255, 0.18);
}

:root .bubble.outbound:has(.audio-message) .audio-time {
  color: var(--bubble-audio-text);
  opacity: 0.7;
}

.bubble.internal .audio-player-pill {
  background: rgba(0, 0, 0, 0.08);
  color: #4b5563;
}

.bubble.internal .audio-progress-bar {
  background: rgba(0, 0, 0, 0.15);
}

.audio-play-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.audio-play-btn:hover {
  background: var(--brand-700);
}

.audio-play-btn svg {
  margin-left: 1px;
}

.audio-play-btn .icon-pause {
  margin-left: 0;
}

.audio-track {
  flex: 1;
  cursor: pointer;
  padding: 8px 0;
}

.audio-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.audio-progress-fill {
  height: 100%;
  width: 0%;
  background: currentColor;
  border-radius: 999px;
  transition: width 0.1s linear;
}

.audio-time {
  flex-shrink: 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  min-width: 32px;
  text-align: right;
}

.audio-speed {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  cursor: pointer;
  padding: 1px 0;
  max-width: 52px;
}

.audio-speed:hover {
  opacity: 1;
}

.audio-speed option {
  color: #111827;
  background: #fff;
}

.audio-transcribe-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.04);
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.92;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.audio-transcribe-btn:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.07);
  border-color: color-mix(in srgb, var(--accent, #dc2626) 40%, transparent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent, #dc2626) 22%, transparent);
}

.audio-transcribe-btn:active {
  transform: translateY(1px);
}

.audio-transcribe-btn:disabled {
  cursor: default;
  opacity: 0.55;
  box-shadow: none;
}

.audio-transcribe-btn[data-state="completed"] {
  border-color: rgba(13, 148, 136, 0.35);
  background: rgba(13, 148, 136, 0.08);
}

.audio-transcribe-btn[data-state="failed"] {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.06);
}

/* Marca "AI": faiscas (gradiente ciano) + letras em gradiente azul->magenta */
.audio-ia-mark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.audio-ia-mark[hidden] {
  display: none;
}

.audio-transcribe-spark {
  display: inline-block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  background-image: linear-gradient(135deg, var(--brand-400, #f87171) 0%, var(--accent, #dc2626) 55%, var(--brand-700, #991b1b) 100%);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3Cg%20transform%3D%27translate%286.6%204.4%29%20scale%28.44%29%20translate%28-12%20-9.5%29%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%27translate%284.7%2017%29%20scale%28.27%29%20translate%28-12%20-9.5%29%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3Cg%20transform%3D%27translate%286.6%204.4%29%20scale%28.44%29%20translate%28-12%20-9.5%29%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%27translate%284.7%2017%29%20scale%28.27%29%20translate%28-12%20-9.5%29%27%3E%3Cpath%20d%3D%27M12%201.6c.66%205.1%202.82%207.26%207.92%207.92-5.1.66-7.26%202.82-7.92%207.92-.66-5.1-2.82-7.26-7.92-7.92C9.18%208.86%2011.34%206.7%2012%201.6z%27%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent, #dc2626) 55%, transparent));
  animation: cf-ai-spark 2.6s ease-in-out infinite;
}

.audio-ia-letters {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background-image: linear-gradient(100deg, var(--brand-700, #991b1b) 0%, var(--accent, #dc2626) 55%, var(--brand-400, #f87171) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.audio-transcribe-btn:hover .audio-transcribe-spark {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent, #dc2626) 85%, transparent));
}

@keyframes cf-ai-spark {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.14) rotate(8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .audio-transcribe-spark {
    animation: none;
  }
}

/* Tema escuro: pill discreto sobre fundo escuro */
:root.dark .audio-transcribe-btn,
.dark .audio-transcribe-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

:root.dark .audio-transcribe-btn:hover,
.dark .audio-transcribe-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: color-mix(in srgb, var(--brand-400, #f87171) 55%, transparent);
}

:root.dark .audio-transcribe-btn[data-state="completed"],
.dark .audio-transcribe-btn[data-state="completed"] {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.1);
}

.audio-transcribe-spinner {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cf-spin 0.7s linear infinite;
  opacity: 0.85;
}

@keyframes cf-spin {
  to {
    transform: rotate(360deg);
  }
}

.audio-transcript {
  width: 100%;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.audio-transcript p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.outbound .audio-transcript {
  background: rgba(0, 0, 0, 0.05);
}

.dark .bubble.outbound .audio-transcript {
  background: rgba(255, 255, 255, 0.07);
}

.bubble.internal .audio-transcript {
  background: rgba(0, 0, 0, 0.06);
  color: #4b5563;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-elevated);
}

.composer fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  gap: 14px;
  font-size: 13px;
}

.composer fieldset legend {
  padding: 0 6px;
  font-size: 11px;
  color: var(--muted);
}

.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
  min-height: 80px;
  background: var(--surface);
  color: var(--ink);
}

.composer textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.file-input input {
  display: none;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  margin-top: 6px;
}

.attachment-link small {
  opacity: 0.7;
}

.image-attachment {
  display: block;
  max-width: 260px;
  margin-top: 6px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}

.image-attachment img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
}

.video-attachment {
  display: block;
  max-width: 320px;
  width: 100%;
  max-height: 360px;
  margin-top: 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 12px;
  background: var(--chatforce-panel-3);
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
}

.attachment-preview-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--chatforce-panel-2);
}

.attachment-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-icon {
  color: var(--chatforce-muted);
}

.attachment-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attachment-preview-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--chatforce-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-size {
  font-size: 11px;
  color: var(--chatforce-muted);
}

.attachment-preview-remove {
  flex-shrink: 0;
}

/* Buttons */
[hidden] {
  display: none !important;
}

.primary-button,
.secondary-button,
.danger-button,
.success-button,
.info-button,
.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
}

.primary-button {
  background: var(--ink-soft);
  color: var(--surface);
}

.primary-button:hover {
  background: var(--ink);
  box-shadow: var(--shadow);
}

.info-button {
  background: var(--info);
  color: #fff;
}

.info-button:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.secondary-button {
  background: var(--surface-elevated);
  color: var(--ink-soft);
  border-color: var(--line);
}

.secondary-button:hover {
  background: var(--soft);
  border-color: var(--line-strong);
}

.danger-button {
  background: var(--accent);
  color: #fff;
}

.danger-button:hover {
  background: var(--accent-dark);
}

.success-button {
  background: var(--success);
  color: #fff;
}

.success-button:hover {
  background: #15803d;
}

.send-button {
  background: var(--success);
  color: #fff;
  align-self: flex-end;
}

.send-button:hover {
  background: #15803d;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-new,
.status-open,
.status-active,
.status-approved,
.status-ok,
.status-connected,
.status-paid,
.status-completed,
.status-confirmed,
.status-answered,
.status-published {
  background: #dcfce7;
  color: #166534;
}

.dark .status-new,
.dark .status-open,
.dark .status-active,
.dark .status-approved,
.dark .status-ok,
.dark .status-connected,
.dark .status-paid,
.dark .status-completed,
.dark .status-confirmed,
.dark .status-answered,
.dark .status-published {
  background: rgba(21, 128, 61, 0.2);
  color: #86efac;
}

.status-closed,
.status-inactive,
.status-lost,
.status-left,
.status-joined {
  background: #f1f5f9;
  color: #475569;
}

.dark .status-closed,
.dark .status-inactive,
.dark .status-lost,
.dark .status-left,
.dark .status-joined {
  background: rgba(71, 85, 105, 0.3);
  color: #cbd5e1;
}

.status-won,
.status-shipped {
  background: #dbeafe;
  color: #1e40af;
}

.dark .status-won,
.dark .status-shipped {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.status-high,
.status-urgent,
.status-overdue,
.status-failed,
.status-cancelled,
.status-disconnected,
.status-missed,
.status-voicemail,
.status-refused,
.status-rejected,
.status-refunded,
.status-suspended,
.status-critical {
  background: #fee2e2;
  color: #991b1b;
}

.dark .status-high,
.dark .status-urgent,
.dark .status-overdue,
.dark .status-failed,
.dark .status-cancelled,
.dark .status-disconnected,
.dark .status-missed,
.dark .status-voicemail,
.dark .status-refused,
.dark .status-rejected,
.dark .status-refunded,
.dark .status-suspended,
.dark .status-critical {
  background: rgba(185, 28, 28, 0.2);
  color: #fca5a5;
}

.status-pending,
.status-paused,
.status-processing,
.status-draft,
.status-queued,
.status-ringing,
.status-sent {
  background: #fef3c7;
  color: #92400e;
}

.dark .status-pending,
.dark .status-paused,
.dark .status-processing,
.dark .status-draft,
.dark .status-queued,
.dark .status-ringing,
.dark .status-sent {
  background: rgba(217, 119, 6, 0.2);
  color: #fcd34d;
}

/* Forms */
.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stacked-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stacked-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.stacked-form input,
.stacked-form textarea,
.stacked-form select {
  width: 100%;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.stacked-form input:focus,
.stacked-form textarea:focus,
.stacked-form select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

input::placeholder,
textarea::placeholder {
  color: var(--field-placeholder, var(--muted));
  opacity: 1;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.inline-form input[type=text] {
  border: 1px solid var(--field-border, var(--line));
  border-radius: 7px;
  padding: 7px 10px;
  width: 160px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-600);
}

.dark .tab-btn.active {
  color: var(--brand-400);
  border-bottom-color: var(--brand-400);
}

.tab-panel {
  display: none;
  min-width: 0;
}

.tab-panel.active {
  display: block;
}

/* Painéis dentro de formulários preservam o espaçamento vertical do stacked-form */
.stacked-form .tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tab-panel > :first-child {
  margin-top: 0;
}

.tab-panel > :last-child {
  margin-bottom: 0;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Configurações em abas: alinha a navegação com os cards do grid */
.settings-tabs .tabs-nav {
  padding: 0 24px;
}

/* Form grid (2 colunas em telas largas) */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}

.form-grid .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Data tables */
.table-scroll {
  overflow-x: auto;
}

.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-actions select {
  border: 1px solid var(--field-border, var(--line));
  border-radius: 7px;
  padding: 7px 10px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 24px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.data-table a:hover {
  text-decoration: underline;
}

/* Tabelas → card-list no mobile */
@media (max-width: 640px) {
  .data-table-wrapper {
    overflow: visible;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: var(--surface-elevated);
    box-shadow: var(--shadow);
  }

  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 2px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    flex: none;
    text-align: left;
  }

  .data-table td:empty::before {
    content: '';
  }

  .data-table-toolbar {
    padding: 12px 14px;
  }
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.empty-table-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.empty-table-tip strong {
  color: var(--ink);
  font-size: 15px;
}

.empty-table-tip span {
  line-height: 1.5;
}

.empty-table-tip .primary-button {
  margin-top: 6px;
  color: var(--surface);
  text-decoration: none;
}

.truncate {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Utility */
.padded {
  padding: 24px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.form-actions a {
  color: var(--muted);
  text-decoration: none;
}

.flash {
  margin: 0 24px 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--ink);
  border: 1px solid var(--brand-200);
  font-size: 13px;
}

.dark .flash {
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  border-color: color-mix(in srgb, var(--brand-500) 25%, transparent);
  color: var(--ink);
}

/* Cores semânticas das mensagens — independentes do skin. */
.flash-success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.flash-warning {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.flash-error {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.dark .flash-success {
  background: rgba(22, 163, 74, 0.16);
  border-color: rgba(22, 163, 74, 0.40);
  color: #86efac;
}

.dark .flash-warning {
  background: rgba(234, 88, 12, 0.16);
  border-color: rgba(234, 88, 12, 0.40);
  color: #fdba74;
}

.dark .flash-error {
  background: rgba(185, 28, 28, 0.18);
  border-color: rgba(185, 28, 28, 0.40);
  color: #fca5a5;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  color: var(--ink);
  font-size: 16px;
}

/* Pagination */
.pagination {
  padding: 18px 24px;
}

.pagination svg {
  width: 18px;
  height: 18px;
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 90% 10%, var(--brand-100), transparent 30%), var(--bg);
}

.dark .login-shell {
  background: radial-gradient(circle at 90% 10%, color-mix(in srgb, var(--brand-500) 15%, transparent), transparent 30%), var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 24px;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.login-card input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.login-card button {
  width: 100%;
}

.login-card .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.login-card .check input {
  width: auto;
  margin: 0;
}

.field-error {
  color: var(--accent);
  font-size: 12px;
  margin: -10px 0 14px;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
}

/* Legal */
.legal-panel {
  max-width: 800px;
  margin: 28px auto;
  padding: 28px;
  background: var(--surface-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.legal-panel.narrow {
  max-width: 680px;
}

.legal-panel .panel-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.legal-panel h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.legal-notice {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  color: #6d4c00;
  font-size: 13px;
}

.dark .legal-notice {
  background: rgba(202, 138, 4, 0.15);
  border-color: rgba(202, 138, 4, 0.3);
  color: #fde047;
}

.legal-text h2 {
  font-size: 18px;
  margin-top: 28px;
  margin-bottom: 12px;
  color: var(--ink);
}

.legal-text p {
  margin-bottom: 14px;
  line-height: 1.65;
}

.legal-text ul {
  margin-bottom: 16px;
  padding-left: 22px;
}

.legal-text li {
  margin-bottom: 8px;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 0 24px 24px;
}

.settings-card {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.settings-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.settings-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.settings-card h2 i {
  font-size: 16px;
  color: var(--brand-600);
}

.settings-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.settings-card li {
  margin-bottom: 8px;
}

.settings-card li:last-child {
  margin-bottom: 0;
}

.settings-card a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}

.settings-card a:hover {
  color: var(--brand-600);
  text-decoration: underline;
}

/* Context panel */
.context-panel {
  width: 280px;
  background: var(--surface-elevated);
  border-left: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
}

.context-panel-mobile-toggle {
  display: none;
}

.context-backdrop {
  display: none;
}

/* Alternador de conta/setor */
.context-switcher {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.context-switcher-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.context-switcher-form label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.context-switcher-form select {
  width: 100%;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-size: 13px;
}

.context-panel h2 {
  margin: 6px 0 16px;
  font-size: 18px;
}

.context-panel dl {
  margin: 0 0 20px;
}

.context-panel dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}

.context-panel dd {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
}

.context-panel details {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface);
}

.context-panel summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.error-box {
  margin: 0 24px 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 13px;
}

.dark .error-box {
  background: rgba(185, 28, 28, 0.15);
  border-color: rgba(185, 28, 28, 0.3);
  color: #fca5a5;
}

/* Kanban */
.kanban {
  display: flex;
  gap: 16px;
  padding: 0 24px 24px;
  overflow-x: auto;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex: 1;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.kanban-column h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kanban-card {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-card strong {
  font-size: 14px;
  color: var(--ink);
}

.kanban-card span {
  font-size: 12px;
  color: var(--muted);
}

/* Metric cards */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 0 24px 24px;
}

.metric {
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.metric:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.metric strong {
  display: block;
  font-size: 28px;
  color: var(--ink);
}

.metric span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

a.metric {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

a.metric:hover {
  border-color: var(--brand-600);
}

/* Member list */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check-row:hover {
  border-color: var(--line-strong);
}

.check-row:has(input[type=checkbox]:checked) {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.dark .check-row:has(input[type=checkbox]:checked) {
  background: color-mix(in srgb, var(--brand-500) 18%, transparent);
}

.check-row input[type=checkbox] {
  flex: none;
}

.check-row > span,
.check-row > small,
.check-row > label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.check-row > span {
  flex: 1;
}

.check-row small {
  color: var(--muted);
  flex: 1;
}

.check-row select {
  flex: none;
  margin-left: auto;
  max-width: 46%;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

/* Checkboxes e radios */
input[type=checkbox],
input[type=radio] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  vertical-align: middle;
  cursor: pointer;
}

/* Não herdar o visual de campo (largura/padding/borda) dos inputs de texto */
.stacked-form input[type=checkbox],
.stacked-form input[type=radio] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  box-shadow: none;
}

/* Labels de caixa única (Ativo/Ativa) alinhadas */
.stacked-form > label:has(> input[type=checkbox]),
.stacked-form > label:has(> input[type=radio]),
.stacked-form .tab-panel > label:has(> input[type=checkbox]),
.stacked-form .tab-panel > label:has(> input[type=radio]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-weight: 500;
  cursor: pointer;
}

/* Divisores de seção em formulários */
.stacked-form > h3,
.stacked-form .tab-panel > h3,
.stacked-form .tab-panel > .member-list-head > h3 {
  margin: 6px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stacked-form > h3:first-child,
.stacked-form .tab-panel > h3:first-child,
.stacked-form .tab-panel > .member-list-head:first-child > h3 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.member-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.member-list-head .check-all {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  border-color: transparent;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.member-list-head .check-all:hover {
  border-color: transparent;
  color: var(--ink);
}

.member-list-head .check-all:has(input[type=checkbox]:checked) {
  border-color: transparent;
  background: var(--brand-50);
  color: var(--brand-700, var(--ink));
}

.dark .member-list-head .check-all:has(input[type=checkbox]:checked) {
  background: color-mix(in srgb, var(--brand-500) 18%, transparent);
  color: var(--ink);
}

/* Turnos de escala */
#shifts-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shift-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px 110px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.shift-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
}

.shift-row input[type=time] {
  width: 100%;
}

.shift-row:has(input[type=checkbox]:not(:checked)) {
  opacity: 0.72;
}

.shift-row input[type=time]:disabled {
  cursor: not-allowed;
}

@media (max-width: 560px) {
  .shift-row {
    grid-template-columns: 1fr 1fr;
  }
  .shift-row label {
    grid-column: 1 / -1;
  }
}

/* Responsive */
@media (max-width: 700px) {
  .conversation-list.wide {
    width: auto;
    margin: 14px;
  }
  .list-heading {
    padding: 16px;
  }
  .list-heading h1 {
    font-size: 20px;
  }
  .kanban {
    flex-direction: column;
    padding: 0 14px 14px;
  }
  .kanban-column {
    max-width: none;
  }
  .tabs-nav {
    gap: 0;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn {
    padding: 9px 12px;
    font-size: 12px;
  }
  .stacked-form.padded,
  .padded {
    padding: 16px;
  }
  .panel {
    padding: 16px;
  }
  .settings-tabs .tabs-nav {
    padding: 0;
  }
  .settings-grid {
    padding: 0 0 16px;
  }
  .form-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* WhatsApp Web-inspired operator shell */

body {
  background: var(--chatforce-bg);
}

.brand-text,
.nav-label,
.status,
.eyebrow {
  letter-spacing: 0;
}

.app-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 70;
  width: var(--rail-width);
  min-height: 100vh;
  background: var(--chatforce-bg);
  border-right: 1px solid var(--chatforce-line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
}

.rail-brand,
.rail-link {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--chatforce-muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.rail-brand {
  background: transparent;
  margin-bottom: 18px;
}

.rail-link svg {
  width: 18px;
  height: 18px;
}

.rail-link:hover,
.rail-link.active {
  color: var(--chatforce-text);
  background: var(--chatforce-panel-3);
}

.rail-link.active {
  box-shadow: inset 2px 0 0 var(--chatforce-blue);
}

.rail-danger {
  color: var(--accent);
}

.rail-danger:hover {
  color: var(--chatforce-white);
  background: var(--accent);
}

.rail-link {
  position: relative;
}

.rail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.rail-nav,
.rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-bottom {
  margin-top: auto;
}

.rail-bottom form {
  margin: 0;
}

/* Profile Menu */
.rail-profile-menu {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-profile-button {
  position: relative;
}

.rail-profile-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: -180px;
  width: 200px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 100;
}

.rail-profile-menu.is-open .rail-profile-dropdown {
  display: block;
}

.rail-profile-dropdown a,
.rail-profile-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.rail-profile-dropdown a:hover,
.rail-profile-dropdown button:hover {
  background: var(--soft);
}

.rail-profile-dropdown form {
  margin: 0;
}

.sidebar {
  left: var(--rail-width);
  width: var(--sidebar-width);
  background: var(--chatforce-panel);
  border-right-color: var(--chatforce-line);
}

.sidebar-brand {
  min-height: 62px;
  padding: 10px 12px;
  gap: 8px;
  border-bottom-color: var(--chatforce-line-soft);
}

.brand-mark {
  width: 24px;
  height: 24px;
  box-shadow: none;
}

.brand-text {
  font-size: 12px;
  font-weight: 700;
}

.brand-version {
  display: none;
}

.sidebar-nav {
  padding: 8px 8px 12px;
}

.nav-group {
  margin-bottom: 12px;
}

.nav-label {
  padding: 7px 6px 5px;
  color: var(--chatforce-text-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
}

.nav-link {
  gap: 8px;
  margin: 1px 0;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--chatforce-text-soft);
  font-size: 11px;
  line-height: 1.25;
}

.nav-link:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.nav-link.active,
.dark .nav-link.active {
  margin-left: 0;
  border-left: 0;
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  color: var(--ink);
}

.nav-icon {
  width: 15px;
  height: 15px;
}

.sidebar-footer {
  padding: 10px 8px;
  gap: 8px;
  border-top-color: var(--chatforce-line-soft);
  font-size: 10px;
}

.dark .sidebar-branding {
  color: var(--ink);
}

/* Sidebar contextual header & filters */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 14px 14px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--chatforce-text-soft);
  border-bottom: 1px solid var(--chatforce-line-soft);
}

.sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
}

.sidebar-filters a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--chatforce-text-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-filters a:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.sidebar-filters a.active {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  color: var(--ink);
}

/* Sidebar sections (Inboxes, Tags) */
.sidebar-section {
  padding: 8px 10px;
  border-top: 1px solid var(--chatforce-line-soft);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chatforce-muted);
}

.sidebar-add-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  color: var(--chatforce-muted);
  background: var(--chatforce-panel-2);
  border: 1px solid var(--chatforce-line);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-add-btn:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--chatforce-text-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-list-item:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.sidebar-list-item.active {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  color: var(--ink);
}

.sidebar-list-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--chatforce-muted);
  flex: none;
}

.sidebar-list-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.sidebar-list-empty {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--chatforce-muted);
}

.sidebar-list-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sidebar-list-row .sidebar-list-item {
  flex: 1;
  min-width: 0;
}

.sidebar-copy-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--chatforce-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.sidebar-list-row:hover .sidebar-copy-btn,
.sidebar-copy-btn:focus-visible,
.sidebar-copy-btn.is-copied {
  opacity: 1;
}

.sidebar-copy-btn:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.sidebar-copy-btn.is-copied {
  color: var(--brand-500);
}

@media (hover: none) {
  .sidebar-copy-btn {
    opacity: 1;
  }
}

.sidebar-new-link {
  display: block;
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--chatforce-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.sidebar-new-link:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

/* No-sidebar layout */
main.no-sidebar {
  margin-left: var(--rail-width);
}

.topbar {
  height: var(--topbar-height);
  margin-left: calc(var(--rail-width) + var(--sidebar-width));
  width: calc(100% - var(--rail-width) - var(--sidebar-width));
  padding: 0 12px;
  background: var(--chatforce-panel);
  border-bottom-color: var(--chatforce-line);
}

.topbar .text-sm {
  font-size: 12px;
}

.account-menu {
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--chatforce-panel-2);
  border-color: var(--chatforce-line);
  color: var(--chatforce-text-soft);
}

main.with-sidebar {
  margin-left: calc(var(--rail-width) + var(--sidebar-width));
}

.conversation-list.wide {
  width: min(1200px, 100%);
  margin-left: auto;
  margin-right: auto;
}

/* Listagens e telas com tabelas/métricas usam toda a largura disponível */
.conversation-list.wide:has(.data-table),
.conversation-list.wide:has(.data-list),
.conversation-list.wide:has(.metric-grid),
.conversation-list.wide:has(.agenda-page),
.conversation-list.wide.intercom-shell {
  width: auto;
  max-width: none;
}

/* Super Admin · detalhe do lead */
.lead-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 24px;
  align-items: start;
  padding: 0 24px 24px;
}

.lead-detail-main .data-list {
  margin-bottom: 26px;
}

.lead-detail-side {
  position: sticky;
  top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .lead-detail-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }

  .lead-detail-side {
    position: static;
  }
}

.chatwoot-layout {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 286px;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: var(--chatforce-canvas);
}

.chatwoot-index {
  grid-template-columns: 310px minmax(0, 1fr);
}

/* Índice com a coluna de agenda: lista | agenda | painel (mesmo sem conversa selecionada) */
.chat-layout.chatwoot-index {
  grid-template-columns: 310px 286px minmax(0, 1fr);
}

.chat-layout.chatwoot-index .agenda-column {
  width: 286px;
  max-width: 286px;
  min-width: 0;
}

.chat-layout.chatwoot-index .chat-panel {
  min-width: 0;
}

@media (max-width: 1100px) {
  .chat-layout.chatwoot-index {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .chat-layout.chatwoot-index .agenda-column {
    display: none;
  }
}

.chatwoot-conversation-list {
  border-right: 1px solid var(--chatforce-line);
  background: var(--chatforce-panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.conversation-list-header {
  flex: none;
  border-bottom: 1px solid var(--chatforce-line);
  background: var(--chatforce-panel);
}

.conversation-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  padding: 8px 10px 4px;
}

.conversation-search input {
  min-width: 0;
  height: 28px;
  border: 1px solid var(--field-border, var(--chatforce-line));
  border-radius: 6px;
  background: var(--field-bg, var(--chatforce-panel-2));
  color: var(--field-text, var(--chatforce-text));
  padding: 0 9px;
  font-size: 12px;
}

.conversation-search button,
.icon-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--chatforce-line);
  border-radius: 6px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
}

.conversation-search button:hover,
.icon-button:hover {
  color: var(--chatforce-text);
  background: var(--chatforce-panel-3);
}

.list-heading.compact {
  padding: 5px 10px 6px;
  align-items: center;
}

.list-heading.compact h1 {
  margin: 0;
  font-size: 15px;
}

.list-heading.compact .eyebrow {
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
}

.conversation-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 8px;
  overflow-x: auto;
}

.conversation-tabs a {
  flex: none;
  color: var(--chatforce-text-soft);
  border-bottom: 2px solid transparent;
  padding: 4px 0 7px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.conversation-tabs a.selected {
  color: var(--ink);
  border-bottom-color: var(--chatforce-blue-soft);
}

.conversation-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
  font-size: 10px;
}

.saved-filter-select {
  padding: 0 10px 8px;
}

.saved-filter-select select {
  width: 100%;
  height: 28px;
  border: 1px solid var(--field-border, var(--chatforce-line));
  border-radius: 6px;
  background: var(--field-bg, var(--chatforce-panel-2));
  color: var(--field-text, var(--chatforce-text));
  font-size: 12px;
}

.sort-options {
  padding: 0 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-options label {
  font-size: 12px;
  color: var(--chatforce-muted);
  font-weight: 500;
  white-space: nowrap;
}

.sort-select {
  height: 28px;
  border: 1px solid var(--field-border, var(--chatforce-line));
  border-radius: 6px;
  background: var(--field-bg, var(--chatforce-panel-2));
  color: var(--field-text, var(--chatforce-text));
  font-size: 12px;
  padding: 0 8px;
  cursor: pointer;
  flex: 1;
}

.sort-select:hover {
  border-color: var(--chatforce-blue-soft);
}

.sort-select:focus {
  outline: none;
  border-color: var(--chatforce-blue-soft);
}

.conversation-list-items {
  overflow-y: auto;
}

.chatwoot-conversation-list .conversation-item {
  position: relative;
  min-height: 70px;
  padding: 10px 10px 10px 12px;
  gap: 10px;
  border-top: 0;
  border-bottom: 1px solid var(--chatforce-line-soft);
  border-left: 2px solid transparent;
  background: var(--chatforce-panel);
}

.chatwoot-conversation-list .conversation-item:hover,
.chatwoot-conversation-list .conversation-item.active {
  background: var(--chatforce-panel-3);
}

.chatwoot-conversation-list .conversation-item.active {
  border-left-color: var(--chatforce-blue-soft);
}

.chatwoot-conversation-list .avatar {
  width: 32px;
  height: 32px;
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
}

.chatwoot-conversation-list .item-copy strong {
  color: var(--chatforce-text);
  font-size: 12px;
}

.chatwoot-conversation-list .item-copy small {
  color: var(--chatforce-text-soft);
  font-size: 11px;
}

.conversation-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 120px;
  margin-top: 3px;
  padding: 1px 5px 2px;
  border: 1px solid var(--chatforce-line);
  border-radius: 4px;
  color: var(--chatforce-text-soft);
  background: var(--chatforce-bg);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-label i {
  font-size: 12px;
  flex: none;
}

.channel-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.channel-label i {
  font-size: 15px;
  color: var(--brand-600);
}

.chatwoot-conversation-list .conversation-side {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-size: 10px;
  color: var(--chatforce-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--chatforce-muted);
}

.status-dot-new,
.status-dot-open,
.status-dot-in_progress {
  background: var(--chatforce-green);
}

.status-dot-closed,
.status-dot-resolved {
  background: var(--chatforce-muted);
}

.pagination.compact {
  padding: 10px;
  border-top: 1px solid var(--chatforce-line);
}

/* Carregamento em lotes da fila de conversas (rolagem infinita). */
.conversation-list-footer {
  flex: none;
}

.conversation-list-loader,
.conversation-list-more,
.conversation-list-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-top: 1px solid var(--chatforce-line);
  color: var(--chatforce-text-soft);
  font-size: 12px;
}

.conversation-list-more i,
.conversation-list-end i {
  font-size: 14px;
}

.conversation-list-end {
  color: var(--chatforce-muted);
}

.conversation-list-loader[hidden],
.conversation-list-more[hidden],
.conversation-list-end[hidden] {
  display: none;
}

.conversation-list-spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cf-spin 0.7s linear infinite;
  opacity: 0.85;
}

.chat-panel {
  background: var(--chatforce-canvas);
  border: 0;
}

.chat-panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chatwoot-empty-state {
  max-width: 360px;
}

.chatwoot-save-filter {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 18px;
  justify-content: center;
}

.chat-header {
  min-height: 60px;
  padding: 9px 14px;
  border-bottom-color: var(--chatforce-line);
  background: var(--chatforce-panel);
}

.chat-header .avatar {
  width: 36px;
  height: 36px;
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
}

.chat-title h1 {
  color: var(--chatforce-text);
  font-size: 14px;
  font-weight: 800;
}

.chat-title span {
  color: var(--chatforce-muted);
}

.chat-title .chat-header-phone {
  display: inline;
  margin-left: 4px;
  white-space: nowrap;
}

.chat-title .chat-header-sep {
  margin: 0 6px 0 2px;
  color: var(--chatforce-muted);
  opacity: 0.55;
}

.chat-header .inline-form input[type=text] {
  width: 120px;
  background: var(--field-bg, var(--chatforce-panel-2));
}

.resolve-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--chatforce-green);
  color: var(--chatforce-white);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.messages {
  padding: 22px 44px;
  gap: 8px;
  background: var(--chatforce-canvas);
}

.bubble {
  max-width: min(58%, 560px);
  padding: 10px 13px;
  border-radius: 6px;
  box-shadow: none;
  font-size: 12px;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.bubble.inbound {
  background: var(--chatforce-bubble-inbound);
  color: var(--chatforce-text);
  border-bottom-left-radius: 3px;
}

.bubble.outbound {
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
  border-bottom-right-radius: 3px;
}

.bubble small {
  color: inherit;
  opacity: 0.82;
  font-size: 10px;
}

.bubble.internal small {
  color: #4b5563;
  opacity: 1;
}

.attachment-link {
  color: var(--ink-soft);
}

.composer {
  gap: 0;
  padding: 0;
  border-top-color: var(--chatforce-line);
  background: var(--chatforce-panel);
}

.composer-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 33px;
  padding: 0 16px;
  border-bottom: 1px solid var(--chatforce-line);
}

.composer-tab {
  height: 33px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--chatforce-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.composer-tab:has(input:checked) {
  color: var(--ink);
  border-bottom-color: var(--chatforce-blue-soft);
}

.composer-tab.private:has(input:checked) {
  color: var(--chatforce-private);
  border-bottom-color: var(--chatforce-private);
}

.composer textarea {
  min-height: 92px;
  border: 0;
  border-radius: 0;
  resize: none;
  padding: 14px 16px;
  background: var(--chatforce-panel);
  color: var(--chatforce-text);
}

.composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.formatting-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 10px;
  border-bottom: 1px solid var(--chatforce-line-soft);
  background: var(--chatforce-panel-3);
}

.format-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--chatforce-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.format-btn .ph {
  line-height: 1;
}

.format-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--chatforce-line);
}

.format-wrapper {
  position: relative;
  display: flex;
}

.format-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 216px;
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  background: var(--chatforce-panel);
  border: 1px solid var(--chatforce-line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

.format-btn:hover {
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text);
}

.format-btn:active {
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
}

.composer-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 10px;
}

.composer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-input {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--chatforce-line);
  border-radius: 6px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text-soft);
  cursor: pointer;
}

.file-input:hover {
  color: var(--chatforce-text);
  background: var(--chatforce-panel-3);
}

.emoji-wrapper {
  position: relative;
}

.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 240px;
  max-height: 200px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 10px;
  background: var(--chatforce-panel-3);
  border: 1px solid var(--chatforce-line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.emoji-option {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.emoji-option:hover {
  background: var(--chatforce-panel-3);
}

#audio_record_toggle.recording {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--chatforce-white);
}

.audio-recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--chatforce-danger);
  font-weight: 600;
}

.audio-recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: audio-pulse 1s infinite;
}

@keyframes audio-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.audio-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 12px;
  background: var(--chatforce-panel-3);
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
}

.audio-preview audio {
  flex: 1;
  height: 32px;
}

.audio-preview-duration {
  font-size: 11px;
  color: var(--chatforce-muted);
  white-space: nowrap;
}

.audio-preview-remove {
  flex-shrink: 0;
}

.send-button {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--success);
  font-size: 12px;
}

.send-button:hover {
  background: var(--chatforce-blue-soft);
}

.context-panel {
  width: auto;
  padding: 0;
  background: var(--chatforce-panel);
  border-left-color: var(--chatforce-line);
}

.contact-summary {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--chatforce-line);
  margin: 20px 20px 0 20px;
}

.avatar.large {
  width: 44px;
  height: 44px;
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
}

.contact-summary h2 {
  margin: 10px 0 2px;
  color: var(--chatforce-text);
  font-size: 14px;
}

.contact-summary > span {
  color: var(--chatforce-muted);
  font-size: 12px;
}

.context-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.context-section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--chatforce-line);
  margin: 20px 20px 0 20px;
}

.context-section h3 {
  margin: 0 0 14px;
  color: var(--chatforce-text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.context-section dl,
.context-panel dl {
  margin: 0;
}

.context-section dt,
.context-panel dt {
  margin: 8px 0 4px;
  color: var(--chatforce-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.context-section dd,
.context-panel dd {
  margin: 0 0 12px 0;
  color: var(--chatforce-text);
  font-size: 13px;
  padding-left: 12px;
}

.context-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--chatforce-line-soft);
}

.context-item strong {
  color: var(--chatforce-text);
  font-size: 12px;
}

.context-item small {
  color: var(--chatforce-muted);
  font-size: 11px;
}

.context-panel details {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 10px 0 0;
  background: transparent;
}

.context-panel summary {
  padding: 8px 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.stacked-form input,
.stacked-form textarea,
.stacked-form select,
.inline-form input[type=text],
.filters button,
.filters select,
.filters input {
  border-color: var(--field-border, var(--chatforce-line));
  background: var(--field-bg, var(--chatforce-panel-2));
  color: var(--field-text, var(--chatforce-text));
}

.status {
  border-radius: 4px;
  padding: 3px 6px;
  letter-spacing: 0;
  text-transform: none;
}

.status-in_progress,
.status-waiting {
  background: #dbeafe;
  color: #1e40af;
}

.dark .status-in_progress,
.dark .status-waiting {
  background: rgba(31, 142, 241, 0.18);
  color: #8dcbff;
}

.status-resolved {
  background: #dcfce7;
  color: #166534;
}

.dark .status-resolved {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

@media (max-width: 1180px) {
  .chatwoot-layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .context-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 88vw);
    z-index: 90;
    display: block;
    transform: translateX(105%);
    transition: transform 0.25s ease;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
  }

  .chat-layout.context-open .context-panel {
    transform: translateX(0);
  }

  .context-panel-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--soft);
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }

  .context-panel-mobile-toggle:hover {
    background: var(--brand-50);
    color: var(--ink);
    border-color: var(--brand-200);
  }

  .dark .context-panel-mobile-toggle:hover {
    background: color-mix(in srgb, var(--brand-500) 15%, transparent);
    color: var(--ink);
    border-color: color-mix(in srgb, var(--brand-500) 25%, transparent);
  }

  .context-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .chat-layout.context-open .context-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 1024px) {
  .topbar {
    margin-left: var(--rail-width);
    width: calc(100% - var(--rail-width));
  }

  main.with-sidebar {
    margin-left: var(--rail-width);
  }
}

@media (max-width: 860px) {
  .chatwoot-layout,
  .chatwoot-index {
    grid-template-columns: minmax(0, 1fr);
  }

  .chatwoot-layout:not(.chatwoot-index) .chatwoot-conversation-list {
    display: none;
  }

  .messages {
    padding: 16px;
  }

  .bubble {
    max-width: 86%;
  }

  .chat-header {
    flex-wrap: wrap;
  }

  .back-button {
    display: grid;
  }
}

/* Scrollbars - Light theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--soft);
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Scrollbars - Dark theme */
.dark ::-webkit-scrollbar-track {
  background: var(--chatforce-panel-2);
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--chatforce-panel-3);
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--chatforce-muted);
}

/* WhatsApp Web skin overrides */

/* Fundo do chat: mesmo arquivo original nos dois temas, preenchendo toda a área.
   No tema claro, uma sobreposição suave deixa o fundo mais translúcido. */
.chat-panel,
.messages {
  background-color: var(--chatforce-canvas);
  background-image: url('/assets/fundo%20chat.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

:root:not(.dark) .chat-panel,
:root:not(.dark) .messages {
  background-image:
    linear-gradient(
      color-mix(in srgb, var(--chatforce-canvas) 82%, transparent),
      color-mix(in srgb, var(--chatforce-canvas) 82%, transparent)
    ),
    url('/assets/fundo%20chat.png');
  background-repeat: no-repeat, no-repeat;
  background-position: center center, center center;
  background-size: cover, cover;
}

/* Bubbles - WhatsApp style */
.bubble {
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  border-radius: 7.5px;
  max-width: min(65%, 520px);
  padding: 6px 7px 8px 9px;
  font-size: 14.2px;
  line-height: 19px;
}

/* Textos longos (URLs) não devem escapar da bolha */
.bubble,
.bubble-card,
.bubble-card p,
.bubble-card a,
.bubble p {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble.inbound {
  background: var(--chatforce-bubble-inbound);
  color: var(--chatforce-text);
  border-bottom-left-radius: 1px;
  align-self: flex-start;
}

.bubble.outbound {
  background: var(--chatforce-bubble-outbound);
  color: var(--chatforce-text);
  border-bottom-right-radius: 1px;
  align-self: flex-end;
}

.dark .bubble.outbound {
  color: #e9edef;
}

.bubble.internal {
  align-self: flex-end;
  background: #fff9c4;
  border: 0;
  color: #111b21;
  border-radius: 7.5px;
  border-bottom-right-radius: 1px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

.dark .bubble.internal {
  background: #facc15;
  color: #111111;
}

.bubble small {
  display: inline;
  font-size: 11px;
  color: var(--chatforce-muted);
  float: right;
  margin-top: 4px;
  margin-left: 8px;
}

.bubble.outbound small {
  color: color-mix(in srgb, var(--bubble-outbound-text, #ffffff) 78%, transparent);
}

.dark .bubble.outbound small {
  color: color-mix(in srgb, var(--bubble-outbound-text, #ffffff) 78%, transparent);
}

/* Conversation list - WhatsApp style */
.chatwoot-conversation-list .conversation-item {
  padding: 12px 14px;
  border-bottom: 0;
  border-top: 0;
  border-left: 0;
  gap: 14px;
  min-height: 72px;
}

.chatwoot-conversation-list .conversation-item:hover,
.chatwoot-conversation-list .conversation-item.active {
  background: var(--chatforce-panel-2);
}

.chatwoot-conversation-list .avatar {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 500;
  background: #dfe5e7;
  color: var(--chatforce-text);
}

.dark .chatwoot-conversation-list .avatar {
  background: #2a2a2a;
  color: #e9edef;
}

.chatwoot-conversation-list .item-copy strong {
  font-size: 16px;
  font-weight: 500;
  color: var(--chatforce-text);
}

.chatwoot-conversation-list .item-copy small {
  font-size: 13px;
  color: var(--chatforce-muted);
  margin-top: 2px;
}

.chatwoot-conversation-list .conversation-side {
  gap: 4px;
  font-size: 11px;
  color: var(--chatforce-muted);
}

/* Chat header - WhatsApp style */
.chat-header {
  background: var(--chatforce-panel-2);
  border-bottom-color: var(--chatforce-line);
  min-height: 59px;
  padding: 10px 16px;
}

.chat-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe5e7;
  color: var(--chatforce-text);
}

.dark .chat-header .avatar {
  background: #2a2a2a;
}

.chat-title h1 {
  font-size: 16px;
  font-weight: 500;
}

/* Composer - WhatsApp style */
.composer {
  background: var(--chatforce-panel-2);
  border-top-color: var(--chatforce-line);
  padding: 10px 16px;
}

.composer textarea {
  background: var(--chatforce-panel);
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 44px;
  font-size: 15px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

.composer-tabs {
  border-bottom-color: var(--chatforce-line);
}

.composer-tab {
  font-size: 13px;
  font-weight: 500;
}

/* Status dot */
.status-dot-new,
.status-dot-open,
.status-dot-in_progress {
  background: var(--chatforce-green);
}

/* Rail */
.app-rail {
  background: var(--chatforce-panel-2);
  border-right-color: var(--chatforce-line);
}

.rail-link:hover,
.rail-link.active {
  background: var(--chatforce-panel-3);
}

/* Sidebar */
.sidebar {
  background: var(--chatforce-panel);
  border-right-color: var(--chatforce-line);
}

.sidebar-header {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--chatforce-text);
  border-bottom: 1px solid var(--chatforce-line);
}

/* Conversation search */
.conversation-search input {
  background: var(--field-bg, var(--chatforce-panel-2));
  border-color: var(--field-border, var(--chatforce-line));
  border-radius: 8px;
  height: 35px;
}

/* Filters in sidebar */
.sidebar-filters a {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--chatforce-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s;
}

.sidebar-filters a:hover,
.sidebar-filters a.active {
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text);
}

/* Panels */
.panel {
  padding: 24px;
  background: var(--surface-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel.narrow:not(.legal-panel) {
  max-width: min(980px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.panel-subheader {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* Definition lists */
.data-list {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 8px 16px;
  margin: 0;
}

.data-list dt {
  font-weight: 600;
  color: var(--muted);
}

.data-list dd {
  margin: 0;
  color: var(--ink);
}

/* Code */
.code-block {
  overflow: auto;
  max-height: 320px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.inline-code {
  padding: 1px 6px;
  background: var(--soft);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

/* Token de API (não pode estourar o card) */
.api-token-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  margin: 0 0 12px;
}

.api-token-value {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.4;
}

.api-token-row .secondary-button {
  flex: none;
}

/* Text helpers */
.text-right {
  text-align: right;
}

p.error {
  color: var(--accent);
  font-size: 13px;
}

.text-link {
  color: var(--ink-soft);
}

.dark .text-link {
  color: var(--ink-soft);
}

.text-danger {
  color: var(--accent);
}

/* Inline forms & small buttons */
form.inline {
  display: inline;
}

.primary-button.small,
.secondary-button.small,
.danger-button.small,
.success-button.small,
.info-button.small,
.send-button.small,
.link-button.small,
button.small {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
}

/* Mobile sidebar toggle (hamburger) */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: calc(var(--rail-width) + 12px);
  z-index: 60;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: var(--shadow);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-menu-toggle .ph {
  font-size: 20px;
}

@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }
}

/* Chat: typing indicator & new-messages pill */
.typing-indicator {
  display: none;
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

.messages-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-wrap .messages {
  flex: 1;
}

.new-messages-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.new-messages-pill:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--ink);
}

.dark .new-messages-pill:hover {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
  border-color: color-mix(in srgb, var(--brand-500) 25%, transparent);
  color: var(--ink);
}

/* Save-filter details (conversation list header) */
.save-filter-details {
  font-size: 12px;
  color: var(--muted);
}

.save-filter-details summary {
  cursor: pointer;
  font-weight: 600;
}

.save-filter-details .filters {
  margin-top: 8px;
}

/* Overdue task row */
.task-overdue td:first-child {
  color: var(--accent);
  font-weight: 600;
}

/* Danger zone (destructive actions) */
.danger-zone {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Color dot (tags) */
.color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  vertical-align: -2px;
}

/* Editable row lists (pipeline stages, order items) */
.stage-list,
.item-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.stage-row,
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stage-row input[type=text],
.item-row input[type=text] {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--field-bg, var(--surface-elevated));
  color: var(--field-text, var(--ink));
}

.item-row input[type=number] {
  width: 110px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--field-bg, var(--surface-elevated));
  color: var(--field-text, var(--ink));
}

.stage-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.order-total {
  font-size: 14px;
  color: var(--ink);
}

.invalid-json {
  border-color: var(--accent) !important;
}

.kanban-column-summary {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

/* Spellcheck highlight overlay (composer) */
.spellcheck-wrap {
  position: relative;
  width: 100%;
}

/* Espelha .composer textarea (casca final: bloco WhatsApp, linha ~3169) para
   alinhamento pixel-perfeito: mesmo padding 9px 12px, border 0, radius 8px,
   font-size 15px e fonte herdada (textarea usa "font: inherit" do reset). */
.spellcheck-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 0 solid transparent;
  border-radius: 8px;
  background: var(--chatforce-panel);
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.spellcheck-highlights {
  color: transparent;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.spellcheck-highlights mark {
  color: transparent;
  background: transparent;
  border-radius: 2px;
  text-decoration-skip-ink: none;
}

.spellcheck-highlights .spell-err {
  text-decoration: underline wavy var(--accent);
}

.spellcheck-highlights .grammar-err {
  text-decoration: underline wavy #d97706;
}

.composer .spellcheck-wrap textarea {
  position: relative;
  background: transparent;
  box-shadow: none;
}

.spell-popover {
  position: absolute;
  z-index: 40;
  pointer-events: auto;
  min-width: 180px;
  max-width: 280px;
  padding: 8px;
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 12px;
}

.spell-popover .spell-popover-message {
  margin: 0 0 6px;
  color: var(--chatforce-muted);
  font-size: 12px;
}

.spell-popover .spell-suggestion {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--chatforce-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.spell-popover .spell-suggestion:hover {
  background: var(--chatforce-panel-3);
}

.spell-popover .spell-ignore {
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--chatforce-muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

/* Fix: altura do chat — permite que a área de mensagens encolha e role internamente */
.chat-panel {
  min-height: 0;
}

.messages {
  min-height: 0;
}

/* Melhorias ChatForce — cores padronizadas das bolhas */
.bubble.outbound {
  background: #22c55e;
  color: #fff;
}
.bubble.outbound small {
  color: rgba(255, 255, 255, 0.8);
}
.bubble.private,
.bubble.internal {
  background: #facc15;
  color: #111;
}
.bubble.private small,
.bubble.internal small {
  color: #4b5563;
}
.bubble.inbound {
  background: var(--chatforce-bubble-inbound, #fff);
  color: var(--chatforce-text);
}
.bubble.system {
  background: #3b82f6;
  color: #fff;
}
.bubble.system small {
  color: rgba(255, 255, 255, 0.8);
}
.bubble.agent {
  background: #7c3aed;
  color: #fff;
}
.dark .bubble.agent {
  background: #8b5cf6;
}
.bubble.agent small {
  color: rgba(255, 255, 255, 0.8);
}

/* Avatar do remetente nas mensagens */
.message-sender {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
}
.message-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-500, #6366f1), var(--brand-600, #4f46e5));
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.bubble.outbound .message-avatar,
.bubble.system .message-avatar,
.bubble.agent .message-avatar {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Cor por contato também no avatar do remetente (mesma paleta dos avatares
   da lista). Sem isto o avatar herdava fundo claro com texto branco. O prefixo
   .message-sender garante a precedência sobre a regra das bolhas coloridas. */
.message-sender .message-avatar.avatar-tone-0 { background: linear-gradient(135deg, #34d399, #047857); color: #ffffff; }
.message-sender .message-avatar.avatar-tone-1 { background: linear-gradient(135deg, #2dd4bf, #0f766e); color: #ffffff; }
.message-sender .message-avatar.avatar-tone-2 { background: linear-gradient(135deg, #a78bfa, #6d28d9); color: #ffffff; }
.message-sender .message-avatar.avatar-tone-3 { background: linear-gradient(135deg, #f87171, #b91c1c); color: #ffffff; }
.message-sender .message-avatar.avatar-tone-4 { background: linear-gradient(135deg, #60a5fa, #1d4ed8); color: #ffffff; }
.message-sender .message-avatar.avatar-tone-5 { background: linear-gradient(135deg, #fbbf24, #b45309); color: #ffffff; }

/* Selo do remetente sobre o avatar, no histórico */
.message-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}

.message-seal {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, var(--sc1, #ffe9a8), var(--sc2, #e0a531) 60%, var(--sc3, #b8860b));
  color: #3b2a06;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  border: 2px solid var(--chatforce-panel, #ffffff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

/* Assinatura por caixa */
.message-signature {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
}

/* Citação de mensagem respondida */
.message-reply {
  padding: 6px 10px;
  margin-bottom: 6px;
  border-left: 3px solid var(--brand-500);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  font-size: 12px;
  opacity: 0.9;
}
.bubble.outbound .message-reply {
  background: rgba(0, 0, 0, 0.08);
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--surface-elevated);
  border-radius: 6px;
  font-size: 12px;
}
.reply-message-btn {
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 11px;
  background: transparent;
  border: 0;
  color: var(--brand-500);
  cursor: pointer;
}

/* Dentro de bolhas coloridas a cor de marca pode sumir no fundo;
   herda a cor do texto da bolha para permanecer legível. */
.bubble .reply-message-btn {
  color: inherit;
  opacity: 0.78;
}

.bubble .reply-message-btn:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Colapsar/expandir colunas da conversa */
.chat-layout.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}
.chat-layout.context-collapsed .context-panel {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}
.chat-layout.sidebar-collapsed .chat-panel,
.chat-layout.context-collapsed .chat-panel {
  flex: 1 1 auto;
}
.sidebar-toggle,
.context-panel-toggle {
  cursor: pointer;
}

.emoji-picker {
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
}
.emoji-picker .emoji-search {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.emoji-picker .emoji-category {
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.emoji-picker .emoji-option {
  width: 32px;
  height: 32px;
  font-size: 18px;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 4px;
}
.emoji-picker .emoji-option:hover {
  background: var(--surface-elevated);
}

.context-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.context-list li {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.context-list li:last-child {
  border-bottom: 0;
}
.context-list a {
  font-weight: 600;
  color: var(--brand-600);
}
.context-list small {
  color: var(--muted);
  font-size: 12px;
}

:root.skin-chatforce.dark .context-list a {
  color: var(--brand-400);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-bar > div:not(.filter-bar-actions) {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.filter-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.filter-bar input[type="search"],
.filter-bar input[type="text"],
.filter-bar input[type="date"] {
  padding: 6px 8px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 6px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}
.filter-bar select {
  min-width: 200px;
  padding: 6px 8px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 6px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}
.filter-bar-actions {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}
.conversation-list > .filter-bar {
  padding-left: 24px;
  padding-right: 24px;
}

.agenda-page {
  margin-top: 4px;
}

@media (max-width: 640px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar select,
  .filter-bar label {
    min-width: 0;
    width: 100%;
  }
}

.kanban-card {
  cursor: grab;
}
.kanban-card.dragging {
  opacity: 0.5;
}
.kanban-dropzone {
  min-height: 80px;
}
.kanban-dropzone.drag-over {
  background: rgba(99, 102, 241, 0.08);
  border-radius: 8px;
}
.kanban-column h3 {
  border-left: 4px solid;
  padding-left: 8px;
}

/* Canned responses dropdown */
.canned-wrapper { position: relative; }
.canned-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-height: 260px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.canned-picker input {
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  outline: none;
}
.canned-picker ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
}
.canned-picker li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
}
.canned-picker li:hover,
.canned-picker li.active {
  background: var(--surface-hover);
}
.canned-picker li.empty {
  cursor: default;
  color: var(--muted);
}
.canned-picker li strong {
  color: var(--brand-600);
  margin-right: 4px;
}

/* ==========================================================================
   Painéis recolhíveis — sidebar contextual (2ª coluna) e painel de contexto
   ========================================================================== */
:root {
  --sidebar-collapsed-width: 64px;
}

/* --- Sidebar contextual --- */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-filters,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-new-link,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-label {
  display: none;
}

.sidebar.collapsed .sidebar-nav {
  padding: 8px 6px;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  gap: 0;
  padding: 9px 0;
}

.sidebar.collapsed .nav-link.active {
  border-left: 0;
  margin-left: 0;
}

.sidebar.collapsed .sidebar-toggle {
  align-self: center;
  margin: 8px 0;
}

/* Estado recolhido já no primeiro paint, via classe no <html> aplicada pelo
   script do <head>. Sem isto, a 2ª coluna é renderizada expandida pelo servidor
   e só recolhe depois que o JS roda — causando o "salto" a cada recarregamento
   (e a cada troca de conversa, que hoje é um full reload).
   Espelha fielmente o estado final de `.sidebar.collapsed` (inclusive o bloco
   "Sidebar recolhida: mantém os sub-ícones" no fim do arquivo): apenas os
   RÓTULOS somem — ícones de filtros, seções, caixas e marcadores permanecem. */
@media (min-width: 1025px) {
  html.cf-sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  html.cf-sidebar-collapsed .sidebar .brand-text,
  html.cf-sidebar-collapsed .sidebar .brand-version,
  html.cf-sidebar-collapsed .sidebar .sidebar-header,
  html.cf-sidebar-collapsed .sidebar .sidebar-new-link,
  html.cf-sidebar-collapsed .sidebar .sidebar-footer,
  html.cf-sidebar-collapsed .sidebar .nav-label,
  html.cf-sidebar-collapsed .sidebar .nav-link span:last-child,
  html.cf-sidebar-collapsed .sidebar .sidebar-section-title,
  html.cf-sidebar-collapsed .sidebar .sidebar-filters a span,
  html.cf-sidebar-collapsed .sidebar .sidebar-list-item > span:last-child,
  html.cf-sidebar-collapsed .sidebar .sidebar-list-empty,
  html.cf-sidebar-collapsed .sidebar .sidebar-copy-btn,
  html.cf-sidebar-collapsed .sidebar .saved-filter-item .filter-option-delete {
    display: none;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-nav {
    padding: 8px 6px;
  }

  html.cf-sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    gap: 0;
    padding: 9px 0;
  }

  html.cf-sidebar-collapsed .sidebar .nav-link.active {
    border-left: 0;
    margin-left: 0;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-toggle {
    align-self: center;
    margin: 8px 0;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-toggle i {
    transform: rotate(180deg);
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-filters {
    display: flex;
    padding: 6px 6px;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-filters a {
    justify-content: center;
    gap: 0;
    padding: 7px 0;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-section {
    display: block;
    padding: 6px 6px;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-section-header {
    justify-content: center;
    padding: 4px 0 6px;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-list {
    align-items: center;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-list-item {
    justify-content: center;
    gap: 0;
    padding: 7px 0;
    width: 100%;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-list-icon {
    width: 18px;
    height: 18px;
  }

  html.cf-sidebar-collapsed .sidebar .sidebar-list-dot {
    width: 10px;
    height: 10px;
  }

  html.cf-sidebar-collapsed .sidebar .saved-filter-item,
  html.cf-sidebar-collapsed .sidebar .saved-filter-item .sidebar-list-item {
    width: 100%;
  }
}

@media (min-width: 1025px) {
  main.with-sidebar {
    transition: margin-left 0.25s ease;
  }

  html.cf-sidebar-collapsed main.with-sidebar {
    margin-left: calc(var(--rail-width) + var(--sidebar-collapsed-width));
  }
}

/* Transições entre páginas (cross-document View Transitions). A troca de
   conversa deixa de exibir o "flash" branco/quebra de layout e passa a ser uma
   transição suave. Navegadores sem suporte ignoram e seguem o comportamento
   atual. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.18s;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* --- Botões de recolher/expandir --- */
.sidebar-toggle,
.context-panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--chatforce-line);
  border-radius: 9px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease,
    transform 0.25s ease, right 0.25s ease;
}

.sidebar-toggle:hover,
.context-panel-toggle:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.sidebar-toggle i,
.context-panel-toggle i {
  font-size: 15px;
  line-height: 1;
  transition: transform 0.25s ease;
}

.sidebar.collapsed .sidebar-toggle {
  transform: none;
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* --- Painel de contexto (coluna direita do chat) --- */
.chatwoot-layout {
  position: relative;
  transition: grid-template-columns 0.25s ease;
}

.context-panel {
  transition: width 0.25s ease, padding 0.25s ease;
}

.context-panel-toggle {
  position: absolute;
  top: 50%;
  right: 286px;
  transform: translateY(-50%);
  z-index: 25;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.chatwoot-layout.context-collapsed .context-panel-toggle,
html.cf-context-collapsed .context-panel-toggle {
  right: 6px;
}

.chatwoot-layout.context-collapsed .context-panel-toggle i,
html.cf-context-collapsed .context-panel-toggle i {
  transform: rotate(180deg);
}

@media (min-width: 1181px) {
  .chatwoot-layout.context-collapsed,
  html.cf-context-collapsed .chatwoot-layout {
    grid-template-columns: 310px minmax(0, 1fr) 0px;
  }

  .chatwoot-layout.context-collapsed .context-panel,
  html.cf-context-collapsed .context-panel {
    width: 0;
    min-width: 0;
    padding: 0;
    border-left: 0;
    overflow: hidden;
  }
}

@media (max-width: 1180px) {
  .context-panel-toggle {
    display: none;
  }
}

/* ==========================================================================
   Botão de nova resposta rápida no balão do composer
   ========================================================================== */
.canned-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.canned-new-btn:hover {
  background: var(--surface-hover);
}

.canned-new-btn i {
  font-size: 13px;
}

/* ==========================================================================
   Seletor de emojis com abas de categorias
   ========================================================================== */
.emoji-picker {
  display: flex;
  flex-direction: column;
  width: 300px;
  max-height: min(340px, calc(100vh - 240px));
  padding: 0;
  overflow: hidden;
}

.emoji-picker .emoji-search {
  flex: 0 0 auto;
  width: auto;
  margin: 8px 8px 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  outline: none;
}

.emoji-picker-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 8px 8px 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.emoji-picker-tabs::-webkit-scrollbar {
  display: none;
}

.emoji-tab {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition: background 0.15s, opacity 0.15s;
}

.emoji-tab:hover {
  background: var(--surface-hover);
  opacity: 1;
}

.emoji-tab.active {
  background: color-mix(in srgb, var(--brand-500) 18%, transparent);
  opacity: 1;
}

.emoji-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 8px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-empty {
  display: block;
  padding: 16px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   Modal de nova resposta rápida
   ========================================================================== */
body.canned-modal-open {
  overflow: hidden;
}

.canned-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.canned-modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated, var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.canned-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.canned-modal-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.canned-modal-header .eyebrow {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.canned-modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.canned-modal-close:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.canned-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canned-modal-body > * {
  flex-shrink: 0;
}

.canned-modal-body > label,
.canned-modal-body .field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.canned-modal-body input:not([type="checkbox"]):not([type="radio"]),
.canned-modal-body select,
.canned-modal-body textarea {
  width: 100%;
  border: 1px solid var(--field-border, var(--border));
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.canned-modal-body input:not([type="checkbox"]):not([type="radio"]):focus,
.canned-modal-body select:focus,
.canned-modal-body textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.canned-modal-body .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.canned-modal-body .check-row input[type="checkbox"] {
  width: auto;
  flex: none;
}

.canned-modal-body .canned-modal-footer {
  position: sticky;
  bottom: -18px;
  margin: 0 -20px -18px;
}

.canned-modal-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
}

.canned-modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.canned-modal-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.canned-modal-field > span small {
  font-weight: 400;
}

.canned-modal-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.canned-modal-field input:focus {
  border-color: var(--brand-500);
}

.canned-modal-shortcut {
  display: flex;
  align-items: center;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  background: var(--field-bg, var(--surface));
  padding-left: 11px;
}

.canned-modal-shortcut:focus-within {
  border-color: var(--brand-500);
}

.canned-modal-shortcut .canned-modal-prefix {
  color: var(--muted);
  font-size: 13px;
}

.canned-modal-shortcut input {
  border: 0;
  background: transparent;
  padding-left: 4px;
  color: var(--field-text, var(--ink));
}

.canned-modal-editor {
  border: 1px solid var(--field-border, var(--line));
  border-radius: 12px;
  overflow: hidden;
  background: var(--field-bg, var(--surface));
}

.canned-modal-editor .formatting-toolbar {
  border-bottom: 1px solid var(--border);
}

.canned-modal-editor textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border: 0;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.canned-modal-panel {
  margin: 0 12px 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated, var(--surface));
}

.canned-chars-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  max-height: 140px;
  overflow-y: auto;
}

.canned-modal-panel.emoji-picker {
  display: flex;
  flex-direction: column;
  position: static;
  width: auto;
  max-height: min(320px, 45vh);
  padding: 0;
  overflow: hidden;
}

.canned-modal-panel.emoji-picker .emoji-grid {
  grid-template-columns: repeat(10, 1fr);
}

.canned-modal-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 12px;
}

.canned-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

/* ==========================================================================
   Comunicação interna (intercom) — inbox em duas colunas
   ========================================================================== */
.intercom-shell {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.intercom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
}

.intercom-header h1 {
  margin: 2px 0 0;
  font-size: 20px;
}

.intercom-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.intercom-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  height: calc(100vh - 210px);
  min-height: 380px;
  max-height: none;
}

.intercom-threads {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--surface);
}

.intercom-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.intercom-thread:hover {
  background: var(--soft);
}

.intercom-thread.active {
  background: var(--brand-50);
}

.dark .intercom-thread.active {
  background: color-mix(in srgb, var(--brand-500) 15%, transparent);
}

.intercom-thread-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--soft);
  color: var(--muted);
}

.intercom-thread-avatar .ph-bold {
  font-size: 16px;
}

.intercom-thread-copy {
  flex: 1;
  min-width: 0;
}

.intercom-thread-copy strong {
  display: block;
  font-size: 13px;
}

.intercom-thread-copy small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intercom-thread-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.intercom-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.intercom-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.intercom-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-elevated);
}

.intercom-panel-header strong {
  display: block;
  font-size: 14px;
}

.intercom-panel-header small {
  color: var(--muted);
  font-size: 12px;
}

.intercom-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.intercom-bubble {
  max-width: min(72%, 560px);
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-elevated);
}

.intercom-bubble.mine {
  align-self: flex-end;
  background: var(--bubble-outbound-bg);
  border-color: var(--bubble-outbound-bg);
  color: var(--bubble-outbound-text);
}

.intercom-bubble.theirs {
  align-self: flex-start;
}

.intercom-bubble-author {
  display: block;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 2px;
}

.intercom-bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.intercom-bubble small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.intercom-composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 24px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.intercom-composer textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-family: inherit;
}

.intercom-composer textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.intercom-empty {
  padding: 40px 24px;
}

@media (max-width: 860px) {
  .intercom-body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .intercom-threads {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .intercom-panel {
    min-height: 68vh;
  }

  .intercom-messages {
    max-height: none;
    padding: 20px 18px;
  }

  .intercom-header {
    padding: 16px 18px;
  }

  .intercom-composer {
    padding: 14px 18px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}

@media (max-height: 720px) {
  .intercom-body {
    height: auto;
    min-height: 0;
  }

  .intercom-messages {
    max-height: 60vh;
  }
}

/* Intercom — formatador, anexos e menção de conversa */
.intercom-composer {
  flex-direction: column;
  align-items: stretch;
}

.intercom-composer .formatting-toolbar {
  margin-bottom: 6px;
}

.intercom-bubble-body {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.intercom-bubble-body ul,
.intercom-bubble-body ol {
  margin: 4px 0;
  padding-left: 20px;
}

.intercom-mention {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.intercom-bubble.theirs .intercom-mention {
  background: var(--soft);
}

.intercom-mention:hover {
  text-decoration: underline;
}

.intercom-attachment-image {
  display: block;
  margin-top: 8px;
  max-width: 260px;
}

.intercom-attachment-image img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.intercom-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
}

.intercom-composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.intercom-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex: none;
}

.intercom-icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.intercom-mention-select {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-size: 13px;
}

.intercom-attachment-count {
  font-size: 12px;
  color: var(--muted);
}

/* Editar/excluir mensagens e conversas internas */
.intercom-panel-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.intercom-msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.intercom-msg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--chatforce-line, var(--line));
  border-radius: 7px;
  background: transparent;
  color: var(--chatforce-text-soft, var(--muted));
  font-size: 11.5px;
  cursor: pointer;
}

.intercom-msg-btn:hover {
  color: var(--chatforce-text, var(--ink));
  border-color: var(--chatforce-line-strong, var(--line-strong));
  background: var(--soft);
}

.intercom-msg-btn.danger {
  color: #dc2626;
  border-color: color-mix(in srgb, #dc2626 35%, var(--chatforce-line, var(--line)));
}

.intercom-msg-btn.danger:hover {
  background: color-mix(in srgb, #dc2626 12%, transparent);
}

.intercom-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.intercom-edit-form textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--field-border, var(--chatforce-line, var(--line)));
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  font-family: inherit;
}

.intercom-edit-form-actions {
  display: flex;
  gap: 8px;
}

/* Atendente responsável na lista de conversas (admin/monitor) */
.conversation-assignee {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--brand-600);
  font-weight: 600;
}

.conversation-assignee .ph-bold {
  font-size: 11px;
}

.dark .conversation-assignee {
  color: var(--brand-400);
}

/* Status de conversa conduzida por IA e pendente para IA */
.status-bot {
  background: #ede9fe;
  color: #5b21b6;
}

.dark .status-bot {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
}

.status-pending_ai {
  background: #fef3c7;
  color: #92400e;
}

.dark .status-pending_ai {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.status-dot-bot {
  background: #8b5cf6;
}

.status-dot-pending_ai {
  background: #f59e0b;
}

/* Ícone de ajuda com tooltip (modal de resolução) */
.info-tip {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

.info-tip:hover,
.info-tip:focus {
  color: var(--brand-600);
  outline: none;
}

/* Tooltip flutuante (JS) — não sofre clipping de containers com overflow */
.cf-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s, visibility 0.12s;
}

.cf-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.dark .cf-tooltip {
  background: #1f1f1f;
  color: #f3f4f6;
}

/* ==== Ajuda contextual, tour e onboarding ==== */
.page-help-button {
  flex: 0 0 auto;
}

.page-tour-button {
  flex: 0 0 auto;
}

.page-tour-button i {
  color: var(--brand-600);
}

.cf-tour-fab {
  bottom: 74px;
}

.help-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  justify-content: flex-end;
}

.help-drawer {
  width: min(420px, 92vw);
  height: 100%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: cf-slide-in 0.18s ease-out;
}

.help-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 25%, transparent);
}

.help-drawer-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

.help-drawer-body {
  padding: 20px;
  overflow-y: auto;
}

.help-drawer-body h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.help-drawer-body p {
  line-height: 1.6;
  color: var(--muted);
}

.help-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

@keyframes cf-slide-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.cf-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(15, 23, 42, 0.55);
}

.cf-tour-box {
  position: fixed;
  z-index: 10010;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--surface-elevated, var(--surface));
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

.dark .cf-tour-box {
  border-color: color-mix(in srgb, var(--ink) 25%, transparent);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.cf-tour-box h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.cf-tour-box p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.cf-tour-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-tour-progress {
  margin-right: auto;
  font-size: 12px;
  color: var(--muted);
}

.cf-tour-skip {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.cf-tour-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.cf-tour-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.cf-tour-highlight {
  position: relative;
  z-index: 10001;
  outline: 3px solid #ef4444;
  outline-offset: 2px;
  border-radius: 6px;
  animation: cf-tour-blink 0.9s steps(1, end) infinite;
}

/* Caixa aberta pelo tour (modal, popover ou painel) sobe acima do escurecimento. */
.cf-tour-elevate {
  z-index: 10005 !important;
}

@keyframes cf-tour-blink {
  0%,
  49% {
    outline-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.4);
  }
  50%,
  100% {
    outline-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.05);
  }
}

.cf-help-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9996;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--brand-600, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.cf-help-fab:hover,
.cf-help-fab:focus {
  filter: brightness(1.08);
  outline: none;
}

.cf-onboard-prompt {
  position: fixed;
  right: 20px;
  bottom: 78px;
  z-index: 9997;
  max-width: 320px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cf-onboard-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cf-onboard-copy span {
  font-size: 13px;
  color: var(--muted);
}

.cf-onboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cf-onboard-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .help-drawer { animation: none; }
  .cf-tooltip { transition: none; }
  .cf-tour-highlight { animation: none; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.4); }
}

/* ==== Central de Ajuda ==== */
.help-page {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.help-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin-top: 16px;
}

.help-nav {
  position: sticky;
  top: 16px;
  align-self: start;
}

.help-search {
  width: 100%;
  margin-bottom: 12px;
}

.help-search-empty {
  color: var(--muted);
  font-size: 13px;
}

.help-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}

.help-nav a:hover {
  background: color-mix(in srgb, var(--brand-500) 10%, transparent);
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.help-intro,
.help-section {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--muted) 20%, transparent);
  border-radius: 12px;
  padding: 20px 24px;
}

.help-intro h2,
.help-section h2 {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.help-intro p {
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 8px;
}

.help-item {
  padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--muted) 15%, transparent);
}

.help-item:first-of-type {
  border-top: none;
}

.help-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.help-item p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
  font-size: 14px;
}

.glossary-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.glossary-item dt {
  font-weight: 600;
}

.glossary-item dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.help-content kbd {
  background: color-mix(in srgb, var(--muted) 15%, transparent);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-nav {
    position: static;
  }

  .help-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.help-page-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.help-section-intro {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.help-steps-title {
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.help-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.help-tips {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.help-tips li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.help-tips li i {
  color: var(--brand-500);
  margin-top: 2px;
}

.help-tour-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.help-tour-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--muted) 20%, transparent);
  border-radius: 10px;
}

.help-tour-list li > i {
  font-size: 20px;
  color: var(--brand-600);
  flex: 0 0 auto;
}

.help-tour-list li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.help-tour-list li span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.help-map-group {
  margin-top: 16px;
}

.help-map-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 15px;
}

.help-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.help-map-list li {
  border-top: 1px solid color-mix(in srgb, var(--muted) 15%, transparent);
  padding-top: 8px;
}

.help-map-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.help-map-list a,
.help-map-title {
  font-weight: 600;
  color: var(--brand-600);
  text-decoration: none;
}

.help-map-title {
  color: var(--ink);
}

.help-map-list a:hover {
  text-decoration: underline;
}

.help-map-list span {
  display: block;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  margin-top: 2px;
}

.help-nav a.active {
  background: color-mix(in srgb, var(--brand-500) 14%, transparent);
  font-weight: 600;
}

.help-section-flash {
  animation: help-flash 1.4s ease-out;
}

@keyframes help-flash {
  0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 55%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.settings-card-help {
  margin: -4px 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ============================================================
   Conversation list — compact filter toolbar + mini modals
   ============================================================ */
.conversation-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 8px;
}

.conversation-tabs-row .conversation-tabs {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
}

.conversation-save {
  position: relative;
  display: flex;
  justify-content: flex-end;
  flex: none;
  padding: 0;
}

.conversation-filter-bar {
  position: relative;
  padding: 0 8px 8px;
}

.conversation-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--chatforce-line);
  border-radius: 999px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text-soft);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-chip:hover {
  color: var(--chatforce-text);
  background: var(--chatforce-panel-3);
}

.filter-chip.active {
  color: var(--chatforce-white);
  background: var(--chatforce-blue);
  border-color: var(--chatforce-blue);
}

.filter-chip i {
  font-size: 13px;
}

.filter-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--chatforce-blue);
  color: var(--chatforce-white);
  font-size: 9px;
  line-height: 1;
}

.filter-chip.active .filter-chip-count {
  background: var(--chatforce-white);
  color: var(--chatforce-blue);
}

.filter-popover {
  position: absolute;
  top: calc(100% - 4px);
  left: 8px;
  right: 8px;
  z-index: 45;
  max-height: min(72vh, 540px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--chatforce-line);
  border-radius: 10px;
  background: var(--surface-elevated, var(--chatforce-panel));
  box-shadow: var(--shadow-lg);
}

.filter-popover[hidden] {
  display: none !important;
}

.filter-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-popover-head strong {
  font-size: 12px;
  color: var(--chatforce-text);
}

.filter-popover-close {
  width: 22px;
  height: 22px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--chatforce-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.filter-popover-close:hover {
  background: var(--chatforce-panel-3);
  color: var(--chatforce-text);
}

.filter-popover-form {
  display: grid;
  gap: 8px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.filter-field > span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--chatforce-muted);
}

.filter-field select,
.filter-field input[type="text"] {
  width: 100%;
  height: 30px;
  min-width: 0;
  border: 1px solid var(--field-border, var(--chatforce-line));
  border-radius: 6px;
  background: var(--field-bg, var(--chatforce-panel-2));
  color: var(--field-text, var(--chatforce-text));
  font-size: 12px;
  padding: 0 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--chatforce-text);
  text-decoration: none;
  cursor: pointer;
}

.filter-option:hover {
  background: var(--chatforce-panel-2);
}

.filter-option input {
  margin: 0;
  accent-color: var(--chatforce-blue);
  flex: none;
}

.filter-option .status-dot {
  flex: none;
}

.filter-option i {
  font-size: 13px;
  color: var(--chatforce-muted);
}

.filter-option > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-popover-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.filter-popover-actions .secondary-button,
.filter-popover-actions button,
.filter-popover-actions a {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.filter-apply {
  background: var(--chatforce-blue);
  border-color: var(--chatforce-blue);
  color: var(--chatforce-white);
}

.filter-apply:hover {
  background: var(--chatforce-blue-soft);
  border-color: var(--chatforce-blue-soft);
  color: var(--chatforce-white);
}

.saved-filter-list {
  display: grid;
  gap: 2px;
}

.saved-filter-tag {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--chatforce-panel-3);
  color: var(--chatforce-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.saved-filter-item {
  display: flex;
  align-items: center;
  gap: 2px;
}

.saved-filter-item .filter-option,
.saved-filter-item .sidebar-list-item {
  flex: 1;
  min-width: 0;
}

.filter-option-delete {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--chatforce-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter-option-delete:hover {
  background: color-mix(in srgb, var(--accent, #dc2626) 15%, transparent);
  color: var(--accent, #dc2626);
}

.status-dot-bot {
  background: #8b5cf6;
}

.status-dot-pending_ai {
  background: #f59e0b;
}

.status-dot-all {
  background: transparent;
  border: 1px solid var(--chatforce-muted);
}

@media (max-width: 860px) {
  .filter-popover {
    left: 6px;
    right: 6px;
    max-height: 60vh;
  }
}

/* Channel picker (ícone + nome da plataforma) */
.stacked-form .field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.channel-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.channel-picker .channel-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.channel-picker .channel-option:hover {
  border-color: var(--line-strong);
}

.channel-picker .channel-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.channel-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
  background: var(--chatforce-panel-2, var(--soft));
  color: var(--brand-600, var(--chatforce-blue));
  font-size: 17px;
}

.channel-option-label {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-picker .channel-option.selected,
.channel-picker .channel-option:has(input:checked) {
  border-color: var(--brand-600, var(--chatforce-blue));
  background: color-mix(in srgb, var(--brand-500, var(--chatforce-blue)) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--brand-600, var(--chatforce-blue));
}

.channel-picker .channel-option:has(input:focus-visible) {
  outline: 2px solid var(--brand-600, var(--chatforce-blue));
  outline-offset: 2px;
}

/* Capacidades do canal (aba da caixa) */
.capability-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 10px;
}

.capability-row .check-row {
  padding: 0;
  border: 0;
  background: transparent;
}

/* Botão e modal de conta/setor */
.context-switcher {
  padding: 8px;
}

.context-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.context-button:hover {
  background: var(--chatforce-panel-3);
}

.context-button > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-button i {
  flex: none;
  color: var(--chatforce-muted);
}

.context-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 16px;
}

.context-modal[hidden] {
  display: none !important;
}

.context-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.context-modal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--chatforce-line);
  border-radius: 12px;
  background: var(--surface-elevated, var(--chatforce-panel));
  box-shadow: var(--shadow-lg);
}

.context-modal-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.context-modal-card > header strong {
  font-size: 13px;
}

/* Toggle da sidebar centralizado na divisória vertical */
.sidebar {
  overflow: visible;
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -15px;
  width: 30px;
  height: 30px;
  margin: 0;
  z-index: 60;
  transform: translateY(-50%);
  background: var(--chatforce-panel-2);
  border-color: var(--chatforce-line);
  color: var(--chatforce-text-soft);
}

.sidebar.collapsed .sidebar-toggle {
  transform: translateY(-50%) rotate(180deg);
}

/* Threads internas (intercom) misturadas na fila de conversas */
.conversation-item-internal .avatar-internal {
  background: color-mix(in srgb, var(--brand-500, var(--chatforce-blue)) 18%, transparent);
  color: var(--brand-600, var(--chatforce-blue));
  font-size: 15px;
}

.conversation-item-internal .item-copy {
  min-width: 0;
}

.conversation-item-internal .item-copy small {
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--chatforce-green, #16a34a);
  color: var(--chatforce-white);
  font-size: 10px;
  font-weight: 700;
}

/* Linhas de recurso no painel de contexto (com ações) */
.context-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Seções recolhíveis do painel de recursos da conversa */
.context-collapsible > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--chatforce-text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  list-style: none;
}

.context-collapsible > summary::-webkit-details-marker {
  display: none;
}

.context-collapsible > summary .context-collapsible-icon {
  flex: none;
  color: var(--brand-600, var(--chatforce-blue));
  font-size: 15px;
}

.context-collapsible > summary .context-collapsible-caret {
  margin-left: auto;
  flex: none;
  color: var(--chatforce-muted);
  font-size: 14px;
  transition: transform 0.2s ease;
}

.context-collapsible[open] > summary {
  margin-bottom: 12px;
}

.context-collapsible[open] > summary .context-collapsible-caret {
  transform: rotate(180deg);
}

.context-collapsible-meta {
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--chatforce-muted);
  background: var(--chatforce-panel-2);
  border-radius: 999px;
  padding: 1px 7px;
}

.context-collapsible-body {
  display: grid;
  gap: 8px;
}

.context-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* Modal genérico do painel de conversa */
.cf-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}

.cf-modal-overlay[hidden] {
  display: none !important;
}

.cf-modal-card {
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--chatforce-line);
  border-radius: 12px;
  background: var(--surface-elevated, var(--chatforce-panel));
  box-shadow: var(--shadow-lg);
}

.cf-modal-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.cf-modal-card > header strong {
  font-size: 13px;
}

/* Itens do pedido (modal de novo pedido) */
.order-items {
  display: grid;
  gap: 6px;
}

.order-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 82px 28px;
  gap: 6px;
  align-items: center;
}

.order-item-row input {
  min-width: 0;
}

/* Estado na fila de conversas: vermelho (não lida), âmbar (não respondida), verde (respondida).
   Cores fixas para valerem em qualquer tema/skin. */
:root {
  --state-unread: #dc2626;
  --state-unanswered: #f59e0b;
  --state-answered: #16a34a;
}

:root.dark {
  --state-unread: #ef4444;
  --state-unanswered: #fbbf24;
  --state-answered: #22c55e;
}

.conversation-flags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.conversation-elapsed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.conversation-elapsed i {
  font-size: 11px;
  opacity: 0.75;
}

.read-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: none;
}

.read-dot--unread {
  background: var(--state-unread);
}

.read-dot--unanswered {
  background: var(--state-unanswered);
}

.read-dot--answered {
  background: var(--state-answered);
}

.conversation-item.state-unread {
  border-left: 3px solid var(--state-unread);
  background: color-mix(in srgb, var(--state-unread) 15%, transparent);
}

.conversation-item.state-unread .item-copy strong {
  font-weight: 700;
}

.conversation-item.state-unanswered {
  border-left: 3px solid var(--state-unanswered);
  background: color-mix(in srgb, var(--state-unanswered) 15%, transparent);
}

.conversation-item.state-answered {
  border-left: 3px solid var(--state-answered);
  background: color-mix(in srgb, var(--state-answered) 10%, transparent);
}

.conversation-label--warn {
  border-color: color-mix(in srgb, var(--state-unanswered) 45%, transparent);
  color: #b45309;
  background: color-mix(in srgb, var(--state-unanswered) 12%, transparent);
}

.dark .conversation-label--warn {
  color: var(--state-unanswered);
}

/* Janela de 24h do WhatsApp: sinalizador verde (ok) */
.conversation-label--ok {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  color: #047857;
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

.dark .conversation-label--ok {
  color: var(--success);
}

.window-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--success) 45%, transparent);
  border-radius: 999px;
  color: #047857;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.window-badge i {
  font-size: 13px;
}

.dark .window-badge {
  color: var(--success);
}

@keyframes conversationNewBlink {
  0%,
  100% {
    background: color-mix(in srgb, var(--state-unread) 8%, transparent);
  }

  50% {
    background: color-mix(in srgb, var(--state-unread) 28%, transparent);
  }
}

.conversation-item--new {
  animation: conversationNewBlink 0.9s ease-in-out 4;
}

/* ============================================================
   Marcadores na fila de conversas
   ============================================================ */
.conversation-item-shell {
  position: relative;
}

.conversation-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

.conversation-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}

.conversation-tags:empty {
  display: none;
}

.conversation-tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 45%, transparent);
}

.dark .conversation-tag-chip {
  background: color-mix(in srgb, var(--tag-color) 24%, transparent);
  border-color: color-mix(in srgb, var(--tag-color) 62%, transparent);
  color: color-mix(in srgb, var(--tag-color) 72%, #fff);
}

.conversation-tag-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.conversation-tag-add:hover,
.conversation-tag-add:focus {
  color: var(--brand-600);
  border-color: var(--brand-600);
  background: color-mix(in srgb, var(--brand-600) 10%, transparent);
  outline: none;
}

.conversation-mark-unread {
  position: absolute;
  bottom: 8px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
  background: var(--surface-elevated);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 13px;
  opacity: 0.6;
  transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
}

.conversation-item-shell:hover .conversation-mark-unread,
.conversation-mark-unread:focus-visible {
  opacity: 1;
}

.conversation-mark-unread:hover,
.conversation-mark-unread:focus-visible {
  color: var(--brand-600);
  border-color: var(--brand-600);
  background: color-mix(in srgb, var(--brand-600) 10%, var(--surface-elevated));
  opacity: 1;
  outline: none;
}

.conversation-tag-popover {
  position: fixed;
  z-index: 1200;
  width: 230px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--muted) 25%, transparent);
  box-shadow: var(--shadow-lg);
}

.conversation-tag-popover-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.conversation-tag-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-tag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.conversation-tag-option:hover {
  background: color-mix(in srgb, var(--tag-color) 12%, transparent);
}

.conversation-tag-option:disabled {
  opacity: 0.6;
  cursor: progress;
}

.conversation-tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: none;
  background: var(--tag-color);
}

.conversation-tag-option-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-tag-option .ph-check {
  opacity: 0;
  color: var(--tag-color);
}

.conversation-tag-option.is-active {
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  font-weight: 600;
}

.conversation-tag-option.is-active .ph-check {
  opacity: 1;
}

.conversation-tag-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Destaque do card selecionado na fila de conversas
   ============================================================ */
.chatwoot-conversation-list .conversation-item.active,
.conversation-item.active {
  background: color-mix(in srgb, var(--brand-500) 14%, var(--chatforce-panel-3, var(--soft)));
  border-left: 4px solid var(--brand-600);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-600) 30%, transparent);
}

.chatwoot-conversation-list .conversation-item.active .item-copy strong,
.conversation-item.active .item-copy strong {
  color: var(--brand-600);
  font-weight: 700;
}

.dark .chatwoot-conversation-list .conversation-item.active,
.dark .conversation-item.active {
  background: color-mix(in srgb, var(--brand-500) 24%, var(--chatforce-panel-3, #334155));
  border-left-color: var(--brand-500);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 42%, transparent);
}

.dark .chatwoot-conversation-list .conversation-item.active .item-copy strong,
.dark .conversation-item.active .item-copy strong {
  color: var(--brand-500);
}

/* ============================================================
   Contraste dos cards da fila de conversas
   ============================================================ */
.chatwoot-conversation-list {
  background: var(--chatforce-panel-2);
}

.chatwoot-conversation-list .conversation-item {
  border-bottom: 1px solid color-mix(in srgb, var(--chatforce-line) 55%, var(--chatforce-muted));
}

.chatwoot-conversation-list .conversation-item:hover:not(.active) {
  background: var(--chatforce-panel-3);
}

.dark .chatwoot-conversation-list .conversation-item:hover:not(.active) {
  background: var(--chatforce-panel-2);
}

/* ============================================================
   Sidebar recolhida: mantém os sub-ícones (filtros, caixas, marcadores)
   ============================================================ */
.sidebar-filters a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-filters a i {
  flex: none;
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.sidebar.collapsed .sidebar-filters {
  display: flex;
  padding: 6px 6px;
}

.sidebar.collapsed .sidebar-filters a {
  justify-content: center;
  gap: 0;
  padding: 7px 0;
}

.sidebar.collapsed .sidebar-filters a span {
  display: none;
}

.sidebar.collapsed .sidebar-section {
  display: block;
  padding: 6px 6px;
}

.sidebar.collapsed .sidebar-section-header {
  justify-content: center;
  padding: 4px 0 6px;
}

.sidebar.collapsed .sidebar-section-title {
  display: none;
}

.sidebar.collapsed .sidebar-list {
  align-items: center;
}

.sidebar.collapsed .sidebar-list-item {
  justify-content: center;
  gap: 0;
  padding: 7px 0;
  width: 100%;
}

.sidebar.collapsed .sidebar-list-item > span:last-child {
  display: none;
}

.sidebar.collapsed .sidebar-list-icon {
  width: 18px;
  height: 18px;
}

.sidebar.collapsed .sidebar-list-dot {
  width: 10px;
  height: 10px;
}

.sidebar.collapsed .sidebar-list-empty,
.sidebar.collapsed .saved-filter-item .filter-option-delete {
  display: none;
}

.sidebar.collapsed .saved-filter-item,
.sidebar.collapsed .saved-filter-item .sidebar-list-item {
  width: 100%;
}

/* ============================================================
   Builder de ações de macro
   ============================================================ */
.macro-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.macro-action-row {
  display: grid;
  grid-template-columns: auto minmax(150px, 210px) 1fr auto;
  gap: 8px;
  align-items: start;
}

.macro-action-reorder {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.macro-action-reorder button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 15px;
  padding: 0;
  border: 1px solid var(--chatforce-line);
  border-radius: 4px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-muted);
  cursor: pointer;
}

.macro-action-reorder button:disabled {
  opacity: 0.35;
  cursor: default;
}

.macro-action-value > * {
  display: none;
}

.macro-action-row[data-type="send_message"] .macro-action-body,
.macro-action-row[data-type="add_note"] .macro-action-body,
.macro-action-row[data-type="add_tag"] .macro-action-tag,
.macro-action-row[data-type="remove_tag"] .macro-action-tag,
.macro-action-row[data-type="assign_to_user"] .macro-action-user,
.macro-action-row[data-type="assign_team"] .macro-action-team,
.macro-action-row[data-type="set_status"] .macro-action-status,
.macro-action-row[data-type="set_priority"] .macro-action-priority,
.macro-action-row[data-type="snooze"] .macro-action-hours {
  display: block;
}

.macro-action-remove {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--chatforce-line);
  border-radius: 6px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-muted);
  cursor: pointer;
}

.macro-action-remove:hover {
  color: var(--chatforce-danger, #dc2626);
  border-color: color-mix(in srgb, var(--chatforce-danger, #dc2626) 45%, transparent);
}

@media (max-width: 700px) {
  .macro-action-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Macros no painel de recursos da conversa
   ============================================================ */
.macro-quick-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.macro-quick-list form {
  margin: 0;
}

.macro-quick-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
  background: var(--chatforce-panel-2);
  color: var(--chatforce-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.macro-quick-item:hover {
  background: var(--chatforce-panel-3);
  border-color: color-mix(in srgb, var(--brand-500) 45%, transparent);
}

.macro-quick-item > i {
  grid-row: 1 / span 2;
  color: var(--brand-600);
  font-size: 16px;
}

.macro-quick-name {
  font-size: 13px;
  font-weight: 600;
}

.macro-quick-item small {
  grid-column: 2;
  color: var(--chatforce-muted);
  font-size: 11px;
  line-height: 1.3;
}

/* Anexo por ação (macro/automação) */
.macro-action-file {
  display: none;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--chatforce-muted);
}

.macro-action-row[data-type="send_message"] .macro-action-file,
.macro-action-row[data-type="add_note"] .macro-action-file {
  display: flex;
}

.macro-action-file small {
  color: var(--chatforce-text-soft);
}

/* Modal de confirmação de macro */
.macro-confirm-actions {
  list-style: disc;
  margin: 8px 0 4px 20px;
  padding: 0;
  color: var(--chatforce-text-soft);
  font-size: 13px;
  line-height: 1.6;
}

/* Automações: condições e ações específicas */
.automation-conditions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.automation-condition-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(130px, 190px) 1fr auto;
  gap: 8px;
  align-items: center;
}

.macro-action-row[data-type="assign_user"] .macro-action-user,
.macro-action-row[data-type="notify_user"] .macro-action-user,
.macro-action-row[data-type="run_agent"] .macro-action-agent,
.macro-action-row[data-type="create_task"] .macro-action-task-title,
.macro-action-row[data-type="create_task"] .macro-action-hours,
.macro-action-row[data-type="update_opportunity_status"] .macro-action-status {
  display: block;
}

@media (max-width: 700px) {
  .automation-condition-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Kanban: header fixo, largura das colunas e rolagem no topo
   ============================================================ */
.kanban-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-left: -24px;
  margin-right: -24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.kanban-width-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.kanban-width-control select {
  border: 1px solid var(--field-border, var(--line));
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--field-bg, var(--surface));
  color: var(--field-text, var(--ink));
}

.kanban-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  margin: 0 24px 6px;
}

.kanban-scroll-top > div {
  height: 1px;
}

.kanban.kanban--sm .kanban-column {
  min-width: 200px;
  max-width: 230px;
}

.kanban.kanban--md .kanban-column {
  min-width: 240px;
  max-width: 270px;
}

.kanban.kanban--lg .kanban-column {
  min-width: 280px;
  max-width: 320px;
}

/* ============================================================
   BOLHAS DE MENSAGEM — PADRÃO FIXO POR TIPO DE MENSAGEM
   As cores abaixo são fixas e NÃO podem ser alteradas por skin,
   com UMA exceção: o skin ChatForce (identidade oficial), cuja
   paleta legada está no bloco "EXCEÇÃO — BOLHAS NO SKIN
   CHATFORCE", no fim deste arquivo.
   Regra do produto documentada em ChatForce-2.0-Projeto-Completo.md (§4)
   e em AGENTS.md.
   ============================================================ */
:root {
  --bubble-inbound-bg: #eef0f2;
  --bubble-inbound-text: #111827;
  --bubble-outbound-bg: #2563eb;
  --bubble-outbound-text: #ffffff;
  --bubble-agent-bg: #7c3aed;
  --bubble-agent-text: #ffffff;
  --bubble-system-bg: #475569;
  --bubble-system-text: #ffffff;
  --bubble-internal-bg: #fef3c7;
  --bubble-internal-text: #111111;
  --bubble-internal-border: #fde047;
  --bubble-audio-bg: #e9edf2;
  --bubble-audio-text: #111827;
}

.dark {
  --bubble-inbound-bg: #1f1f1f;
  --bubble-inbound-text: #e5e5e5;
  --bubble-outbound-bg: #3b82f6;
  --bubble-outbound-text: #ffffff;
  --bubble-agent-bg: #8b5cf6;
  --bubble-agent-text: #ffffff;
  --bubble-system-bg: #334155;
  --bubble-system-text: #f1f5f9;
  --bubble-internal-bg: #facc15;
  --bubble-internal-text: #111111;
  --bubble-internal-border: #eab308;
  --bubble-audio-bg: #2a2f36;
  --bubble-audio-text: #e5e5e5;
}

.bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow);
}

.bubble.inbound {
  align-self: flex-start;
  background: var(--bubble-inbound-bg);
  color: var(--bubble-inbound-text);
  border-bottom-left-radius: 4px;
}

.bubble.outbound {
  align-self: flex-end;
  background: var(--bubble-outbound-bg);
  color: var(--bubble-outbound-text);
  border-bottom-right-radius: 4px;
}

.bubble.agent {
  align-self: flex-end;
  background: var(--bubble-agent-bg);
  color: var(--bubble-agent-text);
  border-bottom-right-radius: 4px;
}

.bubble.system {
  align-self: center;
  background: var(--bubble-system-bg);
  color: var(--bubble-system-text);
  border-radius: 999px;
}

.bubble.internal,
.bubble.private {
  align-self: flex-end;
  background: var(--bubble-internal-bg);
  color: var(--bubble-internal-text);
  border: 1px solid var(--bubble-internal-border);
  border-radius: 12px;
  border-bottom-right-radius: 4px;
}

.bubble small,
.bubble.outbound small,
.bubble.agent small,
.bubble.system small,
.bubble.internal small,
.bubble.private small {
  color: inherit;
  opacity: 0.8;
}

/* Barra superior do compositor: destino + legenda na mesma linha (economiza altura) */
.composer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 0 16px;
  border-bottom: 1px solid var(--chatforce-line);
}

.composer-topbar .composer-tabs {
  height: 33px;
  padding: 0;
  border-bottom: none;
}

/* Legenda das cores das bolhas no topo do compositor (alinhada à direita) */
.composer-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 2px 8px;
  font-size: 11px;
  color: var(--chatforce-muted);
}

.composer-topbar .composer-legend {
  padding: 0;
}

.composer-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.composer-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--chatforce-muted) 55%, transparent);
}

.composer-legend .lg-inbound { background: var(--bubble-inbound-bg); }
.composer-legend .lg-outbound { background: var(--bubble-outbound-bg); }
.composer-legend .lg-agent { background: var(--bubble-agent-bg); }
.composer-legend .lg-system { background: var(--bubble-system-bg); }
.composer-legend .lg-internal { background: var(--bubble-internal-bg); }

/* ============================================================
   EXCEÇÃO — BOLHAS NO SKIN CHATFORCE (identidade oficial)
   Referência: app legado (enviada vinho; recebida discreta —
   cinza translúcido no escuro e sem bolha no claro).
   Somente o skin ChatForce usa esta paleta. As demais skins
   mantêm o padrão fixo por tipo definido acima. Regra do produto
   documentada em AGENTS.md e em
   ChatForce-2.0-Projeto-Completo.md §4.1.1.
   ============================================================ */
:root.skin-chatforce {
  --bubble-inbound-bg: transparent;
  --bubble-inbound-text: var(--chatforce-text);
  --bubble-outbound-bg: #fbe4e4;
  --bubble-outbound-text: #7f1d1d;
  --bubble-outbound-border: #f3baba;
}

:root.skin-chatforce.dark {
  --bubble-inbound-bg: rgb(255 255 255 / 0.13);
  --bubble-inbound-text: #f2f2f2;
  --bubble-outbound-bg: #431c1c;
  --bubble-outbound-text: #f6e7e7;
  --bubble-outbound-border: #6b2b2b;
}

/* A bolha vira casca transparente; o fundo fica no .bubble-card,
   deixando remetente e horário fora da área colorida. */
:root.skin-chatforce .bubble {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  max-width: min(62%, 560px);
}

:root.skin-chatforce .bubble .bubble-card {
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: none;
}

:root.skin-chatforce .bubble.outbound .bubble-card {
  background: var(--bubble-outbound-bg);
  border-color: var(--bubble-outbound-border);
  color: var(--bubble-outbound-text);
  border-bottom-right-radius: 4px;
}

:root.skin-chatforce .bubble.agent .bubble-card {
  background: var(--bubble-agent-bg);
  color: var(--bubble-agent-text);
  border-bottom-right-radius: 4px;
}

:root.skin-chatforce .bubble.system .bubble-card {
  background: var(--bubble-system-bg);
  color: var(--bubble-system-text);
  border-radius: 999px;
  padding: 8px 14px;
}

:root.skin-chatforce .bubble.internal .bubble-card,
:root.skin-chatforce .bubble.private .bubble-card {
  background: var(--bubble-internal-bg);
  color: var(--bubble-internal-text);
  border-color: var(--bubble-internal-border);
  border-bottom-right-radius: 4px;
}

/* Recebida: sem bolha no tema claro; cinza translúcido no escuro
   (o preto total não dava destaque suficiente). */
:root.skin-chatforce .bubble.inbound {
  background: transparent;
  color: var(--bubble-inbound-text);
  padding: 0;
  box-shadow: none;
}

:root.skin-chatforce .bubble.inbound .bubble-card {
  background: var(--bubble-inbound-bg);
  border: 0;
  padding: 0;
}

:root.skin-chatforce.dark .bubble.inbound .bubble-card {
  padding: 10px 13px;
  border-radius: 10px;
  border-bottom-left-radius: 4px;
}

/* Horário/status abaixo da mensagem, discreto */
:root.skin-chatforce .bubble small,
:root.skin-chatforce .bubble.outbound small,
:root.skin-chatforce .bubble.agent small,
:root.skin-chatforce .bubble.system small,
:root.skin-chatforce .bubble.internal small,
:root.skin-chatforce .bubble.private small {
  display: block;
  float: none;
  margin: 6px 0 0;
  padding: 0 4px;
  font-size: 10.5px;
  color: var(--chatforce-muted);
  opacity: 1;
  text-align: left;
}

:root.skin-chatforce .bubble.outbound small,
:root.skin-chatforce .bubble.agent small,
:root.skin-chatforce .bubble.internal small,
:root.skin-chatforce .bubble.private small {
  text-align: right;
}

/* Remetente acima da mensagem, com avatar colorido por contato */
:root.skin-chatforce .message-sender {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 6px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--chatforce-text-soft);
}

:root.skin-chatforce .bubble.outbound .message-sender {
  justify-content: flex-end;
}

:root.skin-chatforce .message-avatar {
  width: 20px;
  height: 20px;
  font-size: 9px;
  border-radius: 50%;
}

:root.skin-chatforce .message-signature {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--chatforce-text-soft);
}

/* Selo de canal nas mensagens: vazado, ao lado do nome */
:root.skin-chatforce .channel-badge {
  border-radius: 5px;
  margin: 0 0 6px;
  vertical-align: middle;
}

:root.skin-chatforce .channel-badge.whatsapp {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--cf-tag-whatsapp) 60%, transparent);
  color: var(--cf-tag-whatsapp);
}

:root.skin-chatforce .channel-badge.instagram {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--cf-tag-instagram) 60%, transparent);
  color: var(--cf-tag-instagram);
}

:root.skin-chatforce .channel-badge.messenger {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--cf-tag-messenger) 60%, transparent);
  color: var(--cf-tag-messenger);
}

/* Nota interna: rótulo acima do bloco amarelo */
:root.skin-chatforce .internal-label {
  font-size: 11px;
  color: var(--bubble-internal-text);
}

:root.skin-chatforce.dark .internal-label {
  color: var(--bubble-internal-bg);
}

/* Anexo dentro da bolha enviada, em faixa translúcida */
:root.skin-chatforce .bubble.outbound .attachment-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgb(0 0 0 / 0.16);
  color: inherit;
  text-decoration: none;
}

:root.skin-chatforce:not(.dark) .bubble.outbound .attachment-link {
  background: rgb(255 255 255 / 0.45);
}

:root.skin-chatforce .bubble.outbound .attachment-link small {
  margin: 0;
  padding: 0;
  font-size: 10.5px;
  color: inherit;
  opacity: 0.75;
  text-align: left;
}

/* Citação de resposta dentro da bolha */
:root.skin-chatforce .message-reply {
  background: rgb(0 0 0 / 0.16);
  border-left-color: color-mix(in srgb, currentColor 45%, transparent);
}

:root.skin-chatforce:not(.dark) .message-reply {
  background: rgb(255 255 255 / 0.5);
}

:root.skin-chatforce .reply-message-btn {
  color: var(--chatforce-muted);
}

/* Legenda: "Recebida" sem bolha vira um contorno */
:root.skin-chatforce .composer-legend .lg-inbound {
  background: transparent;
}

/* Envio otimista: mensagem aparece na hora, antes da fila processar */
.bubble[data-pending="1"] {
  opacity: 0.72;
}

.bubble[data-pending="1"] [data-message-status] {
  opacity: 0.85;
}

.bubble.send-failed {
  opacity: 1;
}

.bubble.send-failed [data-message-status] {
  color: #ef4444;
  font-weight: 600;
}

/* Configurações de transcrição de áudio */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.settings-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.transcription-cloud {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.transcription-cloud summary {
  cursor: pointer;
  font-weight: 600;
}



.call-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:#4f46e5;margin-bottom:6px}
:root.dark .call-badge{color:#a5b4fc}

.call-detail-wrap{max-width:860px;margin:0 auto;padding:24px}
.call-detail{background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:24px;display:flex;flex-direction:column;gap:22px}
:root.dark .call-detail{background:#111827;border-color:#1f2937}
.call-detail-head{display:flex;align-items:center;gap:16px}
.call-detail-avatar{width:52px;height:52px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-size:24px;flex:0 0 auto}
.call-detail-avatar.is-inbound{background:#dcfce7;color:#16a34a}
.call-detail-avatar.is-outbound{background:#e0e7ff;color:#4f46e5}
:root.dark .call-detail-avatar.is-inbound{background:#052e16;color:#4ade80}
:root.dark .call-detail-avatar.is-outbound{background:#1e1b4b;color:#818cf8}
.call-detail-title{flex:1;min-width:0}
.call-detail-title h1{font-size:20px;margin:2px 0 6px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.call-detail-title h1 i{font-size:16px;opacity:.45}
.call-detail-meta{display:flex;gap:16px;flex-wrap:wrap;font-size:13px;color:#6b7280}
:root.dark .call-detail-meta{color:#9ca3af}
.call-detail-meta span{display:inline-flex;align-items:center;gap:6px}
.call-detail-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
.call-info{background:#f9fafb;border:1px solid #eef0f3;border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:4px}
:root.dark .call-info{background:#0b1220;border-color:#1f2937}
.call-info-label{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#9ca3af}
.call-info-value{font-size:14px;font-weight:600}
.call-detail-block h2{font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin:0 0 10px}
:root.dark .call-detail-block h2{color:#9ca3af}
.call-detail-notes{margin:0;font-size:14px;line-height:1.5}
.call-legs,.call-recordings{display:flex;flex-direction:column;gap:10px}
.call-leg{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#f9fafb;border:1px solid #eef0f3;border-radius:12px;padding:10px 14px}
:root.dark .call-leg{background:#0b1220;border-color:#1f2937}
.call-leg-user{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:600}
.call-leg-right{display:inline-flex;align-items:center;gap:10px;font-size:12px;color:#6b7280}
.call-recording{background:#f9fafb;border:1px solid #eef0f3;border-radius:12px;padding:12px 14px}
:root.dark .call-recording{background:#0b1220;border-color:#1f2937}
.call-recording-head{display:flex;align-items:center;justify-content:space-between;font-size:13px;font-weight:600;margin-bottom:10px}
.call-recording audio{width:100%}
.call-detail-actions{display:flex;gap:12px;flex-wrap:wrap;padding-top:14px;border-top:1px solid #eef0f3;align-items:center}
:root.dark .call-detail-actions{border-color:#1f2937}
.call-detail-actions .secondary-button:last-child{margin-left:auto}
.stacked-form .field-with-action{display:flex;gap:8px;align-items:stretch}
.stacked-form .field-with-action input{flex:1 1 auto;min-width:0}
.stacked-form .field-with-action .secondary-button{flex:0 0 auto;white-space:nowrap}

/* Seletor de cliente com busca (pedidos) */
.contact-picker { position: relative; }
.contact-picker-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--field-bg, var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
}
.contact-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--field-text, var(--ink));
  font: inherit;
  cursor: pointer;
}
.contact-picker-option:hover,
.contact-picker-option:focus,
.contact-picker-option[aria-selected=true] { background: var(--line); outline: none; }
.contact-picker-option small { display: block; color: var(--muted); font-size: 12px; }
.contact-picker-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* Linha do cliente na listagem de pedidos */
.order-customer { display: flex; flex-direction: column; line-height: 1.3; }
.order-customer small { color: var(--muted); font-size: 12px; }

/* ============================================================
   Contraste de botões de ação em tema escuro.
   No escuro os tokens de sucesso viram verdes claros; com texto
   branco o contraste fica baixo. Escurece o fundo mantendo o branco.
   ============================================================ */
:root.dark .send-button,
:root.dark .success-button,
:root.dark .resolve-button {
  background: #15803d;
  color: #ffffff;
}

:root.dark .send-button:hover,
:root.dark .success-button:hover,
:root.dark .resolve-button:hover {
  background: #166534;
}

/* WhatsApp (tema claro): o verde de sucesso é claro demais para texto branco */
:root.skin-whatsapp .send-button,
:root.skin-whatsapp .success-button {
  background: #15803d;
  color: #ffffff;
}

:root.skin-whatsapp .send-button:hover,
:root.skin-whatsapp .success-button:hover {
  background: #166534;
}

/* ChatForce claro: verde de sucesso é claro demais para texto branco */
:root.skin-chatforce:not(.dark) .send-button,
:root.skin-chatforce:not(.dark) .success-button,
:root.skin-chatforce:not(.dark) .resolve-button {
  background: #15803d;
  color: #ffffff;
}

:root.skin-chatforce:not(.dark) .send-button:hover,
:root.skin-chatforce:not(.dark) .success-button:hover,
:root.skin-chatforce:not(.dark) .resolve-button:hover {
  background: #166534;
}

/* Perigo em tema escuro: --accent vira um vermelho claro */
:root.dark .danger-button {
  background: #b91c1c;
  color: #ffffff;
}

:root.dark .danger-button:hover {
  background: #991b1b;
}

/* Info em black-white escuro: --info é azul claro */
:root.skin-black-white.dark .info-button {
  background: #1d4ed8;
  color: #ffffff;
}

:root.skin-black-white.dark .info-button:hover {
  background: #1e40af;
}

/* Chat: o conteúdo do balão é para selecionar/copiar; o arraste para
   responder começa pelo cabeçalho (avatar + nome). */
.bubble .bubble-card {
  cursor: text;
}

.bubble .message-sender {
  cursor: grab;
}

.bubble .message-sender:active {
  cursor: grabbing;
}

/* ============================================================
   Treinamento guiado
   ============================================================ */
.training-page {
  max-width: 960px;
  margin: 0 auto;
}

.training-header {
  align-items: flex-start;
}

.training-subtitle {
  margin: 6px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.training-progress {
  margin: 18px 0 22px;
  padding: 16px;
  border: 1px solid var(--chatforce-line);
  border-radius: 12px;
  background: var(--chatforce-panel, var(--surface));
}

.training-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
}

.training-progress-head span {
  color: var(--muted);
}

.training-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--chatforce-panel-3, rgba(148, 163, 184, 0.25));
  overflow: hidden;
}

.training-progress-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-500, #6366f1), var(--brand-600, #4f46e5));
  transition: width 0.4s ease;
}

.training-phases {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.training-phase {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--chatforce-line);
  border-radius: 12px;
  background: var(--chatforce-panel, var(--surface));
}

.training-phase-index {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chatforce-panel-3, rgba(148, 163, 184, 0.25));
  font-size: 13px;
  font-weight: 700;
}

.training-phase-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.training-phase-copy small {
  color: var(--muted);
  font-size: 12px;
}

.training-phase-count {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.training-phase.is-done {
  border-color: color-mix(in srgb, #10b981 45%, var(--chatforce-line));
}

.training-phase.is-clickable {
  cursor: pointer;
}

.training-phase.is-clickable:hover {
  border-color: var(--brand-500, #6366f1);
  background: var(--chatforce-panel-3, rgba(148, 163, 184, 0.12));
}

.training-phase.is-clickable:focus-visible {
  outline: 2px solid var(--brand-500, #6366f1);
  outline-offset: 2px;
}

.training-phase.is-locked {
  opacity: 0.6;
}

.training-phase.is-done .training-phase-index {
  background: #10b981;
  color: #fff;
}

.training-phase.is-current {
  border-color: var(--brand-500, #6366f1);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-500, #6366f1) 35%, transparent);
}

.training-phase.is-current .training-phase-index {
  background: var(--brand-500, #6366f1);
  color: #fff;
}

.training-phase.is-pending {
  border-color: color-mix(in srgb, #f59e0b 55%, var(--chatforce-line));
}

.training-phase.is-pending .training-phase-index {
  background: #f59e0b;
  color: #fff;
}

.training-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.training-reset {
  margin-top: 18px;
}

.training-complete {
  margin: 0 0 18px;
}

.training-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--chatforce-line));
  background: color-mix(in srgb, #f59e0b 12%, var(--chatforce-panel, var(--surface)));
}

.training-badge-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  font-size: 22px;
}

.training-badge strong {
  display: block;
  font-size: 15px;
}

.training-badge span {
  color: var(--muted);
  font-size: 12px;
}

/* Certificado — borda em degradê vermelho, miolo chumbo e selo dourado */
.training-certificate-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.certificate {
  position: relative;
  width: min(920px, 100%);
  padding: 8px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg,
    #8a6108 0%,
    #f5c542 16%,
    #fff6cf 30%,
    #e0a531 46%,
    #a9760a 60%,
    #f5c542 76%,
    #fff1bf 88%,
    #8a6108 100%);
  box-shadow:
    0 24px 60px -24px rgba(224, 165, 49, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Reflexo percorrendo a borda dourada */
.certificate::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg,
    transparent 32%,
    rgba(255, 255, 255, 0.85) 46%,
    rgba(255, 255, 255, 0.25) 52%,
    transparent 64%);
  transform: translateX(-130%);
  animation: cf-cert-shine 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cf-cert-shine {
  0%, 55% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

@media (prefers-reduced-motion: reduce) {
  .certificate::before { animation: none; }
}

.certificate-inner {
  position: relative;
  padding: 46px 54px;
  border-radius: 12px;
  border: 1px solid rgba(245, 197, 66, 0.35);
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(245, 197, 66, 0.14), transparent 55%),
    linear-gradient(180deg, #1a1e29, #12151d);
  color: #e5e7eb;
  text-align: center;
  overflow: hidden;
}

.certificate-inner::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(245, 197, 66, 0.22);
  border-radius: 8px;
  pointer-events: none;
}

.certificate-brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.certificate-logo-img {
  height: 52px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

.certificate-eyebrow {
  margin-top: 26px;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 11px;
  color: #f5c542;
}

.certificate-inner h1 {
  margin: 8px 0 22px;
  font-size: 30px;
  color: #ffffff;
}

.certificate-system {
  margin: -12px 0 18px;
  font-size: 13.5px;
  color: #cbd3e1;
}

.certificate-system strong {
  color: #f5c542;
}

.certificate-issuer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(245, 197, 66, 0.22);
  color: #9aa6b8;
  font-size: 12px;
}

.certificate-issuer-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: #f5c542;
}

.certificate-issuer strong {
  color: #ffffff;
  font-size: 13.5px;
}

.certificate-lead {
  margin: 6px 0;
  color: #9aa6b8;
  font-size: 14px;
}

.certificate-name {
  margin: 14px 0;
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(180deg, #ffe9a8, #f5c542 55%, #c9931f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.certificate-seal {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(245, 197, 66, 0.5);
  background: rgba(245, 197, 66, 0.08);
  color: #fadf8f;
  font-size: 14px;
}

.certificate-seal-medal {
  --seal-size: 46px;
}

.certificate-seal-label strong {
  color: #ffffff;
}

.certificate-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px dashed rgba(245, 197, 66, 0.35);
  color: #8b96a7;
  font-size: 12px;
}

.certificate-foot strong {
  color: #f5c542;
}

.certificate-actions {
  display: flex;
  gap: 10px;
}

/* Impressão do certificado: paisagem, sem margens/cabeçalho, igual à tela */
@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  body * { visibility: hidden !important; }

  .certificate,
  .certificate * { visibility: visible !important; }

  .certificate {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Sem o reflexo animado no papel */
  .certificate::before { display: none !important; }

  .certificate-inner {
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 64px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .certificate-actions,
  .cf-train-bar,
  .cf-train-modal,
  .app-rail,
  #sidebar,
  .cf-train-promo,
  .cf-tour-overlay,
  .cf-train-seal-toast { display: none !important; }
}

/* Selos de nível profissional */
.training-seals {
  margin: 0 0 22px;
}

.training-seals-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.seal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  border: 1px solid var(--chatforce-line);
  border-radius: 12px;
  background: var(--chatforce-panel, var(--surface));
  text-align: center;
}

.seal-card small {
  color: var(--muted);
  font-size: 11px;
}

/* Medalhas metálicas dos selos */
.seal-bronze { --seal-color: #c9772f; --sc1: #f3c79b; --sc2: #c9772f; --sc3: #6f3a10; }
.seal-prata { --seal-color: #9aa6b8; --sc1: #ffffff; --sc2: #b9c2cf; --sc3: #5f6b7c; }
.seal-ouro { --seal-color: #e0a531; --sc1: #fff2b8; --sc2: #e0a531; --sc3: #7c4e08; }
.seal-platina { --seal-color: #5ec8e6; --sc1: #eaffff; --sc2: #7fd6ee; --sc3: #1f6f88; }
.seal-diamante { --seal-color: #dc2626; --sc1: #ffd9d9; --sc2: #ef4444; --sc3: #7f1d1d; }

.seal-emblem,
.cf-train-seal-emblem,
.cf-train-promo-seal,
.certificate-seal-medal {
  --seal-size: 46px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--seal-size);
  height: var(--seal-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 46%),
    conic-gradient(from 210deg,
      var(--sc3, #7c4e08),
      var(--sc1, #fff2b8) 18%,
      var(--sc2, #e0a531) 38%,
      var(--sc3, #7c4e08) 52%,
      var(--sc1, #fff2b8) 70%,
      var(--sc2, #e0a531) 86%,
      var(--sc3, #7c4e08));
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.9),
    inset 0 -4px 7px rgba(0, 0, 0, 0.4),
    0 0 0 2px color-mix(in srgb, var(--sc3, #7c4e08) 62%, transparent),
    0 8px 16px -6px rgba(0, 0, 0, 0.6);
  isolation: isolate;
}

/* Aro serrilhado */
.seal-emblem::before,
.cf-train-seal-emblem::before,
.cf-train-promo-seal::before,
.certificate-seal-medal::before {
  content: '';
  position: absolute;
  inset: -13%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
    var(--sc2, #e0a531) 0deg 5deg,
    color-mix(in srgb, var(--sc3, #7c4e08) 85%, #000 0%) 5deg 10deg);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%);
  mask: radial-gradient(circle, transparent 60%, #000 61%);
  z-index: -1;
}

/* Disco interno escuro */
.seal-emblem::after,
.cf-train-seal-emblem::after,
.cf-train-promo-seal::after,
.certificate-seal-medal::after {
  content: '';
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.35), transparent 46%),
    linear-gradient(160deg, #2b3140, #141821);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), inset 0 -2px 4px rgba(0, 0, 0, 0.65);
  z-index: 1;
}

.seal-emblem i,
.cf-train-seal-emblem i,
.cf-train-promo-seal i,
.certificate-seal-medal i {
  position: relative;
  z-index: 2;
  font-size: calc(var(--seal-size) * 0.44);
  color: var(--sc1, #fff2b8);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
}

/* Selo ainda não conquistado */
.seal-card.is-locked .seal-emblem {
  filter: grayscale(0.9);
  opacity: 0.5;
}

.seal-card.is-earned .seal-emblem {
  filter: none;
  opacity: 1;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.9),
    inset 0 -4px 7px rgba(0, 0, 0, 0.4),
    0 0 0 2px color-mix(in srgb, var(--sc3, #7c4e08) 62%, transparent),
    0 0 18px -2px color-mix(in srgb, var(--seal-color, #f5c542) 55%, transparent),
    0 8px 16px -6px rgba(0, 0, 0, 0.6);
}

.seal-card.is-earned {
  border-color: color-mix(in srgb, var(--seal-color, #f5c542) 55%, var(--chatforce-line));
}

/* Selo no avatar (rail de perfil) */
.rail-profile-button {
  position: relative;
}

.rail-profile-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500, #6366f1), var(--brand-600, #4f46e5));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.rail-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-profile-avatar.seal-none {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.rail-seal-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, var(--sc1, #ffe9a8), var(--sc2, #e0a531) 60%, var(--sc3, #b8860b));
  color: #3b2a06;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  border: 2px solid var(--chatforce-panel, #111827);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

/* Banner de chamada para o treinamento */
.cf-train-promo {
  position: fixed;
  right: 20px;
  bottom: 78px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, #f59e0b 40%, var(--chatforce-line));
  background: linear-gradient(135deg, #1a1e29, #12151d);
  color: #e5e7eb;
  box-shadow: 0 18px 45px -18px rgba(0, 0, 0, 0.6);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cf-train-promo.is-open {
  transform: translateY(0);
  opacity: 1;
}

.cf-train-promo[hidden] {
  display: none;
}

.cf-train-promo-seal {
  --seal-size: 42px;
  flex: none;
}

.cf-train-promo-seal.seal-none {
  background: rgba(148, 163, 184, 0.25);
  color: #e5e7eb;
  filter: none;
  opacity: 1;
}

.cf-train-promo-seal.seal-none::before,
.cf-train-promo-seal.seal-none::after {
  display: none;
}

.cf-train-promo-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cf-train-promo-copy strong {
  font-size: 13.5px;
  color: #fff;
}

.cf-train-promo-copy span {
  font-size: 12px;
  line-height: 1.45;
  color: #9aa6b8;
}

.cf-train-promo-copy b {
  color: #f5c542;
}

.cf-train-promo-cta {
  flex: none;
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 9px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.cf-train-promo-close {
  flex: none;
  border: 0;
  background: transparent;
  color: #9aa6b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* Cartão de selo no perfil */
.profile-seal-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--seal-color, #f5c542) 45%, var(--chatforce-line));
  background: linear-gradient(135deg, #1a1e29, #12151d);
  color: #e5e7eb;
}

.profile-seal-avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chatforce-blue, #4f46e5);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--seal-color, #f5c542) 55%, transparent);
}

.profile-seal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-seal-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-seal-info strong {
  font-size: 15px;
  color: #fff;
}

.profile-seal-info span {
  font-size: 12.5px;
  color: #9aa6b8;
}

.profile-seal-info a {
  margin-top: 4px;
  align-self: flex-start;
  color: #f5c542;
  font-size: 12.5px;
  font-weight: 600;
}


/* Barra do motor de treinamento */
.cf-train-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 120%);
  z-index: 10020;
  width: min(880px, calc(100vw - 32px));
  border-radius: 14px;
  border: 1px solid var(--chatforce-line);
  background: var(--surface-elevated, var(--surface));
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform 0.35s ease;
}

.cf-train-bar.is-open {
  transform: translate(-50%, 0);
}

/* Quando o destaque está atrás da barra, ela sobe para o topo. */
.cf-train-bar.is-top {
  top: 18px;
  bottom: auto;
  transform: translate(-50%, -120%);
}

.cf-train-bar.is-top.is-open {
  transform: translate(-50%, 0);
}

.cf-train-progress {
  height: 5px;
  background: rgba(148, 163, 184, 0.25);
}

.cf-train-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6366f1, #22d3ee);
  transition: width 0.4s ease;
}

/* Pontos de navegação por passo */
.cf-train-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 12px;
}

.cf-train-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--chatforce-line);
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cf-train-dot:hover {
  transform: scale(1.3);
}

.cf-train-dot.is-done {
  background: color-mix(in srgb, var(--brand-500, #6366f1) 55%, transparent);
  border-color: transparent;
}

.cf-train-dot.is-active {
  background: var(--brand-500, #6366f1);
  border-color: var(--brand-600, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500, #6366f1) 30%, transparent);
}

.cf-train-body {
  padding: 14px 18px;
}

.cf-train-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cf-train-meta strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-500, #6366f1);
}

.cf-train-phase {
  font-size: 12px;
  color: var(--muted);
}

.cf-train-text {
  margin: 8px 0 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.cf-train-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-train-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
  background: var(--chatforce-panel-2, transparent);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}

.cf-train-btn:hover {
  background: var(--chatforce-panel-3, rgba(148, 163, 184, 0.15));
}

.cf-train-btn.is-off {
  color: var(--muted);
}

.cf-train-voice {
  padding: 7px 10px;
  border: 1px solid var(--chatforce-line);
  border-radius: 8px;
  background: var(--chatforce-panel-2, transparent);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  max-width: 190px;
}

.cf-train-exit {
  margin-left: auto;
}

/* Modal do questionário / conclusão */
.cf-train-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.6);
  overflow-y: auto;
}

.cf-train-card {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--chatforce-line);
  background: var(--surface-elevated, var(--surface));
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.cf-train-card h2 {
  margin: 4px 0 12px;
  font-size: 18px;
}

.cf-train-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.cf-train-quiz {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cf-train-q {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--chatforce-line);
  border-radius: 10px;
}

.cf-train-q legend {
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.cf-train-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.cf-train-opt:hover {
  background: var(--chatforce-panel-2, rgba(148, 163, 184, 0.1));
}

.cf-train-opt.is-correct {
  background: color-mix(in srgb, #10b981 16%, transparent);
  color: #047857;
}

.cf-train-opt.is-wrong {
  background: color-mix(in srgb, #ef4444 16%, transparent);
  color: #b91c1c;
}

.cf-train-why {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.cf-train-quiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cf-train-quiz-buttons {
  display: flex;
  gap: 8px;
}

.cf-train-quiz-progress {
  font-size: 12px;
  color: var(--muted);
}

.cf-train-medal {
  width: 68px;
  height: 68px;
  margin: 4px auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  font-size: 34px;
}

.cf-train-done {
  text-align: center;
}

.cf-train-done-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Comemoração de selo conquistado */
.cf-train-seal-toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translate(-50%, -24px);
  z-index: 10040;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--seal-color, #f5c542) 55%, transparent);
  background: linear-gradient(135deg, #1a1e29, #12151d);
  color: #e5e7eb;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  opacity: 0;
  animation: cf-seal-in 0.35s ease forwards;
}

.cf-train-seal-toast.is-out {
  animation: cf-seal-out 0.4s ease forwards;
}

.cf-train-seal-toast strong {
  display: block;
  color: #fff;
  font-size: 14px;
}

.cf-train-seal-toast span {
  font-size: 12.5px;
  color: #9aa6b8;
}

.cf-train-seal-toast b {
  color: var(--seal-color, #f5c542);
}

.cf-train-seal-emblem {
  --seal-size: 46px;
  flex: none;
}

@keyframes cf-seal-in {
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes cf-seal-out {
  to { transform: translate(-50%, -24px); opacity: 0; }
}


/* Conversa resolvida na fila: sem cor e esmaecida */
.conversation-item.conversation-item--resolved {
    opacity: .55;
    filter: grayscale(1);
    background: #f3f4f6;
}
.conversation-item.conversation-item--resolved:hover {
    opacity: .8;
}
.dark .conversation-item.conversation-item--resolved {
    background: rgba(148, 163, 184, .08);
}
