/* ===========================================
   INBOX STYLE - WhatsApp-like Layout
   IMPORTANTE: Usa !important para sobrescrever CSS conflitante
   =========================================== */

/* ---------- CSS Reset ---------- */
#app *, #app *::before, #app *::after {
  box-sizing: border-box !important;
  margin: 0;
}

/* ---------- Variables ---------- */
:root {
  --inbox-bg: #f0f2f5;
  --inbox-sidebar-bg: #ffffff;
  --inbox-chat-bg: #efeae2;
  --inbox-header-bg: #f0f2f5;
  --inbox-input-bg: #ffffff;
  --inbox-border: #e9edef;
  --inbox-text-primary: #111b21;
  --inbox-text-secondary: #667781;
  --inbox-text-muted: #8696a0;
  --inbox-primary: #00a884;
  --inbox-primary-hover: #008f72;
  --inbox-unread: #25d366;
  --inbox-msg-out: #d9fdd3;
  --inbox-msg-in: #ffffff;
  --inbox-shadow: 0 1px 3px rgba(11, 20, 26, 0.08);
  --inbox-radius: 8px;
  --inbox-sidebar-width: 400px;
  --inbox-header-height: 60px;
  
  --skeleton: #e9ecef;
}

/* ---------- Dark Mode ---------- */
body.dark {
  --inbox-bg: #0b141a;
  --inbox-sidebar-bg: #111b21;
  --inbox-chat-bg: #0b141a;
  --inbox-header-bg: #202c33;
  --inbox-input-bg: #2a3942;
  --inbox-border: #222d34;
  --inbox-text-primary: #e9edef;
  --inbox-text-secondary: #aebac1;
  --inbox-text-muted: #8696a0;
  --inbox-msg-out: #005c4b;
  --inbox-msg-in: #202c33;
  
  --skeleton: #2a3942;
}

/* ---------- Base ---------- */
html, body {
  height: 100% !important;
  height: -webkit-fill-available !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--inbox-text-primary);
  background: var(--inbox-bg);
  overflow: hidden !important;
}

/* ---------- App Container ---------- */
#app {
  display: flex !important;
  flex-direction: row !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 100% !important;
  overflow: hidden !important;
  background: var(--inbox-bg) !important;
}

/* ===========================================
   SIDEBAR
   =========================================== */
#app .sidebar-title {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

#app .sidebar-logo {
  width: 42px !important;
  height: 42px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  border-radius: 8px;
}

#app .sidebar-title-text {
  display: flex !important;
  flex-direction: column !important;
  line-height: 1.1 !important;
}

#app .sidebar-title-text h1 {
  font-size: 18px !important;
  font-weight: 700 !important;
  margin: 0 !important;
}

#app .sidebar-title-text span {
  font-size: 11px !important;
  color: var(--inbox-text-muted) !important;
  font-weight: 500 !important;
}

#app .title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#app .title-row h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--inbox-text-primary);
  margin: 0;
}

#app .store-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--inbox-primary);
  background: rgba(0,0,0,0.04);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

body.dark #app .store-name {
  background: rgba(255,255,255,0.06);
}
   
#app .sidebar {
  width: var(--inbox-sidebar-width) !important;
  min-width: var(--inbox-sidebar-width) !important;
  max-width: var(--inbox-sidebar-width) !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  background: var(--inbox-sidebar-bg) !important;
  border-right: 1px solid var(--inbox-border) !important;
}

#app .sidebar-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: var(--inbox-header-height) !important;
  padding: 0 16px !important;
  background: var(--inbox-header-bg) !important;
  border-bottom: 1px solid var(--inbox-border) !important;
}

#app .sidebar-title h1 {
  font-size: 20px !important;
  font-weight: 600 !important;
  color: var(--inbox-text-primary) !important;
}

#app .sidebar-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Search */
#app .search-wrapper {
  padding: 8px 12px !important;
  background: var(--inbox-header-bg) !important;
  position: relative !important;
}

#app .search-icon {
  position: absolute !important;
  left: 24px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 18px !important;
  color: var(--inbox-text-muted) !important;
  pointer-events: none !important;
}

#app .search-input {
  width: 100% !important;
  height: 36px !important;
  padding: 0 12px 0 40px !important;
  border: none !important;
  border-radius: 8px !important;
  background: var(--inbox-sidebar-bg) !important;
  color: var(--inbox-text-primary) !important;
  font-size: 14px !important;
  outline: none !important;
}

body.dark #app .search-input {
  background: var(--inbox-input-bg) !important;
}

/* Section Headers */
#app .section-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 16px 8px !important;
  background: var(--inbox-sidebar-bg) !important;
}

#app .section-title {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--inbox-primary) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Badges */
#app .badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 20px !important;
  height: 20px !important;
  padding: 0 6px !important;
  border-radius: 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

#app .badge-primary {
  background: var(--inbox-primary) !important;
  color: #ffffff !important;
}

#app .badge-muted {
  background: var(--inbox-border) !important;
  color: var(--inbox-text-secondary) !important;
}

/* Conversations List */
#app .conversations-list {
  overflow-y: auto !important;
  flex: 1 !important;
}

#app .conversations-queue {
  max-height: 35% !important;
  flex: none !important;
  border-bottom: 1px solid var(--inbox-border) !important;
}

