:root {
  --bg: #080b12;
  --bg2: #0c1017;
  --bg3: #111621;
  --card: #12171f;
  --card2: #161c28;
  --border: #1a2132;
  --border2: #232d42;
  --accent: #4ade80;
  --accent2: #22c55e;
  --accent-dim: rgba(74,222,128,.08);
  --accent-glow: rgba(74,222,128,.12);
  --orange: #f97316;
  --orange2: #fb923c;
  --orange-dim: rgba(249,115,22,.08);
  --blue: #60a5fa;
  --blue-dim: rgba(96,165,250,.08);
  --cyan: #22d3ee;
  --cyan-dim: rgba(34,211,238,.08);
  --red: #f87171;
  --red-dim: rgba(248,113,113,.08);
  --text: #eef2f7;
  --text2: #8b98ab;
  --text3: #5a6577;
  --mono: 'JetBrains Mono', monospace;
}

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

::selection { background: rgba(74,222,128,.25); }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* fundo */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(74,222,128,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,222,128,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.bg-glow { position: fixed; z-index: 0; pointer-events: none; border-radius: 50%; filter: blur(120px); }
.glow-green { width: 600px; height: 600px; left: -200px; top: 20%; background: rgba(74,222,128,.05); }
.glow-orange { width: 500px; height: 500px; right: -150px; top: 10%; background: rgba(249,115,22,.04); }
.glow-blue { width: 700px; height: 400px; left: 35%; top: 60%; background: rgba(96,165,250,.03); }

#app { position: relative; z-index: 1; height: 100vh; display: flex; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2d3a55; }

/* ---------- componentes base ---------- */
.mono { font-family: var(--mono); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 13px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 70px; }
label.field-label {
  display: block; font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin: 14px 0 6px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
  transition: all .2s;
}
.btn:hover { border-color: var(--border2); background: var(--card2); transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent2), #16a34a);
  border-color: transparent; color: #04150a;
  box-shadow: 0 4px 20px rgba(34,197,94,.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(34,197,94,.3); background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.btn-danger { color: var(--red); border-color: rgba(248,113,113,.25); background: var(--red-dim); }
.btn-danger:hover { background: rgba(248,113,113,.15); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); transform: none; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 6px; letter-spacing: .03em;
}
.tag-green { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(74,222,128,.18); }
.tag-orange { background: var(--orange-dim); color: var(--orange2); border: 1px solid rgba(249,115,22,.18); }
.tag-blue { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(96,165,250,.18); }
.tag-cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(34,211,238,.18); }
.tag-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,.18); }
.tag-gray { background: rgba(139,152,171,.08); color: var(--text2); border: 1px solid var(--border); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; transition: border-color .25s, transform .25s, box-shadow .25s;
}
.card:hover { border-color: rgba(74,222,128,.3); }

/* ---------- login ---------- */
.login-wrap {
  width: 100%; height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 400px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: rise .4s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent2), #15803d);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(34,197,94,.25);
}
.logo-mark.logo-photo { background: var(--bg3); overflow: hidden; }
.logo-mark.logo-photo img { width: 100%; height: 100%; object-fit: cover; }
.logo-name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.logo-name span { color: var(--accent); }
.logo-sub { font-family: var(--mono); font-size: 9.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .26em; color: var(--text2); margin-top: 2px; }
.login-sub { color: var(--text2); font-size: 13px; margin-top: 10px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text3); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-toggle { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text2); }
.login-toggle a { color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: none; }
.btn-google { width: 100%; background: var(--bg3); }
.gsi-wrap { display: flex; justify-content: center; }

/* ---------- layout ---------- */
.sidebar {
  width: 232px; flex-shrink: 0; height: 100vh;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .logo { padding: 0 10px 22px; }
.sidebar .logo-name { font-size: 16.5px; }
.sidebar .logo-sub { font-size: 8.5px; }
.nav-section { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--text3); padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; color: var(--text2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; border: 1px solid transparent;
  transition: all .2s; text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(74,222,128,.15); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-badge { margin-left: auto; font-family: var(--mono); font-size: 10px; background: var(--orange-dim); color: var(--orange2); padding: 1px 7px; border-radius: 6px; }
.sidebar-footer { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--border); }
.user-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #06121f;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 62px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; border-bottom: 1px solid var(--border); background: rgba(12,16,23,.6);
  backdrop-filter: blur(10px);
}
.page-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { flex: 1; overflow-y: auto; padding: 26px; }
.content.no-pad { padding: 0; }

