/* ============================================================
   IZZAT CRM — STYLE v3 (LIGHT MODE PREMIUM)
   Inspirado em Linear / Notion / ActiveCampaign / Reportana.
   Consolida: layout, sidebar, topbar, dashboard, leads, kanban,
   inbox 3-cols, composer, marketing, wizard, onboarding, drawer,
   modal, forms, buttons, animations, login.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Base ─────────────────────────────────────────────── */
html { font-size: 14px; -webkit-font-smoothing: antialiased; color-scheme: light; }
body {
  font-family: var(--font);
  color: var(--tx-1);
  background: var(--bg-0);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-bg); color: var(--tx-1); }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--rd-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Scrollbar minimalista */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(16,18,24,.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(16,18,24,.26); background-clip: content-box; border: 2px solid transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(16,18,24,.14) transparent; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Compat: glass utility (alguns lugares usam) */
.glass, .glass-strong {
  background: var(--bg-1);
  border: 1px solid var(--border);
}

/* ============================================================
   LOGIN — split screen premium
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-0);
}
.login-wrap > .login-card { display: none; } /* old single-column variant */

.login-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: var(--bg-0);
}
.login-left {
  padding: 60px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F7FA 100%);
  border-right: 1px solid var(--border);
}
.login-left::before {
  content: ''; position: absolute; top: -200px; right: -200px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(17,18,20,.05), transparent 65%);
  pointer-events: none;
}
.login-brand {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: 700; color: var(--tx-1); letter-spacing: -.01em;
  position: relative; z-index: 1;
}
.login-brand img { height: 26px; }
.login-pitch { position: relative; z-index: 1; margin: auto 0; max-width: 480px; }
.login-pitch h1 {
  font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05;
  color: var(--tx-1); margin: 0 0 18px;
}
.login-pitch p {
  font-size: 15px; color: var(--tx-2); line-height: 1.6; margin: 0;
}
.login-feat-list {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 32px; max-width: 480px;
}
.login-feat {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--tx-1); font-weight: 500;
}
.login-feat-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0; box-shadow: 0 0 0 4px rgba(17,18,20,.06);
}
.login-footer-small {
  position: relative; z-index: 1;
  font-size: 11px; color: var(--tx-3); letter-spacing: .3px; margin-top: 28px;
}
.login-right {
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background: var(--bg-0);
}
.login-right .login-card {
  display: block;
  max-width: 400px; width: 100%;
  background: var(--bg-1);
  padding: 40px 36px;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-3);
}
.login-right .login-title {
  font-size: 24px; font-weight: 700; letter-spacing: -.01em;
  color: var(--tx-1); margin-bottom: 6px;
}
.login-right .login-sub {
  font-size: 13px; color: var(--tx-3); margin-bottom: 24px;
  text-transform: none; letter-spacing: 0;
}
.login-right form label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--tx-2); text-transform: uppercase; letter-spacing: .04em;
  margin: 12px 0 6px;
}
.login-right form input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--tx-1); font-size: 14px;
  outline: none;
  transition: all var(--dur) var(--ease);
  box-sizing: border-box;
}
.login-right form input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.login-right form input::placeholder { color: var(--tx-4); }

.login-right .btn-primary {
  width: 100%; margin-top: 22px; padding: 12px 16px;
  background: var(--primary);
  color: var(--primary-fg);
  border: 1px solid var(--primary);
  border-radius: 10px;
  font-weight: 600; font-size: 14px;
  cursor: pointer; letter-spacing: .01em;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.login-right .btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.login-right .btn-primary:active { transform: translateY(0); }

.login-right .login-google {
  background: var(--bg-1) !important;
  color: var(--tx-1) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 10px !important;
  font-weight: 600 !important; font-size: 13.5px !important;
  transition: all var(--dur) var(--ease) !important;
}
.login-right .login-google:hover {
  border-color: var(--border-hover) !important;
  background: var(--bg-2) !important;
}

.err {
  color: var(--danger);
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  min-height: 14px;
}

@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-left { padding: 32px; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .login-pitch h1 { font-size: 32px; }
  .login-feat-list { display: none; }
}

/* ============================================================
   APP LAYOUT — grid: topbar / sidebar / main
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height: 100vh;
  background: var(--bg-0);
}
.topbar  { grid-area: topbar; }
.sidebar { grid-area: sidebar; }
.main    { grid-area: main; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  overflow: hidden;
}
.topbar-nav { flex: 0 1 auto; margin-right: auto; }
.topbar-right { flex-shrink: 0; margin-left: auto; }
.topbar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  min-width: 56px;
  flex-shrink: 0;
}
.topbar-brand img { height: 24px; width: 24px; }
.topbar-brand span { display: none; }

/* Workspace nav — segmented control estilo ActiveCampaign */
.topbar-nav {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.005em;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s var(--ease);
  position: relative;
  white-space: nowrap;
}
.ws-btn svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .8; }
.ws-btn:hover {
  background: var(--bg-1);
  color: var(--tx-1);
}
.ws-btn.active {
  background: var(--bg-1);
  color: var(--tx-1);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16,18,24,.05), 0 1px 3px rgba(16,18,24,.04);
}
.ws-btn.active svg { color: var(--tx-1); opacity: 1; }
.ws-btn .ws-sub { display: none; }
.ws-badge {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 4px;
  letter-spacing: .04em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.tb-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
}
.tb-icon-btn:hover {
  background: var(--bg-2);
  color: var(--tx-1);
}

.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.notif-bell:hover {
  background: var(--bg-2);
  color: var(--tx-1);
}
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--bg-1);
}

.tb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tb-user:hover { border-color: var(--border-hover); background: var(--bg-1); }
.tb-user .user-avatar {
  width: 26px; height: 26px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11.5px;
  color: var(--tx-1);
  background: linear-gradient(135deg, #E8E8EB, #D5D5D9);
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
}
.tb-user .user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tb-user-info { min-width: 0; max-width: 130px; }
.tb-user-info > div:first-child {
  font-size: 12.5px; font-weight: 600; color: var(--tx-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-user-info > div:last-child {
  font-size: 10px; color: var(--tx-3);
  text-transform: uppercase; letter-spacing: .05em;
  font-weight: 500;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 16px 12px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  height: calc(100vh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.sidebar-logo { padding: 2px 10px 12px; display: none; } /* substituido pelo topbar-brand */
.sidebar-logo img { height: 20px; }

.ws-label {
  padding: 8px 14px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--tx-1);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-label::before {
  content: '';
  width: 3px; height: 12px; border-radius: 2px;
  background: var(--primary);
}

.sidebar-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx-3);
  padding: 14px 12px 6px;
  font-weight: 600;
}
.sidebar-section.sidebar-section-first { padding-top: 6px; }
.sidebar-filters-group { opacity: 1; }

.sidebar-quick-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; margin: 4px 0 8px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  color: var(--tx-3);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.sidebar-quick-search:hover {
  background: var(--bg-2);
  color: var(--tx-1);
  border-color: var(--border-strong);
}
.sidebar-quick-search kbd {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-3);
  font-weight: 600;
}

/* === Hero nav items (Leads / Caixa / Disparos) === */
.nav-primary-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 4px;
  padding: 0 2px;
}
.nav-item-hero {
  display: grid !important;
  grid-template-columns: 28px 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas: "ico main count" "ico sub sub";
  gap: 1px 10px !important;
  padding: 11px 12px !important;
  border-radius: 10px !important;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tx-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
}
.nav-item-hero:hover {
  background: var(--bg-1);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.nav-item-hero.active {
  background: var(--bg-1);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  color: var(--tx-1);
}
.nav-item-hero .nav-ico {
  grid-area: ico;
  width: 28px !important;
  height: 28px !important;
  background: var(--bg-2);
  border-radius: 8px;
  align-self: center;
  display: flex; align-items: center; justify-content: center;
  color: var(--tx-2);
}
.nav-item-hero:hover .nav-ico,
.nav-item-hero.active .nav-ico {
  background: var(--primary);
  color: var(--primary-fg);
}
.nav-item-hero .nav-ico svg { width: 14px !important; height: 14px !important; }
.nav-item-hero .nav-lbl-main {
  grid-area: main;
  font-size: 13px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.nav-item-hero .nav-lbl-sub {
  grid-area: sub;
  font-size: 11px;
  color: var(--tx-3);
  letter-spacing: .01em;
  line-height: 1.3;
}
.nav-item-hero .nav-count { grid-area: count; align-self: center; margin-left: 0 !important; }

/* === Standard nav item === */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--rd-md);
  font-size: 13px;
  color: var(--tx-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover {
  background: var(--bg-2);
  color: var(--tx-1);
}
.nav-item.active {
  background: var(--bg-1);
  color: var(--tx-1);
  font-weight: 600;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
}
.nav-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tx-4);
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.nav-item.active .dot { background: var(--primary); }
.nav-item .nav-ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--tx-3);
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item .nav-ico svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  fill: none;
}
.nav-item:hover .nav-ico { color: var(--tx-1); }
.nav-item.active .nav-ico { color: var(--tx-1); }

.nav-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--tx-3);
  font-weight: 600;
  padding: 1px 7px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.nav-item.active .nav-count {
  color: var(--primary-fg);
  background: var(--primary);
  border-color: var(--primary);
}

