/* ═══════════════════════════════════════════
   AGILITY PROSPECT WEB — Design System
   Tokens via tokens.css (unica fonte de verdade)
   ═══════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─────────────────────────────── */
#topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 50;
  gap: 16px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Country Toggle */
.country-switch {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  gap: 0;
}
.country-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}
.country-btn:hover {
  background: var(--surface-2);
}
.country-btn.active {
  background: var(--accent);
  color: #fff;
}
.country-switch-locked .country-btn:not(.active) {
  opacity: .45;
  cursor: not-allowed;
}
.country-switch-locked .country-btn:not(.active):hover {
  background: transparent;
}
.country-flag {
  font-size: 14px;
  line-height: 1;
}
.country-label {
  letter-spacing: 0.3px;
}
.topbar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}
.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.topbar-subtitle {
  font-size: 10px;
  color: var(--text2);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.lang-switch {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border-radius: 6px;
  padding: 2px;
}
.lang-switch button {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
}
.lang-switch button.act {
  background: var(--accent);
  color: #fff;
}

.theme-toggle-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.theme-toggle-btn:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  color: var(--accent);
}
.theme-toggle-btn .theme-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}
:root.light-theme .theme-toggle-btn .moon-icon {
  display: block;
}
:root.light-theme .theme-toggle-btn .sun-icon {
  display: none;
}
.theme-toggle-btn .moon-icon {
  display: none;
}
.theme-toggle-btn .sun-icon {
  display: block;
}

/* ─── Layout ─────────────────────────────── */
#appContent {
  flex: 1;
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
  background: var(--bg);
}

/* ─── Sidebar (rail flutuante) ───────────────
   Layout inspirado no rail do Alvanto: painel arredondado solto da borda,
   navegacao em cartao interno, item ativo em gradiente da cor de marca. */
#sidebar {
  width: 264px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px;
  gap: 8px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
#sidebar.collapsed {
  width: 72px;
}
#sidebar.collapsed .nav-label,
#sidebar.collapsed .nb {
  display: none;
}
.sidebar-header {
  height: 48px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: none;
  overflow: hidden;
}
.sidebar-logo {
  height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}
/* Controle de visibilidade do logotipo com base no tema ativo */
.light-logo-img {
  display: none !important;
}
.dark-logo-img {
  display: block !important;
}

.light-theme .light-logo-img,
:root.light-theme .light-logo-img {
  display: block !important;
}
.light-theme .dark-logo-img,
:root.light-theme .dark-logo-img {
  display: none !important;
}
#sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}
#sidebar.collapsed .sidebar-logo {
  width: 40px;
  height: 36px;
  object-position: left center;
}
.sidebar-collapse-btn {
  position: static;
  transform: none;
  margin-top: auto;
  flex: none;
  align-self: stretch;
  height: 44px;
  background: var(--surface2);
  border: 0;
  color: var(--text2);
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.sidebar-collapse-btn:hover {
  color: var(--text);
  background: var(--surface3);
}
#sidebar nav {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface2);
  border-radius: 16px;
}
#sidebar nav .ni {
  padding: 0 10px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 14px;
  transition: var(--transition);
  border-radius: 14px;
  min-width: 0;
  position: relative;
}
#sidebar nav .ni .nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#sidebar nav .ni .nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sidebar nav .ni .search-acronym {
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  color: var(--accent2);
  font-size: 10px;
  font-weight: 600;
}
#sidebar nav .ni:hover {
  color: var(--text);
  background: var(--surface3);
}
#sidebar nav .ni.act,
#sidebar nav .ni.act:hover {
  color: #fff;
  background: linear-gradient(135deg, #0a7e94, #0b6174 64%, #0a4a5a);
}
#sidebar nav .ni .nb {
  margin-left: auto;
  font-size: 10px;
  color: var(--text2);
  background: var(--surface3);
  padding: 2px 6px;
  border-radius: 10px;
}
#sidebar nav .ni.act .nb {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}
#sidebar nav .ni.all {
  font-weight: 600;
}

/* ─── Main ───────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 22px;
}

/* ─── Search bar ─────────────────────────── */
#searchBar {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-shrink: 0;
}
#searchFields {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
#searchFields input, #searchFields select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  min-width: 0;
}
#searchFields input:focus, #searchFields select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#searchFields .in-niche { flex: 2; }
#searchFields .in-state { flex: 2; }
#searchFields .in-city { flex: 1; }
#searchFields .in-max { width: 70px; text-align: center; }
#searchActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Buttons ────────────────────────────── */
.btn {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn1 {
  background: var(--accent);
  color: #fff;
}
.btn1:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn2 {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn2:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-hover);
}
.btn3 {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--danger);
}
.btn3:hover {
  background: var(--danger-subtle);
}
.sp {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Queue ──────────────────────────────── */
#queuePanel {
  display: none;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  /* A rolagem saiu do #b2bSearchView (ela recortava o dropdown de estado/cidade,
     que e position:absolute) e veio para ca, que e a unica parte da tela cuja
     altura varia. Sem isso, uma fila longa ficaria cortada por #main, que e
     overflow:hidden e nao rola. */
  max-height: 40vh;
  overflow-y: auto;
}
#queuePanel h4 {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 8px;
}
#queueList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}
.q-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.q-item span { flex: 1; }
.q-item button {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}
.q-item button:hover {
  color: var(--red);
  background: var(--danger-subtle);
}

/* ─── Filter ─────────────────────────────── */
#filterBar {
  padding: 10px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#filterBar input,
#filterBar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
#filterBar input { flex: 1; }
#filterBar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
#filterBar select { min-width: 140px; cursor: pointer; }

/* ─── Stats ──────────────────────────────── */
#statsRow {
  padding: 14px 24px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.mstat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  flex: 1;
  min-width: 100px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.mstat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s;
}
.mstat:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.mstat:hover::before { opacity: 1; }
.mstat .lb {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.mstat .vl {
  font-size: 22px;
  font-weight: 600;
  margin: 2px 0;
}
.mstat .sb {
  font-size: 10px;
  color: var(--text2);
}

/* ─── Table ──────────────────────────────── */
#tableSection {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  padding: 0 16px 14px;
}
#tableHdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}
#tableHdr h2 { font-size: 14px; font-weight: 600; }
#tableHdr .tact { display: flex; gap: 6px; }
#tableWrapper {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
#dataTable {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