#app .conversations-all {
  flex: 1 !important;
}

/* Conversation Item */
#app .conversation-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  position: relative;
  gap: 12px !important;
  padding: 12px 16px !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
  border-bottom: 1px solid var(--inbox-border) !important;
}

#app .conversation-item:hover {
  background: var(--inbox-header-bg) !important;
}

#app .conversation-item.active {
  background: var(--inbox-header-bg) !important;
}

body.dark #app .conversation-item:hover,
body.dark #app .conversation-item.active {
  background: var(--inbox-input-bg) !important;
}

/* Avatar */
#app .avatar {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}

#app .avatar-placeholder {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--inbox-primary), var(--inbox-primary-hover)) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  flex-shrink: 0 !important;
  text-transform: uppercase !important;
}

#app .avatar-placeholder ion-icon {
  font-size: 24px !important;
}

/* Conversation Content */
#app .conversation-content {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

#app .conversation-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

#app .conversation-name {
  font-size: 16px !important;
  font-weight: 500 !important;
  color: var(--inbox-text-primary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#app .conversation-time {
  font-size: 12px !important;
  color: var(--inbox-text-muted) !important;
  flex-shrink: 0 !important;
}

#app .conversation-item.unread .conversation-time {
  color: var(--inbox-unread) !important;
}

#app .conversation-item.unread {
  border-left: 3px solid #25d366;
}

#app .conversation-item[data-controlled="MANUAL"] {
  border-left: 3px solid #1c7ed6;
}

#app .conversation-footer {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

#app .conversation-preview {
  font-size: 14px !important;
  color: var(--inbox-text-secondary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 1 !important;
}

#app .conversation-meta {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}

#app .whatsapp-badge {
  color: var(--inbox-unread) !important;
  font-size: 18px !important;
}

#app .unread-badge {
  min-width: 20px !important;
  height: 20px !important;
  padding: 0 6px !important;
  border-radius: 10px !important;
  background: var(--inbox-unread) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ===========================================
   CHAT CONTAINER
   =========================================== */
#app .chat-container {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-width: 0 !important;
  background: var(--inbox-chat-bg) !important;
  position: relative !important;
}

/* Chat Header */
#app .chat-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  height: var(--inbox-header-height) !important;
  padding: 0 16px !important;
  background: var(--inbox-header-bg) !important;
  border-bottom: 1px solid var(--inbox-border) !important;
  flex-shrink: 0 !important;
}

#app .chat-header.hidden {
  display: none !important;
}

#app .back-btn {
  display: none !important;
}

#app .chat-avatar {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
}

#app .chat-header .avatar,
#app .chat-header .avatar-placeholder {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  font-size: 16px !important;
}

#app .chat-info {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

#app .chat-name {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--inbox-text-primary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#app .chat-phone-wrapper {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
}

#app .chat-phone-wrapper .whatsapp-icon {
  color: var(--inbox-unread) !important;
  font-size: 14px !important;
}

#app .chat-phone {
  font-size: 13px !important;
  color: var(--inbox-text-secondary) !important;
}

#app .chat-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

/* Bot Toggle */
#app .bot-toggle-wrapper {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 6px 12px !important;
  background: rgba(0, 168, 132, 0.1) !important;
  border-radius: 20px !important;
}

body.dark #app .bot-toggle-wrapper {
  background: rgba(0, 168, 132, 0.2) !important;
}

#app .toggle-label {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--inbox-primary) !important;
  white-space: nowrap !important;
}

/* Toggle Switch */
#app .toggle-switch {
  position: relative !important;
  display: inline-block !important;
  width: 40px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
}

#app .toggle-switch input {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

#app .toggle-slider {
  position: absolute !important;
  cursor: pointer !important;
  inset: 0 !important;
  background: var(--inbox-text-muted) !important;
  border-radius: 22px !important;
  transition: 0.2s ease !important;
}

#app .toggle-slider::before {
  content: '' !important;
  position: absolute !important;
  width: 18px !important;
  height: 18px !important;
  left: 2px !important;
  bottom: 2px !important;
  background: #ffffff !important;
  border-radius: 50% !important;
  transition: 0.2s ease !important;
}

#app .toggle-switch input:checked + .toggle-slider {
  background: var(--inbox-primary) !important;
}

#app .toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px) !important;
}

#app .toggle-sm {
  width: 36px !important;
  height: 20px !important;
}

#app .toggle-sm .toggle-slider::before {
  width: 16px !important;
  height: 16px !important;
}

#app .toggle-sm input:checked + .toggle-slider::before {
  transform: translateX(16px) !important;
}

/* Icon Button */
#app .icon-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border: none !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--inbox-text-secondary) !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

#app .icon-btn:hover {
  background: var(--inbox-border) !important;
}

#app .icon-btn ion-icon {
  font-size: 20px !important;
}

/* Dark mode toggle icons */
#app .icon-sun { display: block !important; }
#app .icon-moon { display: none !important; }
body.dark #app .icon-sun { display: none !important; }
body.dark #app .icon-moon { display: block !important; }

/* ===========================================
   CHAT MESSAGES
   =========================================== */
