/* Vzion Agency — tema dark profissional */
:root {
  --bg: #0a0c10;
  --surface: #12151b;
  --surface-2: #1a1e26;
  --border: #232833;
  --border-hover: #323a48;
  --text: #e8ecf1;
  --muted: #8b95a5;
  --faint: #5b6472;
  --accent: #5b8cff;
  --accent-dim: rgba(91, 140, 255, .12);
  --green: #3ecf8e;
  --green-dim: rgba(62, 207, 142, .12);
  --yellow: #f5b83d;
  --yellow-dim: rgba(245, 184, 61, .12);
  --red: #f0616d;
  --red-dim: rgba(240, 97, 109, .12);
  --radius: 10px;
  --sidebar-w: 232px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8b5bff);
  display: grid; place-items: center; font-size: 17px;
}
.brand-name { font-weight: 650; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--faint); }
.brand-sub.on { color: var(--green); }
nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
nav a svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
nav a:hover { background: var(--surface-2); color: var(--text); }
nav a.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-footer { padding: 14px 16px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--border); }

/* ---------- main ---------- */
main { margin-left: var(--sidebar-w); padding: 28px 32px; min-height: 100vh; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- cards / grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
}
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .n.green { color: var(--green); }
.stat .n.accent { color: var(--accent); }
.stat .n.yellow { color: var(--yellow); }

/* ---------- forms ---------- */
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; font-size: 13.5px; font-family: var(--font);
  outline: none; transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: opacity .12s, transform .05s;
  text-decoration: none;
}
button:hover { opacity: .9; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { border-color: var(--border-hover); }
button.green { background: var(--green); color: #04150c; }
button.danger { background: var(--red); }
button.sm { padding: 6px 12px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 22px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--green-dim); border-color: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--green); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr { transition: background .1s; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td .sub { color: var(--faint); font-size: 11.5px; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.b-pendente { background: var(--surface-2); color: var(--muted); }
.b-enviado { background: var(--accent-dim); color: var(--accent); }
.b-respondeu { background: var(--yellow-dim); color: var(--yellow); }
.b-interessado { background: var(--green-dim); color: var(--green); }
.b-erro { background: var(--red-dim); color: var(--red); }
.b-recusou { background: var(--surface-2); color: var(--faint); }

/* ---------- filters / pagination ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters .search { min-width: 220px; }
.pagination { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding-top: 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 200px; }
.kanban-col.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.kanban-head { padding: 12px 14px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.kanban-head .count { color: var(--faint); }
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.kanban-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; cursor: grab; font-size: 12.5px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .name { font-weight: 600; margin-bottom: 3px; }
.kanban-card .meta { color: var(--faint); font-size: 11px; }

/* ---------- logs ---------- */
.logs {
  background: #05070a; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; height: calc(100vh - 220px); min-height: 300px;
  overflow-y: auto; font-family: var(--mono); font-size: 12px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.logs .line-pedro { color: var(--accent); }
.logs .line-paulo { color: var(--green); }
.logs .line-auto { color: var(--yellow); }

/* ---------- drawer (detalhe do lead) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 40; animation: fade .15s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 50; display: flex; flex-direction: column;
  animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-head h2 { font-size: 16px; font-weight: 650; }
.drawer-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; font-size: 13px; margin-bottom: 18px; }
.kv dt { color: var(--faint); }
.chat { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.msg.assistant { background: var(--accent-dim); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.user { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg .time { display: block; font-size: 10px; color: var(--faint); margin-top: 4px; }
.empty { color: var(--faint); text-align: center; padding: 30px 10px; font-size: 13px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: grid; place-items: center; animation: fade .15s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: 460px; max-width: 92vw; padding: 22px; }
.modal h2 { font-size: 16px; margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 16px; font-size: 13px;
  min-width: 220px; animation: slide .2s;
  border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ---------- misc ---------- */
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.2s infinite; margin-right: 7px; }
@keyframes pulse { 50% { opacity: .35; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
canvas { max-width: 100%; }
.chart-box { height: 240px; position: relative; }
.qr-box { display: grid; place-items: center; padding: 20px; }
.qr-box img { border-radius: 10px; background: #fff; padding: 12px; max-width: 260px; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.status-dot.open { background: var(--green); }
.status-dot.closed { background: var(--red); }
.status-dot.connecting { background: var(--yellow); }

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .brand-name, .sidebar .brand-sub, .sidebar nav a span, .sidebar-footer { display: none; }
  nav a { justify-content: center; padding: 11px; }
  main { margin-left: 60px; padding: 18px; }
}

/* ---------- cobertura de nichos ---------- */
.niche-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.niche-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 8px 6px 14px; font-size: 12.5px; background: var(--surface);
}
.niche-chip b { font-size: 11px; font-weight: 600; border-radius: 12px; padding: 2px 8px; }
.niche-chip.done b { background: rgba(62,207,142,.15); color: var(--green); }
.niche-chip.new { border-color: var(--accent); }
.niche-chip.new b { background: rgba(91,140,255,.15); color: var(--accent); }

/* ---------- autopilot redesenhado ---------- */
.hidden { display: none !important; }

.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.hero-head .left { display: flex; align-items: center; gap: 14px; }
.hero-head .title { font-size: 16px; font-weight: 600; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; border-radius: 20px; padding: 5px 12px;
}
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.off { background: var(--surface-2); color: var(--faint); }
.status-pill.on { background: var(--green-dim); color: var(--green); }
.status-pill.busy { background: var(--yellow-dim); color: var(--yellow); }

.segmented {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px;
}
.segmented button {
  background: transparent; color: var(--muted); border: none; border-radius: 6px;
  padding: 6px 16px; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--accent); color: #fff; }

.mode-desc { font-size: 12px; color: var(--faint); margin-top: 8px; line-height: 1.5; }
.card .subhead { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 2px; }
