:root {
  --ink: #14171C;
  --ink-hover: #2A2E35;
  --gold: #C9A24B;
  --gold-hi: #E7C56B;
  --gold-grad: linear-gradient(135deg, #C9A24B 0%, #E7C56B 100%);
  --gold-tint: rgba(201, 162, 75, .12);
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --border: #E4E1DB;
  --text: #23262B;
  --muted: #6E7178;
  --ok: #2F7D4F;
  --ok-bg: #E7F3EB;
  --err: #B23B3B;
  --err-bg: #FBEAEA;
  --warn-bg: #FBF3E2;
  --warn-bd: #E7C56B;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(20, 23, 28, .08), 0 1px 2px rgba(20, 23, 28, .04);
  --topbar-h: 60px;
  --sidebar-w: 240px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

:root[data-theme="dark"] {
  --bg: #14171C;
  --surface: #1B1E24;
  --border: #2C2F37;
  --text: #EBE9E3;
  --muted: #9A9DA6;
  --ink-hover: #262A31;
  --gold-tint: rgba(231, 197, 107, .14);
  --ok: #6FCB8F;
  --ok-bg: rgba(111, 203, 143, .14);
  --err: #E38080;
  --err-bg: rgba(227, 128, 128, .14);
  --warn-bg: rgba(231, 197, 107, .12);
  --warn-bd: #6E5C2E;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: "Sora", system-ui, sans-serif; margin: 0 0 16px; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }

/* ---- shell / sidebar ---- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 14px 24px;
}
.sidebar__brand { padding: 4px 10px 22px; }
.sidebar__logo { height: 34px; width: auto; display: block; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-bottom: 6px; }

.section-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .01em;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); }
.section-btn:hover { background: var(--bg); }
.section-btn.is-active {
  background: var(--gold-tint);
  box-shadow: inset 3px 0 0 var(--gold);
}
.section-btn.is-active .nav-icon { color: var(--gold); }

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 4px 12px 28px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-sub .tab, .nav-sub .doc-tab {
  text-align: left;
  width: 100%;
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 500;
  font-size: 13px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.nav-sub .tab:hover, .nav-sub .doc-tab:hover { color: var(--text); background: var(--bg); }
.nav-sub .tab.active, .nav-sub .doc-tab.active {
  color: var(--text);
  font-weight: 600;
  background: var(--gold-tint);
  box-shadow: none;
}

/* ---- main column / topbar ---- */
.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--bg); }
.theme-toggle svg { width: 17px; height: 17px; }
.icon-sun { display: none; }
.icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---- layout ---- */
main { max-width: 1280px; margin: 0; padding: var(--space-5); width: 100%; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.panel label { display: block; margin: 12px 0; font-weight: 500; }

.panel input[type=text], .panel input[type=search], .panel input[type=email],
.panel input[type=date], .panel textarea, .panel select,
.panel input:not([type]) {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.panel input[type=checkbox] { width: auto; margin-right: 6px; }
.panel input:focus, .panel textarea:focus, .panel select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, .25);
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.section-btn:focus-visible, .tab:focus-visible, .doc-tab:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { width: auto; flex: 0 1 240px; }

/* ---- botoes ---- */
button {
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
button:hover { background: var(--bg); }
button:disabled { opacity: .5; cursor: not-allowed; }

#send-btn, button[type=submit], #hist-apply {
  background: var(--gold-grad);
  color: var(--ink);
  border: 0;
}
#send-btn:hover, button[type=submit]:hover, #hist-apply:hover { filter: brightness(1.04); }

button[data-del], button[data-tdel], button[data-mtdel] {
  color: var(--err);
  border-color: transparent;
  font-weight: 500;
}
#contact-reset, #template-reset, #msg-template-reset, #send-clear-selection {
  color: var(--muted);
  border-color: transparent;
  font-weight: 500;
}
button[data-del]:hover, button[data-tdel]:hover, button[data-mtdel]:hover { background: var(--err-bg); }

/* ---- lista de contatos (Enviar) ---- */
#send-contacts {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#send-contacts li { padding: 6px 10px; border-bottom: 1px solid var(--border); }
#send-contacts li:last-child { border-bottom: 0; }
#send-count { color: var(--muted); margin-right: 12px; }

/* ---- tabelas ---- */
table { border-collapse: collapse; width: 100%; margin-top: 16px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  color: var(--text);
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.cell-wrap { overflow-wrap: anywhere; word-break: break-word; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
.table-scroll {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
}
.table-scroll table { margin-top: 0; }
.docs-todos-foot { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--gold-tint); }
td button { padding: 4px 10px; font-size: 12px; }

/* ---- aviso ---- */
.warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
}
.warning::before { content: "⚠ "; }

/* ---- status (badges) ---- */
.status-erro, .status-enviado, .status-pendente {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}
.status-erro::before, .status-enviado::before, .status-pendente::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-erro { color: var(--err); background: var(--err-bg); }
.status-enviado { color: var(--ok); background: var(--ok-bg); }
.status-pendente { color: var(--gold); background: var(--gold-tint); }

/* ---- pre (detalhe do historico) ---- */
pre {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
}

#send-result, #hist-detail { margin-top: 16px; }
#send-result ul { padding-left: 18px; }
#templates-list, #msg-templates-list { list-style: none; padding: 0; }
#templates-list li, #msg-templates-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- responsivo ---- */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px;
  }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
  .nav-sub { flex-direction: row; flex-wrap: wrap; margin-left: 4px; border-left: 0; padding-left: 0; }
  main { padding: var(--space-4); }
}