#app .chat {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 16px 60px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0px !important;
  min-height: 0 !important; 
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c1.5 0 2.5 1 2.5 2.5S31.5 10 30 10s-2.5-1-2.5-2.5S28.5 5 30 5zm0 45c1.5 0 2.5 1 2.5 2.5S31.5 55 30 55s-2.5-1-2.5-2.5S28.5 50 30 50zM5 30c0-1.5 1-2.5 2.5-2.5S10 28.5 10 30s-1 2.5-2.5 2.5S5 31.5 5 30zm45 0c0-1.5 1-2.5 2.5-2.5S55 28.5 55 30s-1 2.5-2.5 2.5S50 31.5 50 30z' fill='%23d1d5db' fill-opacity='0.15'/%3E%3C/svg%3E") !important;
}

body.dark #app .chat {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c1.5 0 2.5 1 2.5 2.5S31.5 10 30 10s-2.5-1-2.5-2.5S28.5 5 30 5zm0 45c1.5 0 2.5 1 2.5 2.5S31.5 55 30 55s-2.5-1-2.5-2.5S28.5 50 30 50zM5 30c0-1.5 1-2.5 2.5-2.5S10 28.5 10 30s-1 2.5-2.5 2.5S5 31.5 5 30zm45 0c0-1.5 1-2.5 2.5-2.5S55 28.5 55 30s-1 2.5-2.5 2.5S50 31.5 50 30z' fill='%23ffffff' fill-opacity='0.03'/%3E%3C/svg%3E") !important;
}

/* Mensagem seguida do mesmo lado: 2px */
#app .message + .message { margin-top: 2px !important; }

/* Troca de lado: 6px */
#app .msg-in + .msg-out,
#app .msg-out + .msg-in { margin-top: 6px !important; }

/* Empty State */
#app .chat-empty {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 16px !important;
  color: var(--inbox-text-muted) !important;
  text-align: center !important;
  padding: 40px !important;
}

#app .empty-icon {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50% !important;
  background: var(--inbox-border) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#app .empty-icon ion-icon {
  font-size: 40px !important;
  color: var(--inbox-text-muted) !important;
}

#app .chat-empty h3 {
  font-size: 20px !important;
  font-weight: 500 !important;
  color: var(--inbox-text-secondary) !important;
}

#app .chat-empty p {
  font-size: 14px !important;
  color: var(--inbox-text-muted) !important;
}

/* Message Bubbles */
#app .message {
  display: flex !important;
  flex-direction: column !important;
  max-width: 65% !important;
  animation: fadeIn 0.2s ease !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#app .message.msg-in {
  align-self: flex-start !important;
}

#app .message.msg-out {
  align-self: flex-end !important;
}

/* No CSS atual, o .message-time fica fora da bolha — mover para dentro */
#app .message-bubble {
  padding: 6px 9px 6px 9px !important; /* reduzir padding base */
}

/* Footer da bolha com hora + ticks dentro */
#app .bubble-footer {
  display: inline-flex !important;
  align-items: flex-end !important;
  gap: 3px !important;
  float: right !important;
  margin-left: 8px !important;
  margin-bottom: -3px !important; /* sobe junto ao texto */
  vertical-align: bottom !important;
}

#app .msg-out .message-time {
  color: rgba(0, 0, 0, 0.38) !important;
}

#app .msg-in .message-bubble {
  background: var(--inbox-msg-in) !important;
  box-shadow: var(--inbox-shadow) !important;
}

#app .msg-out .message-bubble {
  background: var(--inbox-msg-out) !important;
}

#app .message-text {
  color: var(--inbox-text-primary) !important;
  font-size: 14px !important;
}

#app .message-text strong { font-weight: 600 !important; }
#app .message-text em { font-style: italic !important; }
#app .message-text s { text-decoration: line-through !important; }

#app .message-text code {
  font-family: 'SF Mono', Monaco, monospace !important;
  font-size: 13px !important;
  background: rgba(0, 0, 0, 0.06) !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
}

body.dark #app .message-text code {
  background: rgba(255, 255, 255, 0.1) !important;
}

#app .message-time {
  font-size: 11px !important;
  color: var(--inbox-text-muted) !important;
  text-align: right !important;
  margin-top: 4px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 4px !important;
}

#app .msg-out .message-time {
  color: rgba(0, 0, 0, 0.45) !important;
}

body.dark #app .msg-out .message-time {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Date Separator */
#app .date-separator {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 0 !important;
}

#app .date-separator span {
  background: rgba(255, 255, 255, 0.9) !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--inbox-text-secondary) !important;
  box-shadow: var(--inbox-shadow) !important;
}

body.dark #app .date-separator span {
  background: var(--inbox-input-bg) !important;
}

/* ===========================================
   CHAT FOOTER / INPUT
   =========================================== */
#app .chat-input-wrapper {
  display: flex !important;
  flex-direction: column !important;
  background: var(--inbox-header-bg) !important;
  border-top: 1px solid var(--inbox-border) !important;
  flex-shrink: 0 !important;
  position: relative !important;
}

#app .chat-input-wrapper {
  flex: 0 0 auto !important;
  min-height: 0 !important;
}

#app .chat-input-wrapper.hidden {
  display: none !important;
}