/* ---------- dashboard ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; transition: border-color .25s; position: relative; overflow: hidden; }
.stat-card:hover { border-color: rgba(74,222,128,.3); }
.stat-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }
.stat-accent { position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 14px; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 16px; }
.chart-bar { flex: 1; max-width: 52px; background: linear-gradient(180deg, var(--accent2), rgba(34,197,94,.25)); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; transition: all .3s; }
.chart-bar:hover { background: linear-gradient(180deg, var(--accent), var(--accent2)); }
.chart-bar .tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 5px; font-family: var(--mono); font-size: 10px; color: var(--text2); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.chart-bar:hover .tip { opacity: 1; }
.section-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.section-title .tag { font-weight: 500; }

.list-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 12px; margin-top: 8px;
  background: var(--bg3); transition: border-color .2s;
}
.list-row:hover { border-color: var(--border2); }

/* ---------- kanban ---------- */
.kanban-wrap { height: 100%; display: flex; flex-direction: column; }
.kanban-head { display: flex; align-items: center; gap: 12px; padding: 18px 26px 8px; flex-wrap: wrap; }
.board-tabs { display: flex; gap: 7px; flex-wrap: wrap; }
.board-tab {
  padding: 7px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--card); color: var(--text2);
  cursor: pointer; transition: all .2s;
}
.board-tab:hover { color: var(--text); border-color: var(--border2); }
.board-tab.active { color: var(--accent); background: var(--accent-dim); border-color: rgba(74,222,128,.25); }
.kanban-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 14px 26px 22px; display: flex; gap: 14px; align-items: flex-start; }
.kanban-col {
  width: 280px; flex-shrink: 0; max-height: 100%;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; transition: border-color .2s;
}
.kanban-col.drag-over { border-color: var(--accent2); background: var(--bg3); }
.kanban-col-head { padding: 14px 16px 10px; display: flex; align-items: center; gap: 9px; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--accent); box-shadow: 0 0 8px rgba(74,222,128,.6); }
.dot-orange { background: var(--orange); box-shadow: 0 0 8px rgba(249,115,22,.6); }
.dot-blue { background: var(--blue); box-shadow: 0 0 8px rgba(96,165,250,.6); }
.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px rgba(34,211,238,.6); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(248,113,113,.6); }
.col-name { font-weight: 700; font-size: 13.5px; flex: 1; }
.col-count { font-family: var(--mono); font-size: 11px; color: var(--text3); background: var(--bg3); padding: 1px 8px; border-radius: 6px; }
.col-metrics { padding: 0 16px 9px; font-family: var(--mono); font-size: 10.5px; color: var(--text3); display: flex; gap: 12px; }
.col-metrics b { color: var(--accent); font-weight: 600; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 4px 10px 10px; min-height: 60px; }
.lead-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; cursor: grab;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.lead-card:hover { border-color: rgba(74,222,128,.35); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.lead-card.dragging { opacity: .4; }
.lead-name { font-weight: 600; font-size: 13.5px; }
.lead-phone { font-family: var(--mono); font-size: 11px; color: var(--text3); margin-top: 3px; }
.lead-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.lead-value { font-family: var(--mono); font-size: 11px; color: var(--accent); font-weight: 600; margin-left: auto; }
.col-add-lead { margin: 0 10px 10px; padding: 8px; border: 1px dashed var(--border2); border-radius: 10px; background: transparent; color: var(--text3); font-size: 12px; font-weight: 600; transition: all .2s; }
.col-add-lead:hover { color: var(--accent); border-color: rgba(74,222,128,.4); background: var(--accent-dim); }
.kanban-add-col { width: 260px; flex-shrink: 0; padding: 14px; border: 1px dashed var(--border2); border-radius: 16px; background: transparent; color: var(--text3); font-weight: 600; transition: all .2s; }
.kanban-add-col:hover { color: var(--accent); border-color: rgba(74,222,128,.4); }

/* metrics panel */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.metric-col-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.metric-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 7px; }
.metric-row b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.progress { height: 5px; background: var(--bg3); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .4s; }

