@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
/* Prevenir flash branco - aplicar tema antes de tudo */
html.dark,html.dark body{background:#0b1220 !important;color:#e8eefc}
/* Forçar modo escuro em todos os containers críticos */
html.dark .content,
html.dark .chat-list,
html.dark .chat-panel,
html.dark .chat-messages,
html.dark [class*="bg-white"]:not([class*="text-white"]):not(.btn-primary),
html.dark .tabs,
html.dark #chat-panel{background-color:#0f172a !important}
html.dark .chat-item{background-color:transparent}
html.dark .chat-item:hover{background-color:rgba(30,41,59,0.5)}
body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial,sans-serif;background:#fff;color:#111}
.theme{--bg:#ffffff;--text:#111111;--muted:#f5f5f5;--border:#eaeaea;--brand:#22c55e;--sidebar:#0b1220;--sidebar-text:#e8eefc}
.dark.theme{--bg:#0b1220;--text:#e8eefc;--muted:#0f172a;--border:#1e293b;--brand:#22c55e;--sidebar:#0b1220;--sidebar-text:#e8eefc}
.theme{background:var(--bg);color:var(--text)}
.theme{--text-muted:#6b7280}
.dark.theme{--text-muted:#94a3b8}
.theme{--fs-hero:28px;--fs-h2:22px;--fs-h3:18px;--fs-body:14px;--fs-small:12px;--lh:1.5;--fw-normal:400;--fw-medium:500;--fw-semibold:600;--fw-bold:700;--space-4:4px;--space-8:8px;--space-12:12px;--space-16:16px;--space-24:24px;--space-32:32px;--space-48:48px}
.content h1{font-size:var(--fs-hero);font-weight:var(--fw-bold);line-height:1.2;margin:0 0 var(--space-12)}
.content h2{font-size:var(--fs-h2);font-weight:var(--fw-semibold);line-height:1.3;margin:0 0 var(--space-12)}
.content h3{font-size:var(--fs-h3);font-weight:var(--fw-semibold);line-height:1.3;margin:var(--space-12) 0}
.content p, .content li, .content label{font-size:var(--fs-body);line-height:var(--lh)}
.text-muted{color:var(--text-muted)}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #eee}
.topbar.hidden{display:none}
.nav a{margin-right:12px;text-decoration:none;color:#111}
.nav a:last-child{margin-right:0}
.content{padding:var(--space-16);flex:1;min-width:0;overflow-y:auto;height:100vh;box-sizing:border-box}
.app{display:flex;height:100vh;overflow:hidden}
html,body{height:100%;overflow:hidden;margin:0}
/* Sidebar - Collapsible */
.sidebar {
  width: 72px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
  z-index: 40;
}

.sidebar.expanded {
  width: 240px;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0 4px;
  min-height: 36px;
}

/* Sidebar hover expand - automatically expands on hover */
.sidebar {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover {
  width: 240px;
}

.sidebar:hover .sidebar-text,
.sidebar:hover .sidebar-brand-text {
  opacity: 1;
  transform: translateX(0);
}

.sidebar:hover .sidebar-version {
  text-align: left;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.sidebar-brand img {
  flex-shrink: 0;
  width: 56px;
  height: 32px;
  object-fit: contain;
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar.expanded .sidebar-brand-text {
  opacity: 1;
  transform: translateX(0);
}

/* Sidebar Toggle Button - Hidden, using hover instead */
.sidebar-toggle {
  display: none;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.sidebar-toggle-collapse {
  display: none;
}

.sidebar-toggle-expand {
  display: block;
}

.sidebar.expanded .sidebar-toggle-collapse {
  display: block;
}

.sidebar.expanded .sidebar-toggle-expand {
  display: none;
}


/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-right: -4px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* Sidebar Link */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 14px;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-link.active {
  background: rgba(255,255,255,0.1);
}

/* Sidebar Icon */
.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

/* Sidebar Text */
.sidebar-text {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.expanded .sidebar-text {
  opacity: 1;
  transform: translateX(0);
}

/* Sidebar Footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-version {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
  padding: 0 12px;
}

.sidebar.expanded .sidebar-version {
  text-align: left;
}

/* Sidebar Profile Button */
.sidebar-profile {
  font-family: inherit;
}

/* Sidebar link active indicator */
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

/* Sidebar hover expand effect (optional - uncomment if needed) */
/*
.sidebar:hover {
  width: 240px;
}
.sidebar:hover .sidebar-text,
.sidebar:hover .sidebar-brand-text {
  opacity: 1;
  transform: translateX(0);
}
*/

/* Adjust content when sidebar is expanded */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.user{color:var(--sidebar-text)}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:var(--space-12);margin-top:var(--space-12)}
.card{border:1px solid var(--border);border-radius:12px;padding:16px;background:var(--bg);box-shadow:0 1px 2px rgba(0,0,0,0.06)}
.card:hover{box-shadow:0 2px 6px rgba(0,0,0,0.08)}
.card-title{font-size:12px;color:var(--text-muted);letter-spacing:.02em}
.card-value{font-size:26px;font-weight:600}
.card-row{display:flex;align-items:center;justify-content:space-between}
.card-meta{font-size:12px;color:var(--text-muted)}
.card-metric{display:flex;flex-direction:column;gap:6px}
.table{width:100%;border-collapse:collapse;margin-top:12px}
.table th,.table td{border:1px solid var(--border);padding:12px;text-align:left}
.table thead th{background:var(--muted);font-weight:600}
.table tbody tr:nth-child(odd){background:rgba(0,0,0,0.02)}
.table tr:hover{background:var(--muted)}
.filters{display:flex;gap:8px;margin-top:8px}
.filters input,.filters select,.filters button{padding:6px}
.pagination{display:flex;gap:8px;margin-top:12px;align-items:center}
.kanban{display:flex;gap:var(--space-16);overflow-x:auto;overflow-y:hidden;height:100%;padding-bottom:16px}
.kanban-col{width:340px;flex-shrink:0;border:1px solid var(--border);border-radius:12px;background:var(--muted);box-shadow:0 1px 3px rgba(0,0,0,0.06);display:flex;flex-direction:column;height:100%}
.kanban-col-head{padding:14px 16px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;background:var(--bg);border-radius:12px 12px 0 0;flex-shrink:0}
.kanban-col-body{padding:12px;display:flex;flex-direction:column;gap:12px;flex:1;overflow-y:auto;min-height:0}
.kanban-col-body.drag-over{background:rgba(34,197,94,0.1);border:2px dashed var(--brand)}
.deal{border:1px solid var(--border);border-radius:12px;padding:0;background:var(--bg);box-shadow:0 1px 3px rgba(0,0,0,0.05);cursor:grab;transition:transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease}
.deal:hover{box-shadow:0 4px 12px rgba(0,0,0,0.1);transform:translateY(-2px)}
.deal:active{cursor:grabbing}
.deal.dragging{opacity:0.4;transform:scale(1.02) rotate(1deg);box-shadow:0 8px 24px rgba(0,0,0,0.15);z-index:100}
.deal-title{font-weight:600;margin-bottom:4px}
.deal-meta{font-size:12px;color:var(--text-muted)}
.empty{padding:32px;color:var(--text-muted);text-align:center;font-size:14px}
/* Line clamp utilities */
.line-clamp-1{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.line-clamp-3{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.btn-sm{padding:6px 12px;font-size:13px}
.inline-form{display:flex;gap:6px;align-items:center;margin-top:6px}
.chat{display:flex;flex-direction:column;height:calc(100vh - 120px);border:1px solid var(--border);border-radius:12px;overflow:hidden}
.chat-header{display:flex;align-items:center;gap:12px;padding:12px;border-bottom:1px solid var(--border);background:var(--muted)}
.chat-header .avatar{width:36px;height:36px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600}
.chat-header .info .title{font-weight:600}
.chat-header .info .subtitle{font-size:12px;color:var(--text-muted)}
.chat-messages{flex:1;overflow:auto;padding:16px;display:flex;flex-direction:column;gap:8px;background:linear-gradient(180deg, rgba(0,0,0,0.02), transparent)}
.bubble{max-width:70%;display:flex;flex-direction:column;gap:4px}
.bubble.me{align-self:flex-end}
.bubble.them{align-self:flex-start}
.bubble .text{border:1px solid var(--border);border-radius:12px;padding:10px;background:var(--bg)}
.bubble.me .text{background:#dcfce7;border-color:#bbf7d0}
.bubble.them .text{background:#fff;border-color:var(--border)}
.bubble .meta{font-size:12px;color:var(--text-muted);padding:0 6px}
.composer{display:flex;gap:8px;align-items:center;padding:12px;border-top:1px solid var(--border);background:var(--muted)}
.composer textarea{flex:1;min-height:44px;max-height:120px;resize:vertical}
.form input,.form select,.form textarea{border:1px solid var(--border);padding:10px;border-radius:8px;background:var(--bg);color:var(--text)}
.form button{padding:10px 12px;border-radius:8px;border:1px solid var(--border);background:var(--muted);color:var(--text)}
.form button.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.form label{font-size:12px;color:#666;margin-bottom:4px}
.form{display:flex;flex-direction:column;gap:8px;max-width:400px;width:100%;margin-top:8px}
.form input,.form select,.form button{padding:8px}
.auth.split{display:grid;grid-template-columns:1fr 1fr;min-height:100vh;height:100vh;overflow:hidden}
.auth-left{background:#0b1220;color:#e8eefc;padding:48px;display:flex;flex-direction:column;justify-content:center;align-items:flex-start}
.auth-left .brand{font-weight:700;margin-bottom:24px;font-size:20px}
.auth-left h1{font-size:var(--fs-hero);font-weight:var(--fw-bold);margin:0 0 var(--space-8)}
.auth-left p{color:var(--text-muted);margin:0 0 var(--space-16)}
.features{list-style:none;padding:0;margin:var(--space-24) 0 0}
.features li{margin:var(--space-8) 0;padding-left:24px;position:relative}
.features li:before{content:"✓";position:absolute;left:0;color:var(--brand)}
.auth-right{padding:var(--space-48);display:flex;flex-direction:column;justify-content:center;align-items:center;background:var(--bg);overflow-y:auto}
.auth-right > div{width:100%;max-width:400px}
.auth-right h2{font-size:var(--fs-h2);font-weight:var(--fw-semibold);margin:0 0 var(--space-16);text-align:left}
.auth-right p{margin-top:16px;text-align:center;color:var(--text-muted)}
.auth-right p a{color:var(--brand);text-decoration:none}
.auth-right p a:hover{text-decoration:underline}
.row{display:flex;justify-content:flex-end;margin:var(--space-8) 0}
.row-2{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-8)}
.btn{display:inline-flex;align-items:center;justify-content:center;padding:10px 12px;border-radius:10px;border:1px solid var(--border);background:var(--muted);color:var(--text);text-decoration:none;cursor:pointer;transition:transform .12s ease, box-shadow .12s ease}
.btn:hover{filter:brightness(0.98);transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,0.06)}
.btn-primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn-outline{background:transparent;border-color:var(--border)}
.btn-ghost{background:transparent;border-color:transparent}
/* Mobile Navigation - WhatsApp Style */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(0,0,0,0.08);
  box-shadow: 
    0 -2px 8px rgba(0,0,0,0.06),
    0 -1px 0 rgba(0,0,0,0.05);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  gap: 0;
  border-radius: 0;
  z-index: 50;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
}

.dark .mobile-nav {
  background: rgba(15,23,42,0.98);
  border-top-color: rgba(255,255,255,0.1);
  box-shadow: 
    0 -2px 8px rgba(0,0,0,0.3),
    0 -1px 0 rgba(255,255,255,0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 0;
  color: #64748b;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  position: relative;
  max-width: 100px;
}

.dark .mobile-nav-item {
  color: #94a3b8;
}

.mobile-nav-item:active {
  transform: scale(0.95);
  opacity: 0.7;
}

.mobile-nav-item:hover:not(.active) {
  color: #334155;
  background: transparent;
}

.dark .mobile-nav-item:hover:not(.active) {
  color: #e2e8f0;
  background: transparent;
}

.mobile-nav-item.active {
  background: transparent;
  color: var(--primary-color, #22c55e);
  box-shadow: none;
  transform: none;
}

.dark .mobile-nav-item.active {
  color: var(--primary-color, #22c55e);
  box-shadow: none;
}

.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color, #22c55e);
  border-radius: 0;
}

.mobile-nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  transition: all 0.2s ease;
}

.mobile-nav-item.active svg {
  transform: none;
  color: var(--primary-color, #22c55e);
}

.mobile-nav-item span {
  transition: opacity 0.2s ease;
}

.mobile-nav-item .mobile-nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.mobile-nav-item:hover .mobile-nav-avatar {
  border-color: rgba(100,116,139,0.3);
}

.mobile-nav-item.active .mobile-nav-avatar {
  border-color: var(--primary-color, #22c55e);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

/* Indicator dot for notifications */
.mobile-nav-item[data-badge]::after {
  content: attr(data-badge);
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(239,68,68,0.4);
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@media (max-width: 1024px) {
  .grid.lg\:grid-cols-\[380px_1fr_320px\] {
    grid-template-columns: 380px 1fr;
  }
  #contact-info-panel {
    display: none !important;
  }
  .sidebar {
    display: none !important;
  }
  .content {
    padding: 12px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  .mobile-nav {
    display: flex;
  }
  .app {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  html, body {
    overflow: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  /* Garantir que badges não sejam cortados no mobile */
  .chat-item {
    overflow: visible !important;
    padding-bottom: 22px !important;
    min-height: auto !important;
    position: relative;
    margin-bottom: 0 !important;
  }
  .chat-item-body {
    overflow: visible !important;
  }
  .chat-list {
    overflow-x: visible !important;
    overflow-y: auto !important;
    padding-bottom: 16px !important;
  }
  /* Aumentar espaço para badges quando quebram linha */
  .chat-item-body > div:last-child {
    margin-bottom: 0 !important;
  }
  /* Forçar padding extra para cards com badges */
  .chat-item:has(> .chat-item-body > div:last-child .flex-wrap) {
    padding-bottom: 24px !important;
  }
}

/* Desktop: Show sidebar toggle on hover or when expanded */
@media (min-width: 1025px) {
  .sidebar {
    display: flex !important;
  }
}

/* Compact mobile nav for very small screens */
@media (max-width: 380px) {
  .mobile-nav {
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-nav-item {
    padding: 6px 8px;
    gap: 3px;
  }
  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }
  .mobile-nav-item span {
    font-size: 9px;
  }
}
@media (max-width: 800px){
  .grid.lg\:grid-cols-\[380px_1fr_320px\]{grid-template-columns:1fr}
  .auth.split{grid-template-columns:1fr;min-height:100vh}
  .auth-left{display:none}
  .auth-right{padding:32px 24px;justify-content:flex-start;padding-top:48px}
}

/* Mobile optimizations for titles and content */
@media (max-width: 768px) {
  /* Reduce page titles on mobile */
  .content h1,
  .content h1.text-2xl,
  .content .text-2xl.font-bold {
    font-size: 18px !important;
    line-height: 1.3;
  }
  
  /* Hide subtitles on mobile to save space */
  .content h1 + p.text-sm,
  .content h1 + p.text-slate-600,
  .content .text-2xl + p.text-sm {
    display: none;
  }
  
  /* Reduce padding on mobile */
  .content {
    padding: 12px;
  }
  
  /* Compact header area */
  .content > div:first-child {
    margin-bottom: 8px !important;
  }
  
  /* Make tabs more compact */
  .tabs {
    gap: 4px;
  }
  
  .tabs .tab,
  .tab {
    padding: 6px 8px;
    font-size: 11px;
  }
  
  .tabs .badge,
  .tab .badge {
    padding: 1px 4px;
    font-size: 9px;
  }
  
  /* Fix grid height on mobile */
  .h-\[calc\(100vh-140px\)\] {
    height: calc(100vh - 100px) !important;
  }
  
  /* Reduce chat list padding and optimize space */
  .chat-list {
    max-height: calc(100vh - 200px);
  }
  
  /* Compact search area */
  .p-4.border-b {
    padding: 10px !important;
  }
  
  /* Compact tabs area */
  .tabs.grid-cols-3 {
    margin-bottom: 8px !important;
  }
  
  /* Compact conversation items */
  .chat-item {
    padding: 10px;
    min-height: 70px;
  }
  
  .chat-item .avatar {
    width: 36px;
    height: 36px;
  }
  
  .chat-item-head .name {
    font-size: 13px;
  }
  
  .chat-item-meta .preview {
    font-size: 11px;
    -webkit-line-clamp: 1;
  }
  
  /* Smaller tags */
  .chat-item .text-\[10px\] {
    font-size: 9px !important;
    padding: 2px 4px;
  }
  
  /* Smaller icons in tags */
  .chat-item .w-2\.5 {
    width: 8px !important;
    height: 8px !important;
  }
  
  /* Chat panel optimizations */
  .chat-header {
    padding: 10px 12px;
  }
  
  .chat-header .avatar {
    width: 36px;
    height: 36px;
  }
  
  /* Composer optimizations */
  .composer {
    padding: 8px 10px;
  }
  
  /* Back button more prominent on mobile */
  .chat-header a.lg\\:hidden {
    padding: 8px;
  }
  
  /* Always show close button on mobile (no hover) */
  .btn-close-conv {
    opacity: 1;
  }
  
  /* Hide mobile nav when conversation is open */
  body.conversation-open .mobile-nav {
    display: none !important;
  }
  
  /* Adjust content padding when conversation is open (no nav) */
  body.conversation-open .content {
    padding-bottom: 12px;
  }
  
  /* Garantir largura total no mobile */
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .app, .content {
    width: 100%;
    max-width: 100%;
  }
  
  /* Remover margens e padding do grid de inbox no mobile */
  #inbox-grid {
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Remover border e rounded do container de conversas no mobile */
  #inbox-grid > div {
    border-radius: 0 !important;
    border: none !important;
  }
  
  /* Cards de conversa ocupam toda largura no mobile */
  .chat-item {
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin: 0 !important;
  }
  
  /* Chat list sem margens no mobile */
  .chat-list {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Chat panel sem border e rounded no mobile */
  #chat-panel {
    border-radius: 0 !important;
    border: none !important;
  }
  
  /* Garantir que o conteúdo ocupe toda largura na inbox */
  /* O padding do content será removido apenas para a inbox */
  body:has(#inbox-grid) .content {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* Ajustar padding do header da lista de conversas */
  #inbox-grid > div:first-child > div:first-child {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  /* Mobile composer optimizations */
  .composer {
    gap: 8px;
    padding: 8px 10px !important;
  }
  
  .composer textarea {
    min-height: 40px !important;
    font-size: 16px !important; /* Prevent iOS zoom on focus */
  }
  
  /* Mobile composer menu animation */
  #mobile-composer-menu {
    animation: slideUp 0.15s ease-out;
  }
  
  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
.flow-editor{display:grid;grid-template-columns:300px 1fr;gap:16px;margin-top:16px}
.flow-sidebar{display:flex;flex-direction:column;gap:16px}
.flow-nodes-list,.flow-edges-list{display:flex;flex-direction:column;gap:8px}
.flow-node-item,.flow-edge-item{display:flex;align-items:center;justify-content:space-between}
.flow-node-item summary{cursor:pointer;font-weight:600}
.flow-node-edit{margin-top:8px;display:flex;flex-direction:column;gap:8px}
.flow-node-edit .form textarea{min-height:80px}
.flow-canvas{position:relative;min-height:480px;border:1px dashed var(--border);border-radius:12px;background:var(--bg)}
.flow-node{position:absolute;width:160px;border:1px solid var(--border);border-radius:10px;background:var(--bg);box-shadow:0 1px 2px rgba(0,0,0,0.04)}
.flow-node-head{padding:8px;border-bottom:1px solid var(--border);font-weight:600}
.flow-node-body{padding:8px}

.chat-list-actions{display:flex;gap:8px;align-items:center;margin-top:8px}
.tabs{display:flex;gap:8px;margin-top:8px}
.tab{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;color:inherit;text-decoration:none;background:var(--bg)}
.tab .badge{background:var(--muted);border:1px solid var(--border);border-radius:999px;padding:2px 8px;font-size:12px}
.tab.active{border-color:var(--brand)}
.tab svg{width:18px;height:18px}
.chat-list{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.chat-item{display:flex;gap:12px;align-items:center;padding:10px;border:1px solid var(--border);border-radius:12px;background:var(--bg);text-decoration:none;color:inherit}
.chat-item:hover{box-shadow:0 2px 6px rgba(0,0,0,0.06)}
.chat-item .avatar{width:36px;height:36px;border-radius:50%;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600}
.chat-item-body{display:flex;flex-direction:column;gap:4px;flex:1}
.chat-item-head{display:flex;align-items:center;justify-content:space-between}
.chat-item-head .name{font-weight:600}
.chat-item-head .time{font-size:12px;color:var(--text-muted)}
.chat-item-meta{display:flex;align-items:center;justify-content:space-between}
.chat-item-meta .preview{color:var(--text-muted)}
.chat-item-meta .status{font-size:12px;color:var(--text-muted)}
.chat-item.selected{background:rgba(34,197,94,0.05);border-left:4px solid var(--brand)}
.bubble.me .text{background:linear-gradient(135deg, #22c55e 0%, #16a34a 100%);color:#fff;border:none}
.bubble.them .text{background:#fff;border:1px solid var(--border);box-shadow:0 1px 2px rgba(0,0,0,0.05)}
.composer textarea:focus{outline:none;ring:2px;ring-color:var(--brand)}
.tab.active{background:var(--muted);font-weight:600}

/* Toast Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

/* Profile Sidebar */
#profile-sidebar-content {
  max-height: 100vh;
  overflow-y: auto;
}

#profile-sidebar-content::-webkit-scrollbar {
  width: 6px;
}

#profile-sidebar-content::-webkit-scrollbar-track {
  background: #f1f5f9;
}

#profile-sidebar-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#profile-sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Composer buttons */
.composer .btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.composer .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer .btn svg {
  pointer-events: none;
}

/* Emoji Picker */
#emoji-picker {
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
}

#emoji-picker .emoji-item {
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}

#emoji-picker .emoji-item:active {
  transform: scale(0.95);
}

/* File preview */
#file-preview {
  animation: fadeIn 0.2s ease;
}

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

.animate-fade-in {
  animation: fadeIn 0.15s ease-out;
}

/* Chat item improvements */
.chat-list {
  gap: 0;
  margin-top: 0;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.chat-item {
  padding: 12px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s ease;
  /* Mobile touch optimization - removes 300ms tap delay */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  /* Ensure pointer events work correctly */
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* Make all child elements pass clicks through to the link */
.chat-item * {
  pointer-events: none;
}

/* Re-enable pointer events only for interactive elements */
.chat-item .btn-close-conv {
  pointer-events: auto;
}

/* Active state for better mobile feedback */
.chat-item:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark .chat-item:active {
  background-color: rgba(255, 255, 255, 0.05);
}

.chat-item:hover {
  box-shadow: none;
}

.chat-item:hover .btn-close-conv {
  opacity: 1;
}

.btn-close-conv {
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Note: .btn-close-conv opacity:1 moved to main mobile media query above */

.chat-item .avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.chat-item-head .name {
  font-size: 14px;
}

.chat-item-meta .preview {
  font-size: 12px;
  line-height: 1.4;
}

/* Loading states */
.loading-spinner {
  animation: spin 1s linear infinite;
}

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

/* Better scrollbar for chat list */
.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
}

.chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.2);
}

.dark .chat-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
}

.dark .chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* Error state */
.error-state {
  animation: fadeIn 0.3s ease;
}

/* Chat panel loading */
#chat-panel .animate-spin {
  animation: spin 1s linear infinite;
}

/* Drag & Drop Overlay */
#drop-overlay {
  animation: fadeIn 0.15s ease;
  cursor: copy;
}

#drop-overlay > div {
  animation: bounceIn 0.25s ease;
  transform-origin: center;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* File toast animation */
#file-toast {
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  0% {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Message Actions (Edit/Delete) */
.bubble.me {
  position: relative;
}

.bubble.me .message-actions {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

/* Mostrar botões quando hover no bubble */
.bubble.me:hover .message-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Manter visível quando hover nos botões (via JavaScript) */
.bubble.me .message-actions.show-actions {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.message-actions button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dark .message-actions button {
  background: #334155;
  border-color: #475569;
}

.message-actions button:hover {
  transform: scale(1.1);
}

.msg-edit-btn:hover {
  background: #f0fdf4;
  border-color: #86efac;
}

.dark .msg-edit-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.msg-delete-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.msg-delete-btn:hover i {
  color: #ef4444 !important;
}

.dark .msg-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

/* Deleted message style */
.bubble .deleted-message {
  font-style: italic;
  opacity: 0.6;
}

/* Toast for message actions */
#msg-action-toast {
  animation: slideUp 0.3s ease;
}

/* Esconder sidebar de perfil durante carregamento para evitar flash */
#profile-sidebar.translate-x-full {
  visibility: hidden;
}
#profile-sidebar:not(.translate-x-full) {
  visibility: visible;
}

/* Kanban - modo escuro */
html.dark .kanban-col,
.dark .kanban-col,
.dark.theme .kanban-col { 
  background-color: #0f172a !important; 
  border-color: #1e293b !important; 
}
html.dark .kanban-col-head,
.dark .kanban-col-head,
.dark.theme .kanban-col-head { 
  background-color: #0b1220 !important; 
  border-color: #1e293b !important;
}
html.dark .kanban-col-body,
.dark .kanban-col-body,
.dark.theme .kanban-col-body { 
  background-color: #0f172a !important; 
}
html.dark .deal,
.dark .deal,
.dark.theme .deal { 
  background-color: #1e293b !important; 
  border-color: #334155 !important; 
}