/* Bot Status Bar */
#app .bot-status-bar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 16px !important;
  background: var(--inbox-sidebar-bg) !important;
  border-bottom: 1px solid var(--inbox-border) !important;
}

#app .bot-status-text {
  font-size: 13px !important;
  color: var(--inbox-text-secondary) !important;
}

/* Input Area */
#app .input-area {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  gap: 8px !important;
  padding: 10px 16px !important;
}

#app .input-container {
  flex: 1 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  background: var(--inbox-input-bg) !important;
  border-radius: 24px !important;
  padding: 0 12px !important;
  min-height: 44px !important;
}

body:not(.dark) #app .input-container {
  background: #ffffff !important;
  border: 1px solid var(--inbox-border) !important;
}

#app .chat-textarea {
  flex: 1 !important;
  border: none !important;
  background: transparent !important;
  color: var(--inbox-text-primary) !important;
  font-size: 14px !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  padding: 10px 0 !important;
  resize: none !important;
  outline: none !important;
  max-height: 120px !important;
  overflow-y: auto !important;
}

#app .chat-textarea::placeholder {
  color: var(--inbox-text-muted) !important;
}

/* Send Button */
#app .send-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  border: none !important;
  border-radius: 50% !important;
  background: var(--inbox-primary) !important;
  color: #ffffff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

#app .send-btn:hover {
  background: var(--inbox-primary-hover) !important;
}

#app .send-btn ion-icon {
  font-size: 20px !important;
}

/* Bot Active Overlay */
#app .bot-active-overlay {
  display: none !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 62px !important;
  background: var(--inbox-header-bg) !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: var(--inbox-text-muted) !important;
  font-size: 14px !important;
  border-top: 1px solid var(--inbox-border) !important;
}

#app .bot-active-overlay ion-icon {
  font-size: 18px !important;
}

/* Show overlay when bot is active */
#app .chat-input-wrapper.bot-active .input-area {
  opacity: 0 !important;
  pointer-events: none !important;
}

#app .chat-input-wrapper.bot-active .bot-active-overlay {
  display: flex !important;
}

/* ===========================================
   SCROLLBAR
   =========================================== */
#app ::-webkit-scrollbar {
  width: 6px !important;
}

#app ::-webkit-scrollbar-track {
  background: transparent !important;
}

#app ::-webkit-scrollbar-thumb {
  background: var(--inbox-text-muted) !important;
  border-radius: 3px !important;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #app .chat-input-wrapper {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
  :root {
    --inbox-sidebar-width: 100%;
  }
  
  #app {
    height: 100dvh !important;
    height: -webkit-fill-available !important;
    overflow: hidden !important;
    position: fixed !important;   /* ancora no topo mesmo com bounce do iOS */
    inset: 0 !important;
  }
  
  #app .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 200 !important;
    transform: translateX(0) !important;   /* visível por padrão */
    transition: transform 0.3s ease !important;
  }
  
  #app.chat-open .sidebar {
    transform: translateX(-100%) !important;
    pointer-events: none !important;
  }
  
  #app.show-sidebar .sidebar {
    transform: translateX(0) !important;
  }
  
  #app .back-btn {
    display: flex !important;
  }
  
  #app .chat {
    padding: 16px !important;
  }
  
  #app .message {
    max-width: 85% !important;
  }
  
  #app .chat-container {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0 !important;
  }
  
  /* Quando conversa abre, mostra o chat */
  #app.chat-open .chat-container {
    display: flex !important;
  }
 
  /* Botão voltar aparece */
  #app .back-btn {
    display: flex !important;
  }
 
  /* Mensagens com padding lateral menor */
  #app .chat {
    padding: 12px 8px !important;
  }
 
  /* Balões ocupam mais espaço na tela pequena */
  #app .message {
    max-width: 88% !important;
  }
  
  #app .bot-status-bar {
    padding: 6px 12px !important;
    min-height: 36px !important;
  }
  
  #app .input-area {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
 
  #app .chat-textarea {
    font-size: 16px !important;   /* 16px evita zoom automático no iOS */
  }
  
  #app .bot-active-overlay {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* Cobre apenas a input-area, não o bot-status-bar */
    top: auto !important;
    height: auto !important;
    min-height: 52px !important;
  }
  
  #app .chat-header {
    padding: 0 10px !important;
    gap: 8px !important;
  }
 
  #app .bot-toggle-wrapper {
    padding: 4px 8px !important;
  }
 
  #app .toggle-label {
    display: none !important;   /* esconde o label no mobile para economizar espaço */
  }
}

@media (max-width: 768px) {
  #app .chat-container {
    /* Impede que o conteúdo vaze por baixo do teclado */
    -webkit-overflow-scrolling: touch !important;
  }
 
  #app .chat {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
}

/* ===========================================
   UTILITIES
   =========================================== */
#app .hidden {
  display: none !important;
}

#app .chat {
  align-items: stretch !important;
}

#app .message-bubble {
  position: relative !important;
  overflow: visible !important;

  border-radius: 10px !important;

  padding: 6px 9px !important;

  display: inline-block !important;
}

#app .message-time {
  white-space: nowrap !important;
  display: flex !important;
  gap: 4px !important;
  justify-content: flex-end !important;
  align-items: center !important;
}