/* ---------- chat ---------- */
.chat-layout { display: flex; height: 100%; }
.chat-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--bg2); display: flex; flex-direction: column; }
.chat-list-head { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-list-scroll { flex: 1; overflow-y: auto; padding: 8px; }
.conv-item { padding: 11px 12px; border-radius: 11px; cursor: pointer; transition: background .2s; border: 1px solid transparent; }
.conv-item:hover { background: var(--bg3); }
.conv-item.active { background: var(--accent-dim); border-color: rgba(74,222,128,.18); }
.conv-name { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.conv-time { font-family: var(--mono); font-size: 10px; color: var(--text3); font-weight: 400; flex-shrink: 0; }
.conv-preview { font-size: 12px; color: var(--text3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 13px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: rgba(12,16,23,.5); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 7px; }
.msg { max-width: 65%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg strong { font-weight: 700; }
.msg em { font-style: italic; }
.msg del { text-decoration: line-through; }
.msg code { font-family: var(--mono); padding: 1px 4px; border-radius: 4px; background: rgba(0,0,0,.18); }
.msg-out { align-self: flex-end; background: rgba(34,197,94,.13); border: 1px solid rgba(74,222,128,.2); border-bottom-right-radius: 4px; }
.msg-in { align-self: flex-start; background: var(--card2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-meta { font-family: var(--mono); font-size: 9.5px; color: var(--text3); margin-top: 5px; display: flex; gap: 7px; }
.chat-input-bar { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--bg2); }
.chat-input-bar select { width: 190px; flex-shrink: 0; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text3); gap: 10px; }

/* ---------- workflow editor ---------- */
.wf-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg2); flex-wrap: wrap; }
.wf-canvas-wrap { position: absolute; inset: 0; overflow: hidden; background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 24px 24px; }
.wf-canvas { position: absolute; inset: 0; }
.wf-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wf-node {
  position: absolute; width: 230px; background: var(--card); border: 1px solid var(--border2);
  border-radius: 14px; cursor: grab; user-select: none;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); transition: border-color .2s, box-shadow .2s;
}
.wf-node:hover { border-color: rgba(74,222,128,.4); }
.wf-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim), 0 6px 24px rgba(0,0,0,.35); }
.wf-node-head { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 12.5px; border-radius: 14px 14px 0 0; }
.wf-node-body { padding: 10px 13px; font-size: 12px; color: var(--text2); line-height: 1.5; min-height: 36px; word-break: break-word; }
.wf-port {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--accent2); cursor: crosshair; z-index: 5;
  transition: transform .15s, background .15s;
}
.wf-port:hover { transform: scale(1.35); background: var(--accent2); }
.wf-port-in { left: -7px; top: 20px; border-color: var(--blue); }
.wf-port-out { right: -7px; bottom: 18px; }
.wf-port-yes { right: -7px; top: 42px; border-color: var(--accent2); }
.wf-port-no { right: -7px; top: 70px; border-color: var(--red); }
.wf-port-label { position: absolute; right: 12px; font-family: var(--mono); font-size: 9px; color: var(--text3); }
.wf-palette { display: flex; gap: 8px; flex-wrap: wrap; }
.wf-palette button { font-size: 12px; }
.wf-sidepanel {
  position: absolute; right: 14px; top: 14px; width: 290px; z-index: 10;
  background: var(--card); border: 1px solid var(--border2); border-radius: 16px;
  padding: 18px; box-shadow: 0 16px 48px rgba(0,0,0,.5); max-height: calc(100% - 28px); overflow-y: auto;
}
.wf-list-item { display: flex; align-items: center; gap: 14px; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--bg3); border: 1px solid var(--border2); border-radius: 12px; transition: all .25s; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 2px; left: 2px; background: var(--text3); transition: all .25s; }
.switch input:checked + .track { background: rgba(34,197,94,.25); border-color: var(--accent2); }
.switch input:checked + .track::after { left: 19px; background: var(--accent); box-shadow: 0 0 8px rgba(74,222,128,.6); }

/* ---------- tables / settings ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 500; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table tr { transition: background .15s; }
.table tbody tr:hover { background: var(--bg3); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } .dash-grid { grid-template-columns: 1fr; } }

.number-card { display: flex; align-items: center; gap: 14px; }
.number-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-dim); border: 1px solid rgba(74,222,128,.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(4,6,10,.7);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease; padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border: 1px solid var(--border2); border-radius: 16px;
  width: 520px; max-width: 100%; max-height: calc(100vh - 60px); overflow-y: auto;
  padding: 26px; box-shadow: 0 30px 90px rgba(0,0,0,.6); animation: rise .25s ease;
}
.modal-wide { width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.modal-close { background: transparent; border: none; color: var(--text3); font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px; transition: all .2s; }
.modal-close:hover { color: var(--text); background: var(--bg3); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--card2); border: 1px solid var(--border2); border-radius: 12px;
  padding: 13px 18px; font-size: 13px; font-weight: 500; min-width: 240px;
  box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: slideIn .3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.ok { border-color: rgba(74,222,128,.35); }
.toast.err { border-color: rgba(248,113,113,.4); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- alerta de tarefa ---------- */
#task-alert-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 10px; width: 480px; max-width: calc(100vw - 32px); }
.task-alert {
  background: linear-gradient(135deg, rgba(249,115,22,.14), var(--card2));
  border: 1px solid var(--orange); border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 0 0 4px rgba(249,115,22,.12), 0 20px 60px rgba(0,0,0,.6);
  animation: pulseAlert 2s ease infinite, rise .35s ease;
  display: flex; align-items: center; gap: 14px;
}
@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 4px rgba(249,115,22,.12), 0 20px 60px rgba(0,0,0,.6); }
  50% { box-shadow: 0 0 0 9px rgba(249,115,22,.06), 0 20px 60px rgba(0,0,0,.6); }
}
.task-alert-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--orange-dim); border: 1px solid rgba(249,115,22,.4); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 19px; }
.task-alert-title { font-weight: 700; font-size: 14px; }
.task-alert-sub { font-size: 12px; color: var(--text2); margin-top: 2px; font-family: var(--mono); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text3); }
.empty-state .big { font-size: 38px; margin-bottom: 12px; opacity: .8; }
.empty-state .hint { font-size: 13px; margin-top: 6px; }

