: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: #a7b3c4;
  --text3: #8592a6;
  /* rotulo de coluna e de cartao: branco, porque e o que guia a leitura */
  --rotulo: #ffffff;
  --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: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--rotulo); font-weight: 600; 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: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--rotulo); font-weight: 600; }
.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;
  /* branco puro com um brilho de leve, para o título saltar sem colorir a tela */
  color: #fff; letter-spacing: -.01em;
  text-shadow: 0 0 18px rgba(255,255,255,.22), 0 1px 0 rgba(0,0,0,.35);
  padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.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; word-break: break-word; }
.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: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--rotulo); padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
.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; }

/* ============================================================
   MODO CLARO
   Não é branco puro: fundo cinza-azulado quente e cartões um tom
   acima, para não cansar a vista de quem lê o dia inteiro. As cores
   de destaque ficam mais escuras aqui, senão somem no claro.
   ============================================================ */
:root[data-tema="claro"] {
  --bg: #e9ecf1;
  --bg2: #eff1f5;
  --bg3: #e2e6ec;
  --card: #f7f8fa;
  --card2: #eef1f5;
  --border: #d2d8e2;
  --border2: #b9c2d0;

  --accent: #15803d;
  --accent2: #166534;
  --accent-dim: rgba(21,128,61,.10);
  --accent-glow: rgba(21,128,61,.14);
  --orange: #c2410c;
  --orange2: #9a3412;
  --orange-dim: rgba(194,65,12,.10);
  --blue: #1d4ed8;
  --blue-dim: rgba(29,78,216,.10);
  --cyan: #0e7490;
  --cyan-dim: rgba(14,116,144,.10);
  --red: #b91c1c;
  --red-dim: rgba(185,28,28,.10);

  --text: #16202e;
  --text2: #46536a;
  --text3: #64708a;
  --rotulo: #0d1520;
}

:root[data-tema="claro"] .section-title {
  color: var(--rotulo);
  text-shadow: none;
}
:root[data-tema="claro"] .btn-primary,
:root[data-tema="claro"] .logo-mark { color: #fff; }
:root[data-tema="claro"] .chart-bar {
  background: linear-gradient(180deg, var(--accent), rgba(21,128,61,.28));
}
:root[data-tema="claro"] ::selection { background: rgba(21,128,61,.20); }
:root[data-tema="claro"] .tag { border-color: var(--border2); }
:root[data-tema="claro"] .card { box-shadow: 0 1px 2px rgba(16,24,40,.06); }
:root[data-tema="claro"] input,
:root[data-tema="claro"] select,
:root[data-tema="claro"] textarea { background: #fff; }

.tema-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text2);
  border-radius: 9px; padding: 5px 9px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all .2s;
}
.tema-btn:hover { color: var(--text); border-color: var(--border2); background: var(--bg3); }

/* ajustes finos do claro em coisas que tinham cor fixa de tema escuro */
:root[data-tema="claro"] .topbar { background: rgba(247,248,250,.85); }
:root[data-tema="claro"] .btn {
  background: #fff; border-color: var(--border2); color: var(--text);
}
:root[data-tema="claro"] .btn:hover { background: var(--bg3); border-color: #97a3b6; }
:root[data-tema="claro"] .btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
:root[data-tema="claro"] .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff;
}
:root[data-tema="claro"] .btn-primary:hover { box-shadow: 0 6px 22px rgba(21,128,61,.28); }
:root[data-tema="claro"] .btn-danger { color: var(--red); border-color: rgba(185,28,28,.35); background: var(--red-dim); }
:root[data-tema="claro"] .btn:disabled { opacity: .45; }
:root[data-tema="claro"] .list-row { background: #fff; }
:root[data-tema="claro"] .table tbody tr:hover { background: #eef1f6; }
:root[data-tema="claro"] .modal { box-shadow: 0 24px 60px rgba(16,24,40,.22); }
:root[data-tema="claro"] .modal-overlay { background: rgba(16,24,40,.35); }
:root[data-tema="claro"] .sidebar { background: #f2f4f8; }
:root[data-tema="claro"] .nav-item:hover { background: #e6eaf1; }

/* barra de filtros ativos: precisa saltar aos olhos, é a resposta a
   "não dá para saber o que está filtrado" */
.filtros-ativos {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding: 9px 12px; border-radius: 10px;
  background: var(--accent-dim); border: 1px solid var(--accent-glow);
  font-size: 13px;
}
.filtros-ativos.vazio { background: transparent; border-color: transparent; padding: 4px 2px; font-size: 12px; }
.filtros-ativos .fa-rotulo {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--rotulo); font-weight: 600;
}
.filtros-ativos .fa-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 8px; padding: 4px 9px; color: var(--text);
}
.filtros-ativos .fa-chip a { cursor: pointer; color: var(--text3); font-size: 11px; }
.filtros-ativos .fa-chip a:hover { color: var(--red); }

/* cabeçalho de funil recolhível */
.funil-cab {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  flex-wrap: wrap; user-select: none;
}
.funil-cab:hover .funil-nome { color: var(--accent); }
.funil-seta { color: var(--text3); font-size: 12px; width: 12px; flex: none; }
.funil-nome {
  font-size: 15px; font-weight: 700; color: var(--rotulo); letter-spacing: -.01em;
  transition: color .15s;
}
.funil-resumo { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.funil-dica { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-dim); }
.funil-cab:hover .funil-dica { background: var(--accent-glow); }

/* faixa de alerta de audiência, acima do conteúdo, em qualquer aba */
.alerta-agenda {
  display: flex; align-items: center; gap: 12px; padding: 11px 26px; font-size: 13.5px;
  background: var(--orange-dim); border-bottom: 1px solid rgba(249,115,22,.35); color: var(--text);
}
.alerta-agenda.hoje { background: var(--red-dim); border-bottom-color: rgba(248,113,113,.45); }
.alerta-agenda .alerta-icone { font-size: 16px; }
.alerta-agenda a { color: var(--accent); }
.alerta-agenda.hoje a { color: var(--red); }

/* calendário da agenda */
.cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cab { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--rotulo); text-align: center; padding: 4px 0 8px; font-weight: 600; }
.cal-dia {
  min-height: 64px; border: 1px solid var(--border); border-radius: 10px; padding: 8px;
  background: var(--bg3); cursor: pointer; transition: all .15s; display: flex; flex-direction: column; gap: 4px;
}
.cal-dia:hover { border-color: var(--border2); background: var(--card2); }
.cal-dia.vazio { background: transparent; border-color: transparent; cursor: default; }
.cal-dia.passado { opacity: .45; }
.cal-dia.hoje { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-dia.tem { background: var(--orange-dim); border-color: rgba(249,115,22,.35); }
.cal-dia.tem.hoje { background: var(--red-dim); border-color: var(--red); }
.cal-dia.escolhido { box-shadow: 0 0 0 2px var(--accent) inset; }
.cal-num { font-weight: 700; font-size: 14px; color: var(--text); }
.cal-marca { font-family: var(--mono); font-size: 10.5px; color: var(--orange); font-weight: 600; }
.cal-dia.tem.hoje .cal-marca { color: var(--red); }
