:root {
  /* Identidade Palazzo: preto, verde-limão do ícone, verde do site e tons quentes */
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FAF9F5;
  --border: #E7E3DA;
  --border-strong: #D9D4C9;
  --text: #161614;
  --text-2: #393935;
  --muted: #66655E;
  --primary: #7ED957;          /* verde Palazzo (fundo de botões, barras) */
  --primary-dark: #6BC946;
  --primary-ink: #2E6A1A;      /* verde escuro para texto e links (contraste) */
  --primary-soft: #EDF7E5;
  --lime: #E4F870;             /* verde-limão do ícone */
  --nav: #111110;
  --nav-2: #1C1C1A;
  --nav-active: #272724;
  --nav-text: #D9D7CF;
  --nav-muted: #8F8D84;
  --green: #3F9A22;
  --green-soft: #E9F6E1;
  --green-text: #1F4D12;
  --bubble-me: #E6F4DA;
  --amber-soft: #FFF3DF;
  --amber-text: #7A3E06;
  --red: #C62828;
  --red-soft: #FCEBEA;
  --red-text: #8F1D1D;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 22, 20, 0.06);
  --shadow-lg: 0 16px 40px rgba(22, 22, 20, 0.18);
  --font-title: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--nav); color: var(--nav-text);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #8F8D84; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-muted); padding: 0 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 44px;
  border-radius: 10px; color: var(--nav-text); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--nav-2); color: #fff; }