/* ================= WhatsApp (seleção, lote, dashboard) ================= */
:root {
  --viz-1: #2a78d6;      /* série 1 (enviadas)  - validada em claro/escuro */
  --viz-2: #eb6834;      /* série 2 (respostas) */
  --viz-grid: #E4E1DB;
  --viz-axis: #6E7178;
}
:root[data-theme="dark"] {
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-grid: #2C2F37;
  --viz-axis: #9A9DA6;
}

.wa-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap;
  background: var(--gold-tint); border: 1px solid var(--gold); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4);
}
.wa-bar span { font-weight: 600; margin-right: auto; }
.wa-pick { white-space: nowrap; }
.wa-pick.is-on { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.wa-count {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px;
  background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; text-align: center;
}
.wa-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 var(--space-4); }
.wa-resumo { margin: var(--space-3) 0; min-height: 22px; }
.wa-preview {
  margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--border);
  border-radius: var(--radius); background: color-mix(in srgb, var(--bg) 60%, var(--surface));
}
.wa-preview pre { white-space: pre-wrap; margin: 6px 0 0; font: inherit; }
.wa-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-top: var(--space-4); }
#wa-create-btn:not(:disabled) { background: var(--gold-grad); color: var(--ink); border-color: transparent; font-weight: 600; }
tr.wa-skip td { opacity: .55; }
.wa-counts { line-height: 2.2; }
.wa-h3-gap { margin-top: var(--space-5); }

.wa-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border);
}
.wa-badge--ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.wa-badge--err { color: var(--err); background: var(--err-bg); border-color: transparent; }
.wa-badge--warn { color: var(--text); background: var(--warn-bg); border-color: var(--warn-bd); }
.wa-badge--neutral { color: var(--muted); background: transparent; }

.wa-dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; }
.wa-dash-tools { display: flex; gap: var(--space-3); align-items: flex-end; }
.wa-dash-tools label { margin: 0; }
.wa-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin: var(--space-4) 0 var(--space-5); }
.wa-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); background: var(--surface); }
.wa-tile__label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.wa-tile__value { font-family: "Sora", system-ui, sans-serif; font-size: 32px; font-weight: 700; line-height: 1.2; }
.wa-tile__sub { color: var(--muted); font-size: 12px; }
.wa-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-5); margin-bottom: var(--space-5); }

.wa-funnel { display: grid; gap: var(--space-2); }
.wa-funnel__row { display: grid; grid-template-columns: 96px 1fr 120px; gap: var(--space-3); align-items: center; }
.wa-funnel__track { height: 14px; border-radius: 4px; background: color-mix(in srgb, var(--viz-1) 12%, transparent); overflow: hidden; }
.wa-funnel__bar { display: block; height: 100%; min-width: 2px; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.wa-funnel__n { text-align: right; font-variant-numeric: tabular-nums; }

.wa-chart { width: 100%; height: auto; display: block; }
.wa-chart .wa-grid { stroke: var(--viz-grid); stroke-width: 1; }
.wa-chart .wa-axis { fill: var(--viz-axis); font-size: 11px; }
.wa-chart .wa-bar-1 { fill: var(--viz-1); }
.wa-chart .wa-bar-2 { fill: var(--viz-2); }
.wa-chart g[data-tip]:hover rect[fill=transparent] { fill: var(--gold-tint); }
.wa-legend { display: flex; gap: var(--space-4); margin-top: var(--space-2); color: var(--muted); font-size: 12px; }
.wa-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.wa-sw-1 { background: var(--viz-1); }
.wa-sw-2 { background: var(--viz-2); }
.wa-table-view { margin-top: var(--space-3); }
.wa-table-view summary { cursor: pointer; color: var(--muted); }
.wa-tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff;
  padding: 4px 8px; border-radius: 6px; font-size: 12px; box-shadow: var(--shadow);
}
@media (max-width: 720px) {
  .wa-funnel__row { grid-template-columns: 76px 1fr 96px; }
}