.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.w-full { width: 100%; }
.text-2 { color: var(--text2); } .text-3 { color: var(--text3); }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Melhorias de conta, datas e tarefas da Ayla */
.account-menu { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px;
  text-align: left; color: var(--text); background: transparent; border: 1px solid transparent;
  border-radius: 12px; cursor: pointer; transition: background .2s, border-color .2s;
}
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--bg3); border-color: var(--border); }
.account-trigger-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-chevron { color: var(--text3); font-size: 14px; }
.account-popover { position: absolute; z-index: 60; bottom: calc(100% + 8px); left: 0; right: 0; padding: 6px; border: 1px solid var(--border2); border-radius: 12px; background: var(--card); box-shadow: 0 16px 40px rgba(0,0,0,.45); }
.account-popover[hidden] { display: none !important; }
.account-popover button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; color: var(--text2); background: transparent; cursor: pointer; font-size: 13px; }
.account-popover button:hover { background: var(--bg3); color: var(--text); }
.account-popover .account-logout { color: var(--red); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px; }

.dashboard-task-list { max-height: 248px; overflow-y: auto; padding-right: 4px; }
.dashboard-task-row { min-height: 56px; }
.task-list-row { gap: 10px; }
.task-checkbox {
  appearance: none; width: 18px; height: 18px; margin: 0; flex: 0 0 18px;
  border: 1.5px solid var(--border2); border-radius: 5px; background: var(--bg2);
  cursor: pointer; display: inline-grid; place-content: center;
}
.task-checkbox::before { content: ''; width: 9px; height: 5px; border-left: 2px solid #06120a; border-bottom: 2px solid #06120a; transform: rotate(-45deg) scale(0); transform-origin: center; }
.task-checkbox:checked { background: var(--accent); border-color: var(--accent); }
.task-checkbox:checked::before { transform: rotate(-45deg) scale(1); }
.task-checkbox:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.date-time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date-time-grid input[type="date"], .date-time-grid input[type="time"] { width: 100%; }
.task-time-toggle { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text2); font-size: 13px; cursor: pointer; }
.task-time-toggle input { width: auto; }
.lead-picker-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--bg2); }
.lead-picker-option { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.lead-picker-option:hover { background: var(--bg3); }
.lead-picker-option input { width: auto; flex: 0 0 auto; }
.lead-picker-option span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lead-picker-option small { color: var(--text3); font-size: 11px; }
.lead-picker-count { margin-top: 5px; color: var(--text3); font-size: 11px; text-align: right; }
@media (max-width: 600px) {
  .date-time-grid { grid-template-columns: 1fr; gap: 0; }
  .task-list-row { flex-wrap: wrap; }
}
/* Busca de leads e eixo temporal do dashboard */
.chart-bars { gap: 4px; }
.chart-bar-empty { background: rgba(148,163,184,.16); }
.chart-timeline { display: grid; grid-template-columns: repeat(14,minmax(22px,1fr)); gap: 4px; margin-top: 9px; overflow-x: auto; padding: 4px 0 2px; }
.chart-timeline-day { display: flex; min-width: 22px; flex-direction: column; align-items: center; gap: 4px; color: var(--text3); font: 9px var(--mono); }
.chart-timeline-count { min-height: 11px; color: var(--text2); }
.chart-timeline-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.chart-timeline-dot.has-lead { background: var(--accent); box-shadow: 0 0 7px rgba(34,197,94,.45); }
.chart-timeline-date { white-space: nowrap; }
.lead-picker-selected { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.lead-chip { border: 1px solid var(--border); border-radius: 999px; background: var(--bg3); color: var(--text); padding: 5px 9px; font-size: 11px; cursor: pointer; }
.lead-chip span { color: var(--text3); margin-left: 4px; }
.lead-picker-empty { padding: 12px 8px; color: var(--text3); font-size: 12px; text-align: center; }
.lead-picker-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--bg2); }
.scheduled-actions { white-space: nowrap; }
@media (max-width: 700px) { .chart-timeline { grid-template-columns: repeat(14,24px); } }