.nav-link.active { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav-link span.lbl { flex-grow: 1; }
.nav-badge { background: #2A4366; color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.nav-link.active .nav-badge, .nav-badge.blue { background: var(--primary); }
.nav-badge.red { background: #8F2B2B; }
.me-box { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--nav-2); }
.me-box .who { min-width: 0; flex-grow: 1; }
.me-box .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-box .who span { font-size: 12px; color: #8F8D84; }
.me-box button { background: transparent; border: 0; color: var(--nav-text); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.me-box button:hover { background: var(--nav-active); color: #fff; }

.main { flex: 1 1 auto; min-width: 0; padding: 26px 30px 40px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.page-head .titles { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: #fff; color: var(--red-text); border-color: #F3C4C4; }
.btn.danger:hover { background: var(--red-soft); }
.btn.green { background: var(--green); border-color: var(--green); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.block { width: 100%; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.pill .dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.pill.ok { background: var(--green-soft); color: var(--green-text); }
.pill.off { background: var(--red-soft); color: var(--red-text); }
.pill.wait { background: var(--amber-soft); color: var(--amber-text); }
.pill.blue { background: #EFEDE6; color: #3A3934; }
.pill.gray { background: #EFEDE6; color: var(--text-2); }

.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #F1EFE9; color: var(--text-2); }
.tag.pj { background: #EFEDE6; color: #3A3934; }
.tag.pf { background: #E0F2EF; color: #115E59; }
.tag.utm { background: #F3E8FF; color: #6B21A8; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); font-weight: 500; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--nav); border-color: var(--nav); color: #fff; font-weight: 600; }
.chip.blue[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }

.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 12px; min-height: 42px; color: var(--muted); }
.search input { border: 0; outline: none; background: transparent; width: 100%; color: var(--text); }

.avatar { width: 36px; height: 36px; border-radius: 999px; background: #ECE9E1; color: var(--text-2); font-size: 13px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 40px; height: 40px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.warn-box { background: var(--amber-soft); color: var(--amber-text); border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.err-box { background: var(--red-soft); color: var(--red-text); border-radius: 12px; padding: 12px 14px; font-size: 13px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=date], .field input[type=number], .field select, .field textarea {
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 12px; min-height: 42px; background: #fff; width: 100%;
}
.field textarea { padding: 10px 12px; resize: vertical; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.segmented { display: flex; background: #EFEDE6; border-radius: 10px; padding: 4px; gap: 4px; }
.segmented button { flex: 1 1 0; min-height: 36px; border-radius: 8px; border: 0; background: transparent; color: #4A4943; font-weight: 500; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.12); }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.col { flex: 0 0 290px; background: #EEEBE4; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; border: 2px solid transparent; transition: border-color .15s, background .15s; }
.col.novos { background: var(--primary-soft); border-color: #C9D8F7; }
.col.drop-over { border-color: #7FA3EE; border-style: dashed; background: #F4FBEF; }
.col-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 0; }
.col-head .t { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.col-head .t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .t span { font-size: 12px; color: #4A4943; display: flex; align-items: center; gap: 6px; }
.count { background: #fff; color: var(--text-2); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.col.novos .count { background: var(--primary); color: #fff; }
.col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.dot-status { width: 8px; height: 8px; border-radius: 999px; background: var(--red); display: inline-block; }
.dot-status.open { background: var(--green); }
.dot-status.connecting { background: #D97706; }

.lead-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow); cursor: grab; }
.lead-card:active { cursor: grabbing; }
.lead-card.dragging { opacity: .5; }
.lc-top { display: flex; align-items: flex-start; gap: 10px; }
.lc-id { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lc-id b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-id span { font-size: 12px; color: var(--muted); }
.lc-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.lc-msg { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.lc-status.ok { color: var(--green-text); }
.lc-status.wait { color: var(--amber-text); }
.unread-badge { background: var(--green); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; }
a.lead-card { text-decoration: none; color: inherit; }

/* ---------- Conversas ---------- */
.conv { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(280px, 340px); gap: 16px; align-items: stretch; height: calc(100vh - 52px); min-height: 560px; }
.conv-list, .chat, .ficha { background: #fff; border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.conv-list-head { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid #EFEDE6; }
.conv-list-head h1 { font-size: 20px; }
.conv-items { overflow-y: auto; flex: 1 1 auto; }
.conv-item { display: flex; gap: 12px; padding: 12px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid #F1EFE9; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: #F4FBEF; }
.conv-item .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-item .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .last { font-size: 13px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .who-tag { font-size: 11px; font-weight: 600; color: #4A4943; background: #EFEDE6; padding: 2px 7px; border-radius: 6px; }

.chat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #EFEDE6; }
.chat-head .t { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head .t b { font-size: 15px; }
.chat-head .t span { font-size: 12px; color: var(--muted); }
.back-btn { display: none; }
.chat-body { flex: 1 1 auto; overflow-y: auto; background: #F6F4EF; padding: 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; color: #4A4943; background: #E6E2D9; padding: 4px 10px; border-radius: 999px; margin: 6px 0; }
.msg { max-width: 75%; display: flex; flex-direction: column; gap: 3px; align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .bubble { background: #fff; border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--bubble-me); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.msg.auto .bubble { background: #EFEDE6; }
.msg .media { font-style: italic; color: var(--muted); }
.msg .meta { font-size: 11px; color: var(--muted); padding: 0 4px; }
.composer { border-top: 1px solid #EFEDE6; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex-grow: 1; border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; resize: none; min-height: 44px; max-height: 160px; line-height: 1.45; }
.composer .via { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.composer .via select { border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 8px; background: #fff; }

.ficha { padding: 16px; gap: 14px; overflow-y: auto; }
.ficha h2 { font-size: 16px; }
.ficha-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.campaign-box { background: #FAF5FF; border: 1px solid #EBD9FC; border-radius: 12px; padding: 10px 12px; font-size: 12px; color: #4C1D95; display: flex; flex-direction: column; gap: 3px; }
.events { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.events li { list-style: none; }
.events ul { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
details summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.placeholder-center { flex: 1 1 auto; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }

/* ---------- Tabelas / listas ---------- */
.table-wrap { overflow-x: auto; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px; margin: 16px 0 8px; }
.filters .grow { flex: 1 1 260px; }
.filters .field { flex: 0 1 160px; min-width: 130px; }
@media (max-width: 600px) { .filters .field { flex: 1 1 140px; } }
.tbl.clickable tbody tr { cursor: pointer; }
.tbl.clickable tbody tr:hover td, .tbl.clickable tbody tr:focus td { background: var(--surface-2); }
.tbl.clickable tbody tr:focus { outline: none; }
.tbl.clickable tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.tbl .nowrap { white-space: nowrap; }
.pend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.pend-section { min-width: 0; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pend-head { display: flex; align-items: center; gap: 10px; }
.pend-head h2 { font-size: 16px; flex: 1; }
.pend-head .count { background: #EFEDE6; color: var(--text-2); font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.pend-list { display: flex; flex-direction: column; gap: 8px; }
.pend-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; background: #fff; }
.pend-item:hover { background: var(--surface-2); }
.pend-item .pi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pend-item .pi-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pend-item .pi-msg { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-item .pi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.ok-banner { padding: 14px 18px; margin-top: 16px; background: var(--green-soft); border-color: #BFE3CF; color: var(--green-text); }
.lc-retorno { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; align-self: flex-start; }
.lc-retorno.off { background: var(--red-soft); color: var(--red-text); }
.lc-retorno.wait { background: var(--amber-soft); color: var(--amber-text); }
.lc-retorno.blue { background: #EFEDE6; color: #3A3934; }
.lc-retorno.gray { background: #EFEDE6; color: var(--text-2); }
.retorno-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates .chip { min-height: 30px; padding: 0 10px; font-size: 12px; }
.stage-editor { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: flex; gap: 6px; align-items: center; }
.stage-row input { flex: 1; }
.stage-row .fixed { flex: 1; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 14px; border: 1px dashed var(--border-strong); }
.num-inline { display: inline-flex; align-items: center; gap: 6px; }
.check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.num-inline input { width: 80px; }
@media (max-width: 600px) { .pend-grid { grid-template-columns: 1fr; } .pend-item .pi-side { display: none; } }
.danger-zone { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid #F1EFE9; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.conn-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.conn-card .top { display: flex; align-items: flex-start; gap: 12px; }
.conn-card .top .t { flex-grow: 1; min-width: 0; }
.conn-card .top .t b { display: block; font-size: 15px; }
.conn-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wa-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex-shrink: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; color: var(--muted); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.report-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.report-card h2 { font-size: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; border-radius: 999px; background: #EFEDE6; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

.panel { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.panel h2 { font-size: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.vars { font-size: 12px; color: var(--muted); }
.vars code { background: #EFEDE6; padding: 1px 6px; border-radius: 4px; color: var(--text-2); }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex-grow: 1; min-width: 0; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; min-height: 34px; background: var(--surface-2); font-size: 12px; }

/* ---------- Modal e avisos ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); box-shadow: var(--shadow-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.step i { width: 22px; height: 22px; border-radius: 999px; background: var(--nav); color: #fff; font-style: normal; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.fw-route { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 12px; flex-wrap: wrap; }
.fw-route .p { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 160px; }
.fw-route .p div { min-width: 0; display: flex; flex-direction: column; }
.fw-route .p b { font-size: 14px; }
.fw-route .p span { font-size: 12px; color: var(--muted); }
.qr-box { display: grid; place-items: center; min-height: 280px; background: var(--surface-2); border-radius: 14px; }
.qr-box img { width: 264px; height: 264px; image-rendering: pixelated; }
.qr-steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--nav); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; }
.toast.error { background: #7F1D1D; }
.toast.warn { background: #78350F; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--nav); }
.login-card { background: #fff; border-radius: 20px; width: min(400px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login-card .brand-name { color: var(--text); font-size: 18px; }
.login-card .brand-sub { color: var(--muted); }

/* ---------- Celular / telas menores ---------- */
@media (max-width: 1200px) {
  .conv { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); height: auto; }
  .conv .ficha { grid-column: 1 / -1; }
  .conv-list, .chat { height: calc(100vh - 52px); min-height: 520px; }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center; padding: 8px 10px; gap: 8px; overflow-x: auto; }
  .brand .brand-sub, .brand-name, .nav-title { display: none; }
  .nav-group { flex-direction: row; gap: 2px; }
  .nav-link { padding: 8px 10px; min-height: 40px; gap: 6px; white-space: nowrap; }
  .me-box { margin: 0 0 0 auto; padding: 4px; background: transparent; }
  .me-box .who, .me-box .avatar { display: none; }
  .main { padding: 16px; }
  .conv { grid-template-columns: 1fr; }
  .conv.has-lead .conv-list { display: none; }
  .conv:not(.has-lead) .chat, .conv:not(.has-lead) .ficha { display: none; }
  .conv-list, .chat { height: calc(100vh - 90px); }
  .back-btn { display: inline-flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .msg { max-width: 88%; }
  .settings-grid, .report-grid { grid-template-columns: 1fr; }
}

/* ---------- Tema Palazzo (cores e tipografia; a estrutura das telas não muda) ---------- */
body { font-size: 13.5px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: #000; object-fit: cover; box-shadow: 0 0 0 1px #2B2B27; }
.brand-name { font-family: var(--font-title); font-size: 21px; font-weight: 600; letter-spacing: .01em; color: #fff; }
.brand-sub { color: var(--nav-muted); letter-spacing: .04em; }
.nav-title { color: var(--nav-muted); letter-spacing: .14em; }
.nav-link { position: relative; }
.nav-link svg { opacity: .85; }
.nav-link:hover { background: var(--nav-2); color: #fff; }
.nav-link.active { background: var(--nav-active); color: #fff; }
.nav-link.active svg { color: var(--lime); opacity: 1; }
.nav-link.active::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
.nav-badge { background: #34342F; color: #fff; }
.nav-link.active .nav-badge, .nav-badge.blue { background: var(--lime); color: #111110; }
.nav-badge.red { background: #9B2C2C; color: #fff; }
.me-box { background: var(--nav-2); border: 1px solid #2A2A26; }
.me-box .who span { color: var(--nav-muted); }
.me-box button:hover { background: var(--nav-active); color: var(--lime); }

.page-head h1 { font-family: var(--font-title); font-size: 32px; font-weight: 600; letter-spacing: 0; line-height: 1.1; }
.panel h2, .pend-head h2, .report-card h2 { font-family: var(--font-title); font-size: 20px; font-weight: 600; }
.conv-list-head h1, .ficha-head h2 { font-family: var(--font-title); font-weight: 600; }
.conv-list-head h1 { font-size: 26px; }
.ficha-head h2 { font-size: 20px; }
.modal-head h2 { font-family: var(--font-title); font-size: 22px; font-weight: 600; }

.btn { background: var(--primary); border-color: var(--primary); color: #10140C; font-weight: 600; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #10140C; }
.btn.secondary { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: #fff; color: var(--red-text); border-color: #F0C3C0; }
.btn.green { background: var(--primary); border-color: var(--primary); color: #10140C; }

.chip[aria-pressed="true"] { background: var(--nav); border-color: var(--nav); color: #fff; }
.chip.blue[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #10140C; }
.pill.blue { background: #EFEDE6; color: #3A3934; }
.tag.pj { background: #EFEDE6; color: #3A3934; }
.tag.pf { background: var(--green-soft); color: var(--green-text); }
.lc-retorno.blue { background: #EFEDE6; color: #3A3934; }
.check input { accent-color: var(--green); }
.col { background: #EEEBE4; }
.col.novos { background: var(--primary-soft); border-color: #CFE9BE; }
.col.novos .count { background: var(--nav); color: var(--lime); }
.col.drop-over { border-color: var(--primary); background: #F4FBEF; }
.msg.auto .bubble { background: #F1EEE6; }
.bar > i { background: var(--primary); }
.tbl.clickable tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.step i { background: var(--nav); color: var(--lime); }
.toast { background: var(--nav); }
.ok-banner { background: var(--green-soft); border-color: #CDE8BC; color: var(--green-text); }
.card { border-color: var(--border); }

/* Login */
.login { background: #0B0B0A radial-gradient(circle at 50% -10%, #1D2210 0%, #0B0B0A 55%); }
.login-card { border-radius: 18px; padding: 32px 28px; gap: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-bottom: 4px; }
.login-brand img { width: min(260px, 80%); height: auto; }
.login-brand p { color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.avatar { background: #ECE9E1; color: #3A3934; }
.campaign-box { background: #F7F9EC; border-color: #E2EBC0; color: #3D4710; }

/* ======================================================================
   Refinamento visual (acabamento). Só aparência: a estrutura das telas é a mesma.
   ====================================================================== */
:root {
  --radius-lg: 16px;
  --radius-md: 12px;
  --ring: 0 0 0 3px rgba(126, 217, 87, .28);
  --shadow-card: 0 1px 2px rgba(22, 22, 20, .04), 0 6px 20px -12px rgba(22, 22, 20, .14);
  --shadow-hover: 0 2px 4px rgba(22, 22, 20, .05), 0 14px 30px -14px rgba(22, 22, 20, .26);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
body { font-size: 14px; color: var(--text); }
::selection { background: rgba(228, 248, 112, .55); }

/* Rolagem discreta */
* { scrollbar-width: thin; scrollbar-color: #CFCABF transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #D6D1C6; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.sidebar { scrollbar-color: #3A3A35 transparent; }

/* Menu lateral */
.sidebar { background: linear-gradient(180deg, #141413 0%, #0E0E0D 100%); border-right: 1px solid #1F1F1C; }
.brand { padding: 6px 8px 10px; border-bottom: 1px solid #1F1F1C; }
.nav-link { transition: background .15s var(--ease), color .15s var(--ease); font-size: 13.5px; }
.nav-link:hover svg { color: #fff; opacity: 1; }

/* Área principal e cabeçalhos */
.main { padding: 30px 34px 48px; gap: 20px; max-width: 1680px; }
.page-head { gap: 16px; padding-bottom: 2px; }
.page-head h1 { font-size: 34px; }
.page-head p { font-size: 13.5px; max-width: 72ch; margin-top: 2px; }

/* Cartões */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.panel { padding: 22px; gap: 16px; }
.panel h2 { padding-bottom: 10px; border-bottom: 1px solid #EFECE5; }
.panel > p.muted.small { margin-top: -6px; }

/* Botões */
.btn { border-radius: 10px; transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .08s; box-shadow: inset 0 -1px 0 rgba(0,0,0,.08); letter-spacing: .01em; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.secondary { box-shadow: 0 1px 1px rgba(22,22,20,.04); }
.btn.secondary:hover { border-color: #CBC5B8; }
.btn.danger:hover { border-color: #E8A9A4; }

/* Campos */
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=date], .field input[type=number], .field select, .field textarea, .composer textarea, .search {
  background: #FFFEFC; border-color: var(--border-strong); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input:hover, .field input:hover, .field select:hover, .field textarea:hover, .search:hover, .composer textarea:hover { border-color: #CBC5B8; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .composer textarea:focus { outline: none; border-color: #7CC55A; box-shadow: var(--ring); }
.search:focus-within { border-color: #7CC55A; box-shadow: var(--ring); }
.field > span, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.chip { transition: background .15s var(--ease), border-color .15s var(--ease); }
.chip:hover:not([aria-pressed="true"]) { border-color: #BDB6A7; background: #FCFBF8; }
.segmented { background: #EDEAE2; }

/* Etiquetas */
.pill { letter-spacing: .01em; }
.tag { border-radius: 999px; padding: 3px 9px; font-weight: 600; font-size: 11.5px; }
.count { box-shadow: 0 0 0 1px rgba(22,22,20,.06); }

/* Quadros (Triagem e Quadro) */
.board { gap: 16px; padding: 2px 2px 14px; }
.col { background: #F0EDE6; border: 1px solid #E6E2D8; border-top: 3px solid #CFC9BC; border-radius: var(--radius-lg); padding: 14px 12px 12px; gap: 12px; }
.col.novos { background: #F2FAEC; border-color: #D5EBC6; border-top-color: var(--primary); }
.col[data-stage="novo"] { border-top-color: #8F8D84; }
.col[data-stage="fechado"] { border-top-color: var(--primary); background: #F3F9EE; }
.col[data-stage="perdido"] { border-top-color: #D9827B; background: #F8F1EF; }
.col.drop-over { border-style: dashed; border-color: #7CC55A; border-top-width: 3px; background: #F1FAEA; }
.col-head .t b { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.col .empty { border: 1px dashed #D9D4C9; border-radius: var(--radius-md); padding: 18px 12px; font-size: 12.5px; background: rgba(255,255,255,.45); }
.lead-card { border-radius: var(--radius-md); border-color: #E9E5DC; box-shadow: var(--shadow-card); transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease); }
.lead-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: #DDD8CC; }
.lead-card.dragging { transform: rotate(1.5deg); }
.lc-id b { font-size: 14px; }
.lc-msg { color: #4A4943; line-height: 1.5; }
.unread-badge { background: var(--primary); color: #10140C; }

/* Conversas */
.conv { gap: 16px; }
.conv-list, .chat, .ficha { border-radius: var(--radius-lg); box-shadow: var(--shadow-card); border-color: var(--border); }
.conv-list-head { padding: 18px 16px 14px; }
.conv-item { position: relative; padding: 13px 16px; transition: background .12s var(--ease); }
.conv-item.active { background: #F3F9EE; }
.conv-item.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.conv-item .last { color: #5B5A54; }
.chat-head { padding: 14px 18px; background: #FFFEFC; }
.chat-body {
  background-color: #F4F1EA;
  background-image: radial-gradient(rgba(22,22,20,.045) 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 20px 18px;
}
.msg .bubble { border-color: #ECE8DF; box-shadow: 0 1px 1px rgba(22,22,20,.05); line-height: 1.5; }
.msg.me .bubble { background: #E7F5DC; }
.msg.auto .bubble { background: #FBFAF6; border: 1px dashed #D3CDBF; }
.day-sep { background: rgba(255,255,255,.85); color: #5B5A54; box-shadow: 0 1px 1px rgba(22,22,20,.05); }
.composer { background: #FFFEFC; }
.ficha { padding: 18px; }
.retorno-box { background: #FAF9F5; border-color: #E9E5DC; }

/* Tabelas */
.table-wrap.card { overflow: auto; }
.tbl th { background: #FAF9F5; position: sticky; top: 0; z-index: 1; color: #6B6A63; font-size: 11.5px; letter-spacing: .06em; padding: 12px 14px; }
.tbl td { padding: 13px 14px; }
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl.clickable tbody tr:hover td { background: #FAF8F3; }
.filters { border-radius: var(--radius-lg); }

/* Pendências: cor por tipo */
.pend-section { border-top: 3px solid #CFC9BC; padding: 20px; }
.pend-section[data-kind="retorno"] { border-top-color: #D9827B; }
.pend-section[data-kind="esperando"] { border-top-color: #E0A341; }
.pend-section[data-kind="sumiu"] { border-top-color: #8F8D84; }
.pend-section[data-kind="triagem"] { border-top-color: var(--primary); }
.pend-item { border-color: #ECE8DF; transition: box-shadow .18s var(--ease), transform .18s var(--ease), background .12s; }
.pend-item:hover { background: #FFFEFC; box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.ok-banner { display: flex; align-items: center; gap: 10px; }
.ok-banner::before { content: '✓'; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--primary); color: #10140C; font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* Relatórios */
.tile { padding: 18px 18px 16px; gap: 6px; position: relative; overflow: hidden; }
.tile::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--lime)); opacity: .9; }
.tile .v { font-family: var(--font-title); font-size: 40px; font-weight: 600; letter-spacing: 0; line-height: 1; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: 'lnum' 1, 'tnum' 1; }
.page-head h1, .panel h2, .report-card h2, .pend-head h2, .modal-head h2 { font-variant-numeric: lining-nums; font-feature-settings: 'lnum' 1; }
.tile .l { font-size: 12.5px; }
.report-card { padding: 20px; }
.bar { height: 8px; background: #EDEAE2; }
.bar > i { background: linear-gradient(90deg, #6BC946, var(--primary)); }

/* Conexões e equipe */
.conn-card { padding: 18px; }
.wa-icon { background: #EEF8E6; color: #3F9A22; }

/* Janelas e avisos */
.modal-backdrop { background: rgba(14, 14, 13, .5); backdrop-filter: blur(3px); }
.modal { border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.modal-head { padding-bottom: 12px; border-bottom: 1px solid #EFECE5; }
.fw-route { background: #F6F4EF; border: 1px solid #ECE8DF; }
.toast { border-left: 4px solid var(--primary); border-radius: 10px; }
.toast.error { border-left-color: #F28B82; }
.toast.warn { border-left-color: #F2C14E; }
.warn-box { border: 1px solid #F5D9A8; }
.err-box { border: 1px solid #F3C4C0; }

/* Telas menores */
@media (max-width: 900px) {
  .main { padding: 18px 16px 32px; }
  .page-head h1 { font-size: 28px; }
  .sidebar { border-right: 0; border-bottom: 1px solid #1F1F1C; }
  .brand { border-bottom: 0; padding: 0 4px; }
  .nav-link.active::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 2px; border-radius: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .lead-card:hover, .pend-item:hover { transform: none; }
}