.panel input[type=number], .panel input[type=datetime-local] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit;
}
.panel input[type=number]:focus, .panel input[type=datetime-local]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
#wa-job-detail { margin-top: var(--space-5); }
.wa-chart .wa-axis { font-size: 12px; }

/* ---- login ---- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.login-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-6);
}
.login-logo { display: block; height: 40px; width: auto; margin: 0 auto var(--space-4); }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card label { display: block; margin: var(--space-3) 0; font-weight: 500; }
.login-card input {
  width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit;
}
.login-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.login-card button[type=submit] {
  width: 100%; margin-top: var(--space-3); padding: 10px 12px; background: var(--gold-grad);
  color: var(--ink); font-weight: 600; border-color: transparent;
}
.login-error { color: var(--err); background: var(--err-bg); border-radius: var(--radius); padding: 8px 12px; margin: var(--space-2) 0; }
.topbar__user { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; margin-right: var(--space-3); color: var(--muted); font-size: 13px; }
.topbar__user button { padding: 4px 10px; font-size: 12px; }
.user-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
#user-secret code { font-size: 15px; padding: 2px 6px; background: var(--surface); border-radius: 4px; user-select: all; }

/* ---------- Contatos: filtros, cartões e balões de especialidade ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.btn-primary, .btn-ghost {
  border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, box-shadow .15s, transform .15s;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); box-shadow: var(--shadow); }
:root[data-theme="dark"] .btn-primary { background: var(--gold-grad); color: #14171C; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--gold-tint); }
.link-btn { background: none; border: 0; padding: 2px 4px; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; border-radius: 6px; }
.link-btn:hover { color: var(--text); background: var(--gold-tint); }
.link-btn--danger:hover { color: var(--err); background: var(--err-bg); }

.contacts-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.contacts-head h2 { margin: 0 0 2px; }
.contacts-head p { margin: 0; }

.cfilters {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: var(--space-4); box-shadow: var(--shadow); display: grid; gap: var(--space-4); margin-bottom: var(--space-5);
}
.cfilters__row { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)); gap: var(--space-3); }
.cfilters input[type="search"], .cfilters select {
  width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font: inherit;
}
.cfilters input:focus-visible, .cfilters select:focus-visible, .spec-pill--btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.cfilters__spec-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.cfilters__label { font-weight: 600; font-size: 13px; }
.cfilters__spec-head input { max-width: 260px; height: 34px; }
.cfilters__active { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding-top: var(--space-3); border-top: 1px dashed var(--border); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--gold-tint); color: var(--text); border: 1px solid transparent; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--gold); }

/* Balões de especialidade: matiz estável por nome, pastel no claro e suave no escuro */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-pill {
  --bg-l: 93%; --fg-l: 28%;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.5;
  background: hsl(var(--h) 75% var(--bg-l)); color: hsl(var(--h) 55% var(--fg-l));
  border: 1px solid hsl(var(--h) 60% 85%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:root[data-theme="dark"] .spec-pill { --bg-l: 22%; --fg-l: 84%; border-color: hsl(var(--h) 40% 32%); }
.spec-pill--btn { cursor: pointer; font-family: inherit; transition: transform .12s, box-shadow .12s; }
.spec-pill--btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px hsl(var(--h) 50% 40% / .25); }
.spec-pill--btn.is-on { background: hsl(var(--h) 65% 38%); color: #fff; border-color: transparent; }
.spec-pill__n { font-weight: 500; opacity: .7; font-size: 11.5px; }
.spec-pill--more { --h: 220; background: var(--bg); color: var(--muted); border-color: var(--border); }

.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-4); }
.ccard {
  display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.ccard:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 6px 18px rgba(20, 23, 28, .10); }