/* INCOMING */
#app .msg-in .message-bubble::before {
  content: '';

  position: absolute;
  bottom: 0;
  left: -9px;

  width: 18px;
  height: 18px;

  background: var(--inbox-msg-in);

  border-bottom-right-radius: 16px;

  clip-path: polygon(100% 0, 0 100%, 100% 100%);

  box-shadow: -1px 1px 1px rgba(0,0,0,.04);
}

/* OUTGOING */
#app .msg-out .message-bubble::after {
  content: '';

  position: absolute;
  bottom: 0;
  right: -9px;

  width: 18px;
  height: 18px;

  background: var(--inbox-msg-out);

  border-bottom-left-radius: 16px;

  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.badge {
  position: absolute;
  top: 14px;
  right: 50px;

  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;

  white-space: nowrap;
}

.badge-manual {
  background: #e7f5ff;
  color: #1c7ed6;
  border: 1px solid #74c0fc;
}

.badge-bot {
  background: #f1f3f5;
  color: #495057;
  border: 1px solid #ced4da;
}

.messages-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.messages-loader ion-icon {
  font-size: 20px;
  opacity: .7;
}

.spin {
  animation: spin 1s linear infinite;
}

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

.emoji-picker-wrapper {
  position: absolute;
  bottom: 70px;
  right: 20px;
  z-index: 999;
}

.hidden {
  display: none;
}

.conversation-skeleton {
  display: flex !important;
  gap: 12px !important;
  padding: 14px 16px !important;
  align-items: center !important;
  border-bottom: 1px solid var(--inbox-border);
  min-height: 73px !important;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--skeleton);
  flex-shrink: 0;
}

.skeleton-content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: var(--skeleton);
  position: relative;
  overflow: hidden;
}

.skeleton-name {
  width: 45%;
  margin-bottom: 10px;
}

.skeleton-message {
  width: 80%;
}

.skeleton-line::after,
.skeleton-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255,255,255,.35),
      transparent
    );

  animation: skeleton-loading 1.3s infinite;
}

.skeleton-avatar {
  position: relative;
  overflow: hidden;
}

@keyframes skeleton-loading {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 768px) {

  /* estado padrão: lista visível */
  #app .chat-container {
    display: none !important;
    width: 100% !important;
  }

  #app .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    transform: translateX(0) !important;
  }

  /* quando abre conversa */
  #app.chat-open .sidebar {
    display: none !important;
  }

  #app.chat-open .chat-container {
    display: flex !important;
    width: 100% !important;
  }

  /* back button aparece */
  #app .back-btn {
    display: flex !important;
  }
}

.wa-list-message {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wa-list-body {
  font-size: 14px;
  line-height: 1.5;
}

.wa-list-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wa-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-list-section-title {
  font-size: 12px;
  font-weight: 700;
  opacity: .7;
  text-transform: uppercase;
}

.wa-list-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-list-item {
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-out .wa-list-item {
  background: rgba(255,255,255,.18);
}

.wa-list-item-title {
  font-size: 14px;
  font-weight: 600;
}

.wa-list-item-description {
  font-size: 12px;
  opacity: .75;
}

.wa-list-button {
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 10px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-weight: 600;
  font-size: 14px;
}

.wa-list-footer {
  font-size: 11px;
  opacity: .6;
  text-align: center;
}

/* ===========================================
   CTA URL
   =========================================== */

.wa-cta-message {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wa-cta-body {
  font-size: 14px;
  line-height: 1.5;
}

.wa-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: 100%;

  padding: 12px 16px;

  border-radius: 14px;

  text-decoration: none;
  font-weight: 600;
  font-size: 14px;

  transition:
    transform .15s ease,
    background .15s ease,
    opacity .15s ease;

  background: #00a884;
  color: #fff;

  box-shadow:
    0 2px 10px rgba(0,0,0,.12);
}

.wa-cta-button:hover {
  background: #019270;
  transform: translateY(-1px);
}

.wa-cta-button:active {
  transform: scale(.98);
}

.wa-cta-button ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.wa-cta-button span {
  flex: 1;
  text-align: center;
}

.wa-cta-footer {
  font-size: 11px;
  opacity: .65;
  text-align: center;
}

/* ===========================================
   LINKS
   =========================================== */

.wa-link {
  color: #53bdeb;
  text-decoration: none;
  word-break: break-word;

  display: inline-flex;
  align-items: center;
  gap: 4px;

  padding: 2px 8px;

  border-radius: 8px;

  background: rgba(83, 189, 235, 0.12);

  font-weight: 500;

  transition:
    background .2s ease,
    transform .12s ease;
}

.wa-link:hover {
  background: rgba(83, 189, 235, 0.2);
  transform: translateY(-1px);
}

.wa-link::before {
  content: '🔗';
  font-size: 12px;
}

.wa-code-block {
  margin: 6px 0;
  padding: 10px 12px;

  background: #111b21;
  color: #e9edef;

  border-radius: 8px;

  overflow-x: auto;

  white-space: pre-wrap;
  word-break: break-word;

  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.35;

  display: block;
}

.wa-code-block code {
  background: transparent;
  padding: 0;
  margin: 0;

  color: inherit;

  white-space: inherit;
  word-break: inherit;

  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

pre {
  margin: 0;
}

/* Container de imagem */
#app .media-image-container {
  max-width: 330px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#app .media-image {
  width: 100% !important;
  max-height: 400px !important;
  object-fit: cover !important;
  cursor: pointer !important;
  display: block !important;
  border-radius: 8px !important;
  transition: opacity 0.2s !important;
}

#app .media-image:hover {
  opacity: 0.95 !important;
}

#app .media-caption {
  padding: 8px 4px 4px !important;
  font-size: 14px !important;
  color: var(--inbox-text-primary) !important;
}