/* Larguras específicas para cada coluna da tabela de leads */
#dataTable th:nth-child(1), #dataTable td:nth-child(1) {
  width: 36px;
  min-width: 36px;
  text-align: center;
}
#dataTable th:nth-child(2), #dataTable td:nth-child(2) {
  width: 100px;
  min-width: 100px;
  text-align: center;
}
#dataTable td:nth-child(2) .btn {
  padding: 4px 6px !important;
  font-size: 10px !important;
  min-width: auto !important;
  margin: 0 !important;
}
#dataTable td:nth-child(2) svg {
  width: 13px;
  height: 13px;
}
#dataTable th:nth-child(3), #dataTable td:nth-child(3) {
  width: 30px;
  min-width: 30px;
  text-align: center;
}
#dataTable th:nth-child(4), #dataTable td:nth-child(4) {
  min-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dataTable th:nth-child(5), #dataTable td:nth-child(5) {
  min-width: 85px;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dataTable th:nth-child(6), #dataTable td:nth-child(6) {
  width: 50px;
  min-width: 50px;
  text-align: center;
}
#dataTable th:nth-child(7), #dataTable td:nth-child(7) {
  width: 50px;
  min-width: 50px;
  text-align: center;
}
#dataTable th:nth-child(8), #dataTable td:nth-child(8) {
  min-width: 105px;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dataTable th:nth-child(9), #dataTable td:nth-child(9) {
  width: 52px;
  min-width: 52px;
  text-align: center;
}
#dataTable th:nth-child(10), #dataTable td:nth-child(10) {
  width: 60px;
  min-width: 60px;
  text-align: center;
}
#dataTable th:nth-child(11), #dataTable td:nth-child(11) {
  width: 62px;
  min-width: 62px;
  text-align: center;
}
#dataTable th:nth-child(12), #dataTable td:nth-child(12) {
  width: 55px;
  min-width: 55px;
  text-align: center;
}
#dataTable th:nth-child(13), #dataTable td:nth-child(13) {
  width: 65px;
  min-width: 65px;
  text-align: center;
}
#dataTable th:nth-child(14), #dataTable td:nth-child(14) {
  min-width: 130px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dataTable th:nth-child(15), #dataTable td:nth-child(15) {
  min-width: 120px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dataTable th:nth-child(16), #dataTable td:nth-child(16) {
  width: 60px;
  min-width: 60px;
  text-align: center;
}
#dataTable th:nth-child(17), #dataTable td:nth-child(17) {
  width: 90px;
  min-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dataTable thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
#dataTable th {
  background: var(--surface2);
  color: var(--text2);
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
#dataTable td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
#dataTable tbody tr {
  transition: var(--transition);
  cursor: pointer;
}
#dataTable tbody tr:hover {
  background: var(--surface2);
}
#dataTable a {
  color: var(--accent2);
  text-decoration: none;
  transition: var(--transition);
}
#dataTable a:hover { color: var(--accent); }
#dataTable .rate {
  color: var(--yellow);
  font-weight: 600;
}

/* ─── Terminal ───────────────────────────── */
#tdr {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
#tdr .tog {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
#tdr .tog:hover { color: var(--text); background: var(--border); }
#tdr .cnt {
  max-height: 200px;
  overflow-y: auto;
  padding: 16px 20px;
  display: none;
}
#tdr .cnt.v { display: block; }
#tdr pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--success);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ─── Toast ──────────────────────────────── */
#toastContainer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  width: 100vw;
  max-width: 420px;
}
.toast {
  pointer-events: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 18px 28px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-pop);
  animation: toastPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Tipos de Feedback com Toques de Neon Premium */
.toasts { 
  border: 1px solid var(--success) !important; 
  box-shadow: var(--shadow-pop);
}
.toaste { 
  border: 1px solid var(--danger) !important; 
  box-shadow: var(--shadow-pop);
}
.toastw { 
  border: 1px solid var(--warning) !important; 
  box-shadow: var(--shadow-pop);
}
.toasti { 
  border: 1px solid var(--accent) !important; 
  box-shadow: var(--shadow-pop);
}

.toast-prospecting {
  border: 1px solid var(--accent-glow) !important;
  box-shadow: var(--shadow-pop);
  padding: 24px 32px;
}
.toast-prospecting strong {
  color: var(--accent2) !important;
}
.toast-link {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  border-radius: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.toast-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastCenterIn {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes toastPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── Empty State ────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text2);
}
.empty .ic {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.25;
}

/* ─── Splash ─────────────────────────────── */
#splash {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash img {
  width: 180px;
  height: 180px;
  margin-bottom: 24px;
  animation: pulse 2.5s infinite;
  object-fit: contain;
  filter: drop-shadow(0 0 40px var(--accent-glow));
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}
#splash .loader {
  width: 80px;
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
}
#splash .loader::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: loading 1.2s ease infinite;
}
@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
#splash .brand-text {
  color: var(--text2);
  font-size: 12px;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-top: -4px;
  margin-bottom: 24px;
  opacity: 0.4;
}