/* Featured nav item — destaque com accent */
.nav-item-featured {
  background: linear-gradient(135deg, rgba(255,106,0,.08), rgba(255,106,0,.02)) !important;
  border: 1px solid var(--accent-border) !important;
  color: var(--tx-1) !important;
  margin: 8px 2px !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-weight: 600 !important;
}
.nav-item-featured:hover {
  background: linear-gradient(135deg, rgba(255,106,0,.14), rgba(255,106,0,.04)) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.nav-item-featured .nav-ico { color: var(--accent) !important; }
.nav-tag-new,
.nav-badge-new {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: .04em;
  margin-left: 6px;
  text-transform: uppercase;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pending-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.pending-chip:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.pending-chip-ico {
  width: 26px; height: 26px;
  border-radius: var(--rd-sm);
  background: var(--accent-bg);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pending-chip-body { flex: 1; min-width: 0; overflow: hidden; }
.pending-chip-title { font-size: 12px; font-weight: 600; color: var(--tx-1); line-height: 1.2; }
.pending-chip-sub {
  font-size: 10.5px; color: var(--tx-3);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pending-chip-badge {
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  font-size: 12.5px;
}
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8E8EB, #D5D5D9);
  color: var(--tx-1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-chip .logout {
  margin-left: auto;
  color: var(--tx-3);
  cursor: pointer;
  padding: 0 4px;
  display: flex; align-items: center;
}
.user-chip .logout svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.user-chip .logout:hover { color: var(--danger); }

/* Saved views */
.saved-view {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px;
  border-radius: var(--rd-sm);
  font-size: 12px;
  color: var(--tx-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.saved-view:hover { background: var(--bg-2); color: var(--tx-1); }
.saved-view .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--tx-4); flex-shrink: 0; }
.saved-view .del { margin-left: auto; color: var(--tx-4); font-size: 13px; opacity: 0; transition: var(--dur) var(--ease); padding: 0 2px; }
.saved-view:hover .del { opacity: 1; }
.saved-view .del:hover { color: var(--danger); }
.add-view {
  padding: 6px 11px;
  color: var(--tx-3);
  font-size: 11.5px;
  cursor: pointer;
  border-radius: var(--rd-sm);
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; gap: 6px;
}
.add-view:hover { background: var(--bg-2); color: var(--tx-1); }

/* ============================================================
   MAIN — header / page heading
   ============================================================ */
.main {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-0);
  overflow-x: hidden;
}
.main > section {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
.header > div:first-child { min-width: 0; }
.header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--tx-1);
  overflow-wrap: anywhere;
}
.header .sub {
  font-size: 13px;
  color: var(--tx-3);
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
.header { flex-wrap: wrap; row-gap: 12px; }

/* Settings cog button */
.settings-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--rd-sm);
  background: transparent;
  color: var(--tx-3);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
}
.settings-btn:hover { background: var(--bg-2); color: var(--tx-1); border-color: var(--border); }

/* ============================================================
   STATS (KPI cards)
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  padding: 16px 18px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  box-shadow: var(--shadow-1);
  transition: all var(--dur) var(--ease);
}
.stat:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.stat-label {
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
  font-weight: 600;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--tx-1);
}
.stat.accent {
  border-color: var(--primary-border);
  background: linear-gradient(135deg, var(--bg-1), rgba(17,18,20,.02));
}
.stat.accent .stat-value { color: var(--primary); }

/* ============================================================
   FILTERS + SEARCH
   ============================================================ */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  box-shadow: var(--shadow-1);
}
.search {
  flex: 1;
  min-width: 240px;
  padding: 9px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-2);
  color: var(--tx-1);
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border);
  outline: none;
  transition: all var(--dur) var(--ease);
}
.search:focus {
  background: var(--bg-1);
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.search::placeholder { color: var(--tx-4); }
.filters select {
  padding: 9px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-2);
  color: var(--tx-1);
  font-size: 12.5px;
  font-family: var(--font);
  border: 1px solid var(--border);
  outline: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.filters select:hover, .filters select:focus { border-color: var(--border-hover); background: var(--bg-1); }
.active-filters-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.active-filters-chip svg { stroke: var(--primary); width: 12px; height: 12px; }

.filters-advanced {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin: -8px 0 16px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  align-items: flex-end;
  box-shadow: var(--shadow-1);
}
.filt-group {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px;
}
.filt-group label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--tx-3);
  width: 100%;
  margin-bottom: -2px;
}
.filt-group > *:not(label) {
  padding: 8px 10px;
  border-radius: var(--rd-sm);
  background: var(--bg-2);
  color: var(--tx-1);
  font-size: 12.5px;
  font-family: var(--font);
  border: 1px solid var(--border);
  outline: none;
  transition: all var(--dur) var(--ease);
}
.filt-group input[type=number],
.filt-group input[type=date] { min-width: 100px; max-width: 140px; }
.filt-group > *:focus { border-color: var(--primary); background: var(--bg-1); box-shadow: var(--shadow-focus); }
.date-presets { display: flex; gap: 4px; }
.date-presets button {
  padding: 6px 10px;
  font-size: 11.5px;
  font-family: var(--font);
  background: var(--bg-1);
  color: var(--tx-2);
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.date-presets button:hover { border-color: var(--border-hover); color: var(--tx-1); background: var(--bg-2); }
.filt-actions { display: flex; gap: 8px; margin-left: auto; }

/* ============================================================
   TABLE (leads list)
   ============================================================ */
.table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--tx-1);
}
tbody tr {
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
tbody tr:hover { background: var(--bg-3); }
tbody tr:last-child td { border-bottom: none; }
.cell-name { font-weight: 600; color: var(--tx-1); }
.cell-email { font-size: 12px; color: var(--tx-3); margin-top: 2px; }

/* ─── PILLS / STATUS ─────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-2);
}

/* Workspace tags */
.pill-lab       { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border); }
.pill-partners  { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-border); }
.pill-ecom      { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.pill-reboot    { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
.pill-protocolo { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }

.pill-status { padding: 3px 9px; }
.pill-novo         { background: var(--bg-2); color: var(--tx-2); border-color: var(--border); }
.pill-contatado    { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.pill-tent_1       { background: #FFF4E0; color: #B57711; border-color: #F5DBA8; }
.pill-tent_2       { background: #FFEBD2; color: #A86314; border-color: #F4CC92; }
.pill-tent_3       { background: #FFE0C5; color: #9A5417; border-color: #F1BC7E; }
.pill-tent_4       { background: #FFD3B0; color: #8E471A; border-color: #EFAC68; }
.pill-qualificado  { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.pill-reuniao      { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-border); }
.pill-proposta     { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
.pill-fechado      { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.pill-perdido      { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.cell-date  { color: var(--tx-3); font-size: 12px; white-space: nowrap; }
.cell-owner { color: var(--tx-2); font-size: 12px; }
.cell-owner.empty { color: var(--tx-4); font-style: italic; }
.empty { padding: 48px 20px; text-align: center; color: var(--tx-3); font-size: 13px; }

/* Score chip */
.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
}
.score-chip.high { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.score-chip.med  { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.score-chip.low  { background: var(--bg-2); color: var(--tx-3); border: 1px solid var(--border); }

/* Deal value cell */
.cell-value { font-weight: 700; color: var(--tx-1); font-size: 13px; white-space: nowrap; }
.cell-value.empty { color: var(--tx-4); font-weight: 400; font-style: italic; }

/* Tags row */
.tags-row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-1);
}
.tag-chip .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tag-chip .tag-remove { margin-left: 2px; opacity: .5; cursor: pointer; font-size: 11px; line-height: 1; }
.tag-chip .tag-remove:hover { opacity: 1; color: var(--danger); }
.tag-add-btn {
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--tx-3);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tag-add-btn:hover { color: var(--primary); border-color: var(--primary-border); background: var(--primary-bg); }
.tag-more {
  display: inline-flex; align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--tx-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.tag-picker {
  position: absolute;
  min-width: 180px;
  padding: 5px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-sm);
  box-shadow: var(--shadow-3);
  z-index: 50;
}
.tag-picker .tag-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--tx-1);
  transition: background var(--dur-fast) var(--ease);
}
.tag-picker .tag-opt:hover { background: var(--bg-2); }
.tag-picker .tag-opt .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Bulk bar */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin-bottom: 12px;
  background: var(--bg-1);
  border: 1px solid var(--primary-border);
  border-radius: var(--rd-md);
  box-shadow: var(--shadow-1);
}
.bulk-bar.show { display: flex; }
.bulk-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 11px;
  font-weight: 700;
}
.bulk-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.bulk-actions .btn { padding: 6px 10px; font-size: 12px; }
tr.row-selected { background: var(--bg-3) !important; }
tr.row-selected td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
.row-check { cursor: pointer; accent-color: var(--primary); width: 14px; height: 14px; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-top: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow-1);
}
.pg-info { font-size: 12.5px; color: var(--tx-3); }
.pg-info b { color: var(--tx-1); font-weight: 600; }
.pg-nav { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.pg-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  color: var(--tx-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pg-btn:hover:not(:disabled) {
  background: var(--bg-2);
  color: var(--tx-1);
  border-color: var(--border-hover);
}
.pg-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  font-weight: 700;
}
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-sep { color: var(--tx-4); padding: 0 4px; }

/* Shared UI State Kit */
.crm-ui-state-cell {
  padding: 18px !important;
  background: transparent !important;
  box-sizing: border-box;
}
.crm-ui-state {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  background:
    linear-gradient(135deg, rgba(0,122,255,0.035), rgba(255,255,255,0.88) 44%),
    var(--bg-1);
  color: var(--tx-2);
  box-shadow: var(--shadow-1);
}
.crm-ui-state.is-compact {
  grid-template-columns: 44px minmax(0, 1fr);
  max-width: 520px;
  padding: 18px;
}
.crm-ui-state__icon {
  width: 50px;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--tx-1);
}
.crm-ui-state.is-compact .crm-ui-state__icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
}
.crm-ui-state__icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .72;
}
.crm-ui-state__spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  animation: spin .85s linear infinite;
}
.crm-ui-state__body { min-width: 0; }
.crm-ui-state__kicker {
  margin-bottom: 5px;
  color: var(--tx-3);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.crm-ui-state__title {
  color: var(--tx-1);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0;
}
.crm-ui-state__message {
  max-width: 620px;
  margin-top: 7px;
  color: var(--tx-3);
  font-size: 13px;
  line-height: 1.55;
}
.crm-ui-state__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}
.crm-ui-state__chips span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--tx-2);
  font-size: 10.5px;
  font-weight: 800;
}
.crm-ui-state__chips span:last-child {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}
.crm-ui-state--error .crm-ui-state__icon,
.crm-ui-state--blocked .crm-ui-state__icon {
  background: var(--danger-bg);
  color: var(--danger);
}
.crm-ui-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.crm-ui-state__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 13px;
  border-radius: var(--rd-md);
  border: 1px solid var(--border-strong);
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 12.5px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}
.crm-ui-state__action:hover {
  background: var(--primary-hover);
}

