/* =====================================================================
   MeuCRM — visual "centro de comando": superfícies limpas, barra lateral
   escura, destaque em gradiente índigo → ciano, números em fonte mono.
   Tema claro e escuro pelos mesmos tokens (data-bs-theme no <html>).
   ===================================================================== */

:root,
[data-bs-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #eef1f8;
  --border: #e3e7f0;
  --border-strong: #cfd6e4;
  --text: #0f172a;
  --muted: #5b6478;
  --faint: #8e99b0;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-2: #06b6d4;
  --accent-text: #4338ca;
  --accent-soft: rgba(79, 70, 229, .09);
  --accent-ring: rgba(99, 102, 241, .22);
  --grad: linear-gradient(135deg, #6366f1 0%, #3b82f6 55%, #06b6d4 100%);

  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, .09);
  --warn: #c2410c;
  --warn-soft: rgba(234, 88, 12, .10);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, .10);
  --ai: #7c3aed;
  --ai-soft: rgba(124, 58, 237, .08);
  --ai-border: rgba(124, 58, 237, .20);
  --wa: #16a34a;
  --wa-hover: #15803d;

  --chat-bg: #eef1f7;
  --chat-dot: rgba(15, 23, 42, .06);
  --bubble-in: #ffffff;
  --bubble-out: #dcf8e6;
  --bubble-meta: #6b7a90;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .06);
  --glass: rgba(255, 255, 255, .72);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --sidebar-w: 236px;
  --topbar-h: 60px;

  --font-sans: "Inter Variable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: .875rem;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--accent-hover);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--radius);
  --bs-focus-ring-color: var(--accent-ring);
}

[data-bs-theme="dark"] {
  --bg: #070b16;
  --surface: #0d1323;
  --surface-2: #111a2e;
  --surface-3: #16213a;
  --border: rgba(148, 163, 184, .13);
  --border-strong: rgba(148, 163, 184, .24);
  --text: #e5e9f2;
  --muted: #98a3ba;
  --faint: #66718a;

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-2: #22d3ee;
  --accent-text: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, .13);
  --accent-ring: rgba(129, 140, 248, .30);
  --grad: linear-gradient(135deg, #6366f1 0%, #3b82f6 55%, #06b6d4 100%);

  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .11);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .11);
  --ai: #a78bfa;
  --ai-soft: rgba(167, 139, 250, .09);
  --ai-border: rgba(167, 139, 250, .22);
  --wa: #22c55e;
  --wa-hover: #16a34a;

  --chat-bg: #080d1a;
  --chat-dot: rgba(148, 163, 184, .07);
  --bubble-in: #141d33;
  --bubble-out: #0f3b2c;
  --bubble-meta: #8a97ad;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, .5);
  --glass: rgba(13, 19, 35, .72);

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-primary-rgb: 129, 140, 248;
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 129, 140, 248;
  --bs-link-hover-color: var(--accent-hover);
  --bs-emphasis-color: #f8fafc;
  color-scheme: dark;
}