/* ─── Dashboard ──────────────────────────── */
#dashboardView {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
#dashboardView.v {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#dashboardView .dashboard-header {
  margin-bottom: 4px;
}
#dashboardView .dashboard-header h2 {
  font-size: var(--fs-page);
  font-weight: 600;
  line-height: var(--lh-title);
  letter-spacing: -0.011em;
  margin: 0;
  color: var(--text-1);
}
#dashboardView .dashboard-header p {
  font-size: var(--fs-meta);
  color: var(--text-2);
  margin: 4px 0 0 0;
}
#dashboardView .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
#dashboardView .kpi-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
#dashboardView .kpi-card:hover {
  border-color: var(--accent);
}
#dashboardView .kpi-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#dashboardView .kpi-card .card-title {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-2);
}
#dashboardView .kpi-card .card-value {
  font-size: var(--fs-kpi);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.1;
  margin-top: 4px;
}
#dashboardView .kpi-card .card-progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  margin-top: 8px;
  overflow: hidden;
}
#dashboardView .kpi-card .card-progress-fill {
  height: 100%;
  border-radius: var(--r-sm);
  transition: width 0.8s ease;
}
#dashboardView .kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-2);
}
#dashboardView .two-col-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 1100px) {
  #dashboardView .two-col-layout {
    grid-template-columns: 1fr;
  }
}
#dashboardView .section-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#dashboardView .section-card h3 {
  font-size: var(--fs-section);
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Card do Kanban no dashboard ───────────────────────────────
   Cada etapa e uma linha em duas faixas: rotulo+numeros em cima,
   barra de proporcao ocupando a largura toda embaixo. A barra antes
   tinha 60px fixos, o que a tornava ilegivel — 8 de 121 virava um
   ponto — e ainda deixava um vazio no meio da linha. Em largura
   total ela finalmente comunica proporcao, e o layout nao precisa
   de breakpoint: funciona igual no card estreito do celular e na
   coluna larga do desktop. */
#dashboardView .dash-metric-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#dashboardView .dash-metric-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "dot name value"
    "bar bar  bar";
  align-items: center;
  gap: 6px 8px;
  width: 100%;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background var(--transition);
}
#dashboardView .dash-metric-row:hover,
#dashboardView .dash-metric-row:focus-visible {
  background: var(--surface-3);
}
/* ─── Card de Categorias: rosca + legenda ranqueada ─────────────────
   O anel so pode existir porque as fatias somam 100%: as 5 maiores mais
   "Outras". Sem o "Outras" seria um top-N desenhado como parte-de-um-todo,
   que e uma mentira de forma. O total vai no centro, onde o buraco da rosca
   costuma ser desperdicado. */
#dashboardView .dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
#dashboardView .dash-donut {
  position: relative;
  width: 132px;
  height: 132px;
  flex-shrink: 0;
}
#dashboardView .dash-donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);   /* comeca no topo, nao as 3 horas */
}
#dashboardView .dash-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
}
#dashboardView .dash-donut-total {
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.011em;
}
#dashboardView .dash-donut-label {
  font-size: 11px;
  color: var(--text-3);
}
#dashboardView .dash-donut-legend {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#dashboardView .dash-donut-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--fs-meta);
}
#dashboardView .dash-donut-item .dash-metric-dot { flex-shrink: 0; }
#dashboardView .dash-donut-name {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dashboardView .dash-donut-n {
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
#dashboardView .dash-donut-pct {
  width: 34px;
  text-align: right;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ─── Card do Kanban: pipeline como parte-de-um-todo ────────────────
   Forma diferente do card de Categorias de proposito. Todo lead esta em
   exatamente uma raia, entao as raias somam 100% e cabem numa barra unica
   segmentada. Categorias e um top-N de um conjunto maior — nao soma 100% e
   por isso continua em barras ranqueadas, uma por linha. Formas diferentes
   porque os dados fazem trabalhos diferentes, nao por variedade. */
#dashboardView .dash-pipe-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
#dashboardView .dash-pipe-total {
  font-size: var(--fs-kpi);
  font-weight: 600;
  line-height: 1;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.011em;
}
#dashboardView .dash-pipe-total-label {
  font-size: var(--fs-meta);
  color: var(--text-3);
}
/* Os segmentos se separam por 2px da cor da superficie, nao por borda:
   borda adiciona tinta que nao e dado. */
#dashboardView .dash-pipe-track {
  display: flex;
  gap: 2px;
  height: 10px;
  margin-bottom: 14px;
  background: var(--surface-3);
  border-radius: 5px;
  overflow: hidden;
}
#dashboardView .dash-pipe-seg {
  height: 100%;
  min-width: 3px;
}
#dashboardView .dash-pipe-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
#dashboardView .dash-pipe-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 4px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background var(--transition);
}
#dashboardView .dash-pipe-item:hover,
#dashboardView .dash-pipe-item:focus-visible { background: var(--surface-3); }
#dashboardView .dash-pipe-item .dash-metric-dot { flex-shrink: 0; }
#dashboardView .dash-pipe-label {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-meta);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dashboardView .dash-pipe-n {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
/* Raia vazia recua: o olho vai para onde ha leads. */
#dashboardView .dash-pipe-item.is-zero .dash-pipe-label,
#dashboardView .dash-pipe-item.is-zero .dash-pipe-n { color: var(--text-3); font-weight: 400; }
#dashboardView .dash-pipe-item.is-zero .dash-metric-dot { opacity: 0.45; }

/* Categorias sao leitura, nao navegacao: mesma anatomia, sem afordancia de
   clique — cursor de mao numa linha que nao leva a lugar nenhum e mentira. */
#dashboardView .dash-metric-row.is-static {
  cursor: default;
}
#dashboardView .dash-metric-row.is-static:hover {
  background: transparent;
}
#dashboardView .dash-metric-dot {
  grid-area: dot;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
#dashboardView .dash-metric-name {
  grid-area: name;
  font-size: var(--fs-meta);
  color: var(--text-1);
  /* deixa quebrar em duas linhas em vez de cortar com reticencias:
     nome de etapa e escrito pelo usuario e costuma ser descritivo */
  overflow-wrap: anywhere;
}
#dashboardView .dash-metric-value {
  grid-area: value;
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-shrink: 0;
}
#dashboardView .dash-metric-count {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
#dashboardView .dash-metric-pct {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
#dashboardView .dash-metric-bar {
  grid-area: bar;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
/* Ponta do dado arredondada, base quadrada: a barra cresce de uma linha de
   base, entao arredondar os dois lados faria o zero parecer ter volume. */
#dashboardView .dash-metric-bar > i {
  display: block;
  height: 100%;
  border-radius: 0 3px 3px 0;
  min-width: 3px;   /* 1 lead em 200 ainda precisa aparecer */
}
/* Zero e ausencia, nao um valor minusculo: sem o min-width ele vira um toco
   que se le como "tem alguma coisa ai". */