@media (max-width: 640px) {
  .crm-ui-state-cell {
    padding: 12px !important;
    min-width: 0;
  }
  .crm-ui-state {
    grid-template-columns: 1fr;
    width: min(100%, calc(100vw - 58px));
    max-width: 320px;
    padding: 18px;
    text-align: center;
  }
  .crm-ui-state__icon {
    margin: 0 auto;
  }
  .crm-ui-state__chips,
  .crm-ui-state__actions {
    justify-content: center;
  }
  .crm-ui-state-cell .crm-ui-state {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-top: 4px;
}
.dash-card {
  grid-column: span 6;
  padding: 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-1);
  transition: all var(--dur) var(--ease);
}
.dash-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.dash-card-wide { grid-column: span 12; }
.dash-card-sm { grid-column: span 4; }
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.dash-card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--tx-1);
}
.dash-card-sub {
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.dash-legend { display: flex; gap: 12px; font-size: 11px; color: var(--tx-3); }
.dash-legend .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }
.dash-body { flex: 1; min-height: 0; }
.chart-svg { width: 100%; height: 180px; display: block; }

#dashGreet { color: var(--tx-1); }

/* Funnel */
.funnel-row {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.funnel-label {
  font-size: 12px;
  color: var(--tx-2);
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.funnel-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--primary); }
.funnel-track,
.funnel-bar-wrap {
  height: 22px;
  background: var(--bg-2);
  border-radius: var(--rd-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.funnel-bar { height: 100%; background: var(--primary); transition: width .5s ease; border-radius: var(--rd-sm); }
.funnel-bar[style*="background"] { /* respeita inline color */ }
.funnel-val { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.funnel-count { font-size: 12px; color: var(--tx-1); font-weight: 700; }
.funnel-money { font-size: 10.5px; color: var(--tx-3); font-weight: 500; }

/* Owners / Lost */
.owner-row,
.lost-row {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.owner-row:last-child, .lost-row:last-child { border-bottom: none; }
.owner-name, .lost-name, .lost-label {
  font-size: 12.5px;
  color: var(--tx-2);
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.owner-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8E8EB, #D5D5D9);
  color: var(--tx-1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.owner-bar-wrap, .lost-bar-wrap {
  height: 14px;
  background: var(--bg-2);
  border-radius: var(--rd-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.owner-bar { height: 100%; background: var(--primary); transition: width .5s ease; }
.lost-bar  { height: 100%; background: var(--danger); opacity: .7; transition: width .5s ease; }
.owner-stats { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 11.5px; }
.owner-val, .lost-val {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  font-size: 12px; color: var(--tx-1); font-weight: 700;
  text-align: right;
}
.owner-count { color: var(--tx-3); font-weight: 500; font-size: 10.5px; }
.owner-won { color: var(--success); font-size: 11px; }
.lost-pct { color: var(--tx-3); font-weight: 500; font-size: 10.5px; }
.lost-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.lost-count { font-size: 12px; color: var(--tx-1); font-weight: 700; text-align: right; }

/* Dashboard tasks mini */
.task-mini, .tasks-mini .task-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}
.task-mini:last-child { margin-bottom: 0; }
.task-mini:hover, .tasks-mini .task-mini:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.task-mini .task-icon, .task-mini .tm-kind {
  width: 26px; height: 26px;
  border-radius: var(--rd-sm);
  flex-shrink: 0;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.task-mini .task-icon svg { width: 13px; height: 13px; }
.task-mini .task-mini-body, .task-mini .tm-body { flex: 1; min-width: 0; }
.task-mini .task-mini-title, .task-mini .tm-title {
  font-size: 12.5px; color: var(--tx-1); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-mini .task-mini-meta, .task-mini .tm-meta {
  font-size: 11px; color: var(--tx-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-mini .tm-time { font-size: 11px; color: var(--tx-3); flex-shrink: 0; }
.task-mini.overdue .tm-time { color: var(--danger); font-weight: 600; }

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  min-height: 76px;
  box-shadow: var(--shadow-1);
}
.quick-action:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-3);
}
.qa-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.qa-ico svg { width: 20px; height: 20px; }
.qa-ico-orange { background: var(--accent-bg); color: var(--accent); }
.qa-ico-blue   { background: var(--info-bg); color: var(--info); }
.qa-ico-purple { background: var(--violet-bg); color: var(--violet); }
.qa-title  { font-size: 14px; font-weight: 600; color: var(--tx-1); letter-spacing: -.01em; }
.qa-sub    { font-size: 12px; color: var(--tx-3); margin-top: 3px; }

/* Onboarding card */
.onb-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  padding: 24px 26px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.onb-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,106,0,.10), transparent 70%);
  pointer-events: none;
}
.onb-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; position: relative;
}
.onb-title { font-size: 18px; font-weight: 700; color: var(--tx-1); letter-spacing: -.02em; margin: 0; }
.onb-sub { font-size: 13px; color: var(--tx-3); margin-top: 4px; }
.onb-progress {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--tx-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.onb-progress-bar {
  width: 100px; height: 4px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.onb-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .4s var(--ease);
}
.onb-steps {
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.onb-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.onb-step:hover {
  border-color: var(--border-hover);
  background: var(--bg-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.onb-step.done { opacity: .6; }
.onb-step-check {
  width: 22px; height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--border-hover);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--bg-1);
}
.onb-step.done .onb-step-check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.onb-step.done .onb-step-check svg { display: block; }
.onb-step-check svg { width: 12px; height: 12px; display: none; stroke-width: 3; }
.onb-step-body { flex: 1; min-width: 0; }
.onb-step-title { font-size: 13.5px; font-weight: 600; color: var(--tx-1); letter-spacing: -.005em; }
.onb-step-desc  { font-size: 12px; color: var(--tx-3); margin-top: 3px; line-height: 1.4; }
.onb-step.done .onb-step-title { text-decoration: line-through; }
.onb-step-arrow { color: var(--tx-4); flex-shrink: 0; transition: transform var(--dur) var(--ease); }
.onb-step:hover .onb-step-arrow { color: var(--primary); transform: translateX(3px); }
.onb-step-arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.onb-close {
  background: transparent; border: none;
  color: var(--tx-3); cursor: pointer;
  padding: 0 6px; font-size: 18px;
}
.onb-close:hover { color: var(--tx-1); }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  min-height: calc(100vh - 240px);
}
.kb-col {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  min-width: 280px;
  min-height: 200px;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.kb-col.drop-over {
  background: var(--primary-bg);
  border-color: var(--primary);
}
.kb-col-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 100px; }
.kb-col-empty { flex: 1; min-height: 40px; }
.kb-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 3px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.kb-col-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.kb-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tx-1);
}
.kb-col-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--tx-3);
  font-weight: 600;
}
.kb-col-value {
  font-size: 11px;
  color: var(--tx-3);
  font-weight: 500;
  text-align: right;
  padding: 0 3px 5px;
}

.kb-card {
  padding: 12px 14px;
  border-radius: var(--rd-md);
  background: var(--bg-1);
  border: 1px solid var(--border);
  cursor: grab;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.kb-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.kb-card.dragging { opacity: .4; cursor: grabbing; }
.kb-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 5px;
}
.kb-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx-1);
  line-height: 1.3;
  word-break: break-word;
  flex: 1;
}
.kb-card-value {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tx-1);
  white-space: nowrap;
  flex-shrink: 0;
}
.kb-card-company {
  font-size: 11.5px;
  color: var(--tx-3);
  margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-card-foot {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 10.5px;
}
.kb-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.kb-card-owner { margin-left: auto; color: var(--tx-3); font-size: 10.5px; }
.kb-card-score { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; }

/* ============================================================
   TASKS
   ============================================================ */
.tasks-grid { display: flex; flex-direction: column; gap: 8px; }
.tasks-grid .task-grid-state { max-width: 100%; }
.task-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.task-card:hover {
  background: var(--bg-1);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.task-card.done { opacity: .55; }
.task-card.done .task-title { text-decoration: line-through; }
.task-card.overdue { border-color: var(--danger-border); }
.task-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hover);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  background: var(--bg-1);
  flex-shrink: 0;
}
.task-check:hover { border-color: var(--primary); }
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.task-body { min-width: 0; }
.task-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx-1);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.task-kind-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-2);
}
.task-meta {
  font-size: 11.5px;
  color: var(--tx-3);
  margin-top: 4px;
  display: flex; gap: 12px; flex-wrap: wrap;
}
.task-meta .lead-link { color: var(--primary); cursor: pointer; font-weight: 500; }
.task-meta .lead-link:hover { text-decoration: underline; }
.task-time { font-size: 11.5px; color: var(--tx-3); font-weight: 500; text-align: right; white-space: nowrap; }
.task-time.overdue { color: var(--danger); }
.task-priority-p1 { border-left: 3px solid var(--danger); }
.task-priority-p2 { border-left: 3px solid var(--accent); }
.task-priority-p3 { border-left: 3px solid var(--info); }

/* Calendar */
.calendar {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.cal-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.cal-toolbar h3 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--tx-1); }
.cal-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.cal-head {
  padding: 9px 12px;
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  text-align: left;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(96px, 1fr); }
.cal-cell {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 96px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  overflow: hidden;
  background: var(--bg-1);
}
.cal-cell:hover { background: var(--bg-2); }
.cal-cell.faded { opacity: .35; }
.cal-cell.today {
  background: var(--primary-bg);
}
.cal-cell.today .cal-day { color: var(--primary); font-weight: 700; }
.cal-day { font-size: 12px; color: var(--tx-2); font-weight: 600; margin-bottom: 4px; }
.cal-task {
  padding: 2px 7px;
  margin-bottom: 2px;
  border-radius: 4px;
  font-size: 10.5px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
}
.cal-task:hover { background: var(--primary); color: var(--primary-fg); }
.cal-task.done { opacity: .45; text-decoration: line-through; }
.cal-more { font-size: 10px; color: var(--tx-3); margin-top: 2px; font-weight: 600; }