/* Player de áudio personalizado */
#app .audio-player {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 8px !important;
  min-width: 240px !important;
  max-width: 320px !important;
}

#app .audio-play-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: var(--inbox-primary) !important;
  color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: transform 0.1s !important;
}

#app .audio-play-btn:hover {
  transform: scale(1.05) !important;
}

#app .audio-play-btn:active {
  transform: scale(0.95) !important;
}

#app .audio-play-btn ion-icon {
  font-size: 20px !important;
}

#app .audio-waveform {
  flex: 1 !important;
  position: relative !important;
  height: 32px !important;
}

#app .audio-progress {
  position: absolute !important;
  top: 50% !important;
  left: 0 !important;
  right: 0 !important;
  height: 4px !important;
  background: rgba(0, 0, 0, 0.1) !important;
  border-radius: 2px !important;
  transform: translateY(-50%) !important;
  overflow: hidden !important;
}

body.dark #app .audio-progress {
  background: rgba(255, 255, 255, 0.2) !important;
}

#app .audio-progress-bar {
  height: 100% !important;
  width: 0% !important;
  background: var(--inbox-primary) !important;
  border-radius: 2px !important;
  transition: width 0.1s linear !important;
}

#app .audio-seek {
  position: absolute !important;
  top: 50% !important;
  left: 0 !important;
  right: 0 !important;
  transform: translateY(-50%) !important;
  width: 100% !important;
  height: 20px !important;
  opacity: 0 !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
}

#app .audio-time {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  font-size: 11px !important;
  color: var(--inbox-text-muted) !important;
  min-width: 35px !important;
}

#app .audio-player.playing .audio-current {
  color: var(--inbox-primary) !important;
}

/* Container de vídeo */
#app .media-video-container {
  max-width: 330px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#app .media-video {
  width: 100% !important;
  max-height: 400px !important;
  display: block !important;
  border-radius: 8px !important;
  background: #000 !important;
}

/* Container de documento */
#app .media-document {
  min-width: 200px !important;
  max-width: 280px !important;
}

#app .document-link {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  color: inherit !important;
  transition: background 0.2s !important;
}

body.dark #app .document-link {
  background: rgba(255, 255, 255, 0.08) !important;
}

#app .document-link:hover {
  background: rgba(0, 0, 0, 0.08) !important;
}

body.dark #app .document-link:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

#app .document-icon {
  width: 40px !important;
  height: 40px !important;
  background: var(--inbox-primary) !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

#app .document-icon ion-icon {
  font-size: 20px !important;
  color: #ffffff !important;
}

#app .document-info {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

#app .document-name {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--inbox-text-primary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#app .document-meta {
  font-size: 12px !important;
  color: var(--inbox-text-muted) !important;
}

#app .document-download {
  font-size: 20px !important;
  color: var(--inbox-text-secondary) !important;
  flex-shrink: 0 !important;
}

/* Sticker */
#app .media-sticker {
  max-width: 150px !important;
}

#app .sticker-image {
  width: 100% !important;
  display: block !important;
}

/* Erro de mídia */
#app .media-error {
  padding: 20px !important;
  text-align: center !important;
  color: var(--inbox-text-muted) !important;
  font-size: 13px !important;
}

/* ============================================
   VISUALIZADOR DE IMAGENS (LIGHTBOX)
   ============================================ */

.image-viewer {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0 !important;
  transition: opacity 0.2s ease !important;
}

.image-viewer.visible {
  opacity: 1 !important;
}

.viewer-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.9) !important;
  cursor: zoom-out !important;
}

.viewer-content {
  position: relative !important;
  z-index: 1 !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
}

.viewer-image {
  max-width: 90vw !important;
  max-height: 85vh !important;
  object-fit: contain !important;
  border-radius: 4px !important;
}

.viewer-actions {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  display: flex !important;
  gap: 8px !important;
}

.viewer-btn {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s !important;
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.viewer-btn ion-icon {
  font-size: 24px !important;
}

/* ============================================
   ÁREA DE INPUT COM MÍDIA
   ============================================ */

/* Preview de mídia antes de enviar */
#app .media-preview {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  background: var(--inbox-header-bg) !important;
  border-bottom: 1px solid var(--inbox-border) !important;
}

#app .media-preview.hidden {
  display: none !important;
}

#app .preview-content {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

#app .preview-image {
  width: 60px !important;
  height: 60px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
}

#app .preview-file {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  background: var(--inbox-border) !important;
  border-radius: 8px !important;
}

#app .preview-file ion-icon {
  font-size: 24px !important;
  color: var(--inbox-primary) !important;
}

#app .preview-close {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  color: var(--inbox-text-secondary) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#app .preview-close:hover {
  background: var(--inbox-border) !important;
}