#dashboardView .dash-metric-bar > i.is-zero {
  min-width: 0;
}
/* Rodape ancorado na base do card. Os dois cards tem conteudos de alturas
   diferentes — e agora tambem formas diferentes — mas a grade os estica para a
   mesma altura. Sem a ancora, o mais curto fica com um vazio no pe e a dupla
   parece desalinhada. */
#dashboardView .section-card { display: flex; flex-direction: column; }
#dashboardView #dashCategories,
#dashboardView #dashKanbanContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#dashboardView .dash-metric-foot { margin-top: auto; }
/* No celular o alvo de toque precisa de area: 44px e o minimo
   confortavel, e o dedo nao acerta uma linha de 28px. */
@media (max-width: 768px) {
  #dashboardView .dash-metric-row {
    padding: 10px 8px;
    min-height: 44px;
  }
  #dashboardView .dash-metric-bar { height: 5px; }
}

#dashboardView .active-campaigns-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#dashboardView .active-campaign-item {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  cursor: pointer;
}
#dashboardView .active-campaign-item:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
#dashboardView .footer-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 1100px) {
  #dashboardView .footer-layout {
    grid-template-columns: 1fr;
  }
}
#dashboardView .quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
#dashboardView .action-button-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}
#dashboardView .action-button-card:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}
#dashboardView .action-button-card .action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
}
#dashboardView .action-button-card .action-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#dashboardView .action-button-card .action-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-1);
}
#dashboardView .action-button-card .action-desc {
  font-size: var(--fs-meta);
  color: var(--text-2);
}
#dashboardView .hist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#dashboardView .hist-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-meta);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
}
#dashboardView .hist-item:hover {
  border-color: var(--accent);
}

/* ─── Rename Modal ───────────────────────── */
#renameModal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#renameModal.v { display: flex; }
#renameModal .rm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  min-width: 360px;
  box-shadow: var(--shadow-pop);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
#renameModal .rm h3 { margin-bottom: 16px; font-size: 15px; }
#renameModal .rm input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
#renameModal .rm input:focus { border-color: var(--accent); }
#renameModal .rm .ra {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ─── Edit Lead Modal ────────────────────── */
#editLeadModal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#editLeadModal.v { display: flex; }
#editLeadModal .rm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  min-width: 360px;
  box-shadow: var(--shadow-pop);
  animation: modalIn 0.25s ease;
}
#editLeadModal .rm h3 { margin-bottom: 16px; font-size: 15px; }
#editLeadModal .rm input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
#editLeadModal .rm input:focus { border-color: var(--accent); }
#editLeadModal .rm .ra {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

#leadDetailModal .rm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: modalIn 0.25s ease;
}

/* ─── WhatsApp ───────────────────────────── */
.wa-tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.wa-tab:hover { color: var(--text); background: var(--surface2); }
.wa-tab.act { color: var(--accent2); border-bottom-color: var(--accent); }

/* ─── Configurações > SMS ────────────────────────────────────────
   O painel monta com .page/.card/.field de components.css; aqui ficam
   só as quatro coisas que nenhum componente cobria. */
#smsConnectPanel .sms-number {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.02em;
}
/* Nota de rodapé do card. Fica ao lado de um ícone, daí o inline-flex. */
#smsConnectPanel .sms-note {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  font-size: var(--fs-meta);
  color: var(--text-3);
}
#smsConnectPanel .sms-card-gap { margin-top: var(--s4); }
#smsConnectPanel .sms-test-desc { margin: 0 0 var(--s3); }
/* Campo e botão lado a lado; no celular o botão desce e ocupa a linha,
   porque a 390px os dois juntos espremem o input a ~120px. */
#smsConnectPanel .sms-test-row {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  flex-wrap: wrap;
}
#smsConnectPanel .sms-test-field { flex: 1; min-width: 200px; }
@media (max-width: 768px) {
  #smsConnectPanel .sms-test-field { min-width: 100%; }
  #smsConnectPanel .sms-test-row > .btn { width: 100%; justify-content: center; }
}

.wa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 14px;
  transition: var(--transition);
}
.wa-card:hover { border-color: var(--border-hover); }
.wa-card h4 { font-size: 14px; margin-bottom: 14px; }
.wa-card label {
  display: block;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.wa-card input:not([type="checkbox"]):not([type="radio"]),
.wa-card select,
.wa-card textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.wa-card input[type="checkbox"],
.wa-card input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.wa-card input:focus,
.wa-card select:focus,
.wa-card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.wa-card textarea { resize: vertical; min-height: 100px; }

.wa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-lg);
  font-size: 12px;
  font-weight: 600;
}
.wa-status-badge.connected {
  background: var(--success-subtle);
  color: var(--green);
  border: 1px solid var(--success);
}
.wa-status-badge.disconnected {
  background: var(--danger-subtle);
  color: var(--red);
  border: 1px solid var(--danger);
}

.wa-progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.wa-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ─── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.mobile-menu-btn:hover {
  background: var(--surface-2);
  color: var(--accent2);
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 1200px) {
  #dataTable th:nth-child(10), #dataTable td:nth-child(10),
  #dataTable th:nth-child(11), #dataTable td:nth-child(11),
  #dataTable th:nth-child(12), #dataTable td:nth-child(12),
  #dataTable th:nth-child(16), #dataTable td:nth-child(16),
  #dataTable th:nth-child(17), #dataTable td:nth-child(17) {
    display: none !important;
  }
}

@media (max-width: 1000px) {
  #dataTable th:nth-child(6), #dataTable td:nth-child(6),
  #dataTable th:nth-child(7), #dataTable td:nth-child(7),
  #dataTable th:nth-child(9), #dataTable td:nth-child(9),
  #dataTable th:nth-child(13), #dataTable td:nth-child(13),
  #dataTable th:nth-child(15), #dataTable td:nth-child(15) {
    display: none !important;
  }
}