/* Companies */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.company-card {
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.company-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.company-name { font-size: 15px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.01em; color: var(--tx-1); }
.company-stats { display: flex; gap: 16px; font-size: 11.5px; color: var(--tx-3); }
.company-stats b { color: var(--tx-1); font-weight: 700; }
.company-lead {
  padding: 10px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-1);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.company-lead:hover { background: var(--bg-2); border-color: var(--border-strong); }
.company-lead .name { font-size: 13px; font-weight: 500; color: var(--tx-1); }
.company-lead .meta { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }

/* Activity feed */
#activitySection {
  max-width: 1180px;
  margin-inline: auto;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.activity-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all var(--dur) var(--ease);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: var(--shadow-1);
}
.activity-row:hover { background: var(--bg-3); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.activity-avatar {
  width: 34px; height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(232,237,245,0.95));
  border: 1px solid var(--border);
  color: var(--tx-1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--tx-1); line-height: 1.5; }
.activity-text b { font-weight: 700; }
.activity-text .verb { color: var(--primary); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--tx-3); margin-top: 6px; }

/* Empty state */
.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--tx-3);
  background: var(--bg-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--rd-lg);
}
.empty-state .icon { font-size: 32px; margin-bottom: 10px; opacity: .35; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--tx-1); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--tx-3); max-width: 340px; margin: 0 auto; }

/* ============================================================
   DRAWER (lead detail)
   ============================================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,18,24,.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
  z-index: 100;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(540px, 100vw);
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-4);
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 22px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -.02em;
  color: var(--tx-1);
}
.drawer-header .meta {
  font-size: 12px;
  color: var(--tx-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.drawer-close {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-2);
  width: 30px; height: 30px;
  border-radius: var(--rd-sm);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--bg-1); color: var(--tx-1); border-color: var(--border-hover); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
  font-weight: 600;
}
.field .val {
  font-size: 13px;
  color: var(--tx-1);
  word-break: break-word;
  line-height: 1.5;
}
.field .val.empty { color: var(--tx-4); font-style: italic; }
.field select, .field input, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-1);
  color: var(--tx-1);
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  outline: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.field select:focus, .field input:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx-3);
  margin: 24px 0 12px;
  font-weight: 700;
}
.field-full { grid-column: 1 / -1; }
.field-full .val {
  padding: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* Notes */
.note-input { margin-bottom: 12px; }
.note-input textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-1);
  color: var(--tx-1);
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  outline: none;
  resize: vertical;
  min-height: 76px;
  transition: all var(--dur) var(--ease);
}
.note-input textarea:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.note-input textarea::placeholder { color: var(--tx-4); }

.timeline { display: flex; flex-direction: column; gap: 8px; }
.note {
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--rd-sm);
}
.note-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--tx-3);
  flex-wrap: wrap;
}
.note-kind {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.note-kind.status_change, .note-kind.owner_change { background: var(--bg-2); color: var(--tx-3); border-color: var(--border); }
.note-kind.contato  { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.note-kind.reuniao  { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-border); }
.note-kind.email    { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.note-kind.whatsapp { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.note-body { font-size: 13px; color: var(--tx-1); white-space: pre-wrap; line-height: 1.55; }
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============================================================
   TOAST + LOADING
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  padding: 12px 20px;
  background: var(--primary);
  color: var(--primary-fg);
  border: 1px solid var(--primary);
  border-radius: var(--rd-md);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all .2s var(--ease);
  z-index: 200;
  box-shadow: var(--shadow-3);
  max-width: 420px;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); color: #fff; border-color: var(--success); }
.toast.error   { background: var(--danger);  color: #fff; border-color: var(--danger); }
.toast.warning { background: var(--warning); color: #fff; border-color: var(--warning); }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(17,18,20,.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
}

/* ============================================================
   SETTINGS MODAL
   ============================================================ */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,18,24,.42);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-overlay.open { display: flex; animation: fadeIn .2s var(--ease); }
.settings-modal {
  width: 100%;
  max-width: 920px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-xl);
  overflow: hidden;
  box-shadow: var(--shadow-4);
}
.settings-head, .settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-head h2, .settings-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.01em;
}
.settings-body { display: flex; flex: 1; min-height: 0; }
.settings-tabs {
  width: 220px;
  flex-shrink: 0;
  padding: 14px 10px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
  background: var(--bg-3);
}
.settings-tab {
  padding: 9px 12px;
  border-radius: var(--rd-sm);
  font-size: 13px;
  color: var(--tx-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex; align-items: center; gap: 10px;
  font-weight: 500;
}
.st-ico {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  fill: none; flex-shrink: 0;
}
.settings-tab:hover { background: var(--bg-1); color: var(--tx-1); }
.settings-tab.active {
  background: var(--bg-1);
  color: var(--tx-1);
  font-weight: 600;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
}
.settings-content { flex: 1; padding: 24px 28px; overflow-y: auto; background: var(--bg-1); }
.settings-section { margin-bottom: 28px; }
.settings-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx-3);
  margin: 0 0 12px;
  font-weight: 600;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 13.5px; color: var(--tx-1); font-weight: 500; }
.settings-row-sub   { font-size: 11.5px; color: var(--tx-3); margin-top: 3px; }
.settings-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-1);
  color: var(--tx-1);
  border: 1px solid var(--border-strong);
  outline: none;
  font-size: 13px;
  transition: all var(--dur) var(--ease);
}
.settings-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.settings-desc { color: var(--tx-3); font-size: 13px; margin-bottom: 14px; line-height: 1.55; }
.settings-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
  background: var(--bg-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--rd-md);
}
.settings-code {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tx-2);
  overflow-x: auto;
  white-space: nowrap;
}
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.int-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  transition: all var(--dur) var(--ease);
}
.int-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-1); }
.int-card-ico {
  width: 40px; height: 40px;
  border-radius: var(--rd-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.int-card-body { flex: 1; min-width: 0; }
.int-card-title { font-size: 13.5px; font-weight: 600; color: var(--tx-1); }
.int-card-desc  { font-size: 12px; color: var(--tx-3); margin-top: 3px; line-height: 1.4; }
.int-card-acc   { font-size: 11.5px; color: var(--tx-2); margin-top: 5px; display: flex; align-items: center; }
.int-card-actions { flex-shrink: 0; }

/* Network Connect OS */
.network-os { max-width: 980px; }
.network-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.74), rgba(248,249,251,.88));
  box-shadow: var(--shadow-1);
}
.network-hero h3 { margin: 0 0 6px !important; }
.network-hero__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.network-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.network-status-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  padding: 14px;
}
.network-status-card__top { display: flex; align-items: flex-start; gap: 10px; }
.network-status-card__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #0B0D12;
  background: rgba(0,0,0,.06);
}
.network-status-card__title { font-size: 13px; font-weight: 700; color: var(--tx-1); }
.network-status-card__desc { font-size: 11.5px; color: var(--tx-3); line-height: 1.45; margin-top: 3px; }
.network-status-card__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--tx-3);
  font-size: 11.5px;
  min-width: 0;
}
.network-status-card__footer span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.network-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.network-pill--ok { color: #047857; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.22); }
.network-pill--blocked { color: #9A3412; background: rgba(251,146,60,.12); border: 1px solid rgba(251,146,60,.24); }
.network-runbook {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.network-runbook__step {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.68);
  padding: 12px;
  font-size: 11.5px;
  line-height: 1.42;
  color: var(--tx-3);
}
.network-runbook__step b {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0B0D12;
  color: #fff;
  font-size: 11px;
  margin-right: 6px;
}
.network-advanced {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  overflow: hidden;
}
.network-advanced summary {
  cursor: pointer;
  padding: 13px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tx-2);
}
.network-advanced__body { padding: 0 14px 14px; display: grid; gap: 8px; }
.network-mini { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.network-mini__label { font-weight: 650; color: var(--tx-1); }
.network-mini__value { color: var(--tx-3); font-size: 11.5px; margin-top: 1px; }

.wa-live-note {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,.68);
}
.wa-live-note__title { font-size: 12px; font-weight: 750; color: var(--tx-1); margin-bottom: 10px; }
.wa-live-note__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wa-live-note__grid span { font-size: 11.5px; color: var(--tx-3); padding: 8px 10px; border-radius: 10px; background: rgba(120,120,128,.09); }
.wa-live-note__gate { margin-top: 10px; font-size: 10.5px; color: var(--tx-3); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.wa-advanced {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.58);
  padding: 0 10px 10px;
}
.wa-advanced summary { cursor: pointer; padding: 12px 2px; font-size: 12px; font-weight: 700; color: var(--tx-2); }

@media (max-width: 860px) {
  .network-hero { flex-direction: column; }
  .network-hero__actions { width: 100%; justify-content: stretch; }
  .network-hero__actions .btn { flex: 1; }
  .network-status-grid, .network-runbook { grid-template-columns: 1fr; }
  .wa-live-note__grid { grid-template-columns: 1fr; }
}
.status-ok   { background: var(--success); }
.status-err  { background: var(--danger); }
.status-warn { background: var(--warning); }

@media (max-width: 720px) {
  .settings-body { flex-direction: column; }
  .settings-tabs { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .settings-tab { flex-shrink: 0; }
}

/* ============================================================
   MODAL (general)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,18,24,.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-xl);
  display: flex;
  flex-direction: column;
  transform: scale(.97);
  transition: transform .2s var(--ease);
  box-shadow: var(--shadow-4);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--tx-1);
}
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form .field-grid { margin-bottom: 0; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-form textarea, .modal-form input, .modal-form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--rd-sm);
  background: var(--bg-1);
  color: var(--tx-1);
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  outline: none;
  transition: all var(--dur) var(--ease);
}
.modal-form textarea { resize: vertical; min-height: 84px; }
.modal-form textarea:focus, .modal-form input:focus, .modal-form select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmdk-overlay,
.cmd-palette {
  position: fixed;
  inset: 0;
  background: rgba(16,18,24,.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s var(--ease);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
}
.cmdk-overlay.open, .cmd-palette.open { opacity: 1; pointer-events: auto; }
.cmdk {
  width: min(600px, 92%);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-xl);
  overflow: hidden;
  transform: scale(.98) translateY(-8px);
  transition: transform .15s var(--ease);
  box-shadow: var(--shadow-4);
}
.cmdk-overlay.open .cmdk { transform: scale(1) translateY(0); }
.cmdk-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--tx-1);
  font-size: 15px;
  font-family: var(--font);
  border-bottom: 1px solid var(--border);
}
.cmdk-input::placeholder { color: var(--tx-4); }
.cmdk-list { max-height: 440px; overflow-y: auto; padding: 6px; }
.cmdk-section {
  padding: 9px 12px 4px;
  font-size: 10.5px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--rd-sm);
  cursor: pointer;
  transition: background .1s var(--ease);
}
.cmdk-item:hover, .cmdk-item.selected {
  background: var(--bg-2);
  color: var(--tx-1);
}
.cmdk-icon {
  width: 28px; height: 28px;
  border-radius: var(--rd-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  color: var(--tx-2);
}
.cmdk-item.selected .cmdk-icon {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.cmdk-body { flex: 1; min-width: 0; }
.cmdk-title { font-size: 13px; color: var(--tx-1); font-weight: 500; }
.cmdk-sub   { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.cmdk-hint  { font-size: 10.5px; color: var(--tx-4); font-weight: 500; }
.cmdk-empty { padding: 32px 14px; text-align: center; color: var(--tx-3); font-size: 13px; }

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */
.notif-panel,
.notifications-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  right: 28px;
  width: 380px;
  max-height: 70vh;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-md);
  z-index: 150;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all .15s var(--ease);
  box-shadow: var(--shadow-4);
}
.notif-panel.open, .notifications-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.notif-panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-panel-head h3 { font-size: 13.5px; font-weight: 700; color: var(--tx-1); }
.notif-panel-head .clear {
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}
.notif-panel-head .clear:hover { text-decoration: underline; }
.notif-list { flex: 1; overflow-y: auto; padding: 6px; }
.notif-item {
  padding: 11px 14px;
  border-radius: var(--rd-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  margin-bottom: 1px;
}
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: var(--bg-3); }
.notif-item.unread .notif-dot { background: var(--primary); }
.notif-text {
  font-size: 12.5px;
  color: var(--tx-1);
  line-height: 1.45;
  display: flex; gap: 8px; align-items: flex-start;
}
.notif-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tx-4);
  margin-top: 5px;
  flex-shrink: 0;
}
.notif-time {
  font-size: 11px;
  color: var(--tx-3);
  margin-top: 4px;
  margin-left: 14px;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
}