/* Área de gravação de áudio */
#app .audio-recording {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 12px 16px !important;
  background: var(--inbox-header-bg) !important;
}

#app .audio-recording.hidden {
  display: none !important;
}

#app .recording-cancel {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: #dc3545 !important;
  color: #ffffff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#app .recording-indicator {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

#app .recording-dot {
  width: 12px !important;
  height: 12px !important;
  background: #dc3545 !important;
  border-radius: 50% !important;
  animation: pulse 1s ease-in-out infinite !important;
}

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

#app .recording-time {
  font-size: 16px !important;
  font-weight: 500 !important;
  color: var(--inbox-text-primary) !important;
  font-variant-numeric: tabular-nums !important;
}

#app .recording-send {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  border: none !important;
  background: var(--inbox-primary) !important;
  color: #ffffff !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#app .recording-send ion-icon {
  font-size: 24px !important;
}

/* Menu de anexos */
#app .attachment-wrapper {
  position: relative !important;
}

#app .attachment-menu {
  position: absolute !important;
  bottom: 100% !important;
  left: 0 !important;
  margin-bottom: 8px !important;
  background: var(--inbox-sidebar-bg) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden !important;
  min-width: 160px !important;
  z-index: 100 !important;
}

#app .attachment-menu.hidden {
  display: none !important;
}

#app .attachment-option {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer !important;
  color: var(--inbox-text-primary) !important;
  font-size: 14px !important;
  transition: background 0.15s !important;
}

#app .attachment-option:hover {
  background: var(--inbox-header-bg) !important;
}

#app .attachment-option ion-icon {
  font-size: 20px !important;
  color: var(--inbox-primary) !important;
}

/* Drag & drop */
#app .chat-container.drag-over {
  position: relative !important;
}

#app .chat-container.drag-over::after {
  content: 'Solte o arquivo aqui' !important;
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0, 168, 132, 0.1) !important;
  border: 2px dashed var(--inbox-primary) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  font-weight: 500 !important;
  color: var(--inbox-primary) !important;
  z-index: 50 !important;
}

/* Status de mensagem otimista */
#app .message.msg-optimistic {
  opacity: 0.7 !important;
}

#app .message.msg-failed {
  opacity: 1 !important;
}

#app .message.msg-failed .message-bubble {
  border: 1px solid #dc3545 !important;
}

#app .msg-status {
  display: inline-flex !important;
  align-items: center !important;
  margin-right: 4px !important;
}

#app .msg-status ion-icon {
  font-size: 14px !important;
}

#app .msg-status.sending ion-icon {
  color: var(--inbox-text-muted) !important;
  animation: spin 1s linear infinite !important;
}

#app .msg-status.failed ion-icon {
  color: #dc3545 !important;
}

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

#app .msg-retry {
  display: block !important;
  width: 100% !important;
  margin-top: 8px !important;
  padding: 6px 12px !important;
  border: none !important;
  background: #dc3545 !important;
  color: #ffffff !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  cursor: pointer !important;
}

#app .msg-retry:hover {
  background: #c82333 !important;
}

/* Ajustes para mensagens de mídia */
#app .msg-type-image .message-bubble,
#app .msg-type-video .message-bubble,
#app .msg-type-sticker .message-bubble {
  padding: 4px !important;
  background: transparent !important;
}

#app .msg-type-sticker .bubble-footer {
  display: none !important;
}

/* ===========================================
   LOGIN LAYOUT
   =========================================== */
   
body:has(.login-wrap) {
  overflow: hidden !important; /* mantém, mas o wrap controla */
}

.login-wrap {
  display: flex;
  align-items: stretch;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
  background: var(--inbox-bg);
}
 
/* ---------- Lado esquerdo (pitch) ---------- */
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: var(--inbox-primary);
  position: relative;
  overflow: hidden;
}
 
.login-left::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
  top: -90px;
  right: -90px;
  pointer-events: none;
}
 
.login-left::after {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .07);
  bottom: -70px;
  left: -50px;
  pointer-events: none;
}
 
.login-left-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 300px;
}
 
.login-left-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
 
.login-left-icon ion-icon {
  font-size: 32px;
  color: #ffffff;
}
 
.login-left h1 {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: .75rem;
  line-height: 1.3;
}
 
.login-left p {
  font-size: 14px;
  color: rgba(255, 255, 255, .75);
  line-height: 1.6;
}
 
/* Pills */
.login-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 1.75rem;
}
 
.login-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: 8px 16px;
  text-align: left;
}
 
.login-pill ion-icon {
  font-size: 18px;
  color: rgba(255, 255, 255, .9);
  flex-shrink: 0;
}
 
.login-pill span {
  font-size: 13px;
  color: rgba(255, 255, 255, .85);
}
 
/* ---------- Lado direito (formulário) ---------- */
.login-right {
  width: 400px;
  min-width: 0;       
  max-width: 100%;
  flex-shrink: 1;      
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 2.25rem;
  background: var(--inbox-sidebar-bg);
  border-left: 1px solid var(--inbox-border);
  overflow-y: auto;
  box-sizing: border-box; 
}
 
/* Logo */
.login-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}
 
.login-logo-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--inbox-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
 
.login-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
 
.login-logo-box ion-icon {
  font-size: 20px;
  color: #ffffff;
}
 