@media (max-width: 900px) {
  #searchFields { flex-direction: column; }
  #searchFields .in-niche,
  #searchFields .in-state,
  #searchFields .in-city { flex: unset; }
  #statsRow { flex-wrap: wrap; }
  .mstat { min-width: 120px; }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
  #appContent { padding: 0; gap: 0; }
  #main { border: 0; border-radius: 0; }
  #sidebar {
    position: fixed;
    left: -280px;
    top: 48px;
    height: calc(100vh - 48px);
    z-index: 1000;
    width: 264px !important;
    border-radius: 0 22px 22px 0;
    box-shadow: var(--shadow-pop);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #sidebar.mobile-open {
    left: 0;
  }
  #sidebar .nav-label, #sidebar .nb {
    display: flex !important;
  }
  .sidebar-collapse-btn {
    display: none !important;
  }
  
  #main {
    overflow-y: auto;
  }
  #tableSection {
    flex: none;
    overflow: visible;
  }
  #tableWrapper {
    overflow: visible;
    overflow-x: auto;
  }
}

@media (max-width: 600px) {
  #filterBar { flex-direction: column; gap: 8px; }
  #filterBar input, #filterBar select { width: 100%; }
  #statsRow { padding: 10px 12px; gap: 6px; }
  .mstat { padding: 10px; min-width: calc(50% - 3px); }
  .mstat .vl { font-size: 18px; }
  
  #searchBar { padding: 12px 16px; }
  #searchActions {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
  }
  #searchActions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }
  .usage-badge {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  .wa-card { padding: 16px; }
  
  #tableHdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  #tableHdr .tact {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* ─── Animations ─────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.35s ease; }

/* ─── Profile Dropdown ────────────────────── */
.user-profile {
  position: relative;
  display: inline-block;
}
.profile-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
}
.profile-btn:hover {
  border-color: var(--accent2);
  box-shadow: 0 0 10px var(--accent-glow);
}
.profile-avatar {
  text-transform: uppercase;
}
.profile-dropdown {
  display: none;
  position: absolute;
  top: 50px;
  right: 0;
  width: 320px;
  background: var(--surface-1) !important; /* Totalmente sólido e opaco para evitar vazamento */
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  padding: 20px !important;
  box-shadow: var(--shadow-pop) !important;
  z-index: 1000000 !important;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.profile-dropdown.v {
  display: block !important;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sino de Notificações (lembretes vencidos do Kanban) — mesmo padrão visual do profile-dropdown */
.notif-bell-wrap {
  position: relative;
  display: inline-block;
}
.notif-bell-btn {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: var(--transition);
}
.notif-bell-btn:hover {
  border-color: var(--accent2);
  color: var(--text);
  box-shadow: 0 0 10px var(--accent-glow);
}
.notif-bell-btn svg {
  width: 16px;
  height: 16px;
}
.notif-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--surface);
}
.notif-bell-dropdown {
  display: none;
  position: absolute;
  top: 50px;
  left: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--surface-1) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  padding: 12px !important;
  box-shadow: var(--shadow-pop) !important;
  z-index: 1000000 !important;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.notif-bell-dropdown.v {
  display: block !important;
}
.notif-bell-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 8px 10px;
}
.notif-bell-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
}
.notif-bell-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.notif-bell-item:last-child {
  border-bottom: none;
}
.notif-bell-item:hover {
  background: var(--surface2);
}
.notif-bell-item-lead {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.notif-bell-item-content {
  font-size: 11px;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-bell-item-time {
  font-size: 10px;
  color: var(--accent2);
}
.notif-bell-empty {
  text-align: center;
  color: var(--text2);
  font-size: 12px;
  padding: 20px 8px;
}
.profile-info {
  font-size: 13.5px;
  color: var(--text-1);
  font-weight: 600;
  word-break: break-all;
  margin-bottom: 4px;
}
.profile-divider {
  height: 1px;
  background: var(--border) !important;
  margin: 14px 0 !important;
}
.profile-change-password h4 {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.profile-change-password input {
  width: 100%;
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-1) !important;
  padding: 10px 12px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  outline: none !important;
  margin-bottom: 10px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-change-password input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15) !important;
}
.profile-change-password button {
  width: 100%;
  justify-content: center;
  padding: 10px 12px !important;
}
.dropdown-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 10px 12px !important;
  text-align: left;
  font-size: 13px;
  border-radius: 8px !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.dropdown-item:hover {
  background: var(--surface-2) !important;
}
.logout-item {
  color: var(--danger) !important;
  font-weight: 600;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  margin-top: 4px;
}
.logout-item:hover {
  background: var(--danger-subtle) !important;
}

/* ─── Modern Icon System ─────────────────── */
.wa-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wa-tab svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wa-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
}
.wa-icon-lg {
  width: 18px;
  height: 18px;
}
.wa-icon-sm {
  width: 12px;
  height: 12px;
}
#sidebar nav .ni .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── KANBAN STYLES ────────────────────────── */
#kanbanBoard {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: stretch;
  scroll-behavior: smooth;
}

/* Colunas */
.kanban-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 300px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.kanban-column.drag-over {
  background: var(--surface2);
  border-color: var(--accent);
}
.kanban-column.dragging-column {
  opacity: 0.4;
  border: 2px dashed var(--accent);
}
.kanban-column.column-drag-over {
  border-left: 4px solid var(--accent);
  background: var(--surface2);
}
.kanban-column-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  cursor: grab;
}
.kanban-column-header:active {
  cursor: grabbing;
}
.kanban-column-title-container {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent2);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.kanban-column-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text2);
  padding: 2px 6px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}
.kanban-column-actions {
  display: flex;
  gap: 4px;
}
.kanban-col-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.kanban-col-btn:hover {
  background: var(--surface3);
  color: var(--text);
}
.kanban-col-btn.delete:hover {
  color: var(--red);
}
/* Cores dinâmicas para as colunas do Kanban — apenas uma linha colorida no topo */
.kanban-column-header.color-stage-0 {
  border-top: 3px solid var(--stage-1);
}
.kanban-column-header.color-stage-1 {
  border-top: 3px solid var(--stage-2);
}
.kanban-column-header.color-stage-2 {
  border-top: 3px solid var(--stage-3);
}
.kanban-column-header.color-stage-3 {
  border-top: 3px solid var(--stage-4);
}
.kanban-column-header.color-stage-4 {
  border-top: 3px solid var(--stage-5);
}
.kanban-column-header.color-stage-0 .kanban-column-title { color: var(--stage-1); }
.kanban-column-header.color-stage-1 .kanban-column-title { color: var(--stage-2); }
.kanban-column-header.color-stage-2 .kanban-column-title { color: var(--stage-3); }
.kanban-column-header.color-stage-3 .kanban-column-title { color: var(--stage-4); }
.kanban-column-header.color-stage-4 .kanban-column-title { color: var(--stage-5); }