.ccard__head h3 {
  margin: 0 0 4px; font-size: 15px; line-height: 1.3; font-weight: 650;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ccard__loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.ccard__specs { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 64px; }
.ccard__nospec { font-size: 13px; align-self: center; }
.ccard__foot { display: grid; gap: 6px; margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--border); }
.ccard__mail { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.ccard__mail a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard__mail a:hover { text-decoration: underline; }
.ccard__meta { display: flex; gap: var(--space-3); color: var(--muted); font-size: 12px; }
.ccard__actions { display: flex; gap: 4px; justify-content: flex-end; }
.ccard--noemail { background: linear-gradient(0deg, var(--surface), var(--surface)); }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag--warn { background: var(--warn-bg); color: #8A6A1E; border-color: var(--warn-bd); }
:root[data-theme="dark"] .tag--warn { color: var(--gold-hi); }

.cgrid-more { display: flex; justify-content: center; margin: var(--space-5) 0 var(--space-3); }
.cempty { grid-column: 1 / -1; display: grid; gap: 4px; text-align: center; padding: var(--space-6); color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 16px; }
.cempty strong { color: var(--text); }

.cdialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.cdialog::backdrop { background: rgba(20, 23, 28, .55); backdrop-filter: blur(2px); }
.cdialog form { display: grid; gap: var(--space-3); padding: var(--space-5); }
.cdialog h3 { margin: 0; }
.cdialog label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.cdialog input { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-weight: 400; }
.cdialog__row { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: var(--space-3); }
.cdialog__actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-2); }

@media (max-width: 900px) {
  .cfilters__row { grid-template-columns: 1fr 1fr; }
  .cfilters__row input[type="search"] { grid-column: 1 / -1; }
  .cgrid { grid-template-columns: 1fr; }
  .cdialog__row { grid-template-columns: 1fr; }
  .contacts-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .ccard, .spec-pill--btn, .btn-primary { transition: none; } }

/* ---------- Dropdown moderno (combo) e filtros compartilhados ---------- */
.cfilters__row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; grid-template-columns: none; }
.cfilters__search { flex: 1 1 260px; min-width: 220px; }
.cfilters__pills { display: grid; gap: var(--space-2); }

.combo { position: relative; flex: 0 1 auto; }
.combo__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text);
  font: inherit; cursor: pointer; max-width: 240px; transition: border-color .15s, background .15s, box-shadow .15s;
}
.combo__btn:hover { border-color: var(--gold); }
.combo__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.combo__btn.is-set { background: var(--gold-tint); border-color: var(--gold); }
.combo__label { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.combo__value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo__chev { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform .15s; }
.combo__btn[aria-expanded="true"] .combo__chev { transform: rotate(180deg); }

.combo__pop {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 300px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px;
  box-shadow: 0 14px 40px rgba(20, 23, 28, .18); display: grid; gap: 8px;
}
.combo__search { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.combo__search:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.combo__list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; display: grid; gap: 2px; }
.combo__opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.combo__opt:hover, .combo__opt.is-active { background: var(--gold-tint); }
.combo__opt.is-on { font-weight: 650; }
.combo__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__text small { margin-left: 6px; color: var(--muted); font-weight: 500; }
.combo__count { color: var(--muted); font-size: 12px; background: var(--bg); border-radius: 999px; padding: 0 8px; }
.combo__tick { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.5px solid var(--border); position: relative; }
.combo__tick--box { border-radius: 5px; }
.combo__opt.is-on .combo__tick { background: var(--ink); border-color: var(--ink); }
:root[data-theme="dark"] .combo__opt.is-on .combo__tick { background: var(--gold); border-color: var(--gold); }
.combo__opt.is-on .combo__tick::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
:root[data-theme="dark"] .combo__opt.is-on .combo__tick::after { border-color: #14171C; }
.combo__empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.combo__foot { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 0; }
.combo__hint { color: var(--muted); font-size: 12px; }

.tag--ed { background: var(--gold-tint); color: var(--text); border-color: transparent; }

/* Enviar: lista de destinatários */
.send-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: var(--space-3) 0; }
#send-contacts { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.srow label { display: flex; align-items: center; gap: var(--space-3); padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.srow label:hover { border-color: var(--gold); }
.srow label:has(input:checked) { background: var(--gold-tint); border-color: var(--gold); }
.srow input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.srow__main { display: grid; min-width: 0; flex: 1; }
.srow__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow__sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow__pills { display: flex; gap: 6px; flex-wrap: nowrap; overflow: hidden; max-width: 45%; }

/* Documentos: caixas de marcar e botão de criar lote */
.doc-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 4px; }
.doc-check input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
:root[data-theme="dark"] .doc-check input { accent-color: var(--gold); }
.th-check { width: 44px; text-align: center; }
.docs-fila-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

@media (max-width: 900px) {
  .combo__btn { max-width: 100%; }
  .combo__pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; }
  .srow__pills { display: none; }
  .docs-fila-foot { flex-direction: column; align-items: stretch; }
}

/* ajustes após revisão visual */
#send-contacts { border: 0; padding: 2px; }
#send-contacts li, #send-contacts li:last-child { padding: 0; border: 0; }
.combo__list { grid-template-columns: minmax(0, 1fr); }
.combo__opt { min-width: 0; }
.combo__count { flex: none; }