/* ---------- Base */
html, body { background: var(--bg); }
body {
  font-family: var(--font-sans);
  font-size: .875rem;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
::selection { background: rgba(99, 102, 241, .25); }
a { text-decoration: none; color: var(--accent); }
a:hover { text-decoration: underline; color: var(--accent-hover); }
.btn, .nav-link, .dropdown-item, .list-link, .kcard, .sidebar a, .kpi, .brand { text-decoration: none !important; }
h1, .h1 { font-size: 1.4rem; font-weight: 650; margin: 0; letter-spacing: -.022em; }
h2, .h2 { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h3, .h3 { font-size: .7rem; font-weight: 600; margin: 0; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.text-muted { color: var(--muted) !important; }
.text-faint { color: var(--faint) !important; }
.text-body { color: var(--text) !important; }
.text-ai { color: var(--ai) !important; }
.text-wa { color: var(--wa) !important; }
.small, small { font-size: .8rem; }
.xsmall { font-size: .72rem; }
.fw-medium { font-weight: 500; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.text-success { color: var(--ok) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warn) !important; }
.text-primary { color: var(--accent) !important; }
hr { border-color: var(--border); opacity: 1; }

/* Barras de rolagem discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Botões */
.btn { font-size: .825rem; padding: .42rem .8rem; font-weight: 550; border-radius: var(--radius-sm); transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { font-size: .775rem; padding: .28rem .6rem; }
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-disabled-color: #fff;
  --bs-btn-bg: #4f46e5; --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-bg: #4f46e5; --bs-btn-disabled-border-color: transparent;
  background-image: var(--grad); background-size: 140% 100%; background-position: 0 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 6px 18px rgba(79, 70, 229, .32), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-light, .btn-outline-secondary {
  --bs-btn-bg: var(--surface); --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-bg: var(--surface-3); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-color: var(--faint); --bs-btn-disabled-border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent-ring); --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-color: var(--accent-text); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent-soft); --bs-btn-active-color: var(--accent-text); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: var(--danger-soft); --bs-btn-hover-bg: var(--danger-soft); --bs-btn-hover-color: var(--danger); --bs-btn-hover-border-color: var(--danger); }
.btn-danger { --bs-btn-bg: #e11d48; --bs-btn-border-color: #e11d48; --bs-btn-hover-bg: #be123c; --bs-btn-hover-border-color: #be123c; }
.btn-success { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-ghost:hover, .btn-ghost:focus-visible { background: var(--surface-3); color: var(--text); }
.btn-whatsapp { --bs-btn-bg: var(--wa); --bs-btn-border-color: var(--wa); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--wa-hover); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--wa-hover); --bs-btn-active-bg: var(--wa-hover); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: var(--wa); --bs-btn-disabled-color: #fff; box-shadow: 0 1px 2px rgba(22, 163, 74, .25); }
.btn-whatsapp:hover { box-shadow: 0 6px 16px rgba(22, 163, 74, .3); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring) !important; }
.btn-close { filter: none; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Formulários */
.form-control, .form-select {
  font-size: .85rem; border-color: var(--border-strong); background-color: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.form-control::placeholder { color: var(--faint); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background-color: var(--surface); color: var(--text); }
.form-control:disabled, .form-select:disabled { background-color: var(--surface-2); }
.form-check-input { border-color: var(--border-strong); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }
.form-label { font-size: .76rem; font-weight: 550; color: var(--muted); margin-bottom: .3rem; }
.form-text { font-size: .75rem; color: var(--faint); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }
[data-bs-theme="dark"] .form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2398a3ba' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }

/* ---------- Barra lateral (escura nos dois temas) */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1030;
  display: flex; flex-direction: column;
  color: #a9b3c7;
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(99, 102, 241, .22) 0%, transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(6, 182, 212, .12) 0%, transparent 60%),
    linear-gradient(180deg, #0b1122 0%, #070b16 100%);
  border-right: 1px solid rgba(148, 163, 184, .10);
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 40%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 40%);
}
.sidebar > * { position: relative; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.02em; }
.sidebar .brand { height: var(--topbar-h); padding: 0 1.1rem; font-size: 1rem; color: #fff; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad); color: #fff;
  display: inline-grid; place-items: center; font-size: .8rem; font-weight: 800; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 4px 14px rgba(79, 70, 229, .45);
}
.sidebar nav { padding: .5rem .65rem; flex: 1; overflow-y: auto; scrollbar-color: rgba(148, 163, 184, .2) transparent; }
.sidebar nav a {
  position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; margin-bottom: 2px;
  border-radius: 8px; color: #a9b3c7; font-weight: 500; font-size: .845rem; transition: background-color .15s, color .15s;
}
.sidebar nav a i { font-size: 1.02rem; color: #6f7b95; width: 18px; text-align: center; transition: color .15s; }
.sidebar nav a:hover { background: rgba(148, 163, 184, .08); color: #e5e9f2; }
.sidebar nav a:hover i { color: #c7d0e0; }
.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, .28) 0%, rgba(99, 102, 241, .06) 100%);
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .18);
}
.sidebar nav a.active::before {
  content: ""; position: absolute; left: -.65rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #818cf8, #22d3ee); box-shadow: 0 0 12px rgba(34, 211, 238, .6);
}
.sidebar nav a.active i { color: #67e8f9; }
.sidebar nav .sep { height: 1px; background: rgba(148, 163, 184, .10); margin: .6rem .4rem; }
.sidebar .count {
  margin-left: auto; font-size: .68rem; font-weight: 700; color: #fff; border-radius: 999px; padding: 0 .45rem; line-height: 1.25rem;
  background: #e11d48; box-shadow: 0 0 10px rgba(225, 29, 72, .45); font-family: var(--font-mono);
}
.sidebar .count.count-wa { background: #16a34a; box-shadow: 0 0 10px rgba(34, 197, 94, .45); }
.sidebar .foot { border-top: 1px solid rgba(148, 163, 184, .10); padding: .7rem .8rem; display: flex; align-items: center; gap: .6rem; }
.foot-avatar { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #e0e7ff; background: rgba(99, 102, 241, .22); box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .3); }
.foot-name { flex: 1; min-width: 0; color: #e5e9f2; font-size: .8rem; font-weight: 550; line-height: 1.2; }
.foot-name small { color: #6f7b95; font-weight: 400; font-size: .7rem; }
.sidebar .foot .btn-ghost { color: #8a95ab; }
.sidebar .foot .btn-ghost:hover { background: rgba(148, 163, 184, .1); color: #fff; }

/* ---------- Estrutura */
.main { min-height: 100vh; }
@media (min-width: 992px) { .main { margin-left: var(--sidebar-w); } }

.topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
  background: var(--glass); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .6rem; padding: 0 1.25rem;
}
.topbar .brand-mark { width: 30px; height: 30px; }
.topbar .search { position: relative; flex: 1; max-width: 560px; }
.topbar .search input {
  height: 38px; padding-left: 2.2rem; padding-right: 3.6rem; border-radius: 10px;
  background: var(--surface-2); border-color: var(--border);
}
.topbar .search input:focus { background: var(--surface); }
.topbar .search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--faint); z-index: 1; }
.search-kbd {
  position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: .08rem .38rem;
}
.topbar .search input:focus ~ .search-kbd { opacity: 0; }
.topbar .btn-primary { height: 38px; padding: 0 .9rem; border-radius: 10px; }
.theme-toggle { width: 38px; height: 38px; padding: 0; border-radius: 10px; font-size: 1.05rem; margin-left: auto; }
.theme-ico-light { display: none; }
[data-bs-theme="dark"] .theme-ico-light { display: inline; }
[data-bs-theme="dark"] .theme-ico-dark { display: none; }

.content { padding: 1.5rem 1.75rem 2rem; max-width: 1440px; }
@media (max-width: 991.98px) {
  .topbar { padding: 0 .75rem; }
  .content { padding: 1rem .8rem 5.75rem; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .sub { color: var(--muted); font-size: .84rem; margin-top: .3rem; }

/* Navegação inferior (mobile) */
.bottom-nav {
  position: fixed; inset: auto 0 0 0; height: 62px; z-index: 1030;
  background: var(--glass); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .66rem; font-weight: 550; position: relative; text-decoration: none !important; }
.bottom-nav a i { font-size: 1.2rem; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--grad); }
.bottom-nav .dot { position: absolute; top: 9px; right: calc(50% - 17px); width: 8px; height: 8px; background: var(--danger); border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.bottom-nav .dot.dot-wa { background: var(--wa); }
.offcanvas { background: var(--surface); color: var(--text); border-color: var(--border) !important; }
.offcanvas-bottom { border-radius: 16px 16px 0 0; }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--border); --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-action-hover-color: var(--text); --bs-list-group-action-active-bg: var(--surface-3); }

/* ---------- Superfícies */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.panel-body { padding: 1rem; }
.panel + .panel { margin-top: 1rem; }
.empty { color: var(--faint); padding: 1.6rem 1rem; text-align: center; font-size: .825rem; }
.card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--border); border-radius: var(--radius-lg); }

/* Linhas de lista */
.rows > .row-item { display: flex; gap: .85rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background-color .12s; }
.rows > .row-item:hover { background: var(--surface-2); }
.rows > .row-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.row-item .when { width: 52px; flex-shrink: 0; font-family: var(--font-mono); font-weight: 600; font-size: .8rem; color: var(--text); padding-top: 2px; }
.row-item .when.late { color: var(--danger); }
.row-item .body { flex: 1; min-width: 0; }
.row-item .title { font-weight: 600; color: var(--text); }
.row-item .meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.row-item .actions { display: flex; gap: .35rem; flex-shrink: 0; align-items: center; }
@media (max-width: 575.98px) {
  .row-item { flex-wrap: wrap; }
  .row-item .actions { width: 100%; padding-left: calc(52px + .85rem); }
  .row-item .actions .btn { flex: 1; }
}
.type-tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Tabelas */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); --bs-table-striped-bg: var(--surface-2); margin: 0; font-size: .84rem; }
.table > :not(caption) > * > * { padding: .65rem .9rem; border-color: var(--border); }
.table thead th { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tbody tr { transition: background-color .12s; }
.table-hover tbody tr:hover > * { background: var(--surface-2); }
.table td a.list-link { color: var(--text); font-weight: 550; }
.table td a.list-link:hover { color: var(--accent); }
.panel > .table-responsive:first-child .table thead th:first-child, .panel > .table:first-child thead th:first-child { border-top-left-radius: var(--radius-lg); }
.panel > .table-responsive:first-child .table thead th:last-child, .panel > .table:first-child thead th:last-child { border-top-right-radius: var(--radius-lg); }

/* ---------- Badges */
.badge-soft { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; padding: .18rem .5rem; border-radius: 6px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.temp-quente { background: var(--danger-soft); color: var(--danger); }
.temp-morno { background: var(--warn-soft); color: var(--warn); }
.temp-frio { background: rgba(59, 130, 246, .11); color: #3b82f6; }
[data-bs-theme="dark"] .temp-frio { color: #7cb4ff; }
.st-won { background: var(--ok-soft); color: var(--ok); }
.st-lost { background: var(--surface-3); color: var(--faint); }
.prio-alta { color: var(--danger); }
.badge-late { background: var(--danger-soft); color: var(--danger); }
.badge.text-bg-light { background: var(--surface-3) !important; color: var(--muted) !important; }

/* ---------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.kpis.k6 { grid-template-columns: repeat(6, 1fr); }
.kpi {
  position: relative; overflow: hidden; display: block; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .9rem 1rem .85rem; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--grad); opacity: .0; transition: opacity .15s; }
a.kpi:hover { border-color: var(--accent-ring); box-shadow: var(--shadow-md); transform: translateY(-1px); color: inherit; }
a.kpi:hover::before { opacity: 1; }
.kpi .v { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; color: var(--text); }
.kpi .l { color: var(--muted); font-size: .74rem; font-weight: 500; margin-top: .2rem; }
.kpi .v.is-alert { color: var(--danger); }
@media (max-width: 1199.98px) { .kpis.k6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767.98px) { .kpis, .kpis.k6 { grid-template-columns: repeat(2, 1fr); gap: .5rem; } .kpi .v { font-size: 1.3rem; } }

/* ---------- Chips */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .24rem .7rem; font-size: .76rem; font-weight: 550; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--accent-ring); color: var(--accent-text); }
.chip.active { border-color: transparent; color: #fff; background: var(--grad); box-shadow: 0 2px 10px rgba(79, 70, 229, .3); }
.chip .n { color: var(--faint); margin-left: .25rem; font-family: var(--font-mono); font-size: .7rem; }
.chip.active .n { color: rgba(255, 255, 255, .8); }

/* ---------- Detalhe (contato / oportunidade) */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } .detail-grid > aside { order: -1; } }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: .45rem .75rem; font-size: .84rem; margin: 0; }
.facts dt { color: var(--muted); font-weight: 400; }
.facts dd { margin: 0; word-break: break-word; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: inline-grid; place-items: center;
  font-weight: 650; font-size: .85rem; color: var(--accent-text);
  background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(6, 182, 212, .14));
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.next-action { position: relative; border: 1px solid var(--accent-ring); background: var(--accent-soft); padding: .7rem .85rem .7rem 1rem; border-radius: var(--radius); overflow: hidden; }
.next-action::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.next-action.missing { border-color: var(--danger-soft); background: var(--danger-soft); }
.next-action.missing::before { background: var(--danger); }

/* ---------- Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--muted); font-size: .85rem; }
.timeline .ico.wa-in { background: rgba(34, 197, 94, .12); color: var(--wa); }
.timeline .ico.wa-out { background: var(--accent-soft); color: var(--accent); }
.timeline .ico.ai { background: var(--ai-soft); color: var(--ai); }
.timeline .ico.stage { background: var(--warn-soft); color: var(--warn); }
.timeline .ico.done { background: var(--ok-soft); color: var(--ok); }
.timeline .tl-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-label { font-weight: 600; font-size: .8rem; }
.timeline .tl-time { color: var(--faint); font-size: .72rem; margin-left: auto; white-space: nowrap; font-family: var(--font-mono); }
.timeline .tl-body { margin-top: .15rem; white-space: pre-wrap; word-break: break-word; }
.timeline .msg { display: inline-block; max-width: 100%; padding: .45rem .65rem; border-radius: 10px; background: var(--surface-3); margin-top: .25rem; white-space: pre-wrap; word-break: break-word; }
.timeline .msg.out { background: var(--accent-soft); }

/* ---------- IA */
.ai-box { position: relative; border: 1px solid var(--ai-border); background: linear-gradient(180deg, var(--ai-soft), transparent 70%), var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.ai-box::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, #8b5cf6, #6366f1, #06b6d4); }
.ai-box .panel-head { border-color: var(--ai-border); }
.ai-label { display: inline-flex; align-items: center; gap: .3rem; font-weight: 650; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; background: linear-gradient(90deg, #8b5cf6, #6366f1); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-bs-theme="dark"] .ai-label { background-image: linear-gradient(90deg, #c4b5fd, #a5b4fc); }
.ai-suggestion { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem .8rem; }

/* ---------- Kanban */
.board { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: .85rem; align-items: flex-start; scroll-snap-type: x proximity; }
.kcol { width: 280px; flex-shrink: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 180px); scroll-snap-align: start; }
[data-bs-theme="dark"] .kcol { background: rgba(17, 26, 46, .7); }
.col-head { padding: .75rem .8rem .5rem; }
.col-head .name { font-weight: 650; font-size: .82rem; letter-spacing: -.005em; }
.col-head .sum { color: var(--muted); font-size: .72rem; font-family: var(--font-mono); }
.col-body { padding: 0 .5rem .55rem; overflow-y: auto; min-height: 60px; flex: 1; }
.kcard {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .65rem .7rem; margin-bottom: .5rem;
  color: var(--text); cursor: grab; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kcard:hover { border-color: var(--accent-ring); box-shadow: var(--shadow-md); color: var(--text); transform: translateY(-1px); }
.kcard .k-title { font-weight: 600; font-size: .82rem; line-height: 1.3; }
.kcard .k-sub { color: var(--muted); font-size: .75rem; }
.kcard .k-row { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .4rem; font-size: .76rem; }
.kcard .k-row .tabular, .kcard .k-row strong { font-family: var(--font-mono); font-size: .74rem; }
.kcard .k-next { margin-top: .4rem; font-size: .74rem; color: var(--muted); border-top: 1px dashed var(--border-strong); padding-top: .35rem; }
.kcard .k-next.missing, .kcard .k-next.late { color: var(--danger); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--accent-ring), var(--shadow-lg) !important; }
.lane { margin-bottom: 1.25rem; }
.lane-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.side-lanes .kcol { background: var(--surface-2); }
@media (max-width: 767.98px) { .kcol { width: 84vw; max-height: none; } }

/* ---------- Funil */
.funnel-row { display: grid; grid-template-columns: 130px 1fr 52px; gap: .7rem; align-items: center; padding: .35rem 0; font-size: .82rem; }
.funnel-bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--grad); border-radius: 999px; box-shadow: 0 0 12px rgba(59, 130, 246, .35); }
.funnel-row .pct { color: var(--faint); font-size: .7rem; font-family: var(--font-mono); text-align: right; }

/* ---------- Autocomplete */
.ac-wrap { position: relative; }
.ac-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1060; max-height: 340px; overflow-y: auto; display: none; padding: .3rem; }
.ac-menu.show { display: block; }
.ac-item { display: block; padding: .5rem .65rem; color: var(--text); cursor: pointer; border-radius: 7px; }
.ac-item:hover, .ac-item.active { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.ac-item .sub { color: var(--muted); font-size: .75rem; }
.ac-item .kind { float: right; font-size: .64rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------- Componentes do Bootstrap */
.dropdown-menu {
  --bs-dropdown-bg: var(--surface); --bs-dropdown-color: var(--text); --bs-dropdown-border-color: var(--border);
  --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-link-active-bg: var(--accent-soft); --bs-dropdown-link-active-color: var(--accent-text);
  --bs-dropdown-header-color: var(--faint); --bs-dropdown-divider-bg: var(--border);
  font-size: .84rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem;
}
.dropdown-item { border-radius: 7px; padding: .42rem .65rem; }
.dropdown-item i { color: var(--muted); }
.dropdown-header { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.modal { --bs-modal-bg: var(--surface); --bs-modal-color: var(--text); --bs-modal-border-color: var(--border); }
.modal-backdrop { --bs-backdrop-bg: #020617; --bs-backdrop-opacity: .55; }
.modal-backdrop.show { backdrop-filter: blur(3px); }
.modal-content { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); padding: .9rem 1.1rem; }
.modal-body { padding: 1.1rem; }
.modal-title { font-size: 1rem; font-weight: 650; letter-spacing: -.01em; }
.nav-tabs { border-color: var(--border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { color: var(--muted); font-weight: 550; font-size: .84rem; border: 0; border-bottom: 2px solid transparent; padding: .55rem .8rem; }
.nav-tabs .nav-link:hover { color: var(--text); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--text); background: transparent; border-bottom: 2px solid transparent; border-image: var(--grad) 1; }
.nav-tabs .nav-item { white-space: nowrap; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--accent); }
.alert { border-radius: var(--radius); border-width: 1px; }
.alert-success { --bs-alert-bg: var(--ok-soft); --bs-alert-color: var(--ok); --bs-alert-border-color: rgba(5, 150, 105, .25); }
.alert-danger { --bs-alert-bg: var(--danger-soft); --bs-alert-color: var(--danger); --bs-alert-border-color: rgba(225, 29, 72, .25); }
.alert-warning { --bs-alert-bg: var(--warn-soft); --bs-alert-color: var(--warn); --bs-alert-border-color: rgba(234, 88, 12, .25); }
.alert-info { --bs-alert-bg: var(--accent-soft); --bs-alert-color: var(--accent-text); --bs-alert-border-color: var(--accent-ring); }
.flash { margin-bottom: 1rem; font-size: .85rem; padding: .7rem 1rem; box-shadow: var(--shadow-md); backdrop-filter: blur(8px); }
.flash.position-fixed { border-radius: 12px; }
.progress { background: var(--surface-3); }
.progress-bar { background-image: var(--grad); }
.code, code { font-family: var(--font-mono); font-size: .76rem; }
.code { background: var(--surface-3); color: var(--text); padding: .15rem .4rem; border-radius: 6px; word-break: break-all; border: 1px solid var(--border); }
kbd { font-family: var(--font-mono); }
.spinner-border-sm { width: .9rem; height: .9rem; border-width: .15em; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 35%); padding: 1rem 0 .75rem; }
@media (max-width: 991.98px) { .sticky-actions { bottom: 62px; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min-w-0 { min-width: 0; }
.bg-light { background-color: var(--surface-2) !important; }
.bg-white { background-color: var(--surface) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }

/* ---------- Login / primeiro acesso */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(99, 102, 241, .20) 0%, transparent 60%),
    radial-gradient(50% 45% at 90% 90%, rgba(6, 182, 212, .16) 0%, transparent 60%),
    var(--bg);
}
.auth-body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 0%, transparent 75%);
}
.auth-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .panel { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-lg); padding: 1.75rem !important; border-radius: 18px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .btn-primary { height: 42px; font-size: .9rem; }
.auth-brand { display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; color: var(--text); font-size: 1.1rem; text-decoration: none !important; }
.auth-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: .95rem; }
.auth-theme { position: fixed; top: 1rem; right: 1rem; }