/* ============================================================
   INBOX (3 colunas)
   ============================================================ */
.inbox-section { padding: 0 !important; }

.inbox-root {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-0);
  border-left: 1px solid var(--border);
}

/* === Coluna esquerda: lista === */
.inbox-list {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
  height: calc(100vh - var(--topbar-h));
}
.inbox-list-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 2;
}
.inbox-list-title {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.inbox-list-title h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--tx-1);
}
.inbox-new-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-fg);
  border: 1px solid var(--primary);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.inbox-new-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.inbox-new-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; }

.inbox-search {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  padding: 9px 12px;
  color: var(--tx-1);
  font-size: 13px;
  outline: none;
  margin-bottom: 12px;
  transition: all var(--dur) var(--ease);
}
.inbox-search:focus {
  background: var(--bg-1);
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.inbox-search::placeholder { color: var(--tx-4); }

.inbox-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.inbox-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--tx-2);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--dur) var(--ease);
  letter-spacing: .005em;
}
.inbox-chip:hover { color: var(--tx-1); background: var(--bg-1); border-color: var(--border-hover); }
.inbox-chip.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.inbox-chip .chip-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  margin-right: 5px;
  vertical-align: middle;
}

.inbox-threads {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.thread-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) var(--ease);
}
.thread-item:hover { background: var(--bg-3); }
.thread-item.active {
  background: var(--bg-3);
}
.thread-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.thread-item.unread .thread-name { color: var(--tx-1); font-weight: 700; }
.thread-item.unread::after {
  content: '';
  position: absolute;
  top: 22px;
  right: 18px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
}

.thread-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #E8E8EB, #D5D5D9);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--tx-1);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.thread-body { flex: 1; min-width: 0; }
.thread-row1 {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.thread-name {
  font-size: 13px;
  color: var(--tx-1);
  font-weight: 500;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thread-channel {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.thread-channel.email    { background: var(--info-bg); color: var(--info); }
.thread-channel.whatsapp { background: var(--success-bg); color: var(--success); }
.thread-channel.sms      { background: var(--violet-bg); color: var(--violet); }

.thread-time {
  font-size: 11px;
  color: var(--tx-3);
  flex-shrink: 0;
}
.thread-subject {
  font-size: 12.5px;
  color: var(--tx-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 2px;
  font-weight: 500;
}
.thread-snippet {
  font-size: 12px;
  color: var(--tx-3);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.inbox-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--tx-3);
}
.inbox-empty-card {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 24px 18px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  background:
    linear-gradient(135deg, rgba(0,122,255,0.035), rgba(255,255,255,0.9)),
    var(--bg-1);
  box-shadow: var(--shadow-1);
}
.inbox-empty-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.06);
}
.inbox-empty-icon svg {
  margin: 0;
  width: 34px;
  height: 34px;
}
.inbox-empty-eyebrow {
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--tx-3);
}
.inbox-empty svg { width: 48px; height: 48px; stroke: var(--tx-3); fill: none; stroke-width: 1.3; margin-bottom: 12px; opacity: .4; }
.inbox-empty .title { font-size: 17px; font-weight: 700; color: var(--tx-1); margin-bottom: 6px; letter-spacing: 0; }
.inbox-empty .sub { font-size: 12.5px; color: var(--tx-3); line-height: 1.55; }
.inbox-empty .cta { margin-top: 14px; }
.inbox-empty-steps {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  text-align: left;
}
.inbox-empty-steps span {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  color: var(--tx-2);
  font-size: 12px;
  font-weight: 600;
}
.inbox-empty-gate {
  display: inline-flex;
  margin-top: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  font-size: 10.5px;
  font-weight: 800;
}
.inbox-empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.inbox-empty-actions .composer-send,
.inbox-empty-actions .inbox-secondary-action {
  flex: 1 1 128px;
}
.inbox-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--rd-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  color: var(--tx-1);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.inbox-secondary-action:hover {
  background: var(--bg-2);
}

/* === Coluna central: thread === */
.inbox-thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-0);
}
.thread-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  display: flex; align-items: center; gap: 14px;
  min-height: 64px;
}
.thread-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--tx-1);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}
.thread-header .participants {
  font-size: 12px;
  color: var(--tx-3);
  margin-top: 2px;
}
.thread-header-actions { display: flex; gap: 6px; }
.thread-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.thread-icon-btn:hover {
  background: var(--bg-2);
  color: var(--tx-1);
  border-color: var(--border);
}
.thread-icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  background: var(--bg-0);
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: msgIn .28s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.in  { align-self: flex-start; align-items: flex-start; }

.msg-meta {
  font-size: 11px;
  color: var(--tx-3);
  margin-bottom: 5px;
  font-weight: 500;
  letter-spacing: .005em;
}
.msg-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--tx-1);
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-1);
}
.msg.out .msg-bubble {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  border-top-right-radius: 6px;
}
.msg.in .msg-bubble {
  border-top-left-radius: 6px;
}
.msg-bubble .html-body { all: revert; }
.msg-bubble .html-body * { max-width: 100%; }
.msg-bubble img { max-width: 100%; border-radius: 8px; }
.msg.out .msg-bubble a { color: #fff; text-decoration: underline; }

.msg-subject {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.msg-status {
  font-size: 10.5px;
  color: var(--tx-3);
  margin-top: 4px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.msg-status.sent    { color: var(--success); }
.msg-status.failed  { color: var(--danger); }
.msg-status.bounced { color: var(--danger); }

/* Composer (inline) */
.thread-composer {
  border-top: 1px solid var(--border);
  padding: 14px 22px 18px;
  background: var(--bg-1);
  position: relative;
}
.composer-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--tx-3);
  font-weight: 500;
}
.composer-from {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--tx-1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.composer-from:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.composer-textarea {
  width: 100%;
  min-height: 72px;
  max-height: 280px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-md);
  padding: 12px 14px;
  color: var(--tx-1);
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  line-height: 1.55;
  transition: all var(--dur) var(--ease);
}
.composer-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.composer-tools { display: flex; gap: 4px; }
.composer-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--rd-md);
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  letter-spacing: .005em;
  box-shadow: var(--shadow-1);
}
.composer-send:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.composer-send:active { transform: translateY(0); }
.composer-send svg { width: 13px; height: 13px; stroke: currentColor; fill: currentColor; stroke-width: 0; }
.composer-send[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* === Coluna direita: lead panel === */
.inbox-lead {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
  height: calc(100vh - var(--topbar-h));
}
.lead-header {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.lead-avatar-big {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: linear-gradient(135deg, #E8E8EB, #D5D5D9);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--tx-1);
  margin: 0 auto 14px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.lead-name { font-size: 16px; font-weight: 700; color: var(--tx-1); margin-bottom: 3px; letter-spacing: -.01em; }
.lead-meta { font-size: 12px; color: var(--tx-3); }
.lead-status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}
.lead-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.lead-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 12px;
}
.lead-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 8px;
  gap: 10px;
}
.lead-row .key { color: var(--tx-3); }
.lead-row .val {
  color: var(--tx-1);
  font-weight: 500;
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 200px;
}

.lead-open-btn {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  color: var(--tx-1);
  padding: 10px;
  border-radius: var(--rd-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  margin-top: 10px;
}
.lead-open-btn:hover {
  border-color: var(--primary);
  background: var(--bg-2);
  transform: translateY(-1px);
}

.lead-link-box {
  padding: 26px 22px;
  text-align: center;
}
.lead-link-box .title { font-size: 13.5px; color: var(--tx-1); font-weight: 700; margin-bottom: 6px; }
.lead-link-box .sub { font-size: 12px; color: var(--tx-3); margin-bottom: 14px; line-height: 1.5; }
.lead-link-btn {
  background: var(--primary);
  color: var(--primary-fg);
  padding: 10px 18px;
  border-radius: var(--rd-md);
  border: 1px solid var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.lead-link-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-2); }

/* Placeholder / empty thread */
.thread-placeholder {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  color: var(--tx-3);
  padding: 72px 40px 40px;
  text-align: center;
  background: var(--bg-0);
}
.thread-placeholder-card {
  width: min(100%, 360px);
  max-width: 360px;
  padding: 28px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow-1);
}
.thread-placeholder svg {
  width: 64px; height: 64px;
  stroke: var(--tx-4);
  fill: none; stroke-width: 1.2;
  margin-bottom: 16px;
  opacity: .6;
}
.thread-placeholder-eyebrow {
  margin-bottom: 8px;
  color: var(--tx-3);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.thread-placeholder .title { font-size: 17px; font-weight: 700; color: var(--tx-1); margin-bottom: 4px; }
.thread-placeholder .sub { font-size: 13px; color: var(--tx-3); line-height: 1.55; }
.thread-placeholder-gates {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}
.thread-placeholder-gates span {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--tx-2);
  font-size: 11px;
  font-weight: 700;
}
.thread-placeholder-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.thread-placeholder-actions .composer-send,
.thread-placeholder-actions .inbox-secondary-action {
  min-height: 36px;
  flex: 0 1 auto;
  max-width: 180px;
}