.kanban-column-header.color-stage-1 .kanban-col-btn.delete:hover {
  color: var(--danger);
}

.kanban-cards-container {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}

/* Cartões */
.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: grab;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  user-select: none;
}
.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent2);
  box-shadow: 0 6px 16px var(--accent-glow);
}
.kanban-card-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text2);
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
  z-index: 10;
}
.kanban-card:hover .kanban-card-delete-btn {
  opacity: 1;
}
.kanban-card-delete-btn:hover {
  color: var(--red);
  background: var(--danger-subtle);
}
.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.kanban-card-company {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kanban-card-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.kanban-card-contact-item {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card-contact-item svg {
  color: var(--accent2);
  opacity: 0.8;
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.kanban-card-date {
  font-size: 9px;
  color: var(--text2);
}
.kanban-card-indicators {
  display: flex;
  gap: 6px;
}
.kanban-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text2);
  opacity: 0.6;
}
.kanban-indicator.active {
  color: var(--accent2);
  opacity: 1;
}

/* Seletor de visualização do Kanban (Quadro / Lista / Calendário) */
.kanban-view-switcher {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  flex-shrink: 0;
}
.kanban-view-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.kanban-view-btn:hover:not(.active) {
  color: var(--text);
}
.kanban-view-btn.active {
  background: var(--surface);
  color: var(--accent2);
  border: 1px solid var(--border);
}

/* Badge de etapa reaproveitando as cores color-stage-0..4 / archived */
.kanban-stage-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface2);
  color: var(--text2);
}
.kanban-stage-badge.color-stage-0 { color: var(--stage-1); border-color: var(--stage-1); }
.kanban-stage-badge.color-stage-1 { color: var(--stage-2); border-color: var(--stage-2); }
.kanban-stage-badge.color-stage-2 { color: var(--stage-3); border-color: var(--stage-3); }
.kanban-stage-badge.color-stage-3 { color: var(--stage-4); border-color: var(--stage-4); }
.kanban-stage-badge.color-stage-4 { color: var(--stage-5); border-color: var(--stage-5); }
.kanban-stage-badge.color-stage-archived { color: var(--text2); border-color: var(--border); }

/* Visualização em Lista */
#kanbanListView {
  min-height: 0;
}
.kanban-list-wrapper {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.kanban-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.kanban-list-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.kanban-list-table th {
  background: var(--surface2);
  color: var(--text2);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.kanban-list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.kanban-list-row {
  cursor: pointer;
  transition: var(--transition);
}
.kanban-list-row:hover {
  background: var(--surface2);
}
.kanban-list-indicators {
  display: flex;
  gap: 8px;
}
.kanban-list-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text2);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Visualização em Calendário */
.kanban-cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-shrink: 0;
}
.kanban-cal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  justify-content: center;
}
.kanban-cal-month-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  white-space: nowrap;
}
.kanban-cal-today-btn {
  padding: 4px 10px !important;
  font-size: 11px !important;
}
.kanban-cal-nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.kanban-cal-nav-btn:hover {
  background: var(--surface3);
  color: var(--text);
}
.kanban-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.kanban-cal-weekday {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: 0.5px;
  padding: 4px 0;
}
.kanban-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.kanban-cal-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 78px;
  overflow: hidden;
}
.kanban-cal-cell.outside {
  background: var(--surface2);
  opacity: 0.5;
}
.kanban-cal-cell.today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.kanban-cal-daynum {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
}
.kanban-cal-cell.today .kanban-cal-daynum {
  color: var(--accent2);
}
.kanban-cal-reminders {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.kanban-cal-reminder {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid var(--yellow);
  transition: var(--transition);
}
.kanban-cal-reminder:hover {
  background: var(--surface3);
}
.kanban-cal-reminder.done {
  border-left-color: var(--green);
  opacity: 0.6;
}
.kanban-cal-reminder-time {
  font-weight: 700;
  color: var(--accent2);
  flex-shrink: 0;
}
.kanban-cal-reminder-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-cal-more {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent2);
  cursor: pointer;
  padding: 2px 4px;
}
.kanban-cal-more:hover {
  text-decoration: underline;
}

