body {
  font-family: 'Nunito', sans-serif;
  background: #0B1120;
  background-image: radial-gradient(circle at 50% 0%, rgba(254, 161, 22, 0.08) 0%, transparent 70%);
  min-height: 100vh;
  color: #f3f4f6;
}
    .custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
    .custom-scrollbar::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
    .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(254, 161, 22, 0.5); border-radius: 10px; }
    .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: linear-gradient(to bottom, #ff8c00, #e67e00); }
    
    @keyframes fadeInUp {
      from { transform: translateY(30px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .animate-fadeInUp { animation: fadeInUp 0.6s ease-out; }

    /* Typing indicator da IA */
    @keyframes typingBounce {
      0%, 100% { transform: scale(0.85) translateY(0); opacity: 0.4; }
      50% { transform: scale(1.15) translateY(-5px); opacity: 1; filter: drop-shadow(0 0 1.5px rgba(255,255,255,0.7)); }
    }
    .typing-dot {
      animation: typingBounce 1.4s ease-in-out infinite;
    }
    .typing-dot:nth-child(2) { animation-delay: 0.2s; }
    .typing-dot:nth-child(3) { animation-delay: 0.4s; }
    @keyframes typingSlideIn {
      from { opacity: 0; transform: translateY(12px) scale(0.96); }
      to   { opacity: 1; transform: translateY(0)   scale(1);    }
    }
    @keyframes typingSlideOut {
      from { opacity: 1; transform: translateY(0)   scale(1);    }
      to   { opacity: 0; transform: translateY(8px)  scale(0.96); }
    }
    .typing-indicator-enter {
      animation: typingSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    .typing-indicator-exit {
      animation: typingSlideOut 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    
    .btn-primary {
      background: linear-gradient(135deg, #fea116 0%, #ff8c00 100%);
      box-shadow: 0 4px 15px rgba(254, 161, 22, 0.4);
      transition: all 0.3s;
    }
    .btn-primary:hover {
      box-shadow: 0 6px 25px rgba(254, 161, 22, 0.6);
      transform: translateY(-2px);
    }
    
    .card-dark {
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}
    
    .chat-bubble {
      animation: none;
      transition: all 0.3s;
    }
    .chat-bubble:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    
    /* Scrollbar personalizada mais elegante */
    .custom-scrollbar {
      scrollbar-width: thin;
      scrollbar-color: #fea116 rgba(15, 23, 43, 0.3);
    }
    
    /* Animação de entrada suave para mensagens */
    @keyframes slideInUp {
      from { transform: translateY(20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    /* Mensagens que chegam em tempo real (SSE/poll incremental) */
    .msg-enter {
      animation: slideInUp 0.28s ease-out;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: scale(0.95); }
      to { opacity: 1; transform: scale(1); }
    }
    .animate-fade-in {
      animation: fadeIn 0.2s ease-out forwards;
    }

    /* =====================================================
       INDICADOR DE CONEXÃO EM TEMPO REAL (SSE)
       ===================================================== */
    .sse-indicator {
      position: fixed;
      bottom: 16px;
      right: 16px;
      z-index: 9999;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px;
      border-radius: 9999px;
      font-size: 12px;
      font-weight: 700;
      color: #f3f4f6;
      background: rgba(15, 23, 43, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.12);
      backdrop-filter: blur(8px);
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
      transition: opacity 0.3s, transform 0.3s;
      pointer-events: none;
      user-select: none;
    }
    .sse-indicator .sse-dot {
      width: 8px;
      height: 8px;
      border-radius: 9999px;
      background: currentColor;
    }
    .sse-online { color: #34d399; }
    .sse-online .sse-dot { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: ssePulse 1.8s infinite; }
    .sse-reconnecting { color: #fbbf24; }
    .sse-reconnecting .sse-dot { animation: ssePulse 0.9s infinite; }
    .sse-offline { color: #f87171; }
    @keyframes ssePulse {
      0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
      70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
      100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
    }
    /* Online some sozinho para não poluir; reaparece em hover da tela */
    .sse-indicator.sse-online { opacity: 0.55; }
    .sse-indicator.sse-online:hover { opacity: 1; }
    
    /* Destaque no item selecionado */
    .chat-item-selected {
  background: rgba(254, 161, 22, 0.08) !important;
  border-left: 3px solid #fea116 !important;
}

    /* =====================================================
       MARKDOWN: Estilos para conteúdo renderizado
       ===================================================== */
    .chat-bubble p { margin: 0.35em 0; line-height: 1.65; }
    .chat-bubble > p:first-child { margin-top: 0; }
    .chat-bubble > p:last-child { margin-bottom: 0; }
    .chat-bubble h1, .chat-bubble h2, .chat-bubble h3,
    .chat-bubble h4, .chat-bubble h5, .chat-bubble h6 {
      font-weight: 700; margin: 0.6em 0 0.25em; line-height: 1.35;
    }
    .chat-bubble h1 { font-size: 1.35em; }
    .chat-bubble h2 { font-size: 1.2em; }
    .chat-bubble h3 { font-size: 1.1em; }
    .chat-bubble h4, .chat-bubble h5, .chat-bubble h6 { font-size: 1em; }
    .chat-bubble ul, .chat-bubble ol { margin: 0.4em 0; padding-left: 1.5em; }
    .chat-bubble ul { list-style-type: disc; }
    .chat-bubble ol { list-style-type: decimal; }
    .chat-bubble li { margin: 0.15em 0; line-height: 1.55; }
    .chat-bubble li > ul, .chat-bubble li > ol { margin: 0.15em 0; }
    .chat-bubble blockquote {
      border-left: 3px solid rgba(255,255,255,0.35);
      padding-left: 0.75em; margin: 0.5em 0;
      opacity: 0.9; font-style: italic;
    }
    .chat-bubble code {
      background: rgba(0,0,0,0.3); padding: 0.15em 0.4em;
      border-radius: 4px; font-family: 'Consolas','Courier New',monospace;
      font-size: 0.88em; word-break: break-word;
    }
    .chat-bubble pre {
      background: rgba(0,0,0,0.4); padding: 0.75em 1em;
      border-radius: 8px; overflow-x: auto; margin: 0.5em 0;
      max-width: 100%;
    }
    .chat-bubble pre code {
      background: transparent; padding: 0;
      font-size: 0.85em; line-height: 1.55;
      white-space: pre; word-break: normal;
    }
    .chat-bubble table { border-collapse: collapse; margin: 0.5em 0; width: 100%; font-size: 0.92em; }
    .chat-bubble th, .chat-bubble td {
      border: 1px solid rgba(255,255,255,0.2);
      padding: 0.35em 0.6em; text-align: left;
    }
    .chat-bubble th { background: rgba(0,0,0,0.2); font-weight: 600; }
    .chat-bubble a { color: #93c5fd; text-decoration: underline; }
    .chat-bubble a:hover { color: #bfdbfe; }
    .chat-bubble hr { border: 0; border-top: 1px solid rgba(255,255,255,0.2); margin: 0.6em 0; }
    .chat-bubble img { max-width: 100%; border-radius: 6px; }

    /* =====================================================
       FULLSCREEN: Modo tela cheia para o chat
       ===================================================== */
    .dz-fullscreen {
      position: fixed !important;
      inset: 0 !important;
      z-index: 400 !important;
      width: 100dvw !important;
      height: 100dvh !important;
      max-width: none !important;
      max-height: 100dvh !important;
      border-radius: 0 !important;
      margin: 0 !important;
      background: #080C16;
      isolation: isolate;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .dz-fullscreen .chat-bubble {
      max-width: 70% !important;
    }
    body.dz-fullscreen-active,
    #app.dz-fullscreen-active,
    #dashboard.dz-fullscreen-active {
      overflow: hidden !important;
    }
    @media (max-width: 1024px) {
      .dz-fullscreen .chat-bubble {
        max-width: 90% !important;
      }
    }

.dashboard-state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 2rem 1.5rem;
  text-align: center;
}

.dashboard-state__icon {
  width: 4rem;
  height: 4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fea116;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.dashboard-state--error .dashboard-state__icon {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(127, 29, 29, 0.2);
}

.dashboard-state__title {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dashboard-state__text {
  max-width: 32rem;
  color: #94a3b8;
  font-size: 0.92rem;
  line-height: 1.6;
  font-weight: 600;
}

.dashboard-state__spinner {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  border: 2px solid rgba(254, 161, 22, 0.2);
  border-top-color: #fea116;
  animation: spin 0.9s linear infinite;
}

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

#chatHistory iframe,
#chatHistory audio,
#chatHistory img {
  max-width: 100%;
}

#campaignLogsBody td,
#reactivationLogsBody td {
  white-space: normal;
  vertical-align: top;
}

@media (max-width: 1023px) {
  body,
  #app,
  #dashboard {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    overflow: hidden !important;
  }

  #dashboard {
    flex-direction: row !important;
    position: relative;
  }

  /* Barra lateral ultra compacta no mobile */
  #dashboardSidebar {
    width: 72px !important;
    height: 100% !important;
    min-height: 100% !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0 !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  /* Oculta textos e elementos desnecessários na barra lateral móvel */
  #dashboardSidebar h1,
  #dashboardSidebar span.truncate,
  #dashboardSidebar #userInfo,
  #dashboardSidebar .text-gray-600,
  #dashboardSidebar .text-\[10px\] {
    display: none !important;
  }

  /* Ajusta cabeçalho da marca na barra lateral */
  #dashboardSidebar div.h-\[88px\] {
    height: 72px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #dashboardSidebar div.h-\[88px\] div.w-12 {
    width: 40px !important;
    height: 40px !important;
  }

  /* Navegação compacta com ícones centralizados */
  #dashboardSidebar nav {
    padding: 0.5rem !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-height: none !important;
  }

  #dashboardSidebar nav button {
    justify-content: center !important;
    padding: 0.75rem !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
  }

  #dashboardSidebar nav button svg {
    margin: 0 !important;
    width: 1.25rem;
    height: 1.25rem;
  }

  /* Footer da barra lateral móvel */
  #dashboardSidebar div.mt-auto {
    padding: 0.5rem !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  #dashboardSidebar #audioStatus {
    padding: 0.35rem !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #dashboardSidebar #audioStatus span {
    display: none !important;
  }

  #dashboardSidebar #enableAudioBtn {
    font-size: 8px;
    padding: 2px 4px;
    white-space: nowrap;
    width: 100% !important;
  }

  #dashboardSidebar #openSettingsBtn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 14px !important;
  }

  /* O container principal ocupa o resto do espaço */
  #dashboard > main {
    height: 100% !important;
    width: calc(100% - 72px) !important;
    overflow: hidden !important;
  }

  #activeChatsSection {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    flex-direction: row !important;
    overflow: hidden !important;
  }

  /* Layout deslizante do Chat e Inbox no celular */
  #inboxColumn {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #chatContainer {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    z-index: 20;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Ativa deslizamento ao abrir chat */
  #activeChatsSection.mobile-chat-active #inboxColumn {
    transform: translateX(-100%);
  }

  #activeChatsSection.mobile-chat-active #chatContainer {
    transform: translateX(0);
  }

  /* Cabeçalho do Chat no celular */
  #chatHeader {
    height: 72px !important;
    padding: 0 1rem !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
  }

  #chatHeader > div:first-child {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  #chatHeader > div:last-child {
    width: auto !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
  }

  #chatHeader #encerrarChatBtn,
  #chatHeader #toggleLabel {
    padding: 0.5rem 0.75rem !important;
    min-height: 38px !important;
  }

  #chatHeader #encerrarChatBtn svg,
  #chatHeader #toggleLabel svg {
    width: 1rem;
    height: 1rem;
  }

  #chatHeader h3 {
    font-size: 1.05rem !important;
  }

  /* Histórico do Chat */
  #chatHistory {
    padding: 1rem !important;
  }

  .chat-bubble,
  .dz-fullscreen .chat-bubble {
    max-width: 100% !important;
  }

  /* Compositor (área do input de mensagens) */
  #chatComposer {
    padding: 0.75rem !important;
    gap: 0.5rem !important;
  }

  #chatActionsRow {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  #chatActionsRow > div {
    width: 100%;
  }

  #sendForm {
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  #sendForm > div {
    flex: 1 1 auto !important;
  }

  #sendForm > button[type="submit"] {
    flex: 0 0 auto !important;
    width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    justify-content: center !important;
  }

  #sendForm > button[type="submit"] span {
    display: none !important;
  }

  #composerUtilityRow {
    align-items: center !important;
    gap: 0.5rem !important;
  }

  #composerUtilityRow > button,
  #composerUtilityRow > div {
    width: auto !important;
    justify-content: center;
  }

  #audioPreviewContainer {
    width: 100%;
    min-width: 0 !important;
  }

  #audioPreviewContainer > div {
    flex-wrap: nowrap !important;
  }

  #audioPreview {
    width: 100%;
    max-width: none !important;
  }

  #sendError {
    width: 100%;
    margin-left: 0 !important;
    text-align: center;
  }

  #campaignsPanel,
  #reactivationPanel {
    overflow-x: hidden;
    padding: 1rem !important;
  }

  #campaignsPanel .overflow-x-auto,
  #reactivationPanel .overflow-x-auto {
    width: 100%;
    overflow-x: auto;
  }

  #campaignsPanel table,
  #reactivationPanel table {
    min-width: 760px;
  }

  #statusModal > div,
  #menuModal > div,
  #settingsModal > div,
  #encerradosModal > div {
    width: 100%;
    max-height: calc(100vh - 1rem);
    border-radius: 1.5rem;
  }

  #encerradosModal > div {
    height: calc(100vh - 1rem);
  }

  #sessionHistoryView > div:first-child .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #sessionHistoryMessages {
    padding: 1rem;
    border-radius: 1.25rem;
  }
}