@media (max-width: 1200px) {
  .inbox-root { grid-template-columns: 320px 1fr; }
  .inbox-lead { display: none; }
}
@media (max-width: 800px) {
  .inbox-root { grid-template-columns: 1fr; height: auto; }
  .inbox-list { height: auto; max-height: 60vh; }
  .inbox-thread { min-height: 60vh; }
  .thread-placeholder { padding: 48px 20px 28px; }
  .thread-placeholder-card { max-width: 320px; padding: 24px 20px; }
  .thread-placeholder-actions { flex-direction: column; align-items: center; }
  .thread-placeholder-actions .composer-send,
  .thread-placeholder-actions .inbox-secondary-action {
    width: 100%;
    max-width: 220px;
  }
}

/* Inbox loading */
.inbox-loading { padding: 40px; text-align: center; color: var(--tx-3); font-size: 13px; }
.inbox-loading::after {
  content: '...';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots { 0%, 20% { content: '.' } 40% { content: '..' } 60%, 100% { content: '...' } }

/* === COMPOSER MODAL (compose) === */
.composer-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,18,24,.42);
  backdrop-filter: blur(2px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.composer-modal {
  width: min(720px, 92vw);
  max-height: 88vh;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-xl);
  box-shadow: var(--shadow-4);
  display: flex; flex-direction: column;
  animation: panelIn .25s var(--ease);
}
.composer-modal-large { width: min(1100px, 95vw); max-height: 92vh; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.composer-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.composer-modal-title { font-size: 17px; font-weight: 700; color: var(--tx-1); letter-spacing: -.01em; }
.composer-modal-close {
  background: transparent; border: none;
  color: var(--tx-3);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--dur) var(--ease);
}
.composer-modal-close:hover { color: var(--tx-1); }
.composer-channels {
  display: flex; gap: 4px;
  padding: 14px 22px 0;
}
.composer-channel-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--rd-md);
  transition: all var(--dur) var(--ease);
}
.composer-channel-tab:hover { color: var(--tx-1); background: var(--bg-2); }
.composer-channel-tab.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.composer-modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.composer-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.composer-row label {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.composer-input {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-md);
  padding: 10px 12px;
  color: var(--tx-1);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all var(--dur) var(--ease);
  width: 100%;
  box-sizing: border-box;
}
.composer-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.composer-body { resize: vertical; min-height: 180px; line-height: 1.55; }
.composer-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}
.composer-hint { font-size: 11.5px; color: var(--tx-3); }

/* ============================================================
   MARKETING (campanhas)
   ============================================================ */
.marketing-section { padding: 24px 28px; }
.marketing-root { max-width: 1400px; margin: 0 auto; }

.mkt-hero {
  padding: 36px 32px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-1);
}
.mkt-hero h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 0 0 8px;
  color: var(--tx-1);
  line-height: 1.1;
}
.mkt-hero .sub {
  color: var(--tx-3);
  font-size: 14px;
  line-height: 1.6;
  max-width: 640px;
}
.mkt-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.mkt-kpi {
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  transition: all var(--dur) var(--ease);
}
.mkt-kpi:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.mkt-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx-3);
  margin-bottom: 6px;
}
.mkt-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.02em;
  line-height: 1;
}
.mkt-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  padding-bottom: 0;
  overflow-x: auto;
}
.mkt-nav-tab {
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tx-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  margin-bottom: -1px;
}
.mkt-nav-tab:hover { color: var(--tx-1); }
.mkt-nav-tab.active {
  color: var(--tx-1);
  border-bottom-color: var(--tx-1);
  font-weight: 600;
}
.mkt-empty {
  padding: 80px 40px;
  text-align: center;
  background: var(--bg-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--rd-xl);
  color: var(--tx-3);
}
.mkt-empty .title { font-size: 18px; font-weight: 600; color: var(--tx-1); margin-bottom: 6px; letter-spacing: -.01em; }
.mkt-empty .sub { max-width: 420px; margin: 0 auto 18px; line-height: 1.6; font-size: 13.5px; }
.mkt-loading { padding: 40px; text-align: center; color: var(--tx-3); font-size: 13.5px; }

.mkt-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.mkt-toolbar-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.mkt-card {
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.mkt-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-3);
}
.mkt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.mkt-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mkt-card-meta {
  font-size: 12px;
  color: var(--tx-3);
  margin-top: 8px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.mkt-card-actions { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }

.mkt-card-status {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.mkt-status-draft     { background: var(--bg-2); color: var(--tx-2); border-color: var(--border); }
.mkt-status-scheduled { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.mkt-status-sending   { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.mkt-status-sent      { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.mkt-status-paused    { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.mkt-status-cancelled { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.mkt-status-failed    { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.mkt-status-active    { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }

.mkt-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.mkt-stat-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  padding: 14px 16px;
  transition: all var(--dur) var(--ease);
}
.mkt-stat-box:hover { border-color: var(--border-hover); box-shadow: var(--shadow-1); }
.mkt-stat-k {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}
.mkt-stat-v {
  font-size: 22px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.02em;
}

.mkt-actions-row { display: flex; gap: 8px; margin-bottom: 22px; }

.mkt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  overflow: hidden;
}
.mkt-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--tx-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.mkt-table td {
  padding: 10px 12px;
  color: var(--tx-1);
  border-bottom: 1px solid var(--border);
}
.mkt-table tr:last-child td { border-bottom: none; }

.mkt-form { display: flex; flex-direction: column; gap: 14px; }
.mkt-form-row { display: flex; flex-direction: column; gap: 6px; }
.mkt-form-row label {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.mkt-input {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-md);
  padding: 10px 12px;
  color: var(--tx-1);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all var(--dur) var(--ease);
  width: 100%;
  box-sizing: border-box;
}
.mkt-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.mkt-code { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.mkt-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-height: 280px; }
.mkt-split textarea { min-height: 280px; }
.mkt-preview {
  width: 100%;
  height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  background: #fff;
}
.mkt-snippet { white-space: pre-wrap; word-break: break-all; color: var(--tx-3); font-size: 12px; }

@media (max-width: 860px) {
  .mkt-split { grid-template-columns: 1fr; }
  .mkt-preview { height: 240px; }
}

/* ============================================================
   WIZARD (setup pages)
   ============================================================ */
.wizard-section {
  padding: 32px 40px;
  max-width: 920px;
  margin: 0 auto;
}
.wiz-loading { padding: 40px; text-align: center; color: var(--tx-3); font-size: 13.5px; }

.wiz-header { margin-bottom: 30px; }
.wiz-header h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--tx-1);
  margin: 0 0 10px;
  line-height: 1.1;
}
.wiz-header p {
  font-size: 14.5px;
  color: var(--tx-2);
  line-height: 1.6;
  margin: 0;
  max-width: 660px;
}
.wiz-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  color: var(--tx-3);
  cursor: pointer;
  margin-bottom: 16px;
  font-weight: 500;
  transition: color var(--dur) var(--ease);
}
.wiz-back:hover { color: var(--tx-1); }

.wiz-h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.01em;
  margin: 32px 0 16px;
}

.wiz-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.wiz-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.wiz-step:hover { border-color: var(--border-hover); }
.wiz-step.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17,18,20,.06);
}
.wiz-step.locked { opacity: .5; }
.wiz-step.done {
  background: var(--success-bg);
  border-color: var(--success-border);
}
.wiz-step-num {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 700;
  background: var(--bg-2);
  color: var(--tx-1);
  border: 1px solid var(--border);
}
.wiz-step.active .wiz-step-num {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}
.wiz-step.done .wiz-step-num {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.wiz-step-body { min-width: 0; }
.wiz-step-title { font-size: 15px; font-weight: 700; color: var(--tx-1); letter-spacing: -.01em; margin-bottom: 5px; }
.wiz-step-desc { font-size: 13px; color: var(--tx-3); line-height: 1.55; margin-bottom: 12px; }
.wiz-step-locked { font-size: 12px; color: var(--tx-4); font-style: italic; }

.wiz-form { display: flex; gap: 8px; }
.wiz-input {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--rd-md);
  color: var(--tx-1);
  font-size: 14px;
  outline: none;
  transition: all var(--dur) var(--ease);
}
.wiz-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }

.wiz-existing { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wiz-chip {
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--tx-1);
  font-weight: 500;
}

.wiz-info {
  display: flex; gap: 14px;
  padding: 16px 18px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--rd-md);
  font-size: 13px;
  color: var(--tx-1);
  line-height: 1.55;
}
.wiz-info-ico {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--rd-sm);
  background: rgba(47,122,198,.18);
  color: var(--info);
  display: flex; align-items: center; justify-content: center;
}

.wiz-empty {
  padding: 60px 40px;
  text-align: center;
  background: var(--bg-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--rd-xl);
}
.wiz-empty h3 { font-size: 18px; font-weight: 700; color: var(--tx-1); margin: 0 0 8px; letter-spacing: -.01em; }
.wiz-empty p { font-size: 13.5px; color: var(--tx-3); line-height: 1.6; margin: 0 auto 20px; max-width: 480px; }

.wiz-conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.wiz-conn-card {
  padding: 22px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  display: flex; gap: 14px;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.wiz-conn-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-3);
}
.wiz-conn-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.wiz-conn-body { min-width: 0; }
.wiz-conn-title { font-size: 14.5px; font-weight: 700; color: var(--tx-1); letter-spacing: -.01em; margin-bottom: 5px; }
.wiz-conn-desc { font-size: 12.5px; color: var(--tx-3); line-height: 1.55; margin-bottom: 12px; }