/* Abas de Detalhes do Card */
.card-tab-btn {
  background: none;
  border: none;
  color: var(--text2);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.card-tab-btn.act {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}
.card-tab-btn:hover:not(.act) {
  color: var(--text);
}

/* Notas / Lembretes / Documentos */
.kanban-note-item {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.kanban-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-note-date {
  font-size: 10px;
  color: var(--text2);
}
.kanban-note-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.kanban-note-content {
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.4;
}
.kanban-note-item.auto {
  background: transparent;
  border-style: dashed;
  opacity: 0.9;
}
.kanban-note-item.pinned {
  border-left: 3px solid var(--accent2);
  background: var(--surface2);
}
.kanban-note-item.pinned.auto {
  background: color-mix(in srgb, var(--surface2) 60%, transparent);
}
.note-pin[data-pinned="1"] {
  color: var(--accent2);
}
.kanban-note-badge {
  font-size: 9px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.kanban-note-badge.manual {
  background: var(--surface2);
  color: var(--text2);
}
.kanban-note-badge.system {
  background: var(--surface2);
  color: var(--text2);
}
.kanban-note-badge.email {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent2);
}
.kanban-note-badge.sms {
  background: color-mix(in srgb, var(--yellow) 20%, transparent);
  color: var(--yellow);
}
.kanban-note-badge.whatsapp {
  background: color-mix(in srgb, var(--green) 20%, transparent);
  color: var(--green);
}

.kanban-reminder-item {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kanban-reminder-item.done {
  border-left-color: var(--green);
  opacity: 0.6;
}
.kanban-reminder-item.done .kanban-reminder-text {
  text-decoration: line-through;
  color: var(--text2);
}
.kanban-reminder-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.kanban-reminder-time {
  font-size: 10px;
  color: var(--yellow);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kanban-reminder-item.done .kanban-reminder-time {
  color: var(--green);
}
.kanban-reminder-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

.kanban-doc-item {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kanban-doc-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.kanban-doc-icon {
  color: var(--accent2);
}
.kanban-doc-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-doc-meta {
  font-size: 10px;
  color: var(--text2);
}

/* Área de DropZone */
#kanbanDropZone {
  border: 2px dashed var(--border);
  padding: 20px;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#kanbanDropZone.drag-over {
  border-color: var(--accent);
  background: var(--surface2);
}


/* Modais do Kanban */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  /* Sem isto, um modal mais alto que a tela era centralizado com metade
     para fora: o cabecalho (e o X de fechar) ficava em coordenada negativa
     e o rodape abaixo do viewport, sem nenhum jeito de alcancar. */
  padding: 20px;
  overflow-y: auto;
}
.modal.v {
  display: flex !important;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-pop);
  animation: modal-appear 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  /* O conteudo nunca passa da tela: o excedente rola aqui dentro. */
  max-width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
@keyframes modal-appear {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Paywall Premium para o Plano Free */
.paywall-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.paywall-card {
  max-width: 440px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-pop);
  animation: paywall-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.paywall-icon {
  font-size: 56px;
  line-height: 1;
  color: var(--accent-text);
}
.paywall-card h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--text-1);
}
.paywall-card p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin: 0;
}
.paywall-cta-btn {
  margin-top: 10px;
  padding: 12px 32px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@keyframes paywall-appear {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Suporte ao Tema Claro */
.light-theme .paywall-card {
  box-shadow: var(--shadow-pop);
  background: var(--surface);
}

/* Badge de Uso de Limites */
.usage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
}
.usage-badge strong {
  color: var(--accent2);
  font-weight: 600;
}

/* Dropdown Pesquisável (Combobox com Busca) */
.searchable-dropdown {
  position: relative;
}
.dropdown-trigger {
  position: relative;
  display: flex;
  width: 100%;
}
.dropdown-trigger input {
  width: 100%;
  padding-right: 34px !important; /* Espaço para a seta */
}
.dropdown-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 9px;
  color: var(--text2);
  opacity: 0.6;
  transition: transform 0.2s ease;
}
.searchable-dropdown.open .dropdown-arrow {
  transform: translateY(-50%) rotate(180deg);
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 10000;
  box-shadow: var(--shadow-pop);
  display: none;
}
.searchable-dropdown.open .dropdown-menu {
  display: block;
}
.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--surface2);
  transition: background 0.15s, color 0.15s;
  text-align: left;
}
.dropdown-item:last-child {
  border-bottom: none;
}
.dropdown-item:hover {
  background: var(--accent);
  color: #fff !important;
}
.dropdown-item.no-results {
  color: var(--text2);
  font-style: italic;
  cursor: default;
  background: transparent !important;
}
.light-theme .dropdown-menu {
  box-shadow: var(--shadow-pop);
}

/* ─── SaaS Profile Elements ─────────────────── */
.profile-header-saas {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.profile-avatar-big {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  text-transform: uppercase;
}
.profile-details-saas {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.profile-email-saas {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.profile-role-saas {
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.profile-saas-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.saas-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.saas-label {
  color: var(--text2);
  font-weight: 500;
}
.saas-value {
  color: var(--text);
  font-weight: 600;
}
.saas-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.saas-badge.free {
  background: color-mix(in srgb, var(--cat-outras) 15%, transparent);
  color: var(--text2);
}
.saas-badge.starter {
  background: color-mix(in srgb, var(--cat-1) 15%, transparent);
  color: var(--cat-1);
}
.saas-badge.pro {
  background: color-mix(in srgb, var(--cat-3) 15%, transparent);
  color: var(--cat-3);
}
.saas-badge.enterprise {
  background: color-mix(in srgb, var(--cat-5) 15%, transparent);
  color: var(--cat-5);
}
.upgrade-saas-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.saas-plan-card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.saas-plan-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-pop);
}
.saas-plan-card.recommended:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-pop);
}

/* ─── Viewport Height Fixes (e.g. smaller screens, laptops, zoom) ─── */
@media (max-height: 840px) {
  #main {
    overflow-y: auto;
  }
  #tableSection {
    flex: none;
    overflow: visible;
  }
  #tableWrapper {
    overflow: visible;
    overflow-x: auto;
  }
  #dashboardView {
    overflow-y: visible;
  }
  #adminView {
    overflow-y: visible;
  }
  #searchesView {
    overflow-y: visible;
  }
}

/* ─── Searches View ───────────────────────── */
.searches-total-count {
  font-size: var(--fs-meta);
  color: var(--text-2);
  background: var(--surface-2);
  padding: 2px 10px;
  border-radius: var(--r-lg);
  font-weight: 500;
  white-space: nowrap;
}
.searches-table-card {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.searches-table-scroll {
  height: 100%;
  overflow: auto;
}
.searches-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}
.searches-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface2);
}
.searches-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.searches-table td {
  padding: 12px 16px;
  font-size: var(--fs-meta);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.searches-table-row {
  cursor: pointer;
  transition: background 0.15s;
}
.searches-table-row:hover {
  background: var(--surface-2);
}
.searches-search-cell {
  min-width: 180px;
}
.searches-search-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}
.searches-search-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent-text);
  flex-shrink: 0;
}
.searches-search-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.searches-search-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 1px;
}
.searches-metric-cell {
  white-space: nowrap;
}
.searches-metric {
  font-weight: 600;
  color: var(--text);
}
.searches-date-cell {
  white-space: nowrap;
  color: var(--text-2);
}
.searches-actions-cell {
  white-space: nowrap;
}
.searches-empty {
  padding: 32px 16px !important;
  color: var(--text-2) !important;
  font-size: var(--fs-body, 13px) !important;
  text-align: center;
}
/* ─── Kanban Stage Archived Special Styles ─── */
.kanban-column-archived {
  background: var(--surface-2) !important;
  border: 1px dashed var(--border) !important;
}
.light-theme .kanban-column-archived {
  background: var(--surface-2) !important;
}
.kanban-column-archived.collapsed {
  width: 52px !important;
  min-width: 52px !important;
  flex: none !important;
  padding: 10px 4px !important;
}
.color-stage-archived {
  background: var(--surface2) !important;
  border-bottom: 2px solid var(--border) !important;
}
.vertical-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 12px 0 0 0 !important;
  white-space: nowrap;
  font-size: 13px !important;
  letter-spacing: 0.5px;
  text-align: center;
  align-self: center;
  font-weight: 600;
  color: var(--text2);
}
.kanban-column-archived.collapsed .kanban-column-count {
  margin-top: 6px;
  font-size: 11px;
}
.kanban-column-archived.collapsed .toggle-archive {
  margin-bottom: 6px;
}
.kanban-column-archived.collapsed:hover {
  background: var(--accent-subtle) !important;
  border-color: var(--accent) !important;
}
.kanban-column-archived.drag-over {
  border-color: var(--accent) !important;
  background: var(--accent-subtle) !important;
}




