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

:root {
  --bg: #0a0a0b;
  --surface: #131315;
  --card: #1d1d20;
  --card-2: #26262a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f4f5;
  --muted: #8d8d96;
  --lime: #0052ff;
  --accent-text: #7aa2ff;
  --on: #ffffff;
  --lime-2: #1f66ff;
  --ink: #0a0a0b;
  --red: #ff6b6b;
  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); }

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Layout ---------- */

.app { display: flex; min-height: 100vh; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 76px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
  z-index: 20;
}

.rail-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--on);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 18px;
}

.rail a {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: background .2s, color .2s;
}

.rail a:hover { color: var(--text); border-color: var(--line-2); }
.rail a.active { background: var(--text); color: var(--ink); border-color: var(--text); }
.rail .spacer { flex: 1; }

.rail a .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.rail a[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 54px;
  white-space: nowrap;
  background: var(--card-2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; }

/* ---------- Tipografia ---------- */

.workspace-title {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1;
}

.workspace-title .o {
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  border-radius: 50%;
  border: 0.13em solid var(--lime);
  vertical-align: -0.04em;
  margin: 0 0.02em;
  position: relative;
}

.workspace-title .o::after {
  content: '';
  position: absolute;
  inset: 0.14em;
  border-radius: 50%;
  background: var(--lime);
}

h1 { font-size: 30px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Botões e pílulas ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}

.btn:hover { border-color: var(--text); }
.btn-white { background: var(--text); color: var(--ink); border-color: var(--text); }
.btn-white:hover { background: #fff; }
.btn-lime { background: var(--lime); color: var(--on); border-color: var(--lime); }
.btn-lime:hover { background: var(--lime-2); border-color: var(--lime-2); }
.btn-danger { color: var(--red); border-color: rgba(255, 107, 107, 0.35); }
.btn-block { width: 100%; }

.btn-plus .plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  margin-left: -8px;
}

.circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.circle:hover { border-color: var(--text); }
.circle.sm { width: 34px; height: 34px; }
.circle.sm .ic { width: 15px; height: 15px; }
.circle.dark { background: var(--ink); border-color: var(--ink); color: var(--text); }
.circle.wa { background: #25d366; border-color: #25d366; color: #0a0a0b; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.pill:hover { border-color: var(--text); }
.pill.active { background: var(--text); color: var(--ink); border-color: var(--text); }
.pill .count { opacity: 0.6; font-size: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-lime { background: var(--lime); border-color: var(--lime); color: var(--on); }
.chip-red { background: rgba(255, 107, 107, 0.15); border-color: transparent; color: var(--red); }

.dots { display: inline-flex; gap: 4px; padding: 4px 6px; border-radius: 999px; border: 1px solid var(--line); }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a40; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #111;
  background: hsl(var(--h), 70%, 78%);
  border: 2px solid var(--card);
}

.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ---------- Formulários ---------- */

input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  width: 100%;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lime); }
textarea { resize: vertical; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
label input, label select, label textarea { margin-top: 6px; font-weight: 500; }
select.pill-select { width: auto; border-radius: 999px; height: 34px; padding: 0 12px; font-size: 12px; font-weight: 700; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Topo do workspace ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.top .grow { flex: 1; }

.stats { display: flex; gap: 26px; align-items: flex-end; }
.stat { display: flex; align-items: flex-start; gap: 4px; }
.stat b { font-size: 40px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 13px; margin-top: 18px; }
.stat sup {
  background: var(--lime);
  color: var(--on);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: -2px;
}
.stat sup.red { background: var(--red); color: #fff; }

.schedule {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 6px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--on);
  margin-bottom: 28px;
  overflow-x: auto;
  gap: 8px;
}

.schedule-label {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.schedule a.slot {
  color: var(--on);
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.schedule a.slot:hover { background: rgba(255, 255, 255, 0.24); }
.schedule a.slot .avatar { border-color: var(--lime); }
.schedule .empty-slot { padding: 0 14px; font-weight: 600; font-size: 13px; }

/* ---------- Barra de filtros ---------- */

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-head h2 { margin: 0 14px 0 0; }
.section-head .counter { color: var(--muted); font-size: 12px; text-decoration: underline; margin-right: 10px; }
.section-head .grow { flex: 1; }

.search-inline { display: none; width: 260px; height: 38px; border-radius: 999px; }
.search-inline.show { display: block; }

.toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
}

.toggle a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.toggle a.active { background: var(--text); color: var(--ink); }

/* ---------- Kanban ---------- */

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.k-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 14px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, background .2s;
}

.k-col.over { border-color: var(--lime); background: #0d1530; }

.k-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 12px;
  font-weight: 700;
}

.k-count {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 12px;
  display: grid;
  place-items: center;
}

.k-list { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 60px; }

.k-card {
  position: relative;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: grab;
  border: 1px solid transparent;
  transition: transform .15s, border-color .15s;
}

.k-card:hover { border-color: var(--line-2); }
.k-card.dragging { opacity: 0.4; transform: scale(0.98); }
.k-card.hot { background: var(--lime); color: var(--on); }
.k-card.hot .muted, .k-card.hot .k-meta { color: rgba(255, 255, 255, 0.75); }
.k-card.hot .chip { border-color: rgba(255, 255, 255, 0.35); color: var(--on); }
.k-card.hot .chip-lime { background: var(--on); color: var(--lime); border-color: var(--on); }
.k-card.hot .dots { border-color: rgba(255, 255, 255, 0.25); }
.k-card.hot .dots i:not([style]) { background: rgba(255, 255, 255, 0.25); }
.k-card.hot .avatar { border-color: var(--lime); }
.k-card.hot .circle { border-color: rgba(255, 255, 255, 0.35); color: var(--on); }

.k-card .corner { position: absolute; top: 12px; right: 12px; }
.k-name { font-size: 17px; font-weight: 600; margin: 12px 0 2px; line-height: 1.25; padding-right: 30px; }
.k-meta { color: var(--muted); font-size: 12px; }
.k-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.k-foot .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.k-label { font-size: 10px; color: var(--muted); margin: 12px 0 4px; }
.k-card.hot .k-label { color: rgba(255, 255, 255, 0.7); }
.k-more { color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }

/* ---------- Lista ---------- */

.list { display: flex; flex-direction: column; gap: 8px; }

.list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 2fr) minmax(0, 1.2fr) auto auto auto;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 12px 16px;
}