.login-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
 
.login-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--inbox-text-primary);
}
 
.login-brand-sub {
  font-size: 11px;
  color: var(--inbox-text-muted);
  font-weight: 500;
}
 
/* Títulos */
.login-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--inbox-text-primary);
  margin-bottom: .25rem;
}
 
.login-subtitle {
  font-size: 13px;
  color: var(--inbox-text-secondary);
  margin-bottom: 1.75rem;
}
 
/* ===========================================
   CAMPOS
   =========================================== */
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
  width: 100%;
  min-width: 0;     
  max-width: 100%;  
  box-sizing: border-box;
}
 
.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--inbox-text-secondary);
}
 
.login-input-wrap {
  position: relative;
  width: 100%;      
  min-width: 0;     
}
 
.login-input-wrap .input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--inbox-text-muted);
  pointer-events: none;
}
 
.login-input-wrap input {
  width: 100%;
  min-width: 0;          
  max-width: 100%;       
  box-sizing: border-box; 
  height: 42px;
  padding: 0 40px 0 40px;
  border: 1px solid var(--inbox-border);
  border-radius: var(--inbox-radius);
  background: var(--inbox-input-bg);
  color: var(--inbox-text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
 
.login-input-wrap input::placeholder {
  color: var(--inbox-text-muted);
}
 
.login-input-wrap input:hover {
  border-color: var(--inbox-text-muted);
}
 
.login-input-wrap input:focus {
  border-color: var(--inbox-primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, .12);
}
 
.login-input-wrap input.is-error {
  border-color: #dc3545;
}
 
/* Botão olho */
.login-toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--inbox-text-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color .15s;
}
 
.login-toggle-pw:hover {
  color: var(--inbox-text-secondary);
}
 
/* Mensagem de erro */
.login-err {
  font-size: 12px;
  color: #dc3545;
  display: none;
  align-items: center;
  gap: 4px;
}
 
.login-err.show {
  display: flex;
}
 
.login-err ion-icon {
  font-size: 14px;
  flex-shrink: 0;
}
 
/* ===========================================
   BOTÃO
   =========================================== */
.login-btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--inbox-radius);
  background: var(--inbox-primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: .5rem;
  transition: background .15s, transform .1s;
}
 
.login-btn ion-icon {
  font-size: 20px;
}
 
.login-btn:hover {
  background: var(--inbox-primary-hover);
}
 
.login-btn:active {
  transform: scale(.98);
}
 
.login-btn:disabled {
  background: var(--inbox-border);
  color: var(--inbox-text-muted);
  cursor: not-allowed;
  transform: none;
}
 
/* ===========================================
   TOAST
   =========================================== */
.login-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--inbox-sidebar-bg);
  border: 1px solid var(--inbox-border);
  border-radius: var(--inbox-radius);
  box-shadow: var(--inbox-shadow);
  padding: .65rem 1rem;
  font-size: 13px;
  color: var(--inbox-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
 
.login-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
 
.login-toast ion-icon {
  font-size: 18px;
  color: var(--inbox-primary);
}

.login-toast.error{
  background:rgba(220,53,69,.08);
  border-color:rgba(220,53,69,.25);
  color:#dc3545;
}

.login-toast.error ion-icon{
  color:#dc3545;
}

@media (min-width: 768px) {
  .login-toast {
    left: auto;
    right: 1.5rem;

    transform: translateY(16px);
  }

  .login-toast.show {
    transform: translateY(0);
  }
}

body.dark .login-toast.error{
  background:rgba(220,53,69,.12);
  border-color:rgba(220,53,69,.35);
  color:#ff8f9a;
}

body.dark .login-toast.error ion-icon{
  color:#ff8f9a;
}
 
/* ===========================================
   DARK MODE — dark mode toggle (mesmo padrão do inbox)
   =========================================== */
.login-dark-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--inbox-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background .15s;
}
 
.login-dark-btn:hover {
  background: var(--inbox-border);
}
 
.login-dark-btn ion-icon {
  font-size: 20px;
}
 
.icon-sun { display: block; }
.icon-moon { display: none; }
body.dark .icon-sun { display: none; }
body.dark .icon-moon { display: block; }
 
/* Spin */
@keyframes spin {
  to { transform: rotate(360deg); }
}
 
.spin {
  animation: spin 1s linear infinite;
}
 
/* ===========================================
   RESPONSIVO
   =========================================== */
@media (max-width: 768px) {
  .login-left {
    display: none;
  }
 
  .login-right {
    width: 100%;
    max-width: 100vw;
    flex-shrink: 1;
    border-left: none;
    padding: 2rem 1.5rem;
    justify-content: center;
  }
 
  .login-dark-btn {
    top: 12px;
    right: 12px;
  }
}

/* ---------- Logout Button ---------- */
#app .icon-btn--danger {
  color: var(--inbox-text-muted) !important;
  transition: background 0.15s ease, color 0.15s ease !important;
}

#app .icon-btn--danger:hover {
  background: rgba(220, 53, 69, 0.1) !important;
  color: #dc3545 !important;
}

body.dark #app .icon-btn--danger:hover {
  background: rgba(220, 53, 69, 0.18) !important;
  color: #ff8f9a !important;
}