/* ---------- Tarefas gerais (to-do) */
.todo-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); color: transparent; display: grid; place-items: center; padding: 0; margin-top: 1px; font-size: .8rem; transition: all .15s; }
.todo-check:hover { border-color: var(--ok); color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.row-item.todo .title { font-weight: 500; }
.row-item.todo.is-done .title { text-decoration: line-through; color: var(--faint); }
.row-item.todo.is-done .todo-check { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 575.98px) { .row-item.todo { flex-wrap: nowrap; } .row-item.todo .actions { width: auto; padding-left: 0; } }

/* =====================================================================
   WhatsApp (tela /whatsapp)
   ===================================================================== */
.content.content-full { max-width: none; padding: 0; }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; border-radius: 10px; }

.wa { display: flex; height: calc(100vh - var(--topbar-h)); background: var(--surface); overflow: hidden; }
.wa-list { width: 350px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.wa-list-head { padding: 1rem 1rem .7rem; border-bottom: 1px solid var(--border); }
.wa-search { position: relative; }
.wa-search i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.wa-search input { padding-left: 2rem; background: var(--surface-2); border-color: var(--border); border-radius: 10px; }
.wa-warning { background: var(--warn-soft); color: var(--warn); padding: .55rem 1rem; border-bottom: 1px solid var(--border); }
.wa-items { flex: 1; overflow-y: auto; padding: .35rem; }
.wa-item { position: relative; display: flex; gap: .7rem; padding: .65rem .7rem; border-radius: 10px; cursor: pointer; color: var(--text); margin-bottom: 2px; transition: background-color .12s; }
.wa-item:hover { background: var(--surface-2); }
.wa-item.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.wa-item .avatar { width: 42px; height: 42px; font-size: .82rem; }
.wa-item-body { flex: 1; min-width: 0; }
.wa-item-top, .wa-item-bottom { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.wa-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item-time { font-size: .68rem; color: var(--faint); flex-shrink: 0; font-family: var(--font-mono); }
.wa-item-time.unread { color: var(--wa); font-weight: 600; }
.wa-item-msg { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-badge { background: var(--wa); color: #fff; border-radius: 999px; min-width: 19px; height: 19px; font-size: .66rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; flex-shrink: 0; font-family: var(--font-mono); box-shadow: 0 0 10px rgba(34, 197, 94, .4); }

.wa-thread {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--chat-dot) 1px, transparent 1px);
  background-size: 18px 18px;
}
.wa-empty { margin: auto; text-align: center; color: var(--muted); padding: 2rem; }
.wa-empty > i { font-size: 3rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wa-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wa-chat-head { display: flex; align-items: center; gap: .65rem; padding: .6rem 1rem; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.wa-back { display: none; }
.wa-messages { flex: 1; overflow-y: auto; padding: 1rem 6%; }
.wa-day { text-align: center; margin: .8rem 0 .55rem; }
.wa-day span { background: var(--surface); color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .03em; padding: .22rem .7rem; border-radius: 999px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.wa-row { display: flex; margin-bottom: 3px; }
.wa-row.out { justify-content: flex-end; }
.wa-row.first { margin-top: 9px; }
.wa-bubble { max-width: 68%; background: var(--bubble-in); color: var(--text); border-radius: 12px; padding: .4rem .6rem .28rem; box-shadow: var(--shadow-sm); white-space: pre-wrap; word-wrap: break-word; font-size: .875rem; line-height: 1.4; border: 1px solid var(--border); }
.wa-row.in.first .wa-bubble { border-top-left-radius: 4px; }
.wa-row.out .wa-bubble { background: var(--bubble-out); border-color: transparent; }
.wa-row.out.first .wa-bubble { border-top-right-radius: 4px; }
.wa-bubble .wa-meta { float: right; margin: .4rem 0 -.15rem .6rem; font-size: .64rem; color: var(--bubble-meta); display: inline-flex; gap: 3px; align-items: center; font-family: var(--font-mono); }
.wa-bubble .wa-meta .bi-check2 { color: var(--bubble-meta); }
.wa-bubble .wa-origin { font-size: .58rem; font-weight: 700; letter-spacing: .05em; color: var(--accent-text); background: var(--accent-soft); padding: 0 .3rem; border-radius: 4px; margin-right: 3px; font-family: var(--font-sans); }
.wa-numtag { display: none; font-size: .6rem; margin-bottom: 2px; }
.wa-multi .wa-numtag { display: table; }
.wa-bubble.media { font-style: italic; color: var(--muted); }
.wa-bubble.pending { opacity: .6; }
.wa-bubble.has-media { font-style: normal; color: inherit; padding: .28rem .28rem .22rem; }
.wa-bubble.has-media .wa-caption { display: block; padding: .3rem .35rem 0; }
.wa-bubble.has-media .wa-meta { margin-right: .35rem; }
.wa-media-img { display: block; max-width: 100%; width: 280px; max-height: 320px; object-fit: cover; border-radius: 9px; background: var(--surface-3); cursor: zoom-in; }
.wa-media-video { display: block; max-width: 100%; width: 300px; max-height: 360px; border-radius: 9px; background: #000; }
.wa-media-preview video { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; display: block; }
.wa-media-audio { display: block; width: 260px; max-width: 100%; height: 40px; }
[data-bs-theme="dark"] .wa-media-audio { color-scheme: dark; }
.wa-media-missing { font-style: italic; color: var(--bubble-meta); padding: .25rem .35rem; display: block; }
.wa-media-preview img { max-width: 100%; max-height: 50vh; display: block; margin: 0 auto; border-radius: 10px; }
.wa-media-preview audio { width: 100%; }
.wa-doc { display: flex; align-items: center; gap: .65rem; min-width: 220px; max-width: 300px; padding: .6rem .65rem; border-radius: 9px; background: rgba(127, 140, 160, .10); color: var(--text); text-decoration: none !important; font-style: normal; border: 1px solid var(--border); }
.wa-doc:hover { background: rgba(127, 140, 160, .16); color: var(--text); }
.wa-doc .bi-file-earmark-pdf-fill, .wa-doc .bi-file-earmark { font-size: 1.8rem; color: #ef4444; flex-shrink: 0; }
.wa-doc-text { min-width: 0; }
.wa-doc-name { font-size: .85rem; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.wa-doc-sub { font-size: .68rem; color: var(--bubble-meta); display: block; }
.wa-doc .bi-download { margin-left: auto; color: var(--muted); }
.wa-media-preview .wa-doc { max-width: none; }

.wa-composer { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: .65rem 1rem; border-top: 1px solid var(--border); }
.wa-composer-row { display: flex; align-items: flex-end; gap: .4rem; }
.wa-composer textarea { scrollbar-width: none; resize: none; max-height: 160px; border-color: var(--border); border-radius: 12px; background: var(--surface); padding: .5rem .8rem; }
.wa-send { border-radius: 12px; width: 40px; height: 40px; padding: 0; flex-shrink: 0; }
.wa-ai-btn { color: var(--ai); font-size: 1.12rem; width: 38px; height: 38px; padding: 0; border-radius: 10px; }
.wa-ai-btn:hover { background: var(--ai-soft); color: var(--ai); }
.wa-ai-btn.wa-tool-btn { color: var(--muted); }
.wa-ai-btn.wa-tool-btn:hover { background: var(--surface-3); color: var(--text); }
.wa-ai-btn.wa-tool-btn.recording { color: var(--danger); }
.wa-clock-btn { color: var(--warn); }
.wa-clock-btn:hover { background: var(--warn-soft); color: var(--warn); }
.wa-undo { font-size: .75rem; color: var(--ai); margin-bottom: .35rem; }
.wa-recording { display: flex; align-items: center; gap: .5rem; }
.wa-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: wa-blink 1s infinite; }
.wa-rec-time { font-family: var(--font-mono); font-weight: 600; }
@keyframes wa-blink { 50% { opacity: .25; } }

.wa-side { width: 350px; flex-shrink: 0; border-left: 1px solid var(--border); overflow-y: auto; background: var(--surface); }
.wa.side-hidden .wa-side { display: none; }
.wa-side-head { padding: 1rem; border-bottom: 1px solid var(--border); position: relative; }
.wa-side-close { position: absolute; right: .5rem; top: .5rem; display: none; }
.wa-side-section { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.facts.facts-sm { grid-template-columns: 96px 1fr; font-size: .78rem; gap: .25rem .5rem; }
.wa-ai-log { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .55rem; }
.wa-ai-msg { font-size: .82rem; padding: .5rem .65rem; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.wa-ai-msg.user { background: var(--grad); color: #fff; align-self: flex-end; max-width: 90%; border-bottom-right-radius: 4px; }
.wa-ai-msg.ai { background: var(--ai-soft); border: 1px solid var(--ai-border); border-bottom-left-radius: 4px; }
.wa-ai-msg .wa-ai-suggest { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .45rem .55rem; margin-top: .45rem; }
.wa-ai-chat [data-ai-quick] .chip { font-size: .72rem; text-align: left; }
.wa-ai-chat [data-ai-quick] .chip:hover { border-color: var(--ai-border); color: var(--ai); background: var(--ai-soft); }
.wa-ai-chat textarea { resize: none; }

@media (max-width: 1279.98px) {
  .wa-side { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; z-index: 1025; box-shadow: var(--shadow-lg); }
  .wa:not(.side-open) .wa-side { display: none; }
  .wa-side-close { display: inline-block; }
}
@media (max-width: 991.98px) {
  .wa { height: calc(100vh - var(--topbar-h) - 62px); height: calc(100dvh - var(--topbar-h) - 62px); }
  .wa-side { bottom: 62px; width: 100%; }
}
@media (max-width: 767.98px) {
  .wa-list { width: 100%; border-right: 0; }
  .wa-thread { display: none; }
  .wa.show-thread .wa-list { display: none; }
  .wa.show-thread .wa-thread { display: flex; }
  .wa-back { display: inline-block; }
  .wa-messages { padding: .75rem 3%; }
  .wa-bubble { max-width: 85%; }
  .wa-composer { padding: .5rem .6rem; }
}

/* QR Code do WhatsApp (fundo branco sempre: o QR precisa de contraste) */
.qr-box { width: 236px; height: 236px; margin: 0 auto; border: 1px solid var(--border); border-radius: 14px; display: grid; place-items: center; background: #fff; box-shadow: var(--shadow-md); }
.qr-box img { display: block; }
.qr-box .bi-check-circle-fill { color: #16a34a !important; }

/* ---------- Grupos de contato (cores funcionam no claro e no escuro) */
.grp { --c: #64748b; display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; padding: .14rem .55rem; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 82%, var(--text)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
.grp-blue { --c: #3b82f6; }
.grp-green { --c: #16a34a; }
.grp-purple { --c: #8b5cf6; }
.grp-orange { --c: #ea580c; }
.grp-red { --c: #e11d48; }
.grp-teal { --c: #0d9488; }
.grp-pink { --c: #db2777; }
.grp-gray { --c: #64748b; }
[data-bs-theme="dark"] .grp { color: color-mix(in srgb, var(--c) 55%, #fff); }

/* Observações do contato */
.notes-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.notes-textarea { font-size: .9rem; line-height: 1.55; }

/* Mensagens programadas (conversa do WhatsApp) */
.wa-scheduled { display: flex; flex-direction: column; gap: 4px; margin-bottom: .5rem; }
.wa-sched-item { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .32rem .65rem; font-size: .8rem; box-shadow: var(--shadow-sm); }
.wa-sched-item > i { color: var(--warn); }
.wa-sched-done > i { color: inherit; }
.wa-sched-when { font-weight: 600; white-space: nowrap; font-family: var(--font-mono); font-size: .74rem; }
.wa-sched-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* ---------- Seletor de emojis (public/js/emoji.js) */
.emoji-panel { position: fixed; z-index: 1090; width: min(340px, calc(100vw - 16px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden; }
.emoji-panel.show { display: flex; }
.emoji-search { position: relative; padding: .55rem .55rem .4rem; }
.emoji-search .bi { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-40%); color: var(--faint); font-size: .85rem; }
.emoji-search input { width: 100%; border: 1px solid var(--border-strong); border-radius: 9px; padding: .4rem .6rem .4rem 1.95rem; font-size: .85rem; outline: none; background: var(--surface-2); color: var(--text); }
.emoji-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
.emoji-tabs { display: flex; gap: 2px; padding: 0 .45rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.emoji-tabs button { border: 0; background: none; color: var(--faint); padding: .38rem .48rem; border-bottom: 2px solid transparent; font-size: .95rem; flex-shrink: 0; }
.emoji-tabs button:hover { color: var(--text); }
.emoji-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.emoji-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: .5rem .75rem .15rem; font-weight: 650; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: .2rem .5rem .55rem; height: 220px; overflow-y: auto; align-content: start; }
.emoji-grid button { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: .3rem 0; border-radius: 8px; cursor: pointer; transition: background-color .1s, transform .1s; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--surface-3); outline: none; transform: scale(1.12); }
.emoji-empty { grid-column: 1 / -1; color: var(--faint); font-size: .8rem; padding: 1rem .3rem; text-align: center; }
[data-emoji-for].active { color: var(--accent) !important; background: var(--accent-soft) !important; }

/* ---------- Acessibilidade: menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.wa-composer textarea::-webkit-scrollbar { display: none; }