/* === Domínios === */
.dom-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-lg);
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.dom-box:hover { border-color: var(--border-hover); }
.dom-box-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.dom-box-title { font-size: 17px; font-weight: 700; color: var(--tx-1); letter-spacing: -.015em; }
.dom-box-sub { font-size: 11px; color: var(--tx-3); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.dom-box-actions { display: flex; gap: 6px; flex-shrink: 0; }

.dom-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dom-b {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  letter-spacing: .04em;
  border: 1px solid transparent;
  text-transform: uppercase;
}
.dom-b-ok   { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.dom-b-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.dom-b-err  { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.dom-dns-panel {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
}
.dom-dns-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-1);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}
.dom-dns-note {
  font-size: 12px;
  color: var(--warning);
  margin-top: 12px;
  padding: 9px 11px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 6px;
}

.dns-g { margin-bottom: 18px; }
.dns-g:last-child { margin-bottom: 0; }
.dns-g-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.dns-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dns-t th {
  text-align: left;
  padding: 7px 10px;
  color: var(--tx-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.dns-t td {
  padding: 10px;
  color: var(--tx-1);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.dns-t td code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--tx-1);
  word-break: break-all;
}
.dns-val {
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  border-radius: 6px;
}
.dns-val:hover { background: var(--primary-bg); }
.dns-note { font-size: 11px; color: var(--warning); margin-top: 6px; }

.dom-mbx { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.dom-mbx-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.dom-mbx-head strong {
  font-size: 11px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.mbx-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  margin-bottom: 6px;
  transition: all var(--dur) var(--ease);
}
.mbx-item:hover { border-color: var(--border-hover); }
.mbx-addr { font-size: 13.5px; font-weight: 600; color: var(--tx-1); letter-spacing: -.005em; }
.mbx-fwd { font-size: 12px; color: var(--tx-3); margin-top: 3px; }

.acc-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  margin-bottom: 8px;
  transition: all var(--dur) var(--ease);
  box-shadow: var(--shadow-1);
}
.acc-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.acc-ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
  background: var(--bg-2);
  color: var(--tx-1);
  flex-shrink: 0;
}
.acc-ico-gmail         { background: #FEE2E0; color: #D34A41; }
.acc-ico-outlook       { background: #DBEAFE; color: #1B6EC0; }
.acc-ico-custom_domain { background: var(--accent-bg); color: var(--accent); }
.acc-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-sub { font-size: 11.5px; color: var(--tx-3); margin-top: 3px; }

/* ============================================================
   FLOW BUILDER (canvas)
   ============================================================ */
.flow-builder-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  height: calc(100vh - var(--topbar-h) - 32px);
  background: var(--bg-0);
  border-radius: var(--rd-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.flow-canvas-col {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20px 20px, rgba(16,18,24,.04) 1px, transparent 1px),
    var(--bg-0);
  background-size: 24px 24px;
  position: relative;
  overflow: auto;
}
.flow-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: sticky; top: 0; z-index: 10;
}
.flow-topbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -.01em;
}
.flow-topbar-actions { display: flex; gap: 8px; }

.flow-canvas {
  position: relative;
  flex: 1;
  min-width: 720px;
  min-height: 600px;
  padding: 40px;
}

.flow-node {
  position: absolute;
  width: 240px;
  background: var(--bg-1);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: move;
  transition: all var(--dur) var(--ease);
  user-select: none;
  z-index: 2;
  box-shadow: var(--shadow-1);
}
.flow-node:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-3);
}
.flow-node.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17,18,20,.08), var(--shadow-2);
}
.flow-node-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.flow-node-ico {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.flow-node-ico svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.flow-node-title { font-size: 13px; font-weight: 600; color: var(--tx-1); line-height: 1.3; }
.flow-node-body { font-size: 12px; color: var(--tx-3); margin-top: 5px; line-height: 1.45; }

/* Node colors */
.flow-node-trigger      .flow-node-ico { background: var(--accent); }
.flow-node-trigger      .flow-node-head { color: var(--accent); }
.flow-node-delay        .flow-node-ico { background: var(--warning); }
.flow-node-delay        .flow-node-head { color: var(--warning); }
.flow-node-send_email   .flow-node-ico { background: var(--info); }
.flow-node-send_email   .flow-node-head { color: var(--info); }
.flow-node-send_whatsapp .flow-node-ico { background: var(--success); }
.flow-node-send_whatsapp .flow-node-head { color: var(--success); }
.flow-node-send_sms     .flow-node-ico { background: var(--violet); }
.flow-node-send_sms     .flow-node-head { color: var(--violet); }
.flow-node-if_branch    .flow-node-ico { background: var(--accent); }
.flow-node-if_branch    .flow-node-head { color: var(--accent); }
.flow-node-update_lead  .flow-node-ico { background: var(--tx-3); }
.flow-node-update_lead  .flow-node-head { color: var(--tx-3); }
.flow-node-end          .flow-node-ico { background: var(--danger); }
.flow-node-end          .flow-node-head { color: var(--danger); }

/* Connection handles */
.flow-node-handle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 12px;
  border-radius: 999px;
  background: var(--bg-1);
  border: 2px solid var(--tx-3);
  cursor: crosshair;
  z-index: 3;
  transition: all var(--dur) var(--ease);
}
.flow-node-handle:hover {
  background: var(--primary);
  border-color: var(--primary);
}
.flow-node-handle-top { top: -7px; }
.flow-node-handle-bottom { bottom: -7px; }
.flow-node-handle-yes { bottom: -7px; left: 30%; }
.flow-node-handle-no  { bottom: -7px; left: 70%; }

.flow-edges {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
.flow-edge-path {
  fill: none;
  stroke: rgba(16,18,24,.25);
  stroke-width: 2;
  transition: stroke var(--dur) var(--ease);
}
.flow-edge-path:hover { stroke: var(--primary); }
.flow-edge-label {
  font-size: 10px;
  font-weight: 700;
  fill: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.flow-config-panel {
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  padding: 22px;
  overflow-y: auto;
}
.flow-config-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tx-1);
  margin-bottom: 14px;
  letter-spacing: -.005em;
}
.flow-config-empty {
  color: var(--tx-3);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  padding: 40px 12px;
}

.flow-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.flow-palette-btn {
  padding: 11px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--rd-md);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: all var(--dur) var(--ease);
  color: var(--tx-1);
  font-size: 11px;
  font-weight: 600;
}
.flow-palette-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  transform: translateY(-1px);
}
.flow-palette-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.flow-field { margin-bottom: 14px; }
.flow-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}
.flow-field input,
.flow-field select,
.flow-field textarea,
.flow-input {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  color: var(--tx-1);
  border-radius: var(--rd-md);
  font-size: 12.5px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  transition: all var(--dur) var(--ease);
}
.flow-field input:focus,
.flow-field select:focus,
.flow-field textarea:focus,
.flow-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .dash-card { grid-column: span 12; }
  .dash-card-sm { grid-column: span 6; }
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr !important;
    grid-template-areas: "topbar" "main" !important;
  }
  .sidebar { display: none !important; }
  .topbar-brand span { display: none; }
  .ws-btn .ws-sub { display: none; }
  .tb-user-info { display: none; }
  .wizard-section { padding: 20px; }
  .main { padding: 18px 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 640px; }
  .dash-card-sm { grid-column: span 12; }
  .notif-panel, .notifications-panel { right: 10px; left: 10px; width: auto; }
  .kanban { grid-auto-columns: minmax(260px, 85vw); }
}

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

  .header .actions {
    justify-content: flex-start;
    width: 100%;
  }

  .header h1 {
    font-size: 26px;
    line-height: 1.08;
  }

  #activitySection {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-inline: 0 !important;
  }

  #activitySection .activity-feed {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  #activitySection .activity-feed .empty,
  #activitySection .activity-feed .loading-state {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

/* ── Meta inventory modal ─────────────────────────────── */
.meta-bm { padding: 14px; border: 1px solid var(--bd, #27272A); border-radius: 12px; margin-bottom: 12px; background: var(--bg2, rgba(255,255,255,.02)); }
.meta-bm-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.meta-bm-head small { color: var(--t3); font-size: 11px; font-family: ui-monospace, monospace; }
.meta-section { margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,.06); }
.meta-section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--t3); margin-bottom: 8px; font-weight: 600; }
.meta-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.025); margin-bottom: 6px; }
.meta-item:hover { background: rgba(255,255,255,.05); }
.meta-item-title { font-size: 13px; font-weight: 600; }
.meta-item-sub { font-size: 11.5px; color: var(--t3); margin-top: 2px; }
.meta-item-mini { padding: 6px 10px; border-radius: 6px; background: rgba(255,255,255,.02); margin-bottom: 4px; font-size: 12px; display: flex; align-items: center; justify-content: space-between; }
.meta-item-mini small { color: var(--t3); font-family: ui-monospace, monospace; font-size: 10.5px; }
.meta-empty-item { padding: 8px 12px; color: var(--t4); font-size: 12px; font-style: italic; }