.list-row .name { font-weight: 700; font-size: 15px; }
.list-row .name:hover { color: var(--accent-text); }

/* ---------- Cards genéricos ---------- */

.card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 22px;
  margin-bottom: 16px;
}

.card.light { background: #f1f1f2; color: var(--ink); }
.card.light .muted { color: #6b6b73; }
.card.light input, .card.light textarea, .card.light select { background: #fff; color: var(--ink); border-color: #dcdce0; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-xl);
}

.flash, .alert {
  padding: 12px 18px;
  border-radius: 999px;
  margin-bottom: 18px;
  font-weight: 700;
  display: inline-block;
}

.flash { background: var(--lime); color: var(--on); }
.alert { background: rgba(255, 107, 107, 0.15); color: var(--red); }

/* ---------- Lead ---------- */

.lead-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 16px; align-items: start; }

.lead-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.lead-hero .grow { flex: 1; min-width: 200px; }

.info { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 0; }
.info dt { color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 1px; }
.info dd { margin: 0; word-break: break-word; }
.info a { color: var(--accent-text); }

.chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 2px 12px;
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.in { background: var(--card-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.out { background: var(--lime); color: var(--on); align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble time { display: block; font-size: 10px; opacity: 0.6; margin-top: 4px; }

.composer { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.composer textarea { border-radius: 20px; min-height: 52px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.timeline time { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---------- Conversas ---------- */

.inbox-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

.inbox-row:hover { background: var(--card-2); }
.inbox-row .grow { flex: 1; min-width: 0; }
.inbox-row .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.unread .preview { color: var(--text); font-weight: 600; }

/* ---------- Prospectar ---------- */

.map-frame {
  width: 100%;
  height: 460px;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--card);
}

/* ---------- Modal ---------- */

dialog {
  border: 0;
  padding: 0;
  border-radius: var(--r-xl);
  background: var(--card);
  color: var(--text);
  width: min(520px, calc(100vw - 32px));
}

dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }

/* ---------- Login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: var(--r-xl); padding: 32px; }
.login-card .workspace-title { font-size: 30px; margin-bottom: 24px; }

code { background: var(--card-2); padding: 2px 8px; border-radius: 8px; font-size: 12px; word-break: break-all; }

/* ---------- Responsivo ---------- */

@media (max-width: 980px) {
  .lead-layout { grid-template-columns: 1fr; }
  .list-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .list-row .hide-sm { display: none; }
}

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .rail {
    position: sticky;
    top: auto;
    bottom: 0;
    order: 2;
    width: 100%;
    height: 64px;
    flex-direction: row;
    justify-content: space-around;
    padding: 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .rail-logo, .rail .spacer { display: none; }
  .rail a[data-tip]:hover::after { display: none; }
  .main { padding: 20px 16px 32px; }
  .workspace-title { font-size: 28px; }
  .stats { gap: 16px; }
  .stat b { font-size: 30px; }
  .grid-2 { grid-template-columns: 1fr; }
  .search-inline.show { width: 100%; }
}