/* ─── Admin: mini dashboard de atividade do usuario ──────────── */
.admin-activity {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.admin-activity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.admin-activity-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.admin-activity-last {
  font-size: 11px;
  color: var(--text-3);
}
.admin-activity-loading,
.admin-activity-empty {
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 0;
}
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.admin-metric {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.admin-metric-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.admin-metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.admin-metric-sub {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}
.admin-activity-list {
  margin-bottom: 12px;
}
.admin-activity-list h5 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.admin-activity-item:last-child { border-bottom: none; }
.admin-activity-item strong {
  color: var(--text-1);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-activity-when {
  flex: none;
  font-size: 10px;
  color: var(--text-3);
}

/* ─── Admin: tabela de usuarios no mobile ────────────────────── */
/* Sete colunas nao cabem num celular. Em vez de esconder dados de
   administracao ou empurrar a tabela para fora da tela, cada linha vira
   um cartao e o rotulo de cada campo vem do data-label. */
@media (max-width: 768px) {
  /* O wrapper tinha flex:1 + overflow-y:auto dentro de um pai que ja rola:
     no celular ele colapsava para 29px de altura e a lista de 1024px virava
     uma frestinha rolavel. Aqui a lista flui e quem rola e a pagina.
     Precisa de !important: esses valores vem de style inline no app.html. */
  #adminUsersWrapper {
    border: none !important;
    background: transparent !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    flex: none !important;
    height: auto !important;
  }
  /* display:none e nao "visually hidden": escondido daquele jeito, cada th
     mantinha a largura e empurrava o documento para 424px num viewport de
     386px. Como cada celula ganhou rotulo proprio, o cabecalho e redundante. */
  #adminUsersTable thead {
    display: none;
  }
  #adminUsersTable,
  #adminUsersTable tbody,
  #adminUsersTable tr,
  #adminUsersTable td {
    display: block;
    width: 100%;
  }
  #adminUsersTable tr {
    background: var(--surface-1) !important;
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 10px;
    padding: 4px 0;
  }
  #adminUsersTable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 14px !important;
    text-align: right !important;
    border: none;
  }
  #adminUsersTable td::before {
    content: attr(data-label);
    flex: none;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  /* O e-mail vira o titulo do cartao, sem rotulo e ocupando a linha toda */
  #adminUsersTable td[data-label="E-mail"] {
    justify-content: flex-start;
    text-align: left !important;
    font-size: 13px;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
    word-break: break-all;
  }
  #adminUsersTable td[data-label="E-mail"]::before { content: none; }
  #adminUsersTable td[data-label="Ações"] { justify-content: flex-end; }
  #adminUsersTable td[data-label="Ações"]::before { content: none; }
  #adminUsersTable td[colspan] { justify-content: center; text-align: center !important; }
  #adminUsersTable td[colspan]::before { content: none; }

  /* Filtros empilhados: os campos tinham largura fixa e estouravam a tela */
  #adminFilterBar { flex-direction: column; }
  #adminFilterBar input,
  #adminFilterBar select { width: 100% !important; }
}

/* ─── Topbar no mobile ───────────────────────────────────────── */
/* A topbar tinha flex-shrink:0 nos dois lados e nenhuma regra responsiva:
   pais + idioma + tema + perfil somavam mais que a largura de um celular e
   empurravam TODAS as paginas para fora da tela, nao so o admin. Aqui ela
   encolhe em vez de estourar, sem esconder nenhum controle. */
@media (max-width: 768px) {
  #topbar {
    padding: 0 10px;
    gap: 8px;
  }
  .topbar-right {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }
  /* A bandeira ja identifica o pais; o rotulo e o que nao cabia */
  .country-label { display: none; }
  .country-btn { padding: 4px 7px; }
  .lang-switch button { padding: 4px 7px; font-size: 10px; }
}

/* ─── Modal de detalhes do usuario (admin) ───────────────────── */
/* Um usuario com muita atividade deixa este modal bem alto. Em vez de rolar
   o modal inteiro — o que tira o X e os botoes da tela — so o corpo rola,
   com cabecalho e rodape sempre a vista. */
#adminUserDetailsModal .modal-content {
  overflow: hidden;
  padding: 0;
}
#adminUserDetailsModal .modal-header,
#adminUserDetailsModal .modal-footer {
  flex: none;
  margin: 0 !important;
  padding: 16px 24px !important;
  background: var(--surface-1);
}
#adminUserDetailsModal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
}
@media (max-width: 768px) {
  #adminUserDetailsModal .modal-content { width: 100% !important; }
  #adminUserDetailsModal .modal-header,
  #adminUserDetailsModal .modal-footer { padding: 14px 16px !important; }
  #adminUserDetailsModal .modal-body { padding: 16px; }
  /* Os pares nome/telefone, empresa/cidade etc. ficam ilegiveis em duas
     colunas num celular. */
  #adminUserDetailsModal .modal-body > div:first-child {
    grid-template-columns: 1fr !important;
  }
  #adminUserDetailsModal .modal-body > div:first-child > div {
    grid-column: auto !important;
  }
}