.chat-tags-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 20px; min-height:42px; border-bottom:1px solid var(--border); background:rgba(12,16,23,.28); }
.chat-tags-list { display:flex; align-items:center; flex-wrap:wrap; gap:6px; min-width:0; }
.chat-tag-pill { border:0; cursor:pointer; }
.chat-tag-pill span { margin-left:4px; opacity:.7; }
.chat-tag-add { display:flex; align-items:center; gap:6px; flex:0 1 310px; }
.chat-tag-add input { min-width:0; height:34px; }
.chat-tag-add button { flex-shrink:0; }
@media (max-width:700px) { .chat-tags-bar { align-items:stretch; flex-direction:column; padding:8px 12px; } .chat-tag-add { flex-basis:auto; } }

/* Alinhamento de cursos e seleção múltipla no funil */
.course-list { display:flex; flex-direction:column; gap:6px; max-height:150px; overflow:auto; }
.course-option { display:flex; align-items:flex-start; justify-content:flex-start; gap:9px; width:100%; min-width:0; text-align:left; font-size:12.5px; line-height:1.35; cursor:pointer; }
.course-option input { flex:0 0 15px; width:15px; height:15px; margin:1px 0 0; }
.course-option span { flex:1; min-width:0; overflow-wrap:anywhere; }
.kanban-bulk-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:10px 26px 0; }
.kanban-bulk-tools select { width:auto; min-width:240px; max-width:min(420px, 100%); }
.lead-card-head { display:flex; align-items:flex-start; gap:9px; }
.lead-card-select { flex:0 0 15px; width:15px; height:15px; margin:2px 0 0; cursor:pointer; }
.lead-card-head .lead-name { flex:1; min-width:0; }

/* Dashboard com atualização e distribuição por etapa */
.dashboard-main-grid { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); align-items:start; }
.dashboard-funnels-card { max-height: 390px; overflow:auto; }
.dashboard-funnel { margin-top:12px; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--bg2); }
.dashboard-funnel > header { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; font-size:13px; }
.dashboard-funnel > header span { color:var(--text3); font:11px var(--mono); }
.dashboard-funnel-stages { display:grid; gap:5px; }
.dashboard-funnel-stage { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:8px; background:var(--bg3); font-size:12px; }
.dashboard-funnel-stage-name { flex:1; min-width:0; overflow-wrap:anywhere; }
.dashboard-funnel-stage strong { color:var(--text); font:12px var(--mono); }
.schedule-recipient-box { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--bg2); }
.schedule-recipient-preview { display:flex; flex-wrap:wrap; gap:6px; width:100%; }
.schedule-picker-filters { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:10px; }
.schedule-recipient-list { max-height:300px; overflow:auto; border:1px solid var(--border); border-radius:10px; margin-top:8px; }
.schedule-recipient-row { display:flex; align-items:center; gap:10px; padding:10px 12px; border-bottom:1px solid var(--border); cursor:pointer; }
.schedule-recipient-row:last-child { border-bottom:0; }
.schedule-recipient-row:hover { background:var(--bg3); }
.schedule-recipient-row input { flex:0 0 16px; width:16px; height:16px; }
.schedule-recipient-row span { display:flex; flex-direction:column; min-width:0; gap:2px; }
.schedule-recipient-row strong { font-size:12.5px; }
.schedule-recipient-row small { color:var(--text3); font:10px var(--mono); }
.msg { white-space:normal; max-width:min(65%, 520px); padding:8px 12px; }
.msg-body { white-space:pre-wrap; overflow-wrap:anywhere; }
.msg-meta { margin-top:4px; }
@media (max-width: 800px) { .dashboard-main-grid { grid-template-columns:1fr; } .schedule-picker-filters { grid-template-columns:1fr; } .msg { max-width:88%; } }

.msg-out { background:rgba(34,197,94,.07); border-color:rgba(74,222,128,.12); }
.schedule-picker-list-actions { display:flex; justify-content:flex-end; margin-top:10px; }