/* ── WhatsApp Inbox dedicado ────────────────────────────── */
.wai-section {
  height: calc(100vh - var(--topbar-h, 60px));
  max-height: calc(100vh - var(--topbar-h, 60px));
  overflow: hidden;
  margin: -24px -28px;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
}
.wai-root {
  display: grid; grid-template-columns: 360px 1fr;
  flex: 1; min-height: 0; width: 100%;
  background: var(--bg, #fff); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--bd, rgba(60,60,67,0.12));
}
.wai-list { display: flex; flex-direction: column; border-right: 1px solid var(--bd, rgba(60,60,67,0.12)); min-height: 0; }
.wai-list-head { padding: 14px 16px; border-bottom: 1px solid var(--bd, rgba(60,60,67,0.08)); }
.wai-list-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; }
.wai-blast-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: none; border-radius: 8px;
  background: #25D366; color: #fff; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: background 0.15s;
}
.wai-blast-btn:hover { background: #1ebd5b; }
.wai-search {
  width: 100%; margin-top: 10px; padding: 8px 12px;
  border: 1px solid var(--bd, rgba(60,60,67,0.16));
  border-radius: 8px; font-size: 13px; background: rgba(120,120,128,0.06);
}
.wai-search:focus { outline: none; border-color: #25D366; background: var(--bg); }
.wai-threads { flex: 1; overflow-y: auto; }
.wai-empty { padding: 30px 16px; text-align: center; color: var(--t3); font-size: 13px; line-height: 1.6; }
.wai-filter-chips { display: flex; gap: 6px; margin-top: 8px; padding: 0 4px; }
.wai-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(120,120,128,0.10); color: var(--t2);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
}
.wai-chip:hover { background: rgba(120,120,128,0.16); }
.wai-chip.active { background: rgba(37,211,102,0.14); color: #1a8a48; border-color: rgba(37,211,102,0.3); }
.wai-chip-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #25D366; color: #fff; font-size: 10px; font-weight: 700;
}
.wai-media-block { display: flex; flex-direction: column; gap: 6px; }
.wai-media-block audio, .wai-media-block video { max-width: 100%; }
.wai-media-block video { max-height: 320px; border-radius: 8px; }
.wai-media-dl {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(37,211,102,0.10); color: #1a8a48;
  font-size: 11px; font-weight: 600; text-decoration: none;
  align-self: flex-start; transition: background 0.15s;
}
.wai-media-dl:hover { background: rgba(37,211,102,0.18); text-decoration: none; }
.wai-thread-loadmore { padding: 14px 16px; text-align: center; color: #25D366; font-size: 13px; font-weight: 600; cursor: pointer; border-top: 1px solid rgba(120,120,128,0.12); transition: background 0.15s; }
.wai-thread-loadmore:hover { background: rgba(37,211,102,0.06); }
.wai-thread-end { padding: 16px; text-align: center; color: var(--t3); font-size: 11px; opacity: 0.5; border-top: 1px solid rgba(120,120,128,0.08); }

.wai-thread-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(60,60,67,0.05);
  transition: background 0.1s;
}
.wai-thread-item:hover { background: rgba(120,120,128,0.05); }
.wai-thread-item.active { background: rgba(37,211,102,0.08); }
.wai-thread-item.unread .wai-thread-name { font-weight: 700; }
.wai-thread-item.unread .wai-thread-snippet { color: var(--label); font-weight: 500; }

.wai-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff; font-weight: 600; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wai-avatar.lg { width: 44px; height: 44px; font-size: 15px; }

.wai-thread-body { flex: 1; min-width: 0; }
.wai-thread-row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.wai-thread-name {
  font-size: 13.5px; color: var(--label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wai-thread-time { font-size: 11px; color: var(--t3); flex-shrink: 0; }
.wai-thread-snippet {
  font-size: 12px; color: var(--t3);
  margin-top: 2px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wai-badge {
  background: #25D366; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  flex-shrink: 0;
}

.wai-thread { display: flex; flex-direction: column; min-height: 0; background: rgba(248,248,250,0.4); }
.wai-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--t4);
}
.wai-thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bd, rgba(60,60,67,0.08));
  background: var(--bg, #fff);
}
.wai-thread-head-name { font-size: 14px; font-weight: 600; color: var(--label); }
.wai-thread-head-sub { font-size: 11.5px; color: var(--t3); margin-top: 2px; font-variant-numeric: tabular-nums; }

.wai-msgs {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.wai-day-sep {
  text-align: center; margin: 14px 0 8px;
  font-size: 11px; color: var(--t3);
}
.wai-day-sep span {
  background: rgba(120,120,128,0.14);
  padding: 4px 12px; border-radius: 999px;
}

.wai-bubble {
  max-width: 70%;
  padding: 8px 12px 6px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.45;
  position: relative;
  word-wrap: break-word;
}
.wai-bubble.in { align-self: flex-start; background: #fff; border: 1px solid rgba(60,60,67,0.08); border-bottom-left-radius: 4px; }
.wai-bubble.out { align-self: flex-end; background: #DCF8C6; border-bottom-right-radius: 4px; }
.wai-text { white-space: pre-wrap; }
.wai-meta {
  font-size: 10.5px; color: rgba(0,0,0,0.45);
  text-align: right; margin-top: 3px;
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
}

.wai-media-img { display: block; margin: -8px -12px 6px; max-width: 320px; }
.wai-media-img img { width: 100%; height: auto; max-height: 380px; object-fit: cover; border-radius: 10px 10px 0 0; cursor: pointer; }
.wai-media-vid { display: block; margin: -8px -12px 6px; max-width: 320px; max-height: 380px; border-radius: 10px 10px 0 0; }
.wai-media-doc { display: block; padding: 8px 12px; background: rgba(0,0,0,0.05); border-radius: 8px; margin-bottom: 4px; color: var(--label); text-decoration: none; font-size: 12.5px; }
.wai-media-pending { font-style: italic; color: var(--t3); font-size: 12px; padding: 4px 0; }

.wai-composer {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 12px 16px;
  background: var(--bg, #fff);
  border-top: 1px solid var(--bd, rgba(60,60,67,0.08));
  flex-shrink: 0;
}
.wai-icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: transparent; color: var(--t3, #8E8E93);
  cursor: pointer; transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.wai-icon-btn:hover { background: rgba(120,120,128,0.1); color: var(--label, #1c1c1e); }
.wai-icon-btn.recording { background: rgba(255,59,48,0.1); color: #ff3b30; }
.wai-icon-btn.spinning svg { animation: spin 0.6s linear; }
.wai-rec-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #ff3b30; animation: rec-pulse 1.2s infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.25); }
}
.wai-attach-preview {
  padding: 10px 16px;
  background: rgba(248,248,250,0.8);
  border-top: 1px solid var(--bd, rgba(60,60,67,0.08));
}
.wai-attach-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg, #fff);
  border: 1px solid var(--bd, rgba(60,60,67,0.12));
  border-radius: 10px;
  padding: 8px 12px;
}
.wai-attach-thumb { flex-shrink: 0; }
.wai-attach-thumb img, .wai-attach-thumb video {
  display: block; max-width: 80px; max-height: 80px; border-radius: 6px; object-fit: cover;
}
.wai-attach-info { flex: 1; min-width: 0; }
.wai-attach-name {
  font-size: 13px; font-weight: 600; color: var(--label, #1c1c1e);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wai-attach-size { font-size: 11px; color: var(--t3, #8E8E93); margin-top: 2px; }
.wai-attach-doc {
  padding: 8px 12px; background: rgba(120,120,128,0.08);
  border-radius: 6px; font-size: 12px; color: var(--label, #1c1c1e);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wai-composer textarea {
  flex: 1;
  border: 1px solid var(--bd, rgba(60,60,67,0.12));
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 13.5px; line-height: 1.4;
  resize: none; outline: none;
  font-family: inherit;
  max-height: 120px;
  background: rgba(120,120,128,0.05);
}
.wai-composer textarea:focus { border-color: #25D366; background: var(--bg); }
.wai-send {
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: #25D366; color: #fff;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.wai-send:hover { background: #1ebd5b; }

.wai-loading, .wai-spinner { text-align: center; padding: 40px; }
.wai-spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 2px solid rgba(120,120,128,0.2);
  border-top-color: #25D366; border-radius: 50%;
  animation: waSpin 0.8s linear infinite;
}

/* Blast modal */
.wai-overlay {
  position: fixed; inset: 0; z-index: 2200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.wai-modal {
  width: min(560px, 100%); max-height: 90vh;
  background: var(--bg, #fff);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.24);
}
.wai-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--bd, rgba(60,60,67,0.08));
  display: flex; align-items: flex-start; justify-content: space-between;
}
.wai-modal-title { font-size: 16px; font-weight: 700; }
.wai-modal-sub { font-size: 12px; color: var(--t3); margin-top: 2px; }
.wai-modal-close {
  background: rgba(120,120,128,0.16); color: var(--t2);
  border: none; width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 18px;
}
.wai-modal-body { padding: 20px; overflow-y: auto; }

.wai-blast-step { margin-bottom: 18px; }
.wai-label { display: block; font-size: 12px; font-weight: 600; color: var(--label); margin-bottom: 6px; }
.wai-help { font-size: 11.5px; color: var(--t3); margin-top: 6px; }
.wai-input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--bd, rgba(60,60,67,0.16));
  border-radius: 8px; font-size: 13px; background: var(--bg);
}
.wai-input:focus { outline: none; border-color: #25D366; }
.wai-input-sm { padding: 6px 10px; font-size: 12.5px; }

.wai-tpl-preview {
  padding: 10px 12px; background: rgba(220,248,198,0.5);
  border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  border: 1px solid rgba(37,211,102,0.2);
}
.wai-tpl-preview mark { background: rgba(37,211,102,0.3); padding: 0 4px; border-radius: 3px; color: #128C7E; font-weight: 600; }

.wai-leads-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.wai-leads { max-height: 240px; overflow-y: auto; border: 1px solid var(--bd, rgba(60,60,67,0.12)); border-radius: 8px; }
.wai-lead-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(60,60,67,0.05);
}
.wai-lead-row:hover { background: rgba(120,120,128,0.05); }
.wai-lead-name { font-size: 13px; font-weight: 500; color: var(--label); }
.wai-lead-sub { font-size: 11px; color: var(--t3); }
.wai-leads-summary { margin-top: 8px; font-size: 12px; color: var(--t3); }

.wai-blast-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.wai-progress { background: rgba(120,120,128,0.15); border-radius: 999px; height: 8px; overflow: hidden; margin-top: 14px; }
.wai-progress-bar { height: 100%; background: linear-gradient(90deg, #25D366, #128C7E); transition: width 0.3s; }

.source-state-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--t1);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 12px 30px rgba(15,23,42,0.06);
}
.source-state-kicker {
  font-size: 10px;
  font-weight: 760;
  line-height: 1.2;
  color: rgba(75, 85, 99, 0.78);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.source-state-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--t1);
  margin-bottom: 4px;
}
.source-state-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--t2);
}
.source-state-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.source-state-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(248, 250, 252, 0.92);
  color: rgba(55, 65, 81, 0.82);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0;
}
